changegroup: note during bundle apply if the repo was empty
authorAugie Fackler <augie@google.com>
Wed, 02 Dec 2015 14:32:17 -0500
changeset 27218 de3335b4c8ef
parent 27217 1ec23f3e62f3
child 27219 beb60a898dd0
changegroup: note during bundle apply if the repo was empty An upcoming change for exchanging treemanifest data will need to update the repository capabilities, which we should only do if the repository was empty before we started applying this changegroup. In the future we will probably need a strategy for upgrading to treemanifest in requires during a pull (I'm assuming at some point we'll make it possible to have a flag day to enable treemanifests on an existing history.)
mercurial/changegroup.py
--- a/mercurial/changegroup.py	Wed Dec 02 07:41:35 2015 +0000
+++ b/mercurial/changegroup.py	Wed Dec 02 14:32:17 2015 -0500
@@ -312,6 +312,7 @@
         - number of heads stays the same: 1
         """
         repo = repo.unfiltered()
+        wasempty = (len(repo.changelog) == 0)
         def csmap(x):
             repo.ui.debug("add changeset %s\n" % short(x))
             return len(cl)
@@ -386,7 +387,7 @@
             self.callback = None
             pr = prog(_('files'), efiles)
             newrevs, newfiles = _addchangegroupfiles(
-                repo, self, revmap, trp, pr, needfiles)
+                repo, self, revmap, trp, pr, needfiles, wasempty)
             revisions += newrevs
             files += newfiles
 
@@ -903,7 +904,7 @@
     # to avoid a race we use changegroupsubset() (issue1320)
     return changegroupsubset(repo, basenodes, repo.heads(), source)
 
-def _addchangegroupfiles(repo, source, revmap, trp, pr, needfiles):
+def _addchangegroupfiles(repo, source, revmap, trp, pr, needfiles, wasempty):
     revisions = 0
     files = 0
     while True: