##// END OF EJS Templates
bundle: encapsulate all bundle streams in unbundle class
Matt Mackall -
r12337:6a614948 default
parent child Browse files
Show More
@@ -1543,7 +1543,7 b' class localrepository(repo.repository):'
1543 if msng_cl_lst:
1543 if msng_cl_lst:
1544 self.hook('outgoing', node=hex(msng_cl_lst[0]), source=source)
1544 self.hook('outgoing', node=hex(msng_cl_lst[0]), source=source)
1545
1545
1546 return util.chunkbuffer(gengroup())
1546 return changegroup.unbundle10(util.chunkbuffer(gengroup()), 'UN')
1547
1547
1548 def changegroup(self, basenodes, source):
1548 def changegroup(self, basenodes, source):
1549 # to avoid a race we use changegroupsubset() (issue1320)
1549 # to avoid a race we use changegroupsubset() (issue1320)
@@ -1621,7 +1621,7 b' class localrepository(repo.repository):'
1621 if nodes:
1621 if nodes:
1622 self.hook('outgoing', node=hex(nodes[0]), source=source)
1622 self.hook('outgoing', node=hex(nodes[0]), source=source)
1623
1623
1624 return util.chunkbuffer(gengroup())
1624 return changegroup.unbundle10(util.chunkbuffer(gengroup()), 'UN')
1625
1625
1626 def addchangegroup(self, source, srctype, url, emptyok=False, lock=None):
1626 def addchangegroup(self, source, srctype, url, emptyok=False, lock=None):
1627 """Add the changegroup returned by source.read() to this repo.
1627 """Add the changegroup returned by source.read() to this repo.
@@ -1644,9 +1644,6 b' class localrepository(repo.repository):'
1644 if not source:
1644 if not source:
1645 return 0
1645 return 0
1646
1646
1647 if not hasattr(source, 'chunk'):
1648 source = changegroup.unbundle10(source, 'UN')
1649
1650 self.hook('prechangegroup', throw=True, source=srctype, url=url)
1647 self.hook('prechangegroup', throw=True, source=srctype, url=url)
1651
1648
1652 changesets = files = revisions = 0
1649 changesets = files = revisions = 0
@@ -6,7 +6,7 b''
6 # This software may be used and distributed according to the terms of the
6 # This software may be used and distributed according to the terms of the
7 # GNU General Public License version 2 or any later version.
7 # GNU General Public License version 2 or any later version.
8
8
9 import util, hook, wireproto
9 import util, hook, wireproto, changegroup
10 import os, sys
10 import os, sys
11
11
12 class sshserver(object):
12 class sshserver(object):
@@ -130,7 +130,8 b' class sshserver(object):'
130 return
130 return
131
131
132 self.sendresponse("")
132 self.sendresponse("")
133 r = self.repo.addchangegroup(self.fin, 'serve', self._client(),
133 cg = changegroup.unbundle10(self.fin, "UN")
134 r = self.repo.addchangegroup(cg, 'serve', self._client(),
134 lock=self.lock)
135 lock=self.lock)
135 return str(r)
136 return str(r)
136
137
@@ -102,14 +102,15 b' class wirerepository(repo.repository):'
102 def changegroup(self, nodes, kind):
102 def changegroup(self, nodes, kind):
103 n = encodelist(nodes)
103 n = encodelist(nodes)
104 f = self._callstream("changegroup", roots=n)
104 f = self._callstream("changegroup", roots=n)
105 return self._decompress(f)
105 return changegroupmod.unbundle10(self._decompress(f), 'UN')
106
106
107 def changegroupsubset(self, bases, heads, kind):
107 def changegroupsubset(self, bases, heads, kind):
108 self.requirecap('changegroupsubset', _('look up remote changes'))
108 self.requirecap('changegroupsubset', _('look up remote changes'))
109 bases = encodelist(bases)
109 bases = encodelist(bases)
110 heads = encodelist(heads)
110 heads = encodelist(heads)
111 return self._decompress(self._callstream("changegroupsubset",
111 f = self._callstream("changegroupsubset",
112 bases=bases, heads=heads))
112 bases=bases, heads=heads)
113 return changegroupmod.unbundle10(self._decompress(f), 'UN')
113
114
114 def unbundle(self, cg, heads, source):
115 def unbundle(self, cg, heads, source):
115 '''Send cg (a readable file-like object representing the
116 '''Send cg (a readable file-like object representing the
General Comments 0
You need to be logged in to leave comments. Login now