atom feed14 messages in com.selenic.mercurial-develRe: overriding defaults (was Re: [PAT...
FromSent OnAttachments
Adrian BuehlmannOct 19, 2009 2:53 pm 
Greg WardOct 20, 2009 1:52 pm 
Adrian BuehlmannOct 20, 2009 3:24 pm 
Matt MackallOct 20, 2009 3:31 pm 
Adrian BuehlmannOct 20, 2009 4:01 pm 
Greg WardOct 20, 2009 5:00 pm 
Adrian BuehlmannOct 21, 2009 1:08 am 
Peter ArrenbrechtOct 21, 2009 1:12 am 
Peter ArrenbrechtOct 21, 2009 1:16 am 
Adrian BuehlmannOct 21, 2009 2:02 am 
Matt MackallOct 21, 2009 10:34 am 
Adrian BuehlmannOct 21, 2009 10:58 am 
John CoomesOct 21, 2009 12:41 pm 
Matt MackallOct 21, 2009 2:14 pm 
Subject:Re: overriding defaults (was Re: [PATCH] clone: update to branch ...)
From:Matt Mackall (
Date:Oct 21, 2009 2:14:03 pm

On Wed, 2009-10-21 at 12:42 -0700, John Coomes wrote:

Matt Mackall ( wrote:

On Wed, 2009-10-21 at 11:03 +0200, Adrian Buehlmann wrote:

On 21.10.2009 10:17, Peter Arrenbrecht wrote:

On Wed, Oct 21, 2009 at 10:09 AM, Adrian Buehlmann <> wrote:

--source-branch sounds good

(--source-branch could even be specified in [defaults], provided mercurial would gracefully disregard it without moaning if it had been specified for a non local source repo.)

My plan for --source-branch was to do the same as

hg clone -u <branch of src's parent> src dest

would do.

That aside, we need 'clone -u' for completeness/versatility's sake. We should implement that first and see if it has a chance to make it into 1.4. Matt's messages seem to hint at that.

I guess `hg clone -u . src dest` should cover most scenarios where people would have wanted --source-branch.


So . is in scope. Neat.

Compare existing:

$ hg -R thg-stable par changeset: 3536:cd50b769e235 branch: stable tag: 0.8.3 user: Steve Borho <> date: Tue Oct 06 22:07:28 2009 -0500 summary: hgtk: correct arguments to dispatch() when launching qct

$ hg clone -r . thg-stable thg-stable-bug1234 requesting all changes adding changesets adding manifests adding file changes added 3537 changesets with 5456 changes to 522 files updating to branch stable 297 files updated, 0 files merged, 0 files removed, 0 files unresolved

Planned (faking output):

$ hg clone -u . thg-stable thg-stable-bug1235 updating to branch stable 297 files updated, 0 files merged, 0 files removed, 0 files unresolved

For folks who want to put "-u ." into [defaults], we should make sure that -U still disables it.

Good point.

-U should gracefully and silently override -u without mercurial moaning at it (or at least not moan by default, i.e. without --verbose).

Disagree. Again, this is one of the fundamental problems with defaults: once you've set a default, there's no way to bypass it. Don't use 'em.

Or create a way to override them. I think mercurial could really benefit from an automatic way to allow bool options to be negated. E.g., if every bool option foo implicitly defined an additional option --no-foo. ksh getopts supports this concept with -n/+n (ksh only accepts short options, though).

Assuming it was/could be implemented, would something along those lines be considered?

Nope. There's no need for it. Just don't set defaults that are contrary to the real defaults and you never encounter this problem or the additional complexity of having to support option negation.

You also don't need to worry about scripts and other tools getting fooled/broken by those defaults. And you also don't need to worry about your coworkers fat-fingering things on your machine because your defaults and their defaults don't agree. Which -will happen- if one of you sets -u . as a default on clone.

Defaults are a bad idea. They are deprecated. Don't use them. Don't recommend them. Forget they existed. Use aliases.