[PATCH 1 of 3] rebase: add a 'revtodo' constant to
Mads Kiilerich
mads at kiilerich.com
Tue Dec 2 19:02:30 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 1417542380 28800
> # Tue Dec 02 09:46:20 2014 -0800
> # Node ID 0e50f872225ac6082796871f236c05c2e51a4d25
> # Parent 6b2953028561f9b49fb79e975d68e85e8666f13a
> rebase: add a 'revtodo' constant to
to what?
> The state mapping is using '-1' to mark revision that have not been rebased yet.
> We introduce and use a constant for that purpose. This will help emphasising the
> fact the value mean something else than nullrev.
>
> diff --git a/hgext/rebase.py b/hgext/rebase.py
> --- a/hgext/rebase.py
> +++ b/hgext/rebase.py
> @@ -808,11 +809,11 @@ def inrebase(repo, originalwd, state):
>
> return False
>
> def abort(repo, originalwd, target, state):
> 'Restore the repository to its original state'
> - dstates = [s for s in state.values() if s > nullrev]
> + dstates = [s for s in state.values() if s > revtodo]
I am not sure revtodo is more correct here than nullrev. If you don't
want to rely on nullrev=0-1 then I think it would be more correct to use
>= 0 to filter out all normal revision numbers. That is also what is
used in clearrebased.
> @@ -831,11 +832,11 @@ def abort(repo, originalwd, target, stat
> # Update away from the rebase if necessary
> if inrebase(repo, originalwd, state):
> merge.update(repo, repo[originalwd].rev(), False, True, False)
>
> # Strip from the first rebased revision
> - rebased = filter(lambda x: x > -1 and x != target, state.values())
> + rebased = filter(lambda x: x > revtodo and x != target, state.values())
Again, when we don't rely on revtodo==nullrev=-1, wouldn't it be more
correct to use >= 0?
/Mads
More information about the Mercurial-devel
mailing list