Patchwork [in,crew] help: document '@' bookmark in 'help bookmarks' and 'help clone'

login
register
mail settings
Submitter Kevin Bullock
Date Jan. 25, 2013, 5:08 p.m.
Message ID <e031e10cdc06a9708cd7.1359133736@vpn0-77.vpn.umn.edu>
Download mbox | patch
Permalink /patch/734/
State Accepted
Commit e031e10cdc06a9708cd77f7518b6a6d817eeec10
Headers show

Comments

Kevin Bullock - Jan. 25, 2013, 5:08 p.m.
# HG changeset patch
# User Kevin Bullock <kbullock@ringworld.org>
# Date 1359133590 21600
# Branch stable
# Node ID e031e10cdc06a9708cd77f7518b6a6d817eeec10
# Parent  692cbda1eb50fe30c70792cb1e9380b28769467c
help: document '@' bookmark in 'help bookmarks' and 'help clone'
Matt Mackall - Jan. 25, 2013, 10:06 p.m.
On Fri, 2013-01-25 at 11:40 -0600, Kevin Bullock wrote:
> On 25 Jan 2013, at 11:08 AM, Kevin Bullock wrote:
> 
> > # HG changeset patch
> > # User Kevin Bullock <kbullock@ringworld.org>
> > # Date 1359133590 21600
> > # Branch stable
> > # Node ID e031e10cdc06a9708cd77f7518b6a6d817eeec10
> > # Parent  692cbda1eb50fe30c70792cb1e9380b28769467c
> > help: document '@' bookmark in 'help bookmarks' and 'help clone'
> 
> Eep! I broke test-help.t. Fix incoming. Sorry.

Please find the numbered list in the clone help:

http://www.selenic.com/hg/file/692cbda1eb50/mercurial/commands.py#l1173
Antonio Zanardo - Jan. 28, 2013, 1:06 a.m.
Hello,

That's nice to have this feature documented, but I fail to understand 
clearly why this feature is useful, i.e., what are the use cases?

Does the bookmark "@" exist to serve as a starting point for the 
contributors of a project to know which revision to base their patches?

Zanardo.

On 1/25/13 3:08 PM, Kevin Bullock wrote:
> # HG changeset patch
> # User Kevin Bullock <kbullock@ringworld.org>
> # Date 1359133590 21600
> # Branch stable
> # Node ID e031e10cdc06a9708cd77f7518b6a6d817eeec10
> # Parent  692cbda1eb50fe30c70792cb1e9380b28769467c
> help: document '@' bookmark in 'help bookmarks' and 'help clone'
>
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -785,6 +785,10 @@ def bookmark(ui, repo, mark=None, rev=No
>       repositories to support bookmarks. For versions prior to 1.8, this means
>       the bookmarks extension must be enabled.
>
> +    If you set a bookmark called '@', new clones of the repository will
> +    have that revision checked out (and the bookmark made active) by
> +    default.
> +
>       With -i/--inactive, the new bookmark will not be made the active
>       bookmark. If -r/--rev is given, the new bookmark will not be made
>       active even if -i/--inactive is not given. If no NAME is given, the
> @@ -1146,6 +1150,9 @@ def clone(ui, source, dest=None, **opts)
>       tag will include the tagged changeset but not the changeset
>       containing the tag.
>
> +    If the source repository has a bookmark called '@' set, that
> +    revision will be checked out in the new repository by default.
> +
>       To check out a particular version, use -u/--update, or
>       -U/--noupdate to create a clone with no working directory.
>
>
Sean Farley - Jan. 28, 2013, 5:58 p.m.
On Sun, Jan 27, 2013 at 9:34 PM, Kevin Bullock
<kbullock+mercurial@ringworld.org> wrote:
> On 27 Jan 2013, at 7:06 PM, Antonio Zanardo wrote:
>
> Hello,
>
> That's nice to have this feature documented, but I fail to understand
> clearly why this feature is useful, i.e., what are the use cases?
>
> Does the bookmark "@" exist to serve as a starting point for the
> contributors of a project to know which revision to base their patches?
>
>
> Yep, that's about right. It's the revision you want people to get by default
> when they clone your project. It could represent your latest integrated,
> tested, non-experimental code. This is particularly useful in the presence
> of other bookmarks that might mark experimental or unstable work (topic
> branches).

I am very interested in the topic branch workflow but the presence of
'@' still has some quirks:

1) 'hg clone -U <url> && hg up' still updates to 'default' even when
'@' is present. I believe this should update to '@' (if it exists),
right? The BookmarksPlan mentions this at the bottom: "Bare update
with no active bookmark updates to the implicit branch-default
bookmark if it exists."

2) 'hg push -B <bookmark>' pushes everything + bookmark. It'd be nice
to just have a way to push the bookmark (+ancestors).

What do others think about this behavior?
Matt Mackall - Jan. 28, 2013, 6:22 p.m.
On Mon, 2013-01-28 at 11:58 -0600, Sean Farley wrote:
> On Sun, Jan 27, 2013 at 9:34 PM, Kevin Bullock
> <kbullock+mercurial@ringworld.org> wrote:
> > On 27 Jan 2013, at 7:06 PM, Antonio Zanardo wrote:
> >
> > Hello,
> >
> > That's nice to have this feature documented, but I fail to understand
> > clearly why this feature is useful, i.e., what are the use cases?
> >
> > Does the bookmark "@" exist to serve as a starting point for the
> > contributors of a project to know which revision to base their patches?
> >
> >
> > Yep, that's about right. It's the revision you want people to get by default
> > when they clone your project. It could represent your latest integrated,
> > tested, non-experimental code. This is particularly useful in the presence
> > of other bookmarks that might mark experimental or unstable work (topic
> > branches).
> 
> I am very interested in the topic branch workflow but the presence of
> '@' still has some quirks:
> 
> 1) 'hg clone -U <url> && hg up' still updates to 'default' even when
> '@' is present. I believe this should update to '@' (if it exists),
> right? The BookmarksPlan mentions this at the bottom: "Bare update
> with no active bookmark updates to the implicit branch-default
> bookmark if it exists."

Notabug. With clone -U, you get the null checkout, which is on the
default branch. Updating takes you to the tip of the default branch.

> 2) 'hg push -B <bookmark>' pushes everything + bookmark. It'd be nice
> to just have a way to push the bookmark (+ancestors).

hg push -r <bookmark>?
Sean Farley - Jan. 28, 2013, 6:36 p.m.
On Mon, Jan 28, 2013 at 12:22 PM, Matt Mackall <mpm@selenic.com> wrote:
> On Mon, 2013-01-28 at 11:58 -0600, Sean Farley wrote:
>> On Sun, Jan 27, 2013 at 9:34 PM, Kevin Bullock
>> <kbullock+mercurial@ringworld.org> wrote:
>> > On 27 Jan 2013, at 7:06 PM, Antonio Zanardo wrote:
>> >
>> > Hello,
>> >
>> > That's nice to have this feature documented, but I fail to understand
>> > clearly why this feature is useful, i.e., what are the use cases?
>> >
>> > Does the bookmark "@" exist to serve as a starting point for the
>> > contributors of a project to know which revision to base their patches?
>> >
>> >
>> > Yep, that's about right. It's the revision you want people to get by default
>> > when they clone your project. It could represent your latest integrated,
>> > tested, non-experimental code. This is particularly useful in the presence
>> > of other bookmarks that might mark experimental or unstable work (topic
>> > branches).
>>
>> I am very interested in the topic branch workflow but the presence of
>> '@' still has some quirks:
>>
>> 1) 'hg clone -U <url> && hg up' still updates to 'default' even when
>> '@' is present. I believe this should update to '@' (if it exists),
>> right? The BookmarksPlan mentions this at the bottom: "Bare update
>> with no active bookmark updates to the implicit branch-default
>> bookmark if it exists."
>
> Notabug. With clone -U, you get the null checkout, which is on the
> default branch. Updating takes you to the tip of the default branch.

Well, I'm trying to get a bookmarks based workflow and don't see how I
can "enable it." By that, I mean I'm willing to do something outside
the norm (either enable a setting, or adding the '@' bookmark, etc.).

>> 2) 'hg push -B <bookmark>' pushes everything + bookmark. It'd be nice
>> to just have a way to push the bookmark (+ancestors).
>
> hg push -r <bookmark>?

Dammit. I don't know why I don't test these things out before I send the email.
Sean Farley - Jan. 28, 2013, 7:14 p.m.
On Mon, Jan 28, 2013 at 1:08 PM, Kevin Bullock
<kbullock+mercurial@ringworld.org> wrote:
> On Jan 28, 2013, at 11:58 AM, Sean Farley wrote:
>
>> 2) 'hg push -B <bookmark>' pushes everything + bookmark. It'd be nice
>> to just have a way to push the bookmark (+ancestors).
>
> Not true (anymore?): <http://www.selenic.com/hg/rev/7199e82d6d8b>

Yeah, I'm an idiot; sorry.

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -785,6 +785,10 @@  def bookmark(ui, repo, mark=None, rev=No
     repositories to support bookmarks. For versions prior to 1.8, this means
     the bookmarks extension must be enabled.
 
+    If you set a bookmark called '@', new clones of the repository will
+    have that revision checked out (and the bookmark made active) by
+    default.
+
     With -i/--inactive, the new bookmark will not be made the active
     bookmark. If -r/--rev is given, the new bookmark will not be made
     active even if -i/--inactive is not given. If no NAME is given, the
@@ -1146,6 +1150,9 @@  def clone(ui, source, dest=None, **opts)
     tag will include the tagged changeset but not the changeset
     containing the tag.
 
+    If the source repository has a bookmark called '@' set, that
+    revision will be checked out in the new repository by default.
+
     To check out a particular version, use -u/--update, or
     -U/--noupdate to create a clone with no working directory.