# HG changeset patch # User Benoit Boissinot # Date 1128375914 25200 # Node ID f2b00be33e2c586daae8a778ea1587af3dd00e7e # Parent c3654cfaa77d92a8247b6224956307e88be0377a Fix traceback when nothing was added during unbundle The changegroup and commit hook are now run only when something is modified. The correct number of changesets added is printed. diff -r c3654cfaa77d -r f2b00be33e2c mercurial/localrepo.py --- a/mercurial/localrepo.py Mon Oct 03 14:43:11 2005 -0700 +++ b/mercurial/localrepo.py Mon Oct 03 14:45:14 2005 -0700 @@ -992,6 +992,8 @@ co = self.changelog.tip() cn = self.changelog.addgroup(getgroup(), csmap, tr, 1) # unique cnr, cor = map(self.changelog.rev, (cn, co)) + if cn == nullid: + cnr = cor changesets = cnr - cor # pull off the manifest group @@ -1022,12 +1024,14 @@ tr.close() - if not self.hook("changegroup", node=hex(self.changelog.node(cor+1))): - self.ui.warn("abort: changegroup hook returned failure!\n") - return 1 + if changesets > 0: + if not self.hook("changegroup", + node=hex(self.changelog.node(cor+1))): + self.ui.warn("abort: changegroup hook returned failure!\n") + return 1 - for i in range(cor + 1, cnr + 1): - self.hook("commit", node=hex(self.changelog.node(i))) + for i in range(cor + 1, cnr + 1): + self.hook("commit", node=hex(self.changelog.node(i))) return