[PATCH 1 of 2 STABLE] destutil: add the ability to specify a search space for rebase destination
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Mon May 2 04:59:50 EDT 2016
On 05/01/2016 08:20 AM, Yuya Nishihara wrote:
> On Sat, 30 Apr 2016 19:20:53 +0200, Pierre-Yves David wrote:
>> # HG changeset patch
>> # User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
>> # Date 1462034468 -7200
>> # Sat Apr 30 18:41:08 2016 +0200
>> # Branch stable
>> # Node ID ff7be3798ec9465d9306a30e01ab976c941c0967
>> # Parent cbf282da720ac907b492a2b1045288130d6d166e
>> # EXP-Topic issue5214
>> destutil: add the ability to specify a search space for rebase destination
>> diff -r cbf282da720a -r ff7be3798ec9 mercurial/destutil.py
>> --- a/mercurial/destutil.py Wed Apr 27 01:07:40 2016 -0700
>> +++ b/mercurial/destutil.py Sat Apr 30 18:41:08 2016 +0200
>> @@ -256,7 +256,7 @@
>> },
>> }
>>
>> -def _destmergebook(repo, action='merge', sourceset=None):
>> +def _destmergebook(repo, action='merge', sourceset=None, destspace=None):
>> """find merge destination in the active bookmark case"""
>> node = None
>> bmheads = repo.bookmarkheads(repo._activebookmark)
>> @@ -275,7 +275,8 @@
>> assert node is not None
>> return node
>>
>> -def _destmergebranch(repo, action='merge', sourceset=None, onheadcheck=True):
>> +def _destmergebranch(repo, action='merge', sourceset=None, onheadcheck=True,
>> + destspace=None):
>> """find merge destination based on branch heads"""
>> node = None
>>
>> @@ -308,6 +309,12 @@
>> bheads = list(repo.revs('%ln - (%ld::)', bheads, sourceset))
>> # filters out bookmarked heads
>> nbhs = list(repo.revs('%ld - bookmark()', bheads))
>> +
>> + if destspace is not None:
>> + # restrict search space
>> + # used in the 'hg pull --rebase' case, see issue 5214.
>> + nbhs = list(repo.revs('%ld and %ld', destspace, nbhs))
>> +
>> if len(nbhs) > 1:
>> # Case B: There is more than 1 other anonymous heads
>> #
>> @@ -339,18 +346,22 @@
>> assert node is not None
>> return node
>>
>> -def destmerge(repo, action='merge', sourceset=None, onheadcheck=True):
>> +def destmerge(repo, action='merge', sourceset=None, onheadcheck=True,
>> + destspace=None):
>> """return the default destination for a merge
>>
>> (or raise exception about why it can't pick one)
>>
>> :action: the action being performed, controls emitted error message
>> """
>> + # destspace is here to work around issues with `hg pull --rebase` see
>> + # issue5214 for details
>> if repo._activebookmark:
>> - node = _destmergebook(repo, action=action, sourceset=sourceset)
>> + node = _destmergebook(repo, action=action, sourceset=sourceset,
>> + destspace=destspace)
> I noticed _destmergebook() doesn't handle destspace, but it is documented in
> the next patch and the BTS. So it should be okay.
Yes, we should probably adjust something in the bookmark case too,but I
saw it a less critical and I delayed more work on this until next week.
More information about the Mercurial-devel
mailing list