emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r114124: Merge: Some fixes for vc-ignore.


From: Xue Fuqiao
Subject: [Emacs-diffs] trunk r114124: Merge: Some fixes for vc-ignore.
Date: Wed, 04 Sep 2013 00:42:12 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 114124 [merge]
revision-id: address@hidden
parent: address@hidden
parent: address@hidden
committer: Xue Fuqiao <address@hidden>
branch nick: trunk
timestamp: Wed 2013-09-04 08:41:58 +0800
message:
  Merge: Some fixes for vc-ignore.
modified:
  doc/emacs/ChangeLog            changelog-20091113204419-o5vbwnq5f7feedwu-6227
  doc/emacs/maintaining.texi     
maintaining.texi-20091113204419-o5vbwnq5f7feedwu-6262
  etc/NEWS                       news-20100311060928-aoit31wvzf25yr1z-1
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/vc/vc-bzr.el              vcbzr.el-20091113204419-o5vbwnq5f7feedwu-5055
  lisp/vc/vc-git.el              vcgit.el-20091113204419-o5vbwnq5f7feedwu-5070
  lisp/vc/vc-hg.el               vchg.el-20091113204419-o5vbwnq5f7feedwu-5062
  lisp/vc/vc-svn.el              vcsvn.el-20091113204419-o5vbwnq5f7feedwu-2575
  lisp/vc/vc.el                  vc.el-20091113204419-o5vbwnq5f7feedwu-502
=== modified file 'doc/emacs/ChangeLog'
--- a/doc/emacs/ChangeLog       2013-08-31 19:49:52 +0000
+++ b/doc/emacs/ChangeLog       2013-09-04 00:39:34 +0000
@@ -1,3 +1,7 @@
+2013-09-04  Xue Fuqiao  <address@hidden>
+
+       * maintaining.texi (VC Ignore): Mention `vc-ignore' with prefix 
argument.
+
 2013-08-31  Ulrich Müller  <address@hidden>
 
        * xresources.texi (Motif Resources):

=== modified file 'doc/emacs/maintaining.texi'
--- a/doc/emacs/maintaining.texi        2013-07-30 22:27:47 +0000
+++ b/doc/emacs/maintaining.texi        2013-09-04 00:31:13 +0000
@@ -1043,12 +1043,14 @@
 
 @kindex C-x v G
 @findex vc-ignore
-  Many source trees contain some files that do not need to be versioned,
-such as editor backups, object or bytecode files, and built programs.
-You can simply not add them, but then they’ll always crop up as
-unknown files.  You can also tell the version control system to ignore
-these files by adding them to the ignore file at the top of the tree.
address@hidden v G} (@code{vc-ignore}) can help you do this.
+  Many source trees contain some files that do not need to be
+versioned, such as editor backups, object or bytecode files, and built
+programs.  You can simply not add them, but then they’ll always crop
+up as unknown files.  You can also tell the version control system to
+ignore these files by adding them to the ignore file at the top of the
+tree.  @kbd{C-x v G} (@code{vc-ignore}) can help you do this.  When
+called with a prefix argument, you can remove a file from the ignored
+file list.
 
 @node VC Directory Mode
 @subsection VC Directory Mode

=== modified file 'etc/NEWS'
--- a/etc/NEWS  2013-08-31 18:26:59 +0000
+++ b/etc/NEWS  2013-09-04 00:39:34 +0000
@@ -262,8 +262,9 @@
 *** In VC directory mode, `L' lists the change log for the current VC
 controlled tree in a window.
 
-*** `C-x v G' (globally) and `G' (in VC directory mode) ignores a
-file under current version control system.
+*** `C-x v G' (globally) and `G' (in VC directory mode) ignores a file
+under current version control system.  When called with a prefix
+argument, you can remove a file from the ignored file list.
 
 ** cl-lib
 

=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-09-03 20:14:58 +0000
+++ b/lisp/ChangeLog    2013-09-04 00:39:34 +0000
@@ -1,3 +1,14 @@
+2013-09-04  Xue Fuqiao  <address@hidden>
+
+       * vc/vc.el (vc-ignore): Rewrite.
+       (vc-default-ignore): New function.
+       (vc-default-ignore-completion-table): Use find-ignore-file.
+
+       * vc/vc-bzr.el (vc-bzr-ignore, vc-bzr-ignore-completion-table):
+       * vc/vc-git.el (vc-git-ignore, vc-git-ignore-completion-table):
+       * vc/vc-hg.el (vc-hg-ignore, vc-hg-ignore-completion-table):
+       Remove.  Most code moved to vc.el.
+
 2013-09-03  Stefan Monnier  <address@hidden>
 
        * net/tramp-gvfs.el (tramp-gvfs-mount-spec, tramp-synce-list-devices): 

=== modified file 'lisp/vc/vc-bzr.el'
--- a/lisp/vc/vc-bzr.el 2013-08-04 02:55:45 +0000
+++ b/lisp/vc/vc-bzr.el 2013-09-04 00:31:13 +0000
@@ -651,21 +651,6 @@
           (vc-bzr-command "cat" t 0 file "-r" rev)
         (vc-bzr-command "cat" t 0 file))))
 
-(defun vc-bzr-ignore (file &optional directory remove)
-  "Ignore FILE under Bazaar.
-If DIRECTORY is non-nil, the repository to use will be deduced by
-DIRECTORY; if REMOVE is non-nil, remove FILE from ignored files."
-  (if remove
-      (if directory
-         (vc--remove-regexp file (vc-bzr-find-ignore-file directory))
-       (vc--remove-regexp file
-                          (vc-bzr-find-ignore-file default-directory)))
-    (vc-bzr-command "ignore" t 0 file)))
-
-(defun vc-bzr-ignore-completion-table (file)
-  "Return the list of ignored files."
-  (vc--read-lines (vc-bzr-find-ignore-file file)))
-
 (defun vc-bzr-find-ignore-file (file)
   "Return the root directory of the repository of FILE."
   (expand-file-name ".bzrignore"

=== modified file 'lisp/vc/vc-git.el'
--- a/lisp/vc/vc-git.el 2013-09-03 18:28:06 +0000
+++ b/lisp/vc/vc-git.el 2013-09-04 00:39:34 +0000
@@ -687,22 +687,6 @@
      nil
      "cat-file" "blob" (concat (if rev rev "HEAD") ":" fullname))))
 
-(defun vc-git-ignore (file &optional directory remove)
-  "Ignore FILE under Git.
-If DIRECTORY is non-nil, the repository to use will be deduced by
-DIRECTORY; if REMOVE is non-nil, remove FILE from ignored files."
-  (let (gitignore)
-    (if directory
-       (setq gitignore (vc-git-find-ignore-file directory))
-      (setq gitignore (vc-git-find-ignore-file default-directory)))
-    (if remove
-       (vc--remove-regexp file gitignore)
-      (vc--add-line file gitignore))))
-
-(defun vc-git-ignore-completion-table (file)
-  "Return the list of ignored files."
-  (vc--read-lines (vc-git-find-ignore-file file)))
-
 (defun vc-git-find-ignore-file (file)
   "Return the root directory of the repository of FILE."
   (expand-file-name ".gitignore"

=== modified file 'lisp/vc/vc-hg.el'
--- a/lisp/vc/vc-hg.el  2013-08-04 02:55:45 +0000
+++ b/lisp/vc/vc-hg.el  2013-09-04 00:31:13 +0000
@@ -459,22 +459,6 @@
         (vc-hg-command buffer 0 file "cat" "-r" rev)
       (vc-hg-command buffer 0 file "cat"))))
 
-(defun vc-hg-ignore (file &optional directory remove)
-  "Ignore FILE under Mercurial.
-If DIRECTORY is non-nil, the repository to use will be deduced by
-DIRECTORY; if REMOVE is non-nil, remove FILE from ignored files."
-  (let (hgignore)
-    (if directory
-       (setq hgignore (vc-hg-find-ignore-file directory))
-      (setq hgignore (vc-hg-find-ignore-file default-directory)))
-    (if remove
-       (vc--remove-regexp file hgignore)
-      (vc--add-line file hgignore))))
-
-(defun vc-hg-ignore-completion-table (file)
-  "Return the list of ignored files."
-  (vc--read-lines (vc-hg-find-ignore-file file)))
-
 (defun vc-hg-find-ignore-file (file)
   "Return the root directory of the repository of FILE."
   (expand-file-name ".hgignore"

=== modified file 'lisp/vc/vc-svn.el'
--- a/lisp/vc/vc-svn.el 2013-08-04 02:55:45 +0000
+++ b/lisp/vc/vc-svn.el 2013-09-04 00:31:13 +0000
@@ -354,8 +354,7 @@
 
 (defun vc-svn-ignore (file &optional directory remove)
   "Ignore FILE under Subversion.
-If DIRECTORY is non-nil, the repository to use will be deduced by
-DIRECTORY; if REMOVE is non-nil, remove FILE from ignored files."
+FILE is a file wildcard, relative to the root directory of DIRECTORY."
   (vc-svn-command t 0 file "propedit" "svn:ignore"))
 
 (defun vc-svn-ignore-completion-table (file)

=== modified file 'lisp/vc/vc.el'
--- a/lisp/vc/vc.el     2013-08-06 09:38:41 +0000
+++ b/lisp/vc/vc.el     2013-09-04 00:39:34 +0000
@@ -497,11 +497,14 @@
 ;;   This function is used in `vc-stay-local-p' which backends can use
 ;;   for their convenience.
 ;;
-;; - ignore (file &optional remove)
+;; - ignore (file &optional directory)
 ;;
-;;   Ignore FILE under the current VCS.  When called interactively and
-;;   with a prefix argument, remove an ignored file.  When called from
-;;   Lisp code, if REMOVE is non-nil, remove FILE from ignored files."
+;;   Ignore FILE under the VCS of DIRECTORY (default is `default-directory').
+;;   FILE is a file wildcard.
+;;   When called interactively and with a prefix argument, remove FILE
+;;   from ignored files.
+;;   When called from Lisp code, if DIRECTORY is non-nil, the
+;;   repository to use will be deduced by DIRECTORY.
 ;;
 ;; - ignore-completion-table
 ;;
@@ -1342,33 +1345,44 @@
   (let ((vc-handled-backends (list backend)))
     (call-interactively 'vc-register)))
 
-(defun vc-ignore (file &optional directory remove)
+(defun vc-ignore (file &optional directory)
   "Ignore FILE under the VCS of DIRECTORY (default is `default-directory').
+FILE is a file wildcard.
 When called interactively and with a prefix argument, remove FILE
 from ignored files.
 When called from Lisp code, if DIRECTORY is non-nil, the
+repository to use will be deduced by DIRECTORY."
+  (interactive
+   (list (read-file-name "The file to ignore: ")
+        (completing-read
+         "The file to remove: "
+         (vc-call-backend
+          (vc-backend default-directory)
+          'ignore-completion-table default-directory))))
+  (let* ((directory (or directory default-directory))
+        (backend (vc-backend default-directory))
+        (remove current-prefix-arg))
+    (vc-call-backend backend 'ignore file directory remove)))
+
+(defun vc-default-ignore (backend file &optional directory remove)
+  "Ignore FILE under the VCS of DIRECTORY (default is `default-directory').
+FILE is a file wildcard, relative to the root directory of DIRECTORY.
+When called from Lisp code, if DIRECTORY is non-nil, the
 repository to use will be deduced by DIRECTORY; if REMOVE is
-non-nil, remove FILE from ignored files."
-  (interactive
-   (if (null current-prefix-arg)
-       (list (read-file-name "The file to ignore: "))
-     (list
-      (completing-read
-       "The file to remove: "
-       (vc-call-backend
-       (vc-backend default-directory)
-       'ignore-completion-table default-directory)))))
-  (let (backend)
-    (if directory
-       (progn (setq backend (vc-backend default-directory))
-              (vc-call-backend backend 'ignore file directory remove))
-      (setq backend (vc-backend directory))
-      (vc-call-backend backend 'ignore file default-directory remove))))
+non-nil, remove FILE from ignored files.
+Argument BACKEND is the backend you are using."
+  (let ((ignore
+        (vc-call-backend backend 'find-ignore-file (or directory 
default-directory)))
+       (pattern (file-relative-name
+                 (expand-file-name file) (file-name-directory file))))
+    (if remove
+       (vc--remove-regexp pattern ignore)
+      (vc--add-line pattern ignore))))
 
-(defun vc-default-ignore-completion-table (_file)
-  "Return the list of ignored files."
-  ;; Unused lexical argument `file'
-  nil)
+(defun vc-default-ignore-completion-table (backend file)
+  "Return the list of ignored files under BACKEND."
+  (vc--read-lines
+   (vc-call-backend backend 'find-ignore-file file)))
 
 (defun vc--read-lines (file)
   "Return a list of lines of FILE."


reply via email to

[Prev in Thread] Current Thread [Next in Thread]