Show More
@@ -232,7 +232,7 b' def opener(base):' | |||
|
232 | 232 | |
|
233 | 233 | return o |
|
234 | 234 | |
|
235 | class repository: | |
|
235 | class localrepository: | |
|
236 | 236 | def __init__(self, ui, path=None, create=0): |
|
237 | 237 | self.remote = 0 |
|
238 | 238 | if path and path[:7] == "http://": |
@@ -612,15 +612,15 b' class repository:' | |||
|
612 | 612 | return nl |
|
613 | 613 | |
|
614 | 614 | def getchangegroup(self, remote): |
|
615 | tip = remote.branches([]) | |
|
615 | tip = remote.branches([])[0] | |
|
616 | 616 | cl = self.changelog |
|
617 | unknown = tip | |
|
617 | unknown = [tip] | |
|
618 | 618 | search = [] |
|
619 | 619 | fetch = [] |
|
620 | 620 | |
|
621 | 621 | if tip[0] == self.changelog.tip(): |
|
622 |
return |
|
|
623 | ||
|
622 | return None | |
|
623 | ||
|
624 | 624 | while unknown: |
|
625 | 625 | n = unknown.pop(0) |
|
626 | 626 | if n == nullid: break |
@@ -640,7 +640,7 b' class repository:' | |||
|
640 | 640 | f = 1 |
|
641 | 641 | for i in l + [n[1]]: |
|
642 | 642 | if self.changelog.nodemap.has_key(i): |
|
643 |
if f |
|
|
643 | if f <= 4: | |
|
644 | 644 | fetch.append(p) |
|
645 | 645 | else: |
|
646 | 646 | search.append((p, i)) |
@@ -666,25 +666,22 b' class repository:' | |||
|
666 | 666 | changed.sort() |
|
667 | 667 | |
|
668 | 668 | # the changegroup is changesets + manifests + all file revs |
|
669 | cg = [] | |
|
670 | 669 | revs = [ self.changelog.rev(n) for n in nodes ] |
|
671 | 670 | |
|
672 |
|
|
|
673 | cg.append(g) | |
|
674 | g = self.manifest.group(linkmap) | |
|
675 | cg.append(g) | |
|
671 | yield self.changelog.group(linkmap) | |
|
672 | yield self.manifest.group(linkmap) | |
|
676 | 673 | |
|
677 | 674 | for f in changed: |
|
678 | 675 | g = self.file(f).group(linkmap) |
|
679 | 676 | if not g: raise "couldn't find change to %s" % f |
|
680 | 677 | l = struct.pack(">l", len(f)) |
|
681 |
|
|
|
682 | ||
|
683 | return "".join(cg) | |
|
678 | yield "".join([l, f, g]) | |
|
684 | 679 | |
|
685 | 680 | def addchangegroup(self, data): |
|
686 | 681 | def getlen(data, pos): |
|
687 | 682 | return struct.unpack(">l", data[pos:pos + 4])[0] |
|
683 | ||
|
684 | if not data: return | |
|
688 | 685 | |
|
689 | 686 | tr = self.transaction() |
|
690 | 687 | simple = True |
@@ -787,6 +784,41 b' class repository:' | |||
|
787 | 784 | |
|
788 | 785 | tr.close() |
|
789 | 786 | |
|
787 | class remoterepository: | |
|
788 | def __init__(self, ui, path): | |
|
789 | self.url = path.replace("hg://", "http://", 1) | |
|
790 | self.ui = ui | |
|
791 | ||
|
792 | def do_cmd(self, cmd, **args): | |
|
793 | q = {"cmd": cmd} | |
|
794 | q.update(args) | |
|
795 | qs = urllib.urlencode(q) | |
|
796 | cu = "%s?%s" % (self.url, qs) | |
|
797 | return urllib.urlopen(cu).read() | |
|
798 | ||
|
799 | def branches(self, nodes): | |
|
800 | n = " ".join(map(hex, nodes)) | |
|
801 | d = self.do_cmd("branches", nodes=n) | |
|
802 | br = [ map(bin, b.split(" ")) for b in d.splitlines() ] | |
|
803 | return br | |
|
804 | ||
|
805 | def between(self, pairs): | |
|
806 | n = "\n".join(["-".join(map(hex, p)) for p in pairs]) | |
|
807 | d = self.do_cmd("between", pairs=n) | |
|
808 | p = [ map(bin, l.split(" ")) for l in d.splitlines() ] | |
|
809 | return p | |
|
810 | ||
|
811 | def changegroup(self, nodes): | |
|
812 | n = " ".join(map(hex, nodes)) | |
|
813 | d = self.do_cmd("changegroup", roots=n) | |
|
814 | return zlib.decompress(d) | |
|
815 | ||
|
816 | def repository(ui, path=None, create=0): | |
|
817 | if path and path[:5] == "hg://": | |
|
818 | return remoterepository(ui, path) | |
|
819 | else: | |
|
820 | return localrepository(ui, path, create) | |
|
821 | ||
|
790 | 822 | class ui: |
|
791 | 823 | def __init__(self, verbose=False, debug=False): |
|
792 | 824 | self.verbose = verbose |
General Comments 0
You need to be logged in to leave comments.
Login now