[PATCH 01 of 14] commands: add shallowroot option

Peter Arrenbrecht peter.arrenbrecht at gmail.com
Fri Jul 30 01:06:47 CDT 2010


On Tue, Jul 20, 2010 at 3:13 AM, Greg Ward <greg-hg at gerg.ca> wrote:
> On Fri, Jul 16, 2010 at 3:15 AM, Vishakh H <vsh426 at gmail.com> wrote:
>> # HG changeset patch
>> # User Vishakh H <vsh426 at gmail.com>
>> # Date 1279263210 -19800
>> # Node ID ac0aaabc91abd7c2ecde7c1e35fe2ac6f6a46e93
>> # Parent  47ca289a3a08516dd9b05d5ebe88aee07cf42d89
>> commands: add shallowroot option
>
> I believe usual convention when modifying commands.py is to prefix
> with the command that you are modifying, e.g.
>
>  clone: add shallowroot option
>
> Also, I think just plain "--shallow" is good enough.  So for the
> commit message, I suggest
>
>  clone: add --shallow/-s option
>
>> diff --git a/mercurial/commands.py b/mercurial/commands.py
>> --- a/mercurial/commands.py
>> +++ b/mercurial/commands.py
>> @@ -707,7 +707,8 @@
>>                  stream=opts.get('uncompressed'),
>>                  rev=opts.get('rev'),
>>                  update=opts.get('updaterev') or not opts.get('noupdate'),
>> -                 branch=opts.get('branch'))
>> +                 branch=opts.get('branch'),
>> +                 shallowroot=opts.get('shallowroot'))
>
> Indentation looks funny.  You're not using tabs, are you?
>
>> @@ -4048,6 +4049,8 @@
>>            _('include the specified changeset'), _('REV')),
>>           ('b', 'branch', [],
>>            _('clone only the specified branch'), _('BRANCH')),
>> +          ('s', 'shallowroot', '',
>> +           _('revision at which shallow clone will be created'), _('REV')),

You should document the new option in the docstring of clone, too.
This will force you to think about what the user can expect from
shallow clones, caveats, etc. ;)

> For the help, how about:
>
>  create a shallow clone with history only going back to REV
>
> or maybe
>
>  create a shallow clone with history starting at REV

I like the latter. Or maybe something like "clone only this revision
and its descendants" which is more precise. But we could leave
precision for the main help text.

-parren


More information about the Mercurial-devel mailing list