##// END OF EJS Templates
Adding changegroupsubset and lookup to ssh protocol so pull -r and...
Eric Hopper -
r3446:0b450267 default
parent child Browse files
Show More
@@ -131,6 +131,13 class sshrepository(remoterepository):
131 131 def unlock(self):
132 132 self.call("unlock")
133 133
134 def lookup(self, key):
135 d = self.call("lookup", key=key)
136 try:
137 return bin(d[:-1])
138 except:
139 raise hg.RepoError("unexpected response '%s'" % (d[:400] + "..."))
140
134 141 def heads(self):
135 142 d = self.call("heads")
136 143 try:
@@ -160,6 +167,11 class sshrepository(remoterepository):
160 167 n = " ".join(map(hex, nodes))
161 168 return self.do_cmd("changegroup", roots=n)
162 169
170 def changegroupsubset(self, bases, heads, kind):
171 bases = " ".join(map(hex, bases))
172 heads = " ".join(map(hex, heads))
173 return self.do_cmd("changegroupsubset", bases=bases, heads=heads)
174
163 175 def unbundle(self, cg, heads, source):
164 176 d = self.call("unbundle", heads=' '.join(map(hex, heads)))
165 177 if d:
@@ -48,6 +48,11 class sshserver(object):
48 48 else: self.respond("")
49 49 return cmd != ''
50 50
51 def do_lookup(self):
52 arg, key = self.getarg()
53 assert arg == 'key'
54 self.respond(hex(self.repo.lookup(key)) + "\n")
55
51 56 def do_heads(self):
52 57 h = self.repo.heads()
53 58 self.respond(" ".join(map(hex, h)) + "\n")
@@ -61,7 +66,7 class sshserver(object):
61 66 capabilities: space separated list of tokens
62 67 '''
63 68
64 caps = ['unbundle']
69 caps = ['unbundle', 'lookup', 'changegroupsubset']
65 70 if self.ui.configbool('server', 'uncompressed'):
66 71 caps.append('stream=%d' % self.repo.revlogversion)
67 72 self.respond("capabilities: %s\n" % (' '.join(caps),))
@@ -110,6 +115,22 class sshserver(object):
110 115
111 116 self.fout.flush()
112 117
118 def do_changegroupsubset(self):
119 bases = []
120 heads = []
121 argmap = dict([self.getarg(), self.getarg()])
122 bases = [bin(n) for n in argmap['bases'].split(' ')]
123 heads = [bin(n) for n in argmap['heads'].split(' ')]
124
125 cg = self.repo.changegroupsubset(bases, heads, 'serve')
126 while True:
127 d = cg.read(4096)
128 if not d:
129 break
130 self.fout.write(d)
131
132 self.fout.flush()
133
113 134 def do_addchangegroup(self):
114 135 '''DEPRECATED'''
115 136
General Comments 0
You need to be logged in to leave comments. Login now