Mercurial > public > mercurial-scm > hg
comparison mercurial/revlog.py @ 1981:736b6c96bbbc
make incoming work via ssh (issue139); move chunk code into separate module.
Incoming ssh needs to detect the end of the changegroup, otherwise it would
block trying to read from the ssh pipe. This is done by parsing the
changegroup chunks.
bundlerepo.getchunk() already is identical to
localrepo.addchangegroup.getchunk(), which is followed by getgroup which
looks much like what you can re-use in bundlerepository.__init__() and in
write_bundle(). bundlerevlog.__init__.genchunk() looks very similar, too,
as do some while loops in localrepo.py.
Applied patch from Benoit Boissinot to move duplicate/related code
to mercurial/changegroup.py and use this to fix incoming ssh.
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Tue, 21 Mar 2006 11:47:21 +0100 |
parents | 7518823709a2 |
children | 4aab906517c6 |
comparison
equal
deleted
inserted
replaced
1980:dfb796786337 | 1981:736b6c96bbbc |
---|---|
11 """ | 11 """ |
12 | 12 |
13 from node import * | 13 from node import * |
14 from i18n import gettext as _ | 14 from i18n import gettext as _ |
15 from demandload import demandload | 15 from demandload import demandload |
16 demandload(globals(), "binascii errno heapq mdiff os sha struct zlib") | 16 demandload(globals(), "binascii changegroup errno heapq mdiff os") |
17 demandload(globals(), "sha struct zlib") | |
17 | 18 |
18 def hash(text, p1, p2): | 19 def hash(text, p1, p2): |
19 """generate a hash from the given text and its parent hashes | 20 """generate a hash from the given text and its parent hashes |
20 | 21 |
21 This hash combines both the current file contents and its history | 22 This hash combines both the current file contents and its history |
706 """ | 707 """ |
707 revs = [self.rev(n) for n in nodelist] | 708 revs = [self.rev(n) for n in nodelist] |
708 | 709 |
709 # if we don't have any revisions touched by these changesets, bail | 710 # if we don't have any revisions touched by these changesets, bail |
710 if not revs: | 711 if not revs: |
711 yield struct.pack(">l", 0) | 712 yield changegroup.closechunk() |
712 return | 713 return |
713 | 714 |
714 # add the parent of the first rev | 715 # add the parent of the first rev |
715 p = self.parents(self.node(revs[0]))[0] | 716 p = self.parents(self.node(revs[0]))[0] |
716 revs.insert(0, self.rev(p)) | 717 revs.insert(0, self.rev(p)) |
724 infocollect(nb) | 725 infocollect(nb) |
725 | 726 |
726 d = self.revdiff(a, b) | 727 d = self.revdiff(a, b) |
727 p = self.parents(nb) | 728 p = self.parents(nb) |
728 meta = nb + p[0] + p[1] + lookup(nb) | 729 meta = nb + p[0] + p[1] + lookup(nb) |
729 l = struct.pack(">l", len(meta) + len(d) + 4) | 730 yield changegroup.genchunk("%s%s" % (meta, d)) |
730 yield l | 731 |
731 yield meta | 732 yield changegroup.closechunk() |
732 yield d | |
733 | |
734 yield struct.pack(">l", 0) | |
735 | 733 |
736 def addgroup(self, revs, linkmapper, transaction, unique=0): | 734 def addgroup(self, revs, linkmapper, transaction, unique=0): |
737 """ | 735 """ |
738 add a delta group | 736 add a delta group |
739 | 737 |