changeset 22969:805c18b27f48

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.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Tue, 14 Oct 2014 00:09:25 -0700
parents 01e98eba3bc1
children d82e2223f132
files mercurial/changegroup.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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"))