emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 9d5c4d0 1/3: Fix interaction between vc-hg find-fil


From: Eli Zaretskii
Subject: [Emacs-diffs] master 9d5c4d0 1/3: Fix interaction between vc-hg find-file-hook and vc state caching
Date: Sat, 3 Nov 2018 04:40:47 -0400 (EDT)

branch: master
commit 9d5c4d07462e69b4e0552e7f09e3e59a3fd10b6a
Author: Daniel Pittman <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Fix interaction between vc-hg find-file-hook and vc state caching
    
    Bad assumptions in the `vc-hg-find-file-hook' prevented it from
    working. This correctly them.  (Bug#33129).
    
    2018-10-23  Daniel Pittman  <address@hidden>
    
        * lisp/vc/vc-hg.el (vc-hg-find-file-hook): This function made two
        assumptions about conflicted files that were not accurate,
        preventing conflicts in files ever being detected.
    
        The first was that the `vc-state' was cache by the time this was
        invoked, which it is not - at least when visiting the file, or
        using `vc-refresh-state'.
    
        The second was that a file with the ".orig" extension would be
        present, next to the file being visited.  This is the default
        behavior of Mercurial, but can be overridden by the user.
    
        Since the VC mode-line code will shortly calculate the state for
        display, the optimization of testing for the ".orig" file only
        delayed this work by a few moments.
---
 etc/NEWS         | 6 ++++++
 lisp/vc/vc-hg.el | 4 +---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index ac23b3b..b71ac80 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -339,6 +339,12 @@ When no files are marked, all modified files are stashed, 
as before.
 
 *** The new hook 'vc-retrieve-tag-hook' runs after retrieving a tag.
 
+--- `vc-hg' now invokes `smerge-mode' correctly when visiting files.
+Code that attempted to invoke `smerge-mode' when visiting an Hg file
+with conflicts existed in earlier versions of Emacs, but incorrectly
+never detected a conflict due to invalid assumptions about cached
+values.
+
 ** diff-mode
 *** Hunks are now automatically refined by default.
 To disable it, set the new defcustom 'diff-font-lock-refine' to nil.
diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
index 3696573..d528813 100644
--- a/lisp/vc/vc-hg.el
+++ b/lisp/vc/vc-hg.el
@@ -1142,11 +1142,9 @@ REV is the revision to check out into WORKFILE."
 
 (defun vc-hg-find-file-hook ()
   (when (and buffer-file-name
-             (file-exists-p (concat buffer-file-name ".orig"))
              ;; Hg does not seem to have a "conflict" status, eg
              ;; hg http://bz.selenic.com/show_bug.cgi?id=2724
-             (memq (vc-file-getprop buffer-file-name 'vc-state)
-                   '(edited conflict))
+             (memq (vc-state buffer-file-name) '(edited conflict))
              ;; Maybe go on to check that "hg resolve -l" says "U"?
              ;; If "hg resolve -l" says there's a conflict but there are no
              ;; conflict markers, it's not clear what we should do.



reply via email to

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