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)) |
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): |