[F008] Clone

This functionality aims to surround : hg clone and to adapt it for <ant> tags.

Shell command


hg clone [OPTION]... SOURCE [DEST]

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 changeset). Otherwise, clone will initially check out (in order
    of precedence):

    a) the changeset, tag or branch specified with -u/--updaterev
    b) the changeset, 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
    changeset (applicable for local source repositories only).

    A set of changesets (tags, or branch names) to pull may be specified by
    listing each changeset (tag, or branch name) with -r/--rev. If -r/--rev is
    used, the cloned repository will contain only a subset of the changesets
    of the source repository. Only the set of changesets defined by all
    -r/--rev options (including all their ancestors) will be pulled into the
    destination repository. No subsequent changesets (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.

options:

 -U --noupdate      the clone will only contain a repository (no working copy)
 -u --updaterev     revision, tag or branch to check out
 -r --rev           clone only the specified revisions and ancestors
    --pull          use pull protocol to copy metadata
    --uncompressed  use uncompressed transfer (fast over LAN)
 -e --ssh           specify ssh command to use
    --remotecmd     specify hg command to run on the remote side

use "hg -v help clone" to show global options
                  

Parameters

Attribute Description Value Required
source the local or remote source to clone - http://url
- https://url
- file://path | path
- ssh://url
NEED HELP FOR SSH
yes if current directory is not a local repository.
no otherwise : uses current directory by default
destination the destination directory no, default is the basename of the source
noupdate the clone will only contain a repository (no working copy) true/false, yes/no, on/off no
revision clone only the specified revisions and ancestors no
pull use pull protocol to copy metadata true/false, yes/no, on/off no
uncompressed use uncompressed transfer (fast over LAN) true/false, yes/no, on/off no
ssh specify ssh command to use no
remotecmd specify hg command to run on the remote side no
Nested element Description Required
dirset resource collections no
arg command line argument value no
auth authentification no : hg uses hgrc configuration by default
hg source hg destination
<hg source="BJDOLLAR{src.val}" /> BJDOLLAR{src.val} basename of the source :
http://mercurial.intuxication.org/hg/ant4hg-tests => ./ant4hg-tests
file://path/to/my/dir => ./dir
<hg destination="BJDOLLAR{dest.val}" /> current directory
must be local repository root directory
(that contains .hg)
BJDOLLAR{dest.val}
<hg source="BJDOLLAR{src.val} destination="BJDOLLAR{dest.val}" /> BJDOLLAR{src.val} BJDOLLAR{dest.val}

Examples


# clone repository to ./ant4hg-tests : the basename of the source
<hg cmd="clone" source="http://mercurial.intuxication.org/hg/ant4hg-tests"/>

# clone repository to the given directory
                    <hg cmd="clone" source="http://mercurial.intuxication.org/hg/ant4hg-tests" destination="path/to/dir" />