[PATCH 8 of 9] hg: add shallowroot parameters

Vishakh H vsh426 at gmail.com
Tue Jul 6 05:47:07 CDT 2010


# HG changeset patch
# User Vishakh H <vsh426 at gmail.com>
# Date 1278412035 -19800
# Branch stable
# Node ID fb5a27d57242cbc874aa388dd78e81aee3870851
# Parent  732c4eb5a2ecca07e80c38045d07ec7d825a678d
hg: add shallowroot parameters

diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -179,7 +179,7 @@
         _update(r, uprev)
 
 def clone(ui, source, dest=None, pull=False, rev=None, update=True,
-          stream=False, branch=None):
+          stream=False, branch=None, shallowroot=None):
     """Make a copy of an existing repository.
 
     Create a copy of an existing repository in a new directory.  The
@@ -259,7 +259,7 @@
         copy = False
         if src_repo.cancopy() and islocal(dest):
             abspath = os.path.abspath(util.drop_scheme('file', origsource))
-            copy = not pull and not rev
+            copy = not pull and not rev and not shallowroot
 
         if copy:
             try:
@@ -330,8 +330,10 @@
                                        "support clone by revision"))
                 revs = [src_repo.lookup(r) for r in rev]
                 checkout = revs[0]
+            if shallowroot:
+                shallowroot = src_repo.lookup(shallowroot)
             if dest_repo.local():
-                dest_repo.clone(src_repo, heads=revs, stream=stream)
+                dest_repo.clone(src_repo, heads=revs, shallowroot=shallowroot, stream=stream)
             elif src_repo.local():
                 src_repo.push(dest_repo, revs=revs)
             else:


More information about the Mercurial-devel mailing list