emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 3c3aad7: When VC detects a conflict, specify which


From: Karl Fogel
Subject: [Emacs-diffs] master 3c3aad7: When VC detects a conflict, specify which file
Date: Mon, 09 Nov 2015 21:57:58 +0000

branch: master
commit 3c3aad733522365a8fe729d7c92e64e98bc4ce92
Author: Karl Fogel <address@hidden>
Commit: Karl Fogel <address@hidden>

    When VC detects a conflict, specify which file
    
    * lisp/vc/vc.el (vc-message-unresolved-conflicts): New function.
    * lisp/vc/vc-svn.el (vc-svn-find-file-hook):
    * lisp/vc/vc-hg.el (vc-hg-find-file-hook):
    * lisp/vc/vc-bzr.el (vc-bzr-find-file-hook):
    * lisp/vc/vc-git.el (vc-git-find-file-hook): Use above new function
      to display a standard message that specifies the conflicted file.
    
    Before this change, the message VC used for indicating a conflicted
    file was just "There are unresolved conflicts in this file" without
    naming the file (and this language was duplicated in several places).
    After this change, it's "There are unresolved conflicts in file FOO"
    (and this language is now centralized in one function in vc.el).
    
    Justification: It's important for the message to name the conflicted
    file because the moment when VC realizes a file is conflicted does not
    always come interactively.  For example, some people automatically
    find a set of Org Mode files on startup, and may keep those .org files
    under version control.  If any of the files are conflicted, the user
    just sees some messages fly by, and might later check the "*Messages*"
    buffer to find out what files were conflicted.  I'm not saying this
    happened to me or anything; it's a purely hypothetical example.
---
 lisp/vc/vc-bzr.el |    2 +-
 lisp/vc/vc-git.el |    2 +-
 lisp/vc/vc-hg.el  |    2 +-
 lisp/vc/vc-svn.el |    2 +-
 lisp/vc/vc.el     |    7 +++++++
 5 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/lisp/vc/vc-bzr.el b/lisp/vc/vc-bzr.el
index 9b2711d..caedbd9 100644
--- a/lisp/vc/vc-bzr.el
+++ b/lisp/vc/vc-bzr.el
@@ -517,7 +517,7 @@ in the branch repository (or whose status not be 
determined)."
     ;; elisp function to remerge from the .BASE/OTHER/THIS files.
     (smerge-start-session)
     (add-hook 'after-save-hook 'vc-bzr-resolve-when-done nil t)
-    (message "There are unresolved conflicts in this file")))
+    (vc-message-unresolved-conflicts buffer-file-name)))
 
 (defun vc-bzr-version-dirstate (dir)
   "Try to return as a string the bzr revision ID of directory DIR.
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 27898a9..8bf37f0 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -841,7 +841,7 @@ This prompts for a branch to merge from."
     (smerge-start-session)
     (when vc-git-resolve-conflicts
       (add-hook 'after-save-hook 'vc-git-resolve-when-done nil 'local))
-    (message "There are unresolved conflicts in this file")))
+    (vc-message-unresolved-conflicts buffer-file-name)))
 
 ;;; HISTORY FUNCTIONS
 
diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
index f9957c1..92b0c31 100644
--- a/lisp/vc/vc-hg.el
+++ b/lisp/vc/vc-hg.el
@@ -535,7 +535,7 @@ REV is the revision to check out into WORKFILE."
     (vc-file-setprop buffer-file-name 'vc-state 'conflict)
     (smerge-start-session)
     (add-hook 'after-save-hook 'vc-hg-resolve-when-done nil t)
-    (message "There are unresolved conflicts in this file")))
+    (vc-message-unresolved-conflicts buffer-file-name)))
 
 
 ;; Modeled after the similar function in vc-bzr.el
diff --git a/lisp/vc/vc-svn.el b/lisp/vc/vc-svn.el
index 4ef63a2..de58fb9 100644
--- a/lisp/vc/vc-svn.el
+++ b/lisp/vc/vc-svn.el
@@ -686,7 +686,7 @@ and that it passes `vc-svn-global-switches' to it before 
FLAGS."
       ;; use conflict markers in which case we don't really know what to do.
       ;; So let's just punt for now.
       nil)
-    (message "There are unresolved conflicts in this file")))
+    (vc-message-unresolved-conflicts buffer-file-name)))
 
 (defun vc-svn-parse-status (&optional filename)
   "Parse output of \"svn status\" command in the current buffer.
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index f08e562..28ddeb3 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -2068,6 +2068,13 @@ changes from the current branch."
     (message "File contains conflicts.")))
 
 ;;;###autoload
+(defun vc-message-unresolved-conflicts (filename)
+  "Display a message indicating unresolved conflicts in FILENAME."
+  ;; This enables all VC backends to give a standard, recognizeable
+  ;; conflict message that indicates which file is conflicted.
+  (message "There are unresolved conflicts in %s" filename))
+
+;;;###autoload
 (defalias 'vc-resolve-conflicts 'smerge-ediff)
 
 ;; TODO: This is OK but maybe we could integrate it better.



reply via email to

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