Patchwork D3753: graft: store the node from where we started the operation in graftstate

login
register
mail settings
Submitter phabricator
Date June 15, 2018, 8:10 p.m.
Message ID <differential-rev-PHID-DREV-f76eoj6syk77xk3csv2c-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/32184/
State Superseded
Headers show

Comments

phabricator - June 15, 2018, 8:10 p.m.
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This will help us in updating to the start node when the user does `hg graft
  --abort`.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3753

AFFECTED FILES
  mercurial/commands.py

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-devel
Yuya Nishihara - June 16, 2018, 1:58 p.m.
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -2233,6 +2233,8 @@
>              raise error.Abort(_('no revisions specified'))
>          cmdutil.checkunfinished(repo)
>          cmdutil.bailifchanged(repo)
> +        # the node from where we started the graft operation
> +        statedata['startnode'] = repo['.'].node()

Nit: Isn't it always the parent of the `newnodes[0]`?

I don't have strong opinion whether we should store the startnode, but if
we store it at the start of the graft, I think we won't need to care for
`statedata.get('newnodes') is None` case, in the first patch. I mean we can
always record newnodes no matter if it may be incomplete or not since the
existence of the startnode gives us a trust.
phabricator - June 16, 2018, 2:04 p.m.
yuja added a comment.


  > - a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2233,6 +2233,8 @@ raise error.Abort(_('no revisions specified')) cmdutil.checkunfinished(repo) cmdutil.bailifchanged(repo) +        # the node from where we started the graft operation +        statedata['startnode'] = repo['.'].node()
  
  Nit: Isn't it always the parent of the `newnodes[0]`?
  
  I don't have strong opinion whether we should store the startnode, but if
  we store it at the start of the graft, I think we won't need to care for
  `statedata.get('newnodes') is None` case, in the first patch. I mean we can
  always record newnodes no matter if it may be incomplete or not since the
  existence of the startnode gives us a trust.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3753

To: pulkit, #hg-reviewers
Cc: yuja, mercurial-devel
phabricator - June 24, 2018, 7:50 p.m.
pulkit abandoned this revision.
pulkit added a comment.


  In https://phab.mercurial-scm.org/D3753#58884, @yuja wrote:
  
  > > - a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2233,6 +2233,8 @@ raise error.Abort(_('no revisions specified')) cmdutil.checkunfinished(repo) cmdutil.bailifchanged(repo) +        # the node from where we started the graft operation +        statedata['startnode'] = repo['.'].node()
  >
  > Nit: Isn't it always the parent of the `newnodes[0]`?
  
  
  Oh, yes. Let's not store the startnode.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3753

To: pulkit, #hg-reviewers
Cc: yuja, mercurial-devel

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2233,6 +2233,8 @@ 
             raise error.Abort(_('no revisions specified'))
         cmdutil.checkunfinished(repo)
         cmdutil.bailifchanged(repo)
+        # the node from where we started the graft operation
+        statedata['startnode'] = repo['.'].node()
         revs = scmutil.revrange(repo, revs)
 
     skipped = set()