From: Andrii Kolomoiets <andreyk.mad@gmail.com>
To: 38425@debbugs.gnu.org
Subject: bug#38425: 27.0.50; [PATCH] vc-hg-create-tag: Possibility to create a branch
Date: Fri, 29 Nov 2019 17:03:33 +0200 [thread overview]
Message-ID: <3AFDE56F-43D3-47BC-BC1E-0A72D48D17F4@gmail.com> (raw)
[-- 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
next reply other threads:[~2019-11-29 15:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-29 15:03 Andrii Kolomoiets [this message]
2019-11-29 15:14 ` bug#38425: 27.0.50; [PATCH] vc-hg-create-tag: Possibility to create a branch 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
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=3AFDE56F-43D3-47BC-BC1E-0A72D48D17F4@gmail.com \
--to=andreyk.mad@gmail.com \
--cc=38425@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.