* lisp/vc/vc.el (vc-ignore): Rewrite.
(vc-default-ignore): New function.
(vc-default-ignore-completion-table): Use find-ignore-file.
* lisp/vc/vc-bzr.el (vc-bzr-ignore, vc-bzr-ignore-completion-table):
* lisp/vc/vc-git.el (vc-git-ignore, vc-git-ignore-completion-table):
* lisp/vc/vc-hg.el (vc-hg-ignore, vc-hg-ignore-completion-table):
Remove. Most code moved to vc.el.
* doc/emacs/maintaining.texi (VC Ignore): Mention `vc-ignore' with prefix argument.
+2013-09-04 Xue Fuqiao <xfq.free@gmail.com>
+
+ * maintaining.texi (VC Ignore): Mention `vc-ignore' with prefix argument.
+
2013-07-31 Eli Zaretskii <eliz@gnu.org>
* emacs.texi (Top): Remove menu item for the removed "Disabling
@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.
-@kbd{C-x 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
*** 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
+2013-09-04 Xue Fuqiao <xfq.free@gmail.com>
+
+ * 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-08-04 Xue Fuqiao <xfq.free@gmail.com>
* vc/vc.el (vc-ignore): Rewrite.
(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"
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"
(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"
(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)
;; This function is used in `vc-stay-local-p' which backends can use
;; for their convenience.
;;
-;; - ignore (file &optional remove)
-;;
-;; 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 &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.
;;
;; - ignore-completion-table
;;
-;; Return the completion table for files ignored by the current
-;; version control system, e.g., the entries in `.gitignore' and
-;; `.bzrignore'.
+;; Return the completion table for files ignored by the version
+;; control system in `default-directory'.
;;
;; - previous-revision (file rev)
;;
(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; if REMOVE is
-non-nil, remove FILE from ignored files."
+repository to use will be deduced by DIRECTORY."
(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))))
-
-(defun vc-default-ignore-completion-table (file)
- "Return the list of ignored files."
- ;; Unused lexical argument `file'
- nil)
+ (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.
+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 (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."