changegroup: fix the scope of a try finally
The try finally is here to ensure we release the just-created transaction.
Therefore we should not do half a dozen operations before actually entry the try
scope.
--- a/mercurial/changegroup.py Sun Nov 01 21:19:09 2015 +0900
+++ b/mercurial/changegroup.py Fri Nov 06 12:39:06 2015 -0500
@@ -322,19 +322,19 @@
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)