diff options
| author | Karl Fogel | 2015-11-09 15:57:23 -0600 |
|---|---|---|
| committer | Karl Fogel | 2015-11-09 15:57:29 -0600 |
| commit | 3c3aad733522365a8fe729d7c92e64e98bc4ce92 (patch) | |
| tree | 78cc938eea47aaa43d0be8cf9856c0bba8665b44 | |
| parent | 86c19714b097aa477d339ed99ffb5136c755a046 (diff) | |
| download | emacs-3c3aad733522365a8fe729d7c92e64e98bc4ce92.tar.gz emacs-3c3aad733522365a8fe729d7c92e64e98bc4ce92.zip | |
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.
| -rw-r--r-- | lisp/vc/vc-bzr.el | 2 | ||||
| -rw-r--r-- | lisp/vc/vc-git.el | 2 | ||||
| -rw-r--r-- | lisp/vc/vc-hg.el | 2 | ||||
| -rw-r--r-- | lisp/vc/vc-svn.el | 2 | ||||
| -rw-r--r-- | 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 9b2711d8146..caedbd9f6c3 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)." | |||
| 517 | ;; elisp function to remerge from the .BASE/OTHER/THIS files. | 517 | ;; elisp function to remerge from the .BASE/OTHER/THIS files. |
| 518 | (smerge-start-session) | 518 | (smerge-start-session) |
| 519 | (add-hook 'after-save-hook 'vc-bzr-resolve-when-done nil t) | 519 | (add-hook 'after-save-hook 'vc-bzr-resolve-when-done nil t) |
| 520 | (message "There are unresolved conflicts in this file"))) | 520 | (vc-message-unresolved-conflicts buffer-file-name))) |
| 521 | 521 | ||
| 522 | (defun vc-bzr-version-dirstate (dir) | 522 | (defun vc-bzr-version-dirstate (dir) |
| 523 | "Try to return as a string the bzr revision ID of directory DIR. | 523 | "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 27898a991a0..8bf37f09dc2 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." | |||
| 841 | (smerge-start-session) | 841 | (smerge-start-session) |
| 842 | (when vc-git-resolve-conflicts | 842 | (when vc-git-resolve-conflicts |
| 843 | (add-hook 'after-save-hook 'vc-git-resolve-when-done nil 'local)) | 843 | (add-hook 'after-save-hook 'vc-git-resolve-when-done nil 'local)) |
| 844 | (message "There are unresolved conflicts in this file"))) | 844 | (vc-message-unresolved-conflicts buffer-file-name))) |
| 845 | 845 | ||
| 846 | ;;; HISTORY FUNCTIONS | 846 | ;;; HISTORY FUNCTIONS |
| 847 | 847 | ||
diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el index f9957c1afff..92b0c3169c1 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." | |||
| 535 | (vc-file-setprop buffer-file-name 'vc-state 'conflict) | 535 | (vc-file-setprop buffer-file-name 'vc-state 'conflict) |
| 536 | (smerge-start-session) | 536 | (smerge-start-session) |
| 537 | (add-hook 'after-save-hook 'vc-hg-resolve-when-done nil t) | 537 | (add-hook 'after-save-hook 'vc-hg-resolve-when-done nil t) |
| 538 | (message "There are unresolved conflicts in this file"))) | 538 | (vc-message-unresolved-conflicts buffer-file-name))) |
| 539 | 539 | ||
| 540 | 540 | ||
| 541 | ;; Modeled after the similar function in vc-bzr.el | 541 | ;; Modeled after the similar function in vc-bzr.el |
diff --git a/lisp/vc/vc-svn.el b/lisp/vc/vc-svn.el index 4ef63a23db5..de58fb91c62 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." | |||
| 686 | ;; use conflict markers in which case we don't really know what to do. | 686 | ;; use conflict markers in which case we don't really know what to do. |
| 687 | ;; So let's just punt for now. | 687 | ;; So let's just punt for now. |
| 688 | nil) | 688 | nil) |
| 689 | (message "There are unresolved conflicts in this file"))) | 689 | (vc-message-unresolved-conflicts buffer-file-name))) |
| 690 | 690 | ||
| 691 | (defun vc-svn-parse-status (&optional filename) | 691 | (defun vc-svn-parse-status (&optional filename) |
| 692 | "Parse output of \"svn status\" command in the current buffer. | 692 | "Parse output of \"svn status\" command in the current buffer. |
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index f08e562efe5..28ddeb3d58b 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el | |||
| @@ -2068,6 +2068,13 @@ changes from the current branch." | |||
| 2068 | (message "File contains conflicts."))) | 2068 | (message "File contains conflicts."))) |
| 2069 | 2069 | ||
| 2070 | ;;;###autoload | 2070 | ;;;###autoload |
| 2071 | (defun vc-message-unresolved-conflicts (filename) | ||
| 2072 | "Display a message indicating unresolved conflicts in FILENAME." | ||
| 2073 | ;; This enables all VC backends to give a standard, recognizeable | ||
| 2074 | ;; conflict message that indicates which file is conflicted. | ||
| 2075 | (message "There are unresolved conflicts in %s" filename)) | ||
| 2076 | |||
| 2077 | ;;;###autoload | ||
| 2071 | (defalias 'vc-resolve-conflicts 'smerge-ediff) | 2078 | (defalias 'vc-resolve-conflicts 'smerge-ediff) |
| 2072 | 2079 | ||
| 2073 | ;; TODO: This is OK but maybe we could integrate it better. | 2080 | ;; TODO: This is OK but maybe we could integrate it better. |