[PATCH] clone: update to branch of parent for local source repos by default

Adrian Buehlmann adrian at cadifra.com
Tue Oct 20 22:24:48 UTC 2009


On 20.10.2009 22:52, Greg Ward wrote:
> On Mon, Oct 19, 2009 at 5:53 PM, Adrian Buehlmann <adrian at cadifra.com> wrote:
>> # HG changeset patch
>> # User Adrian Buehlmann <adrian at cadifra.com>
>> # Date 1255989153 -7200
>> # Node ID 56363f62752ecb33134c7272acb7dedd34debc9c
>> # Parent  6578bc930174a1d312f4198d36bd43ebcd24cfc2
>> clone: update to branch of parent for local source repos by default
>>
>> (I'm sending this mostly for historic/documentation purposes as Matt has
>> mixed feelings about it. It's just amazing how small and effective this
>> patch actually is)
>>
>> would allow to do things like
>>
>> $ hg clone thg-stable thg-stable-bug1234
>> updating to branch stable
>> 297 files updated, 0 files merged, 0 files removed, 0 files unresolved
>>
>> provided thg-stable's parent is at branch 'stable'.
>>
>> Today, the same can only be achieved by doing
>>
>> hg clone -U thg-stable thg-stable-bug1234
>> cd thg-stable-bug1234
>> hg up stable
> 
> This patch makes a lot of sense to me.  We're going to be using
> Mercurial with lots of named branches, as we maintain different parts
> of our code on anywhere from 2 to 10 branches at a time.  (Pesky
> customers, wanting bug fixes without full upgrades.)  If I have a
> local clone of the 3.8 branch, and I want another local clone for
> experimental work, I would just expect 'hg clone' to put it on that
> branch.  The fact that this is not the default is entirely
> understandable... but I don't really want to have to explain it to my
> users!
> 
>> The argument against doing this patch probably is that this would be the
>> first time that clone would be influenced by the state of the source _working
>> directory_ ("layering violation", as Dirkjan put it).
> 
> Bahh!  Layering, shmayering.  Just do whatever is convenient and easy,
> right?  ;-)
> 

Since the patch breaks the current spec of clone ("we ignore the src working
dir and take default in that case"), would it be acceptable to enable this
new sexy behavior with a config option?

Maybe (<enter bikeshedding mode>):

[ui] cloneparentbranch = True

with a default of 'False' if absent.

Or a whole new section:

[clone]
checkoutparentbranch = True

Like this, local clone would be guaranteed to continue to clone the default
branch out of the box. As it always did.




More information about the Mercurial-devel mailing list