625 other = hg.repository(ui, source) |
625 other = hg.repository(ui, source) |
626 |
626 |
627 copy = False |
627 copy = False |
628 if other.dev() != -1: |
628 if other.dev() != -1: |
629 abspath = os.path.abspath(source) |
629 abspath = os.path.abspath(source) |
630 if not opts['pull']: |
630 if not opts['pull'] and not opts['rev']: |
631 copy = True |
631 copy = True |
632 |
632 |
633 if copy: |
633 if copy: |
634 try: |
634 try: |
635 # we use a lock here because if we race with commit, we |
635 # we use a lock here because if we race with commit, we |
653 |
653 |
654 repo = hg.repository(ui, dest) |
654 repo = hg.repository(ui, dest) |
655 |
655 |
656 else: |
656 else: |
657 repo = hg.repository(ui, dest, create=1) |
657 repo = hg.repository(ui, dest, create=1) |
658 repo.pull(other) |
658 rev = None |
|
659 if opts['rev']: |
|
660 rev = [other.lookup(opts['rev'])] |
|
661 repo.pull(other, heads = rev) |
659 |
662 |
660 f = repo.opener("hgrc", "w", text=True) |
663 f = repo.opener("hgrc", "w", text=True) |
661 f.write("[paths]\n") |
664 f.write("[paths]\n") |
662 f.write("default = %s\n" % abspath) |
665 f.write("default = %s\n" % abspath) |
663 |
666 |
1780 'hg cat [OPTION]... FILE...'), |
1783 'hg cat [OPTION]... FILE...'), |
1781 "^clone": |
1784 "^clone": |
1782 (clone, |
1785 (clone, |
1783 [('U', 'noupdate', None, 'skip update after cloning'), |
1786 [('U', 'noupdate', None, 'skip update after cloning'), |
1784 ('e', 'ssh', "", 'ssh command'), |
1787 ('e', 'ssh', "", 'ssh command'), |
|
1788 ('r', 'rev', "", 'only clone changesets needed to create revision'), |
1785 ('', 'pull', None, 'use pull protocol to copy metadata'), |
1789 ('', 'pull', None, 'use pull protocol to copy metadata'), |
1786 ('', 'remotecmd', "", 'remote hg command')], |
1790 ('', 'remotecmd', "", 'remote hg command')], |
1787 'hg clone [OPTION]... SOURCE [DEST]'), |
1791 'hg clone [OPTION]... SOURCE [DEST]'), |
1788 "^commit|ci": |
1792 "^commit|ci": |
1789 (commit, |
1793 (commit, |