[Top][All Lists]

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

master 561840b: vc-hg: prompt for branch to merge

From: Eli Zaretskii
Subject: master 561840b: vc-hg: prompt for branch to merge
Date: Sat, 30 Nov 2019 07:01:59 -0500 (EST)

branch: master
commit 561840b553274207f814b33a211ce7e12c92c9a6
Author: Andrii Kolomoiets <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    vc-hg: prompt for branch to merge
    * lisp/vc/vc-hg.el (vc-hg-merge-branch): Prompt for revision to merge.
    (vc-hg-revision-table): Use branches, tags and bookmarks as competion
    * etc/NEWS: Mention changes of vc-hg.el
    * doc/emacs/maintaining.texi (Switching Branches): Mention 'hg update'
    (Merging): Mention 'hg merge' command.
    This fixes bug#22860
 doc/emacs/maintaining.texi |  9 ++++++---
 etc/NEWS                   |  9 +++++++++
 lisp/vc/vc-hg.el           | 13 +++++++++----
 3 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi
index 4bda4c9..7570fef 100644
--- a/doc/emacs/maintaining.texi
+++ b/doc/emacs/maintaining.texi
@@ -1443,7 +1443,9 @@ the @command{git checkout} command, which changes the 
contents of the
 working tree to match the branch you switch to.  Bazaar also supports
 co-located branches, in which case the @command{bzr switch} command
 will switch branches in the current directory.  With Subversion, you
-switch to another branch using the @command{svn switch} command.
+switch to another branch using the @command{svn switch} command.  With
+Mercurial, command @command{hg update} is used to swith to another
   The VC command to switch to another branch in the current directory
 is @kbd{C-x v r @var{branch-name} @key{RET}} (@code{vc-retrieve-tag}).
@@ -1558,8 +1560,9 @@ command @kbd{C-x v m} (@code{vc-merge}).  On Bazaar, this 
prompts for
 the exact arguments to pass to @command{bzr merge}, offering a
 sensible default if possible.  On Git, this prompts for the name of a
 branch to merge from, with completion (based on the branch names known
-to the current repository).  The output from running the merge command
-is shown in a separate buffer.
+to the current repository).  With Mercurial, this prompts for argument
+to pass to @command{hg merge}.  The output from running the merge
+command is shown in a separate buffer.
   On a centralized version control system like CVS, @kbd{C-x v m}
 prompts for a branch ID, or a pair of revision IDs (@pxref{Switching
diff --git a/etc/NEWS b/etc/NEWS
index 57dbc93..2cbc373 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -973,6 +973,15 @@ The 'C-x v h' command now works in buffers that visit 
files controlled
 by Hg.
+*** The Hg (Mercurial) back-end now prompts for revision to merge when
+you invoke 'C-x v m' ('vc-merge').
+*** The Hg (Mercurial) back-end now use tags, branches and bookmarks
+instead of revision numbers as completion candidates when it prompts
+for a revision.
 *** 'C-u C-x v D' ('vc-root-version-diff') prompts for two revisions
 and compares their entire trees.
diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
index c9407b1..e0c46b2 100644
--- a/lisp/vc/vc-hg.el
+++ b/lisp/vc/vc-hg.el
@@ -566,7 +566,9 @@ This requires hg 4.4 or later, for the \"-L\" option of 
\"hg log\"."
 (defun vc-hg-revision-table (files)
   (let ((default-directory (file-name-directory (car files))))
-      (vc-hg-command t nil files "log" "--template" "{rev} ")
+      (vc-hg-command t nil nil "branches" "-q")
+      (vc-hg-command t nil nil "bookmarks" "-q")
+      (vc-hg-command t nil nil "tags" "-q")
        (buffer-substring-no-properties (point-min) (point-max))))))
@@ -1487,13 +1489,16 @@ call \"hg push -r REVS\" to push the specified 
revisions REVS."
   (vc-hg--pushpull "push" prompt nil (called-interactively-p 'interactive)))
 (defun vc-hg-merge-branch ()
-  "Merge incoming changes into the current working directory.
+  "Prompt for revision and merge it into working directory.
 This runs the command \"hg merge\"."
   (let* ((root (vc-hg-root default-directory))
         (buffer (format "*vc-hg : %s*" (expand-file-name root)))
          ;; Disable pager.
-         (process-environment (cons "HGPLAIN=1" process-environment)))
-    (apply 'vc-do-async-command buffer root vc-hg-program '("--config" 
"ui.report_untrusted=0" "merge"))
+         (process-environment (cons "HGPLAIN=1" process-environment))
+         (branch (vc-read-revision "Revision to merge: ")))
+    (apply 'vc-do-async-command buffer root vc-hg-program
+           (append '("--config" "ui.report_untrusted=0" "merge")
+                   (unless (string= branch "") (list branch))))
     (with-current-buffer buffer (vc-run-delayed (vc-compilation-mode 'hg)))
     (vc-set-async-update buffer)))

reply via email to

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