addchangegroup: add option to skip check for empty changelog group
authorAlexis S. L. Carvalho <alexis@cecm.usp.br>
Sat, 19 Jan 2008 18:01:16 -0200
changeset 5907 afb7bdf11a61
parent 5906 0136d7f58982
child 5908 afa1e6122be7
addchangegroup: add option to skip check for empty changelog group
mercurial/localrepo.py
--- a/mercurial/localrepo.py	Sat Jan 19 18:01:16 2008 -0200
+++ b/mercurial/localrepo.py	Sat Jan 19 18:01:16 2008 -0200
@@ -1852,7 +1852,7 @@
 
         return util.chunkbuffer(gengroup())
 
-    def addchangegroup(self, source, srctype, url):
+    def addchangegroup(self, source, srctype, url, emptyok=False):
         """add changegroup to repo.
 
         return values:
@@ -1888,7 +1888,7 @@
             self.ui.status(_("adding changesets\n"))
             cor = cl.count() - 1
             chunkiter = changegroup.chunkiter(source)
-            if cl.addgroup(chunkiter, csmap, trp, 1) is None:
+            if cl.addgroup(chunkiter, csmap, trp, 1) is None and not emptyok:
                 raise util.Abort(_("received changelog group is empty"))
             cnr = cl.count() - 1
             changesets = cnr - cor