[PATCH 2 of 3] rebase: handle revtodo as a special value when storing/restoring state
Mads Kiilerich
mads at kiilerich.com
Tue Dec 2 19:03:13 CST 2014
On 12/02/2014 09:32 PM, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at fb.com>
> # Date 1417551792 28800
> # Tue Dec 02 12:23:12 2014 -0800
> # Node ID 627b344d81f64444216dc0ac7cfc33d63d7fcdff
> # Parent 0e50f872225ac6082796871f236c05c2e51a4d25
> rebase: handle revtodo as a special value when storing/restoring state
>
> Revtodo happen to share its value with nullrev but this is an implementation
> details. So we move away from it.
>
> diff --git a/hgext/rebase.py b/hgext/rebase.py
> --- a/hgext/rebase.py
> +++ b/hgext/rebase.py
> @@ -728,11 +728,11 @@ def storestatus(repo, originalwd, target
> f.write('%d\n' % int(keep))
> f.write('%d\n' % int(keepbranches))
> f.write('%s\n' % (activebookmark or ''))
> for d, v in state.iteritems():
> oldrev = repo[d].hex()
> - if v > nullmerge:
> + if v >= 0:
> newrev = repo[v].hex()
> else:
> newrev = v
> f.write("%s:%s\n" % (oldrev, newrev))
This will change the file format from storing revtodo as '0'*40 to '-1'.
Is that intentional and a good idea? AFAICS that means that old hg will
fail to read a new rebasestate file correctly. I don't think that is OK.
You can make revtodo independent of nullrev if you want, but I think you
still have to store it as hex(nullid). I thus don't see much point in
using a different constant than nullrev.
/Mads
> f.close()
> @@ -769,11 +769,11 @@ def restorestatus(repo):
> # line 6 is a recent addition, so for backwards compatibility
> # check that the line doesn't look like the oldrev:newrev lines
> activebookmark = l
> else:
> oldrev, newrev = l.split(':')
> - if newrev in (str(nullmerge), str(revignored)):
> + if newrev in (str(revtodo), str(nullmerge), str(revignored)):
> state[repo[oldrev].rev()] = int(newrev)
> else:
> state[repo[oldrev].rev()] = repo[newrev].rev()
>
> if keepbranches is None:
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
More information about the Mercurial-devel
mailing list