Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 1461:02099220ad49
Implementing clone -r, which clones all changesets needed to reach a
particular revision.
author | Eric Hopper <hopper@omnifarious.org> |
---|---|
date | Fri, 07 Oct 2005 19:51:09 -0700 |
parents | 518da3c3b6ce |
children | be6b5ce60b7f |
comparison
equal
deleted
inserted
replaced
1460:40d08cf1c544 | 1461:02099220ad49 |
---|---|
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, |