* bug#33129: 26.1; `vc-hg-find-file-hook' can never detect files with conflicts @ 2018-10-23 16:03 Daniel Pittman [not found] ` <handler.33129.B.15403106928776.ack@debbugs.gnu.org> 0 siblings, 1 reply; 3+ messages in thread From: Daniel Pittman @ 2018-10-23 16:03 UTC (permalink / raw) To: 33129 [-- Attachment #1: Type: text/plain, Size: 1036 bytes --] The `vc-hg-find-file-hook' tries to automatically invoke `smerge-mode' when a file with conflicts is visited. Unfortunately, due to incorrect assumptions, it rarely -- possibly never -- actually manages to detect the files. There are two incorrect assumptions in the code that prevent this: First, that `vc-state' will already be cached by the backend, which is not true in at least the cases of visiting the file, reverting the file, or using `vc-refresh-state'. It is certainly possible that in some case or other the hook works, this assumption means that it is almost never going to behave as intended. Second, it assumes that a ".orig" backup file is created by Mercurial next to the current file, which is only true by default: these files can be redirected to an alternate path, or disabled entirely, by the user. This is especially common when working on a network file-system, since additional file operations can slow down the Mercurial merge process, or when users have some other mechanism to handle the failure case. [-- Attachment #2: Type: text/html, Size: 1149 bytes --] ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <handler.33129.B.15403106928776.ack@debbugs.gnu.org>]
* bug#33129: Acknowledgement (26.1; `vc-hg-find-file-hook' can never detect files with conflicts) [not found] ` <handler.33129.B.15403106928776.ack@debbugs.gnu.org> @ 2018-10-23 16:10 ` Daniel Pittman 2018-11-03 8:37 ` Eli Zaretskii 0 siblings, 1 reply; 3+ messages in thread From: Daniel Pittman @ 2018-10-23 16:10 UTC (permalink / raw) To: 33129 [-- 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 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* bug#33129: Acknowledgement (26.1; `vc-hg-find-file-hook' can never detect files with conflicts) 2018-10-23 16:10 ` bug#33129: Acknowledgement (26.1; `vc-hg-find-file-hook' can never detect files with conflicts) Daniel Pittman @ 2018-11-03 8:37 ` Eli Zaretskii 0 siblings, 0 replies; 3+ messages in thread From: Eli Zaretskii @ 2018-11-03 8:37 UTC (permalink / raw) To: Daniel Pittman; +Cc: 33129-done > From: Daniel Pittman <slippycheeze@google.com> > Date: Tue, 23 Oct 2018 12:10:35 -0400 > > Please find attached a patch fixing both the issues identified in this bug: Thanks, pushed to the master branch. ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-11-03 8:37 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 ` bug#33129: Acknowledgement (26.1; `vc-hg-find-file-hook' can never detect files with conflicts) Daniel Pittman 2018-11-03 8:37 ` Eli Zaretskii
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.