[PATCH 02 of 14] hg: add shallowroot parameters for clone
Vishakh H
vsh426 at gmail.com
Fri Jul 16 02:15:10 CDT 2010
# HG changeset patch
# User Vishakh H <vsh426 at gmail.com>
# Date 1279263210 -19800
# Node ID cc705977c22d5f656883c2fc3d8fb5a25e09f56b
# Parent ac0aaabc91abd7c2ecde7c1e35fe2ac6f6a46e93
hg: add shallowroot parameters for clone
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:
@@ -313,6 +313,8 @@
dest_repo = repository(ui, dest)
src_repo.hook('outgoing', source='clone', node='0'*40)
else:
+ if shallowroot:
+ shallowroot = src_repo.lookup(shallowroot)
try:
dest_repo = repository(ui, dest, create=True)
except OSError, inst:
@@ -331,7 +333,7 @@
revs = [src_repo.lookup(r) for r in rev]
checkout = revs[0]
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