[PATCH 5 of 8] Create [web] section with short username as contact on hg init and hg clone

Matt Mackall mpm at selenic.com
Sun Aug 28 15:27:59 CDT 2005


On Sun, Aug 28, 2005 at 06:54:55PM +0200, Thomas Arendsen Hein wrote:
> # HG changeset patch
> # User Thomas Arendsen Hein <thomas at intevation.de>
> # Node ID 899b619a7eb2312d0006ff8120dc3589d865c10c
> # Parent  92525920ad291a2f9cc9248ac0fef8134f51926b
> Create [web] section with short username as contact on hg init and hg clone.

I don't really like this bit. It's going to get it wrong for people
who haven't set ui.username to what they want yet and it feels
hackish. I also don't want to write more than the bare minimum to this
file, it sets a bad precedent.

I'd rather see us use ui.username as the default contact, and allow
that to be overridden.

> 
> diff -r 92525920ad29 -r 899b619a7eb2 mercurial/commands.py
> --- a/mercurial/commands.py	Sun Aug 28 16:13:28 2005
> +++ b/mercurial/commands.py	Sun Aug 28 16:27:24 2005
> @@ -587,8 +587,8 @@
>          repo = hg.repository(ui, dest, create=1)
>          repo.pull(other)
>  
> -    f = repo.opener("hgrc", "w")
> -    f.write("[paths]\n")
> +    f = repo.opener("hgrc", "a")
> +    f.write("\n[paths]\n")
>      f.write("default = %s\n" % abspath)
>  
>      if not opts['noupdate']:
> diff -r 92525920ad29 -r 899b619a7eb2 mercurial/localrepo.py
> --- a/mercurial/localrepo.py	Sun Aug 28 16:13:28 2005
> +++ b/mercurial/localrepo.py	Sun Aug 28 16:27:24 2005
> @@ -27,17 +27,19 @@
>  
>          self.root = os.path.abspath(path)
>          self.ui = ui
> -
> -        if create:
> -            os.mkdir(self.path)
> -            os.mkdir(self.join("data"))
> -
>          self.opener = util.opener(self.path)
>          self.wopener = util.opener(self.root)
>          self.manifest = manifest.manifest(self.opener)
>          self.changelog = changelog.changelog(self.opener)
>          self.tagscache = None
>          self.nodetagscache = None
> +
> +        if create:
> +            os.mkdir(self.path)
> +            os.mkdir(self.join("data"))
> +            f = self.opener("hgrc", "w")
> +            f.write("[web]\n")
> +            f.write("contact = %s\n" % ui.shortuser(ui.username()))
>  
>          self.dirstate = dirstate.dirstate(self.opener, ui, self.root)
>          try:
> _______________________________________________
> Mercurial mailing list
> Mercurial at selenic.com
> http://selenic.com/mailman/listinfo/mercurial

-- 
Mathematics is the supreme nostalgia of our time.


More information about the Mercurial mailing list