aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXue Fuqiao2013-07-30 08:25:31 +0800
committerXue Fuqiao2013-07-30 08:25:31 +0800
commit7aa7fff0c8860b72a2c7cdc7d4d0845245754d43 (patch)
tree10c4e901544080581b926622eb35d26ddda65791
parent8121f08950ca36647a6dfa32d02be574b253d9df (diff)
downloademacs-7aa7fff0c8860b72a2c7cdc7d4d0845245754d43.tar.gz
emacs-7aa7fff0c8860b72a2c7cdc7d4d0845245754d43.zip
Add vc-ignore.
* 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.
-rw-r--r--etc/NEWS6
-rw-r--r--lisp/ChangeLog20
-rw-r--r--lisp/vc/pcvs.el20
-rw-r--r--lisp/vc/vc-bzr.el6
-rw-r--r--lisp/vc/vc-cvs.el22
-rw-r--r--lisp/vc/vc-dir.el6
-rw-r--r--lisp/vc/vc-git.el14
-rw-r--r--lisp/vc/vc-hg.el12
-rw-r--r--lisp/vc/vc-svn.el6
-rw-r--r--lisp/vc/vc.el6
10 files changed, 99 insertions, 19 deletions
diff --git a/etc/NEWS b/etc/NEWS
index feb45f43348..c472a2be8f3 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -229,6 +229,12 @@ The default separator is changed to allow surrounding spaces around the comma.
229*** New variable `diary-from-outlook-function', used by the command 229*** New variable `diary-from-outlook-function', used by the command
230`diary-from-outlook'. 230`diary-from-outlook'.
231 231
232** VC Directory Mode
233
234*** `D' displays diffs between VC-controlled whole tree revisions.
235*** `L' lists the change log for the current VC controlled tree in a window.
236*** `I' ignores the file under current version control system.
237
232** cl-lib 238** cl-lib
233 239
234*** New macro cl-tagbody. 240*** New macro cl-tagbody.
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 587c9b921c9..29cd88a9186 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,23 @@
12013-07-30 Xue Fuqiao <xfq.free@gmail.com>
2
3 * vc/vc.el (vc-ignore): New function.
4
5 * vc/vc-svn.el (vc-svn-ignore): New function.
6
7 * vc/vc-hg.el (vc-hg-ignore): New function.
8
9 * vc/vc-git.el (vc-git-ignore): New function.
10
11 * vc/vc-dir.el (vc-dir-mode-map): Add key binding for vc-dir-ignore
12 (vc-dir-ignore): New function.
13
14 * vc/vc-cvs.el (vc-cvs-ignore): New function.
15 (cvs-append-to-ignore): Moved from pcvs.el.
16
17 * vc/vc-bzr.el (vc-bzr-ignore): New function.
18
19 * vc/pcvs.el (vc-cvs): Require 'vc-cvs.
20
12013-07-24 Juanma Barranquero <lekktu@gmail.com> 212013-07-24 Juanma Barranquero <lekktu@gmail.com>
2 22
3 * desktop.el (desktop-restoring-frames-p): Return a true boolean. 23 * desktop.el (desktop-restoring-frames-p): Return a true boolean.
diff --git a/lisp/vc/pcvs.el b/lisp/vc/pcvs.el
index 208b93d9670..fb91185662a 100644
--- a/lisp/vc/pcvs.el
+++ b/lisp/vc/pcvs.el
@@ -122,6 +122,7 @@
122(require 'pcvs-util) 122(require 'pcvs-util)
123(require 'pcvs-parse) 123(require 'pcvs-parse)
124(require 'pcvs-info) 124(require 'pcvs-info)
125(require 'vc-cvs)
125 126
126 127
127;;;; 128;;;;
@@ -1970,25 +1971,6 @@ This command ignores files that are not flagged as `Unknown'."
1970(declare-function vc-editable-p "vc" (file)) 1971(declare-function vc-editable-p "vc" (file))
1971(declare-function vc-checkout "vc" (file &optional writable rev)) 1972(declare-function vc-checkout "vc" (file &optional writable rev))
1972 1973
1973(defun cvs-append-to-ignore (dir str &optional old-dir)
1974 "Add STR to the .cvsignore file in DIR.
1975If OLD-DIR is non-nil, then this is a directory that we don't want
1976to hear about anymore."
1977 (with-current-buffer
1978 (find-file-noselect (expand-file-name ".cvsignore" dir))
1979 (when (ignore-errors
1980 (and buffer-read-only
1981 (eq 'CVS (vc-backend buffer-file-name))
1982 (not (vc-editable-p buffer-file-name))))
1983 ;; CVSREAD=on special case
1984 (vc-checkout buffer-file-name t))
1985 (goto-char (point-max))
1986 (unless (bolp) (insert "\n"))
1987 (insert str (if old-dir "/\n" "\n"))
1988 (if cvs-sort-ignore-file (sort-lines nil (point-min) (point-max)))
1989 (save-buffer)))
1990
1991
1992(defun cvs-mode-find-file-other-window (e) 1974(defun cvs-mode-find-file-other-window (e)
1993 "Select a buffer containing the file in another window." 1975 "Select a buffer containing the file in another window."
1994 (interactive (list last-input-event)) 1976 (interactive (list last-input-event))
diff --git a/lisp/vc/vc-bzr.el b/lisp/vc/vc-bzr.el
index 5e76d8464a5..5f026a2ecd9 100644
--- a/lisp/vc/vc-bzr.el
+++ b/lisp/vc/vc-bzr.el
@@ -651,6 +651,12 @@ REV non-nil gets an error."
651 (vc-bzr-command "cat" t 0 file "-r" rev) 651 (vc-bzr-command "cat" t 0 file "-r" rev)
652 (vc-bzr-command "cat" t 0 file)))) 652 (vc-bzr-command "cat" t 0 file))))
653 653
654(defun vc-bzr-ignore (file)
655 "Ignore FILE under Bazaar."
656 (interactive)
657 (vc-bzr-command "ignore" (get-buffer-create "*vc-ignore*") 0
658 file))
659
654(defun vc-bzr-checkout (_file &optional _editable rev) 660(defun vc-bzr-checkout (_file &optional _editable rev)
655 (if rev (error "Operation not supported") 661 (if rev (error "Operation not supported")
656 ;; Else, there's nothing to do. 662 ;; Else, there's nothing to do.
diff --git a/lisp/vc/vc-cvs.el b/lisp/vc/vc-cvs.el
index 17b278d1ce4..3472673f46d 100644
--- a/lisp/vc/vc-cvs.el
+++ b/lisp/vc/vc-cvs.el
@@ -1226,6 +1226,28 @@ is non-nil."
1226 table (lambda () (vc-cvs-revision-table (car files)))))) 1226 table (lambda () (vc-cvs-revision-table (car files))))))
1227 table)) 1227 table))
1228 1228
1229(defun vc-cvs-ignore (file)
1230 "Ignore FILE under CVS."
1231 (interactive)
1232 (cvs-append-to-ignore (file-name-directory file) file))
1233
1234(defun cvs-append-to-ignore (dir str &optional old-dir)
1235 "In DIR, add STR to the .cvsignore file.
1236If OLD-DIR is non-nil, then this is a directory that we don't want
1237to hear about anymore."
1238 (with-current-buffer
1239 (find-file-noselect (expand-file-name ".cvsignore" dir))
1240 (when (ignore-errors
1241 (and buffer-read-only
1242 (eq 'CVS (vc-backend buffer-file-name))
1243 (not (vc-editable-p buffer-file-name))))
1244 ;; CVSREAD=on special case
1245 (vc-checkout buffer-file-name t))
1246 (goto-char (point-max))
1247 (unless (bolp) (insert "\n"))
1248 (insert str (if old-dir "/\n" "\n"))
1249 (if cvs-sort-ignore-file (sort-lines nil (point-min) (point-max)))
1250 (save-buffer)))
1229 1251
1230(provide 'vc-cvs) 1252(provide 'vc-cvs)
1231 1253
diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el
index 80f78496a43..4920e85c351 100644
--- a/lisp/vc/vc-dir.el
+++ b/lisp/vc/vc-dir.el
@@ -277,6 +277,7 @@ See `run-hooks'."
277 (define-key map "Q" 'vc-dir-query-replace-regexp) 277 (define-key map "Q" 'vc-dir-query-replace-regexp)
278 (define-key map (kbd "M-s a C-s") 'vc-dir-isearch) 278 (define-key map (kbd "M-s a C-s") 'vc-dir-isearch)
279 (define-key map (kbd "M-s a M-C-s") 'vc-dir-isearch-regexp) 279 (define-key map (kbd "M-s a M-C-s") 'vc-dir-isearch-regexp)
280 (define-key map "I" 'vc-dir-ignore)
280 281
281 ;; Hook up the menu. 282 ;; Hook up the menu.
282 (define-key map [menu-bar vc-dir-mode] 283 (define-key map [menu-bar vc-dir-mode]
@@ -789,6 +790,11 @@ with the command \\[tags-loop-continue]."
789 (tags-query-replace from to delimited 790 (tags-query-replace from to delimited
790 '(mapcar 'car (vc-dir-marked-only-files-and-states)))) 791 '(mapcar 'car (vc-dir-marked-only-files-and-states))))
791 792
793(defun vc-dir-ignore ()
794 "Ignore the current file."
795 (interactive)
796 (vc-ignore (vc-dir-current-file)))
797
792(defun vc-dir-current-file () 798(defun vc-dir-current-file ()
793 (let ((node (ewoc-locate vc-ewoc))) 799 (let ((node (ewoc-locate vc-ewoc)))
794 (unless node 800 (unless node
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index af5be361047..2183fef4e7d 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -103,6 +103,8 @@
103;; - rename-file (old new) OK 103;; - rename-file (old new) OK
104;; - find-file-hook () NOT NEEDED 104;; - find-file-hook () NOT NEEDED
105 105
106;;; Code:
107
106(eval-when-compile 108(eval-when-compile
107 (require 'cl-lib) 109 (require 'cl-lib)
108 (require 'vc) 110 (require 'vc)
@@ -678,6 +680,18 @@ It is based on `log-edit-mode', and has Git-specific extensions.")
678 nil 680 nil
679 "cat-file" "blob" (concat (if rev rev "HEAD") ":" fullname)))) 681 "cat-file" "blob" (concat (if rev rev "HEAD") ":" fullname))))
680 682
683(defun vc-git-ignore (file)
684 "Ignore FILE under Git."
685 (interactive)
686 (with-temp-buffer
687 (insert-file-contents
688 (let (gitignore (concat (file-name-as-directory (vc-git-root
689 default-directory)) ".gitignore"))
690 (unless (search-forward file nil t)
691 (goto-char (point-max))
692 (insert (concat "\n" file "\n"))
693 (write-region 1 (point-max) gitignore))))))
694
681(defun vc-git-checkout (file &optional _editable rev) 695(defun vc-git-checkout (file &optional _editable rev)
682 (vc-git-command nil 0 file "checkout" (or rev "HEAD"))) 696 (vc-git-command nil 0 file "checkout" (or rev "HEAD")))
683 697
diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
index a80a103c675..dd9ff003493 100644
--- a/lisp/vc/vc-hg.el
+++ b/lisp/vc/vc-hg.el
@@ -459,6 +459,18 @@ REV is ignored."
459 (vc-hg-command buffer 0 file "cat" "-r" rev) 459 (vc-hg-command buffer 0 file "cat" "-r" rev)
460 (vc-hg-command buffer 0 file "cat")))) 460 (vc-hg-command buffer 0 file "cat"))))
461 461
462(defun vc-hg-ignore (file)
463 "Ignore FILE under Mercurial."
464 (interactive)
465 (with-temp-buffer
466 (insert-file-contents
467 (let (hgignore (concat (file-name-as-directory (vc-hg-root
468 default-directory)) ".hgignore"))
469 (unless (search-forward file nil t)
470 (goto-char (point-max))
471 (insert (concat "\n" file "\n"))
472 (write-region 1 (point-max) hgignore))))))
473
462;; Modeled after the similar function in vc-bzr.el 474;; Modeled after the similar function in vc-bzr.el
463(defun vc-hg-checkout (file &optional _editable rev) 475(defun vc-hg-checkout (file &optional _editable rev)
464 "Retrieve a revision of FILE. 476 "Retrieve a revision of FILE.
diff --git a/lisp/vc/vc-svn.el b/lisp/vc/vc-svn.el
index 39b107b81b5..7851aac435e 100644
--- a/lisp/vc/vc-svn.el
+++ b/lisp/vc/vc-svn.el
@@ -352,6 +352,12 @@ This is only possible if SVN is responsible for FILE's directory.")
352 (concat "-r" rev)) 352 (concat "-r" rev))
353 (vc-switches 'SVN 'checkout)))) 353 (vc-switches 'SVN 'checkout))))
354 354
355(defun vc-svn-ignore (file)
356 "Ignore FILE under Subversion."
357 (interactive)
358 (vc-svn-command (get-buffer-create "*vc-ignore*") 0
359 file "propedit" "svn:ignore"))
360
355(defun vc-svn-checkout (file &optional editable rev) 361(defun vc-svn-checkout (file &optional editable rev)
356 (message "Checking out %s..." file) 362 (message "Checking out %s..." file)
357 (with-current-buffer (or (get-file-buffer file) (current-buffer)) 363 (with-current-buffer (or (get-file-buffer file) (current-buffer))
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 0308dd1ebd4..210e647ba65 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -1332,6 +1332,12 @@ first backend that could register the file is used."
1332 (let ((vc-handled-backends (list backend))) 1332 (let ((vc-handled-backends (list backend)))
1333 (call-interactively 'vc-register))) 1333 (call-interactively 'vc-register)))
1334 1334
1335(defun vc-ignore (file)
1336 "Ignore FILE under the current VCS."
1337 (interactive "fIgnore file: ")
1338 (let ((backend (vc-backend file)))
1339 (vc-call-backend backend 'ignore file)))
1340
1335(defun vc-checkout (file &optional writable rev) 1341(defun vc-checkout (file &optional writable rev)
1336 "Retrieve a copy of the revision REV of FILE. 1342 "Retrieve a copy of the revision REV of FILE.
1337If WRITABLE is non-nil, make sure the retrieved file is writable. 1343If WRITABLE is non-nil, make sure the retrieved file is writable.