* lisp/vc/vc.el (vc-ignore): New function.
* lisp/vc/vc-svn.el (vc-svn-ignore): New function.
* lisp/vc/vc-hg.el (vc-hg-ignore): New function.
* lisp/vc/vc-git.el (vc-git-ignore): New function.
* lisp/vc/vc-dir.el (vc-dir-mode-map): Add key binding for vc-dir-ignore
(vc-dir-ignore): New function.
* lisp/vc/vc-cvs.el (vc-cvs-ignore): New function.
(cvs-append-to-ignore): Moved from pcvs.el.
* lisp/vc/vc-bzr.el (vc-bzr-ignore): New function.
* lisp/vc/pcvs.el (vc-cvs): Require 'vc-cvs.
*** New variable `diary-from-outlook-function', used by the command
`diary-from-outlook'.
+** VC Directory Mode
+
+*** `D' displays diffs between VC-controlled whole tree revisions.
+*** `L' lists the change log for the current VC controlled tree in a window.
+*** `I' ignores the file under current version control system.
+
** cl-lib
*** New macro cl-tagbody.
+2013-07-30 Xue Fuqiao <xfq.free@gmail.com>
+
+ * vc/vc.el (vc-ignore): New function.
+
+ * vc/vc-svn.el (vc-svn-ignore): New function.
+
+ * vc/vc-hg.el (vc-hg-ignore): New function.
+
+ * vc/vc-git.el (vc-git-ignore): New function.
+
+ * vc/vc-dir.el (vc-dir-mode-map): Add key binding for vc-dir-ignore
+ (vc-dir-ignore): New function.
+
+ * vc/vc-cvs.el (vc-cvs-ignore): New function.
+ (cvs-append-to-ignore): Moved from pcvs.el.
+
+ * vc/vc-bzr.el (vc-bzr-ignore): New function.
+
+ * vc/pcvs.el (vc-cvs): Require 'vc-cvs.
+
2013-07-24 Juanma Barranquero <lekktu@gmail.com>
* desktop.el (desktop-restoring-frames-p): Return a true boolean.
(require 'pcvs-util)
(require 'pcvs-parse)
(require 'pcvs-info)
+(require 'vc-cvs)
\f
;;;;
(declare-function vc-editable-p "vc" (file))
(declare-function vc-checkout "vc" (file &optional writable rev))
-(defun cvs-append-to-ignore (dir str &optional old-dir)
- "Add STR to the .cvsignore file in DIR.
-If OLD-DIR is non-nil, then this is a directory that we don't want
-to hear about anymore."
- (with-current-buffer
- (find-file-noselect (expand-file-name ".cvsignore" dir))
- (when (ignore-errors
- (and buffer-read-only
- (eq 'CVS (vc-backend buffer-file-name))
- (not (vc-editable-p buffer-file-name))))
- ;; CVSREAD=on special case
- (vc-checkout buffer-file-name t))
- (goto-char (point-max))
- (unless (bolp) (insert "\n"))
- (insert str (if old-dir "/\n" "\n"))
- (if cvs-sort-ignore-file (sort-lines nil (point-min) (point-max)))
- (save-buffer)))
-
-
(defun cvs-mode-find-file-other-window (e)
"Select a buffer containing the file in another window."
(interactive (list last-input-event))
(vc-bzr-command "cat" t 0 file "-r" rev)
(vc-bzr-command "cat" t 0 file))))
+(defun vc-bzr-ignore (file)
+ "Ignore FILE under Bazaar."
+ (interactive)
+ (vc-bzr-command "ignore" (get-buffer-create "*vc-ignore*") 0
+ file))
+
(defun vc-bzr-checkout (_file &optional _editable rev)
(if rev (error "Operation not supported")
;; Else, there's nothing to do.
table (lambda () (vc-cvs-revision-table (car files))))))
table))
+(defun vc-cvs-ignore (file)
+ "Ignore FILE under CVS."
+ (interactive)
+ (cvs-append-to-ignore (file-name-directory file) file))
+
+(defun cvs-append-to-ignore (dir str &optional old-dir)
+ "In DIR, add STR to the .cvsignore file.
+If OLD-DIR is non-nil, then this is a directory that we don't want
+to hear about anymore."
+ (with-current-buffer
+ (find-file-noselect (expand-file-name ".cvsignore" dir))
+ (when (ignore-errors
+ (and buffer-read-only
+ (eq 'CVS (vc-backend buffer-file-name))
+ (not (vc-editable-p buffer-file-name))))
+ ;; CVSREAD=on special case
+ (vc-checkout buffer-file-name t))
+ (goto-char (point-max))
+ (unless (bolp) (insert "\n"))
+ (insert str (if old-dir "/\n" "\n"))
+ (if cvs-sort-ignore-file (sort-lines nil (point-min) (point-max)))
+ (save-buffer)))
(provide 'vc-cvs)
(define-key map "Q" 'vc-dir-query-replace-regexp)
(define-key map (kbd "M-s a C-s") 'vc-dir-isearch)
(define-key map (kbd "M-s a M-C-s") 'vc-dir-isearch-regexp)
+ (define-key map "I" 'vc-dir-ignore)
;; Hook up the menu.
(define-key map [menu-bar vc-dir-mode]
(tags-query-replace from to delimited
'(mapcar 'car (vc-dir-marked-only-files-and-states))))
+(defun vc-dir-ignore ()
+ "Ignore the current file."
+ (interactive)
+ (vc-ignore (vc-dir-current-file)))
+
(defun vc-dir-current-file ()
(let ((node (ewoc-locate vc-ewoc)))
(unless node
;; - rename-file (old new) OK
;; - find-file-hook () NOT NEEDED
+;;; Code:
+
(eval-when-compile
(require 'cl-lib)
(require 'vc)
nil
"cat-file" "blob" (concat (if rev rev "HEAD") ":" fullname))))
+(defun vc-git-ignore (file)
+ "Ignore FILE under Git."
+ (interactive)
+ (with-temp-buffer
+ (insert-file-contents
+ (let (gitignore (concat (file-name-as-directory (vc-git-root
+ default-directory)) ".gitignore"))
+ (unless (search-forward file nil t)
+ (goto-char (point-max))
+ (insert (concat "\n" file "\n"))
+ (write-region 1 (point-max) gitignore))))))
+
(defun vc-git-checkout (file &optional _editable rev)
(vc-git-command nil 0 file "checkout" (or rev "HEAD")))
(vc-hg-command buffer 0 file "cat" "-r" rev)
(vc-hg-command buffer 0 file "cat"))))
+(defun vc-hg-ignore (file)
+ "Ignore FILE under Mercurial."
+ (interactive)
+ (with-temp-buffer
+ (insert-file-contents
+ (let (hgignore (concat (file-name-as-directory (vc-hg-root
+ default-directory)) ".hgignore"))
+ (unless (search-forward file nil t)
+ (goto-char (point-max))
+ (insert (concat "\n" file "\n"))
+ (write-region 1 (point-max) hgignore))))))
+
;; Modeled after the similar function in vc-bzr.el
(defun vc-hg-checkout (file &optional _editable rev)
"Retrieve a revision of FILE.
(concat "-r" rev))
(vc-switches 'SVN 'checkout))))
+(defun vc-svn-ignore (file)
+ "Ignore FILE under Subversion."
+ (interactive)
+ (vc-svn-command (get-buffer-create "*vc-ignore*") 0
+ file "propedit" "svn:ignore"))
+
(defun vc-svn-checkout (file &optional editable rev)
(message "Checking out %s..." file)
(with-current-buffer (or (get-file-buffer file) (current-buffer))
(let ((vc-handled-backends (list backend)))
(call-interactively 'vc-register)))
+(defun vc-ignore (file)
+ "Ignore FILE under the current VCS."
+ (interactive "fIgnore file: ")
+ (let ((backend (vc-backend file)))
+ (vc-call-backend backend 'ignore file)))
+
(defun vc-checkout (file &optional writable rev)
"Retrieve a copy of the revision REV of FILE.
If WRITABLE is non-nil, make sure the retrieved file is writable.