[PATCH] Added clone function to package to permit cloning a repo without first opening a repo

Idan Kamara idankk86 at gmail.com
Thu Nov 17 17:22:26 CST 2011


On Wed, Nov 16, 2011 at 11:17 PM, Jeff Laughlin <
jmlaughlin at integrated-informatics.com> wrote:

> # HG changeset patch
> # User Jeff Laughlin <jmlaughlin at integrated-informatics.com>
> # Date 1321477332 18000
> # Node ID a17141e6aabfd8f8bc7a3fc18bb18109bd633b4d
> # Parent  cc29b623eb5a459c9badd031855e2c3f0d943994
> Added clone function to package to permit cloning a repo without first
> opening a repo.
>

Please remember to --flag hglib when sending patches related to hglib so
it'll be easier to spot them.
My .hg/hgrc in hglib's clone contains this:

[defaults]
email = --flag hglib

So I don't have to type it every time.


>
> diff -r cc29b623eb5a -r a17141e6aabf hglib/__init__.py
> --- a/hglib/__init__.py Wed Nov 16 14:19:15 2011 -0500
> +++ b/hglib/__init__.py Wed Nov 16 16:02:12 2011 -0500
> @@ -20,3 +20,15 @@
>         raise error.CommandError(args, proc.returncode, out, err)
>
>     return open(dest, encoding, configs)
> +
> +def clone(source=None, dest=None, ssh=None, remotecmd=None,
> insecure=False,
> +         encoding=None, configs=None):
>

The last two arguments aren't used.


> +    args = util.cmdbuilder('clone', source, dest, e=ssh,
> remotecmd=remotecmd,
> +                           insecure=insecure)
> +
> +    args.insert(0, HGPATH)
> +    proc = util.popen(args)
> +    out, err = proc.communicate()
> +    if proc.returncode:
> +        raise error.CommandError(args, proc.returncode, out, err)
> +


I guess it's more flexible if we don't return a client object here, like
init().
But are there any real scenarios where someone would clone() without
calling open() right after? Maybe... If that's the case maybe init() needs
to change too.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20111118/0668c819/attachment.html>


More information about the Mercurial-devel mailing list