623 |
623 |
624 It is possible to specify an ``ssh://`` URL as the destination, but no |
624 It is possible to specify an ``ssh://`` URL as the destination, but no |
625 .hg/hgrc and working directory will be created on the remote side. |
625 .hg/hgrc and working directory will be created on the remote side. |
626 Please see 'hg help urls' for important details about ``ssh://`` URLs. |
626 Please see 'hg help urls' for important details about ``ssh://`` URLs. |
627 |
627 |
628 If the -U/--noupdate option is specified, the new clone will contain |
|
629 only a repository (.hg) and no working copy (the working copy parent |
|
630 will be the null changeset). Otherwise, clone will initially check |
|
631 out (in order of precedence): |
|
632 |
|
633 a) the changeset, tag or branch specified with -u/--updaterev |
|
634 b) the changeset, tag or branch given with the first -r/--rev |
|
635 c) the branch given with the first -b/--branch |
|
636 d) the branch given with the url#branch source syntax |
|
637 e) the head of the default branch |
|
638 |
|
639 Use 'hg clone -u . src dst' to checkout the source repository's |
|
640 parent changeset (applicable for local source repositories only). |
|
641 |
|
642 A set of changesets (tags, or branch names) to pull may be specified |
628 A set of changesets (tags, or branch names) to pull may be specified |
643 by listing each changeset (tag, or branch name) with -r/--rev. |
629 by listing each changeset (tag, or branch name) with -r/--rev. |
644 If -r/--rev is used, the cloned repository will contain only a subset |
630 If -r/--rev is used, the cloned repository will contain only a subset |
645 of the changesets of the source repository. Only the set of changesets |
631 of the changesets of the source repository. Only the set of changesets |
646 defined by all -r/--rev options (including all their ancestors) |
632 defined by all -r/--rev options (including all their ancestors) |
651 Using -r/--rev (or 'clone src#rev dest') implies --pull, even for |
637 Using -r/--rev (or 'clone src#rev dest') implies --pull, even for |
652 local source repositories. |
638 local source repositories. |
653 |
639 |
654 For efficiency, hardlinks are used for cloning whenever the source |
640 For efficiency, hardlinks are used for cloning whenever the source |
655 and destination are on the same filesystem (note this applies only |
641 and destination are on the same filesystem (note this applies only |
656 to the repository data, not to the checked out files). Some |
642 to the repository data, not to the working directory). Some |
657 filesystems, such as AFS, implement hardlinking incorrectly, but |
643 filesystems, such as AFS, implement hardlinking incorrectly, but |
658 do not report errors. In these cases, use the --pull option to |
644 do not report errors. In these cases, use the --pull option to |
659 avoid hardlinking. |
645 avoid hardlinking. |
660 |
646 |
661 In some cases, you can clone repositories and checked out files |
647 In some cases, you can clone repositories and the working directory |
662 using full hardlinks with :: |
648 using full hardlinks with :: |
663 |
649 |
664 $ cp -al REPO REPOCLONE |
650 $ cp -al REPO REPOCLONE |
665 |
651 |
666 This is the fastest way to clone, but it is not always safe. The |
652 This is the fastest way to clone, but it is not always safe. The |
667 operation is not atomic (making sure REPO is not modified during |
653 operation is not atomic (making sure REPO is not modified during |
668 the operation is up to you) and you have to make sure your editor |
654 the operation is up to you) and you have to make sure your editor |
669 breaks hardlinks (Emacs and most Linux Kernel tools do so). Also, |
655 breaks hardlinks (Emacs and most Linux Kernel tools do so). Also, |
670 this is not compatible with certain extensions that place their |
656 this is not compatible with certain extensions that place their |
671 metadata under the .hg directory, such as mq. |
657 metadata under the .hg directory, such as mq. |
|
658 |
|
659 Mercurial will update the working directory to the first applicable |
|
660 revision from this list: |
|
661 |
|
662 a) null if -U or the source repository has no changesets |
|
663 b) if -u . and the source repository is local, the first parent of |
|
664 the source repository's working directory |
|
665 c) the changeset specified with -u (if a branch name, this means the |
|
666 latest head of that branch) |
|
667 d) the changeset specified with -r |
|
668 e) the tipmost head specified with -b |
|
669 f) the tipmost head specified with the url#branch source syntax |
|
670 g) the tipmost head of the default branch |
|
671 h) tip |
672 """ |
672 """ |
673 if opts.get('noupdate') and opts.get('updaterev'): |
673 if opts.get('noupdate') and opts.get('updaterev'): |
674 raise util.Abort(_("cannot specify both --noupdate and --updaterev")) |
674 raise util.Abort(_("cannot specify both --noupdate and --updaterev")) |
675 |
675 |
676 hg.clone(cmdutil.remoteui(ui, opts), source, dest, |
676 hg.clone(cmdutil.remoteui(ui, opts), source, dest, |