Mercurial > hg
comparison mercurial/changegroup.py @ 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 |
comparison
equal
deleted
inserted
replaced
22968:01e98eba3bc1 | 22969:805c18b27f48 |
---|---|
590 return cl.rev(x) | 590 return cl.rev(x) |
591 | 591 |
592 if not source: | 592 if not source: |
593 return 0 | 593 return 0 |
594 | 594 |
595 repo.hook('prechangegroup', throw=True, source=srctype, url=url) | |
596 | |
597 changesets = files = revisions = 0 | 595 changesets = files = revisions = 0 |
598 efiles = set() | 596 efiles = set() |
599 | 597 |
600 # write changelog data to temp files so concurrent readers will not see | 598 # write changelog data to temp files so concurrent readers will not see |
601 # inconsistent view | 599 # inconsistent view |
603 cl.delayupdate() | 601 cl.delayupdate() |
604 oldheads = cl.heads() | 602 oldheads = cl.heads() |
605 | 603 |
606 tr = repo.transaction("\n".join([srctype, util.hidepassword(url)])) | 604 tr = repo.transaction("\n".join([srctype, util.hidepassword(url)])) |
607 try: | 605 try: |
606 repo.hook('prechangegroup', throw=True, source=srctype, url=url) | |
607 | |
608 trp = weakref.proxy(tr) | 608 trp = weakref.proxy(tr) |
609 # pull off the changeset group | 609 # pull off the changeset group |
610 repo.ui.status(_("adding changesets\n")) | 610 repo.ui.status(_("adding changesets\n")) |
611 clstart = len(cl) | 611 clstart = len(cl) |
612 class prog(object): | 612 class prog(object): |