emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r117697: Integrate Rüdiger Sonderfeld's code for det


From: Eric S. Raymond
Subject: [Emacs-diffs] trunk r117697: Integrate Rüdiger Sonderfeld's code for detecting conflicted files under git.
Date: Wed, 13 Aug 2014 08:06:55 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117697
revision-id: address@hidden
parent: address@hidden
committer: Eric S. Raymond <address@hidden>
branch nick: trunk
timestamp: Wed 2014-08-13 04:05:45 -0400
message:
  Integrate Rüdiger Sonderfeld's code for detecting conflicted files under git.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/vc/vc-git.el              vcgit.el-20091113204419-o5vbwnq5f7feedwu-5070
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-08-12 16:16:00 +0000
+++ b/lisp/ChangeLog    2014-08-13 08:05:45 +0000
@@ -1,3 +1,10 @@
+2014-08-13  Eric S. Raymond  <address@hidden>
+
+       * vc/vc-git.el (vc-git-conflicted-files): Integrate Rüdiger
+       Sonderfeld's code for detecting conflicted files using a status
+       listing.  Useful in itself and a step towards better smerge
+       support.
+
 2014-08-12  Stefan Monnier  <address@hidden>
 
        * mpc.el (mpc-reorder): Don't bother splitting the "active"s elements

=== modified file 'lisp/vc/vc-git.el'
--- a/lisp/vc/vc-git.el 2014-06-29 20:48:55 +0000
+++ b/lisp/vc/vc-git.el 2014-08-13 08:05:45 +0000
@@ -102,6 +102,7 @@
 ;; - delete-file (file)                            OK
 ;; - rename-file (old new)                         OK
 ;; - find-file-hook ()                             NOT NEEDED
+;; - conflicted-files                              OK
 
 ;;; Code:
 
@@ -769,6 +770,23 @@
     (with-current-buffer buffer (vc-run-delayed (vc-compilation-mode 'git)))
     (vc-set-async-update buffer)))
 
+(defun vc-git-conflicted-files (directory)
+  "Return the list of files with conflicts in DIRECTORY."
+  (let* ((status
+          (vc-git--run-command-string directory "status" "--porcelain" "--"))
+         (lines (split-string status "\n" 'omit-nulls))
+         files)
+    (dolist (line lines files)
+      (when (string-match "\\([ MADRCU?!][ MADRCU?!]\\) \\(.+\\)\\(?: -> 
\\(.+\\)\\)?"
+                          line)
+        (let ((state (match-string 1 line))
+              (file (match-string 2 line)))
+          ;; See git-status(1).
+          (when (member state '("AU" "UD" "UA" ;; "DD"
+                                "DU" "AA" "UU"))
+            (push file files)))))))
+
+
 ;;; HISTORY FUNCTIONS
 
 (autoload 'vc-setup-buffer "vc-dispatcher")


reply via email to

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