all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Daniel Pittman <slippycheeze@google.com>
To: 33129@debbugs.gnu.org
Subject: bug#33129: Acknowledgement (26.1; `vc-hg-find-file-hook' can never detect files with conflicts)
Date: Tue, 23 Oct 2018 12:10:35 -0400	[thread overview]
Message-ID: <CAC45yQupLY8LjZiFjAFRk8ZfhCGhm3xJGS+tE1oTVu2THe3h8g@mail.gmail.com> (raw)
In-Reply-To: <handler.33129.B.15403106928776.ack@debbugs.gnu.org>


[-- Attachment #1.1: Type: text/plain, Size: 76 bytes --]

Please find attached a patch fixing both the issues identified in this bug:

[-- Attachment #1.2: Type: text/html, Size: 112 bytes --]

[-- Attachment #2: 0001-Fix-interaction-between-vc-hg-find-file-hook-and-vc-.patch --]
[-- Type: application/octet-stream, Size: 2757 bytes --]

From ade637fb894633fdfc1ea6ba54e4b31d26ec028e Mon Sep 17 00:00:00 2001
From: Daniel Pittman <slippycheeze@google.com>
Date: Tue, 23 Oct 2018 11:24:04 -0400
Subject: [PATCH] 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  <slippycheeze@google.com>

	* 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 7a98b492f1..e6b628f97d 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -340,6 +340,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 3696573595..d528813bc0 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.
-- 
2.19.1


  parent reply	other threads:[~2018-10-23 16:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-23 16:03 bug#33129: 26.1; `vc-hg-find-file-hook' can never detect files with conflicts Daniel Pittman
     [not found] ` <handler.33129.B.15403106928776.ack@debbugs.gnu.org>
2018-10-23 16:10   ` Daniel Pittman [this message]
2018-11-03  8:37     ` bug#33129: Acknowledgement (26.1; `vc-hg-find-file-hook' can never detect files with conflicts) Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAC45yQupLY8LjZiFjAFRk8ZfhCGhm3xJGS+tE1oTVu2THe3h8g@mail.gmail.com \
    --to=slippycheeze@google.com \
    --cc=33129@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.