aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond2014-08-13 04:05:45 -0400
committerEric S. Raymond2014-08-13 04:05:45 -0400
commit2cc441ecbf093d2d7e319f2359b80fd358589b0f (patch)
treeb12c3085c43277ebb92f5e92ee91d110527335e0
parentc1677234a35ac49ac1dd4276a19e90ac8e62b6e6 (diff)
downloademacs-2cc441ecbf093d2d7e319f2359b80fd358589b0f.tar.gz
emacs-2cc441ecbf093d2d7e319f2359b80fd358589b0f.zip
Integrate RĂ¼diger Sonderfeld's code for detecting conflicted files under git.
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/vc/vc-git.el18
2 files changed, 25 insertions, 0 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 7bb7415bc9c..764d6d12c8a 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
12014-08-13 Eric S. Raymond <esr@thyrsus.com>
2
3 * vc/vc-git.el (vc-git-conflicted-files): Integrate RĂ¼diger
4 Sonderfeld's code for detecting conflicted files using a status
5 listing. Useful in itself and a step towards better smerge
6 support.
7
12014-08-12 Stefan Monnier <monnier@iro.umontreal.ca> 82014-08-12 Stefan Monnier <monnier@iro.umontreal.ca>
2 9
3 * mpc.el (mpc-reorder): Don't bother splitting the "active"s elements 10 * mpc.el (mpc-reorder): Don't bother splitting the "active"s elements
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 9c8ab3ba393..3e9228601d8 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -102,6 +102,7 @@
102;; - delete-file (file) OK 102;; - delete-file (file) OK
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;; - conflicted-files OK
105 106
106;;; Code: 107;;; Code:
107 108
@@ -769,6 +770,23 @@ This prompts for a branch to merge from."
769 (with-current-buffer buffer (vc-run-delayed (vc-compilation-mode 'git))) 770 (with-current-buffer buffer (vc-run-delayed (vc-compilation-mode 'git)))
770 (vc-set-async-update buffer))) 771 (vc-set-async-update buffer)))
771 772
773(defun vc-git-conflicted-files (directory)
774 "Return the list of files with conflicts in DIRECTORY."
775 (let* ((status
776 (vc-git--run-command-string directory "status" "--porcelain" "--"))
777 (lines (split-string status "\n" 'omit-nulls))
778 files)
779 (dolist (line lines files)
780 (when (string-match "\\([ MADRCU?!][ MADRCU?!]\\) \\(.+\\)\\(?: -> \\(.+\\)\\)?"
781 line)
782 (let ((state (match-string 1 line))
783 (file (match-string 2 line)))
784 ;; See git-status(1).
785 (when (member state '("AU" "UD" "UA" ;; "DD"
786 "DU" "AA" "UU"))
787 (push file files)))))))
788
789
772;;; HISTORY FUNCTIONS 790;;; HISTORY FUNCTIONS
773 791
774(autoload 'vc-setup-buffer "vc-dispatcher") 792(autoload 'vc-setup-buffer "vc-dispatcher")