##// END OF EJS Templates
portability fix for test-ssh...
Alexis S. L. Carvalho -
r3380:8770b487 default
parent child Browse files
Show More
@@ -18,7 +18,7 b' class sshrepository(remoterepository):'
18
18
19 m = re.match(r'ssh://(([^@]+)@)?([^:/]+)(:(\d+))?(/(.*))?', path)
19 m = re.match(r'ssh://(([^@]+)@)?([^:/]+)(:(\d+))?(/(.*))?', path)
20 if not m:
20 if not m:
21 raise hg.RepoError(_("couldn't parse location %s") % path)
21 self.repoerror(_("couldn't parse location %s") % path)
22
22
23 self.user = m.group(2)
23 self.user = m.group(2)
24 self.host = m.group(3)
24 self.host = m.group(3)
@@ -38,7 +38,7 b' class sshrepository(remoterepository):'
38 ui.note('running %s\n' % cmd)
38 ui.note('running %s\n' % cmd)
39 res = os.system(cmd)
39 res = os.system(cmd)
40 if res != 0:
40 if res != 0:
41 raise hg.RepoError(_("could not create remote repo"))
41 self.repoerror(_("could not create remote repo"))
42
42
43 self.validate_repo(ui, sshcmd, args, remotecmd)
43 self.validate_repo(ui, sshcmd, args, remotecmd)
44
44
@@ -70,7 +70,7 b' class sshrepository(remoterepository):'
70 lines.append(l)
70 lines.append(l)
71 max_noise -= 1
71 max_noise -= 1
72 else:
72 else:
73 raise hg.RepoError(_("no suitable response from remote hg"))
73 self.repoerror(_("no suitable response from remote hg"))
74
74
75 self.capabilities = ()
75 self.capabilities = ()
76 lines.reverse()
76 lines.reverse()
@@ -87,6 +87,10 b' class sshrepository(remoterepository):'
87 if not l: break
87 if not l: break
88 self.ui.status(_("remote: "), l)
88 self.ui.status(_("remote: "), l)
89
89
90 def repoerror(self, msg):
91 self.cleanup()
92 raise hg.RepoError(msg)
93
90 def cleanup(self):
94 def cleanup(self):
91 try:
95 try:
92 self.pipeo.close()
96 self.pipeo.close()
@@ -117,7 +121,7 b' class sshrepository(remoterepository):'
117 try:
121 try:
118 l = int(l)
122 l = int(l)
119 except:
123 except:
120 raise hg.RepoError(_("unexpected response '%s'") % l)
124 self.repoerror(_("unexpected response '%s'") % l)
121 return r.read(l)
125 return r.read(l)
122
126
123 def lock(self):
127 def lock(self):
@@ -132,7 +136,7 b' class sshrepository(remoterepository):'
132 try:
136 try:
133 return map(bin, d[:-1].split(" "))
137 return map(bin, d[:-1].split(" "))
134 except:
138 except:
135 raise hg.RepoError(_("unexpected response '%s'") % (d[:400] + "..."))
139 self.repoerror(_("unexpected response '%s'") % (d[:400] + "..."))
136
140
137 def branches(self, nodes):
141 def branches(self, nodes):
138 n = " ".join(map(hex, nodes))
142 n = " ".join(map(hex, nodes))
@@ -141,7 +145,7 b' class sshrepository(remoterepository):'
141 br = [ tuple(map(bin, b.split(" "))) for b in d.splitlines() ]
145 br = [ tuple(map(bin, b.split(" "))) for b in d.splitlines() ]
142 return br
146 return br
143 except:
147 except:
144 raise hg.RepoError(_("unexpected response '%s'") % (d[:400] + "..."))
148 self.repoerror(_("unexpected response '%s'") % (d[:400] + "..."))
145
149
146 def between(self, pairs):
150 def between(self, pairs):
147 n = "\n".join(["-".join(map(hex, p)) for p in pairs])
151 n = "\n".join(["-".join(map(hex, p)) for p in pairs])
@@ -150,7 +154,7 b' class sshrepository(remoterepository):'
150 p = [ l and map(bin, l.split(" ")) or [] for l in d.splitlines() ]
154 p = [ l and map(bin, l.split(" ")) or [] for l in d.splitlines() ]
151 return p
155 return p
152 except:
156 except:
153 raise hg.RepoError(_("unexpected response '%s'") % (d[:400] + "..."))
157 self.repoerror(_("unexpected response '%s'") % (d[:400] + "..."))
154
158
155 def changegroup(self, nodes, kind):
159 def changegroup(self, nodes, kind):
156 n = " ".join(map(hex, nodes))
160 n = " ".join(map(hex, nodes))
@@ -159,7 +163,7 b' class sshrepository(remoterepository):'
159 def unbundle(self, cg, heads, source):
163 def unbundle(self, cg, heads, source):
160 d = self.call("unbundle", heads=' '.join(map(hex, heads)))
164 d = self.call("unbundle", heads=' '.join(map(hex, heads)))
161 if d:
165 if d:
162 raise hg.RepoError(_("push refused: %s") % d)
166 self.repoerror(_("push refused: %s") % d)
163
167
164 while 1:
168 while 1:
165 d = cg.read(4096)
169 d = cg.read(4096)
@@ -185,7 +189,7 b' class sshrepository(remoterepository):'
185 def addchangegroup(self, cg, source, url):
189 def addchangegroup(self, cg, source, url):
186 d = self.call("addchangegroup")
190 d = self.call("addchangegroup")
187 if d:
191 if d:
188 raise hg.RepoError(_("push refused: %s") % d)
192 self.repoerror(_("push refused: %s") % d)
189 while 1:
193 while 1:
190 d = cg.read(4096)
194 d = cg.read(4096)
191 if not d: break
195 if not d: break
@@ -1,7 +1,7 b''
1 # creating 'remote'
1 # creating 'remote'
2 # repo not found error
2 # repo not found error
3 remote: abort: repository nonexistent not found!
3 abort: no suitable response from remote hg!
4 abort: no suitable response from remote hg!
4 remote: abort: repository nonexistent not found!
5 # clone remote via stream
5 # clone remote via stream
6 streaming all changes
6 streaming all changes
7 XXX files to transfer, XXX bytes of data
7 XXX files to transfer, XXX bytes of data
General Comments 0
You need to be logged in to leave comments. Login now