comparison mercurial/changegroup.py @ 33309:69c4493a54f9

changegroup: don't fail on empty changegroup (API) I don't know why applying an empty changegroup should be an error. It seems harmless. I suspect the check was there to find code that creates empty changegroups just because that would be wasteful. Let's use develwarn() for that instead, so we catch any such cases that run with our test runner, but we still allow others to generate empty changegroups if they want to. We have run into this check at Google once or twice and had to work around it, but I'm changing this not so much because of that, but because it seems like it shouldn't be an error. I also changed the message slightly to be more modern ("changelog group" -> "changegroup") and more generic ("received" -> "applied").
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 30 Jun 2017 23:58:59 -0700
parents 248d5890c80a
children 168ba5c4dfcb
comparison
equal deleted inserted replaced
33308:248d5890c80a 33309:69c4493a54f9
296 self.changelogheader() 296 self.changelogheader()
297 cgnodes = cl.addgroup(self, csmap, trp, addrevisioncb=onchangelog) 297 cgnodes = cl.addgroup(self, csmap, trp, addrevisioncb=onchangelog)
298 efiles = len(efiles) 298 efiles = len(efiles)
299 299
300 if not cgnodes: 300 if not cgnodes:
301 raise error.Abort(_("received changelog group is empty")) 301 repo.ui.develwarn('applied empty changegroup',
302 config='empty-changegroup')
302 clend = len(cl) 303 clend = len(cl)
303 changesets = clend - clstart 304 changesets = clend - clstart
304 repo.ui.progress(_('changesets'), None) 305 repo.ui.progress(_('changesets'), None)
305 self.callback = None 306 self.callback = None
306 307