First draft for clone -u

Adrian Buehlmann adrian at cadifra.com
Thu Oct 22 13:35:05 UTC 2009


On 21.10.2009 21:37, Adrian Buehlmann wrote:
> I started trying to add option -u to the clone command.
> 
> Currently I have this first draft for a patch (feedback most welcome):
> 

My current state of the help text:

def clone(ui, source, dest=None, **opts):
    """make a copy of an existing repository

    Create a copy of an existing repository in a new directory.

    If no destination directory name is specified, it defaults to the
    basename of the source.

    The location of the source is added to the new repository's
    .hg/hgrc file, as the default to be used for future pulls.

    See 'hg help urls' for valid source format details.

    It is possible to specify an ssh:// URL as the destination, but no
    .hg/hgrc and working directory will be created on the remote side.
    Please see 'hg help urls' for important details about ssh:// URLs.

    If the -U/--noupdate option is specified, the new clone will contain
    only a repository (.hg) and no working copy (the working copy parent
    will be the null revision). Otherwise, clone will initially check
    out (in order of precedence):
    a) the revision, tag or branch specified with -u/--updaterev
    b) the revision, tag or branch given with the first -r/--rev
    c) the head of the default branch

    Use 'hg clone -u . src dst' to checkout the source repository's
    parent revision (applicable for local source repositories only).

    A set of revisions (tags, or branch names) to pull may be specified
    by listing each revision (tag, or branch name) with -r/--rev.
    If -r/--rev is used, the cloned repository will contain only a subset
    of the revisions of the source repository. Only the set of revisions
    defined by all -r/--rev options (implicitly including their direct
    and indirect parent revisions) will be pulled into the destination
    repository. No subsequent revisions (including subsequent tags) will
    be present in the destination.

    Using -r/--rev (or 'clone src#rev dest') implies --pull, even for
    local source repositories.

    For efficiency, hardlinks are used for cloning whenever the source
    and destination are on the same filesystem (note this applies only
    to the repository data, not to the checked out files). Some
    filesystems, such as AFS, implement hardlinking incorrectly, but
    do not report errors. In these cases, use the --pull option to
    avoid hardlinking.

    In some cases, you can clone repositories and checked out files
    using full hardlinks with ::

      $ cp -al REPO REPOCLONE

    This is the fastest way to clone, but it is not always safe. The
    operation is not atomic (making sure REPO is not modified during
    the operation is up to you) and you have to make sure your editor
    breaks hardlinks (Emacs and most Linux Kernel tools do so). Also,
    this is not compatible with certain extensions that place their
    metadata under the .hg directory, such as mq.
    """



More information about the Mercurial-devel mailing list