Patchwork [V2] config: give a more detailed sample repo config

login
register
mail settings
Submitter Jordi Gutiérrez Hermoso
Date Oct. 3, 2014, 8:21 p.m.
Message ID <eb4d20b10e17135d8b24.1412367675@Iris>
Download mbox | patch
Permalink /patch/6098/
State Superseded
Headers show

Comments

Jordi Gutiérrez Hermoso - Oct. 3, 2014, 8:21 p.m.
# HG changeset patch
# User Jordi Gutiérrez Hermoso <jordigh@octave.org>
# Date 1412353066 14400
#      Fri Oct 03 12:17:46 2014 -0400
# Node ID eb4d20b10e17135d8b2402f23af8e0b6797297c9
# Parent  9f9ba0dcf5fdcc9978db7fdbd909916f0c35e4a6
config: give a more detailed sample repo config

Some examples of the typical configurations that one might want to do
in an .hg/hgrc file. This includes a default-push that happens to
point to the same location as my-fork.

I insist on the myfork terminology for a server-side clone. Bitbucket,
Github, and others have widely popularised this meaning of "fork".
Matt Mackall - Oct. 3, 2014, 8:39 p.m.
On Fri, 2014-10-03 at 16:21 -0400, Jordi Gutiérrez Hermoso wrote:
> # HG changeset patch
> # User Jordi Gutiérrez Hermoso <jordigh@octave.org>
> # Date 1412353066 14400
> #      Fri Oct 03 12:17:46 2014 -0400
> # Node ID eb4d20b10e17135d8b2402f23af8e0b6797297c9
> # Parent  9f9ba0dcf5fdcc9978db7fdbd909916f0c35e4a6
> config: give a more detailed sample repo config

We're doing something a little weird here.

$ hg init a
$ cat a/.hg/hgrc
cat: a/.hg/hgrc: No such file or directory
$ hg clone a aa
updating to branch default
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ cat aa/.hg/hgrc
# You may want to set your username here if it is not set
# globally, or this repository requires a different
# username from your usual configuration. If you want to
# set something for all of your repositories on this
# computer, try running the command
# 'hg config --edit --global'

Who approved that? Global?? Ugh.

# [ui]
# username = Jane Doe <jdoe@example.com>
[paths]
default = /home/mpm/a/a

We're not creating the file on init, but we are on clone.

It seems that we've got one message in hg.py, another in ui.py. We need
to unify them and create the file in all of the following circumstances:

- init
- clone (+ add default url)
- conf -l (if not already present)

And you'll need to make sure your patch works in the clone case..
Pierre-Yves David - Oct. 3, 2014, 10:19 p.m.
On 10/03/2014 03:39 PM, Matt Mackall wrote:
> On Fri, 2014-10-03 at 16:21 -0400, Jordi Gutiérrez Hermoso wrote:
>> # HG changeset patch
>> # User Jordi Gutiérrez Hermoso <jordigh@octave.org>
>> # Date 1412353066 14400
>> #      Fri Oct 03 12:17:46 2014 -0400
>> # Node ID eb4d20b10e17135d8b2402f23af8e0b6797297c9
>> # Parent  9f9ba0dcf5fdcc9978db7fdbd909916f0c35e4a6
>> config: give a more detailed sample repo config
>
> We're doing something a little weird here.
>
> $ hg init a
> $ cat a/.hg/hgrc
> cat: a/.hg/hgrc: No such file or directory
> $ hg clone a aa
> updating to branch default
> 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
> $ cat aa/.hg/hgrc
> # You may want to set your username here if it is not set
> # globally, or this repository requires a different
> # username from your usual configuration. If you want to
> # set something for all of your repositories on this
> # computer, try running the command
> # 'hg config --edit --global'
>
> Who approved that? Global?? Ugh.

This is added by:

   changeset:   25035:82b2ba904e3e
   user:        Augie Fackler <raf@durin42.com>
   date:        Tue Sep 09 17:16:24 2014 -0400
   summary:     clone: provide sample username = config entry in 
.hg/hgrc (issue4359)

And I cannot see any mention of it on the list. So I assume it has been 
pushed directly on crew ? Obsmarkers give Augies as the last guy who 
touched the changesets.

Augies, did you pushed that by mistake our did you got a special side 
channel approval for that (I would be confused by Matt acking this).
Augie Fackler - Oct. 6, 2014, 7:54 p.m.
On Fri, Oct 03, 2014 at 05:19:25PM -0500, Pierre-Yves David wrote:
>
>
> On 10/03/2014 03:39 PM, Matt Mackall wrote:
> >On Fri, 2014-10-03 at 16:21 -0400, Jordi Gutiérrez Hermoso wrote:
> >># HG changeset patch
> >># User Jordi Gutiérrez Hermoso <jordigh@octave.org>
> >># Date 1412353066 14400
> >>#      Fri Oct 03 12:17:46 2014 -0400
> >># Node ID eb4d20b10e17135d8b2402f23af8e0b6797297c9
> >># Parent  9f9ba0dcf5fdcc9978db7fdbd909916f0c35e4a6
> >>config: give a more detailed sample repo config
> >
> >We're doing something a little weird here.
> >
> >$ hg init a
> >$ cat a/.hg/hgrc
> >cat: a/.hg/hgrc: No such file or directory
> >$ hg clone a aa
> >updating to branch default
> >0 files updated, 0 files merged, 0 files removed, 0 files unresolved
> >$ cat aa/.hg/hgrc
> ># You may want to set your username here if it is not set
> ># globally, or this repository requires a different
> ># username from your usual configuration. If you want to
> ># set something for all of your repositories on this
> ># computer, try running the command
> ># 'hg config --edit --global'
> >
> >Who approved that? Global?? Ugh.

if we're talking about the actual *flag name* --global, I'm almost sure that isn't me. In fact:

changeset:   21617:13fcb9ca9ccc
user:        Matt Mackall <mpm@selenic.com>
date:        Tue Mar 18 18:49:30 2014 -0500
summary:     config: add --global and --local flags

>
> This is added by:
>
>   changeset:   25035:82b2ba904e3e
>   user:        Augie Fackler <raf@durin42.com>
>   date:        Tue Sep 09 17:16:24 2014 -0400
>   summary:     clone: provide sample username = config entry in .hg/hgrc
> (issue4359)
>
> And I cannot see any mention of it on the list. So I assume it has been
> pushed directly on crew ? Obsmarkers give Augies as the last guy who touched
> the changesets.
>
> Augies, did you pushed that by mistake our did you got a special side
> channel approval for that (I would be confused by Matt acking this).

I'm pretty sure I ran this by at least TheMystic on IRC. Since it's in
a sample hgrc config, we can certainly change it?

(-1 point for not cc'ing me on this email, I almost didn't read it.)

>
> --
> Pierre-Yves David
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
Pierre-Yves David - Oct. 6, 2014, 7:58 p.m.
On 10/06/2014 12:54 PM, Augie Fackler wrote:
> On Fri, Oct 03, 2014 at 05:19:25PM -0500, Pierre-Yves David wrote:
>>
>>
>> On 10/03/2014 03:39 PM, Matt Mackall wrote:
>>> On Fri, 2014-10-03 at 16:21 -0400, Jordi Gutiérrez Hermoso wrote:
>>>> # HG changeset patch
>>>> # User Jordi Gutiérrez Hermoso <jordigh@octave.org>
>>>> # Date 1412353066 14400
>>>> #      Fri Oct 03 12:17:46 2014 -0400
>>>> # Node ID eb4d20b10e17135d8b2402f23af8e0b6797297c9
>>>> # Parent  9f9ba0dcf5fdcc9978db7fdbd909916f0c35e4a6
>>>> config: give a more detailed sample repo config
>>>
>>> We're doing something a little weird here.
>>>
>>> $ hg init a
>>> $ cat a/.hg/hgrc
>>> cat: a/.hg/hgrc: No such file or directory
>>> $ hg clone a aa
>>> updating to branch default
>>> 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
>>> $ cat aa/.hg/hgrc
>>> # You may want to set your username here if it is not set
>>> # globally, or this repository requires a different
>>> # username from your usual configuration. If you want to
>>> # set something for all of your repositories on this
>>> # computer, try running the command
>>> # 'hg config --edit --global'
>>>
>>> Who approved that? Global?? Ugh.
>
> if we're talking about the actual *flag name* --global, I'm almost sure that isn't me. In fact:
>
> changeset:   21617:13fcb9ca9ccc
> user:        Matt Mackall <mpm@selenic.com>
> date:        Tue Mar 18 18:49:30 2014 -0500
> summary:     config: add --global and --local flags

Sure, --global edit the system level config. Definitly not something we 
want the use to use in this case.


>
>>
>> This is added by:
>>
>>    changeset:   25035:82b2ba904e3e
>>    user:        Augie Fackler <raf@durin42.com>
>>    date:        Tue Sep 09 17:16:24 2014 -0400
>>    summary:     clone: provide sample username = config entry in .hg/hgrc
>> (issue4359)
>>
>> And I cannot see any mention of it on the list. So I assume it has been
>> pushed directly on crew ? Obsmarkers give Augies as the last guy who touched
>> the changesets.
>>
>> Augies, did you pushed that by mistake our did you got a special side
>> channel approval for that (I would be confused by Matt acking this).
>
> I'm pretty sure I ran this by at least TheMystic on IRC. Since it's in
> a sample hgrc config, we can certainly change it?

It think it was list worthy. But not a huge deal.

> (-1 point for not cc'ing me on this email, I almost didn't read it.)

Oops, sorry about that.
Augie Fackler - Oct. 6, 2014, 8 p.m.
On Oct 6, 2014, at 3:58 PM, Pierre-Yves David <pierre-yves.david@ens-lyon.org> wrote:

> 
> 
> On 10/06/2014 12:54 PM, Augie Fackler wrote:
>> On Fri, Oct 03, 2014 at 05:19:25PM -0500, Pierre-Yves David wrote:
>>> 
>>> 
>>> On 10/03/2014 03:39 PM, Matt Mackall wrote:
>>>> On Fri, 2014-10-03 at 16:21 -0400, Jordi Gutiérrez Hermoso wrote:
>>>>> # HG changeset patch
>>>>> # User Jordi Gutiérrez Hermoso <jordigh@octave.org>
>>>>> # Date 1412353066 14400
>>>>> #      Fri Oct 03 12:17:46 2014 -0400
>>>>> # Node ID eb4d20b10e17135d8b2402f23af8e0b6797297c9
>>>>> # Parent  9f9ba0dcf5fdcc9978db7fdbd909916f0c35e4a6
>>>>> config: give a more detailed sample repo config
>>>> 
>>>> We're doing something a little weird here.
>>>> 
>>>> $ hg init a
>>>> $ cat a/.hg/hgrc
>>>> cat: a/.hg/hgrc: No such file or directory
>>>> $ hg clone a aa
>>>> updating to branch default
>>>> 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
>>>> $ cat aa/.hg/hgrc
>>>> # You may want to set your username here if it is not set
>>>> # globally, or this repository requires a different
>>>> # username from your usual configuration. If you want to
>>>> # set something for all of your repositories on this
>>>> # computer, try running the command
>>>> # 'hg config --edit --global'
>>>> 
>>>> Who approved that? Global?? Ugh.
>> 
>> if we're talking about the actual *flag name* --global, I'm almost sure that isn't me. In fact:
>> 
>> changeset:   21617:13fcb9ca9ccc
>> user:        Matt Mackall <mpm@selenic.com>
>> date:        Tue Mar 18 18:49:30 2014 -0500
>> summary:     config: add --global and --local flags
> 
> Sure, --global edit the system level config. Definitly not something we want the use to use in this case.
> 
> 
>> 
>>> 
>>> This is added by:
>>> 
>>>   changeset:   25035:82b2ba904e3e
>>>   user:        Augie Fackler <raf@durin42.com>
>>>   date:        Tue Sep 09 17:16:24 2014 -0400
>>>   summary:     clone: provide sample username = config entry in .hg/hgrc
>>> (issue4359)
>>> 
>>> And I cannot see any mention of it on the list. So I assume it has been
>>> pushed directly on crew ? Obsmarkers give Augies as the last guy who touched
>>> the changesets.
>>> 
>>> Augies, did you pushed that by mistake our did you got a special side
>>> channel approval for that (I would be confused by Matt acking this).
>> 
>> I'm pretty sure I ran this by at least TheMystic on IRC. Since it's in
>> a sample hgrc config, we can certainly change it?
> 
> It think it was list worthy. But not a huge deal.

Oh jeez. I didn't even notice that --global means something other than what it does for 'git config' (and neither did the folks that reviewed via irc). Yay.

Shall I send a patch to correctly suggest --edit instead of --global --edit, or is that going to shake out of the other work suggested i this thread?

> 
>> (-1 point for not cc'ing me on this email, I almost didn't read it.)
> 
> Oops, sorry about that.
> 
> -- 
> Pierre-Yves David
Jordi Gutiérrez Hermoso - Oct. 6, 2014, 8:02 p.m.
On Fri, 2014-10-03 at 15:39 -0500, Matt Mackall wrote:
> We're not creating the file on init, but we are on clone.
> 
> It seems that we've got one message in hg.py, another in ui.py. We need
> to unify them and create the file in all of the following circumstances:
> 
> - init
> - clone (+ add default url)
> - conf -l (if not already present)

I'm working on this. It's pretty easy to fixx the clone one. The init
one is trickier, because then I'd have to worry about localrepo,
sshrepo, and maybe subrepo, all of which accept create=True (and with
sshrepo, it gets complicated as the local and remote Mercurials might
not agree).

Can we just leave it hgrcless for init? Since the idea is that you get
these sample hgrc files if you're using `hgrc config --local`, I think
creating the hgrc just-in-time is ok.

Patch

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -28,6 +28,14 @@  username =
 
     'local':
 """# example repository config (see "hg help config" for more info)
+[paths]
+# path aliases to other clones of this repo in URLs or filesystem paths
+# (see "paths" in "hg help config")
+#
+# default      = http://example.com/hg/example-repo
+# default-push = ssh://jdoe@example.net/hg/jdoes-fork
+# my-fork      = ssh://jdoe@example.net/hg/jdoes-fork
+# my-clone     = /home/jdoe/jdoes-clone
 """,
 
     'global':