emacs-diffs
[Top][All Lists]
Advanced

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

master c789c3a: vc-hg-create-tag: Possibility to create a branch


From: Lars Ingebrigtsen
Subject: master c789c3a: vc-hg-create-tag: Possibility to create a branch
Date: Sun, 9 Aug 2020 08:31:14 -0400 (EDT)

branch: master
commit c789c3aac66943497f771896ec13bae618f86a01
Author: Andrii Kolomoiets <andreyk.mad@gmail.com>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    vc-hg-create-tag: Possibility to create a branch
    
    * lisp/vc/vc-hg.el (vc-hg-create-bookmark): New user option.
    (vc-hg-create-tag): Use it (bug#38425).
---
 etc/NEWS         |  4 ++++
 lisp/vc/vc-hg.el | 24 +++++++++++++++++++++---
 2 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 1e4fe47..25ee6e1 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -232,6 +232,10 @@ their 'default-directory' under VC.
 *** Support for bookmark.el.
 Bookmark locations can refer to VC directory buffers.
 
+---
+*** New user option 'vc-hg-create-bookmark' controls whether a bookmark
+or branch will be created when you invoke 'C-u C-x v s' ('vc-create-tag').
+
 ** Gnus
 
 ---
diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
index 95ced7b..09f8043 100644
--- a/lisp/vc/vc-hg.el
+++ b/lisp/vc/vc-hg.el
@@ -186,6 +186,16 @@ highlighting the Log View buffer."
   :group 'vc-hg
   :version "24.5")
 
+(defcustom vc-hg-create-bookmark t
+  "This controls whether `vc-create-tag' will create a bookmark or branch.
+If nil, named branch will be created.
+If t, bookmark will be created.
+If `ask', you will be prompted for a branch type."
+  :type '(choice (const :tag "No" nil)
+                 (const :tag "Yes" t)
+                 (const :tag "Ask" ask))
+  :version "28.1")
+
 
 ;; Clear up the cache to force vc-call to check again and discover
 ;; new functions when we reload this file.
@@ -625,10 +635,18 @@ Optional arg REVISION is a revision to annotate from."
 ;;; Tag system
 
 (defun vc-hg-create-tag (dir name branchp)
-  "Attach the tag NAME to the state of the working copy."
+  "Create tag NAME in repo in DIR.  Create branch if BRANCHP.
+Variable `vc-hg-create-bookmark' controls what kind of branch will be created."
   (let ((default-directory dir))
-    (and (vc-hg-command nil 0 nil "status")
-         (vc-hg-command nil 0 nil (if branchp "bookmark" "tag") name))))
+    (vc-hg-command nil 0 nil
+                   (if branchp
+                       (if (if (eq vc-hg-create-bookmark 'ask)
+                               (yes-or-no-p "Create bookmark instead of 
branch? ")
+                             vc-hg-create-bookmark)
+                           "bookmark"
+                         "branch")
+                     "tag")
+                   name)))
 
 (defun vc-hg-retrieve-tag (dir name _update)
   "Retrieve the version tagged by NAME of all registered files at or below 
DIR."



reply via email to

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