[PATCH 2 of 2 v3] commands: add editconfig command to edit repo/user config
mads at kiilerich.com
Sat Sep 25 07:56:03 CDT 2010
Brodie Rao wrote, On 09/23/2010 03:31 AM:
> # HG changeset patch
> # User Brodie Rao<brodie at bitheap.org>
> # Date 1285205392 18000
> # Node ID 8a156b68be591a89654729c64bc5eb87e7caae4d
> # Parent 0bf68f8654746f151617e6179e3b273b08f5f211
> commands: add editconfig command to edit repo/user config
> "hg editconfig" provides a happy medium between making the user edit
> their config manually and providing a command to edit specific
> Without any arguments, the command will load the repo's hgrc in an
> editor if the user is inside a repo. When run outside a repo, it
> aborts. To edit the user config, a -u/--user option is provided.
> If there's no user or repo config, editconfig will provide configs
> with commented out examples.
> +def editconfig(ui, repo, **opts):
> + """load configuration file in configured editor
> + With no arguments, the current repository's ``.hg/hgrc`` is
> + loaded in your configured editor.
> + With --user, your user configuration file is loaded.
> + """
> + def writeconfig(path, example):
> + if example == 'user':
> + s = _(
> +"""# This is an example config file. Uncomment settings to enable them.
_If_ we want such templates then it might be a bit prettier to threat it
like a help topic and store it in mercurial/help/*.txt
More information about the Mercurial-devel