all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#38425: 27.0.50; [PATCH] vc-hg-create-tag: Possibility to create a branch
@ 2019-11-29 15:03 Andrii Kolomoiets
  2019-11-29 15:14 ` Dmitry Gutov
  0 siblings, 1 reply; 7+ messages in thread
From: Andrii Kolomoiets @ 2019-11-29 15:03 UTC (permalink / raw)
  To: 38425

[-- Attachment #1: Type: text/plain, Size: 190 bytes --]

Hello.

Mercurial supports two kind of branches: named branch and bookmark.

vc-hg-create-tag can create only a bookmark (Bug#17586).

This patch adds possibility to create a named branch.


[-- Attachment #2: 0001-vc-hg-create-tag-Possibility-to-create-a-branch.patch --]
[-- Type: application/octet-stream, Size: 2821 bytes --]

From db47e6703f098050467f589288dc002131bc34e0 Mon Sep 17 00:00:00 2001
From: Andrii Kolomoiets <andreyk.mad@gmail.com>
Date: Fri, 29 Nov 2019 16:55:27 +0200
Subject: [PATCH] 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.
* etc/NEWS: Mention it.
---
 etc/NEWS         |  3 +++
 lisp/vc/vc-hg.el | 24 +++++++++++++++++++++---
 2 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index cb73e46358..aa8101d69e 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -979,6 +979,9 @@ and compares their entire trees.
 *** New user option 'vc-hg-revert-switches' specifies switches to pass
 to Hg revert.
 
+*** 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').
+
 *** 'C-x v M D' ('vc-diff-mergebase') and 'C-x v M L' ('vc-log-mergebase')
 print diffs and logs between the merge base (common ancestor) of two
 given revisions.
diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
index 5ff1a6204b..69f2b6d856 100644
--- a/lisp/vc/vc-hg.el
+++ b/lisp/vc/vc-hg.el
@@ -184,6 +184,16 @@ vc-hg-root-log-format
   :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 "27.1")
+
 \f
 ;; Clear up the cache to force vc-call to check again and discover
 ;; new functions when we reload this file.
@@ -619,10 +629,18 @@ vc-hg-annotate-extract-revision-at-line
 ;;; 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."
-- 
2.15.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-08-09 12:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-29 15:03 bug#38425: 27.0.50; [PATCH] vc-hg-create-tag: Possibility to create a branch Andrii Kolomoiets
2019-11-29 15:14 ` Dmitry Gutov
2019-11-29 18:30   ` Andrii Kolomoiets
2019-11-29 22:21     ` Dmitry Gutov
2019-11-29 23:01       ` Andrii Kolomoiets
2019-11-29 23:03         ` Andrii Kolomoiets
2020-08-09 12:28           ` Lars Ingebrigtsen

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.