[PATCH 03 of 14] hg: add shallow option for repo intialization

Vishakh H vsh426 at gmail.com
Fri Jul 16 02:15:11 CDT 2010


# HG changeset patch
# User Vishakh H <vsh426 at gmail.com>
# Date 1279263210 -19800
# Node ID 6f82794d9beffa5487e2a364ec0eb29d3441774a
# Parent  cc705977c22d5f656883c2fc3d8fb5a25e09f56b
hg: add shallow option for repo intialization

parameter to mark repo as shallow

diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -89,9 +89,9 @@
             return False
     return repo.local()
 
-def repository(ui, path='', create=False):
+def repository(ui, path='', create=False, shallow=None):
     """return a repository object for the specified path"""
-    repo = _lookup(path).instance(ui, path, create)
+    repo = _lookup(path).instance(ui, path, create, shallow)
     ui = getattr(repo, "ui", ui)
     for name, module in extensions.extensions():
         hook = getattr(module, 'reposetup', None)
@@ -316,7 +316,8 @@
             if shallowroot:
                 shallowroot = src_repo.lookup(shallowroot)
             try:
-                dest_repo = repository(ui, dest, create=True)
+                dest_repo = repository(ui, dest, create=True,
+                                       shallow=shallowroot)
             except OSError, inst:
                 if inst.errno == errno.EEXIST:
                     dir_cleanup.close()


More information about the Mercurial-devel mailing list