[PATCH 2 of 4] clone to master bookmark if available

Matt Mackall mpm at selenic.com
Mon Nov 7 14:59:34 CST 2011


-------- Forwarded Message --------
From: Matt Mackall <mpm at selenic.com>
To: Arne Babenhauserheide <arne_bab at web.de>
Subject: Re: [PATCH 2 of 4] clone to master bookmark if available
Date: Mon, 07 Nov 2011 10:08:02 -0600

On Mon, 2011-11-07 at 08:40 +0100, Arne Babenhauserheide wrote:
> Am Sonntag, 6. November 2011, 18:50:05 schrieben Sie:
> > On Mon, 2011-11-07 at 01:01 +0100, Arne Babenhauserheide wrote:
> > > > ..which all suggests we need to figure out a nice way to track
> > > > multiple
> > > > bookmarks of the same name first. Git does this with a "namespace"
> > > > notion, which is one possibility.
> > > 
> > > The problem with a namespace is, how to figure out the namespace. Git
> > > has
> > > remote setup and tracking, while in hg it’s normal to just hg pull
> > > <path>.
> > Indeed, which is why I point out that namespaces are only one
> > possibility. We could, for instance, simply create a new B' bookmark
> > whenever we had divergence on B, and teach merge to automatically remove
> > it. 
> 
> I think I would prefer using the last path segment as namespace… or allowing 
> the user to specify a prefix/rename. Just adding a fixed string does not scale 
> for having many remotes. 

I skipped the explanation of how to scale it as I assumed the
conventions of prime notation were familiar to everyone. But that's not
the point: the point is that we don't really need to 'name' these other
bookmarks. They should by their nature be short-lived and not numerous,
much like unmerged heads.

> What other options are there? 

Last path segment isn't a terribly good one, as that will often be the
same. Hostname and IP address have similar issues. Even full paths can
collide if the remote repository gets rebased or someone forcibly pushes
another head between your pulls. We could attach usernames from commits,
but again, those will eventually collide. Nor will they necessarily be
meaningful on a large project.

So I think some simple and temporary "numbering" (in some notation) of
the divergent copies is probably the easiest and least gaudy thing to
do. Here's another notation using '@', a symbol that won't get us in
trouble with shells or revsets:

B   <- the original bookmark
B at 1 <- its first divergent copy
B at 2 <- its second

..which brings me back to your "default bookmark" concept, which could
be simply:

@  <- the default bookmark to checkout on clone
@1 <- its first divergent copy

The 'at' semantics of '@' are a decent fit for the bookmark concept.

[Symbols we probably shouldn't use here include

 ~!#$%^&*()-+[]{}\|;:,<>?'" 

which means the usable set only includes 
 
 _@/. ]

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list