[PATCH 04 of 14] localrepo: add shallowroot parameters to localrepo methods

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


# HG changeset patch
# User Vishakh H <vsh426 at gmail.com>
# Date 1279263210 -19800
# Node ID f24fc146825832dc47442cabdefed43c9afca0ba
# Parent  6f82794d9beffa5487e2a364ec0eb29d3441774a
localrepo: add shallowroot parameters to localrepo methods

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1179,7 +1179,8 @@
 
         return r
 
-    def pull(self, remote, heads=None, force=False):
+    def pull(self, remote, heads=None, force=False,
+             shallowroot=None):
         lock = self.lock()
         try:
             tmp = discovery.findcommonincoming(self, remote, heads=heads,
@@ -1195,14 +1196,15 @@
                 # issue1320, avoid a race if remote changed after discovery
                 heads = rheads
 
-            if heads is None:
+            if heads is None and shallowroot is None:
                 cg = remote.changegroup(fetch, 'pull')
             else:
                 if not remote.capable('changegroupsubset'):
                     raise util.Abort(_("Partial pull cannot be done because "
                                        "other repository doesn't support "
                                        "changegroupsubset."))
-                cg = remote.changegroupsubset(fetch, heads, 'pull')
+                cg = remote.changegroupsubset(fetch, heads, 'pull',
+                                              shallowroot=shallowroot)
             return self.addchangegroup(cg, 'pull', remote.url(), lock=lock)
         finally:
             lock.release()
@@ -1272,7 +1274,8 @@
             for node in nodes:
                 self.ui.debug("%s\n" % hex(node))
 
-    def changegroupsubset(self, bases, heads, source, extranodes=None):
+    def changegroupsubset(self, bases, heads, source, extranodes=None,
+                          shallowroot=None):
         """Compute a changegroup consisting of all the nodes that are
         descendents of any of the bases and ancestors of any of the heads.
         Return a chunkbuffer object whose read() method will return
@@ -1833,7 +1836,7 @@
         self.invalidate()
         return len(self.heads()) + 1
 
-    def clone(self, remote, heads=[], stream=False):
+    def clone(self, remote, heads=[], stream=False, shallowroot=None):
         '''clone remote repository.
 
         keyword arguments:
@@ -1850,7 +1853,7 @@
 
         if stream and not heads and remote.capable('stream'):
             return self.stream_in(remote)
-        return self.pull(remote, heads)
+        return self.pull(remote, heads, shallowroot=shallowroot)
 
     def pushkey(self, namespace, key, old, new):
         return pushkey.push(self, namespace, key, old, new)


More information about the Mercurial-devel mailing list