Proposed bookmarks plan posted to wiki
Kevin Bullock
kbullock+mercurial at ringworld.org
Fri Jun 8 19:42:18 UTC 2012
I've been mulling over the past several weeks' threads about bookmarks, and as I've variously promised, summed up both my own thoughts and as much of the recent discussions as I could. I've posted it to the wiki as a draft, so that we can get all the facets together into one place, and hopefully move discussion towards a coherent set of behavior.
http://mercurial.selenic.com/wiki/BookmarksPlan
Since I've tried to make it as coherent as possible, this first draft represents _my_ view of how bookmarks should behave. I know others hold different opinions: the wiki page should evolve to reflect the decided consensus. But I wanted to provide a starting point for developing the final, consistent behavior, whatever that ends up being.
[Text of the page follows inline for discussion.]
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
== Discussions ==
For context and other proposals that have been made on the -devel list and elsewhere, see the following:
* http://titanpad.com/hg-bookmarks
* http://markmail.org/message/hlv5gw6nlugogvcn
* http://markmail.org/message/x7kvw4tpqjawm3a5
* http://markmail.org/message/qugvrgamwudgsdbq
* http://markmail.org/message/2gsxpvtbmewmbi3p
* http://markmail.org/message/fywc4yrnlnjrq4il
== 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.
== Command Behavior with Bookmarks ==
=== clone ===
* Clone all bookmarks. (./)
* Update to '@' if it exists, otherwise fall back to 'default' or 'tip'.
=== pull ===
* Pull all bookmarks.
If you don't want to expose the bookmarks, then mark the ''changesets'' secret; this leads us to:
=== commit ===
* Add an option that commits the working directory as secret and creates a bookmark (http://markmail.org/message/vx7ub3pojxlccgdx).
=== push ===
* `hg push -r BOOKMARK` should automatically sync the bookmark too, without having to specify `-B`.
* 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.
This 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)
=== 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?
pacem in terris / мир / शान्ति / سَلاَم / 平和
Kevin R. Bullock
pacem in terris / мир / शान्ति / سَلاَم / 平和
Kevin R. Bullock
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-devel/attachments/20120608/8c3110c3/attachment-0002.html>
More information about the Mercurial-devel
mailing list