[PATCH 6 of 9] localrepo: add shallowroot parameters to localrepo methods

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


# HG changeset patch
# User Vishakh H <vsh426 at gmail.com>
# Date 1278412035 -19800
# Branch stable
# Node ID b3c06c23e6b618dc4ad6a94036d49c19432c2441
# Parent  2270527622c49bfdeff6e5686d34e10222db79e4
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,7 @@
 
         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 +1195,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 +1273,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 +1835,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 +1852,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