bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#16254: 24.3.50; [PATCH] bzr error on emacs trunk using vc-print-log


From: Christoph
Subject: bug#16254: 24.3.50; [PATCH] bzr error on emacs trunk using vc-print-log
Date: Mon, 30 Dec 2013 08:53:39 -0700

It would be nice if a fix for this issue made it into 24.4. Or do you think that this is too intrusive of a change?

I'll add Changelog entries etc. and commit it if someone can look it over.

Thanks.

On Thu, Dec 26, 2013 at 7:47 PM, Christoph <cschol2112@gmail.com> wrote:
This issue seems to be that when deducing the fileset in dired mode, the code does not distinguish between files that are under version control and files that aren't.

The following patch adds detection (and filtering) of unregistered members to vc-dired-deduce-fileset.
If the marked files have any unregistered files among them, the unregistered files are filtered out. 
If all files are unregistered, an error is shown. This also covers the main case of selecting just one unregistered file/directory.

Thoughts?

=== modified file 'lisp/vc/vc.el'
--- lisp/vc/vc.el 2013-11-26 19:17:55 +0000
+++ lisp/vc/vc.el 2013-12-27 02:40:38 +0000
@@ -1014,10 +1014,19 @@
      (t (error "File is not under version control")))))
 
 (defun vc-dired-deduce-fileset ()
-  (let ((backend (vc-responsible-backend default-directory)))
-    (unless backend (error "Directory not under VC"))
-    (list backend
-          (dired-map-over-marks (dired-get-filename nil t) nil))))
+  "Deduce a set of files and a backend to which to apply an
+operation from all the marked items in a dired buffer. Resulting
+fileset only includes items that are version controlled."
+  (let ((backend (vc-responsible-backend default-directory))
+        (fileset
+         (delq nil (mapcar
+                    (lambda (x) (if (not (equal (vc-backend x) nil)) x))
+                    (dired-map-over-marks
+                     (dired-get-filename nil t)
+                     nil)))))
+    (if (not fileset)
+        (error "Marked fileset is not under version control")
+      (list backend fileset))))
 
 (defun vc-ensure-vc-buffer ()
   "Make sure that the current buffer visits a version-controlled file."

reply via email to

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