diff 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
line wrap: on
line diff
--- a/mercurial/commands.py	Fri Oct 07 19:49:25 2005 -0700
+++ b/mercurial/commands.py	Fri Oct 07 19:51:09 2005 -0700
@@ -627,7 +627,7 @@
     copy = False
     if other.dev() != -1:
         abspath = os.path.abspath(source)
-        if not opts['pull']:
+        if not opts['pull'] and not opts['rev']:
             copy = True
 
     if copy:
@@ -655,7 +655,10 @@
 
     else:
         repo = hg.repository(ui, dest, create=1)
-        repo.pull(other)
+        rev = None
+        if opts['rev']:
+            rev = [other.lookup(opts['rev'])]
+        repo.pull(other, heads = rev)
 
     f = repo.opener("hgrc", "w", text=True)
     f.write("[paths]\n")
@@ -1782,6 +1785,7 @@
         (clone,
          [('U', 'noupdate', None, 'skip update after cloning'),
           ('e', 'ssh', "", 'ssh command'),
+          ('r', 'rev', "", 'only clone changesets needed to create revision'),
           ('', 'pull', None, 'use pull protocol to copy metadata'),
           ('', 'remotecmd', "", 'remote hg command')],
          'hg clone [OPTION]... SOURCE [DEST]'),