736 lock = repo.lock() |
736 lock = repo.lock() |
737 try: |
737 try: |
738 check_heads(repo, heads, 'uploading changes') |
738 check_heads(repo, heads, 'uploading changes') |
739 # push can proceed |
739 # push can proceed |
740 if util.safehasattr(cg, 'params'): |
740 if util.safehasattr(cg, 'params'): |
741 tr = repo.transaction('unbundle') |
741 try: |
742 tr.hookargs['bundle2-exp'] = '1' |
742 tr = repo.transaction('unbundle') |
743 r = bundle2.processbundle(repo, cg, lambda: tr).reply |
743 tr.hookargs['bundle2-exp'] = '1' |
744 cl = repo.unfiltered().changelog |
744 r = bundle2.processbundle(repo, cg, lambda: tr).reply |
745 p = cl.writepending() and repo.root or "" |
745 cl = repo.unfiltered().changelog |
746 repo.hook('b2x-pretransactionclose', throw=True, source=source, |
746 p = cl.writepending() and repo.root or "" |
747 url=url, pending=p, **tr.hookargs) |
747 repo.hook('b2x-pretransactionclose', throw=True, source=source, |
748 tr.close() |
748 url=url, pending=p, **tr.hookargs) |
749 repo.hook('b2x-transactionclose', source=source, url=url, |
749 tr.close() |
750 **tr.hookargs) |
750 repo.hook('b2x-transactionclose', source=source, url=url, |
|
751 **tr.hookargs) |
|
752 except Exception, exc: |
|
753 exc.duringunbundle2 = True |
|
754 raise |
751 else: |
755 else: |
752 r = changegroup.addchangegroup(repo, cg, source, url) |
756 r = changegroup.addchangegroup(repo, cg, source, url) |
753 finally: |
757 finally: |
754 if tr is not None: |
758 if tr is not None: |
755 tr.release() |
759 tr.release() |