# HG changeset patch # User Pierre-Yves David # Date 2014-10-14 07:09:25 # Node ID 805c18b27f48a5cd49ebe78dd0b7e32447a3de09 # Parent 01e98eba3bc140c0153b120dc2ee7fd43340ed72 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. diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py --- a/mercurial/changegroup.py +++ b/mercurial/changegroup.py @@ -592,8 +592,6 @@ def addchangegroup(repo, source, srctype if not source: return 0 - repo.hook('prechangegroup', throw=True, source=srctype, url=url) - changesets = files = revisions = 0 efiles = set() @@ -605,6 +603,8 @@ def addchangegroup(repo, source, srctype 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"))