Mercurial > public > mercurial-scm > hg-stable
diff mercurial/changegroup.py @ 23203:3872d563e01a
changelog: handle writepending in the transaction
The 'delayupdate' method now takes a transaction object and registers its
'_writepending' method for execution in 'transaction.writepending()'. The hook can then
use 'transaction.writepending()' directly.
At some point this will allow the addition of other file creation
during writepending.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Fri, 17 Oct 2014 21:55:31 -0700 |
parents | 832b7ef275c8 |
children | 2d54aa5397cd |
line wrap: on
line diff
--- a/mercurial/changegroup.py Fri Oct 17 21:19:54 2014 -0700 +++ b/mercurial/changegroup.py Fri Oct 17 21:55:31 2014 -0700 @@ -661,12 +661,6 @@ changesets = files = revisions = 0 efiles = set() - # write changelog data to temp files so concurrent readers will not see - # inconsistent view - cl = repo.changelog - cl.delayupdate() - oldheads = cl.heads() - 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 @@ -674,6 +668,12 @@ # 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: repo.hook('prechangegroup', throw=True, **tr.hookargs) @@ -756,7 +756,7 @@ repo.invalidatevolatilesets() if changesets > 0: - p = lambda: cl.writepending() and repo.root or "" + p = lambda: tr.writepending() and repo.root or "" if 'node' not in tr.hookargs: tr.hookargs['node'] = hex(cl.node(clstart)) hookargs = dict(tr.hookargs)