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

* bug#38425: 27.0.50; [PATCH] vc-hg-create-tag: Possibility to create a branch
  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
  0 siblings, 1 reply; 7+ messages in thread
From: Dmitry Gutov @ 2019-11-29 15:14 UTC (permalink / raw)
  To: Andrii Kolomoiets, 38425

On 29.11.2019 17:03, Andrii Kolomoiets wrote:
> +*** 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')

Do some Mercurial users or projects predominantly work with branches, 
while others - with bookmarks?





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

* bug#38425: 27.0.50; [PATCH] vc-hg-create-tag: Possibility to create a branch
  2019-11-29 15:14 ` Dmitry Gutov
@ 2019-11-29 18:30   ` Andrii Kolomoiets
  2019-11-29 22:21     ` Dmitry Gutov
  0 siblings, 1 reply; 7+ messages in thread
From: Andrii Kolomoiets @ 2019-11-29 18:30 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 38425

On 29 Nov 2019, at 17:14, Dmitry Gutov <dgutov@yandex.ru> wrote:
> 
> On 29.11.2019 17:03, Andrii Kolomoiets wrote:
>> +*** 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')
> 
> Do some Mercurial users or projects predominantly work with branches, while others - with bookmarks?

I think so. They even can be used together in one repository.




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

* bug#38425: 27.0.50; [PATCH] vc-hg-create-tag: Possibility to create a branch
  2019-11-29 18:30   ` Andrii Kolomoiets
@ 2019-11-29 22:21     ` Dmitry Gutov
  2019-11-29 23:01       ` Andrii Kolomoiets
  0 siblings, 1 reply; 7+ messages in thread
From: Dmitry Gutov @ 2019-11-29 22:21 UTC (permalink / raw)
  To: Andrii Kolomoiets; +Cc: 38425

On 29.11.2019 20:30, Andrii Kolomoiets wrote:
> On 29 Nov 2019, at 17:14, Dmitry Gutov <dgutov@yandex.ru> wrote:
>>
>> On 29.11.2019 17:03, Andrii Kolomoiets wrote:
>>> +*** 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')
>>
>> Do some Mercurial users or projects predominantly work with branches, while others - with bookmarks?
> 
> I think so. They even can be used together in one repository.

That "even" is why I'm asking. If, on average, the user has to deal with 
both then the new option won't help. vc-hg might as well only one or the 
other in vc-create-tag, leaving the alternative to the command line.





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

* bug#38425: 27.0.50; [PATCH] vc-hg-create-tag: Possibility to create a branch
  2019-11-29 22:21     ` Dmitry Gutov
@ 2019-11-29 23:01       ` Andrii Kolomoiets
  2019-11-29 23:03         ` Andrii Kolomoiets
  0 siblings, 1 reply; 7+ messages in thread
From: Andrii Kolomoiets @ 2019-11-29 23:01 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 38425

On 30 Nov 2019, at 00:21, Dmitry Gutov <dgutov@yandex.ru> wrote:
> 
> On 29.11.2019 20:30, Andrii Kolomoiets wrote:
>> On 29 Nov 2019, at 17:14, Dmitry Gutov <dgutov@yandex.ru> wrote:
>>> 
>>> On 29.11.2019 17:03, Andrii Kolomoiets wrote:
>>>> +*** 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')
>>> 
>>> Do some Mercurial users or projects predominantly work with branches, while others - with bookmarks?
>> I think so. They even can be used together in one repository.
> 
> That "even" is why I'm asking. If, on average, the user has to deal with both then the new option won't help. vc-hg might as well only one or the other in vc-create-tag, leaving the alternative to the command line.

Why not? I've added option 'ask' so user can create branch or bookmark. Default value t is set for backward capability.




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

* bug#38425: 27.0.50; [PATCH] vc-hg-create-tag: Possibility to create a branch
  2019-11-29 23:01       ` Andrii Kolomoiets
@ 2019-11-29 23:03         ` Andrii Kolomoiets
  2020-08-09 12:28           ` Lars Ingebrigtsen
  0 siblings, 1 reply; 7+ messages in thread
From: Andrii Kolomoiets @ 2019-11-29 23:03 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 38425

On 30 Nov 2019, at 01:01, Andrii Kolomoiets <andreyk.mad@gmail.com> wrote:
> 
> On 30 Nov 2019, at 00:21, Dmitry Gutov <dgutov@yandex.ru> wrote:
>> 
>> On 29.11.2019 20:30, Andrii Kolomoiets wrote:
>>> On 29 Nov 2019, at 17:14, Dmitry Gutov <dgutov@yandex.ru> wrote:
>>>> 
>>>> On 29.11.2019 17:03, Andrii Kolomoiets wrote:
>>>>> +*** 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')
>>>> 
>>>> Do some Mercurial users or projects predominantly work with branches, while others - with bookmarks?
>>> I think so. They even can be used together in one repository.
>> 
>> That "even" is why I'm asking. If, on average, the user has to deal with both then the new option won't help. vc-hg might as well only one or the other in vc-create-tag, leaving the alternative to the command line.
> 
> Why not? I've added option 'ask' so user can create branch or bookmark. Default value t is set for backward capability.

Sorry, backward compatibility.




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

* bug#38425: 27.0.50; [PATCH] vc-hg-create-tag: Possibility to create a branch
  2019-11-29 23:03         ` Andrii Kolomoiets
@ 2020-08-09 12:28           ` Lars Ingebrigtsen
  0 siblings, 0 replies; 7+ messages in thread
From: Lars Ingebrigtsen @ 2020-08-09 12:28 UTC (permalink / raw)
  To: Andrii Kolomoiets; +Cc: Dmitry Gutov, 38425

Andrii Kolomoiets <andreyk.mad@gmail.com> writes:

>>> That "even" is why I'm asking. If, on average, the user has to deal
>>> with both then the new option won't help. vc-hg might as well only
>>> one or the other in vc-create-tag, leaving the alternative to the
>>> command line.
>> 
>> Why not? I've added option 'ask' so user can create branch or
>> bookmark. Default value t is set for backward capability.
>
> Sorry, backward compatibility.

I think that makes sense, so I've applied your patch to Emacs 28.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[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.