Mercurial > hg > mercurial-crew-with-dirclash
comparison mercurial/localrepo.py @ 2230:332950340788
localrepository.addchangegroup: add more source infos to hooks
author | Vadim Gelfer <vadim.gelfer@gmail.com> |
---|---|
date | Mon, 08 May 2006 16:50:27 -0700 |
parents | 0ff326c2b286 |
children | ef3c039e7ab8 |
comparison
equal
deleted
inserted
replaced
2229:0ff326c2b286 | 2230:332950340788 |
---|---|
1077 | 1077 |
1078 if heads is None: | 1078 if heads is None: |
1079 cg = remote.changegroup(fetch, 'pull') | 1079 cg = remote.changegroup(fetch, 'pull') |
1080 else: | 1080 else: |
1081 cg = remote.changegroupsubset(fetch, heads, 'pull') | 1081 cg = remote.changegroupsubset(fetch, heads, 'pull') |
1082 return self.addchangegroup(cg) | 1082 return self.addchangegroup(cg, 'pull') |
1083 | 1083 |
1084 def push(self, remote, force=False, revs=None): | 1084 def push(self, remote, force=False, revs=None): |
1085 lock = remote.lock() | 1085 lock = remote.lock() |
1086 | 1086 |
1087 base = {} | 1087 base = {} |
1114 | 1114 |
1115 if revs is None: | 1115 if revs is None: |
1116 cg = self.changegroup(update, 'push') | 1116 cg = self.changegroup(update, 'push') |
1117 else: | 1117 else: |
1118 cg = self.changegroupsubset(update, revs, 'push') | 1118 cg = self.changegroupsubset(update, revs, 'push') |
1119 return remote.addchangegroup(cg) | 1119 return remote.addchangegroup(cg, 'push') |
1120 | 1120 |
1121 def changegroupsubset(self, bases, heads, source): | 1121 def changegroupsubset(self, bases, heads, source): |
1122 """This function generates a changegroup consisting of all the nodes | 1122 """This function generates a changegroup consisting of all the nodes |
1123 that are descendents of any of the bases, and ancestors of any of | 1123 that are descendents of any of the bases, and ancestors of any of |
1124 the heads. | 1124 the heads. |
1453 if nodes: | 1453 if nodes: |
1454 self.hook('outgoing', node=hex(nodes[0]), source=source) | 1454 self.hook('outgoing', node=hex(nodes[0]), source=source) |
1455 | 1455 |
1456 return util.chunkbuffer(gengroup()) | 1456 return util.chunkbuffer(gengroup()) |
1457 | 1457 |
1458 def addchangegroup(self, source): | 1458 def addchangegroup(self, source, srctype): |
1459 """add changegroup to repo. | 1459 """add changegroup to repo. |
1460 returns number of heads modified or added + 1.""" | 1460 returns number of heads modified or added + 1.""" |
1461 | 1461 |
1462 def csmap(x): | 1462 def csmap(x): |
1463 self.ui.debug(_("add changeset %s\n") % short(x)) | 1463 self.ui.debug(_("add changeset %s\n") % short(x)) |
1467 return cl.rev(x) | 1467 return cl.rev(x) |
1468 | 1468 |
1469 if not source: | 1469 if not source: |
1470 return 0 | 1470 return 0 |
1471 | 1471 |
1472 self.hook('prechangegroup', throw=True, source=source) | 1472 self.hook('prechangegroup', throw=True, source=srctype) |
1473 | 1473 |
1474 changesets = files = revisions = 0 | 1474 changesets = files = revisions = 0 |
1475 | 1475 |
1476 tr = self.transaction() | 1476 tr = self.transaction() |
1477 | 1477 |
1532 self.ui.status(_("added %d changesets" | 1532 self.ui.status(_("added %d changesets" |
1533 " with %d changes to %d files%s\n") | 1533 " with %d changes to %d files%s\n") |
1534 % (changesets, revisions, files, heads)) | 1534 % (changesets, revisions, files, heads)) |
1535 | 1535 |
1536 self.hook('pretxnchangegroup', throw=True, | 1536 self.hook('pretxnchangegroup', throw=True, |
1537 node=hex(self.changelog.node(cor+1)), source=source) | 1537 node=hex(self.changelog.node(cor+1)), source=srctype) |
1538 | 1538 |
1539 tr.close() | 1539 tr.close() |
1540 | 1540 |
1541 if changesets > 0: | 1541 if changesets > 0: |
1542 self.hook("changegroup", node=hex(self.changelog.node(cor+1)), | 1542 self.hook("changegroup", node=hex(self.changelog.node(cor+1)), |
1543 source=source) | 1543 source=srctype) |
1544 | 1544 |
1545 for i in range(cor + 1, cnr + 1): | 1545 for i in range(cor + 1, cnr + 1): |
1546 self.hook("incoming", node=hex(self.changelog.node(i)), | 1546 self.hook("incoming", node=hex(self.changelog.node(i)), |
1547 source=source) | 1547 source=srctype) |
1548 | 1548 |
1549 return newheads - oldheads + 1 | 1549 return newheads - oldheads + 1 |
1550 | 1550 |
1551 def update(self, node, allow=False, force=False, choose=None, | 1551 def update(self, node, allow=False, force=False, choose=None, |
1552 moddirstate=True, forcemerge=False, wlock=None, show_stats=True): | 1552 moddirstate=True, forcemerge=False, wlock=None, show_stats=True): |