Bug 1877 - bookmarks: do not move merged bookmark
Summary: bookmarks: do not move merged bookmark
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: unspecified
Hardware: All All
: normal feature
Assignee: David Soria Parra
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-19 02:44 UTC by Oben Sonne
Modified: 2011-06-11 13:40 UTC (History)
7 users (show)

See Also:
Python Version: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Oben Sonne 2009-10-19 02:44 UTC
I know bookmarks are supposed to move on commits. When merging a bookmarked
revision into another head, the bookmark moves to the merging commit. 
The merging commit is a child of the previous bookmarked revision, so
technically this just conforms to the "move on commit" idea. However, is
this a desired behavior in a typical "switch-and-merge-branches-repeatedly"
workflow? I don't think so.

Example:
I have a named branch 'dev' for working on bigger changes. At the same time
I have multiple short-living bookmarked heads to work on smaller changes.
Below is an example, main, fix1 and feature2 are bookmarked heads: 

dev main fix1 feature2
 o    o    o    o
  \   |    |   /
   .  .    .  .

The problem here is that if I do a 'hg merge main' within the 'dev' branch,
that bookmark moves into the dev branch, technically correct according to
the bookmark definition, but semantically wrong. When merging in a
bookmarked revision, the referenced bookmark should not move.

Thoughts?
Comment 1 Adrian Buehlmann 2009-10-19 02:55 UTC
I agree with obs.
Comment 2 Greg Ward 2009-10-19 13:44 UTC
Totally agree.  This should be the default.
Comment 3 abderrahim 2009-10-20 02:36 UTC
I believe bookmarks.track.current is what you want, the problem is that it
is in the help text of the extension which is shadowed by the help of the
command.

with this enabled, you need to explicitly update to a bookmark for it to be
moved next commit (merge or not). Maybe this should be the default?

put this in your hgrc

[bookmarks]
track.current = True
Comment 4 Adrian Buehlmann 2009-10-20 03:02 UTC
I still think bookmarks from "the other head" (parent 2 of the working dir
before the commit) of merges should never be moved onto the merged-to line
of the DAG.

Independent of the track.current setting.
Comment 5 Oben Sonne 2009-10-20 10:39 UTC
Happy to hear you agree here.

I enabled the track.current option and now the bookmark does not move when
it gets merged in. As you mentioned, I think this should be the default
behavior.

I would even go further and make the 'track.current  = True' behavior the
default one for any commits. That way bookmarks are more similar to
branches. Personally I cannot think of situations where I would prefer the
'track.current = False' behavior (but for sure there use cases for that).

If track.current should be enabled or disabled by default depends on which
behavior is more useful in the majority of cases and which behavior matches
the mental model most new users have when they start using bookmarks (latter
one is not easy to answer).
Comment 6 David Soria Parra 2011-03-13 17:31 UTC
Please test this. It's fixed since 1.8. track.current is now the default 
behaviour.
Comment 7 Oben Sonne 2011-03-14 14:14 UTC
Though the track.current options appears to be enabled by default (i.e. it 
works as expcected on regular commits), the initial problem that bookmarks 
move on merges still exists. Actually it is worse now since the workaround to 
enable the option is not possible anymore.

Here's an interactive shell session illustrating the problem: 
http://pastebin.com/AsbN9t08
Comment 8 David Soria Parra 2011-03-14 16:19 UTC
updated title
Comment 9 Oben Sonne 2011-03-25 06:54 UTC
I've written a fix for this issue and wrote a corresponding test for the test 
suite. If nobody is working on this already, I would send my patch to the 
mailing list. However, just want to make sure this isn't already tackled.
Comment 10 Matt Mackall 2011-04-05 13:28 UTC
Fixed by:

changeset:   13806:8ba08a16e4e0
user:        David Soria Parra <dsp@php.net>
date:        Mon Mar 14 23:50:28 2011 +0100
summary:     bookmarks: do not forward merged bookmark (issue1877)
Comment 11 HG Bot 2011-06-01 16:00 UTC
Fixed by http://selenic.com/repo/hg/rev/4d958d1bb072
David Soria Parra <dsp@php.net>
bookmarks: do not forward merged bookmark (issue1877)

(please test the fix)
Comment 12 Oben Sonne 2011-06-11 13:23 UTC
works as expected, thanks
Comment 13 Matt Mackall 2011-06-11 13:40 UTC
Re-resolving auto-reopened issue
Comment 14 Bugzilla 2012-05-12 09:03 UTC

--- Bug imported by bugzilla@serpentine.com 2012-05-12 09:03 EDT  ---

This bug was previously known as _bug_ 1877 at http://mercurial.selenic.com/bts/issue1877