unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Unable to a new branch with VC commit
@ 2021-03-11 20:46 Tero Mononen
  2021-03-12  9:50 ` Robert Pluim
  0 siblings, 1 reply; 7+ messages in thread
From: Tero Mononen @ 2021-03-11 20:46 UTC (permalink / raw)
  To: help-gnu-emacs

Dear Emacs people,

Most likely I'm doing something wrong but I don't know what.

I haven't managed to create a new Mercurial branch in Emacs. According 
to manual [1] it should happen with C-u C-x v v. It does request "New 
revision or backend". I give name of the new branch, and then commit 
changes. Surprisingly, commit ends up to the active branch instead of 
the new one. I.e., it completely ignores my input.

I tested the same procedure also with Git and the result was also the same.

My workaround is to change branch manually with "hg branch" command and 
then use VC in emacs. But, I'm wondering how to do the whole process 
with VC.

[1] 
https://www.gnu.org/software/emacs/manual/html_node/emacs/Creating-Branches.html#Creating-Branches



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

* Re: Unable to a new branch with VC commit
  2021-03-11 20:46 Unable to a new branch with VC commit Tero Mononen
@ 2021-03-12  9:50 ` Robert Pluim
  2021-03-12 10:15   ` Tero Mononen
  2021-03-12 12:39   ` Eli Zaretskii
  0 siblings, 2 replies; 7+ messages in thread
From: Robert Pluim @ 2021-03-12  9:50 UTC (permalink / raw)
  To: Tero Mononen; +Cc: help-gnu-emacs

>>>>> On Thu, 11 Mar 2021 22:46:54 +0200, Tero Mononen <tero@ooe.fi> said:

    Tero> Dear Emacs people,
    Tero> Most likely I'm doing something wrong but I don't know what.

    Tero> I haven't managed to create a new Mercurial branch in
    Tero> Emacs. According to manual [1] it should happen with C-u C-x
    Tero> v v. It does request "New revision or backend". I give name
    Tero> of the new branch, and then commit changes. Surprisingly,
    Tero> commit ends up to the active branch instead of the new
    Tero> one. I.e., it completely ignores my input.

    Tero> I tested the same procedure also with Git and the result was
    Tero> also the same.

Neither git nor Mercurial fall under the "On centralized version
control systems" clause of the 'Creating New Branches'
documentation. You should be able to create a branch on both git and
Mercurial by doing 'C-u C-x v s', which runs 'vc-create-tag'.

Robert
-- 



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

* Re: Unable to a new branch with VC commit
  2021-03-12  9:50 ` Robert Pluim
@ 2021-03-12 10:15   ` Tero Mononen
  2021-03-12 10:46     ` Robert Pluim
  2021-03-12 12:39   ` Eli Zaretskii
  1 sibling, 1 reply; 7+ messages in thread
From: Tero Mononen @ 2021-03-12 10:15 UTC (permalink / raw)
  To: help-gnu-emacs

Oh, thanks.

It works "correctly" with Git but with Mercurial it doesn't create named 
branch but
a bookmark. Then I found related reported bug:
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=38425


Thanks,
Tero

On 12/03/2021 11.50, Robert Pluim wrote:
>>>>>> On Thu, 11 Mar 2021 22:46:54 +0200, Tero Mononen <tero@ooe.fi> said:
>      Tero> Dear Emacs people,
>      Tero> Most likely I'm doing something wrong but I don't know what.
>
>      Tero> I haven't managed to create a new Mercurial branch in
>      Tero> Emacs. According to manual [1] it should happen with C-u C-x
>      Tero> v v. It does request "New revision or backend". I give name
>      Tero> of the new branch, and then commit changes. Surprisingly,
>      Tero> commit ends up to the active branch instead of the new
>      Tero> one. I.e., it completely ignores my input.
>
>      Tero> I tested the same procedure also with Git and the result was
>      Tero> also the same.
>
> Neither git nor Mercurial fall under the "On centralized version
> control systems" clause of the 'Creating New Branches'
> documentation. You should be able to create a branch on both git and
> Mercurial by doing 'C-u C-x v s', which runs 'vc-create-tag'.
>
> Robert




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

* Re: Unable to a new branch with VC commit
  2021-03-12 10:15   ` Tero Mononen
@ 2021-03-12 10:46     ` Robert Pluim
  0 siblings, 0 replies; 7+ messages in thread
From: Robert Pluim @ 2021-03-12 10:46 UTC (permalink / raw)
  To: Tero Mononen; +Cc: help-gnu-emacs

>>>>> On Fri, 12 Mar 2021 12:15:24 +0200, Tero Mononen <tero@ooe.fi> said:

    Tero> Oh, thanks.
    Tero> It works "correctly" with Git but with Mercurial it doesn't create
    Tero> named branch but
    Tero> a bookmark. Then I found related reported bug:
    Tero> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=38425

Which is fixed in emacs-28. Iʼve updated the emacs documentation about
creating branches as well.

Robert
-- 



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

* Re: Unable to a new branch with VC commit
  2021-03-12  9:50 ` Robert Pluim
  2021-03-12 10:15   ` Tero Mononen
@ 2021-03-12 12:39   ` Eli Zaretskii
  2021-03-12 14:21     ` Robert Pluim
  1 sibling, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2021-03-12 12:39 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Robert Pluim <rpluim@gmail.com>
> Date: Fri, 12 Mar 2021 10:50:10 +0100
> Cc: help-gnu-emacs@gnu.org
> 
> Neither git nor Mercurial fall under the "On centralized version
> control systems" clause of the 'Creating New Branches'
> documentation.

Is there any good reason why "C-u C-x v v" won't work for a dVCS?
There's an advantage in keeping the UI consistent as much as
reasonably practical, even though the two VCS types are very
different.

> You should be able to create a branch on both git and
> Mercurial by doing 'C-u C-x v s', which runs 'vc-create-tag'.

vc-create-tag is a strange name for making a branch, which probably
doesn't help discoverability.



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

* Re: Unable to a new branch with VC commit
  2021-03-12 12:39   ` Eli Zaretskii
@ 2021-03-12 14:21     ` Robert Pluim
  2021-03-12 15:14       ` Robert Pluim
  0 siblings, 1 reply; 7+ messages in thread
From: Robert Pluim @ 2021-03-12 14:21 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

>>>>> On Fri, 12 Mar 2021 14:39:05 +0200, Eli Zaretskii <eliz@gnu.org> said:

    >> From: Robert Pluim <rpluim@gmail.com>
    >> Date: Fri, 12 Mar 2021 10:50:10 +0100
    >> Cc: help-gnu-emacs@gnu.org
    >> 
    >> Neither git nor Mercurial fall under the "On centralized version
    >> control systems" clause of the 'Creating New Branches'
    >> documentation.

    Eli> Is there any good reason why "C-u C-x v v" won't work for a dVCS?
    Eli> There's an advantage in keeping the UI consistent as much as
    Eli> reasonably practical, even though the two VCS types are very
    Eli> different.

I donʼt see why it shouldn't. Someone just needs to add the right
incantations to vc-git-checkin and vc-hg-checkin (and maybe
vc-bazaar-checkin), and deprecate the vc-create-tag branch-creating
usage.

    >> You should be able to create a branch on both git and
    >> Mercurial by doing 'C-u C-x v s', which runs 'vc-create-tag'.

    Eli> vc-create-tag is a strange name for making a branch, which probably
    Eli> doesn't help discoverability.

I donʼt know the original rationale: Iʼve forgotten everything I ever
learned about the equivalence of tags and branches in RCS/CVS :-)

Robert
-- 



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

* Re: Unable to a new branch with VC commit
  2021-03-12 14:21     ` Robert Pluim
@ 2021-03-12 15:14       ` Robert Pluim
  0 siblings, 0 replies; 7+ messages in thread
From: Robert Pluim @ 2021-03-12 15:14 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs, Tero Mononen

>>>>> On Fri, 12 Mar 2021 15:21:12 +0100, Robert Pluim <rpluim@gmail.com> said:

>>>>> On Fri, 12 Mar 2021 14:39:05 +0200, Eli Zaretskii <eliz@gnu.org> said:
    >>> From: Robert Pluim <rpluim@gmail.com>
    >>> Date: Fri, 12 Mar 2021 10:50:10 +0100
    >>> Cc: help-gnu-emacs@gnu.org
    >>> 
    >>> Neither git nor Mercurial fall under the "On centralized version
    >>> control systems" clause of the 'Creating New Branches'
    >>> documentation.

    Eli> Is there any good reason why "C-u C-x v v" won't work for a dVCS?
    Eli> There's an advantage in keeping the UI consistent as much as
    Eli> reasonably practical, even though the two VCS types are very
    Eli> different.

    Robert> I donʼt see why it shouldn't. Someone just needs to add the right
    Robert> incantations to vc-git-checkin and vc-hg-checkin (and maybe
    Robert> vc-bazaar-checkin), and deprecate the vc-create-tag branch-creating
    Robert> usage.

Something like this untested patch for vc-git. Tero, does this work
for you?

diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 465ed8735c..287512c255 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -915,7 +915,7 @@ vc-git-log-edit-mode
   "Major mode for editing Git log messages.
 It is based on `log-edit-mode', and has Git-specific extensions.")
 
-(defun vc-git-checkin (files comment &optional _rev)
+(defun vc-git-checkin (files comment &optional rev)
   (let* ((file1 (or (car files) default-directory))
          (root (vc-git-root file1))
          (default-directory (expand-file-name root))
@@ -937,6 +937,10 @@ vc-git-checkin
           (if (eq system-type 'windows-nt)
               (let ((default-directory (file-name-directory file1)))
                 (make-nearby-temp-file "git-msg")))))
+    ;; When specified 'rev' is a branch name to create.
+    (when rev
+      (vc-git-command nil 0 nil "update-index" "--refresh")
+      (vc-git-command nil 0 nil "checkout" "-b" rev))
     (cl-flet ((boolean-arg-fn
                (argument)
                (lambda (value) (when (equal value "yes") (list argument)))))

Robert
-- 



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

end of thread, other threads:[~2021-03-12 15:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-11 20:46 Unable to a new branch with VC commit Tero Mononen
2021-03-12  9:50 ` Robert Pluim
2021-03-12 10:15   ` Tero Mononen
2021-03-12 10:46     ` Robert Pluim
2021-03-12 12:39   ` Eli Zaretskii
2021-03-12 14:21     ` Robert Pluim
2021-03-12 15:14       ` Robert Pluim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).