Differences between revisions 3 and 4
Revision 3 as of 2012-07-06 19:16:09
Size: 3801
Editor: AugieFackler
Comment: Tag some more features as done, based on my local experimentation.
Revision 4 as of 2012-10-15 15:47:50
Size: 3850
Editor: rrcs-208-105-152-235
Comment: Add an additional link to discussion on default bookmark naming
Deletions are marked like this. Additions are marked like this.
Line 29: Line 29:
 * http://markmail.org/message/5kn5joi7t5q2euvr

Bookmarks Plan

/!\ This page is intended for developers.

/!\ This is a DRAFT for discussion, and does not represent any firm decisions on future behavior.

Original draft by KevinBullock.

A plan to smooth out the usage of bookmarks as short-lived branches (a.k.a. feature branches). This covers several facets of bookmarks that have been discussed recently (June 2012) on the mailing list:

  • Providing a default-update-on-clone bookmark (the '@' bookmark)
  • Introducing bookmarks (particularly as experimental branches) sanely into a workflow where they're not being used
  • When to sync bookmarks automatically

1. Discussions

For context and other proposals that have been made on the -devel list and elsewhere, see the following:

2. Introducing Bookmarks Into Your Workflow

mpm posed the following problem: Alice and Bob are working on a branch. Alice updates to the branch head and commits, then starts some experimental work. She commits and bookmarks her work as alice-work. When Bob pulls and updates, he should move forward one commit. Instead he gets everything in alice-work, which is now the branch head.

To solve this, I propose:

Adding the first bookmark to any named branch also creates an implicit default bookmark on that named branch, with the same name as the branch[?]. This implicit per-named-branch default is created regardless of whether the bookmark was added by the bookmark command, push, pull, or clone.

The implicit bookmark for the current branch is treated as active if no other bookmark is active.

No implicit bookmark is created on any named-branch without other bookmarks.

3. Command Behavior with Bookmarks

3.1. clone

  • Clone all bookmarks. (./)

  • Update to '@' if it exists, otherwise fall back to 'default' or 'tip'.

3.2. pull

  • Pull all bookmarks. (./)

If you don't want to expose the bookmarks, then mark the changesets secret; this leads us to:

3.3. commit

3.4. push

  • hg push -B BOOKMARK should push only the changesets through BOOKMARK. I.e., it should be equivalent to hg push -B BOOKMARK -r BOOKMARK. (./)

  • Warn (with hint) when pushing changesets that are bookmarked without pushing the bookmarks (suggested by marmoute: http://markmail.org/message/pxemyessq6ek7ynw).

Discussion: It should be possible to push a bookmark and all the changesets leading up to it in one command. Right now, hg push -B BOOKMARK pushes _all changesets_, and then the given bookmark, which is too much.

The above proposed behavior is a compromise between local-only bookmarks and topic-branch bookmarks. Those who are used to topic branches in Git are also used to naming them explicitly to push them. And to quote: "Yes, push and pull are definitely asymmetrical. This should be no surprise to anyone who's used a rope." (http://markmail.org/message/mlxueu2lnxi7ewq5)

3.5. update

  • Update to a bookmark named explicitly on the command line makes that bookmark active. (./)

  • Bare update moves the active bookmark forward. (./)

  • Bare update with no active bookmark updates to the implicit branch-default bookmark if it exists (see above).
    • What if it doesn't exist, i.e., how/when to add the implicit bookmark to
      • old repos?


BookmarksPlan (last edited 2015-06-12 10:48:17 by Pierre-YvesDavid)