comparison mercurial/changegroup.py @ 27218:de3335b4c8ef

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.)
author Augie Fackler <augie@google.com>
date Wed, 02 Dec 2015 14:32:17 -0500
parents c4895f9b8ab1
children beb60a898dd0
comparison
equal deleted inserted replaced
27217:1ec23f3e62f3 27218:de3335b4c8ef
310 - more heads than before: 1+added heads (2..n) 310 - more heads than before: 1+added heads (2..n)
311 - fewer heads than before: -1-removed heads (-2..-n) 311 - fewer heads than before: -1-removed heads (-2..-n)
312 - number of heads stays the same: 1 312 - number of heads stays the same: 1
313 """ 313 """
314 repo = repo.unfiltered() 314 repo = repo.unfiltered()
315 wasempty = (len(repo.changelog) == 0)
315 def csmap(x): 316 def csmap(x):
316 repo.ui.debug("add changeset %s\n" % short(x)) 317 repo.ui.debug("add changeset %s\n" % short(x))
317 return len(cl) 318 return len(cl)
318 319
319 def revmap(x): 320 def revmap(x):
384 # process the files 385 # process the files
385 repo.ui.status(_("adding file changes\n")) 386 repo.ui.status(_("adding file changes\n"))
386 self.callback = None 387 self.callback = None
387 pr = prog(_('files'), efiles) 388 pr = prog(_('files'), efiles)
388 newrevs, newfiles = _addchangegroupfiles( 389 newrevs, newfiles = _addchangegroupfiles(
389 repo, self, revmap, trp, pr, needfiles) 390 repo, self, revmap, trp, pr, needfiles, wasempty)
390 revisions += newrevs 391 revisions += newrevs
391 files += newfiles 392 files += newfiles
392 393
393 dh = 0 394 dh = 0
394 if oldheads: 395 if oldheads:
901 902
902 def changegroup(repo, basenodes, source): 903 def changegroup(repo, basenodes, source):
903 # to avoid a race we use changegroupsubset() (issue1320) 904 # to avoid a race we use changegroupsubset() (issue1320)
904 return changegroupsubset(repo, basenodes, repo.heads(), source) 905 return changegroupsubset(repo, basenodes, repo.heads(), source)
905 906
906 def _addchangegroupfiles(repo, source, revmap, trp, pr, needfiles): 907 def _addchangegroupfiles(repo, source, revmap, trp, pr, needfiles, wasempty):
907 revisions = 0 908 revisions = 0
908 files = 0 909 files = 0
909 while True: 910 while True:
910 chunkdata = source.filelogheader() 911 chunkdata = source.filelogheader()
911 if not chunkdata: 912 if not chunkdata: