]> git.eshelyaron.com Git - emacs.git/commitdiff
Add vc-ignore.
authorXue Fuqiao <xfq.free@gmail.com>
Tue, 30 Jul 2013 00:25:31 +0000 (08:25 +0800)
committerXue Fuqiao <xfq.free@gmail.com>
Tue, 30 Jul 2013 00:25:31 +0000 (08:25 +0800)
* 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.

etc/NEWS
lisp/ChangeLog
lisp/vc/pcvs.el
lisp/vc/vc-bzr.el
lisp/vc/vc-cvs.el
lisp/vc/vc-dir.el
lisp/vc/vc-git.el
lisp/vc/vc-hg.el
lisp/vc/vc-svn.el
lisp/vc/vc.el

index feb45f43348e12efca38a836d7b9eadb3794c70e..c472a2be8f367cacd76118245f773353b8dce4e8 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -229,6 +229,12 @@ The default separator is changed to allow surrounding spaces around the comma.
 *** 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.
index 587c9b921c99f7e91bf3866f01214b9256406e07..29cd88a9186cd4a2388c200b72819ce03546261e 100644 (file)
@@ -1,3 +1,23 @@
+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.
index 208b93d9670524d3e037daeaaf54b18f20ebb8a3..fb91185662a1742c2368d1033d2ad05a5bbbfad2 100644 (file)
 (require 'pcvs-util)
 (require 'pcvs-parse)
 (require 'pcvs-info)
+(require 'vc-cvs)
 
 \f
 ;;;;
@@ -1970,25 +1971,6 @@ This command ignores files that are not flagged as `Unknown'."
 (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))
index 5e76d8464a5075f18ae2f97cb72d791c20f8f74f..5f026a2ecd92402816f5c4644abfdae429e236b8 100644 (file)
@@ -651,6 +651,12 @@ REV non-nil gets an error."
           (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.
index 17b278d1ce4bd4cb14f32871b77ee49e5736339e..3472673f46dfba872a60811ea8920c5f2bfcce81 100644 (file)
@@ -1226,6 +1226,28 @@ is non-nil."
                    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)
 
index 80f78496a43e8440770fef169f817bf40310b4f0..4920e85c3514ba1b9da106c01503dfcb59e87293 100644 (file)
@@ -277,6 +277,7 @@ See `run-hooks'."
     (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]
@@ -789,6 +790,11 @@ with the command \\[tags-loop-continue]."
   (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
index af5be3610476732202cd3423a5800c360e633b7e..2183fef4e7d0dfda29ea65151833a62ac93f2ca6 100644 (file)
 ;; - rename-file (old new)                         OK
 ;; - find-file-hook ()                             NOT NEEDED
 
+;;; Code:
+
 (eval-when-compile
   (require 'cl-lib)
   (require 'vc)
@@ -678,6 +680,18 @@ It is based on `log-edit-mode', and has Git-specific extensions.")
      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")))
 
index a80a103c675295e417e351fb5ad6cbdc01a27b61..dd9ff0034932465b4f90ee58721a1e2722c6ee0b 100644 (file)
@@ -459,6 +459,18 @@ REV is ignored."
         (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.
index 39b107b81b569f7370a22c9b527f7b7d11d81e34..7851aac435e60780edae084fbae6de03ed311dea 100644 (file)
@@ -352,6 +352,12 @@ This is only possible if SVN is responsible for FILE's directory.")
                (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))
index 0308dd1ebd424ec7278e8f8945eda03a1d216fca..210e647ba652a2cefdde770bce080a5bfb7d6e68 100644 (file)
@@ -1332,6 +1332,12 @@ first backend that could register the file is used."
   (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.