[PATCH] bookmarks: active bookmark diverges if a pull would move it (issue3682)

Sean Farley sean.michael.farley at gmail.com
Fri Oct 26 18:40:18 CDT 2012


On Fri, Oct 26, 2012 at 8:43 AM, Augie Fackler <raf at durin42.com> wrote:
>
> On Oct 24, 2012, at 4:04 PM, Kevin Bullock <kbullock+mercurial at ringworld.org> wrote:
>
>> # HG changeset patch
>> # User Kevin Bullock <kbullock at ringworld.org>
>> # Date 1351112598 18000
>> # Branch stable
>> # Node ID 188c42046dfd1441455c63cdde13c0ef757d17a5
>> # Parent  acd4577a568d22d3e58bab28600a5ce0a3f87ce1
>> bookmarks: active bookmark diverges if a pull would move it (issue3682)
>>
>> Before this change, a pull could move the active bookmark (even
>> backwards). This resulted in the bookmark no longer being active (but
>> still being listed in .hg/bookmarks.current -- also see issue3683).
>>
>> After this change, if a pull would move the active bookmark, the
>> divergent bookmarks machinery is invoked, leaving the active bookmark
>> where it was.
>>
>> diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
>> --- a/mercurial/bookmarks.py
>> +++ b/mercurial/bookmarks.py
>> @@ -196,7 +196,7 @@ def updatefromremote(ui, repo, remote, p
>>                 cl = repo[nl]
>>                 if cl.rev() >= cr.rev():
>>                     continue
>> -                if validdest(repo, cl, cr):
>> +                if validdest(repo, cl, cr) and k != repo._bookmarkcurrent:
>>                     repo._bookmarks[k] = cr.node()
>>                     changed = True
>>                     ui.status(_("updating bookmark %s\n") % k)
>> diff --git a/tests/test-bookmarks-pushpull.t b/tests/test-bookmarks-pushpull.t
>> --- a/tests/test-bookmarks-pushpull.t
>> +++ b/tests/test-bookmarks-pushpull.t
>> @@ -29,9 +29,9 @@ import bookmark by name
>>
>>   $ hg init ../b
>>   $ cd ../b
>> -  $ hg book Y
>> +  $ hg book --inactive Y
>>   $ hg book
>> -   * Y                         -1:000000000000
>> +     Y                         -1:000000000000
>>   $ hg pull ../a
>>   pulling from ../a
>>   requesting all changes
>
>
> It'd be nice to see a test for the actual divergence, but other than that I like this. mpm, have you decided about this behavior?

In a similar vein, what about the dichotomy between 'current' and
'active' with bookmarks? Would it be appropriate to send a patch on
stable for that? See for reference,
http://bz.selenic.com/show_bug.cgi?id=3683


More information about the Mercurial-devel mailing list