[PATCH] rebase: 'pull --rebase' rebase on new branching only

Pierre-Yves David pierre-yves.david at ens-lyon.org
Thu May 5 18:57:46 EDT 2016



On 05/05/2016 10:45 PM, Martin von Zweigbergk wrote:
> On Thu, May 5, 2016 at 9:04 AM, Pierre-Yves David
> <pierre-yves.david at ens-lyon.org> wrote:
>> # HG changeset patch
>> # User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
>> # Date 1462366525 -7200
>> #      Wed May 04 14:55:25 2016 +0200
>> # Node ID 7e72800c070d941f294c4e7ed91db29a08bac073
>> # Parent  906a1c8a75fd8a18e43e8545eedcbe5222f84647
>> # EXP-Topic pull.rebase
>> rebase: 'pull --rebase' rebase on new branching only
> Meant for stable?

No, this is a new behavior making 'hg pull --rebase' a bit closer to its 
initial intend (and therefore hopefully more reliable to build work-flow 
on) but the 3.7 behavior was even more baroque so no regression testing 
here.

>> Previously, if two heads existed on the current branch before the pull and the
>> pull add changeset on the one unrelated to the working copy 'hg pull --rebase'
>> would trigger a rebase on that branch. This might not what the user wants
>> as they could have resolved the head situation before pulling if they wanted to.
>>
>> Therefore, we restrict the set of destination candidate to 'hg pull --rebase' to
>> the set of pulled changesets that create a branching from the current working
>> copy branch.
>>
>> diff -r 906a1c8a75fd -r 7e72800c070d hgext/rebase.py
>> --- a/hgext/rebase.py   Wed May 04 06:44:44 2016 +0900
>> +++ b/hgext/rebase.py   Wed May 04 14:55:25 2016 +0200
>> @@ -1245,15 +1245,18 @@ def pullrebase(orig, ui, repo, *args, **
>>                   if 'source' in opts:
>>                       del opts['source']
>>                   # revsprepull is the len of the repo, not revnum of tip.
>> -                destspace = list(repo.changelog.revs(start=revsprepull))
>> +                destspace = repo.revs("(%ld and children(::.))::",
>> +                                      repo.changelog.revs(start=revsprepull))
> Is this equivalent to repo.revs("(%d: and children(::.))::", revsprepull)?

Almost, but if revsprepull is filtered (for some reason), the '%d:' 
version will fail while the version using "%ld" and changelog.revs will 
be robust.

Cheers,

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list