addchangegroup: call `prechangegroup` hook after transaction retrieval
We want to reused some possible information stored in the transaction
`hookargs` dict that may be stored by something handling the transaction at an
upper level (eg: bundle2) So we move the running of the hooks after transaction
creation. This has no visible effects (but an empty transaction roolback if the
hook fails) because nothing had happened in the transaction yet.
--- a/mercurial/changegroup.py Tue Oct 14 00:03:03 2014 -0700
+++ b/mercurial/changegroup.py Tue Oct 14 00:09:25 2014 -0700
@@ -592,8 +592,6 @@
if not source:
return 0
- repo.hook('prechangegroup', throw=True, source=srctype, url=url)
-
changesets = files = revisions = 0
efiles = set()
@@ -605,6 +603,8 @@
tr = repo.transaction("\n".join([srctype, util.hidepassword(url)]))
try:
+ repo.hook('prechangegroup', throw=True, source=srctype, url=url)
+
trp = weakref.proxy(tr)
# pull off the changeset group
repo.ui.status(_("adding changesets\n"))