diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py --- a/mercurial/changegroup.py +++ b/mercurial/changegroup.py @@ -322,19 +322,19 @@ class cg1unpacker(object): changesets = files = revisions = 0 tr = repo.transaction("\n".join([srctype, util.hidepassword(url)])) - # The transaction could have been created before and already - # carries source information. In this case we use the top - # level data. We overwrite the argument because we need to use - # the top level value (if they exist) in this function. - srctype = tr.hookargs.setdefault('source', srctype) - url = tr.hookargs.setdefault('url', url) + try: + # The transaction could have been created before and already + # carries source information. In this case we use the top + # level data. We overwrite the argument because we need to use + # the top level value (if they exist) in this function. + srctype = tr.hookargs.setdefault('source', srctype) + url = tr.hookargs.setdefault('url', url) - # write changelog data to temp files so concurrent readers will not see - # inconsistent view - cl = repo.changelog - cl.delayupdate(tr) - oldheads = cl.heads() - try: + # write changelog data to temp files so concurrent readers + # will not see an inconsistent view + cl = repo.changelog + cl.delayupdate(tr) + oldheads = cl.heads() repo.hook('prechangegroup', throw=True, **tr.hookargs) trp = weakref.proxy(tr)