##// END OF EJS Templates
changegroup: store source and url in the `hookargs` dict...
Pierre-Yves David -
r22971:3fe571c7 default
parent child Browse files
Show More
@@ -602,9 +602,14 b' def addchangegroup(repo, source, srctype'
602 oldheads = cl.heads()
602 oldheads = cl.heads()
603
603
604 tr = repo.transaction("\n".join([srctype, util.hidepassword(url)]))
604 tr = repo.transaction("\n".join([srctype, util.hidepassword(url)]))
605 # The transaction could have been created before and already carries source
606 # information. In this case we use the top level data. We overwrite the
607 # argument because we need to use the top level value (if they exist) in
608 # this function.
609 srctype = tr.hookargs.setdefault('source', srctype)
610 url = tr.hookargs.setdefault('url', url)
605 try:
611 try:
606 repo.hook('prechangegroup', throw=True, source=srctype, url=url,
612 repo.hook('prechangegroup', throw=True, **tr.hookargs)
607 **tr.hookargs)
608
613
609 trp = weakref.proxy(tr)
614 trp = weakref.proxy(tr)
610 # pull off the changeset group
615 # pull off the changeset group
@@ -692,8 +697,7 b' def addchangegroup(repo, source, srctype'
692 else:
697 else:
693 hookargs = dict(tr.hookargs)
698 hookargs = dict(tr.hookargs)
694 hookargs['node'] = hex(cl.node(clstart))
699 hookargs['node'] = hex(cl.node(clstart))
695 repo.hook('pretxnchangegroup', throw=True, source=srctype,
700 repo.hook('pretxnchangegroup', throw=True, pending=p, **hookargs)
696 url=url, pending=p, **hookargs)
697
701
698 added = [cl.node(r) for r in xrange(clstart, clend)]
702 added = [cl.node(r) for r in xrange(clstart, clend)]
699 publishing = repo.ui.configbool('phases', 'publish', True)
703 publishing = repo.ui.configbool('phases', 'publish', True)
@@ -739,13 +743,12 b' def addchangegroup(repo, source, srctype'
739
743
740 # forcefully update the on-disk branch cache
744 # forcefully update the on-disk branch cache
741 repo.ui.debug("updating the branch cache\n")
745 repo.ui.debug("updating the branch cache\n")
742 repo.hook("changegroup", source=srctype, url=url,
746 repo.hook("changegroup", **hookargs)
743 **hookargs)
744
747
745 for n in added:
748 for n in added:
746 args = hookargs.copy()
749 args = hookargs.copy()
747 args['node'] = hex(n)
750 args['node'] = hex(n)
748 repo.hook("incoming", source=srctype, url=url, **args)
751 repo.hook("incoming", **args)
749
752
750 newheads = [h for h in repo.heads() if h not in oldheads]
753 newheads = [h for h in repo.heads() if h not in oldheads]
751 repo.ui.log("incoming",
754 repo.ui.log("incoming",
@@ -1235,15 +1235,16 b' def unbundle(repo, cg, heads, source, ur'
1235 if util.safehasattr(cg, 'params'):
1235 if util.safehasattr(cg, 'params'):
1236 try:
1236 try:
1237 tr = repo.transaction('unbundle')
1237 tr = repo.transaction('unbundle')
1238 tr.hookargs['source'] = source
1239 tr.hookargs['url'] = url
1238 tr.hookargs['bundle2-exp'] = '1'
1240 tr.hookargs['bundle2-exp'] = '1'
1239 r = bundle2.processbundle(repo, cg, lambda: tr).reply
1241 r = bundle2.processbundle(repo, cg, lambda: tr).reply
1240 cl = repo.unfiltered().changelog
1242 cl = repo.unfiltered().changelog
1241 p = cl.writepending() and repo.root or ""
1243 p = cl.writepending() and repo.root or ""
1242 repo.hook('b2x-pretransactionclose', throw=True, source=source,
1244 repo.hook('b2x-pretransactionclose', throw=True, pending=p,
1243 url=url, pending=p, **tr.hookargs)
1245 **tr.hookargs)
1244 tr.close()
1246 tr.close()
1245 repo.hook('b2x-transactionclose', source=source, url=url,
1247 repo.hook('b2x-transactionclose', **tr.hookargs)
1246 **tr.hookargs)
1247 except Exception, exc:
1248 except Exception, exc:
1248 exc.duringunbundle2 = True
1249 exc.duringunbundle2 = True
1249 raise
1250 raise
@@ -153,7 +153,7 b' push'
153 pushing to other
153 pushing to other
154 searching for changes
154 searching for changes
155 b2x-transactionclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2-EXP=1 HG_NEW_OBSMARKERS=1 HG_NODE=eea13746799a9e0bfd88f29d3c2e9dc9389f524f HG_PHASES_MOVED=1 HG_SOURCE=push HG_URL=push
155 b2x-transactionclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2-EXP=1 HG_NEW_OBSMARKERS=1 HG_NODE=eea13746799a9e0bfd88f29d3c2e9dc9389f524f HG_PHASES_MOVED=1 HG_SOURCE=push HG_URL=push
156 changegroup hook: HG_BUNDLE2-EXP=1 HG_NODE=eea13746799a9e0bfd88f29d3c2e9dc9389f524f HG_SOURCE=bundle2 HG_URL=bundle2
156 changegroup hook: HG_BUNDLE2-EXP=1 HG_NODE=eea13746799a9e0bfd88f29d3c2e9dc9389f524f HG_SOURCE=push HG_URL=push
157 remote: adding changesets
157 remote: adding changesets
158 remote: adding manifests
158 remote: adding manifests
159 remote: adding file changes
159 remote: adding file changes
@@ -229,7 +229,7 b' push over ssh'
229 remote: 1 new obsolescence markers
229 remote: 1 new obsolescence markers
230 updating bookmark book_5fdd
230 updating bookmark book_5fdd
231 remote: b2x-transactionclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2-EXP=1 HG_NEW_OBSMARKERS=1 HG_NODE=5fddd98957c8a54a4d436dfe1da9d87f21a1b97b HG_SOURCE=serve HG_URL=remote:ssh:127.0.0.1
231 remote: b2x-transactionclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2-EXP=1 HG_NEW_OBSMARKERS=1 HG_NODE=5fddd98957c8a54a4d436dfe1da9d87f21a1b97b HG_SOURCE=serve HG_URL=remote:ssh:127.0.0.1
232 remote: changegroup hook: HG_BUNDLE2-EXP=1 HG_NODE=5fddd98957c8a54a4d436dfe1da9d87f21a1b97b HG_SOURCE=bundle2 HG_URL=bundle2
232 remote: changegroup hook: HG_BUNDLE2-EXP=1 HG_NODE=5fddd98957c8a54a4d436dfe1da9d87f21a1b97b HG_SOURCE=serve HG_URL=remote:ssh:127.0.0.1
233 $ hg -R other log -G
233 $ hg -R other log -G
234 o 6:5fddd98957c8 draft Nicolas Dumazet <nicdumz.commits@gmail.com> book_5fdd C
234 o 6:5fddd98957c8 draft Nicolas Dumazet <nicdumz.commits@gmail.com> book_5fdd C
235 |
235 |
@@ -456,7 +456,7 b' Doing the actual push: hook abort'
456 searching for changes
456 searching for changes
457 transaction abort!
457 transaction abort!
458 rollback completed
458 rollback completed
459 changegroup hook: HG_BUNDLE2-EXP=1 HG_NODE=e7ec4e813ba6b07be2a0516ce1a74bb4e503f91a HG_SOURCE=bundle2 HG_URL=bundle2
459 changegroup hook: HG_BUNDLE2-EXP=1 HG_NODE=e7ec4e813ba6b07be2a0516ce1a74bb4e503f91a HG_SOURCE=push HG_URL=push
460 abort: b2x-pretransactionclose.failpush hook exited with status 1
460 abort: b2x-pretransactionclose.failpush hook exited with status 1
461 [255]
461 [255]
462
462
@@ -466,7 +466,7 b' Doing the actual push: hook abort'
466 abort: b2x-pretransactionclose.failpush hook exited with status 1
466 abort: b2x-pretransactionclose.failpush hook exited with status 1
467 remote: transaction abort!
467 remote: transaction abort!
468 remote: rollback completed
468 remote: rollback completed
469 remote: changegroup hook: HG_BUNDLE2-EXP=1 HG_NODE=e7ec4e813ba6b07be2a0516ce1a74bb4e503f91a HG_SOURCE=bundle2 HG_URL=bundle2
469 remote: changegroup hook: HG_BUNDLE2-EXP=1 HG_NODE=e7ec4e813ba6b07be2a0516ce1a74bb4e503f91a HG_SOURCE=serve HG_URL=remote:ssh:127.0.0.1
470 [255]
470 [255]
471
471
472 $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6
472 $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6
General Comments 0
You need to be logged in to leave comments. Login now