659 return 0 |
659 return 0 |
660 |
660 |
661 changesets = files = revisions = 0 |
661 changesets = files = revisions = 0 |
662 efiles = set() |
662 efiles = set() |
663 |
663 |
664 # write changelog data to temp files so concurrent readers will not see |
|
665 # inconsistent view |
|
666 cl = repo.changelog |
|
667 cl.delayupdate() |
|
668 oldheads = cl.heads() |
|
669 |
|
670 tr = repo.transaction("\n".join([srctype, util.hidepassword(url)])) |
664 tr = repo.transaction("\n".join([srctype, util.hidepassword(url)])) |
671 # The transaction could have been created before and already carries source |
665 # The transaction could have been created before and already carries source |
672 # information. In this case we use the top level data. We overwrite the |
666 # information. In this case we use the top level data. We overwrite the |
673 # argument because we need to use the top level value (if they exist) in |
667 # argument because we need to use the top level value (if they exist) in |
674 # this function. |
668 # this function. |
675 srctype = tr.hookargs.setdefault('source', srctype) |
669 srctype = tr.hookargs.setdefault('source', srctype) |
676 url = tr.hookargs.setdefault('url', url) |
670 url = tr.hookargs.setdefault('url', url) |
|
671 |
|
672 # write changelog data to temp files so concurrent readers will not see |
|
673 # inconsistent view |
|
674 cl = repo.changelog |
|
675 cl.delayupdate(tr) |
|
676 oldheads = cl.heads() |
677 try: |
677 try: |
678 repo.hook('prechangegroup', throw=True, **tr.hookargs) |
678 repo.hook('prechangegroup', throw=True, **tr.hookargs) |
679 |
679 |
680 trp = weakref.proxy(tr) |
680 trp = weakref.proxy(tr) |
681 # pull off the changeset group |
681 # pull off the changeset group |
754 " with %d changes to %d files%s\n") |
754 " with %d changes to %d files%s\n") |
755 % (changesets, revisions, files, htext)) |
755 % (changesets, revisions, files, htext)) |
756 repo.invalidatevolatilesets() |
756 repo.invalidatevolatilesets() |
757 |
757 |
758 if changesets > 0: |
758 if changesets > 0: |
759 p = lambda: cl.writepending() and repo.root or "" |
759 p = lambda: tr.writepending() and repo.root or "" |
760 if 'node' not in tr.hookargs: |
760 if 'node' not in tr.hookargs: |
761 tr.hookargs['node'] = hex(cl.node(clstart)) |
761 tr.hookargs['node'] = hex(cl.node(clstart)) |
762 hookargs = dict(tr.hookargs) |
762 hookargs = dict(tr.hookargs) |
763 else: |
763 else: |
764 hookargs = dict(tr.hookargs) |
764 hookargs = dict(tr.hookargs) |