Show More
@@ -1,3079 +1,3079 b'' | |||||
1 | # debugcommands.py - command processing for debug* commands |
|
1 | # debugcommands.py - command processing for debug* commands | |
2 | # |
|
2 | # | |
3 | # Copyright 2005-2016 Matt Mackall <mpm@selenic.com> |
|
3 | # Copyright 2005-2016 Matt Mackall <mpm@selenic.com> | |
4 | # |
|
4 | # | |
5 | # This software may be used and distributed according to the terms of the |
|
5 | # This software may be used and distributed according to the terms of the | |
6 | # GNU General Public License version 2 or any later version. |
|
6 | # GNU General Public License version 2 or any later version. | |
7 |
|
7 | |||
8 | from __future__ import absolute_import |
|
8 | from __future__ import absolute_import | |
9 |
|
9 | |||
10 | import codecs |
|
10 | import codecs | |
11 | import collections |
|
11 | import collections | |
12 | import difflib |
|
12 | import difflib | |
13 | import errno |
|
13 | import errno | |
14 | import operator |
|
14 | import operator | |
15 | import os |
|
15 | import os | |
16 | import random |
|
16 | import random | |
17 | import re |
|
17 | import re | |
18 | import socket |
|
18 | import socket | |
19 | import ssl |
|
19 | import ssl | |
20 | import stat |
|
20 | import stat | |
21 | import string |
|
21 | import string | |
22 | import subprocess |
|
22 | import subprocess | |
23 | import sys |
|
23 | import sys | |
24 | import tempfile |
|
24 | import tempfile | |
25 | import time |
|
25 | import time | |
26 |
|
26 | |||
27 | from .i18n import _ |
|
27 | from .i18n import _ | |
28 | from .node import ( |
|
28 | from .node import ( | |
29 | bin, |
|
29 | bin, | |
30 | hex, |
|
30 | hex, | |
31 | nullhex, |
|
31 | nullhex, | |
32 | nullid, |
|
32 | nullid, | |
33 | nullrev, |
|
33 | nullrev, | |
34 | short, |
|
34 | short, | |
35 | ) |
|
35 | ) | |
36 | from . import ( |
|
36 | from . import ( | |
37 | bundle2, |
|
37 | bundle2, | |
38 | changegroup, |
|
38 | changegroup, | |
39 | cmdutil, |
|
39 | cmdutil, | |
40 | color, |
|
40 | color, | |
41 | context, |
|
41 | context, | |
42 | dagparser, |
|
42 | dagparser, | |
43 | dagutil, |
|
43 | dagutil, | |
44 | encoding, |
|
44 | encoding, | |
45 | error, |
|
45 | error, | |
46 | exchange, |
|
46 | exchange, | |
47 | extensions, |
|
47 | extensions, | |
48 | filemerge, |
|
48 | filemerge, | |
49 | fileset, |
|
49 | fileset, | |
50 | formatter, |
|
50 | formatter, | |
51 | hg, |
|
51 | hg, | |
52 | httppeer, |
|
52 | httppeer, | |
53 | localrepo, |
|
53 | localrepo, | |
54 | lock as lockmod, |
|
54 | lock as lockmod, | |
55 | logcmdutil, |
|
55 | logcmdutil, | |
56 | merge as mergemod, |
|
56 | merge as mergemod, | |
57 | obsolete, |
|
57 | obsolete, | |
58 | obsutil, |
|
58 | obsutil, | |
59 | phases, |
|
59 | phases, | |
60 | policy, |
|
60 | policy, | |
61 | pvec, |
|
61 | pvec, | |
62 | pycompat, |
|
62 | pycompat, | |
63 | registrar, |
|
63 | registrar, | |
64 | repair, |
|
64 | repair, | |
65 | revlog, |
|
65 | revlog, | |
66 | revset, |
|
66 | revset, | |
67 | revsetlang, |
|
67 | revsetlang, | |
68 | scmutil, |
|
68 | scmutil, | |
69 | setdiscovery, |
|
69 | setdiscovery, | |
70 | simplemerge, |
|
70 | simplemerge, | |
71 | smartset, |
|
71 | smartset, | |
72 | sshpeer, |
|
72 | sshpeer, | |
73 | sslutil, |
|
73 | sslutil, | |
74 | streamclone, |
|
74 | streamclone, | |
75 | templater, |
|
75 | templater, | |
76 | treediscovery, |
|
76 | treediscovery, | |
77 | upgrade, |
|
77 | upgrade, | |
78 | url as urlmod, |
|
78 | url as urlmod, | |
79 | util, |
|
79 | util, | |
80 | vfs as vfsmod, |
|
80 | vfs as vfsmod, | |
81 | wireprotoframing, |
|
81 | wireprotoframing, | |
82 | wireprotoserver, |
|
82 | wireprotoserver, | |
83 | ) |
|
83 | ) | |
84 | from .utils import ( |
|
84 | from .utils import ( | |
85 | dateutil, |
|
85 | dateutil, | |
86 | procutil, |
|
86 | procutil, | |
87 | stringutil, |
|
87 | stringutil, | |
88 | ) |
|
88 | ) | |
89 |
|
89 | |||
90 | release = lockmod.release |
|
90 | release = lockmod.release | |
91 |
|
91 | |||
92 | command = registrar.command() |
|
92 | command = registrar.command() | |
93 |
|
93 | |||
94 | @command('debugancestor', [], _('[INDEX] REV1 REV2'), optionalrepo=True) |
|
94 | @command('debugancestor', [], _('[INDEX] REV1 REV2'), optionalrepo=True) | |
95 | def debugancestor(ui, repo, *args): |
|
95 | def debugancestor(ui, repo, *args): | |
96 | """find the ancestor revision of two revisions in a given index""" |
|
96 | """find the ancestor revision of two revisions in a given index""" | |
97 | if len(args) == 3: |
|
97 | if len(args) == 3: | |
98 | index, rev1, rev2 = args |
|
98 | index, rev1, rev2 = args | |
99 | r = revlog.revlog(vfsmod.vfs(pycompat.getcwd(), audit=False), index) |
|
99 | r = revlog.revlog(vfsmod.vfs(pycompat.getcwd(), audit=False), index) | |
100 | lookup = r.lookup |
|
100 | lookup = r.lookup | |
101 | elif len(args) == 2: |
|
101 | elif len(args) == 2: | |
102 | if not repo: |
|
102 | if not repo: | |
103 | raise error.Abort(_('there is no Mercurial repository here ' |
|
103 | raise error.Abort(_('there is no Mercurial repository here ' | |
104 | '(.hg not found)')) |
|
104 | '(.hg not found)')) | |
105 | rev1, rev2 = args |
|
105 | rev1, rev2 = args | |
106 | r = repo.changelog |
|
106 | r = repo.changelog | |
107 | lookup = repo.lookup |
|
107 | lookup = repo.lookup | |
108 | else: |
|
108 | else: | |
109 | raise error.Abort(_('either two or three arguments required')) |
|
109 | raise error.Abort(_('either two or three arguments required')) | |
110 | a = r.ancestor(lookup(rev1), lookup(rev2)) |
|
110 | a = r.ancestor(lookup(rev1), lookup(rev2)) | |
111 | ui.write('%d:%s\n' % (r.rev(a), hex(a))) |
|
111 | ui.write('%d:%s\n' % (r.rev(a), hex(a))) | |
112 |
|
112 | |||
113 | @command('debugapplystreamclonebundle', [], 'FILE') |
|
113 | @command('debugapplystreamclonebundle', [], 'FILE') | |
114 | def debugapplystreamclonebundle(ui, repo, fname): |
|
114 | def debugapplystreamclonebundle(ui, repo, fname): | |
115 | """apply a stream clone bundle file""" |
|
115 | """apply a stream clone bundle file""" | |
116 | f = hg.openpath(ui, fname) |
|
116 | f = hg.openpath(ui, fname) | |
117 | gen = exchange.readbundle(ui, f, fname) |
|
117 | gen = exchange.readbundle(ui, f, fname) | |
118 | gen.apply(repo) |
|
118 | gen.apply(repo) | |
119 |
|
119 | |||
120 | @command('debugbuilddag', |
|
120 | @command('debugbuilddag', | |
121 | [('m', 'mergeable-file', None, _('add single file mergeable changes')), |
|
121 | [('m', 'mergeable-file', None, _('add single file mergeable changes')), | |
122 | ('o', 'overwritten-file', None, _('add single file all revs overwrite')), |
|
122 | ('o', 'overwritten-file', None, _('add single file all revs overwrite')), | |
123 | ('n', 'new-file', None, _('add new file at each rev'))], |
|
123 | ('n', 'new-file', None, _('add new file at each rev'))], | |
124 | _('[OPTION]... [TEXT]')) |
|
124 | _('[OPTION]... [TEXT]')) | |
125 | def debugbuilddag(ui, repo, text=None, |
|
125 | def debugbuilddag(ui, repo, text=None, | |
126 | mergeable_file=False, |
|
126 | mergeable_file=False, | |
127 | overwritten_file=False, |
|
127 | overwritten_file=False, | |
128 | new_file=False): |
|
128 | new_file=False): | |
129 | """builds a repo with a given DAG from scratch in the current empty repo |
|
129 | """builds a repo with a given DAG from scratch in the current empty repo | |
130 |
|
130 | |||
131 | The description of the DAG is read from stdin if not given on the |
|
131 | The description of the DAG is read from stdin if not given on the | |
132 | command line. |
|
132 | command line. | |
133 |
|
133 | |||
134 | Elements: |
|
134 | Elements: | |
135 |
|
135 | |||
136 | - "+n" is a linear run of n nodes based on the current default parent |
|
136 | - "+n" is a linear run of n nodes based on the current default parent | |
137 | - "." is a single node based on the current default parent |
|
137 | - "." is a single node based on the current default parent | |
138 | - "$" resets the default parent to null (implied at the start); |
|
138 | - "$" resets the default parent to null (implied at the start); | |
139 | otherwise the default parent is always the last node created |
|
139 | otherwise the default parent is always the last node created | |
140 | - "<p" sets the default parent to the backref p |
|
140 | - "<p" sets the default parent to the backref p | |
141 | - "*p" is a fork at parent p, which is a backref |
|
141 | - "*p" is a fork at parent p, which is a backref | |
142 | - "*p1/p2" is a merge of parents p1 and p2, which are backrefs |
|
142 | - "*p1/p2" is a merge of parents p1 and p2, which are backrefs | |
143 | - "/p2" is a merge of the preceding node and p2 |
|
143 | - "/p2" is a merge of the preceding node and p2 | |
144 | - ":tag" defines a local tag for the preceding node |
|
144 | - ":tag" defines a local tag for the preceding node | |
145 | - "@branch" sets the named branch for subsequent nodes |
|
145 | - "@branch" sets the named branch for subsequent nodes | |
146 | - "#...\\n" is a comment up to the end of the line |
|
146 | - "#...\\n" is a comment up to the end of the line | |
147 |
|
147 | |||
148 | Whitespace between the above elements is ignored. |
|
148 | Whitespace between the above elements is ignored. | |
149 |
|
149 | |||
150 | A backref is either |
|
150 | A backref is either | |
151 |
|
151 | |||
152 | - a number n, which references the node curr-n, where curr is the current |
|
152 | - a number n, which references the node curr-n, where curr is the current | |
153 | node, or |
|
153 | node, or | |
154 | - the name of a local tag you placed earlier using ":tag", or |
|
154 | - the name of a local tag you placed earlier using ":tag", or | |
155 | - empty to denote the default parent. |
|
155 | - empty to denote the default parent. | |
156 |
|
156 | |||
157 | All string valued-elements are either strictly alphanumeric, or must |
|
157 | All string valued-elements are either strictly alphanumeric, or must | |
158 | be enclosed in double quotes ("..."), with "\\" as escape character. |
|
158 | be enclosed in double quotes ("..."), with "\\" as escape character. | |
159 | """ |
|
159 | """ | |
160 |
|
160 | |||
161 | if text is None: |
|
161 | if text is None: | |
162 | ui.status(_("reading DAG from stdin\n")) |
|
162 | ui.status(_("reading DAG from stdin\n")) | |
163 | text = ui.fin.read() |
|
163 | text = ui.fin.read() | |
164 |
|
164 | |||
165 | cl = repo.changelog |
|
165 | cl = repo.changelog | |
166 | if len(cl) > 0: |
|
166 | if len(cl) > 0: | |
167 | raise error.Abort(_('repository is not empty')) |
|
167 | raise error.Abort(_('repository is not empty')) | |
168 |
|
168 | |||
169 | # determine number of revs in DAG |
|
169 | # determine number of revs in DAG | |
170 | total = 0 |
|
170 | total = 0 | |
171 | for type, data in dagparser.parsedag(text): |
|
171 | for type, data in dagparser.parsedag(text): | |
172 | if type == 'n': |
|
172 | if type == 'n': | |
173 | total += 1 |
|
173 | total += 1 | |
174 |
|
174 | |||
175 | if mergeable_file: |
|
175 | if mergeable_file: | |
176 | linesperrev = 2 |
|
176 | linesperrev = 2 | |
177 | # make a file with k lines per rev |
|
177 | # make a file with k lines per rev | |
178 | initialmergedlines = ['%d' % i for i in xrange(0, total * linesperrev)] |
|
178 | initialmergedlines = ['%d' % i for i in xrange(0, total * linesperrev)] | |
179 | initialmergedlines.append("") |
|
179 | initialmergedlines.append("") | |
180 |
|
180 | |||
181 | tags = [] |
|
181 | tags = [] | |
182 |
|
182 | |||
183 | wlock = lock = tr = None |
|
183 | wlock = lock = tr = None | |
184 | try: |
|
184 | try: | |
185 | wlock = repo.wlock() |
|
185 | wlock = repo.wlock() | |
186 | lock = repo.lock() |
|
186 | lock = repo.lock() | |
187 | tr = repo.transaction("builddag") |
|
187 | tr = repo.transaction("builddag") | |
188 |
|
188 | |||
189 | at = -1 |
|
189 | at = -1 | |
190 | atbranch = 'default' |
|
190 | atbranch = 'default' | |
191 | nodeids = [] |
|
191 | nodeids = [] | |
192 | id = 0 |
|
192 | id = 0 | |
193 | ui.progress(_('building'), id, unit=_('revisions'), total=total) |
|
193 | ui.progress(_('building'), id, unit=_('revisions'), total=total) | |
194 | for type, data in dagparser.parsedag(text): |
|
194 | for type, data in dagparser.parsedag(text): | |
195 | if type == 'n': |
|
195 | if type == 'n': | |
196 | ui.note(('node %s\n' % pycompat.bytestr(data))) |
|
196 | ui.note(('node %s\n' % pycompat.bytestr(data))) | |
197 | id, ps = data |
|
197 | id, ps = data | |
198 |
|
198 | |||
199 | files = [] |
|
199 | files = [] | |
200 | filecontent = {} |
|
200 | filecontent = {} | |
201 |
|
201 | |||
202 | p2 = None |
|
202 | p2 = None | |
203 | if mergeable_file: |
|
203 | if mergeable_file: | |
204 | fn = "mf" |
|
204 | fn = "mf" | |
205 | p1 = repo[ps[0]] |
|
205 | p1 = repo[ps[0]] | |
206 | if len(ps) > 1: |
|
206 | if len(ps) > 1: | |
207 | p2 = repo[ps[1]] |
|
207 | p2 = repo[ps[1]] | |
208 | pa = p1.ancestor(p2) |
|
208 | pa = p1.ancestor(p2) | |
209 | base, local, other = [x[fn].data() for x in (pa, p1, |
|
209 | base, local, other = [x[fn].data() for x in (pa, p1, | |
210 | p2)] |
|
210 | p2)] | |
211 | m3 = simplemerge.Merge3Text(base, local, other) |
|
211 | m3 = simplemerge.Merge3Text(base, local, other) | |
212 | ml = [l.strip() for l in m3.merge_lines()] |
|
212 | ml = [l.strip() for l in m3.merge_lines()] | |
213 | ml.append("") |
|
213 | ml.append("") | |
214 | elif at > 0: |
|
214 | elif at > 0: | |
215 | ml = p1[fn].data().split("\n") |
|
215 | ml = p1[fn].data().split("\n") | |
216 | else: |
|
216 | else: | |
217 | ml = initialmergedlines |
|
217 | ml = initialmergedlines | |
218 | ml[id * linesperrev] += " r%i" % id |
|
218 | ml[id * linesperrev] += " r%i" % id | |
219 | mergedtext = "\n".join(ml) |
|
219 | mergedtext = "\n".join(ml) | |
220 | files.append(fn) |
|
220 | files.append(fn) | |
221 | filecontent[fn] = mergedtext |
|
221 | filecontent[fn] = mergedtext | |
222 |
|
222 | |||
223 | if overwritten_file: |
|
223 | if overwritten_file: | |
224 | fn = "of" |
|
224 | fn = "of" | |
225 | files.append(fn) |
|
225 | files.append(fn) | |
226 | filecontent[fn] = "r%i\n" % id |
|
226 | filecontent[fn] = "r%i\n" % id | |
227 |
|
227 | |||
228 | if new_file: |
|
228 | if new_file: | |
229 | fn = "nf%i" % id |
|
229 | fn = "nf%i" % id | |
230 | files.append(fn) |
|
230 | files.append(fn) | |
231 | filecontent[fn] = "r%i\n" % id |
|
231 | filecontent[fn] = "r%i\n" % id | |
232 | if len(ps) > 1: |
|
232 | if len(ps) > 1: | |
233 | if not p2: |
|
233 | if not p2: | |
234 | p2 = repo[ps[1]] |
|
234 | p2 = repo[ps[1]] | |
235 | for fn in p2: |
|
235 | for fn in p2: | |
236 | if fn.startswith("nf"): |
|
236 | if fn.startswith("nf"): | |
237 | files.append(fn) |
|
237 | files.append(fn) | |
238 | filecontent[fn] = p2[fn].data() |
|
238 | filecontent[fn] = p2[fn].data() | |
239 |
|
239 | |||
240 | def fctxfn(repo, cx, path): |
|
240 | def fctxfn(repo, cx, path): | |
241 | if path in filecontent: |
|
241 | if path in filecontent: | |
242 | return context.memfilectx(repo, cx, path, |
|
242 | return context.memfilectx(repo, cx, path, | |
243 | filecontent[path]) |
|
243 | filecontent[path]) | |
244 | return None |
|
244 | return None | |
245 |
|
245 | |||
246 | if len(ps) == 0 or ps[0] < 0: |
|
246 | if len(ps) == 0 or ps[0] < 0: | |
247 | pars = [None, None] |
|
247 | pars = [None, None] | |
248 | elif len(ps) == 1: |
|
248 | elif len(ps) == 1: | |
249 | pars = [nodeids[ps[0]], None] |
|
249 | pars = [nodeids[ps[0]], None] | |
250 | else: |
|
250 | else: | |
251 | pars = [nodeids[p] for p in ps] |
|
251 | pars = [nodeids[p] for p in ps] | |
252 | cx = context.memctx(repo, pars, "r%i" % id, files, fctxfn, |
|
252 | cx = context.memctx(repo, pars, "r%i" % id, files, fctxfn, | |
253 | date=(id, 0), |
|
253 | date=(id, 0), | |
254 | user="debugbuilddag", |
|
254 | user="debugbuilddag", | |
255 | extra={'branch': atbranch}) |
|
255 | extra={'branch': atbranch}) | |
256 | nodeid = repo.commitctx(cx) |
|
256 | nodeid = repo.commitctx(cx) | |
257 | nodeids.append(nodeid) |
|
257 | nodeids.append(nodeid) | |
258 | at = id |
|
258 | at = id | |
259 | elif type == 'l': |
|
259 | elif type == 'l': | |
260 | id, name = data |
|
260 | id, name = data | |
261 | ui.note(('tag %s\n' % name)) |
|
261 | ui.note(('tag %s\n' % name)) | |
262 | tags.append("%s %s\n" % (hex(repo.changelog.node(id)), name)) |
|
262 | tags.append("%s %s\n" % (hex(repo.changelog.node(id)), name)) | |
263 | elif type == 'a': |
|
263 | elif type == 'a': | |
264 | ui.note(('branch %s\n' % data)) |
|
264 | ui.note(('branch %s\n' % data)) | |
265 | atbranch = data |
|
265 | atbranch = data | |
266 | ui.progress(_('building'), id, unit=_('revisions'), total=total) |
|
266 | ui.progress(_('building'), id, unit=_('revisions'), total=total) | |
267 | tr.close() |
|
267 | tr.close() | |
268 |
|
268 | |||
269 | if tags: |
|
269 | if tags: | |
270 | repo.vfs.write("localtags", "".join(tags)) |
|
270 | repo.vfs.write("localtags", "".join(tags)) | |
271 | finally: |
|
271 | finally: | |
272 | ui.progress(_('building'), None) |
|
272 | ui.progress(_('building'), None) | |
273 | release(tr, lock, wlock) |
|
273 | release(tr, lock, wlock) | |
274 |
|
274 | |||
275 | def _debugchangegroup(ui, gen, all=None, indent=0, **opts): |
|
275 | def _debugchangegroup(ui, gen, all=None, indent=0, **opts): | |
276 | indent_string = ' ' * indent |
|
276 | indent_string = ' ' * indent | |
277 | if all: |
|
277 | if all: | |
278 | ui.write(("%sformat: id, p1, p2, cset, delta base, len(delta)\n") |
|
278 | ui.write(("%sformat: id, p1, p2, cset, delta base, len(delta)\n") | |
279 | % indent_string) |
|
279 | % indent_string) | |
280 |
|
280 | |||
281 | def showchunks(named): |
|
281 | def showchunks(named): | |
282 | ui.write("\n%s%s\n" % (indent_string, named)) |
|
282 | ui.write("\n%s%s\n" % (indent_string, named)) | |
283 | for deltadata in gen.deltaiter(): |
|
283 | for deltadata in gen.deltaiter(): | |
284 | node, p1, p2, cs, deltabase, delta, flags = deltadata |
|
284 | node, p1, p2, cs, deltabase, delta, flags = deltadata | |
285 | ui.write("%s%s %s %s %s %s %d\n" % |
|
285 | ui.write("%s%s %s %s %s %s %d\n" % | |
286 | (indent_string, hex(node), hex(p1), hex(p2), |
|
286 | (indent_string, hex(node), hex(p1), hex(p2), | |
287 | hex(cs), hex(deltabase), len(delta))) |
|
287 | hex(cs), hex(deltabase), len(delta))) | |
288 |
|
288 | |||
289 | chunkdata = gen.changelogheader() |
|
289 | chunkdata = gen.changelogheader() | |
290 | showchunks("changelog") |
|
290 | showchunks("changelog") | |
291 | chunkdata = gen.manifestheader() |
|
291 | chunkdata = gen.manifestheader() | |
292 | showchunks("manifest") |
|
292 | showchunks("manifest") | |
293 | for chunkdata in iter(gen.filelogheader, {}): |
|
293 | for chunkdata in iter(gen.filelogheader, {}): | |
294 | fname = chunkdata['filename'] |
|
294 | fname = chunkdata['filename'] | |
295 | showchunks(fname) |
|
295 | showchunks(fname) | |
296 | else: |
|
296 | else: | |
297 | if isinstance(gen, bundle2.unbundle20): |
|
297 | if isinstance(gen, bundle2.unbundle20): | |
298 | raise error.Abort(_('use debugbundle2 for this file')) |
|
298 | raise error.Abort(_('use debugbundle2 for this file')) | |
299 | chunkdata = gen.changelogheader() |
|
299 | chunkdata = gen.changelogheader() | |
300 | for deltadata in gen.deltaiter(): |
|
300 | for deltadata in gen.deltaiter(): | |
301 | node, p1, p2, cs, deltabase, delta, flags = deltadata |
|
301 | node, p1, p2, cs, deltabase, delta, flags = deltadata | |
302 | ui.write("%s%s\n" % (indent_string, hex(node))) |
|
302 | ui.write("%s%s\n" % (indent_string, hex(node))) | |
303 |
|
303 | |||
304 | def _debugobsmarkers(ui, part, indent=0, **opts): |
|
304 | def _debugobsmarkers(ui, part, indent=0, **opts): | |
305 | """display version and markers contained in 'data'""" |
|
305 | """display version and markers contained in 'data'""" | |
306 | opts = pycompat.byteskwargs(opts) |
|
306 | opts = pycompat.byteskwargs(opts) | |
307 | data = part.read() |
|
307 | data = part.read() | |
308 | indent_string = ' ' * indent |
|
308 | indent_string = ' ' * indent | |
309 | try: |
|
309 | try: | |
310 | version, markers = obsolete._readmarkers(data) |
|
310 | version, markers = obsolete._readmarkers(data) | |
311 | except error.UnknownVersion as exc: |
|
311 | except error.UnknownVersion as exc: | |
312 | msg = "%sunsupported version: %s (%d bytes)\n" |
|
312 | msg = "%sunsupported version: %s (%d bytes)\n" | |
313 | msg %= indent_string, exc.version, len(data) |
|
313 | msg %= indent_string, exc.version, len(data) | |
314 | ui.write(msg) |
|
314 | ui.write(msg) | |
315 | else: |
|
315 | else: | |
316 | msg = "%sversion: %d (%d bytes)\n" |
|
316 | msg = "%sversion: %d (%d bytes)\n" | |
317 | msg %= indent_string, version, len(data) |
|
317 | msg %= indent_string, version, len(data) | |
318 | ui.write(msg) |
|
318 | ui.write(msg) | |
319 | fm = ui.formatter('debugobsolete', opts) |
|
319 | fm = ui.formatter('debugobsolete', opts) | |
320 | for rawmarker in sorted(markers): |
|
320 | for rawmarker in sorted(markers): | |
321 | m = obsutil.marker(None, rawmarker) |
|
321 | m = obsutil.marker(None, rawmarker) | |
322 | fm.startitem() |
|
322 | fm.startitem() | |
323 | fm.plain(indent_string) |
|
323 | fm.plain(indent_string) | |
324 | cmdutil.showmarker(fm, m) |
|
324 | cmdutil.showmarker(fm, m) | |
325 | fm.end() |
|
325 | fm.end() | |
326 |
|
326 | |||
327 | def _debugphaseheads(ui, data, indent=0): |
|
327 | def _debugphaseheads(ui, data, indent=0): | |
328 | """display version and markers contained in 'data'""" |
|
328 | """display version and markers contained in 'data'""" | |
329 | indent_string = ' ' * indent |
|
329 | indent_string = ' ' * indent | |
330 | headsbyphase = phases.binarydecode(data) |
|
330 | headsbyphase = phases.binarydecode(data) | |
331 | for phase in phases.allphases: |
|
331 | for phase in phases.allphases: | |
332 | for head in headsbyphase[phase]: |
|
332 | for head in headsbyphase[phase]: | |
333 | ui.write(indent_string) |
|
333 | ui.write(indent_string) | |
334 | ui.write('%s %s\n' % (hex(head), phases.phasenames[phase])) |
|
334 | ui.write('%s %s\n' % (hex(head), phases.phasenames[phase])) | |
335 |
|
335 | |||
336 | def _quasirepr(thing): |
|
336 | def _quasirepr(thing): | |
337 | if isinstance(thing, (dict, util.sortdict, collections.OrderedDict)): |
|
337 | if isinstance(thing, (dict, util.sortdict, collections.OrderedDict)): | |
338 | return '{%s}' % ( |
|
338 | return '{%s}' % ( | |
339 | b', '.join(b'%s: %s' % (k, thing[k]) for k in sorted(thing))) |
|
339 | b', '.join(b'%s: %s' % (k, thing[k]) for k in sorted(thing))) | |
340 | return pycompat.bytestr(repr(thing)) |
|
340 | return pycompat.bytestr(repr(thing)) | |
341 |
|
341 | |||
342 | def _debugbundle2(ui, gen, all=None, **opts): |
|
342 | def _debugbundle2(ui, gen, all=None, **opts): | |
343 | """lists the contents of a bundle2""" |
|
343 | """lists the contents of a bundle2""" | |
344 | if not isinstance(gen, bundle2.unbundle20): |
|
344 | if not isinstance(gen, bundle2.unbundle20): | |
345 | raise error.Abort(_('not a bundle2 file')) |
|
345 | raise error.Abort(_('not a bundle2 file')) | |
346 | ui.write(('Stream params: %s\n' % _quasirepr(gen.params))) |
|
346 | ui.write(('Stream params: %s\n' % _quasirepr(gen.params))) | |
347 | parttypes = opts.get(r'part_type', []) |
|
347 | parttypes = opts.get(r'part_type', []) | |
348 | for part in gen.iterparts(): |
|
348 | for part in gen.iterparts(): | |
349 | if parttypes and part.type not in parttypes: |
|
349 | if parttypes and part.type not in parttypes: | |
350 | continue |
|
350 | continue | |
351 | ui.write('%s -- %s\n' % (part.type, _quasirepr(part.params))) |
|
351 | ui.write('%s -- %s\n' % (part.type, _quasirepr(part.params))) | |
352 | if part.type == 'changegroup': |
|
352 | if part.type == 'changegroup': | |
353 | version = part.params.get('version', '01') |
|
353 | version = part.params.get('version', '01') | |
354 | cg = changegroup.getunbundler(version, part, 'UN') |
|
354 | cg = changegroup.getunbundler(version, part, 'UN') | |
355 | if not ui.quiet: |
|
355 | if not ui.quiet: | |
356 | _debugchangegroup(ui, cg, all=all, indent=4, **opts) |
|
356 | _debugchangegroup(ui, cg, all=all, indent=4, **opts) | |
357 | if part.type == 'obsmarkers': |
|
357 | if part.type == 'obsmarkers': | |
358 | if not ui.quiet: |
|
358 | if not ui.quiet: | |
359 | _debugobsmarkers(ui, part, indent=4, **opts) |
|
359 | _debugobsmarkers(ui, part, indent=4, **opts) | |
360 | if part.type == 'phase-heads': |
|
360 | if part.type == 'phase-heads': | |
361 | if not ui.quiet: |
|
361 | if not ui.quiet: | |
362 | _debugphaseheads(ui, part, indent=4) |
|
362 | _debugphaseheads(ui, part, indent=4) | |
363 |
|
363 | |||
364 | @command('debugbundle', |
|
364 | @command('debugbundle', | |
365 | [('a', 'all', None, _('show all details')), |
|
365 | [('a', 'all', None, _('show all details')), | |
366 | ('', 'part-type', [], _('show only the named part type')), |
|
366 | ('', 'part-type', [], _('show only the named part type')), | |
367 | ('', 'spec', None, _('print the bundlespec of the bundle'))], |
|
367 | ('', 'spec', None, _('print the bundlespec of the bundle'))], | |
368 | _('FILE'), |
|
368 | _('FILE'), | |
369 | norepo=True) |
|
369 | norepo=True) | |
370 | def debugbundle(ui, bundlepath, all=None, spec=None, **opts): |
|
370 | def debugbundle(ui, bundlepath, all=None, spec=None, **opts): | |
371 | """lists the contents of a bundle""" |
|
371 | """lists the contents of a bundle""" | |
372 | with hg.openpath(ui, bundlepath) as f: |
|
372 | with hg.openpath(ui, bundlepath) as f: | |
373 | if spec: |
|
373 | if spec: | |
374 | spec = exchange.getbundlespec(ui, f) |
|
374 | spec = exchange.getbundlespec(ui, f) | |
375 | ui.write('%s\n' % spec) |
|
375 | ui.write('%s\n' % spec) | |
376 | return |
|
376 | return | |
377 |
|
377 | |||
378 | gen = exchange.readbundle(ui, f, bundlepath) |
|
378 | gen = exchange.readbundle(ui, f, bundlepath) | |
379 | if isinstance(gen, bundle2.unbundle20): |
|
379 | if isinstance(gen, bundle2.unbundle20): | |
380 | return _debugbundle2(ui, gen, all=all, **opts) |
|
380 | return _debugbundle2(ui, gen, all=all, **opts) | |
381 | _debugchangegroup(ui, gen, all=all, **opts) |
|
381 | _debugchangegroup(ui, gen, all=all, **opts) | |
382 |
|
382 | |||
383 | @command('debugcapabilities', |
|
383 | @command('debugcapabilities', | |
384 | [], _('PATH'), |
|
384 | [], _('PATH'), | |
385 | norepo=True) |
|
385 | norepo=True) | |
386 | def debugcapabilities(ui, path, **opts): |
|
386 | def debugcapabilities(ui, path, **opts): | |
387 | """lists the capabilities of a remote peer""" |
|
387 | """lists the capabilities of a remote peer""" | |
388 | opts = pycompat.byteskwargs(opts) |
|
388 | opts = pycompat.byteskwargs(opts) | |
389 | peer = hg.peer(ui, opts, path) |
|
389 | peer = hg.peer(ui, opts, path) | |
390 | caps = peer.capabilities() |
|
390 | caps = peer.capabilities() | |
391 | ui.write(('Main capabilities:\n')) |
|
391 | ui.write(('Main capabilities:\n')) | |
392 | for c in sorted(caps): |
|
392 | for c in sorted(caps): | |
393 | ui.write((' %s\n') % c) |
|
393 | ui.write((' %s\n') % c) | |
394 | b2caps = bundle2.bundle2caps(peer) |
|
394 | b2caps = bundle2.bundle2caps(peer) | |
395 | if b2caps: |
|
395 | if b2caps: | |
396 | ui.write(('Bundle2 capabilities:\n')) |
|
396 | ui.write(('Bundle2 capabilities:\n')) | |
397 | for key, values in sorted(b2caps.iteritems()): |
|
397 | for key, values in sorted(b2caps.iteritems()): | |
398 | ui.write((' %s\n') % key) |
|
398 | ui.write((' %s\n') % key) | |
399 | for v in values: |
|
399 | for v in values: | |
400 | ui.write((' %s\n') % v) |
|
400 | ui.write((' %s\n') % v) | |
401 |
|
401 | |||
402 | @command('debugcheckstate', [], '') |
|
402 | @command('debugcheckstate', [], '') | |
403 | def debugcheckstate(ui, repo): |
|
403 | def debugcheckstate(ui, repo): | |
404 | """validate the correctness of the current dirstate""" |
|
404 | """validate the correctness of the current dirstate""" | |
405 | parent1, parent2 = repo.dirstate.parents() |
|
405 | parent1, parent2 = repo.dirstate.parents() | |
406 | m1 = repo[parent1].manifest() |
|
406 | m1 = repo[parent1].manifest() | |
407 | m2 = repo[parent2].manifest() |
|
407 | m2 = repo[parent2].manifest() | |
408 | errors = 0 |
|
408 | errors = 0 | |
409 | for f in repo.dirstate: |
|
409 | for f in repo.dirstate: | |
410 | state = repo.dirstate[f] |
|
410 | state = repo.dirstate[f] | |
411 | if state in "nr" and f not in m1: |
|
411 | if state in "nr" and f not in m1: | |
412 | ui.warn(_("%s in state %s, but not in manifest1\n") % (f, state)) |
|
412 | ui.warn(_("%s in state %s, but not in manifest1\n") % (f, state)) | |
413 | errors += 1 |
|
413 | errors += 1 | |
414 | if state in "a" and f in m1: |
|
414 | if state in "a" and f in m1: | |
415 | ui.warn(_("%s in state %s, but also in manifest1\n") % (f, state)) |
|
415 | ui.warn(_("%s in state %s, but also in manifest1\n") % (f, state)) | |
416 | errors += 1 |
|
416 | errors += 1 | |
417 | if state in "m" and f not in m1 and f not in m2: |
|
417 | if state in "m" and f not in m1 and f not in m2: | |
418 | ui.warn(_("%s in state %s, but not in either manifest\n") % |
|
418 | ui.warn(_("%s in state %s, but not in either manifest\n") % | |
419 | (f, state)) |
|
419 | (f, state)) | |
420 | errors += 1 |
|
420 | errors += 1 | |
421 | for f in m1: |
|
421 | for f in m1: | |
422 | state = repo.dirstate[f] |
|
422 | state = repo.dirstate[f] | |
423 | if state not in "nrm": |
|
423 | if state not in "nrm": | |
424 | ui.warn(_("%s in manifest1, but listed as state %s") % (f, state)) |
|
424 | ui.warn(_("%s in manifest1, but listed as state %s") % (f, state)) | |
425 | errors += 1 |
|
425 | errors += 1 | |
426 | if errors: |
|
426 | if errors: | |
427 | error = _(".hg/dirstate inconsistent with current parent's manifest") |
|
427 | error = _(".hg/dirstate inconsistent with current parent's manifest") | |
428 | raise error.Abort(error) |
|
428 | raise error.Abort(error) | |
429 |
|
429 | |||
430 | @command('debugcolor', |
|
430 | @command('debugcolor', | |
431 | [('', 'style', None, _('show all configured styles'))], |
|
431 | [('', 'style', None, _('show all configured styles'))], | |
432 | 'hg debugcolor') |
|
432 | 'hg debugcolor') | |
433 | def debugcolor(ui, repo, **opts): |
|
433 | def debugcolor(ui, repo, **opts): | |
434 | """show available color, effects or style""" |
|
434 | """show available color, effects or style""" | |
435 | ui.write(('color mode: %s\n') % ui._colormode) |
|
435 | ui.write(('color mode: %s\n') % ui._colormode) | |
436 | if opts.get(r'style'): |
|
436 | if opts.get(r'style'): | |
437 | return _debugdisplaystyle(ui) |
|
437 | return _debugdisplaystyle(ui) | |
438 | else: |
|
438 | else: | |
439 | return _debugdisplaycolor(ui) |
|
439 | return _debugdisplaycolor(ui) | |
440 |
|
440 | |||
441 | def _debugdisplaycolor(ui): |
|
441 | def _debugdisplaycolor(ui): | |
442 | ui = ui.copy() |
|
442 | ui = ui.copy() | |
443 | ui._styles.clear() |
|
443 | ui._styles.clear() | |
444 | for effect in color._activeeffects(ui).keys(): |
|
444 | for effect in color._activeeffects(ui).keys(): | |
445 | ui._styles[effect] = effect |
|
445 | ui._styles[effect] = effect | |
446 | if ui._terminfoparams: |
|
446 | if ui._terminfoparams: | |
447 | for k, v in ui.configitems('color'): |
|
447 | for k, v in ui.configitems('color'): | |
448 | if k.startswith('color.'): |
|
448 | if k.startswith('color.'): | |
449 | ui._styles[k] = k[6:] |
|
449 | ui._styles[k] = k[6:] | |
450 | elif k.startswith('terminfo.'): |
|
450 | elif k.startswith('terminfo.'): | |
451 | ui._styles[k] = k[9:] |
|
451 | ui._styles[k] = k[9:] | |
452 | ui.write(_('available colors:\n')) |
|
452 | ui.write(_('available colors:\n')) | |
453 | # sort label with a '_' after the other to group '_background' entry. |
|
453 | # sort label with a '_' after the other to group '_background' entry. | |
454 | items = sorted(ui._styles.items(), |
|
454 | items = sorted(ui._styles.items(), | |
455 | key=lambda i: ('_' in i[0], i[0], i[1])) |
|
455 | key=lambda i: ('_' in i[0], i[0], i[1])) | |
456 | for colorname, label in items: |
|
456 | for colorname, label in items: | |
457 | ui.write(('%s\n') % colorname, label=label) |
|
457 | ui.write(('%s\n') % colorname, label=label) | |
458 |
|
458 | |||
459 | def _debugdisplaystyle(ui): |
|
459 | def _debugdisplaystyle(ui): | |
460 | ui.write(_('available style:\n')) |
|
460 | ui.write(_('available style:\n')) | |
461 | width = max(len(s) for s in ui._styles) |
|
461 | width = max(len(s) for s in ui._styles) | |
462 | for label, effects in sorted(ui._styles.items()): |
|
462 | for label, effects in sorted(ui._styles.items()): | |
463 | ui.write('%s' % label, label=label) |
|
463 | ui.write('%s' % label, label=label) | |
464 | if effects: |
|
464 | if effects: | |
465 | # 50 |
|
465 | # 50 | |
466 | ui.write(': ') |
|
466 | ui.write(': ') | |
467 | ui.write(' ' * (max(0, width - len(label)))) |
|
467 | ui.write(' ' * (max(0, width - len(label)))) | |
468 | ui.write(', '.join(ui.label(e, e) for e in effects.split())) |
|
468 | ui.write(', '.join(ui.label(e, e) for e in effects.split())) | |
469 | ui.write('\n') |
|
469 | ui.write('\n') | |
470 |
|
470 | |||
471 | @command('debugcreatestreamclonebundle', [], 'FILE') |
|
471 | @command('debugcreatestreamclonebundle', [], 'FILE') | |
472 | def debugcreatestreamclonebundle(ui, repo, fname): |
|
472 | def debugcreatestreamclonebundle(ui, repo, fname): | |
473 | """create a stream clone bundle file |
|
473 | """create a stream clone bundle file | |
474 |
|
474 | |||
475 | Stream bundles are special bundles that are essentially archives of |
|
475 | Stream bundles are special bundles that are essentially archives of | |
476 | revlog files. They are commonly used for cloning very quickly. |
|
476 | revlog files. They are commonly used for cloning very quickly. | |
477 | """ |
|
477 | """ | |
478 | # TODO we may want to turn this into an abort when this functionality |
|
478 | # TODO we may want to turn this into an abort when this functionality | |
479 | # is moved into `hg bundle`. |
|
479 | # is moved into `hg bundle`. | |
480 | if phases.hassecret(repo): |
|
480 | if phases.hassecret(repo): | |
481 | ui.warn(_('(warning: stream clone bundle will contain secret ' |
|
481 | ui.warn(_('(warning: stream clone bundle will contain secret ' | |
482 | 'revisions)\n')) |
|
482 | 'revisions)\n')) | |
483 |
|
483 | |||
484 | requirements, gen = streamclone.generatebundlev1(repo) |
|
484 | requirements, gen = streamclone.generatebundlev1(repo) | |
485 | changegroup.writechunks(ui, gen, fname) |
|
485 | changegroup.writechunks(ui, gen, fname) | |
486 |
|
486 | |||
487 | ui.write(_('bundle requirements: %s\n') % ', '.join(sorted(requirements))) |
|
487 | ui.write(_('bundle requirements: %s\n') % ', '.join(sorted(requirements))) | |
488 |
|
488 | |||
489 | @command('debugdag', |
|
489 | @command('debugdag', | |
490 | [('t', 'tags', None, _('use tags as labels')), |
|
490 | [('t', 'tags', None, _('use tags as labels')), | |
491 | ('b', 'branches', None, _('annotate with branch names')), |
|
491 | ('b', 'branches', None, _('annotate with branch names')), | |
492 | ('', 'dots', None, _('use dots for runs')), |
|
492 | ('', 'dots', None, _('use dots for runs')), | |
493 | ('s', 'spaces', None, _('separate elements by spaces'))], |
|
493 | ('s', 'spaces', None, _('separate elements by spaces'))], | |
494 | _('[OPTION]... [FILE [REV]...]'), |
|
494 | _('[OPTION]... [FILE [REV]...]'), | |
495 | optionalrepo=True) |
|
495 | optionalrepo=True) | |
496 | def debugdag(ui, repo, file_=None, *revs, **opts): |
|
496 | def debugdag(ui, repo, file_=None, *revs, **opts): | |
497 | """format the changelog or an index DAG as a concise textual description |
|
497 | """format the changelog or an index DAG as a concise textual description | |
498 |
|
498 | |||
499 | If you pass a revlog index, the revlog's DAG is emitted. If you list |
|
499 | If you pass a revlog index, the revlog's DAG is emitted. If you list | |
500 | revision numbers, they get labeled in the output as rN. |
|
500 | revision numbers, they get labeled in the output as rN. | |
501 |
|
501 | |||
502 | Otherwise, the changelog DAG of the current repo is emitted. |
|
502 | Otherwise, the changelog DAG of the current repo is emitted. | |
503 | """ |
|
503 | """ | |
504 | spaces = opts.get(r'spaces') |
|
504 | spaces = opts.get(r'spaces') | |
505 | dots = opts.get(r'dots') |
|
505 | dots = opts.get(r'dots') | |
506 | if file_: |
|
506 | if file_: | |
507 | rlog = revlog.revlog(vfsmod.vfs(pycompat.getcwd(), audit=False), |
|
507 | rlog = revlog.revlog(vfsmod.vfs(pycompat.getcwd(), audit=False), | |
508 | file_) |
|
508 | file_) | |
509 | revs = set((int(r) for r in revs)) |
|
509 | revs = set((int(r) for r in revs)) | |
510 | def events(): |
|
510 | def events(): | |
511 | for r in rlog: |
|
511 | for r in rlog: | |
512 | yield 'n', (r, list(p for p in rlog.parentrevs(r) |
|
512 | yield 'n', (r, list(p for p in rlog.parentrevs(r) | |
513 | if p != -1)) |
|
513 | if p != -1)) | |
514 | if r in revs: |
|
514 | if r in revs: | |
515 | yield 'l', (r, "r%i" % r) |
|
515 | yield 'l', (r, "r%i" % r) | |
516 | elif repo: |
|
516 | elif repo: | |
517 | cl = repo.changelog |
|
517 | cl = repo.changelog | |
518 | tags = opts.get(r'tags') |
|
518 | tags = opts.get(r'tags') | |
519 | branches = opts.get(r'branches') |
|
519 | branches = opts.get(r'branches') | |
520 | if tags: |
|
520 | if tags: | |
521 | labels = {} |
|
521 | labels = {} | |
522 | for l, n in repo.tags().items(): |
|
522 | for l, n in repo.tags().items(): | |
523 | labels.setdefault(cl.rev(n), []).append(l) |
|
523 | labels.setdefault(cl.rev(n), []).append(l) | |
524 | def events(): |
|
524 | def events(): | |
525 | b = "default" |
|
525 | b = "default" | |
526 | for r in cl: |
|
526 | for r in cl: | |
527 | if branches: |
|
527 | if branches: | |
528 | newb = cl.read(cl.node(r))[5]['branch'] |
|
528 | newb = cl.read(cl.node(r))[5]['branch'] | |
529 | if newb != b: |
|
529 | if newb != b: | |
530 | yield 'a', newb |
|
530 | yield 'a', newb | |
531 | b = newb |
|
531 | b = newb | |
532 | yield 'n', (r, list(p for p in cl.parentrevs(r) |
|
532 | yield 'n', (r, list(p for p in cl.parentrevs(r) | |
533 | if p != -1)) |
|
533 | if p != -1)) | |
534 | if tags: |
|
534 | if tags: | |
535 | ls = labels.get(r) |
|
535 | ls = labels.get(r) | |
536 | if ls: |
|
536 | if ls: | |
537 | for l in ls: |
|
537 | for l in ls: | |
538 | yield 'l', (r, l) |
|
538 | yield 'l', (r, l) | |
539 | else: |
|
539 | else: | |
540 | raise error.Abort(_('need repo for changelog dag')) |
|
540 | raise error.Abort(_('need repo for changelog dag')) | |
541 |
|
541 | |||
542 | for line in dagparser.dagtextlines(events(), |
|
542 | for line in dagparser.dagtextlines(events(), | |
543 | addspaces=spaces, |
|
543 | addspaces=spaces, | |
544 | wraplabels=True, |
|
544 | wraplabels=True, | |
545 | wrapannotations=True, |
|
545 | wrapannotations=True, | |
546 | wrapnonlinear=dots, |
|
546 | wrapnonlinear=dots, | |
547 | usedots=dots, |
|
547 | usedots=dots, | |
548 | maxlinewidth=70): |
|
548 | maxlinewidth=70): | |
549 | ui.write(line) |
|
549 | ui.write(line) | |
550 | ui.write("\n") |
|
550 | ui.write("\n") | |
551 |
|
551 | |||
552 | @command('debugdata', cmdutil.debugrevlogopts, _('-c|-m|FILE REV')) |
|
552 | @command('debugdata', cmdutil.debugrevlogopts, _('-c|-m|FILE REV')) | |
553 | def debugdata(ui, repo, file_, rev=None, **opts): |
|
553 | def debugdata(ui, repo, file_, rev=None, **opts): | |
554 | """dump the contents of a data file revision""" |
|
554 | """dump the contents of a data file revision""" | |
555 | opts = pycompat.byteskwargs(opts) |
|
555 | opts = pycompat.byteskwargs(opts) | |
556 | if opts.get('changelog') or opts.get('manifest') or opts.get('dir'): |
|
556 | if opts.get('changelog') or opts.get('manifest') or opts.get('dir'): | |
557 | if rev is not None: |
|
557 | if rev is not None: | |
558 | raise error.CommandError('debugdata', _('invalid arguments')) |
|
558 | raise error.CommandError('debugdata', _('invalid arguments')) | |
559 | file_, rev = None, file_ |
|
559 | file_, rev = None, file_ | |
560 | elif rev is None: |
|
560 | elif rev is None: | |
561 | raise error.CommandError('debugdata', _('invalid arguments')) |
|
561 | raise error.CommandError('debugdata', _('invalid arguments')) | |
562 | r = cmdutil.openrevlog(repo, 'debugdata', file_, opts) |
|
562 | r = cmdutil.openrevlog(repo, 'debugdata', file_, opts) | |
563 | try: |
|
563 | try: | |
564 | ui.write(r.revision(r.lookup(rev), raw=True)) |
|
564 | ui.write(r.revision(r.lookup(rev), raw=True)) | |
565 | except KeyError: |
|
565 | except KeyError: | |
566 | raise error.Abort(_('invalid revision identifier %s') % rev) |
|
566 | raise error.Abort(_('invalid revision identifier %s') % rev) | |
567 |
|
567 | |||
568 | @command('debugdate', |
|
568 | @command('debugdate', | |
569 | [('e', 'extended', None, _('try extended date formats'))], |
|
569 | [('e', 'extended', None, _('try extended date formats'))], | |
570 | _('[-e] DATE [RANGE]'), |
|
570 | _('[-e] DATE [RANGE]'), | |
571 | norepo=True, optionalrepo=True) |
|
571 | norepo=True, optionalrepo=True) | |
572 | def debugdate(ui, date, range=None, **opts): |
|
572 | def debugdate(ui, date, range=None, **opts): | |
573 | """parse and display a date""" |
|
573 | """parse and display a date""" | |
574 | if opts[r"extended"]: |
|
574 | if opts[r"extended"]: | |
575 | d = dateutil.parsedate(date, util.extendeddateformats) |
|
575 | d = dateutil.parsedate(date, util.extendeddateformats) | |
576 | else: |
|
576 | else: | |
577 | d = dateutil.parsedate(date) |
|
577 | d = dateutil.parsedate(date) | |
578 | ui.write(("internal: %d %d\n") % d) |
|
578 | ui.write(("internal: %d %d\n") % d) | |
579 | ui.write(("standard: %s\n") % dateutil.datestr(d)) |
|
579 | ui.write(("standard: %s\n") % dateutil.datestr(d)) | |
580 | if range: |
|
580 | if range: | |
581 | m = dateutil.matchdate(range) |
|
581 | m = dateutil.matchdate(range) | |
582 | ui.write(("match: %s\n") % m(d[0])) |
|
582 | ui.write(("match: %s\n") % m(d[0])) | |
583 |
|
583 | |||
584 | @command('debugdeltachain', |
|
584 | @command('debugdeltachain', | |
585 | cmdutil.debugrevlogopts + cmdutil.formatteropts, |
|
585 | cmdutil.debugrevlogopts + cmdutil.formatteropts, | |
586 | _('-c|-m|FILE'), |
|
586 | _('-c|-m|FILE'), | |
587 | optionalrepo=True) |
|
587 | optionalrepo=True) | |
588 | def debugdeltachain(ui, repo, file_=None, **opts): |
|
588 | def debugdeltachain(ui, repo, file_=None, **opts): | |
589 | """dump information about delta chains in a revlog |
|
589 | """dump information about delta chains in a revlog | |
590 |
|
590 | |||
591 | Output can be templatized. Available template keywords are: |
|
591 | Output can be templatized. Available template keywords are: | |
592 |
|
592 | |||
593 | :``rev``: revision number |
|
593 | :``rev``: revision number | |
594 | :``chainid``: delta chain identifier (numbered by unique base) |
|
594 | :``chainid``: delta chain identifier (numbered by unique base) | |
595 | :``chainlen``: delta chain length to this revision |
|
595 | :``chainlen``: delta chain length to this revision | |
596 | :``prevrev``: previous revision in delta chain |
|
596 | :``prevrev``: previous revision in delta chain | |
597 | :``deltatype``: role of delta / how it was computed |
|
597 | :``deltatype``: role of delta / how it was computed | |
598 | :``compsize``: compressed size of revision |
|
598 | :``compsize``: compressed size of revision | |
599 | :``uncompsize``: uncompressed size of revision |
|
599 | :``uncompsize``: uncompressed size of revision | |
600 | :``chainsize``: total size of compressed revisions in chain |
|
600 | :``chainsize``: total size of compressed revisions in chain | |
601 | :``chainratio``: total chain size divided by uncompressed revision size |
|
601 | :``chainratio``: total chain size divided by uncompressed revision size | |
602 | (new delta chains typically start at ratio 2.00) |
|
602 | (new delta chains typically start at ratio 2.00) | |
603 | :``lindist``: linear distance from base revision in delta chain to end |
|
603 | :``lindist``: linear distance from base revision in delta chain to end | |
604 | of this revision |
|
604 | of this revision | |
605 | :``extradist``: total size of revisions not part of this delta chain from |
|
605 | :``extradist``: total size of revisions not part of this delta chain from | |
606 | base of delta chain to end of this revision; a measurement |
|
606 | base of delta chain to end of this revision; a measurement | |
607 | of how much extra data we need to read/seek across to read |
|
607 | of how much extra data we need to read/seek across to read | |
608 | the delta chain for this revision |
|
608 | the delta chain for this revision | |
609 | :``extraratio``: extradist divided by chainsize; another representation of |
|
609 | :``extraratio``: extradist divided by chainsize; another representation of | |
610 | how much unrelated data is needed to load this delta chain |
|
610 | how much unrelated data is needed to load this delta chain | |
611 |
|
611 | |||
612 | If the repository is configured to use the sparse read, additional keywords |
|
612 | If the repository is configured to use the sparse read, additional keywords | |
613 | are available: |
|
613 | are available: | |
614 |
|
614 | |||
615 | :``readsize``: total size of data read from the disk for a revision |
|
615 | :``readsize``: total size of data read from the disk for a revision | |
616 | (sum of the sizes of all the blocks) |
|
616 | (sum of the sizes of all the blocks) | |
617 | :``largestblock``: size of the largest block of data read from the disk |
|
617 | :``largestblock``: size of the largest block of data read from the disk | |
618 | :``readdensity``: density of useful bytes in the data read from the disk |
|
618 | :``readdensity``: density of useful bytes in the data read from the disk | |
619 | :``srchunks``: in how many data hunks the whole revision would be read |
|
619 | :``srchunks``: in how many data hunks the whole revision would be read | |
620 |
|
620 | |||
621 | The sparse read can be enabled with experimental.sparse-read = True |
|
621 | The sparse read can be enabled with experimental.sparse-read = True | |
622 | """ |
|
622 | """ | |
623 | opts = pycompat.byteskwargs(opts) |
|
623 | opts = pycompat.byteskwargs(opts) | |
624 | r = cmdutil.openrevlog(repo, 'debugdeltachain', file_, opts) |
|
624 | r = cmdutil.openrevlog(repo, 'debugdeltachain', file_, opts) | |
625 | index = r.index |
|
625 | index = r.index | |
626 | generaldelta = r.version & revlog.FLAG_GENERALDELTA |
|
626 | generaldelta = r.version & revlog.FLAG_GENERALDELTA | |
627 | withsparseread = getattr(r, '_withsparseread', False) |
|
627 | withsparseread = getattr(r, '_withsparseread', False) | |
628 |
|
628 | |||
629 | def revinfo(rev): |
|
629 | def revinfo(rev): | |
630 | e = index[rev] |
|
630 | e = index[rev] | |
631 | compsize = e[1] |
|
631 | compsize = e[1] | |
632 | uncompsize = e[2] |
|
632 | uncompsize = e[2] | |
633 | chainsize = 0 |
|
633 | chainsize = 0 | |
634 |
|
634 | |||
635 | if generaldelta: |
|
635 | if generaldelta: | |
636 | if e[3] == e[5]: |
|
636 | if e[3] == e[5]: | |
637 | deltatype = 'p1' |
|
637 | deltatype = 'p1' | |
638 | elif e[3] == e[6]: |
|
638 | elif e[3] == e[6]: | |
639 | deltatype = 'p2' |
|
639 | deltatype = 'p2' | |
640 | elif e[3] == rev - 1: |
|
640 | elif e[3] == rev - 1: | |
641 | deltatype = 'prev' |
|
641 | deltatype = 'prev' | |
642 | elif e[3] == rev: |
|
642 | elif e[3] == rev: | |
643 | deltatype = 'base' |
|
643 | deltatype = 'base' | |
644 | else: |
|
644 | else: | |
645 | deltatype = 'other' |
|
645 | deltatype = 'other' | |
646 | else: |
|
646 | else: | |
647 | if e[3] == rev: |
|
647 | if e[3] == rev: | |
648 | deltatype = 'base' |
|
648 | deltatype = 'base' | |
649 | else: |
|
649 | else: | |
650 | deltatype = 'prev' |
|
650 | deltatype = 'prev' | |
651 |
|
651 | |||
652 | chain = r._deltachain(rev)[0] |
|
652 | chain = r._deltachain(rev)[0] | |
653 | for iterrev in chain: |
|
653 | for iterrev in chain: | |
654 | e = index[iterrev] |
|
654 | e = index[iterrev] | |
655 | chainsize += e[1] |
|
655 | chainsize += e[1] | |
656 |
|
656 | |||
657 | return compsize, uncompsize, deltatype, chain, chainsize |
|
657 | return compsize, uncompsize, deltatype, chain, chainsize | |
658 |
|
658 | |||
659 | fm = ui.formatter('debugdeltachain', opts) |
|
659 | fm = ui.formatter('debugdeltachain', opts) | |
660 |
|
660 | |||
661 | fm.plain(' rev chain# chainlen prev delta ' |
|
661 | fm.plain(' rev chain# chainlen prev delta ' | |
662 | 'size rawsize chainsize ratio lindist extradist ' |
|
662 | 'size rawsize chainsize ratio lindist extradist ' | |
663 | 'extraratio') |
|
663 | 'extraratio') | |
664 | if withsparseread: |
|
664 | if withsparseread: | |
665 | fm.plain(' readsize largestblk rddensity srchunks') |
|
665 | fm.plain(' readsize largestblk rddensity srchunks') | |
666 | fm.plain('\n') |
|
666 | fm.plain('\n') | |
667 |
|
667 | |||
668 | chainbases = {} |
|
668 | chainbases = {} | |
669 | for rev in r: |
|
669 | for rev in r: | |
670 | comp, uncomp, deltatype, chain, chainsize = revinfo(rev) |
|
670 | comp, uncomp, deltatype, chain, chainsize = revinfo(rev) | |
671 | chainbase = chain[0] |
|
671 | chainbase = chain[0] | |
672 | chainid = chainbases.setdefault(chainbase, len(chainbases) + 1) |
|
672 | chainid = chainbases.setdefault(chainbase, len(chainbases) + 1) | |
673 | start = r.start |
|
673 | start = r.start | |
674 | length = r.length |
|
674 | length = r.length | |
675 | basestart = start(chainbase) |
|
675 | basestart = start(chainbase) | |
676 | revstart = start(rev) |
|
676 | revstart = start(rev) | |
677 | lineardist = revstart + comp - basestart |
|
677 | lineardist = revstart + comp - basestart | |
678 | extradist = lineardist - chainsize |
|
678 | extradist = lineardist - chainsize | |
679 | try: |
|
679 | try: | |
680 | prevrev = chain[-2] |
|
680 | prevrev = chain[-2] | |
681 | except IndexError: |
|
681 | except IndexError: | |
682 | prevrev = -1 |
|
682 | prevrev = -1 | |
683 |
|
683 | |||
684 | chainratio = float(chainsize) / float(uncomp) |
|
684 | chainratio = float(chainsize) / float(uncomp) | |
685 | extraratio = float(extradist) / float(chainsize) |
|
685 | extraratio = float(extradist) / float(chainsize) | |
686 |
|
686 | |||
687 | fm.startitem() |
|
687 | fm.startitem() | |
688 | fm.write('rev chainid chainlen prevrev deltatype compsize ' |
|
688 | fm.write('rev chainid chainlen prevrev deltatype compsize ' | |
689 | 'uncompsize chainsize chainratio lindist extradist ' |
|
689 | 'uncompsize chainsize chainratio lindist extradist ' | |
690 | 'extraratio', |
|
690 | 'extraratio', | |
691 | '%7d %7d %8d %8d %7s %10d %10d %10d %9.5f %9d %9d %10.5f', |
|
691 | '%7d %7d %8d %8d %7s %10d %10d %10d %9.5f %9d %9d %10.5f', | |
692 | rev, chainid, len(chain), prevrev, deltatype, comp, |
|
692 | rev, chainid, len(chain), prevrev, deltatype, comp, | |
693 | uncomp, chainsize, chainratio, lineardist, extradist, |
|
693 | uncomp, chainsize, chainratio, lineardist, extradist, | |
694 | extraratio, |
|
694 | extraratio, | |
695 | rev=rev, chainid=chainid, chainlen=len(chain), |
|
695 | rev=rev, chainid=chainid, chainlen=len(chain), | |
696 | prevrev=prevrev, deltatype=deltatype, compsize=comp, |
|
696 | prevrev=prevrev, deltatype=deltatype, compsize=comp, | |
697 | uncompsize=uncomp, chainsize=chainsize, |
|
697 | uncompsize=uncomp, chainsize=chainsize, | |
698 | chainratio=chainratio, lindist=lineardist, |
|
698 | chainratio=chainratio, lindist=lineardist, | |
699 | extradist=extradist, extraratio=extraratio) |
|
699 | extradist=extradist, extraratio=extraratio) | |
700 | if withsparseread: |
|
700 | if withsparseread: | |
701 | readsize = 0 |
|
701 | readsize = 0 | |
702 | largestblock = 0 |
|
702 | largestblock = 0 | |
703 | srchunks = 0 |
|
703 | srchunks = 0 | |
704 |
|
704 | |||
705 | for revschunk in revlog._slicechunk(r, chain): |
|
705 | for revschunk in revlog._slicechunk(r, chain): | |
706 | srchunks += 1 |
|
706 | srchunks += 1 | |
707 | blkend = start(revschunk[-1]) + length(revschunk[-1]) |
|
707 | blkend = start(revschunk[-1]) + length(revschunk[-1]) | |
708 | blksize = blkend - start(revschunk[0]) |
|
708 | blksize = blkend - start(revschunk[0]) | |
709 |
|
709 | |||
710 | readsize += blksize |
|
710 | readsize += blksize | |
711 | if largestblock < blksize: |
|
711 | if largestblock < blksize: | |
712 | largestblock = blksize |
|
712 | largestblock = blksize | |
713 |
|
713 | |||
714 | readdensity = float(chainsize) / float(readsize) |
|
714 | readdensity = float(chainsize) / float(readsize) | |
715 |
|
715 | |||
716 | fm.write('readsize largestblock readdensity srchunks', |
|
716 | fm.write('readsize largestblock readdensity srchunks', | |
717 | ' %10d %10d %9.5f %8d', |
|
717 | ' %10d %10d %9.5f %8d', | |
718 | readsize, largestblock, readdensity, srchunks, |
|
718 | readsize, largestblock, readdensity, srchunks, | |
719 | readsize=readsize, largestblock=largestblock, |
|
719 | readsize=readsize, largestblock=largestblock, | |
720 | readdensity=readdensity, srchunks=srchunks) |
|
720 | readdensity=readdensity, srchunks=srchunks) | |
721 |
|
721 | |||
722 | fm.plain('\n') |
|
722 | fm.plain('\n') | |
723 |
|
723 | |||
724 | fm.end() |
|
724 | fm.end() | |
725 |
|
725 | |||
726 | @command('debugdirstate|debugstate', |
|
726 | @command('debugdirstate|debugstate', | |
727 | [('', 'nodates', None, _('do not display the saved mtime')), |
|
727 | [('', 'nodates', None, _('do not display the saved mtime')), | |
728 | ('', 'datesort', None, _('sort by saved mtime'))], |
|
728 | ('', 'datesort', None, _('sort by saved mtime'))], | |
729 | _('[OPTION]...')) |
|
729 | _('[OPTION]...')) | |
730 | def debugstate(ui, repo, **opts): |
|
730 | def debugstate(ui, repo, **opts): | |
731 | """show the contents of the current dirstate""" |
|
731 | """show the contents of the current dirstate""" | |
732 |
|
732 | |||
733 | nodates = opts.get(r'nodates') |
|
733 | nodates = opts.get(r'nodates') | |
734 | datesort = opts.get(r'datesort') |
|
734 | datesort = opts.get(r'datesort') | |
735 |
|
735 | |||
736 | timestr = "" |
|
736 | timestr = "" | |
737 | if datesort: |
|
737 | if datesort: | |
738 | keyfunc = lambda x: (x[1][3], x[0]) # sort by mtime, then by filename |
|
738 | keyfunc = lambda x: (x[1][3], x[0]) # sort by mtime, then by filename | |
739 | else: |
|
739 | else: | |
740 | keyfunc = None # sort by filename |
|
740 | keyfunc = None # sort by filename | |
741 | for file_, ent in sorted(repo.dirstate._map.iteritems(), key=keyfunc): |
|
741 | for file_, ent in sorted(repo.dirstate._map.iteritems(), key=keyfunc): | |
742 | if ent[3] == -1: |
|
742 | if ent[3] == -1: | |
743 | timestr = 'unset ' |
|
743 | timestr = 'unset ' | |
744 | elif nodates: |
|
744 | elif nodates: | |
745 | timestr = 'set ' |
|
745 | timestr = 'set ' | |
746 | else: |
|
746 | else: | |
747 | timestr = time.strftime(r"%Y-%m-%d %H:%M:%S ", |
|
747 | timestr = time.strftime(r"%Y-%m-%d %H:%M:%S ", | |
748 | time.localtime(ent[3])) |
|
748 | time.localtime(ent[3])) | |
749 | timestr = encoding.strtolocal(timestr) |
|
749 | timestr = encoding.strtolocal(timestr) | |
750 | if ent[1] & 0o20000: |
|
750 | if ent[1] & 0o20000: | |
751 | mode = 'lnk' |
|
751 | mode = 'lnk' | |
752 | else: |
|
752 | else: | |
753 | mode = '%3o' % (ent[1] & 0o777 & ~util.umask) |
|
753 | mode = '%3o' % (ent[1] & 0o777 & ~util.umask) | |
754 | ui.write("%c %s %10d %s%s\n" % (ent[0], mode, ent[2], timestr, file_)) |
|
754 | ui.write("%c %s %10d %s%s\n" % (ent[0], mode, ent[2], timestr, file_)) | |
755 | for f in repo.dirstate.copies(): |
|
755 | for f in repo.dirstate.copies(): | |
756 | ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copied(f), f)) |
|
756 | ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copied(f), f)) | |
757 |
|
757 | |||
758 | @command('debugdiscovery', |
|
758 | @command('debugdiscovery', | |
759 | [('', 'old', None, _('use old-style discovery')), |
|
759 | [('', 'old', None, _('use old-style discovery')), | |
760 | ('', 'nonheads', None, |
|
760 | ('', 'nonheads', None, | |
761 | _('use old-style discovery with non-heads included')), |
|
761 | _('use old-style discovery with non-heads included')), | |
762 | ('', 'rev', [], 'restrict discovery to this set of revs'), |
|
762 | ('', 'rev', [], 'restrict discovery to this set of revs'), | |
763 | ] + cmdutil.remoteopts, |
|
763 | ] + cmdutil.remoteopts, | |
764 | _('[--rev REV] [OTHER]')) |
|
764 | _('[--rev REV] [OTHER]')) | |
765 | def debugdiscovery(ui, repo, remoteurl="default", **opts): |
|
765 | def debugdiscovery(ui, repo, remoteurl="default", **opts): | |
766 | """runs the changeset discovery protocol in isolation""" |
|
766 | """runs the changeset discovery protocol in isolation""" | |
767 | opts = pycompat.byteskwargs(opts) |
|
767 | opts = pycompat.byteskwargs(opts) | |
768 | remoteurl, branches = hg.parseurl(ui.expandpath(remoteurl)) |
|
768 | remoteurl, branches = hg.parseurl(ui.expandpath(remoteurl)) | |
769 | remote = hg.peer(repo, opts, remoteurl) |
|
769 | remote = hg.peer(repo, opts, remoteurl) | |
770 | ui.status(_('comparing with %s\n') % util.hidepassword(remoteurl)) |
|
770 | ui.status(_('comparing with %s\n') % util.hidepassword(remoteurl)) | |
771 |
|
771 | |||
772 | # make sure tests are repeatable |
|
772 | # make sure tests are repeatable | |
773 | random.seed(12323) |
|
773 | random.seed(12323) | |
774 |
|
774 | |||
775 | def doit(pushedrevs, remoteheads, remote=remote): |
|
775 | def doit(pushedrevs, remoteheads, remote=remote): | |
776 | if opts.get('old'): |
|
776 | if opts.get('old'): | |
777 | if not util.safehasattr(remote, 'branches'): |
|
777 | if not util.safehasattr(remote, 'branches'): | |
778 | # enable in-client legacy support |
|
778 | # enable in-client legacy support | |
779 | remote = localrepo.locallegacypeer(remote.local()) |
|
779 | remote = localrepo.locallegacypeer(remote.local()) | |
780 | common, _in, hds = treediscovery.findcommonincoming(repo, remote, |
|
780 | common, _in, hds = treediscovery.findcommonincoming(repo, remote, | |
781 | force=True) |
|
781 | force=True) | |
782 | common = set(common) |
|
782 | common = set(common) | |
783 | if not opts.get('nonheads'): |
|
783 | if not opts.get('nonheads'): | |
784 | ui.write(("unpruned common: %s\n") % |
|
784 | ui.write(("unpruned common: %s\n") % | |
785 | " ".join(sorted(short(n) for n in common))) |
|
785 | " ".join(sorted(short(n) for n in common))) | |
786 | dag = dagutil.revlogdag(repo.changelog) |
|
786 | dag = dagutil.revlogdag(repo.changelog) | |
787 | all = dag.ancestorset(dag.internalizeall(common)) |
|
787 | all = dag.ancestorset(dag.internalizeall(common)) | |
788 | common = dag.externalizeall(dag.headsetofconnecteds(all)) |
|
788 | common = dag.externalizeall(dag.headsetofconnecteds(all)) | |
789 | else: |
|
789 | else: | |
790 | nodes = None |
|
790 | nodes = None | |
791 | if pushedrevs: |
|
791 | if pushedrevs: | |
792 | revs = scmutil.revrange(repo, pushedrevs) |
|
792 | revs = scmutil.revrange(repo, pushedrevs) | |
793 | nodes = [repo[r].node() for r in revs] |
|
793 | nodes = [repo[r].node() for r in revs] | |
794 | common, any, hds = setdiscovery.findcommonheads(ui, repo, remote, |
|
794 | common, any, hds = setdiscovery.findcommonheads(ui, repo, remote, | |
795 | ancestorsof=nodes) |
|
795 | ancestorsof=nodes) | |
796 | common = set(common) |
|
796 | common = set(common) | |
797 | rheads = set(hds) |
|
797 | rheads = set(hds) | |
798 | lheads = set(repo.heads()) |
|
798 | lheads = set(repo.heads()) | |
799 | ui.write(("common heads: %s\n") % |
|
799 | ui.write(("common heads: %s\n") % | |
800 | " ".join(sorted(short(n) for n in common))) |
|
800 | " ".join(sorted(short(n) for n in common))) | |
801 | if lheads <= common: |
|
801 | if lheads <= common: | |
802 | ui.write(("local is subset\n")) |
|
802 | ui.write(("local is subset\n")) | |
803 | elif rheads <= common: |
|
803 | elif rheads <= common: | |
804 | ui.write(("remote is subset\n")) |
|
804 | ui.write(("remote is subset\n")) | |
805 |
|
805 | |||
806 | remoterevs, _checkout = hg.addbranchrevs(repo, remote, branches, revs=None) |
|
806 | remoterevs, _checkout = hg.addbranchrevs(repo, remote, branches, revs=None) | |
807 | localrevs = opts['rev'] |
|
807 | localrevs = opts['rev'] | |
808 | doit(localrevs, remoterevs) |
|
808 | doit(localrevs, remoterevs) | |
809 |
|
809 | |||
810 | _chunksize = 4 << 10 |
|
810 | _chunksize = 4 << 10 | |
811 |
|
811 | |||
812 | @command('debugdownload', |
|
812 | @command('debugdownload', | |
813 | [ |
|
813 | [ | |
814 | ('o', 'output', '', _('path')), |
|
814 | ('o', 'output', '', _('path')), | |
815 | ], |
|
815 | ], | |
816 | optionalrepo=True) |
|
816 | optionalrepo=True) | |
817 | def debugdownload(ui, repo, url, output=None, **opts): |
|
817 | def debugdownload(ui, repo, url, output=None, **opts): | |
818 | """download a resource using Mercurial logic and config |
|
818 | """download a resource using Mercurial logic and config | |
819 | """ |
|
819 | """ | |
820 | fh = urlmod.open(ui, url, output) |
|
820 | fh = urlmod.open(ui, url, output) | |
821 |
|
821 | |||
822 | dest = ui |
|
822 | dest = ui | |
823 | if output: |
|
823 | if output: | |
824 | dest = open(output, "wb", _chunksize) |
|
824 | dest = open(output, "wb", _chunksize) | |
825 | try: |
|
825 | try: | |
826 | data = fh.read(_chunksize) |
|
826 | data = fh.read(_chunksize) | |
827 | while data: |
|
827 | while data: | |
828 | dest.write(data) |
|
828 | dest.write(data) | |
829 | data = fh.read(_chunksize) |
|
829 | data = fh.read(_chunksize) | |
830 | finally: |
|
830 | finally: | |
831 | if output: |
|
831 | if output: | |
832 | dest.close() |
|
832 | dest.close() | |
833 |
|
833 | |||
834 | @command('debugextensions', cmdutil.formatteropts, [], norepo=True) |
|
834 | @command('debugextensions', cmdutil.formatteropts, [], norepo=True) | |
835 | def debugextensions(ui, **opts): |
|
835 | def debugextensions(ui, **opts): | |
836 | '''show information about active extensions''' |
|
836 | '''show information about active extensions''' | |
837 | opts = pycompat.byteskwargs(opts) |
|
837 | opts = pycompat.byteskwargs(opts) | |
838 | exts = extensions.extensions(ui) |
|
838 | exts = extensions.extensions(ui) | |
839 | hgver = util.version() |
|
839 | hgver = util.version() | |
840 | fm = ui.formatter('debugextensions', opts) |
|
840 | fm = ui.formatter('debugextensions', opts) | |
841 | for extname, extmod in sorted(exts, key=operator.itemgetter(0)): |
|
841 | for extname, extmod in sorted(exts, key=operator.itemgetter(0)): | |
842 | isinternal = extensions.ismoduleinternal(extmod) |
|
842 | isinternal = extensions.ismoduleinternal(extmod) | |
843 | extsource = pycompat.fsencode(extmod.__file__) |
|
843 | extsource = pycompat.fsencode(extmod.__file__) | |
844 | if isinternal: |
|
844 | if isinternal: | |
845 | exttestedwith = [] # never expose magic string to users |
|
845 | exttestedwith = [] # never expose magic string to users | |
846 | else: |
|
846 | else: | |
847 | exttestedwith = getattr(extmod, 'testedwith', '').split() |
|
847 | exttestedwith = getattr(extmod, 'testedwith', '').split() | |
848 | extbuglink = getattr(extmod, 'buglink', None) |
|
848 | extbuglink = getattr(extmod, 'buglink', None) | |
849 |
|
849 | |||
850 | fm.startitem() |
|
850 | fm.startitem() | |
851 |
|
851 | |||
852 | if ui.quiet or ui.verbose: |
|
852 | if ui.quiet or ui.verbose: | |
853 | fm.write('name', '%s\n', extname) |
|
853 | fm.write('name', '%s\n', extname) | |
854 | else: |
|
854 | else: | |
855 | fm.write('name', '%s', extname) |
|
855 | fm.write('name', '%s', extname) | |
856 | if isinternal or hgver in exttestedwith: |
|
856 | if isinternal or hgver in exttestedwith: | |
857 | fm.plain('\n') |
|
857 | fm.plain('\n') | |
858 | elif not exttestedwith: |
|
858 | elif not exttestedwith: | |
859 | fm.plain(_(' (untested!)\n')) |
|
859 | fm.plain(_(' (untested!)\n')) | |
860 | else: |
|
860 | else: | |
861 | lasttestedversion = exttestedwith[-1] |
|
861 | lasttestedversion = exttestedwith[-1] | |
862 | fm.plain(' (%s!)\n' % lasttestedversion) |
|
862 | fm.plain(' (%s!)\n' % lasttestedversion) | |
863 |
|
863 | |||
864 | fm.condwrite(ui.verbose and extsource, 'source', |
|
864 | fm.condwrite(ui.verbose and extsource, 'source', | |
865 | _(' location: %s\n'), extsource or "") |
|
865 | _(' location: %s\n'), extsource or "") | |
866 |
|
866 | |||
867 | if ui.verbose: |
|
867 | if ui.verbose: | |
868 | fm.plain(_(' bundled: %s\n') % ['no', 'yes'][isinternal]) |
|
868 | fm.plain(_(' bundled: %s\n') % ['no', 'yes'][isinternal]) | |
869 | fm.data(bundled=isinternal) |
|
869 | fm.data(bundled=isinternal) | |
870 |
|
870 | |||
871 | fm.condwrite(ui.verbose and exttestedwith, 'testedwith', |
|
871 | fm.condwrite(ui.verbose and exttestedwith, 'testedwith', | |
872 | _(' tested with: %s\n'), |
|
872 | _(' tested with: %s\n'), | |
873 | fm.formatlist(exttestedwith, name='ver')) |
|
873 | fm.formatlist(exttestedwith, name='ver')) | |
874 |
|
874 | |||
875 | fm.condwrite(ui.verbose and extbuglink, 'buglink', |
|
875 | fm.condwrite(ui.verbose and extbuglink, 'buglink', | |
876 | _(' bug reporting: %s\n'), extbuglink or "") |
|
876 | _(' bug reporting: %s\n'), extbuglink or "") | |
877 |
|
877 | |||
878 | fm.end() |
|
878 | fm.end() | |
879 |
|
879 | |||
880 | @command('debugfileset', |
|
880 | @command('debugfileset', | |
881 | [('r', 'rev', '', _('apply the filespec on this revision'), _('REV'))], |
|
881 | [('r', 'rev', '', _('apply the filespec on this revision'), _('REV'))], | |
882 | _('[-r REV] FILESPEC')) |
|
882 | _('[-r REV] FILESPEC')) | |
883 | def debugfileset(ui, repo, expr, **opts): |
|
883 | def debugfileset(ui, repo, expr, **opts): | |
884 | '''parse and apply a fileset specification''' |
|
884 | '''parse and apply a fileset specification''' | |
885 | ctx = scmutil.revsingle(repo, opts.get(r'rev'), None) |
|
885 | ctx = scmutil.revsingle(repo, opts.get(r'rev'), None) | |
886 | if ui.verbose: |
|
886 | if ui.verbose: | |
887 | tree = fileset.parse(expr) |
|
887 | tree = fileset.parse(expr) | |
888 | ui.note(fileset.prettyformat(tree), "\n") |
|
888 | ui.note(fileset.prettyformat(tree), "\n") | |
889 |
|
889 | |||
890 | for f in ctx.getfileset(expr): |
|
890 | for f in ctx.getfileset(expr): | |
891 | ui.write("%s\n" % f) |
|
891 | ui.write("%s\n" % f) | |
892 |
|
892 | |||
893 | @command('debugformat', |
|
893 | @command('debugformat', | |
894 | [] + cmdutil.formatteropts, |
|
894 | [] + cmdutil.formatteropts, | |
895 | _('')) |
|
895 | _('')) | |
896 | def debugformat(ui, repo, **opts): |
|
896 | def debugformat(ui, repo, **opts): | |
897 | """display format information about the current repository |
|
897 | """display format information about the current repository | |
898 |
|
898 | |||
899 | Use --verbose to get extra information about current config value and |
|
899 | Use --verbose to get extra information about current config value and | |
900 | Mercurial default.""" |
|
900 | Mercurial default.""" | |
901 | opts = pycompat.byteskwargs(opts) |
|
901 | opts = pycompat.byteskwargs(opts) | |
902 | maxvariantlength = max(len(fv.name) for fv in upgrade.allformatvariant) |
|
902 | maxvariantlength = max(len(fv.name) for fv in upgrade.allformatvariant) | |
903 | maxvariantlength = max(len('format-variant'), maxvariantlength) |
|
903 | maxvariantlength = max(len('format-variant'), maxvariantlength) | |
904 |
|
904 | |||
905 | def makeformatname(name): |
|
905 | def makeformatname(name): | |
906 | return '%s:' + (' ' * (maxvariantlength - len(name))) |
|
906 | return '%s:' + (' ' * (maxvariantlength - len(name))) | |
907 |
|
907 | |||
908 | fm = ui.formatter('debugformat', opts) |
|
908 | fm = ui.formatter('debugformat', opts) | |
909 | if fm.isplain(): |
|
909 | if fm.isplain(): | |
910 | def formatvalue(value): |
|
910 | def formatvalue(value): | |
911 | if util.safehasattr(value, 'startswith'): |
|
911 | if util.safehasattr(value, 'startswith'): | |
912 | return value |
|
912 | return value | |
913 | if value: |
|
913 | if value: | |
914 | return 'yes' |
|
914 | return 'yes' | |
915 | else: |
|
915 | else: | |
916 | return 'no' |
|
916 | return 'no' | |
917 | else: |
|
917 | else: | |
918 | formatvalue = pycompat.identity |
|
918 | formatvalue = pycompat.identity | |
919 |
|
919 | |||
920 | fm.plain('format-variant') |
|
920 | fm.plain('format-variant') | |
921 | fm.plain(' ' * (maxvariantlength - len('format-variant'))) |
|
921 | fm.plain(' ' * (maxvariantlength - len('format-variant'))) | |
922 | fm.plain(' repo') |
|
922 | fm.plain(' repo') | |
923 | if ui.verbose: |
|
923 | if ui.verbose: | |
924 | fm.plain(' config default') |
|
924 | fm.plain(' config default') | |
925 | fm.plain('\n') |
|
925 | fm.plain('\n') | |
926 | for fv in upgrade.allformatvariant: |
|
926 | for fv in upgrade.allformatvariant: | |
927 | fm.startitem() |
|
927 | fm.startitem() | |
928 | repovalue = fv.fromrepo(repo) |
|
928 | repovalue = fv.fromrepo(repo) | |
929 | configvalue = fv.fromconfig(repo) |
|
929 | configvalue = fv.fromconfig(repo) | |
930 |
|
930 | |||
931 | if repovalue != configvalue: |
|
931 | if repovalue != configvalue: | |
932 | namelabel = 'formatvariant.name.mismatchconfig' |
|
932 | namelabel = 'formatvariant.name.mismatchconfig' | |
933 | repolabel = 'formatvariant.repo.mismatchconfig' |
|
933 | repolabel = 'formatvariant.repo.mismatchconfig' | |
934 | elif repovalue != fv.default: |
|
934 | elif repovalue != fv.default: | |
935 | namelabel = 'formatvariant.name.mismatchdefault' |
|
935 | namelabel = 'formatvariant.name.mismatchdefault' | |
936 | repolabel = 'formatvariant.repo.mismatchdefault' |
|
936 | repolabel = 'formatvariant.repo.mismatchdefault' | |
937 | else: |
|
937 | else: | |
938 | namelabel = 'formatvariant.name.uptodate' |
|
938 | namelabel = 'formatvariant.name.uptodate' | |
939 | repolabel = 'formatvariant.repo.uptodate' |
|
939 | repolabel = 'formatvariant.repo.uptodate' | |
940 |
|
940 | |||
941 | fm.write('name', makeformatname(fv.name), fv.name, |
|
941 | fm.write('name', makeformatname(fv.name), fv.name, | |
942 | label=namelabel) |
|
942 | label=namelabel) | |
943 | fm.write('repo', ' %3s', formatvalue(repovalue), |
|
943 | fm.write('repo', ' %3s', formatvalue(repovalue), | |
944 | label=repolabel) |
|
944 | label=repolabel) | |
945 | if fv.default != configvalue: |
|
945 | if fv.default != configvalue: | |
946 | configlabel = 'formatvariant.config.special' |
|
946 | configlabel = 'formatvariant.config.special' | |
947 | else: |
|
947 | else: | |
948 | configlabel = 'formatvariant.config.default' |
|
948 | configlabel = 'formatvariant.config.default' | |
949 | fm.condwrite(ui.verbose, 'config', ' %6s', formatvalue(configvalue), |
|
949 | fm.condwrite(ui.verbose, 'config', ' %6s', formatvalue(configvalue), | |
950 | label=configlabel) |
|
950 | label=configlabel) | |
951 | fm.condwrite(ui.verbose, 'default', ' %7s', formatvalue(fv.default), |
|
951 | fm.condwrite(ui.verbose, 'default', ' %7s', formatvalue(fv.default), | |
952 | label='formatvariant.default') |
|
952 | label='formatvariant.default') | |
953 | fm.plain('\n') |
|
953 | fm.plain('\n') | |
954 | fm.end() |
|
954 | fm.end() | |
955 |
|
955 | |||
956 | @command('debugfsinfo', [], _('[PATH]'), norepo=True) |
|
956 | @command('debugfsinfo', [], _('[PATH]'), norepo=True) | |
957 | def debugfsinfo(ui, path="."): |
|
957 | def debugfsinfo(ui, path="."): | |
958 | """show information detected about current filesystem""" |
|
958 | """show information detected about current filesystem""" | |
959 | ui.write(('path: %s\n') % path) |
|
959 | ui.write(('path: %s\n') % path) | |
960 | ui.write(('mounted on: %s\n') % (util.getfsmountpoint(path) or '(unknown)')) |
|
960 | ui.write(('mounted on: %s\n') % (util.getfsmountpoint(path) or '(unknown)')) | |
961 | ui.write(('exec: %s\n') % (util.checkexec(path) and 'yes' or 'no')) |
|
961 | ui.write(('exec: %s\n') % (util.checkexec(path) and 'yes' or 'no')) | |
962 | ui.write(('fstype: %s\n') % (util.getfstype(path) or '(unknown)')) |
|
962 | ui.write(('fstype: %s\n') % (util.getfstype(path) or '(unknown)')) | |
963 | ui.write(('symlink: %s\n') % (util.checklink(path) and 'yes' or 'no')) |
|
963 | ui.write(('symlink: %s\n') % (util.checklink(path) and 'yes' or 'no')) | |
964 | ui.write(('hardlink: %s\n') % (util.checknlink(path) and 'yes' or 'no')) |
|
964 | ui.write(('hardlink: %s\n') % (util.checknlink(path) and 'yes' or 'no')) | |
965 | casesensitive = '(unknown)' |
|
965 | casesensitive = '(unknown)' | |
966 | try: |
|
966 | try: | |
967 | with tempfile.NamedTemporaryFile(prefix='.debugfsinfo', dir=path) as f: |
|
967 | with tempfile.NamedTemporaryFile(prefix='.debugfsinfo', dir=path) as f: | |
968 | casesensitive = util.fscasesensitive(f.name) and 'yes' or 'no' |
|
968 | casesensitive = util.fscasesensitive(f.name) and 'yes' or 'no' | |
969 | except OSError: |
|
969 | except OSError: | |
970 | pass |
|
970 | pass | |
971 | ui.write(('case-sensitive: %s\n') % casesensitive) |
|
971 | ui.write(('case-sensitive: %s\n') % casesensitive) | |
972 |
|
972 | |||
973 | @command('debuggetbundle', |
|
973 | @command('debuggetbundle', | |
974 | [('H', 'head', [], _('id of head node'), _('ID')), |
|
974 | [('H', 'head', [], _('id of head node'), _('ID')), | |
975 | ('C', 'common', [], _('id of common node'), _('ID')), |
|
975 | ('C', 'common', [], _('id of common node'), _('ID')), | |
976 | ('t', 'type', 'bzip2', _('bundle compression type to use'), _('TYPE'))], |
|
976 | ('t', 'type', 'bzip2', _('bundle compression type to use'), _('TYPE'))], | |
977 | _('REPO FILE [-H|-C ID]...'), |
|
977 | _('REPO FILE [-H|-C ID]...'), | |
978 | norepo=True) |
|
978 | norepo=True) | |
979 | def debuggetbundle(ui, repopath, bundlepath, head=None, common=None, **opts): |
|
979 | def debuggetbundle(ui, repopath, bundlepath, head=None, common=None, **opts): | |
980 | """retrieves a bundle from a repo |
|
980 | """retrieves a bundle from a repo | |
981 |
|
981 | |||
982 | Every ID must be a full-length hex node id string. Saves the bundle to the |
|
982 | Every ID must be a full-length hex node id string. Saves the bundle to the | |
983 | given file. |
|
983 | given file. | |
984 | """ |
|
984 | """ | |
985 | opts = pycompat.byteskwargs(opts) |
|
985 | opts = pycompat.byteskwargs(opts) | |
986 | repo = hg.peer(ui, opts, repopath) |
|
986 | repo = hg.peer(ui, opts, repopath) | |
987 | if not repo.capable('getbundle'): |
|
987 | if not repo.capable('getbundle'): | |
988 | raise error.Abort("getbundle() not supported by target repository") |
|
988 | raise error.Abort("getbundle() not supported by target repository") | |
989 | args = {} |
|
989 | args = {} | |
990 | if common: |
|
990 | if common: | |
991 | args[r'common'] = [bin(s) for s in common] |
|
991 | args[r'common'] = [bin(s) for s in common] | |
992 | if head: |
|
992 | if head: | |
993 | args[r'heads'] = [bin(s) for s in head] |
|
993 | args[r'heads'] = [bin(s) for s in head] | |
994 | # TODO: get desired bundlecaps from command line. |
|
994 | # TODO: get desired bundlecaps from command line. | |
995 | args[r'bundlecaps'] = None |
|
995 | args[r'bundlecaps'] = None | |
996 | bundle = repo.getbundle('debug', **args) |
|
996 | bundle = repo.getbundle('debug', **args) | |
997 |
|
997 | |||
998 | bundletype = opts.get('type', 'bzip2').lower() |
|
998 | bundletype = opts.get('type', 'bzip2').lower() | |
999 | btypes = {'none': 'HG10UN', |
|
999 | btypes = {'none': 'HG10UN', | |
1000 | 'bzip2': 'HG10BZ', |
|
1000 | 'bzip2': 'HG10BZ', | |
1001 | 'gzip': 'HG10GZ', |
|
1001 | 'gzip': 'HG10GZ', | |
1002 | 'bundle2': 'HG20'} |
|
1002 | 'bundle2': 'HG20'} | |
1003 | bundletype = btypes.get(bundletype) |
|
1003 | bundletype = btypes.get(bundletype) | |
1004 | if bundletype not in bundle2.bundletypes: |
|
1004 | if bundletype not in bundle2.bundletypes: | |
1005 | raise error.Abort(_('unknown bundle type specified with --type')) |
|
1005 | raise error.Abort(_('unknown bundle type specified with --type')) | |
1006 | bundle2.writebundle(ui, bundle, bundlepath, bundletype) |
|
1006 | bundle2.writebundle(ui, bundle, bundlepath, bundletype) | |
1007 |
|
1007 | |||
1008 | @command('debugignore', [], '[FILE]') |
|
1008 | @command('debugignore', [], '[FILE]') | |
1009 | def debugignore(ui, repo, *files, **opts): |
|
1009 | def debugignore(ui, repo, *files, **opts): | |
1010 | """display the combined ignore pattern and information about ignored files |
|
1010 | """display the combined ignore pattern and information about ignored files | |
1011 |
|
1011 | |||
1012 | With no argument display the combined ignore pattern. |
|
1012 | With no argument display the combined ignore pattern. | |
1013 |
|
1013 | |||
1014 | Given space separated file names, shows if the given file is ignored and |
|
1014 | Given space separated file names, shows if the given file is ignored and | |
1015 | if so, show the ignore rule (file and line number) that matched it. |
|
1015 | if so, show the ignore rule (file and line number) that matched it. | |
1016 | """ |
|
1016 | """ | |
1017 | ignore = repo.dirstate._ignore |
|
1017 | ignore = repo.dirstate._ignore | |
1018 | if not files: |
|
1018 | if not files: | |
1019 | # Show all the patterns |
|
1019 | # Show all the patterns | |
1020 | ui.write("%s\n" % pycompat.byterepr(ignore)) |
|
1020 | ui.write("%s\n" % pycompat.byterepr(ignore)) | |
1021 | else: |
|
1021 | else: | |
1022 | m = scmutil.match(repo[None], pats=files) |
|
1022 | m = scmutil.match(repo[None], pats=files) | |
1023 | for f in m.files(): |
|
1023 | for f in m.files(): | |
1024 | nf = util.normpath(f) |
|
1024 | nf = util.normpath(f) | |
1025 | ignored = None |
|
1025 | ignored = None | |
1026 | ignoredata = None |
|
1026 | ignoredata = None | |
1027 | if nf != '.': |
|
1027 | if nf != '.': | |
1028 | if ignore(nf): |
|
1028 | if ignore(nf): | |
1029 | ignored = nf |
|
1029 | ignored = nf | |
1030 | ignoredata = repo.dirstate._ignorefileandline(nf) |
|
1030 | ignoredata = repo.dirstate._ignorefileandline(nf) | |
1031 | else: |
|
1031 | else: | |
1032 | for p in util.finddirs(nf): |
|
1032 | for p in util.finddirs(nf): | |
1033 | if ignore(p): |
|
1033 | if ignore(p): | |
1034 | ignored = p |
|
1034 | ignored = p | |
1035 | ignoredata = repo.dirstate._ignorefileandline(p) |
|
1035 | ignoredata = repo.dirstate._ignorefileandline(p) | |
1036 | break |
|
1036 | break | |
1037 | if ignored: |
|
1037 | if ignored: | |
1038 | if ignored == nf: |
|
1038 | if ignored == nf: | |
1039 | ui.write(_("%s is ignored\n") % m.uipath(f)) |
|
1039 | ui.write(_("%s is ignored\n") % m.uipath(f)) | |
1040 | else: |
|
1040 | else: | |
1041 | ui.write(_("%s is ignored because of " |
|
1041 | ui.write(_("%s is ignored because of " | |
1042 | "containing folder %s\n") |
|
1042 | "containing folder %s\n") | |
1043 | % (m.uipath(f), ignored)) |
|
1043 | % (m.uipath(f), ignored)) | |
1044 | ignorefile, lineno, line = ignoredata |
|
1044 | ignorefile, lineno, line = ignoredata | |
1045 | ui.write(_("(ignore rule in %s, line %d: '%s')\n") |
|
1045 | ui.write(_("(ignore rule in %s, line %d: '%s')\n") | |
1046 | % (ignorefile, lineno, line)) |
|
1046 | % (ignorefile, lineno, line)) | |
1047 | else: |
|
1047 | else: | |
1048 | ui.write(_("%s is not ignored\n") % m.uipath(f)) |
|
1048 | ui.write(_("%s is not ignored\n") % m.uipath(f)) | |
1049 |
|
1049 | |||
1050 | @command('debugindex', cmdutil.debugrevlogopts + |
|
1050 | @command('debugindex', cmdutil.debugrevlogopts + | |
1051 | [('f', 'format', 0, _('revlog format'), _('FORMAT'))], |
|
1051 | [('f', 'format', 0, _('revlog format'), _('FORMAT'))], | |
1052 | _('[-f FORMAT] -c|-m|FILE'), |
|
1052 | _('[-f FORMAT] -c|-m|FILE'), | |
1053 | optionalrepo=True) |
|
1053 | optionalrepo=True) | |
1054 | def debugindex(ui, repo, file_=None, **opts): |
|
1054 | def debugindex(ui, repo, file_=None, **opts): | |
1055 | """dump the contents of an index file""" |
|
1055 | """dump the contents of an index file""" | |
1056 | opts = pycompat.byteskwargs(opts) |
|
1056 | opts = pycompat.byteskwargs(opts) | |
1057 | r = cmdutil.openrevlog(repo, 'debugindex', file_, opts) |
|
1057 | r = cmdutil.openrevlog(repo, 'debugindex', file_, opts) | |
1058 | format = opts.get('format', 0) |
|
1058 | format = opts.get('format', 0) | |
1059 | if format not in (0, 1): |
|
1059 | if format not in (0, 1): | |
1060 | raise error.Abort(_("unknown format %d") % format) |
|
1060 | raise error.Abort(_("unknown format %d") % format) | |
1061 |
|
1061 | |||
1062 | if ui.debugflag: |
|
1062 | if ui.debugflag: | |
1063 | shortfn = hex |
|
1063 | shortfn = hex | |
1064 | else: |
|
1064 | else: | |
1065 | shortfn = short |
|
1065 | shortfn = short | |
1066 |
|
1066 | |||
1067 | # There might not be anything in r, so have a sane default |
|
1067 | # There might not be anything in r, so have a sane default | |
1068 | idlen = 12 |
|
1068 | idlen = 12 | |
1069 | for i in r: |
|
1069 | for i in r: | |
1070 | idlen = len(shortfn(r.node(i))) |
|
1070 | idlen = len(shortfn(r.node(i))) | |
1071 | break |
|
1071 | break | |
1072 |
|
1072 | |||
1073 | if format == 0: |
|
1073 | if format == 0: | |
1074 | if ui.verbose: |
|
1074 | if ui.verbose: | |
1075 | ui.write((" rev offset length linkrev" |
|
1075 | ui.write((" rev offset length linkrev" | |
1076 | " %s %s p2\n") % ("nodeid".ljust(idlen), |
|
1076 | " %s %s p2\n") % ("nodeid".ljust(idlen), | |
1077 | "p1".ljust(idlen))) |
|
1077 | "p1".ljust(idlen))) | |
1078 | else: |
|
1078 | else: | |
1079 | ui.write((" rev linkrev %s %s p2\n") % ( |
|
1079 | ui.write((" rev linkrev %s %s p2\n") % ( | |
1080 | "nodeid".ljust(idlen), "p1".ljust(idlen))) |
|
1080 | "nodeid".ljust(idlen), "p1".ljust(idlen))) | |
1081 | elif format == 1: |
|
1081 | elif format == 1: | |
1082 | if ui.verbose: |
|
1082 | if ui.verbose: | |
1083 | ui.write((" rev flag offset length size link p1" |
|
1083 | ui.write((" rev flag offset length size link p1" | |
1084 | " p2 %s\n") % "nodeid".rjust(idlen)) |
|
1084 | " p2 %s\n") % "nodeid".rjust(idlen)) | |
1085 | else: |
|
1085 | else: | |
1086 | ui.write((" rev flag size link p1 p2 %s\n") % |
|
1086 | ui.write((" rev flag size link p1 p2 %s\n") % | |
1087 | "nodeid".rjust(idlen)) |
|
1087 | "nodeid".rjust(idlen)) | |
1088 |
|
1088 | |||
1089 | for i in r: |
|
1089 | for i in r: | |
1090 | node = r.node(i) |
|
1090 | node = r.node(i) | |
1091 | if format == 0: |
|
1091 | if format == 0: | |
1092 | try: |
|
1092 | try: | |
1093 | pp = r.parents(node) |
|
1093 | pp = r.parents(node) | |
1094 | except Exception: |
|
1094 | except Exception: | |
1095 | pp = [nullid, nullid] |
|
1095 | pp = [nullid, nullid] | |
1096 | if ui.verbose: |
|
1096 | if ui.verbose: | |
1097 | ui.write("% 6d % 9d % 7d % 7d %s %s %s\n" % ( |
|
1097 | ui.write("% 6d % 9d % 7d % 7d %s %s %s\n" % ( | |
1098 | i, r.start(i), r.length(i), r.linkrev(i), |
|
1098 | i, r.start(i), r.length(i), r.linkrev(i), | |
1099 | shortfn(node), shortfn(pp[0]), shortfn(pp[1]))) |
|
1099 | shortfn(node), shortfn(pp[0]), shortfn(pp[1]))) | |
1100 | else: |
|
1100 | else: | |
1101 | ui.write("% 6d % 7d %s %s %s\n" % ( |
|
1101 | ui.write("% 6d % 7d %s %s %s\n" % ( | |
1102 | i, r.linkrev(i), shortfn(node), shortfn(pp[0]), |
|
1102 | i, r.linkrev(i), shortfn(node), shortfn(pp[0]), | |
1103 | shortfn(pp[1]))) |
|
1103 | shortfn(pp[1]))) | |
1104 | elif format == 1: |
|
1104 | elif format == 1: | |
1105 | pr = r.parentrevs(i) |
|
1105 | pr = r.parentrevs(i) | |
1106 | if ui.verbose: |
|
1106 | if ui.verbose: | |
1107 | ui.write("% 6d %04x % 8d % 8d % 8d % 6d % 6d % 6d %s\n" % ( |
|
1107 | ui.write("% 6d %04x % 8d % 8d % 8d % 6d % 6d % 6d %s\n" % ( | |
1108 | i, r.flags(i), r.start(i), r.length(i), r.rawsize(i), |
|
1108 | i, r.flags(i), r.start(i), r.length(i), r.rawsize(i), | |
1109 | r.linkrev(i), pr[0], pr[1], shortfn(node))) |
|
1109 | r.linkrev(i), pr[0], pr[1], shortfn(node))) | |
1110 | else: |
|
1110 | else: | |
1111 | ui.write("% 6d %04x % 8d % 6d % 6d % 6d %s\n" % ( |
|
1111 | ui.write("% 6d %04x % 8d % 6d % 6d % 6d %s\n" % ( | |
1112 | i, r.flags(i), r.rawsize(i), r.linkrev(i), pr[0], pr[1], |
|
1112 | i, r.flags(i), r.rawsize(i), r.linkrev(i), pr[0], pr[1], | |
1113 | shortfn(node))) |
|
1113 | shortfn(node))) | |
1114 |
|
1114 | |||
1115 | @command('debugindexdot', cmdutil.debugrevlogopts, |
|
1115 | @command('debugindexdot', cmdutil.debugrevlogopts, | |
1116 | _('-c|-m|FILE'), optionalrepo=True) |
|
1116 | _('-c|-m|FILE'), optionalrepo=True) | |
1117 | def debugindexdot(ui, repo, file_=None, **opts): |
|
1117 | def debugindexdot(ui, repo, file_=None, **opts): | |
1118 | """dump an index DAG as a graphviz dot file""" |
|
1118 | """dump an index DAG as a graphviz dot file""" | |
1119 | opts = pycompat.byteskwargs(opts) |
|
1119 | opts = pycompat.byteskwargs(opts) | |
1120 | r = cmdutil.openrevlog(repo, 'debugindexdot', file_, opts) |
|
1120 | r = cmdutil.openrevlog(repo, 'debugindexdot', file_, opts) | |
1121 | ui.write(("digraph G {\n")) |
|
1121 | ui.write(("digraph G {\n")) | |
1122 | for i in r: |
|
1122 | for i in r: | |
1123 | node = r.node(i) |
|
1123 | node = r.node(i) | |
1124 | pp = r.parents(node) |
|
1124 | pp = r.parents(node) | |
1125 | ui.write("\t%d -> %d\n" % (r.rev(pp[0]), i)) |
|
1125 | ui.write("\t%d -> %d\n" % (r.rev(pp[0]), i)) | |
1126 | if pp[1] != nullid: |
|
1126 | if pp[1] != nullid: | |
1127 | ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i)) |
|
1127 | ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i)) | |
1128 | ui.write("}\n") |
|
1128 | ui.write("}\n") | |
1129 |
|
1129 | |||
1130 | @command('debuginstall', [] + cmdutil.formatteropts, '', norepo=True) |
|
1130 | @command('debuginstall', [] + cmdutil.formatteropts, '', norepo=True) | |
1131 | def debuginstall(ui, **opts): |
|
1131 | def debuginstall(ui, **opts): | |
1132 | '''test Mercurial installation |
|
1132 | '''test Mercurial installation | |
1133 |
|
1133 | |||
1134 | Returns 0 on success. |
|
1134 | Returns 0 on success. | |
1135 | ''' |
|
1135 | ''' | |
1136 | opts = pycompat.byteskwargs(opts) |
|
1136 | opts = pycompat.byteskwargs(opts) | |
1137 |
|
1137 | |||
1138 | def writetemp(contents): |
|
1138 | def writetemp(contents): | |
1139 | (fd, name) = tempfile.mkstemp(prefix="hg-debuginstall-") |
|
1139 | (fd, name) = tempfile.mkstemp(prefix="hg-debuginstall-") | |
1140 | f = os.fdopen(fd, r"wb") |
|
1140 | f = os.fdopen(fd, r"wb") | |
1141 | f.write(contents) |
|
1141 | f.write(contents) | |
1142 | f.close() |
|
1142 | f.close() | |
1143 | return name |
|
1143 | return name | |
1144 |
|
1144 | |||
1145 | problems = 0 |
|
1145 | problems = 0 | |
1146 |
|
1146 | |||
1147 | fm = ui.formatter('debuginstall', opts) |
|
1147 | fm = ui.formatter('debuginstall', opts) | |
1148 | fm.startitem() |
|
1148 | fm.startitem() | |
1149 |
|
1149 | |||
1150 | # encoding |
|
1150 | # encoding | |
1151 | fm.write('encoding', _("checking encoding (%s)...\n"), encoding.encoding) |
|
1151 | fm.write('encoding', _("checking encoding (%s)...\n"), encoding.encoding) | |
1152 | err = None |
|
1152 | err = None | |
1153 | try: |
|
1153 | try: | |
1154 | codecs.lookup(pycompat.sysstr(encoding.encoding)) |
|
1154 | codecs.lookup(pycompat.sysstr(encoding.encoding)) | |
1155 | except LookupError as inst: |
|
1155 | except LookupError as inst: | |
1156 | err = stringutil.forcebytestr(inst) |
|
1156 | err = stringutil.forcebytestr(inst) | |
1157 | problems += 1 |
|
1157 | problems += 1 | |
1158 | fm.condwrite(err, 'encodingerror', _(" %s\n" |
|
1158 | fm.condwrite(err, 'encodingerror', _(" %s\n" | |
1159 | " (check that your locale is properly set)\n"), err) |
|
1159 | " (check that your locale is properly set)\n"), err) | |
1160 |
|
1160 | |||
1161 | # Python |
|
1161 | # Python | |
1162 | fm.write('pythonexe', _("checking Python executable (%s)\n"), |
|
1162 | fm.write('pythonexe', _("checking Python executable (%s)\n"), | |
1163 | pycompat.sysexecutable) |
|
1163 | pycompat.sysexecutable) | |
1164 | fm.write('pythonver', _("checking Python version (%s)\n"), |
|
1164 | fm.write('pythonver', _("checking Python version (%s)\n"), | |
1165 | ("%d.%d.%d" % sys.version_info[:3])) |
|
1165 | ("%d.%d.%d" % sys.version_info[:3])) | |
1166 | fm.write('pythonlib', _("checking Python lib (%s)...\n"), |
|
1166 | fm.write('pythonlib', _("checking Python lib (%s)...\n"), | |
1167 | os.path.dirname(pycompat.fsencode(os.__file__))) |
|
1167 | os.path.dirname(pycompat.fsencode(os.__file__))) | |
1168 |
|
1168 | |||
1169 | security = set(sslutil.supportedprotocols) |
|
1169 | security = set(sslutil.supportedprotocols) | |
1170 | if sslutil.hassni: |
|
1170 | if sslutil.hassni: | |
1171 | security.add('sni') |
|
1171 | security.add('sni') | |
1172 |
|
1172 | |||
1173 | fm.write('pythonsecurity', _("checking Python security support (%s)\n"), |
|
1173 | fm.write('pythonsecurity', _("checking Python security support (%s)\n"), | |
1174 | fm.formatlist(sorted(security), name='protocol', |
|
1174 | fm.formatlist(sorted(security), name='protocol', | |
1175 | fmt='%s', sep=',')) |
|
1175 | fmt='%s', sep=',')) | |
1176 |
|
1176 | |||
1177 | # These are warnings, not errors. So don't increment problem count. This |
|
1177 | # These are warnings, not errors. So don't increment problem count. This | |
1178 | # may change in the future. |
|
1178 | # may change in the future. | |
1179 | if 'tls1.2' not in security: |
|
1179 | if 'tls1.2' not in security: | |
1180 | fm.plain(_(' TLS 1.2 not supported by Python install; ' |
|
1180 | fm.plain(_(' TLS 1.2 not supported by Python install; ' | |
1181 | 'network connections lack modern security\n')) |
|
1181 | 'network connections lack modern security\n')) | |
1182 | if 'sni' not in security: |
|
1182 | if 'sni' not in security: | |
1183 | fm.plain(_(' SNI not supported by Python install; may have ' |
|
1183 | fm.plain(_(' SNI not supported by Python install; may have ' | |
1184 | 'connectivity issues with some servers\n')) |
|
1184 | 'connectivity issues with some servers\n')) | |
1185 |
|
1185 | |||
1186 | # TODO print CA cert info |
|
1186 | # TODO print CA cert info | |
1187 |
|
1187 | |||
1188 | # hg version |
|
1188 | # hg version | |
1189 | hgver = util.version() |
|
1189 | hgver = util.version() | |
1190 | fm.write('hgver', _("checking Mercurial version (%s)\n"), |
|
1190 | fm.write('hgver', _("checking Mercurial version (%s)\n"), | |
1191 | hgver.split('+')[0]) |
|
1191 | hgver.split('+')[0]) | |
1192 | fm.write('hgverextra', _("checking Mercurial custom build (%s)\n"), |
|
1192 | fm.write('hgverextra', _("checking Mercurial custom build (%s)\n"), | |
1193 | '+'.join(hgver.split('+')[1:])) |
|
1193 | '+'.join(hgver.split('+')[1:])) | |
1194 |
|
1194 | |||
1195 | # compiled modules |
|
1195 | # compiled modules | |
1196 | fm.write('hgmodulepolicy', _("checking module policy (%s)\n"), |
|
1196 | fm.write('hgmodulepolicy', _("checking module policy (%s)\n"), | |
1197 | policy.policy) |
|
1197 | policy.policy) | |
1198 | fm.write('hgmodules', _("checking installed modules (%s)...\n"), |
|
1198 | fm.write('hgmodules', _("checking installed modules (%s)...\n"), | |
1199 | os.path.dirname(pycompat.fsencode(__file__))) |
|
1199 | os.path.dirname(pycompat.fsencode(__file__))) | |
1200 |
|
1200 | |||
1201 | if policy.policy in ('c', 'allow'): |
|
1201 | if policy.policy in ('c', 'allow'): | |
1202 | err = None |
|
1202 | err = None | |
1203 | try: |
|
1203 | try: | |
1204 | from .cext import ( |
|
1204 | from .cext import ( | |
1205 | base85, |
|
1205 | base85, | |
1206 | bdiff, |
|
1206 | bdiff, | |
1207 | mpatch, |
|
1207 | mpatch, | |
1208 | osutil, |
|
1208 | osutil, | |
1209 | ) |
|
1209 | ) | |
1210 | dir(bdiff), dir(mpatch), dir(base85), dir(osutil) # quiet pyflakes |
|
1210 | dir(bdiff), dir(mpatch), dir(base85), dir(osutil) # quiet pyflakes | |
1211 | except Exception as inst: |
|
1211 | except Exception as inst: | |
1212 | err = stringutil.forcebytestr(inst) |
|
1212 | err = stringutil.forcebytestr(inst) | |
1213 | problems += 1 |
|
1213 | problems += 1 | |
1214 | fm.condwrite(err, 'extensionserror', " %s\n", err) |
|
1214 | fm.condwrite(err, 'extensionserror', " %s\n", err) | |
1215 |
|
1215 | |||
1216 | compengines = util.compengines._engines.values() |
|
1216 | compengines = util.compengines._engines.values() | |
1217 | fm.write('compengines', _('checking registered compression engines (%s)\n'), |
|
1217 | fm.write('compengines', _('checking registered compression engines (%s)\n'), | |
1218 | fm.formatlist(sorted(e.name() for e in compengines), |
|
1218 | fm.formatlist(sorted(e.name() for e in compengines), | |
1219 | name='compengine', fmt='%s', sep=', ')) |
|
1219 | name='compengine', fmt='%s', sep=', ')) | |
1220 | fm.write('compenginesavail', _('checking available compression engines ' |
|
1220 | fm.write('compenginesavail', _('checking available compression engines ' | |
1221 | '(%s)\n'), |
|
1221 | '(%s)\n'), | |
1222 | fm.formatlist(sorted(e.name() for e in compengines |
|
1222 | fm.formatlist(sorted(e.name() for e in compengines | |
1223 | if e.available()), |
|
1223 | if e.available()), | |
1224 | name='compengine', fmt='%s', sep=', ')) |
|
1224 | name='compengine', fmt='%s', sep=', ')) | |
1225 | wirecompengines = util.compengines.supportedwireengines(util.SERVERROLE) |
|
1225 | wirecompengines = util.compengines.supportedwireengines(util.SERVERROLE) | |
1226 | fm.write('compenginesserver', _('checking available compression engines ' |
|
1226 | fm.write('compenginesserver', _('checking available compression engines ' | |
1227 | 'for wire protocol (%s)\n'), |
|
1227 | 'for wire protocol (%s)\n'), | |
1228 | fm.formatlist([e.name() for e in wirecompengines |
|
1228 | fm.formatlist([e.name() for e in wirecompengines | |
1229 | if e.wireprotosupport()], |
|
1229 | if e.wireprotosupport()], | |
1230 | name='compengine', fmt='%s', sep=', ')) |
|
1230 | name='compengine', fmt='%s', sep=', ')) | |
1231 | re2 = 'missing' |
|
1231 | re2 = 'missing' | |
1232 | if util._re2: |
|
1232 | if util._re2: | |
1233 | re2 = 'available' |
|
1233 | re2 = 'available' | |
1234 | fm.plain(_('checking "re2" regexp engine (%s)\n') % re2) |
|
1234 | fm.plain(_('checking "re2" regexp engine (%s)\n') % re2) | |
1235 | fm.data(re2=bool(util._re2)) |
|
1235 | fm.data(re2=bool(util._re2)) | |
1236 |
|
1236 | |||
1237 | # templates |
|
1237 | # templates | |
1238 | p = templater.templatepaths() |
|
1238 | p = templater.templatepaths() | |
1239 | fm.write('templatedirs', 'checking templates (%s)...\n', ' '.join(p)) |
|
1239 | fm.write('templatedirs', 'checking templates (%s)...\n', ' '.join(p)) | |
1240 | fm.condwrite(not p, '', _(" no template directories found\n")) |
|
1240 | fm.condwrite(not p, '', _(" no template directories found\n")) | |
1241 | if p: |
|
1241 | if p: | |
1242 | m = templater.templatepath("map-cmdline.default") |
|
1242 | m = templater.templatepath("map-cmdline.default") | |
1243 | if m: |
|
1243 | if m: | |
1244 | # template found, check if it is working |
|
1244 | # template found, check if it is working | |
1245 | err = None |
|
1245 | err = None | |
1246 | try: |
|
1246 | try: | |
1247 | templater.templater.frommapfile(m) |
|
1247 | templater.templater.frommapfile(m) | |
1248 | except Exception as inst: |
|
1248 | except Exception as inst: | |
1249 | err = stringutil.forcebytestr(inst) |
|
1249 | err = stringutil.forcebytestr(inst) | |
1250 | p = None |
|
1250 | p = None | |
1251 | fm.condwrite(err, 'defaulttemplateerror', " %s\n", err) |
|
1251 | fm.condwrite(err, 'defaulttemplateerror', " %s\n", err) | |
1252 | else: |
|
1252 | else: | |
1253 | p = None |
|
1253 | p = None | |
1254 | fm.condwrite(p, 'defaulttemplate', |
|
1254 | fm.condwrite(p, 'defaulttemplate', | |
1255 | _("checking default template (%s)\n"), m) |
|
1255 | _("checking default template (%s)\n"), m) | |
1256 | fm.condwrite(not m, 'defaulttemplatenotfound', |
|
1256 | fm.condwrite(not m, 'defaulttemplatenotfound', | |
1257 | _(" template '%s' not found\n"), "default") |
|
1257 | _(" template '%s' not found\n"), "default") | |
1258 | if not p: |
|
1258 | if not p: | |
1259 | problems += 1 |
|
1259 | problems += 1 | |
1260 | fm.condwrite(not p, '', |
|
1260 | fm.condwrite(not p, '', | |
1261 | _(" (templates seem to have been installed incorrectly)\n")) |
|
1261 | _(" (templates seem to have been installed incorrectly)\n")) | |
1262 |
|
1262 | |||
1263 | # editor |
|
1263 | # editor | |
1264 | editor = ui.geteditor() |
|
1264 | editor = ui.geteditor() | |
1265 | editor = util.expandpath(editor) |
|
1265 | editor = util.expandpath(editor) | |
1266 | editorbin = procutil.shellsplit(editor)[0] |
|
1266 | editorbin = procutil.shellsplit(editor)[0] | |
1267 | fm.write('editor', _("checking commit editor... (%s)\n"), editorbin) |
|
1267 | fm.write('editor', _("checking commit editor... (%s)\n"), editorbin) | |
1268 | cmdpath = procutil.findexe(editorbin) |
|
1268 | cmdpath = procutil.findexe(editorbin) | |
1269 | fm.condwrite(not cmdpath and editor == 'vi', 'vinotfound', |
|
1269 | fm.condwrite(not cmdpath and editor == 'vi', 'vinotfound', | |
1270 | _(" No commit editor set and can't find %s in PATH\n" |
|
1270 | _(" No commit editor set and can't find %s in PATH\n" | |
1271 | " (specify a commit editor in your configuration" |
|
1271 | " (specify a commit editor in your configuration" | |
1272 | " file)\n"), not cmdpath and editor == 'vi' and editorbin) |
|
1272 | " file)\n"), not cmdpath and editor == 'vi' and editorbin) | |
1273 | fm.condwrite(not cmdpath and editor != 'vi', 'editornotfound', |
|
1273 | fm.condwrite(not cmdpath and editor != 'vi', 'editornotfound', | |
1274 | _(" Can't find editor '%s' in PATH\n" |
|
1274 | _(" Can't find editor '%s' in PATH\n" | |
1275 | " (specify a commit editor in your configuration" |
|
1275 | " (specify a commit editor in your configuration" | |
1276 | " file)\n"), not cmdpath and editorbin) |
|
1276 | " file)\n"), not cmdpath and editorbin) | |
1277 | if not cmdpath and editor != 'vi': |
|
1277 | if not cmdpath and editor != 'vi': | |
1278 | problems += 1 |
|
1278 | problems += 1 | |
1279 |
|
1279 | |||
1280 | # check username |
|
1280 | # check username | |
1281 | username = None |
|
1281 | username = None | |
1282 | err = None |
|
1282 | err = None | |
1283 | try: |
|
1283 | try: | |
1284 | username = ui.username() |
|
1284 | username = ui.username() | |
1285 | except error.Abort as e: |
|
1285 | except error.Abort as e: | |
1286 | err = stringutil.forcebytestr(e) |
|
1286 | err = stringutil.forcebytestr(e) | |
1287 | problems += 1 |
|
1287 | problems += 1 | |
1288 |
|
1288 | |||
1289 | fm.condwrite(username, 'username', _("checking username (%s)\n"), username) |
|
1289 | fm.condwrite(username, 'username', _("checking username (%s)\n"), username) | |
1290 | fm.condwrite(err, 'usernameerror', _("checking username...\n %s\n" |
|
1290 | fm.condwrite(err, 'usernameerror', _("checking username...\n %s\n" | |
1291 | " (specify a username in your configuration file)\n"), err) |
|
1291 | " (specify a username in your configuration file)\n"), err) | |
1292 |
|
1292 | |||
1293 | fm.condwrite(not problems, '', |
|
1293 | fm.condwrite(not problems, '', | |
1294 | _("no problems detected\n")) |
|
1294 | _("no problems detected\n")) | |
1295 | if not problems: |
|
1295 | if not problems: | |
1296 | fm.data(problems=problems) |
|
1296 | fm.data(problems=problems) | |
1297 | fm.condwrite(problems, 'problems', |
|
1297 | fm.condwrite(problems, 'problems', | |
1298 | _("%d problems detected," |
|
1298 | _("%d problems detected," | |
1299 | " please check your install!\n"), problems) |
|
1299 | " please check your install!\n"), problems) | |
1300 | fm.end() |
|
1300 | fm.end() | |
1301 |
|
1301 | |||
1302 | return problems |
|
1302 | return problems | |
1303 |
|
1303 | |||
1304 | @command('debugknown', [], _('REPO ID...'), norepo=True) |
|
1304 | @command('debugknown', [], _('REPO ID...'), norepo=True) | |
1305 | def debugknown(ui, repopath, *ids, **opts): |
|
1305 | def debugknown(ui, repopath, *ids, **opts): | |
1306 | """test whether node ids are known to a repo |
|
1306 | """test whether node ids are known to a repo | |
1307 |
|
1307 | |||
1308 | Every ID must be a full-length hex node id string. Returns a list of 0s |
|
1308 | Every ID must be a full-length hex node id string. Returns a list of 0s | |
1309 | and 1s indicating unknown/known. |
|
1309 | and 1s indicating unknown/known. | |
1310 | """ |
|
1310 | """ | |
1311 | opts = pycompat.byteskwargs(opts) |
|
1311 | opts = pycompat.byteskwargs(opts) | |
1312 | repo = hg.peer(ui, opts, repopath) |
|
1312 | repo = hg.peer(ui, opts, repopath) | |
1313 | if not repo.capable('known'): |
|
1313 | if not repo.capable('known'): | |
1314 | raise error.Abort("known() not supported by target repository") |
|
1314 | raise error.Abort("known() not supported by target repository") | |
1315 | flags = repo.known([bin(s) for s in ids]) |
|
1315 | flags = repo.known([bin(s) for s in ids]) | |
1316 | ui.write("%s\n" % ("".join([f and "1" or "0" for f in flags]))) |
|
1316 | ui.write("%s\n" % ("".join([f and "1" or "0" for f in flags]))) | |
1317 |
|
1317 | |||
1318 | @command('debuglabelcomplete', [], _('LABEL...')) |
|
1318 | @command('debuglabelcomplete', [], _('LABEL...')) | |
1319 | def debuglabelcomplete(ui, repo, *args): |
|
1319 | def debuglabelcomplete(ui, repo, *args): | |
1320 | '''backwards compatibility with old bash completion scripts (DEPRECATED)''' |
|
1320 | '''backwards compatibility with old bash completion scripts (DEPRECATED)''' | |
1321 | debugnamecomplete(ui, repo, *args) |
|
1321 | debugnamecomplete(ui, repo, *args) | |
1322 |
|
1322 | |||
1323 | @command('debuglocks', |
|
1323 | @command('debuglocks', | |
1324 | [('L', 'force-lock', None, _('free the store lock (DANGEROUS)')), |
|
1324 | [('L', 'force-lock', None, _('free the store lock (DANGEROUS)')), | |
1325 | ('W', 'force-wlock', None, |
|
1325 | ('W', 'force-wlock', None, | |
1326 | _('free the working state lock (DANGEROUS)')), |
|
1326 | _('free the working state lock (DANGEROUS)')), | |
1327 | ('s', 'set-lock', None, _('set the store lock until stopped')), |
|
1327 | ('s', 'set-lock', None, _('set the store lock until stopped')), | |
1328 | ('S', 'set-wlock', None, |
|
1328 | ('S', 'set-wlock', None, | |
1329 | _('set the working state lock until stopped'))], |
|
1329 | _('set the working state lock until stopped'))], | |
1330 | _('[OPTION]...')) |
|
1330 | _('[OPTION]...')) | |
1331 | def debuglocks(ui, repo, **opts): |
|
1331 | def debuglocks(ui, repo, **opts): | |
1332 | """show or modify state of locks |
|
1332 | """show or modify state of locks | |
1333 |
|
1333 | |||
1334 | By default, this command will show which locks are held. This |
|
1334 | By default, this command will show which locks are held. This | |
1335 | includes the user and process holding the lock, the amount of time |
|
1335 | includes the user and process holding the lock, the amount of time | |
1336 | the lock has been held, and the machine name where the process is |
|
1336 | the lock has been held, and the machine name where the process is | |
1337 | running if it's not local. |
|
1337 | running if it's not local. | |
1338 |
|
1338 | |||
1339 | Locks protect the integrity of Mercurial's data, so should be |
|
1339 | Locks protect the integrity of Mercurial's data, so should be | |
1340 | treated with care. System crashes or other interruptions may cause |
|
1340 | treated with care. System crashes or other interruptions may cause | |
1341 | locks to not be properly released, though Mercurial will usually |
|
1341 | locks to not be properly released, though Mercurial will usually | |
1342 | detect and remove such stale locks automatically. |
|
1342 | detect and remove such stale locks automatically. | |
1343 |
|
1343 | |||
1344 | However, detecting stale locks may not always be possible (for |
|
1344 | However, detecting stale locks may not always be possible (for | |
1345 | instance, on a shared filesystem). Removing locks may also be |
|
1345 | instance, on a shared filesystem). Removing locks may also be | |
1346 | blocked by filesystem permissions. |
|
1346 | blocked by filesystem permissions. | |
1347 |
|
1347 | |||
1348 | Setting a lock will prevent other commands from changing the data. |
|
1348 | Setting a lock will prevent other commands from changing the data. | |
1349 | The command will wait until an interruption (SIGINT, SIGTERM, ...) occurs. |
|
1349 | The command will wait until an interruption (SIGINT, SIGTERM, ...) occurs. | |
1350 | The set locks are removed when the command exits. |
|
1350 | The set locks are removed when the command exits. | |
1351 |
|
1351 | |||
1352 | Returns 0 if no locks are held. |
|
1352 | Returns 0 if no locks are held. | |
1353 |
|
1353 | |||
1354 | """ |
|
1354 | """ | |
1355 |
|
1355 | |||
1356 | if opts.get(r'force_lock'): |
|
1356 | if opts.get(r'force_lock'): | |
1357 | repo.svfs.unlink('lock') |
|
1357 | repo.svfs.unlink('lock') | |
1358 | if opts.get(r'force_wlock'): |
|
1358 | if opts.get(r'force_wlock'): | |
1359 | repo.vfs.unlink('wlock') |
|
1359 | repo.vfs.unlink('wlock') | |
1360 | if opts.get(r'force_lock') or opts.get(r'force_wlock'): |
|
1360 | if opts.get(r'force_lock') or opts.get(r'force_wlock'): | |
1361 | return 0 |
|
1361 | return 0 | |
1362 |
|
1362 | |||
1363 | locks = [] |
|
1363 | locks = [] | |
1364 | try: |
|
1364 | try: | |
1365 | if opts.get(r'set_wlock'): |
|
1365 | if opts.get(r'set_wlock'): | |
1366 | try: |
|
1366 | try: | |
1367 | locks.append(repo.wlock(False)) |
|
1367 | locks.append(repo.wlock(False)) | |
1368 | except error.LockHeld: |
|
1368 | except error.LockHeld: | |
1369 | raise error.Abort(_('wlock is already held')) |
|
1369 | raise error.Abort(_('wlock is already held')) | |
1370 | if opts.get(r'set_lock'): |
|
1370 | if opts.get(r'set_lock'): | |
1371 | try: |
|
1371 | try: | |
1372 | locks.append(repo.lock(False)) |
|
1372 | locks.append(repo.lock(False)) | |
1373 | except error.LockHeld: |
|
1373 | except error.LockHeld: | |
1374 | raise error.Abort(_('lock is already held')) |
|
1374 | raise error.Abort(_('lock is already held')) | |
1375 | if len(locks): |
|
1375 | if len(locks): | |
1376 | ui.promptchoice(_("ready to release the lock (y)? $$ &Yes")) |
|
1376 | ui.promptchoice(_("ready to release the lock (y)? $$ &Yes")) | |
1377 | return 0 |
|
1377 | return 0 | |
1378 | finally: |
|
1378 | finally: | |
1379 | release(*locks) |
|
1379 | release(*locks) | |
1380 |
|
1380 | |||
1381 | now = time.time() |
|
1381 | now = time.time() | |
1382 | held = 0 |
|
1382 | held = 0 | |
1383 |
|
1383 | |||
1384 | def report(vfs, name, method): |
|
1384 | def report(vfs, name, method): | |
1385 | # this causes stale locks to get reaped for more accurate reporting |
|
1385 | # this causes stale locks to get reaped for more accurate reporting | |
1386 | try: |
|
1386 | try: | |
1387 | l = method(False) |
|
1387 | l = method(False) | |
1388 | except error.LockHeld: |
|
1388 | except error.LockHeld: | |
1389 | l = None |
|
1389 | l = None | |
1390 |
|
1390 | |||
1391 | if l: |
|
1391 | if l: | |
1392 | l.release() |
|
1392 | l.release() | |
1393 | else: |
|
1393 | else: | |
1394 | try: |
|
1394 | try: | |
1395 | st = vfs.lstat(name) |
|
1395 | st = vfs.lstat(name) | |
1396 | age = now - st[stat.ST_MTIME] |
|
1396 | age = now - st[stat.ST_MTIME] | |
1397 | user = util.username(st.st_uid) |
|
1397 | user = util.username(st.st_uid) | |
1398 | locker = vfs.readlock(name) |
|
1398 | locker = vfs.readlock(name) | |
1399 | if ":" in locker: |
|
1399 | if ":" in locker: | |
1400 | host, pid = locker.split(':') |
|
1400 | host, pid = locker.split(':') | |
1401 | if host == socket.gethostname(): |
|
1401 | if host == socket.gethostname(): | |
1402 | locker = 'user %s, process %s' % (user, pid) |
|
1402 | locker = 'user %s, process %s' % (user, pid) | |
1403 | else: |
|
1403 | else: | |
1404 | locker = 'user %s, process %s, host %s' \ |
|
1404 | locker = 'user %s, process %s, host %s' \ | |
1405 | % (user, pid, host) |
|
1405 | % (user, pid, host) | |
1406 | ui.write(("%-6s %s (%ds)\n") % (name + ":", locker, age)) |
|
1406 | ui.write(("%-6s %s (%ds)\n") % (name + ":", locker, age)) | |
1407 | return 1 |
|
1407 | return 1 | |
1408 | except OSError as e: |
|
1408 | except OSError as e: | |
1409 | if e.errno != errno.ENOENT: |
|
1409 | if e.errno != errno.ENOENT: | |
1410 | raise |
|
1410 | raise | |
1411 |
|
1411 | |||
1412 | ui.write(("%-6s free\n") % (name + ":")) |
|
1412 | ui.write(("%-6s free\n") % (name + ":")) | |
1413 | return 0 |
|
1413 | return 0 | |
1414 |
|
1414 | |||
1415 | held += report(repo.svfs, "lock", repo.lock) |
|
1415 | held += report(repo.svfs, "lock", repo.lock) | |
1416 | held += report(repo.vfs, "wlock", repo.wlock) |
|
1416 | held += report(repo.vfs, "wlock", repo.wlock) | |
1417 |
|
1417 | |||
1418 | return held |
|
1418 | return held | |
1419 |
|
1419 | |||
1420 | @command('debugmergestate', [], '') |
|
1420 | @command('debugmergestate', [], '') | |
1421 | def debugmergestate(ui, repo, *args): |
|
1421 | def debugmergestate(ui, repo, *args): | |
1422 | """print merge state |
|
1422 | """print merge state | |
1423 |
|
1423 | |||
1424 | Use --verbose to print out information about whether v1 or v2 merge state |
|
1424 | Use --verbose to print out information about whether v1 or v2 merge state | |
1425 | was chosen.""" |
|
1425 | was chosen.""" | |
1426 | def _hashornull(h): |
|
1426 | def _hashornull(h): | |
1427 | if h == nullhex: |
|
1427 | if h == nullhex: | |
1428 | return 'null' |
|
1428 | return 'null' | |
1429 | else: |
|
1429 | else: | |
1430 | return h |
|
1430 | return h | |
1431 |
|
1431 | |||
1432 | def printrecords(version): |
|
1432 | def printrecords(version): | |
1433 | ui.write(('* version %d records\n') % version) |
|
1433 | ui.write(('* version %d records\n') % version) | |
1434 | if version == 1: |
|
1434 | if version == 1: | |
1435 | records = v1records |
|
1435 | records = v1records | |
1436 | else: |
|
1436 | else: | |
1437 | records = v2records |
|
1437 | records = v2records | |
1438 |
|
1438 | |||
1439 | for rtype, record in records: |
|
1439 | for rtype, record in records: | |
1440 | # pretty print some record types |
|
1440 | # pretty print some record types | |
1441 | if rtype == 'L': |
|
1441 | if rtype == 'L': | |
1442 | ui.write(('local: %s\n') % record) |
|
1442 | ui.write(('local: %s\n') % record) | |
1443 | elif rtype == 'O': |
|
1443 | elif rtype == 'O': | |
1444 | ui.write(('other: %s\n') % record) |
|
1444 | ui.write(('other: %s\n') % record) | |
1445 | elif rtype == 'm': |
|
1445 | elif rtype == 'm': | |
1446 | driver, mdstate = record.split('\0', 1) |
|
1446 | driver, mdstate = record.split('\0', 1) | |
1447 | ui.write(('merge driver: %s (state "%s")\n') |
|
1447 | ui.write(('merge driver: %s (state "%s")\n') | |
1448 | % (driver, mdstate)) |
|
1448 | % (driver, mdstate)) | |
1449 | elif rtype in 'FDC': |
|
1449 | elif rtype in 'FDC': | |
1450 | r = record.split('\0') |
|
1450 | r = record.split('\0') | |
1451 | f, state, hash, lfile, afile, anode, ofile = r[0:7] |
|
1451 | f, state, hash, lfile, afile, anode, ofile = r[0:7] | |
1452 | if version == 1: |
|
1452 | if version == 1: | |
1453 | onode = 'not stored in v1 format' |
|
1453 | onode = 'not stored in v1 format' | |
1454 | flags = r[7] |
|
1454 | flags = r[7] | |
1455 | else: |
|
1455 | else: | |
1456 | onode, flags = r[7:9] |
|
1456 | onode, flags = r[7:9] | |
1457 | ui.write(('file: %s (record type "%s", state "%s", hash %s)\n') |
|
1457 | ui.write(('file: %s (record type "%s", state "%s", hash %s)\n') | |
1458 | % (f, rtype, state, _hashornull(hash))) |
|
1458 | % (f, rtype, state, _hashornull(hash))) | |
1459 | ui.write((' local path: %s (flags "%s")\n') % (lfile, flags)) |
|
1459 | ui.write((' local path: %s (flags "%s")\n') % (lfile, flags)) | |
1460 | ui.write((' ancestor path: %s (node %s)\n') |
|
1460 | ui.write((' ancestor path: %s (node %s)\n') | |
1461 | % (afile, _hashornull(anode))) |
|
1461 | % (afile, _hashornull(anode))) | |
1462 | ui.write((' other path: %s (node %s)\n') |
|
1462 | ui.write((' other path: %s (node %s)\n') | |
1463 | % (ofile, _hashornull(onode))) |
|
1463 | % (ofile, _hashornull(onode))) | |
1464 | elif rtype == 'f': |
|
1464 | elif rtype == 'f': | |
1465 | filename, rawextras = record.split('\0', 1) |
|
1465 | filename, rawextras = record.split('\0', 1) | |
1466 | extras = rawextras.split('\0') |
|
1466 | extras = rawextras.split('\0') | |
1467 | i = 0 |
|
1467 | i = 0 | |
1468 | extrastrings = [] |
|
1468 | extrastrings = [] | |
1469 | while i < len(extras): |
|
1469 | while i < len(extras): | |
1470 | extrastrings.append('%s = %s' % (extras[i], extras[i + 1])) |
|
1470 | extrastrings.append('%s = %s' % (extras[i], extras[i + 1])) | |
1471 | i += 2 |
|
1471 | i += 2 | |
1472 |
|
1472 | |||
1473 | ui.write(('file extras: %s (%s)\n') |
|
1473 | ui.write(('file extras: %s (%s)\n') | |
1474 | % (filename, ', '.join(extrastrings))) |
|
1474 | % (filename, ', '.join(extrastrings))) | |
1475 | elif rtype == 'l': |
|
1475 | elif rtype == 'l': | |
1476 | labels = record.split('\0', 2) |
|
1476 | labels = record.split('\0', 2) | |
1477 | labels = [l for l in labels if len(l) > 0] |
|
1477 | labels = [l for l in labels if len(l) > 0] | |
1478 | ui.write(('labels:\n')) |
|
1478 | ui.write(('labels:\n')) | |
1479 | ui.write((' local: %s\n' % labels[0])) |
|
1479 | ui.write((' local: %s\n' % labels[0])) | |
1480 | ui.write((' other: %s\n' % labels[1])) |
|
1480 | ui.write((' other: %s\n' % labels[1])) | |
1481 | if len(labels) > 2: |
|
1481 | if len(labels) > 2: | |
1482 | ui.write((' base: %s\n' % labels[2])) |
|
1482 | ui.write((' base: %s\n' % labels[2])) | |
1483 | else: |
|
1483 | else: | |
1484 | ui.write(('unrecognized entry: %s\t%s\n') |
|
1484 | ui.write(('unrecognized entry: %s\t%s\n') | |
1485 | % (rtype, record.replace('\0', '\t'))) |
|
1485 | % (rtype, record.replace('\0', '\t'))) | |
1486 |
|
1486 | |||
1487 | # Avoid mergestate.read() since it may raise an exception for unsupported |
|
1487 | # Avoid mergestate.read() since it may raise an exception for unsupported | |
1488 | # merge state records. We shouldn't be doing this, but this is OK since this |
|
1488 | # merge state records. We shouldn't be doing this, but this is OK since this | |
1489 | # command is pretty low-level. |
|
1489 | # command is pretty low-level. | |
1490 | ms = mergemod.mergestate(repo) |
|
1490 | ms = mergemod.mergestate(repo) | |
1491 |
|
1491 | |||
1492 | # sort so that reasonable information is on top |
|
1492 | # sort so that reasonable information is on top | |
1493 | v1records = ms._readrecordsv1() |
|
1493 | v1records = ms._readrecordsv1() | |
1494 | v2records = ms._readrecordsv2() |
|
1494 | v2records = ms._readrecordsv2() | |
1495 | order = 'LOml' |
|
1495 | order = 'LOml' | |
1496 | def key(r): |
|
1496 | def key(r): | |
1497 | idx = order.find(r[0]) |
|
1497 | idx = order.find(r[0]) | |
1498 | if idx == -1: |
|
1498 | if idx == -1: | |
1499 | return (1, r[1]) |
|
1499 | return (1, r[1]) | |
1500 | else: |
|
1500 | else: | |
1501 | return (0, idx) |
|
1501 | return (0, idx) | |
1502 | v1records.sort(key=key) |
|
1502 | v1records.sort(key=key) | |
1503 | v2records.sort(key=key) |
|
1503 | v2records.sort(key=key) | |
1504 |
|
1504 | |||
1505 | if not v1records and not v2records: |
|
1505 | if not v1records and not v2records: | |
1506 | ui.write(('no merge state found\n')) |
|
1506 | ui.write(('no merge state found\n')) | |
1507 | elif not v2records: |
|
1507 | elif not v2records: | |
1508 | ui.note(('no version 2 merge state\n')) |
|
1508 | ui.note(('no version 2 merge state\n')) | |
1509 | printrecords(1) |
|
1509 | printrecords(1) | |
1510 | elif ms._v1v2match(v1records, v2records): |
|
1510 | elif ms._v1v2match(v1records, v2records): | |
1511 | ui.note(('v1 and v2 states match: using v2\n')) |
|
1511 | ui.note(('v1 and v2 states match: using v2\n')) | |
1512 | printrecords(2) |
|
1512 | printrecords(2) | |
1513 | else: |
|
1513 | else: | |
1514 | ui.note(('v1 and v2 states mismatch: using v1\n')) |
|
1514 | ui.note(('v1 and v2 states mismatch: using v1\n')) | |
1515 | printrecords(1) |
|
1515 | printrecords(1) | |
1516 | if ui.verbose: |
|
1516 | if ui.verbose: | |
1517 | printrecords(2) |
|
1517 | printrecords(2) | |
1518 |
|
1518 | |||
1519 | @command('debugnamecomplete', [], _('NAME...')) |
|
1519 | @command('debugnamecomplete', [], _('NAME...')) | |
1520 | def debugnamecomplete(ui, repo, *args): |
|
1520 | def debugnamecomplete(ui, repo, *args): | |
1521 | '''complete "names" - tags, open branch names, bookmark names''' |
|
1521 | '''complete "names" - tags, open branch names, bookmark names''' | |
1522 |
|
1522 | |||
1523 | names = set() |
|
1523 | names = set() | |
1524 | # since we previously only listed open branches, we will handle that |
|
1524 | # since we previously only listed open branches, we will handle that | |
1525 | # specially (after this for loop) |
|
1525 | # specially (after this for loop) | |
1526 | for name, ns in repo.names.iteritems(): |
|
1526 | for name, ns in repo.names.iteritems(): | |
1527 | if name != 'branches': |
|
1527 | if name != 'branches': | |
1528 | names.update(ns.listnames(repo)) |
|
1528 | names.update(ns.listnames(repo)) | |
1529 | names.update(tag for (tag, heads, tip, closed) |
|
1529 | names.update(tag for (tag, heads, tip, closed) | |
1530 | in repo.branchmap().iterbranches() if not closed) |
|
1530 | in repo.branchmap().iterbranches() if not closed) | |
1531 | completions = set() |
|
1531 | completions = set() | |
1532 | if not args: |
|
1532 | if not args: | |
1533 | args = [''] |
|
1533 | args = [''] | |
1534 | for a in args: |
|
1534 | for a in args: | |
1535 | completions.update(n for n in names if n.startswith(a)) |
|
1535 | completions.update(n for n in names if n.startswith(a)) | |
1536 | ui.write('\n'.join(sorted(completions))) |
|
1536 | ui.write('\n'.join(sorted(completions))) | |
1537 | ui.write('\n') |
|
1537 | ui.write('\n') | |
1538 |
|
1538 | |||
1539 | @command('debugobsolete', |
|
1539 | @command('debugobsolete', | |
1540 | [('', 'flags', 0, _('markers flag')), |
|
1540 | [('', 'flags', 0, _('markers flag')), | |
1541 | ('', 'record-parents', False, |
|
1541 | ('', 'record-parents', False, | |
1542 | _('record parent information for the precursor')), |
|
1542 | _('record parent information for the precursor')), | |
1543 | ('r', 'rev', [], _('display markers relevant to REV')), |
|
1543 | ('r', 'rev', [], _('display markers relevant to REV')), | |
1544 | ('', 'exclusive', False, _('restrict display to markers only ' |
|
1544 | ('', 'exclusive', False, _('restrict display to markers only ' | |
1545 | 'relevant to REV')), |
|
1545 | 'relevant to REV')), | |
1546 | ('', 'index', False, _('display index of the marker')), |
|
1546 | ('', 'index', False, _('display index of the marker')), | |
1547 | ('', 'delete', [], _('delete markers specified by indices')), |
|
1547 | ('', 'delete', [], _('delete markers specified by indices')), | |
1548 | ] + cmdutil.commitopts2 + cmdutil.formatteropts, |
|
1548 | ] + cmdutil.commitopts2 + cmdutil.formatteropts, | |
1549 | _('[OBSOLETED [REPLACEMENT ...]]')) |
|
1549 | _('[OBSOLETED [REPLACEMENT ...]]')) | |
1550 | def debugobsolete(ui, repo, precursor=None, *successors, **opts): |
|
1550 | def debugobsolete(ui, repo, precursor=None, *successors, **opts): | |
1551 | """create arbitrary obsolete marker |
|
1551 | """create arbitrary obsolete marker | |
1552 |
|
1552 | |||
1553 | With no arguments, displays the list of obsolescence markers.""" |
|
1553 | With no arguments, displays the list of obsolescence markers.""" | |
1554 |
|
1554 | |||
1555 | opts = pycompat.byteskwargs(opts) |
|
1555 | opts = pycompat.byteskwargs(opts) | |
1556 |
|
1556 | |||
1557 | def parsenodeid(s): |
|
1557 | def parsenodeid(s): | |
1558 | try: |
|
1558 | try: | |
1559 | # We do not use revsingle/revrange functions here to accept |
|
1559 | # We do not use revsingle/revrange functions here to accept | |
1560 | # arbitrary node identifiers, possibly not present in the |
|
1560 | # arbitrary node identifiers, possibly not present in the | |
1561 | # local repository. |
|
1561 | # local repository. | |
1562 | n = bin(s) |
|
1562 | n = bin(s) | |
1563 | if len(n) != len(nullid): |
|
1563 | if len(n) != len(nullid): | |
1564 | raise TypeError() |
|
1564 | raise TypeError() | |
1565 | return n |
|
1565 | return n | |
1566 | except TypeError: |
|
1566 | except TypeError: | |
1567 | raise error.Abort('changeset references must be full hexadecimal ' |
|
1567 | raise error.Abort('changeset references must be full hexadecimal ' | |
1568 | 'node identifiers') |
|
1568 | 'node identifiers') | |
1569 |
|
1569 | |||
1570 | if opts.get('delete'): |
|
1570 | if opts.get('delete'): | |
1571 | indices = [] |
|
1571 | indices = [] | |
1572 | for v in opts.get('delete'): |
|
1572 | for v in opts.get('delete'): | |
1573 | try: |
|
1573 | try: | |
1574 | indices.append(int(v)) |
|
1574 | indices.append(int(v)) | |
1575 | except ValueError: |
|
1575 | except ValueError: | |
1576 | raise error.Abort(_('invalid index value: %r') % v, |
|
1576 | raise error.Abort(_('invalid index value: %r') % v, | |
1577 | hint=_('use integers for indices')) |
|
1577 | hint=_('use integers for indices')) | |
1578 |
|
1578 | |||
1579 | if repo.currenttransaction(): |
|
1579 | if repo.currenttransaction(): | |
1580 | raise error.Abort(_('cannot delete obsmarkers in the middle ' |
|
1580 | raise error.Abort(_('cannot delete obsmarkers in the middle ' | |
1581 | 'of transaction.')) |
|
1581 | 'of transaction.')) | |
1582 |
|
1582 | |||
1583 | with repo.lock(): |
|
1583 | with repo.lock(): | |
1584 | n = repair.deleteobsmarkers(repo.obsstore, indices) |
|
1584 | n = repair.deleteobsmarkers(repo.obsstore, indices) | |
1585 | ui.write(_('deleted %i obsolescence markers\n') % n) |
|
1585 | ui.write(_('deleted %i obsolescence markers\n') % n) | |
1586 |
|
1586 | |||
1587 | return |
|
1587 | return | |
1588 |
|
1588 | |||
1589 | if precursor is not None: |
|
1589 | if precursor is not None: | |
1590 | if opts['rev']: |
|
1590 | if opts['rev']: | |
1591 | raise error.Abort('cannot select revision when creating marker') |
|
1591 | raise error.Abort('cannot select revision when creating marker') | |
1592 | metadata = {} |
|
1592 | metadata = {} | |
1593 | metadata['user'] = opts['user'] or ui.username() |
|
1593 | metadata['user'] = opts['user'] or ui.username() | |
1594 | succs = tuple(parsenodeid(succ) for succ in successors) |
|
1594 | succs = tuple(parsenodeid(succ) for succ in successors) | |
1595 | l = repo.lock() |
|
1595 | l = repo.lock() | |
1596 | try: |
|
1596 | try: | |
1597 | tr = repo.transaction('debugobsolete') |
|
1597 | tr = repo.transaction('debugobsolete') | |
1598 | try: |
|
1598 | try: | |
1599 | date = opts.get('date') |
|
1599 | date = opts.get('date') | |
1600 | if date: |
|
1600 | if date: | |
1601 | date = dateutil.parsedate(date) |
|
1601 | date = dateutil.parsedate(date) | |
1602 | else: |
|
1602 | else: | |
1603 | date = None |
|
1603 | date = None | |
1604 | prec = parsenodeid(precursor) |
|
1604 | prec = parsenodeid(precursor) | |
1605 | parents = None |
|
1605 | parents = None | |
1606 | if opts['record_parents']: |
|
1606 | if opts['record_parents']: | |
1607 | if prec not in repo.unfiltered(): |
|
1607 | if prec not in repo.unfiltered(): | |
1608 | raise error.Abort('cannot used --record-parents on ' |
|
1608 | raise error.Abort('cannot used --record-parents on ' | |
1609 | 'unknown changesets') |
|
1609 | 'unknown changesets') | |
1610 | parents = repo.unfiltered()[prec].parents() |
|
1610 | parents = repo.unfiltered()[prec].parents() | |
1611 | parents = tuple(p.node() for p in parents) |
|
1611 | parents = tuple(p.node() for p in parents) | |
1612 | repo.obsstore.create(tr, prec, succs, opts['flags'], |
|
1612 | repo.obsstore.create(tr, prec, succs, opts['flags'], | |
1613 | parents=parents, date=date, |
|
1613 | parents=parents, date=date, | |
1614 | metadata=metadata, ui=ui) |
|
1614 | metadata=metadata, ui=ui) | |
1615 | tr.close() |
|
1615 | tr.close() | |
1616 | except ValueError as exc: |
|
1616 | except ValueError as exc: | |
1617 | raise error.Abort(_('bad obsmarker input: %s') % |
|
1617 | raise error.Abort(_('bad obsmarker input: %s') % | |
1618 | pycompat.bytestr(exc)) |
|
1618 | pycompat.bytestr(exc)) | |
1619 | finally: |
|
1619 | finally: | |
1620 | tr.release() |
|
1620 | tr.release() | |
1621 | finally: |
|
1621 | finally: | |
1622 | l.release() |
|
1622 | l.release() | |
1623 | else: |
|
1623 | else: | |
1624 | if opts['rev']: |
|
1624 | if opts['rev']: | |
1625 | revs = scmutil.revrange(repo, opts['rev']) |
|
1625 | revs = scmutil.revrange(repo, opts['rev']) | |
1626 | nodes = [repo[r].node() for r in revs] |
|
1626 | nodes = [repo[r].node() for r in revs] | |
1627 | markers = list(obsutil.getmarkers(repo, nodes=nodes, |
|
1627 | markers = list(obsutil.getmarkers(repo, nodes=nodes, | |
1628 | exclusive=opts['exclusive'])) |
|
1628 | exclusive=opts['exclusive'])) | |
1629 | markers.sort(key=lambda x: x._data) |
|
1629 | markers.sort(key=lambda x: x._data) | |
1630 | else: |
|
1630 | else: | |
1631 | markers = obsutil.getmarkers(repo) |
|
1631 | markers = obsutil.getmarkers(repo) | |
1632 |
|
1632 | |||
1633 | markerstoiter = markers |
|
1633 | markerstoiter = markers | |
1634 | isrelevant = lambda m: True |
|
1634 | isrelevant = lambda m: True | |
1635 | if opts.get('rev') and opts.get('index'): |
|
1635 | if opts.get('rev') and opts.get('index'): | |
1636 | markerstoiter = obsutil.getmarkers(repo) |
|
1636 | markerstoiter = obsutil.getmarkers(repo) | |
1637 | markerset = set(markers) |
|
1637 | markerset = set(markers) | |
1638 | isrelevant = lambda m: m in markerset |
|
1638 | isrelevant = lambda m: m in markerset | |
1639 |
|
1639 | |||
1640 | fm = ui.formatter('debugobsolete', opts) |
|
1640 | fm = ui.formatter('debugobsolete', opts) | |
1641 | for i, m in enumerate(markerstoiter): |
|
1641 | for i, m in enumerate(markerstoiter): | |
1642 | if not isrelevant(m): |
|
1642 | if not isrelevant(m): | |
1643 | # marker can be irrelevant when we're iterating over a set |
|
1643 | # marker can be irrelevant when we're iterating over a set | |
1644 | # of markers (markerstoiter) which is bigger than the set |
|
1644 | # of markers (markerstoiter) which is bigger than the set | |
1645 | # of markers we want to display (markers) |
|
1645 | # of markers we want to display (markers) | |
1646 | # this can happen if both --index and --rev options are |
|
1646 | # this can happen if both --index and --rev options are | |
1647 | # provided and thus we need to iterate over all of the markers |
|
1647 | # provided and thus we need to iterate over all of the markers | |
1648 | # to get the correct indices, but only display the ones that |
|
1648 | # to get the correct indices, but only display the ones that | |
1649 | # are relevant to --rev value |
|
1649 | # are relevant to --rev value | |
1650 | continue |
|
1650 | continue | |
1651 | fm.startitem() |
|
1651 | fm.startitem() | |
1652 | ind = i if opts.get('index') else None |
|
1652 | ind = i if opts.get('index') else None | |
1653 | cmdutil.showmarker(fm, m, index=ind) |
|
1653 | cmdutil.showmarker(fm, m, index=ind) | |
1654 | fm.end() |
|
1654 | fm.end() | |
1655 |
|
1655 | |||
1656 | @command('debugpathcomplete', |
|
1656 | @command('debugpathcomplete', | |
1657 | [('f', 'full', None, _('complete an entire path')), |
|
1657 | [('f', 'full', None, _('complete an entire path')), | |
1658 | ('n', 'normal', None, _('show only normal files')), |
|
1658 | ('n', 'normal', None, _('show only normal files')), | |
1659 | ('a', 'added', None, _('show only added files')), |
|
1659 | ('a', 'added', None, _('show only added files')), | |
1660 | ('r', 'removed', None, _('show only removed files'))], |
|
1660 | ('r', 'removed', None, _('show only removed files'))], | |
1661 | _('FILESPEC...')) |
|
1661 | _('FILESPEC...')) | |
1662 | def debugpathcomplete(ui, repo, *specs, **opts): |
|
1662 | def debugpathcomplete(ui, repo, *specs, **opts): | |
1663 | '''complete part or all of a tracked path |
|
1663 | '''complete part or all of a tracked path | |
1664 |
|
1664 | |||
1665 | This command supports shells that offer path name completion. It |
|
1665 | This command supports shells that offer path name completion. It | |
1666 | currently completes only files already known to the dirstate. |
|
1666 | currently completes only files already known to the dirstate. | |
1667 |
|
1667 | |||
1668 | Completion extends only to the next path segment unless |
|
1668 | Completion extends only to the next path segment unless | |
1669 | --full is specified, in which case entire paths are used.''' |
|
1669 | --full is specified, in which case entire paths are used.''' | |
1670 |
|
1670 | |||
1671 | def complete(path, acceptable): |
|
1671 | def complete(path, acceptable): | |
1672 | dirstate = repo.dirstate |
|
1672 | dirstate = repo.dirstate | |
1673 | spec = os.path.normpath(os.path.join(pycompat.getcwd(), path)) |
|
1673 | spec = os.path.normpath(os.path.join(pycompat.getcwd(), path)) | |
1674 | rootdir = repo.root + pycompat.ossep |
|
1674 | rootdir = repo.root + pycompat.ossep | |
1675 | if spec != repo.root and not spec.startswith(rootdir): |
|
1675 | if spec != repo.root and not spec.startswith(rootdir): | |
1676 | return [], [] |
|
1676 | return [], [] | |
1677 | if os.path.isdir(spec): |
|
1677 | if os.path.isdir(spec): | |
1678 | spec += '/' |
|
1678 | spec += '/' | |
1679 | spec = spec[len(rootdir):] |
|
1679 | spec = spec[len(rootdir):] | |
1680 | fixpaths = pycompat.ossep != '/' |
|
1680 | fixpaths = pycompat.ossep != '/' | |
1681 | if fixpaths: |
|
1681 | if fixpaths: | |
1682 | spec = spec.replace(pycompat.ossep, '/') |
|
1682 | spec = spec.replace(pycompat.ossep, '/') | |
1683 | speclen = len(spec) |
|
1683 | speclen = len(spec) | |
1684 | fullpaths = opts[r'full'] |
|
1684 | fullpaths = opts[r'full'] | |
1685 | files, dirs = set(), set() |
|
1685 | files, dirs = set(), set() | |
1686 | adddir, addfile = dirs.add, files.add |
|
1686 | adddir, addfile = dirs.add, files.add | |
1687 | for f, st in dirstate.iteritems(): |
|
1687 | for f, st in dirstate.iteritems(): | |
1688 | if f.startswith(spec) and st[0] in acceptable: |
|
1688 | if f.startswith(spec) and st[0] in acceptable: | |
1689 | if fixpaths: |
|
1689 | if fixpaths: | |
1690 | f = f.replace('/', pycompat.ossep) |
|
1690 | f = f.replace('/', pycompat.ossep) | |
1691 | if fullpaths: |
|
1691 | if fullpaths: | |
1692 | addfile(f) |
|
1692 | addfile(f) | |
1693 | continue |
|
1693 | continue | |
1694 | s = f.find(pycompat.ossep, speclen) |
|
1694 | s = f.find(pycompat.ossep, speclen) | |
1695 | if s >= 0: |
|
1695 | if s >= 0: | |
1696 | adddir(f[:s]) |
|
1696 | adddir(f[:s]) | |
1697 | else: |
|
1697 | else: | |
1698 | addfile(f) |
|
1698 | addfile(f) | |
1699 | return files, dirs |
|
1699 | return files, dirs | |
1700 |
|
1700 | |||
1701 | acceptable = '' |
|
1701 | acceptable = '' | |
1702 | if opts[r'normal']: |
|
1702 | if opts[r'normal']: | |
1703 | acceptable += 'nm' |
|
1703 | acceptable += 'nm' | |
1704 | if opts[r'added']: |
|
1704 | if opts[r'added']: | |
1705 | acceptable += 'a' |
|
1705 | acceptable += 'a' | |
1706 | if opts[r'removed']: |
|
1706 | if opts[r'removed']: | |
1707 | acceptable += 'r' |
|
1707 | acceptable += 'r' | |
1708 | cwd = repo.getcwd() |
|
1708 | cwd = repo.getcwd() | |
1709 | if not specs: |
|
1709 | if not specs: | |
1710 | specs = ['.'] |
|
1710 | specs = ['.'] | |
1711 |
|
1711 | |||
1712 | files, dirs = set(), set() |
|
1712 | files, dirs = set(), set() | |
1713 | for spec in specs: |
|
1713 | for spec in specs: | |
1714 | f, d = complete(spec, acceptable or 'nmar') |
|
1714 | f, d = complete(spec, acceptable or 'nmar') | |
1715 | files.update(f) |
|
1715 | files.update(f) | |
1716 | dirs.update(d) |
|
1716 | dirs.update(d) | |
1717 | files.update(dirs) |
|
1717 | files.update(dirs) | |
1718 | ui.write('\n'.join(repo.pathto(p, cwd) for p in sorted(files))) |
|
1718 | ui.write('\n'.join(repo.pathto(p, cwd) for p in sorted(files))) | |
1719 | ui.write('\n') |
|
1719 | ui.write('\n') | |
1720 |
|
1720 | |||
1721 | @command('debugpeer', [], _('PATH'), norepo=True) |
|
1721 | @command('debugpeer', [], _('PATH'), norepo=True) | |
1722 | def debugpeer(ui, path): |
|
1722 | def debugpeer(ui, path): | |
1723 | """establish a connection to a peer repository""" |
|
1723 | """establish a connection to a peer repository""" | |
1724 | # Always enable peer request logging. Requires --debug to display |
|
1724 | # Always enable peer request logging. Requires --debug to display | |
1725 | # though. |
|
1725 | # though. | |
1726 | overrides = { |
|
1726 | overrides = { | |
1727 | ('devel', 'debug.peer-request'): True, |
|
1727 | ('devel', 'debug.peer-request'): True, | |
1728 | } |
|
1728 | } | |
1729 |
|
1729 | |||
1730 | with ui.configoverride(overrides): |
|
1730 | with ui.configoverride(overrides): | |
1731 | peer = hg.peer(ui, {}, path) |
|
1731 | peer = hg.peer(ui, {}, path) | |
1732 |
|
1732 | |||
1733 | local = peer.local() is not None |
|
1733 | local = peer.local() is not None | |
1734 | canpush = peer.canpush() |
|
1734 | canpush = peer.canpush() | |
1735 |
|
1735 | |||
1736 | ui.write(_('url: %s\n') % peer.url()) |
|
1736 | ui.write(_('url: %s\n') % peer.url()) | |
1737 | ui.write(_('local: %s\n') % (_('yes') if local else _('no'))) |
|
1737 | ui.write(_('local: %s\n') % (_('yes') if local else _('no'))) | |
1738 | ui.write(_('pushable: %s\n') % (_('yes') if canpush else _('no'))) |
|
1738 | ui.write(_('pushable: %s\n') % (_('yes') if canpush else _('no'))) | |
1739 |
|
1739 | |||
1740 | @command('debugpickmergetool', |
|
1740 | @command('debugpickmergetool', | |
1741 | [('r', 'rev', '', _('check for files in this revision'), _('REV')), |
|
1741 | [('r', 'rev', '', _('check for files in this revision'), _('REV')), | |
1742 | ('', 'changedelete', None, _('emulate merging change and delete')), |
|
1742 | ('', 'changedelete', None, _('emulate merging change and delete')), | |
1743 | ] + cmdutil.walkopts + cmdutil.mergetoolopts, |
|
1743 | ] + cmdutil.walkopts + cmdutil.mergetoolopts, | |
1744 | _('[PATTERN]...'), |
|
1744 | _('[PATTERN]...'), | |
1745 | inferrepo=True) |
|
1745 | inferrepo=True) | |
1746 | def debugpickmergetool(ui, repo, *pats, **opts): |
|
1746 | def debugpickmergetool(ui, repo, *pats, **opts): | |
1747 | """examine which merge tool is chosen for specified file |
|
1747 | """examine which merge tool is chosen for specified file | |
1748 |
|
1748 | |||
1749 | As described in :hg:`help merge-tools`, Mercurial examines |
|
1749 | As described in :hg:`help merge-tools`, Mercurial examines | |
1750 | configurations below in this order to decide which merge tool is |
|
1750 | configurations below in this order to decide which merge tool is | |
1751 | chosen for specified file. |
|
1751 | chosen for specified file. | |
1752 |
|
1752 | |||
1753 | 1. ``--tool`` option |
|
1753 | 1. ``--tool`` option | |
1754 | 2. ``HGMERGE`` environment variable |
|
1754 | 2. ``HGMERGE`` environment variable | |
1755 | 3. configurations in ``merge-patterns`` section |
|
1755 | 3. configurations in ``merge-patterns`` section | |
1756 | 4. configuration of ``ui.merge`` |
|
1756 | 4. configuration of ``ui.merge`` | |
1757 | 5. configurations in ``merge-tools`` section |
|
1757 | 5. configurations in ``merge-tools`` section | |
1758 | 6. ``hgmerge`` tool (for historical reason only) |
|
1758 | 6. ``hgmerge`` tool (for historical reason only) | |
1759 | 7. default tool for fallback (``:merge`` or ``:prompt``) |
|
1759 | 7. default tool for fallback (``:merge`` or ``:prompt``) | |
1760 |
|
1760 | |||
1761 | This command writes out examination result in the style below:: |
|
1761 | This command writes out examination result in the style below:: | |
1762 |
|
1762 | |||
1763 | FILE = MERGETOOL |
|
1763 | FILE = MERGETOOL | |
1764 |
|
1764 | |||
1765 | By default, all files known in the first parent context of the |
|
1765 | By default, all files known in the first parent context of the | |
1766 | working directory are examined. Use file patterns and/or -I/-X |
|
1766 | working directory are examined. Use file patterns and/or -I/-X | |
1767 | options to limit target files. -r/--rev is also useful to examine |
|
1767 | options to limit target files. -r/--rev is also useful to examine | |
1768 | files in another context without actual updating to it. |
|
1768 | files in another context without actual updating to it. | |
1769 |
|
1769 | |||
1770 | With --debug, this command shows warning messages while matching |
|
1770 | With --debug, this command shows warning messages while matching | |
1771 | against ``merge-patterns`` and so on, too. It is recommended to |
|
1771 | against ``merge-patterns`` and so on, too. It is recommended to | |
1772 | use this option with explicit file patterns and/or -I/-X options, |
|
1772 | use this option with explicit file patterns and/or -I/-X options, | |
1773 | because this option increases amount of output per file according |
|
1773 | because this option increases amount of output per file according | |
1774 | to configurations in hgrc. |
|
1774 | to configurations in hgrc. | |
1775 |
|
1775 | |||
1776 | With -v/--verbose, this command shows configurations below at |
|
1776 | With -v/--verbose, this command shows configurations below at | |
1777 | first (only if specified). |
|
1777 | first (only if specified). | |
1778 |
|
1778 | |||
1779 | - ``--tool`` option |
|
1779 | - ``--tool`` option | |
1780 | - ``HGMERGE`` environment variable |
|
1780 | - ``HGMERGE`` environment variable | |
1781 | - configuration of ``ui.merge`` |
|
1781 | - configuration of ``ui.merge`` | |
1782 |
|
1782 | |||
1783 | If merge tool is chosen before matching against |
|
1783 | If merge tool is chosen before matching against | |
1784 | ``merge-patterns``, this command can't show any helpful |
|
1784 | ``merge-patterns``, this command can't show any helpful | |
1785 | information, even with --debug. In such case, information above is |
|
1785 | information, even with --debug. In such case, information above is | |
1786 | useful to know why a merge tool is chosen. |
|
1786 | useful to know why a merge tool is chosen. | |
1787 | """ |
|
1787 | """ | |
1788 | opts = pycompat.byteskwargs(opts) |
|
1788 | opts = pycompat.byteskwargs(opts) | |
1789 | overrides = {} |
|
1789 | overrides = {} | |
1790 | if opts['tool']: |
|
1790 | if opts['tool']: | |
1791 | overrides[('ui', 'forcemerge')] = opts['tool'] |
|
1791 | overrides[('ui', 'forcemerge')] = opts['tool'] | |
1792 | ui.note(('with --tool %r\n') % (pycompat.bytestr(opts['tool']))) |
|
1792 | ui.note(('with --tool %r\n') % (pycompat.bytestr(opts['tool']))) | |
1793 |
|
1793 | |||
1794 | with ui.configoverride(overrides, 'debugmergepatterns'): |
|
1794 | with ui.configoverride(overrides, 'debugmergepatterns'): | |
1795 | hgmerge = encoding.environ.get("HGMERGE") |
|
1795 | hgmerge = encoding.environ.get("HGMERGE") | |
1796 | if hgmerge is not None: |
|
1796 | if hgmerge is not None: | |
1797 | ui.note(('with HGMERGE=%r\n') % (pycompat.bytestr(hgmerge))) |
|
1797 | ui.note(('with HGMERGE=%r\n') % (pycompat.bytestr(hgmerge))) | |
1798 | uimerge = ui.config("ui", "merge") |
|
1798 | uimerge = ui.config("ui", "merge") | |
1799 | if uimerge: |
|
1799 | if uimerge: | |
1800 | ui.note(('with ui.merge=%r\n') % (pycompat.bytestr(uimerge))) |
|
1800 | ui.note(('with ui.merge=%r\n') % (pycompat.bytestr(uimerge))) | |
1801 |
|
1801 | |||
1802 | ctx = scmutil.revsingle(repo, opts.get('rev')) |
|
1802 | ctx = scmutil.revsingle(repo, opts.get('rev')) | |
1803 | m = scmutil.match(ctx, pats, opts) |
|
1803 | m = scmutil.match(ctx, pats, opts) | |
1804 | changedelete = opts['changedelete'] |
|
1804 | changedelete = opts['changedelete'] | |
1805 | for path in ctx.walk(m): |
|
1805 | for path in ctx.walk(m): | |
1806 | fctx = ctx[path] |
|
1806 | fctx = ctx[path] | |
1807 | try: |
|
1807 | try: | |
1808 | if not ui.debugflag: |
|
1808 | if not ui.debugflag: | |
1809 | ui.pushbuffer(error=True) |
|
1809 | ui.pushbuffer(error=True) | |
1810 | tool, toolpath = filemerge._picktool(repo, ui, path, |
|
1810 | tool, toolpath = filemerge._picktool(repo, ui, path, | |
1811 | fctx.isbinary(), |
|
1811 | fctx.isbinary(), | |
1812 | 'l' in fctx.flags(), |
|
1812 | 'l' in fctx.flags(), | |
1813 | changedelete) |
|
1813 | changedelete) | |
1814 | finally: |
|
1814 | finally: | |
1815 | if not ui.debugflag: |
|
1815 | if not ui.debugflag: | |
1816 | ui.popbuffer() |
|
1816 | ui.popbuffer() | |
1817 | ui.write(('%s = %s\n') % (path, tool)) |
|
1817 | ui.write(('%s = %s\n') % (path, tool)) | |
1818 |
|
1818 | |||
1819 | @command('debugpushkey', [], _('REPO NAMESPACE [KEY OLD NEW]'), norepo=True) |
|
1819 | @command('debugpushkey', [], _('REPO NAMESPACE [KEY OLD NEW]'), norepo=True) | |
1820 | def debugpushkey(ui, repopath, namespace, *keyinfo, **opts): |
|
1820 | def debugpushkey(ui, repopath, namespace, *keyinfo, **opts): | |
1821 | '''access the pushkey key/value protocol |
|
1821 | '''access the pushkey key/value protocol | |
1822 |
|
1822 | |||
1823 | With two args, list the keys in the given namespace. |
|
1823 | With two args, list the keys in the given namespace. | |
1824 |
|
1824 | |||
1825 | With five args, set a key to new if it currently is set to old. |
|
1825 | With five args, set a key to new if it currently is set to old. | |
1826 | Reports success or failure. |
|
1826 | Reports success or failure. | |
1827 | ''' |
|
1827 | ''' | |
1828 |
|
1828 | |||
1829 | target = hg.peer(ui, {}, repopath) |
|
1829 | target = hg.peer(ui, {}, repopath) | |
1830 | if keyinfo: |
|
1830 | if keyinfo: | |
1831 | key, old, new = keyinfo |
|
1831 | key, old, new = keyinfo | |
1832 | r = target.pushkey(namespace, key, old, new) |
|
1832 | r = target.pushkey(namespace, key, old, new) | |
1833 | ui.status(pycompat.bytestr(r) + '\n') |
|
1833 | ui.status(pycompat.bytestr(r) + '\n') | |
1834 | return not r |
|
1834 | return not r | |
1835 | else: |
|
1835 | else: | |
1836 | for k, v in sorted(target.listkeys(namespace).iteritems()): |
|
1836 | for k, v in sorted(target.listkeys(namespace).iteritems()): | |
1837 | ui.write("%s\t%s\n" % (stringutil.escapestr(k), |
|
1837 | ui.write("%s\t%s\n" % (stringutil.escapestr(k), | |
1838 | stringutil.escapestr(v))) |
|
1838 | stringutil.escapestr(v))) | |
1839 |
|
1839 | |||
1840 | @command('debugpvec', [], _('A B')) |
|
1840 | @command('debugpvec', [], _('A B')) | |
1841 | def debugpvec(ui, repo, a, b=None): |
|
1841 | def debugpvec(ui, repo, a, b=None): | |
1842 | ca = scmutil.revsingle(repo, a) |
|
1842 | ca = scmutil.revsingle(repo, a) | |
1843 | cb = scmutil.revsingle(repo, b) |
|
1843 | cb = scmutil.revsingle(repo, b) | |
1844 | pa = pvec.ctxpvec(ca) |
|
1844 | pa = pvec.ctxpvec(ca) | |
1845 | pb = pvec.ctxpvec(cb) |
|
1845 | pb = pvec.ctxpvec(cb) | |
1846 | if pa == pb: |
|
1846 | if pa == pb: | |
1847 | rel = "=" |
|
1847 | rel = "=" | |
1848 | elif pa > pb: |
|
1848 | elif pa > pb: | |
1849 | rel = ">" |
|
1849 | rel = ">" | |
1850 | elif pa < pb: |
|
1850 | elif pa < pb: | |
1851 | rel = "<" |
|
1851 | rel = "<" | |
1852 | elif pa | pb: |
|
1852 | elif pa | pb: | |
1853 | rel = "|" |
|
1853 | rel = "|" | |
1854 | ui.write(_("a: %s\n") % pa) |
|
1854 | ui.write(_("a: %s\n") % pa) | |
1855 | ui.write(_("b: %s\n") % pb) |
|
1855 | ui.write(_("b: %s\n") % pb) | |
1856 | ui.write(_("depth(a): %d depth(b): %d\n") % (pa._depth, pb._depth)) |
|
1856 | ui.write(_("depth(a): %d depth(b): %d\n") % (pa._depth, pb._depth)) | |
1857 | ui.write(_("delta: %d hdist: %d distance: %d relation: %s\n") % |
|
1857 | ui.write(_("delta: %d hdist: %d distance: %d relation: %s\n") % | |
1858 | (abs(pa._depth - pb._depth), pvec._hamming(pa._vec, pb._vec), |
|
1858 | (abs(pa._depth - pb._depth), pvec._hamming(pa._vec, pb._vec), | |
1859 | pa.distance(pb), rel)) |
|
1859 | pa.distance(pb), rel)) | |
1860 |
|
1860 | |||
1861 | @command('debugrebuilddirstate|debugrebuildstate', |
|
1861 | @command('debugrebuilddirstate|debugrebuildstate', | |
1862 | [('r', 'rev', '', _('revision to rebuild to'), _('REV')), |
|
1862 | [('r', 'rev', '', _('revision to rebuild to'), _('REV')), | |
1863 | ('', 'minimal', None, _('only rebuild files that are inconsistent with ' |
|
1863 | ('', 'minimal', None, _('only rebuild files that are inconsistent with ' | |
1864 | 'the working copy parent')), |
|
1864 | 'the working copy parent')), | |
1865 | ], |
|
1865 | ], | |
1866 | _('[-r REV]')) |
|
1866 | _('[-r REV]')) | |
1867 | def debugrebuilddirstate(ui, repo, rev, **opts): |
|
1867 | def debugrebuilddirstate(ui, repo, rev, **opts): | |
1868 | """rebuild the dirstate as it would look like for the given revision |
|
1868 | """rebuild the dirstate as it would look like for the given revision | |
1869 |
|
1869 | |||
1870 | If no revision is specified the first current parent will be used. |
|
1870 | If no revision is specified the first current parent will be used. | |
1871 |
|
1871 | |||
1872 | The dirstate will be set to the files of the given revision. |
|
1872 | The dirstate will be set to the files of the given revision. | |
1873 | The actual working directory content or existing dirstate |
|
1873 | The actual working directory content or existing dirstate | |
1874 | information such as adds or removes is not considered. |
|
1874 | information such as adds or removes is not considered. | |
1875 |
|
1875 | |||
1876 | ``minimal`` will only rebuild the dirstate status for files that claim to be |
|
1876 | ``minimal`` will only rebuild the dirstate status for files that claim to be | |
1877 | tracked but are not in the parent manifest, or that exist in the parent |
|
1877 | tracked but are not in the parent manifest, or that exist in the parent | |
1878 | manifest but are not in the dirstate. It will not change adds, removes, or |
|
1878 | manifest but are not in the dirstate. It will not change adds, removes, or | |
1879 | modified files that are in the working copy parent. |
|
1879 | modified files that are in the working copy parent. | |
1880 |
|
1880 | |||
1881 | One use of this command is to make the next :hg:`status` invocation |
|
1881 | One use of this command is to make the next :hg:`status` invocation | |
1882 | check the actual file content. |
|
1882 | check the actual file content. | |
1883 | """ |
|
1883 | """ | |
1884 | ctx = scmutil.revsingle(repo, rev) |
|
1884 | ctx = scmutil.revsingle(repo, rev) | |
1885 | with repo.wlock(): |
|
1885 | with repo.wlock(): | |
1886 | dirstate = repo.dirstate |
|
1886 | dirstate = repo.dirstate | |
1887 | changedfiles = None |
|
1887 | changedfiles = None | |
1888 | # See command doc for what minimal does. |
|
1888 | # See command doc for what minimal does. | |
1889 | if opts.get(r'minimal'): |
|
1889 | if opts.get(r'minimal'): | |
1890 | manifestfiles = set(ctx.manifest().keys()) |
|
1890 | manifestfiles = set(ctx.manifest().keys()) | |
1891 | dirstatefiles = set(dirstate) |
|
1891 | dirstatefiles = set(dirstate) | |
1892 | manifestonly = manifestfiles - dirstatefiles |
|
1892 | manifestonly = manifestfiles - dirstatefiles | |
1893 | dsonly = dirstatefiles - manifestfiles |
|
1893 | dsonly = dirstatefiles - manifestfiles | |
1894 | dsnotadded = set(f for f in dsonly if dirstate[f] != 'a') |
|
1894 | dsnotadded = set(f for f in dsonly if dirstate[f] != 'a') | |
1895 | changedfiles = manifestonly | dsnotadded |
|
1895 | changedfiles = manifestonly | dsnotadded | |
1896 |
|
1896 | |||
1897 | dirstate.rebuild(ctx.node(), ctx.manifest(), changedfiles) |
|
1897 | dirstate.rebuild(ctx.node(), ctx.manifest(), changedfiles) | |
1898 |
|
1898 | |||
1899 | @command('debugrebuildfncache', [], '') |
|
1899 | @command('debugrebuildfncache', [], '') | |
1900 | def debugrebuildfncache(ui, repo): |
|
1900 | def debugrebuildfncache(ui, repo): | |
1901 | """rebuild the fncache file""" |
|
1901 | """rebuild the fncache file""" | |
1902 | repair.rebuildfncache(ui, repo) |
|
1902 | repair.rebuildfncache(ui, repo) | |
1903 |
|
1903 | |||
1904 | @command('debugrename', |
|
1904 | @command('debugrename', | |
1905 | [('r', 'rev', '', _('revision to debug'), _('REV'))], |
|
1905 | [('r', 'rev', '', _('revision to debug'), _('REV'))], | |
1906 | _('[-r REV] FILE')) |
|
1906 | _('[-r REV] FILE')) | |
1907 | def debugrename(ui, repo, file1, *pats, **opts): |
|
1907 | def debugrename(ui, repo, file1, *pats, **opts): | |
1908 | """dump rename information""" |
|
1908 | """dump rename information""" | |
1909 |
|
1909 | |||
1910 | opts = pycompat.byteskwargs(opts) |
|
1910 | opts = pycompat.byteskwargs(opts) | |
1911 | ctx = scmutil.revsingle(repo, opts.get('rev')) |
|
1911 | ctx = scmutil.revsingle(repo, opts.get('rev')) | |
1912 | m = scmutil.match(ctx, (file1,) + pats, opts) |
|
1912 | m = scmutil.match(ctx, (file1,) + pats, opts) | |
1913 | for abs in ctx.walk(m): |
|
1913 | for abs in ctx.walk(m): | |
1914 | fctx = ctx[abs] |
|
1914 | fctx = ctx[abs] | |
1915 | o = fctx.filelog().renamed(fctx.filenode()) |
|
1915 | o = fctx.filelog().renamed(fctx.filenode()) | |
1916 | rel = m.rel(abs) |
|
1916 | rel = m.rel(abs) | |
1917 | if o: |
|
1917 | if o: | |
1918 | ui.write(_("%s renamed from %s:%s\n") % (rel, o[0], hex(o[1]))) |
|
1918 | ui.write(_("%s renamed from %s:%s\n") % (rel, o[0], hex(o[1]))) | |
1919 | else: |
|
1919 | else: | |
1920 | ui.write(_("%s not renamed\n") % rel) |
|
1920 | ui.write(_("%s not renamed\n") % rel) | |
1921 |
|
1921 | |||
1922 | @command('debugrevlog', cmdutil.debugrevlogopts + |
|
1922 | @command('debugrevlog', cmdutil.debugrevlogopts + | |
1923 | [('d', 'dump', False, _('dump index data'))], |
|
1923 | [('d', 'dump', False, _('dump index data'))], | |
1924 | _('-c|-m|FILE'), |
|
1924 | _('-c|-m|FILE'), | |
1925 | optionalrepo=True) |
|
1925 | optionalrepo=True) | |
1926 | def debugrevlog(ui, repo, file_=None, **opts): |
|
1926 | def debugrevlog(ui, repo, file_=None, **opts): | |
1927 | """show data and statistics about a revlog""" |
|
1927 | """show data and statistics about a revlog""" | |
1928 | opts = pycompat.byteskwargs(opts) |
|
1928 | opts = pycompat.byteskwargs(opts) | |
1929 | r = cmdutil.openrevlog(repo, 'debugrevlog', file_, opts) |
|
1929 | r = cmdutil.openrevlog(repo, 'debugrevlog', file_, opts) | |
1930 |
|
1930 | |||
1931 | if opts.get("dump"): |
|
1931 | if opts.get("dump"): | |
1932 | numrevs = len(r) |
|
1932 | numrevs = len(r) | |
1933 | ui.write(("# rev p1rev p2rev start end deltastart base p1 p2" |
|
1933 | ui.write(("# rev p1rev p2rev start end deltastart base p1 p2" | |
1934 | " rawsize totalsize compression heads chainlen\n")) |
|
1934 | " rawsize totalsize compression heads chainlen\n")) | |
1935 | ts = 0 |
|
1935 | ts = 0 | |
1936 | heads = set() |
|
1936 | heads = set() | |
1937 |
|
1937 | |||
1938 | for rev in xrange(numrevs): |
|
1938 | for rev in xrange(numrevs): | |
1939 | dbase = r.deltaparent(rev) |
|
1939 | dbase = r.deltaparent(rev) | |
1940 | if dbase == -1: |
|
1940 | if dbase == -1: | |
1941 | dbase = rev |
|
1941 | dbase = rev | |
1942 | cbase = r.chainbase(rev) |
|
1942 | cbase = r.chainbase(rev) | |
1943 | clen = r.chainlen(rev) |
|
1943 | clen = r.chainlen(rev) | |
1944 | p1, p2 = r.parentrevs(rev) |
|
1944 | p1, p2 = r.parentrevs(rev) | |
1945 | rs = r.rawsize(rev) |
|
1945 | rs = r.rawsize(rev) | |
1946 | ts = ts + rs |
|
1946 | ts = ts + rs | |
1947 | heads -= set(r.parentrevs(rev)) |
|
1947 | heads -= set(r.parentrevs(rev)) | |
1948 | heads.add(rev) |
|
1948 | heads.add(rev) | |
1949 | try: |
|
1949 | try: | |
1950 | compression = ts / r.end(rev) |
|
1950 | compression = ts / r.end(rev) | |
1951 | except ZeroDivisionError: |
|
1951 | except ZeroDivisionError: | |
1952 | compression = 0 |
|
1952 | compression = 0 | |
1953 | ui.write("%5d %5d %5d %5d %5d %10d %4d %4d %4d %7d %9d " |
|
1953 | ui.write("%5d %5d %5d %5d %5d %10d %4d %4d %4d %7d %9d " | |
1954 | "%11d %5d %8d\n" % |
|
1954 | "%11d %5d %8d\n" % | |
1955 | (rev, p1, p2, r.start(rev), r.end(rev), |
|
1955 | (rev, p1, p2, r.start(rev), r.end(rev), | |
1956 | r.start(dbase), r.start(cbase), |
|
1956 | r.start(dbase), r.start(cbase), | |
1957 | r.start(p1), r.start(p2), |
|
1957 | r.start(p1), r.start(p2), | |
1958 | rs, ts, compression, len(heads), clen)) |
|
1958 | rs, ts, compression, len(heads), clen)) | |
1959 | return 0 |
|
1959 | return 0 | |
1960 |
|
1960 | |||
1961 | v = r.version |
|
1961 | v = r.version | |
1962 | format = v & 0xFFFF |
|
1962 | format = v & 0xFFFF | |
1963 | flags = [] |
|
1963 | flags = [] | |
1964 | gdelta = False |
|
1964 | gdelta = False | |
1965 | if v & revlog.FLAG_INLINE_DATA: |
|
1965 | if v & revlog.FLAG_INLINE_DATA: | |
1966 | flags.append('inline') |
|
1966 | flags.append('inline') | |
1967 | if v & revlog.FLAG_GENERALDELTA: |
|
1967 | if v & revlog.FLAG_GENERALDELTA: | |
1968 | gdelta = True |
|
1968 | gdelta = True | |
1969 | flags.append('generaldelta') |
|
1969 | flags.append('generaldelta') | |
1970 | if not flags: |
|
1970 | if not flags: | |
1971 | flags = ['(none)'] |
|
1971 | flags = ['(none)'] | |
1972 |
|
1972 | |||
1973 | nummerges = 0 |
|
1973 | nummerges = 0 | |
1974 | numfull = 0 |
|
1974 | numfull = 0 | |
1975 | numprev = 0 |
|
1975 | numprev = 0 | |
1976 | nump1 = 0 |
|
1976 | nump1 = 0 | |
1977 | nump2 = 0 |
|
1977 | nump2 = 0 | |
1978 | numother = 0 |
|
1978 | numother = 0 | |
1979 | nump1prev = 0 |
|
1979 | nump1prev = 0 | |
1980 | nump2prev = 0 |
|
1980 | nump2prev = 0 | |
1981 | chainlengths = [] |
|
1981 | chainlengths = [] | |
1982 | chainbases = [] |
|
1982 | chainbases = [] | |
1983 | chainspans = [] |
|
1983 | chainspans = [] | |
1984 |
|
1984 | |||
1985 | datasize = [None, 0, 0] |
|
1985 | datasize = [None, 0, 0] | |
1986 | fullsize = [None, 0, 0] |
|
1986 | fullsize = [None, 0, 0] | |
1987 | deltasize = [None, 0, 0] |
|
1987 | deltasize = [None, 0, 0] | |
1988 | chunktypecounts = {} |
|
1988 | chunktypecounts = {} | |
1989 | chunktypesizes = {} |
|
1989 | chunktypesizes = {} | |
1990 |
|
1990 | |||
1991 | def addsize(size, l): |
|
1991 | def addsize(size, l): | |
1992 | if l[0] is None or size < l[0]: |
|
1992 | if l[0] is None or size < l[0]: | |
1993 | l[0] = size |
|
1993 | l[0] = size | |
1994 | if size > l[1]: |
|
1994 | if size > l[1]: | |
1995 | l[1] = size |
|
1995 | l[1] = size | |
1996 | l[2] += size |
|
1996 | l[2] += size | |
1997 |
|
1997 | |||
1998 | numrevs = len(r) |
|
1998 | numrevs = len(r) | |
1999 | for rev in xrange(numrevs): |
|
1999 | for rev in xrange(numrevs): | |
2000 | p1, p2 = r.parentrevs(rev) |
|
2000 | p1, p2 = r.parentrevs(rev) | |
2001 | delta = r.deltaparent(rev) |
|
2001 | delta = r.deltaparent(rev) | |
2002 | if format > 0: |
|
2002 | if format > 0: | |
2003 | addsize(r.rawsize(rev), datasize) |
|
2003 | addsize(r.rawsize(rev), datasize) | |
2004 | if p2 != nullrev: |
|
2004 | if p2 != nullrev: | |
2005 | nummerges += 1 |
|
2005 | nummerges += 1 | |
2006 | size = r.length(rev) |
|
2006 | size = r.length(rev) | |
2007 | if delta == nullrev: |
|
2007 | if delta == nullrev: | |
2008 | chainlengths.append(0) |
|
2008 | chainlengths.append(0) | |
2009 | chainbases.append(r.start(rev)) |
|
2009 | chainbases.append(r.start(rev)) | |
2010 | chainspans.append(size) |
|
2010 | chainspans.append(size) | |
2011 | numfull += 1 |
|
2011 | numfull += 1 | |
2012 | addsize(size, fullsize) |
|
2012 | addsize(size, fullsize) | |
2013 | else: |
|
2013 | else: | |
2014 | chainlengths.append(chainlengths[delta] + 1) |
|
2014 | chainlengths.append(chainlengths[delta] + 1) | |
2015 | baseaddr = chainbases[delta] |
|
2015 | baseaddr = chainbases[delta] | |
2016 | revaddr = r.start(rev) |
|
2016 | revaddr = r.start(rev) | |
2017 | chainbases.append(baseaddr) |
|
2017 | chainbases.append(baseaddr) | |
2018 | chainspans.append((revaddr - baseaddr) + size) |
|
2018 | chainspans.append((revaddr - baseaddr) + size) | |
2019 | addsize(size, deltasize) |
|
2019 | addsize(size, deltasize) | |
2020 | if delta == rev - 1: |
|
2020 | if delta == rev - 1: | |
2021 | numprev += 1 |
|
2021 | numprev += 1 | |
2022 | if delta == p1: |
|
2022 | if delta == p1: | |
2023 | nump1prev += 1 |
|
2023 | nump1prev += 1 | |
2024 | elif delta == p2: |
|
2024 | elif delta == p2: | |
2025 | nump2prev += 1 |
|
2025 | nump2prev += 1 | |
2026 | elif delta == p1: |
|
2026 | elif delta == p1: | |
2027 | nump1 += 1 |
|
2027 | nump1 += 1 | |
2028 | elif delta == p2: |
|
2028 | elif delta == p2: | |
2029 | nump2 += 1 |
|
2029 | nump2 += 1 | |
2030 | elif delta != nullrev: |
|
2030 | elif delta != nullrev: | |
2031 | numother += 1 |
|
2031 | numother += 1 | |
2032 |
|
2032 | |||
2033 | # Obtain data on the raw chunks in the revlog. |
|
2033 | # Obtain data on the raw chunks in the revlog. | |
2034 | segment = r._getsegmentforrevs(rev, rev)[1] |
|
2034 | segment = r._getsegmentforrevs(rev, rev)[1] | |
2035 | if segment: |
|
2035 | if segment: | |
2036 | chunktype = bytes(segment[0:1]) |
|
2036 | chunktype = bytes(segment[0:1]) | |
2037 | else: |
|
2037 | else: | |
2038 | chunktype = 'empty' |
|
2038 | chunktype = 'empty' | |
2039 |
|
2039 | |||
2040 | if chunktype not in chunktypecounts: |
|
2040 | if chunktype not in chunktypecounts: | |
2041 | chunktypecounts[chunktype] = 0 |
|
2041 | chunktypecounts[chunktype] = 0 | |
2042 | chunktypesizes[chunktype] = 0 |
|
2042 | chunktypesizes[chunktype] = 0 | |
2043 |
|
2043 | |||
2044 | chunktypecounts[chunktype] += 1 |
|
2044 | chunktypecounts[chunktype] += 1 | |
2045 | chunktypesizes[chunktype] += size |
|
2045 | chunktypesizes[chunktype] += size | |
2046 |
|
2046 | |||
2047 | # Adjust size min value for empty cases |
|
2047 | # Adjust size min value for empty cases | |
2048 | for size in (datasize, fullsize, deltasize): |
|
2048 | for size in (datasize, fullsize, deltasize): | |
2049 | if size[0] is None: |
|
2049 | if size[0] is None: | |
2050 | size[0] = 0 |
|
2050 | size[0] = 0 | |
2051 |
|
2051 | |||
2052 | numdeltas = numrevs - numfull |
|
2052 | numdeltas = numrevs - numfull | |
2053 | numoprev = numprev - nump1prev - nump2prev |
|
2053 | numoprev = numprev - nump1prev - nump2prev | |
2054 | totalrawsize = datasize[2] |
|
2054 | totalrawsize = datasize[2] | |
2055 | datasize[2] /= numrevs |
|
2055 | datasize[2] /= numrevs | |
2056 | fulltotal = fullsize[2] |
|
2056 | fulltotal = fullsize[2] | |
2057 | fullsize[2] /= numfull |
|
2057 | fullsize[2] /= numfull | |
2058 | deltatotal = deltasize[2] |
|
2058 | deltatotal = deltasize[2] | |
2059 | if numrevs - numfull > 0: |
|
2059 | if numrevs - numfull > 0: | |
2060 | deltasize[2] /= numrevs - numfull |
|
2060 | deltasize[2] /= numrevs - numfull | |
2061 | totalsize = fulltotal + deltatotal |
|
2061 | totalsize = fulltotal + deltatotal | |
2062 | avgchainlen = sum(chainlengths) / numrevs |
|
2062 | avgchainlen = sum(chainlengths) / numrevs | |
2063 | maxchainlen = max(chainlengths) |
|
2063 | maxchainlen = max(chainlengths) | |
2064 | maxchainspan = max(chainspans) |
|
2064 | maxchainspan = max(chainspans) | |
2065 | compratio = 1 |
|
2065 | compratio = 1 | |
2066 | if totalsize: |
|
2066 | if totalsize: | |
2067 | compratio = totalrawsize / totalsize |
|
2067 | compratio = totalrawsize / totalsize | |
2068 |
|
2068 | |||
2069 | basedfmtstr = '%%%dd\n' |
|
2069 | basedfmtstr = '%%%dd\n' | |
2070 | basepcfmtstr = '%%%dd %s(%%5.2f%%%%)\n' |
|
2070 | basepcfmtstr = '%%%dd %s(%%5.2f%%%%)\n' | |
2071 |
|
2071 | |||
2072 | def dfmtstr(max): |
|
2072 | def dfmtstr(max): | |
2073 | return basedfmtstr % len(str(max)) |
|
2073 | return basedfmtstr % len(str(max)) | |
2074 | def pcfmtstr(max, padding=0): |
|
2074 | def pcfmtstr(max, padding=0): | |
2075 | return basepcfmtstr % (len(str(max)), ' ' * padding) |
|
2075 | return basepcfmtstr % (len(str(max)), ' ' * padding) | |
2076 |
|
2076 | |||
2077 | def pcfmt(value, total): |
|
2077 | def pcfmt(value, total): | |
2078 | if total: |
|
2078 | if total: | |
2079 | return (value, 100 * float(value) / total) |
|
2079 | return (value, 100 * float(value) / total) | |
2080 | else: |
|
2080 | else: | |
2081 | return value, 100.0 |
|
2081 | return value, 100.0 | |
2082 |
|
2082 | |||
2083 | ui.write(('format : %d\n') % format) |
|
2083 | ui.write(('format : %d\n') % format) | |
2084 | ui.write(('flags : %s\n') % ', '.join(flags)) |
|
2084 | ui.write(('flags : %s\n') % ', '.join(flags)) | |
2085 |
|
2085 | |||
2086 | ui.write('\n') |
|
2086 | ui.write('\n') | |
2087 | fmt = pcfmtstr(totalsize) |
|
2087 | fmt = pcfmtstr(totalsize) | |
2088 | fmt2 = dfmtstr(totalsize) |
|
2088 | fmt2 = dfmtstr(totalsize) | |
2089 | ui.write(('revisions : ') + fmt2 % numrevs) |
|
2089 | ui.write(('revisions : ') + fmt2 % numrevs) | |
2090 | ui.write((' merges : ') + fmt % pcfmt(nummerges, numrevs)) |
|
2090 | ui.write((' merges : ') + fmt % pcfmt(nummerges, numrevs)) | |
2091 | ui.write((' normal : ') + fmt % pcfmt(numrevs - nummerges, numrevs)) |
|
2091 | ui.write((' normal : ') + fmt % pcfmt(numrevs - nummerges, numrevs)) | |
2092 | ui.write(('revisions : ') + fmt2 % numrevs) |
|
2092 | ui.write(('revisions : ') + fmt2 % numrevs) | |
2093 | ui.write((' full : ') + fmt % pcfmt(numfull, numrevs)) |
|
2093 | ui.write((' full : ') + fmt % pcfmt(numfull, numrevs)) | |
2094 | ui.write((' deltas : ') + fmt % pcfmt(numdeltas, numrevs)) |
|
2094 | ui.write((' deltas : ') + fmt % pcfmt(numdeltas, numrevs)) | |
2095 | ui.write(('revision size : ') + fmt2 % totalsize) |
|
2095 | ui.write(('revision size : ') + fmt2 % totalsize) | |
2096 | ui.write((' full : ') + fmt % pcfmt(fulltotal, totalsize)) |
|
2096 | ui.write((' full : ') + fmt % pcfmt(fulltotal, totalsize)) | |
2097 | ui.write((' deltas : ') + fmt % pcfmt(deltatotal, totalsize)) |
|
2097 | ui.write((' deltas : ') + fmt % pcfmt(deltatotal, totalsize)) | |
2098 |
|
2098 | |||
2099 | def fmtchunktype(chunktype): |
|
2099 | def fmtchunktype(chunktype): | |
2100 | if chunktype == 'empty': |
|
2100 | if chunktype == 'empty': | |
2101 | return ' %s : ' % chunktype |
|
2101 | return ' %s : ' % chunktype | |
2102 | elif chunktype in pycompat.bytestr(string.ascii_letters): |
|
2102 | elif chunktype in pycompat.bytestr(string.ascii_letters): | |
2103 | return ' 0x%s (%s) : ' % (hex(chunktype), chunktype) |
|
2103 | return ' 0x%s (%s) : ' % (hex(chunktype), chunktype) | |
2104 | else: |
|
2104 | else: | |
2105 | return ' 0x%s : ' % hex(chunktype) |
|
2105 | return ' 0x%s : ' % hex(chunktype) | |
2106 |
|
2106 | |||
2107 | ui.write('\n') |
|
2107 | ui.write('\n') | |
2108 | ui.write(('chunks : ') + fmt2 % numrevs) |
|
2108 | ui.write(('chunks : ') + fmt2 % numrevs) | |
2109 | for chunktype in sorted(chunktypecounts): |
|
2109 | for chunktype in sorted(chunktypecounts): | |
2110 | ui.write(fmtchunktype(chunktype)) |
|
2110 | ui.write(fmtchunktype(chunktype)) | |
2111 | ui.write(fmt % pcfmt(chunktypecounts[chunktype], numrevs)) |
|
2111 | ui.write(fmt % pcfmt(chunktypecounts[chunktype], numrevs)) | |
2112 | ui.write(('chunks size : ') + fmt2 % totalsize) |
|
2112 | ui.write(('chunks size : ') + fmt2 % totalsize) | |
2113 | for chunktype in sorted(chunktypecounts): |
|
2113 | for chunktype in sorted(chunktypecounts): | |
2114 | ui.write(fmtchunktype(chunktype)) |
|
2114 | ui.write(fmtchunktype(chunktype)) | |
2115 | ui.write(fmt % pcfmt(chunktypesizes[chunktype], totalsize)) |
|
2115 | ui.write(fmt % pcfmt(chunktypesizes[chunktype], totalsize)) | |
2116 |
|
2116 | |||
2117 | ui.write('\n') |
|
2117 | ui.write('\n') | |
2118 | fmt = dfmtstr(max(avgchainlen, maxchainlen, maxchainspan, compratio)) |
|
2118 | fmt = dfmtstr(max(avgchainlen, maxchainlen, maxchainspan, compratio)) | |
2119 | ui.write(('avg chain length : ') + fmt % avgchainlen) |
|
2119 | ui.write(('avg chain length : ') + fmt % avgchainlen) | |
2120 | ui.write(('max chain length : ') + fmt % maxchainlen) |
|
2120 | ui.write(('max chain length : ') + fmt % maxchainlen) | |
2121 | ui.write(('max chain reach : ') + fmt % maxchainspan) |
|
2121 | ui.write(('max chain reach : ') + fmt % maxchainspan) | |
2122 | ui.write(('compression ratio : ') + fmt % compratio) |
|
2122 | ui.write(('compression ratio : ') + fmt % compratio) | |
2123 |
|
2123 | |||
2124 | if format > 0: |
|
2124 | if format > 0: | |
2125 | ui.write('\n') |
|
2125 | ui.write('\n') | |
2126 | ui.write(('uncompressed data size (min/max/avg) : %d / %d / %d\n') |
|
2126 | ui.write(('uncompressed data size (min/max/avg) : %d / %d / %d\n') | |
2127 | % tuple(datasize)) |
|
2127 | % tuple(datasize)) | |
2128 | ui.write(('full revision size (min/max/avg) : %d / %d / %d\n') |
|
2128 | ui.write(('full revision size (min/max/avg) : %d / %d / %d\n') | |
2129 | % tuple(fullsize)) |
|
2129 | % tuple(fullsize)) | |
2130 | ui.write(('delta size (min/max/avg) : %d / %d / %d\n') |
|
2130 | ui.write(('delta size (min/max/avg) : %d / %d / %d\n') | |
2131 | % tuple(deltasize)) |
|
2131 | % tuple(deltasize)) | |
2132 |
|
2132 | |||
2133 | if numdeltas > 0: |
|
2133 | if numdeltas > 0: | |
2134 | ui.write('\n') |
|
2134 | ui.write('\n') | |
2135 | fmt = pcfmtstr(numdeltas) |
|
2135 | fmt = pcfmtstr(numdeltas) | |
2136 | fmt2 = pcfmtstr(numdeltas, 4) |
|
2136 | fmt2 = pcfmtstr(numdeltas, 4) | |
2137 | ui.write(('deltas against prev : ') + fmt % pcfmt(numprev, numdeltas)) |
|
2137 | ui.write(('deltas against prev : ') + fmt % pcfmt(numprev, numdeltas)) | |
2138 | if numprev > 0: |
|
2138 | if numprev > 0: | |
2139 | ui.write((' where prev = p1 : ') + fmt2 % pcfmt(nump1prev, |
|
2139 | ui.write((' where prev = p1 : ') + fmt2 % pcfmt(nump1prev, | |
2140 | numprev)) |
|
2140 | numprev)) | |
2141 | ui.write((' where prev = p2 : ') + fmt2 % pcfmt(nump2prev, |
|
2141 | ui.write((' where prev = p2 : ') + fmt2 % pcfmt(nump2prev, | |
2142 | numprev)) |
|
2142 | numprev)) | |
2143 | ui.write((' other : ') + fmt2 % pcfmt(numoprev, |
|
2143 | ui.write((' other : ') + fmt2 % pcfmt(numoprev, | |
2144 | numprev)) |
|
2144 | numprev)) | |
2145 | if gdelta: |
|
2145 | if gdelta: | |
2146 | ui.write(('deltas against p1 : ') |
|
2146 | ui.write(('deltas against p1 : ') | |
2147 | + fmt % pcfmt(nump1, numdeltas)) |
|
2147 | + fmt % pcfmt(nump1, numdeltas)) | |
2148 | ui.write(('deltas against p2 : ') |
|
2148 | ui.write(('deltas against p2 : ') | |
2149 | + fmt % pcfmt(nump2, numdeltas)) |
|
2149 | + fmt % pcfmt(nump2, numdeltas)) | |
2150 | ui.write(('deltas against other : ') + fmt % pcfmt(numother, |
|
2150 | ui.write(('deltas against other : ') + fmt % pcfmt(numother, | |
2151 | numdeltas)) |
|
2151 | numdeltas)) | |
2152 |
|
2152 | |||
2153 | @command('debugrevspec', |
|
2153 | @command('debugrevspec', | |
2154 | [('', 'optimize', None, |
|
2154 | [('', 'optimize', None, | |
2155 | _('print parsed tree after optimizing (DEPRECATED)')), |
|
2155 | _('print parsed tree after optimizing (DEPRECATED)')), | |
2156 | ('', 'show-revs', True, _('print list of result revisions (default)')), |
|
2156 | ('', 'show-revs', True, _('print list of result revisions (default)')), | |
2157 | ('s', 'show-set', None, _('print internal representation of result set')), |
|
2157 | ('s', 'show-set', None, _('print internal representation of result set')), | |
2158 | ('p', 'show-stage', [], |
|
2158 | ('p', 'show-stage', [], | |
2159 | _('print parsed tree at the given stage'), _('NAME')), |
|
2159 | _('print parsed tree at the given stage'), _('NAME')), | |
2160 | ('', 'no-optimized', False, _('evaluate tree without optimization')), |
|
2160 | ('', 'no-optimized', False, _('evaluate tree without optimization')), | |
2161 | ('', 'verify-optimized', False, _('verify optimized result')), |
|
2161 | ('', 'verify-optimized', False, _('verify optimized result')), | |
2162 | ], |
|
2162 | ], | |
2163 | ('REVSPEC')) |
|
2163 | ('REVSPEC')) | |
2164 | def debugrevspec(ui, repo, expr, **opts): |
|
2164 | def debugrevspec(ui, repo, expr, **opts): | |
2165 | """parse and apply a revision specification |
|
2165 | """parse and apply a revision specification | |
2166 |
|
2166 | |||
2167 | Use -p/--show-stage option to print the parsed tree at the given stages. |
|
2167 | Use -p/--show-stage option to print the parsed tree at the given stages. | |
2168 | Use -p all to print tree at every stage. |
|
2168 | Use -p all to print tree at every stage. | |
2169 |
|
2169 | |||
2170 | Use --no-show-revs option with -s or -p to print only the set |
|
2170 | Use --no-show-revs option with -s or -p to print only the set | |
2171 | representation or the parsed tree respectively. |
|
2171 | representation or the parsed tree respectively. | |
2172 |
|
2172 | |||
2173 | Use --verify-optimized to compare the optimized result with the unoptimized |
|
2173 | Use --verify-optimized to compare the optimized result with the unoptimized | |
2174 | one. Returns 1 if the optimized result differs. |
|
2174 | one. Returns 1 if the optimized result differs. | |
2175 | """ |
|
2175 | """ | |
2176 | opts = pycompat.byteskwargs(opts) |
|
2176 | opts = pycompat.byteskwargs(opts) | |
2177 | aliases = ui.configitems('revsetalias') |
|
2177 | aliases = ui.configitems('revsetalias') | |
2178 | stages = [ |
|
2178 | stages = [ | |
2179 | ('parsed', lambda tree: tree), |
|
2179 | ('parsed', lambda tree: tree), | |
2180 | ('expanded', lambda tree: revsetlang.expandaliases(tree, aliases, |
|
2180 | ('expanded', lambda tree: revsetlang.expandaliases(tree, aliases, | |
2181 | ui.warn)), |
|
2181 | ui.warn)), | |
2182 | ('concatenated', revsetlang.foldconcat), |
|
2182 | ('concatenated', revsetlang.foldconcat), | |
2183 | ('analyzed', revsetlang.analyze), |
|
2183 | ('analyzed', revsetlang.analyze), | |
2184 | ('optimized', revsetlang.optimize), |
|
2184 | ('optimized', revsetlang.optimize), | |
2185 | ] |
|
2185 | ] | |
2186 | if opts['no_optimized']: |
|
2186 | if opts['no_optimized']: | |
2187 | stages = stages[:-1] |
|
2187 | stages = stages[:-1] | |
2188 | if opts['verify_optimized'] and opts['no_optimized']: |
|
2188 | if opts['verify_optimized'] and opts['no_optimized']: | |
2189 | raise error.Abort(_('cannot use --verify-optimized with ' |
|
2189 | raise error.Abort(_('cannot use --verify-optimized with ' | |
2190 | '--no-optimized')) |
|
2190 | '--no-optimized')) | |
2191 | stagenames = set(n for n, f in stages) |
|
2191 | stagenames = set(n for n, f in stages) | |
2192 |
|
2192 | |||
2193 | showalways = set() |
|
2193 | showalways = set() | |
2194 | showchanged = set() |
|
2194 | showchanged = set() | |
2195 | if ui.verbose and not opts['show_stage']: |
|
2195 | if ui.verbose and not opts['show_stage']: | |
2196 | # show parsed tree by --verbose (deprecated) |
|
2196 | # show parsed tree by --verbose (deprecated) | |
2197 | showalways.add('parsed') |
|
2197 | showalways.add('parsed') | |
2198 | showchanged.update(['expanded', 'concatenated']) |
|
2198 | showchanged.update(['expanded', 'concatenated']) | |
2199 | if opts['optimize']: |
|
2199 | if opts['optimize']: | |
2200 | showalways.add('optimized') |
|
2200 | showalways.add('optimized') | |
2201 | if opts['show_stage'] and opts['optimize']: |
|
2201 | if opts['show_stage'] and opts['optimize']: | |
2202 | raise error.Abort(_('cannot use --optimize with --show-stage')) |
|
2202 | raise error.Abort(_('cannot use --optimize with --show-stage')) | |
2203 | if opts['show_stage'] == ['all']: |
|
2203 | if opts['show_stage'] == ['all']: | |
2204 | showalways.update(stagenames) |
|
2204 | showalways.update(stagenames) | |
2205 | else: |
|
2205 | else: | |
2206 | for n in opts['show_stage']: |
|
2206 | for n in opts['show_stage']: | |
2207 | if n not in stagenames: |
|
2207 | if n not in stagenames: | |
2208 | raise error.Abort(_('invalid stage name: %s') % n) |
|
2208 | raise error.Abort(_('invalid stage name: %s') % n) | |
2209 | showalways.update(opts['show_stage']) |
|
2209 | showalways.update(opts['show_stage']) | |
2210 |
|
2210 | |||
2211 | treebystage = {} |
|
2211 | treebystage = {} | |
2212 | printedtree = None |
|
2212 | printedtree = None | |
2213 | tree = revsetlang.parse(expr, lookup=repo.__contains__) |
|
2213 | tree = revsetlang.parse(expr, lookup=repo.__contains__) | |
2214 | for n, f in stages: |
|
2214 | for n, f in stages: | |
2215 | treebystage[n] = tree = f(tree) |
|
2215 | treebystage[n] = tree = f(tree) | |
2216 | if n in showalways or (n in showchanged and tree != printedtree): |
|
2216 | if n in showalways or (n in showchanged and tree != printedtree): | |
2217 | if opts['show_stage'] or n != 'parsed': |
|
2217 | if opts['show_stage'] or n != 'parsed': | |
2218 | ui.write(("* %s:\n") % n) |
|
2218 | ui.write(("* %s:\n") % n) | |
2219 | ui.write(revsetlang.prettyformat(tree), "\n") |
|
2219 | ui.write(revsetlang.prettyformat(tree), "\n") | |
2220 | printedtree = tree |
|
2220 | printedtree = tree | |
2221 |
|
2221 | |||
2222 | if opts['verify_optimized']: |
|
2222 | if opts['verify_optimized']: | |
2223 | arevs = revset.makematcher(treebystage['analyzed'])(repo) |
|
2223 | arevs = revset.makematcher(treebystage['analyzed'])(repo) | |
2224 | brevs = revset.makematcher(treebystage['optimized'])(repo) |
|
2224 | brevs = revset.makematcher(treebystage['optimized'])(repo) | |
2225 | if opts['show_set'] or (opts['show_set'] is None and ui.verbose): |
|
2225 | if opts['show_set'] or (opts['show_set'] is None and ui.verbose): | |
2226 | ui.write(("* analyzed set:\n"), smartset.prettyformat(arevs), "\n") |
|
2226 | ui.write(("* analyzed set:\n"), smartset.prettyformat(arevs), "\n") | |
2227 | ui.write(("* optimized set:\n"), smartset.prettyformat(brevs), "\n") |
|
2227 | ui.write(("* optimized set:\n"), smartset.prettyformat(brevs), "\n") | |
2228 | arevs = list(arevs) |
|
2228 | arevs = list(arevs) | |
2229 | brevs = list(brevs) |
|
2229 | brevs = list(brevs) | |
2230 | if arevs == brevs: |
|
2230 | if arevs == brevs: | |
2231 | return 0 |
|
2231 | return 0 | |
2232 | ui.write(('--- analyzed\n'), label='diff.file_a') |
|
2232 | ui.write(('--- analyzed\n'), label='diff.file_a') | |
2233 | ui.write(('+++ optimized\n'), label='diff.file_b') |
|
2233 | ui.write(('+++ optimized\n'), label='diff.file_b') | |
2234 | sm = difflib.SequenceMatcher(None, arevs, brevs) |
|
2234 | sm = difflib.SequenceMatcher(None, arevs, brevs) | |
2235 | for tag, alo, ahi, blo, bhi in sm.get_opcodes(): |
|
2235 | for tag, alo, ahi, blo, bhi in sm.get_opcodes(): | |
2236 | if tag in ('delete', 'replace'): |
|
2236 | if tag in ('delete', 'replace'): | |
2237 | for c in arevs[alo:ahi]: |
|
2237 | for c in arevs[alo:ahi]: | |
2238 | ui.write('-%s\n' % c, label='diff.deleted') |
|
2238 | ui.write('-%s\n' % c, label='diff.deleted') | |
2239 | if tag in ('insert', 'replace'): |
|
2239 | if tag in ('insert', 'replace'): | |
2240 | for c in brevs[blo:bhi]: |
|
2240 | for c in brevs[blo:bhi]: | |
2241 | ui.write('+%s\n' % c, label='diff.inserted') |
|
2241 | ui.write('+%s\n' % c, label='diff.inserted') | |
2242 | if tag == 'equal': |
|
2242 | if tag == 'equal': | |
2243 | for c in arevs[alo:ahi]: |
|
2243 | for c in arevs[alo:ahi]: | |
2244 | ui.write(' %s\n' % c) |
|
2244 | ui.write(' %s\n' % c) | |
2245 | return 1 |
|
2245 | return 1 | |
2246 |
|
2246 | |||
2247 | func = revset.makematcher(tree) |
|
2247 | func = revset.makematcher(tree) | |
2248 | revs = func(repo) |
|
2248 | revs = func(repo) | |
2249 | if opts['show_set'] or (opts['show_set'] is None and ui.verbose): |
|
2249 | if opts['show_set'] or (opts['show_set'] is None and ui.verbose): | |
2250 | ui.write(("* set:\n"), smartset.prettyformat(revs), "\n") |
|
2250 | ui.write(("* set:\n"), smartset.prettyformat(revs), "\n") | |
2251 | if not opts['show_revs']: |
|
2251 | if not opts['show_revs']: | |
2252 | return |
|
2252 | return | |
2253 | for c in revs: |
|
2253 | for c in revs: | |
2254 | ui.write("%d\n" % c) |
|
2254 | ui.write("%d\n" % c) | |
2255 |
|
2255 | |||
2256 | @command('debugserve', [ |
|
2256 | @command('debugserve', [ | |
2257 | ('', 'sshstdio', False, _('run an SSH server bound to process handles')), |
|
2257 | ('', 'sshstdio', False, _('run an SSH server bound to process handles')), | |
2258 | ('', 'logiofd', '', _('file descriptor to log server I/O to')), |
|
2258 | ('', 'logiofd', '', _('file descriptor to log server I/O to')), | |
2259 | ('', 'logiofile', '', _('file to log server I/O to')), |
|
2259 | ('', 'logiofile', '', _('file to log server I/O to')), | |
2260 | ], '') |
|
2260 | ], '') | |
2261 | def debugserve(ui, repo, **opts): |
|
2261 | def debugserve(ui, repo, **opts): | |
2262 | """run a server with advanced settings |
|
2262 | """run a server with advanced settings | |
2263 |
|
2263 | |||
2264 | This command is similar to :hg:`serve`. It exists partially as a |
|
2264 | This command is similar to :hg:`serve`. It exists partially as a | |
2265 | workaround to the fact that ``hg serve --stdio`` must have specific |
|
2265 | workaround to the fact that ``hg serve --stdio`` must have specific | |
2266 | arguments for security reasons. |
|
2266 | arguments for security reasons. | |
2267 | """ |
|
2267 | """ | |
2268 | opts = pycompat.byteskwargs(opts) |
|
2268 | opts = pycompat.byteskwargs(opts) | |
2269 |
|
2269 | |||
2270 | if not opts['sshstdio']: |
|
2270 | if not opts['sshstdio']: | |
2271 | raise error.Abort(_('only --sshstdio is currently supported')) |
|
2271 | raise error.Abort(_('only --sshstdio is currently supported')) | |
2272 |
|
2272 | |||
2273 | logfh = None |
|
2273 | logfh = None | |
2274 |
|
2274 | |||
2275 | if opts['logiofd'] and opts['logiofile']: |
|
2275 | if opts['logiofd'] and opts['logiofile']: | |
2276 | raise error.Abort(_('cannot use both --logiofd and --logiofile')) |
|
2276 | raise error.Abort(_('cannot use both --logiofd and --logiofile')) | |
2277 |
|
2277 | |||
2278 | if opts['logiofd']: |
|
2278 | if opts['logiofd']: | |
2279 | # Line buffered because output is line based. |
|
2279 | # Line buffered because output is line based. | |
2280 | logfh = os.fdopen(int(opts['logiofd']), r'ab', 1) |
|
2280 | logfh = os.fdopen(int(opts['logiofd']), r'ab', 1) | |
2281 | elif opts['logiofile']: |
|
2281 | elif opts['logiofile']: | |
2282 | logfh = open(opts['logiofile'], 'ab', 1) |
|
2282 | logfh = open(opts['logiofile'], 'ab', 1) | |
2283 |
|
2283 | |||
2284 | s = wireprotoserver.sshserver(ui, repo, logfh=logfh) |
|
2284 | s = wireprotoserver.sshserver(ui, repo, logfh=logfh) | |
2285 | s.serve_forever() |
|
2285 | s.serve_forever() | |
2286 |
|
2286 | |||
2287 | @command('debugsetparents', [], _('REV1 [REV2]')) |
|
2287 | @command('debugsetparents', [], _('REV1 [REV2]')) | |
2288 | def debugsetparents(ui, repo, rev1, rev2=None): |
|
2288 | def debugsetparents(ui, repo, rev1, rev2=None): | |
2289 | """manually set the parents of the current working directory |
|
2289 | """manually set the parents of the current working directory | |
2290 |
|
2290 | |||
2291 | This is useful for writing repository conversion tools, but should |
|
2291 | This is useful for writing repository conversion tools, but should | |
2292 | be used with care. For example, neither the working directory nor the |
|
2292 | be used with care. For example, neither the working directory nor the | |
2293 | dirstate is updated, so file status may be incorrect after running this |
|
2293 | dirstate is updated, so file status may be incorrect after running this | |
2294 | command. |
|
2294 | command. | |
2295 |
|
2295 | |||
2296 | Returns 0 on success. |
|
2296 | Returns 0 on success. | |
2297 | """ |
|
2297 | """ | |
2298 |
|
2298 | |||
2299 | node1 = scmutil.revsingle(repo, rev1).node() |
|
2299 | node1 = scmutil.revsingle(repo, rev1).node() | |
2300 | node2 = scmutil.revsingle(repo, rev2, 'null').node() |
|
2300 | node2 = scmutil.revsingle(repo, rev2, 'null').node() | |
2301 |
|
2301 | |||
2302 | with repo.wlock(): |
|
2302 | with repo.wlock(): | |
2303 | repo.setparents(node1, node2) |
|
2303 | repo.setparents(node1, node2) | |
2304 |
|
2304 | |||
2305 | @command('debugssl', [], '[SOURCE]', optionalrepo=True) |
|
2305 | @command('debugssl', [], '[SOURCE]', optionalrepo=True) | |
2306 | def debugssl(ui, repo, source=None, **opts): |
|
2306 | def debugssl(ui, repo, source=None, **opts): | |
2307 | '''test a secure connection to a server |
|
2307 | '''test a secure connection to a server | |
2308 |
|
2308 | |||
2309 | This builds the certificate chain for the server on Windows, installing the |
|
2309 | This builds the certificate chain for the server on Windows, installing the | |
2310 | missing intermediates and trusted root via Windows Update if necessary. It |
|
2310 | missing intermediates and trusted root via Windows Update if necessary. It | |
2311 | does nothing on other platforms. |
|
2311 | does nothing on other platforms. | |
2312 |
|
2312 | |||
2313 | If SOURCE is omitted, the 'default' path will be used. If a URL is given, |
|
2313 | If SOURCE is omitted, the 'default' path will be used. If a URL is given, | |
2314 | that server is used. See :hg:`help urls` for more information. |
|
2314 | that server is used. See :hg:`help urls` for more information. | |
2315 |
|
2315 | |||
2316 | If the update succeeds, retry the original operation. Otherwise, the cause |
|
2316 | If the update succeeds, retry the original operation. Otherwise, the cause | |
2317 | of the SSL error is likely another issue. |
|
2317 | of the SSL error is likely another issue. | |
2318 | ''' |
|
2318 | ''' | |
2319 | if not pycompat.iswindows: |
|
2319 | if not pycompat.iswindows: | |
2320 | raise error.Abort(_('certificate chain building is only possible on ' |
|
2320 | raise error.Abort(_('certificate chain building is only possible on ' | |
2321 | 'Windows')) |
|
2321 | 'Windows')) | |
2322 |
|
2322 | |||
2323 | if not source: |
|
2323 | if not source: | |
2324 | if not repo: |
|
2324 | if not repo: | |
2325 | raise error.Abort(_("there is no Mercurial repository here, and no " |
|
2325 | raise error.Abort(_("there is no Mercurial repository here, and no " | |
2326 | "server specified")) |
|
2326 | "server specified")) | |
2327 | source = "default" |
|
2327 | source = "default" | |
2328 |
|
2328 | |||
2329 | source, branches = hg.parseurl(ui.expandpath(source)) |
|
2329 | source, branches = hg.parseurl(ui.expandpath(source)) | |
2330 | url = util.url(source) |
|
2330 | url = util.url(source) | |
2331 | addr = None |
|
2331 | addr = None | |
2332 |
|
2332 | |||
2333 | defaultport = {'https': 443, 'ssh': 22} |
|
2333 | defaultport = {'https': 443, 'ssh': 22} | |
2334 | if url.scheme in defaultport: |
|
2334 | if url.scheme in defaultport: | |
2335 | try: |
|
2335 | try: | |
2336 | addr = (url.host, int(url.port or defaultport[url.scheme])) |
|
2336 | addr = (url.host, int(url.port or defaultport[url.scheme])) | |
2337 | except ValueError: |
|
2337 | except ValueError: | |
2338 | raise error.Abort(_("malformed port number in URL")) |
|
2338 | raise error.Abort(_("malformed port number in URL")) | |
2339 | else: |
|
2339 | else: | |
2340 | raise error.Abort(_("only https and ssh connections are supported")) |
|
2340 | raise error.Abort(_("only https and ssh connections are supported")) | |
2341 |
|
2341 | |||
2342 | from . import win32 |
|
2342 | from . import win32 | |
2343 |
|
2343 | |||
2344 | s = ssl.wrap_socket(socket.socket(), ssl_version=ssl.PROTOCOL_TLS, |
|
2344 | s = ssl.wrap_socket(socket.socket(), ssl_version=ssl.PROTOCOL_TLS, | |
2345 | cert_reqs=ssl.CERT_NONE, ca_certs=None) |
|
2345 | cert_reqs=ssl.CERT_NONE, ca_certs=None) | |
2346 |
|
2346 | |||
2347 | try: |
|
2347 | try: | |
2348 | s.connect(addr) |
|
2348 | s.connect(addr) | |
2349 | cert = s.getpeercert(True) |
|
2349 | cert = s.getpeercert(True) | |
2350 |
|
2350 | |||
2351 | ui.status(_('checking the certificate chain for %s\n') % url.host) |
|
2351 | ui.status(_('checking the certificate chain for %s\n') % url.host) | |
2352 |
|
2352 | |||
2353 | complete = win32.checkcertificatechain(cert, build=False) |
|
2353 | complete = win32.checkcertificatechain(cert, build=False) | |
2354 |
|
2354 | |||
2355 | if not complete: |
|
2355 | if not complete: | |
2356 | ui.status(_('certificate chain is incomplete, updating... ')) |
|
2356 | ui.status(_('certificate chain is incomplete, updating... ')) | |
2357 |
|
2357 | |||
2358 | if not win32.checkcertificatechain(cert): |
|
2358 | if not win32.checkcertificatechain(cert): | |
2359 | ui.status(_('failed.\n')) |
|
2359 | ui.status(_('failed.\n')) | |
2360 | else: |
|
2360 | else: | |
2361 | ui.status(_('done.\n')) |
|
2361 | ui.status(_('done.\n')) | |
2362 | else: |
|
2362 | else: | |
2363 | ui.status(_('full certificate chain is available\n')) |
|
2363 | ui.status(_('full certificate chain is available\n')) | |
2364 | finally: |
|
2364 | finally: | |
2365 | s.close() |
|
2365 | s.close() | |
2366 |
|
2366 | |||
2367 | @command('debugsub', |
|
2367 | @command('debugsub', | |
2368 | [('r', 'rev', '', |
|
2368 | [('r', 'rev', '', | |
2369 | _('revision to check'), _('REV'))], |
|
2369 | _('revision to check'), _('REV'))], | |
2370 | _('[-r REV] [REV]')) |
|
2370 | _('[-r REV] [REV]')) | |
2371 | def debugsub(ui, repo, rev=None): |
|
2371 | def debugsub(ui, repo, rev=None): | |
2372 | ctx = scmutil.revsingle(repo, rev, None) |
|
2372 | ctx = scmutil.revsingle(repo, rev, None) | |
2373 | for k, v in sorted(ctx.substate.items()): |
|
2373 | for k, v in sorted(ctx.substate.items()): | |
2374 | ui.write(('path %s\n') % k) |
|
2374 | ui.write(('path %s\n') % k) | |
2375 | ui.write((' source %s\n') % v[0]) |
|
2375 | ui.write((' source %s\n') % v[0]) | |
2376 | ui.write((' revision %s\n') % v[1]) |
|
2376 | ui.write((' revision %s\n') % v[1]) | |
2377 |
|
2377 | |||
2378 | @command('debugsuccessorssets', |
|
2378 | @command('debugsuccessorssets', | |
2379 | [('', 'closest', False, _('return closest successors sets only'))], |
|
2379 | [('', 'closest', False, _('return closest successors sets only'))], | |
2380 | _('[REV]')) |
|
2380 | _('[REV]')) | |
2381 | def debugsuccessorssets(ui, repo, *revs, **opts): |
|
2381 | def debugsuccessorssets(ui, repo, *revs, **opts): | |
2382 | """show set of successors for revision |
|
2382 | """show set of successors for revision | |
2383 |
|
2383 | |||
2384 | A successors set of changeset A is a consistent group of revisions that |
|
2384 | A successors set of changeset A is a consistent group of revisions that | |
2385 | succeed A. It contains non-obsolete changesets only unless closests |
|
2385 | succeed A. It contains non-obsolete changesets only unless closests | |
2386 | successors set is set. |
|
2386 | successors set is set. | |
2387 |
|
2387 | |||
2388 | In most cases a changeset A has a single successors set containing a single |
|
2388 | In most cases a changeset A has a single successors set containing a single | |
2389 | successor (changeset A replaced by A'). |
|
2389 | successor (changeset A replaced by A'). | |
2390 |
|
2390 | |||
2391 | A changeset that is made obsolete with no successors are called "pruned". |
|
2391 | A changeset that is made obsolete with no successors are called "pruned". | |
2392 | Such changesets have no successors sets at all. |
|
2392 | Such changesets have no successors sets at all. | |
2393 |
|
2393 | |||
2394 | A changeset that has been "split" will have a successors set containing |
|
2394 | A changeset that has been "split" will have a successors set containing | |
2395 | more than one successor. |
|
2395 | more than one successor. | |
2396 |
|
2396 | |||
2397 | A changeset that has been rewritten in multiple different ways is called |
|
2397 | A changeset that has been rewritten in multiple different ways is called | |
2398 | "divergent". Such changesets have multiple successor sets (each of which |
|
2398 | "divergent". Such changesets have multiple successor sets (each of which | |
2399 | may also be split, i.e. have multiple successors). |
|
2399 | may also be split, i.e. have multiple successors). | |
2400 |
|
2400 | |||
2401 | Results are displayed as follows:: |
|
2401 | Results are displayed as follows:: | |
2402 |
|
2402 | |||
2403 | <rev1> |
|
2403 | <rev1> | |
2404 | <successors-1A> |
|
2404 | <successors-1A> | |
2405 | <rev2> |
|
2405 | <rev2> | |
2406 | <successors-2A> |
|
2406 | <successors-2A> | |
2407 | <successors-2B1> <successors-2B2> <successors-2B3> |
|
2407 | <successors-2B1> <successors-2B2> <successors-2B3> | |
2408 |
|
2408 | |||
2409 | Here rev2 has two possible (i.e. divergent) successors sets. The first |
|
2409 | Here rev2 has two possible (i.e. divergent) successors sets. The first | |
2410 | holds one element, whereas the second holds three (i.e. the changeset has |
|
2410 | holds one element, whereas the second holds three (i.e. the changeset has | |
2411 | been split). |
|
2411 | been split). | |
2412 | """ |
|
2412 | """ | |
2413 | # passed to successorssets caching computation from one call to another |
|
2413 | # passed to successorssets caching computation from one call to another | |
2414 | cache = {} |
|
2414 | cache = {} | |
2415 | ctx2str = bytes |
|
2415 | ctx2str = bytes | |
2416 | node2str = short |
|
2416 | node2str = short | |
2417 | for rev in scmutil.revrange(repo, revs): |
|
2417 | for rev in scmutil.revrange(repo, revs): | |
2418 | ctx = repo[rev] |
|
2418 | ctx = repo[rev] | |
2419 | ui.write('%s\n'% ctx2str(ctx)) |
|
2419 | ui.write('%s\n'% ctx2str(ctx)) | |
2420 | for succsset in obsutil.successorssets(repo, ctx.node(), |
|
2420 | for succsset in obsutil.successorssets(repo, ctx.node(), | |
2421 | closest=opts[r'closest'], |
|
2421 | closest=opts[r'closest'], | |
2422 | cache=cache): |
|
2422 | cache=cache): | |
2423 | if succsset: |
|
2423 | if succsset: | |
2424 | ui.write(' ') |
|
2424 | ui.write(' ') | |
2425 | ui.write(node2str(succsset[0])) |
|
2425 | ui.write(node2str(succsset[0])) | |
2426 | for node in succsset[1:]: |
|
2426 | for node in succsset[1:]: | |
2427 | ui.write(' ') |
|
2427 | ui.write(' ') | |
2428 | ui.write(node2str(node)) |
|
2428 | ui.write(node2str(node)) | |
2429 | ui.write('\n') |
|
2429 | ui.write('\n') | |
2430 |
|
2430 | |||
2431 | @command('debugtemplate', |
|
2431 | @command('debugtemplate', | |
2432 | [('r', 'rev', [], _('apply template on changesets'), _('REV')), |
|
2432 | [('r', 'rev', [], _('apply template on changesets'), _('REV')), | |
2433 | ('D', 'define', [], _('define template keyword'), _('KEY=VALUE'))], |
|
2433 | ('D', 'define', [], _('define template keyword'), _('KEY=VALUE'))], | |
2434 | _('[-r REV]... [-D KEY=VALUE]... TEMPLATE'), |
|
2434 | _('[-r REV]... [-D KEY=VALUE]... TEMPLATE'), | |
2435 | optionalrepo=True) |
|
2435 | optionalrepo=True) | |
2436 | def debugtemplate(ui, repo, tmpl, **opts): |
|
2436 | def debugtemplate(ui, repo, tmpl, **opts): | |
2437 | """parse and apply a template |
|
2437 | """parse and apply a template | |
2438 |
|
2438 | |||
2439 | If -r/--rev is given, the template is processed as a log template and |
|
2439 | If -r/--rev is given, the template is processed as a log template and | |
2440 | applied to the given changesets. Otherwise, it is processed as a generic |
|
2440 | applied to the given changesets. Otherwise, it is processed as a generic | |
2441 | template. |
|
2441 | template. | |
2442 |
|
2442 | |||
2443 | Use --verbose to print the parsed tree. |
|
2443 | Use --verbose to print the parsed tree. | |
2444 | """ |
|
2444 | """ | |
2445 | revs = None |
|
2445 | revs = None | |
2446 | if opts[r'rev']: |
|
2446 | if opts[r'rev']: | |
2447 | if repo is None: |
|
2447 | if repo is None: | |
2448 | raise error.RepoError(_('there is no Mercurial repository here ' |
|
2448 | raise error.RepoError(_('there is no Mercurial repository here ' | |
2449 | '(.hg not found)')) |
|
2449 | '(.hg not found)')) | |
2450 | revs = scmutil.revrange(repo, opts[r'rev']) |
|
2450 | revs = scmutil.revrange(repo, opts[r'rev']) | |
2451 |
|
2451 | |||
2452 | props = {} |
|
2452 | props = {} | |
2453 | for d in opts[r'define']: |
|
2453 | for d in opts[r'define']: | |
2454 | try: |
|
2454 | try: | |
2455 | k, v = (e.strip() for e in d.split('=', 1)) |
|
2455 | k, v = (e.strip() for e in d.split('=', 1)) | |
2456 | if not k or k == 'ui': |
|
2456 | if not k or k == 'ui': | |
2457 | raise ValueError |
|
2457 | raise ValueError | |
2458 | props[k] = v |
|
2458 | props[k] = v | |
2459 | except ValueError: |
|
2459 | except ValueError: | |
2460 | raise error.Abort(_('malformed keyword definition: %s') % d) |
|
2460 | raise error.Abort(_('malformed keyword definition: %s') % d) | |
2461 |
|
2461 | |||
2462 | if ui.verbose: |
|
2462 | if ui.verbose: | |
2463 | aliases = ui.configitems('templatealias') |
|
2463 | aliases = ui.configitems('templatealias') | |
2464 | tree = templater.parse(tmpl) |
|
2464 | tree = templater.parse(tmpl) | |
2465 | ui.note(templater.prettyformat(tree), '\n') |
|
2465 | ui.note(templater.prettyformat(tree), '\n') | |
2466 | newtree = templater.expandaliases(tree, aliases) |
|
2466 | newtree = templater.expandaliases(tree, aliases) | |
2467 | if newtree != tree: |
|
2467 | if newtree != tree: | |
2468 | ui.note(("* expanded:\n"), templater.prettyformat(newtree), '\n') |
|
2468 | ui.note(("* expanded:\n"), templater.prettyformat(newtree), '\n') | |
2469 |
|
2469 | |||
2470 | if revs is None: |
|
2470 | if revs is None: | |
2471 | tres = formatter.templateresources(ui, repo) |
|
2471 | tres = formatter.templateresources(ui, repo) | |
2472 | t = formatter.maketemplater(ui, tmpl, resources=tres) |
|
2472 | t = formatter.maketemplater(ui, tmpl, resources=tres) | |
2473 | ui.write(t.renderdefault(props)) |
|
2473 | ui.write(t.renderdefault(props)) | |
2474 | else: |
|
2474 | else: | |
2475 | displayer = logcmdutil.maketemplater(ui, repo, tmpl) |
|
2475 | displayer = logcmdutil.maketemplater(ui, repo, tmpl) | |
2476 | for r in revs: |
|
2476 | for r in revs: | |
2477 | displayer.show(repo[r], **pycompat.strkwargs(props)) |
|
2477 | displayer.show(repo[r], **pycompat.strkwargs(props)) | |
2478 | displayer.close() |
|
2478 | displayer.close() | |
2479 |
|
2479 | |||
2480 | @command('debuguigetpass', [ |
|
2480 | @command('debuguigetpass', [ | |
2481 | ('p', 'prompt', '', _('prompt text'), _('TEXT')), |
|
2481 | ('p', 'prompt', '', _('prompt text'), _('TEXT')), | |
2482 | ], _('[-p TEXT]'), norepo=True) |
|
2482 | ], _('[-p TEXT]'), norepo=True) | |
2483 | def debuguigetpass(ui, prompt=''): |
|
2483 | def debuguigetpass(ui, prompt=''): | |
2484 | """show prompt to type password""" |
|
2484 | """show prompt to type password""" | |
2485 | r = ui.getpass(prompt) |
|
2485 | r = ui.getpass(prompt) | |
2486 | ui.write(('respose: %s\n') % r) |
|
2486 | ui.write(('respose: %s\n') % r) | |
2487 |
|
2487 | |||
2488 | @command('debuguiprompt', [ |
|
2488 | @command('debuguiprompt', [ | |
2489 | ('p', 'prompt', '', _('prompt text'), _('TEXT')), |
|
2489 | ('p', 'prompt', '', _('prompt text'), _('TEXT')), | |
2490 | ], _('[-p TEXT]'), norepo=True) |
|
2490 | ], _('[-p TEXT]'), norepo=True) | |
2491 | def debuguiprompt(ui, prompt=''): |
|
2491 | def debuguiprompt(ui, prompt=''): | |
2492 | """show plain prompt""" |
|
2492 | """show plain prompt""" | |
2493 | r = ui.prompt(prompt) |
|
2493 | r = ui.prompt(prompt) | |
2494 | ui.write(('response: %s\n') % r) |
|
2494 | ui.write(('response: %s\n') % r) | |
2495 |
|
2495 | |||
2496 | @command('debugupdatecaches', []) |
|
2496 | @command('debugupdatecaches', []) | |
2497 | def debugupdatecaches(ui, repo, *pats, **opts): |
|
2497 | def debugupdatecaches(ui, repo, *pats, **opts): | |
2498 | """warm all known caches in the repository""" |
|
2498 | """warm all known caches in the repository""" | |
2499 | with repo.wlock(), repo.lock(): |
|
2499 | with repo.wlock(), repo.lock(): | |
2500 | repo.updatecaches(full=True) |
|
2500 | repo.updatecaches(full=True) | |
2501 |
|
2501 | |||
2502 | @command('debugupgraderepo', [ |
|
2502 | @command('debugupgraderepo', [ | |
2503 | ('o', 'optimize', [], _('extra optimization to perform'), _('NAME')), |
|
2503 | ('o', 'optimize', [], _('extra optimization to perform'), _('NAME')), | |
2504 | ('', 'run', False, _('performs an upgrade')), |
|
2504 | ('', 'run', False, _('performs an upgrade')), | |
2505 | ]) |
|
2505 | ]) | |
2506 | def debugupgraderepo(ui, repo, run=False, optimize=None): |
|
2506 | def debugupgraderepo(ui, repo, run=False, optimize=None): | |
2507 | """upgrade a repository to use different features |
|
2507 | """upgrade a repository to use different features | |
2508 |
|
2508 | |||
2509 | If no arguments are specified, the repository is evaluated for upgrade |
|
2509 | If no arguments are specified, the repository is evaluated for upgrade | |
2510 | and a list of problems and potential optimizations is printed. |
|
2510 | and a list of problems and potential optimizations is printed. | |
2511 |
|
2511 | |||
2512 | With ``--run``, a repository upgrade is performed. Behavior of the upgrade |
|
2512 | With ``--run``, a repository upgrade is performed. Behavior of the upgrade | |
2513 | can be influenced via additional arguments. More details will be provided |
|
2513 | can be influenced via additional arguments. More details will be provided | |
2514 | by the command output when run without ``--run``. |
|
2514 | by the command output when run without ``--run``. | |
2515 |
|
2515 | |||
2516 | During the upgrade, the repository will be locked and no writes will be |
|
2516 | During the upgrade, the repository will be locked and no writes will be | |
2517 | allowed. |
|
2517 | allowed. | |
2518 |
|
2518 | |||
2519 | At the end of the upgrade, the repository may not be readable while new |
|
2519 | At the end of the upgrade, the repository may not be readable while new | |
2520 | repository data is swapped in. This window will be as long as it takes to |
|
2520 | repository data is swapped in. This window will be as long as it takes to | |
2521 | rename some directories inside the ``.hg`` directory. On most machines, this |
|
2521 | rename some directories inside the ``.hg`` directory. On most machines, this | |
2522 | should complete almost instantaneously and the chances of a consumer being |
|
2522 | should complete almost instantaneously and the chances of a consumer being | |
2523 | unable to access the repository should be low. |
|
2523 | unable to access the repository should be low. | |
2524 | """ |
|
2524 | """ | |
2525 | return upgrade.upgraderepo(ui, repo, run=run, optimize=optimize) |
|
2525 | return upgrade.upgraderepo(ui, repo, run=run, optimize=optimize) | |
2526 |
|
2526 | |||
2527 | @command('debugwalk', cmdutil.walkopts, _('[OPTION]... [FILE]...'), |
|
2527 | @command('debugwalk', cmdutil.walkopts, _('[OPTION]... [FILE]...'), | |
2528 | inferrepo=True) |
|
2528 | inferrepo=True) | |
2529 | def debugwalk(ui, repo, *pats, **opts): |
|
2529 | def debugwalk(ui, repo, *pats, **opts): | |
2530 | """show how files match on given patterns""" |
|
2530 | """show how files match on given patterns""" | |
2531 | opts = pycompat.byteskwargs(opts) |
|
2531 | opts = pycompat.byteskwargs(opts) | |
2532 | m = scmutil.match(repo[None], pats, opts) |
|
2532 | m = scmutil.match(repo[None], pats, opts) | |
2533 | ui.write(('matcher: %r\n' % m)) |
|
2533 | ui.write(('matcher: %r\n' % m)) | |
2534 | items = list(repo[None].walk(m)) |
|
2534 | items = list(repo[None].walk(m)) | |
2535 | if not items: |
|
2535 | if not items: | |
2536 | return |
|
2536 | return | |
2537 | f = lambda fn: fn |
|
2537 | f = lambda fn: fn | |
2538 | if ui.configbool('ui', 'slash') and pycompat.ossep != '/': |
|
2538 | if ui.configbool('ui', 'slash') and pycompat.ossep != '/': | |
2539 | f = lambda fn: util.normpath(fn) |
|
2539 | f = lambda fn: util.normpath(fn) | |
2540 | fmt = 'f %%-%ds %%-%ds %%s' % ( |
|
2540 | fmt = 'f %%-%ds %%-%ds %%s' % ( | |
2541 | max([len(abs) for abs in items]), |
|
2541 | max([len(abs) for abs in items]), | |
2542 | max([len(m.rel(abs)) for abs in items])) |
|
2542 | max([len(m.rel(abs)) for abs in items])) | |
2543 | for abs in items: |
|
2543 | for abs in items: | |
2544 | line = fmt % (abs, f(m.rel(abs)), m.exact(abs) and 'exact' or '') |
|
2544 | line = fmt % (abs, f(m.rel(abs)), m.exact(abs) and 'exact' or '') | |
2545 | ui.write("%s\n" % line.rstrip()) |
|
2545 | ui.write("%s\n" % line.rstrip()) | |
2546 |
|
2546 | |||
2547 | @command('debugwhyunstable', [], _('REV')) |
|
2547 | @command('debugwhyunstable', [], _('REV')) | |
2548 | def debugwhyunstable(ui, repo, rev): |
|
2548 | def debugwhyunstable(ui, repo, rev): | |
2549 | """explain instabilities of a changeset""" |
|
2549 | """explain instabilities of a changeset""" | |
2550 | for entry in obsutil.whyunstable(repo, repo[rev]): |
|
2550 | for entry in obsutil.whyunstable(repo, repo[rev]): | |
2551 | dnodes = '' |
|
2551 | dnodes = '' | |
2552 | if entry.get('divergentnodes'): |
|
2552 | if entry.get('divergentnodes'): | |
2553 | dnodes = ' '.join('%s (%s)' % (ctx.hex(), ctx.phasestr()) |
|
2553 | dnodes = ' '.join('%s (%s)' % (ctx.hex(), ctx.phasestr()) | |
2554 | for ctx in entry['divergentnodes']) + ' ' |
|
2554 | for ctx in entry['divergentnodes']) + ' ' | |
2555 | ui.write('%s: %s%s %s\n' % (entry['instability'], dnodes, |
|
2555 | ui.write('%s: %s%s %s\n' % (entry['instability'], dnodes, | |
2556 | entry['reason'], entry['node'])) |
|
2556 | entry['reason'], entry['node'])) | |
2557 |
|
2557 | |||
2558 | @command('debugwireargs', |
|
2558 | @command('debugwireargs', | |
2559 | [('', 'three', '', 'three'), |
|
2559 | [('', 'three', '', 'three'), | |
2560 | ('', 'four', '', 'four'), |
|
2560 | ('', 'four', '', 'four'), | |
2561 | ('', 'five', '', 'five'), |
|
2561 | ('', 'five', '', 'five'), | |
2562 | ] + cmdutil.remoteopts, |
|
2562 | ] + cmdutil.remoteopts, | |
2563 | _('REPO [OPTIONS]... [ONE [TWO]]'), |
|
2563 | _('REPO [OPTIONS]... [ONE [TWO]]'), | |
2564 | norepo=True) |
|
2564 | norepo=True) | |
2565 | def debugwireargs(ui, repopath, *vals, **opts): |
|
2565 | def debugwireargs(ui, repopath, *vals, **opts): | |
2566 | opts = pycompat.byteskwargs(opts) |
|
2566 | opts = pycompat.byteskwargs(opts) | |
2567 | repo = hg.peer(ui, opts, repopath) |
|
2567 | repo = hg.peer(ui, opts, repopath) | |
2568 | for opt in cmdutil.remoteopts: |
|
2568 | for opt in cmdutil.remoteopts: | |
2569 | del opts[opt[1]] |
|
2569 | del opts[opt[1]] | |
2570 | args = {} |
|
2570 | args = {} | |
2571 | for k, v in opts.iteritems(): |
|
2571 | for k, v in opts.iteritems(): | |
2572 | if v: |
|
2572 | if v: | |
2573 | args[k] = v |
|
2573 | args[k] = v | |
2574 | args = pycompat.strkwargs(args) |
|
2574 | args = pycompat.strkwargs(args) | |
2575 | # run twice to check that we don't mess up the stream for the next command |
|
2575 | # run twice to check that we don't mess up the stream for the next command | |
2576 | res1 = repo.debugwireargs(*vals, **args) |
|
2576 | res1 = repo.debugwireargs(*vals, **args) | |
2577 | res2 = repo.debugwireargs(*vals, **args) |
|
2577 | res2 = repo.debugwireargs(*vals, **args) | |
2578 | ui.write("%s\n" % res1) |
|
2578 | ui.write("%s\n" % res1) | |
2579 | if res1 != res2: |
|
2579 | if res1 != res2: | |
2580 | ui.warn("%s\n" % res2) |
|
2580 | ui.warn("%s\n" % res2) | |
2581 |
|
2581 | |||
2582 | def _parsewirelangblocks(fh): |
|
2582 | def _parsewirelangblocks(fh): | |
2583 | activeaction = None |
|
2583 | activeaction = None | |
2584 | blocklines = [] |
|
2584 | blocklines = [] | |
2585 |
|
2585 | |||
2586 | for line in fh: |
|
2586 | for line in fh: | |
2587 | line = line.rstrip() |
|
2587 | line = line.rstrip() | |
2588 | if not line: |
|
2588 | if not line: | |
2589 | continue |
|
2589 | continue | |
2590 |
|
2590 | |||
2591 | if line.startswith(b'#'): |
|
2591 | if line.startswith(b'#'): | |
2592 | continue |
|
2592 | continue | |
2593 |
|
2593 | |||
2594 | if not line.startswith(' '): |
|
2594 | if not line.startswith(' '): | |
2595 | # New block. Flush previous one. |
|
2595 | # New block. Flush previous one. | |
2596 | if activeaction: |
|
2596 | if activeaction: | |
2597 | yield activeaction, blocklines |
|
2597 | yield activeaction, blocklines | |
2598 |
|
2598 | |||
2599 | activeaction = line |
|
2599 | activeaction = line | |
2600 | blocklines = [] |
|
2600 | blocklines = [] | |
2601 | continue |
|
2601 | continue | |
2602 |
|
2602 | |||
2603 | # Else we start with an indent. |
|
2603 | # Else we start with an indent. | |
2604 |
|
2604 | |||
2605 | if not activeaction: |
|
2605 | if not activeaction: | |
2606 | raise error.Abort(_('indented line outside of block')) |
|
2606 | raise error.Abort(_('indented line outside of block')) | |
2607 |
|
2607 | |||
2608 | blocklines.append(line) |
|
2608 | blocklines.append(line) | |
2609 |
|
2609 | |||
2610 | # Flush last block. |
|
2610 | # Flush last block. | |
2611 | if activeaction: |
|
2611 | if activeaction: | |
2612 | yield activeaction, blocklines |
|
2612 | yield activeaction, blocklines | |
2613 |
|
2613 | |||
2614 | @command('debugwireproto', |
|
2614 | @command('debugwireproto', | |
2615 | [ |
|
2615 | [ | |
2616 | ('', 'localssh', False, _('start an SSH server for this repo')), |
|
2616 | ('', 'localssh', False, _('start an SSH server for this repo')), | |
2617 | ('', 'peer', '', _('construct a specific version of the peer')), |
|
2617 | ('', 'peer', '', _('construct a specific version of the peer')), | |
2618 | ('', 'noreadstderr', False, _('do not read from stderr of the remote')), |
|
2618 | ('', 'noreadstderr', False, _('do not read from stderr of the remote')), | |
2619 | ] + cmdutil.remoteopts, |
|
2619 | ] + cmdutil.remoteopts, | |
2620 | _('[PATH]'), |
|
2620 | _('[PATH]'), | |
2621 | optionalrepo=True) |
|
2621 | optionalrepo=True) | |
2622 | def debugwireproto(ui, repo, path=None, **opts): |
|
2622 | def debugwireproto(ui, repo, path=None, **opts): | |
2623 | """send wire protocol commands to a server |
|
2623 | """send wire protocol commands to a server | |
2624 |
|
2624 | |||
2625 | This command can be used to issue wire protocol commands to remote |
|
2625 | This command can be used to issue wire protocol commands to remote | |
2626 | peers and to debug the raw data being exchanged. |
|
2626 | peers and to debug the raw data being exchanged. | |
2627 |
|
2627 | |||
2628 | ``--localssh`` will start an SSH server against the current repository |
|
2628 | ``--localssh`` will start an SSH server against the current repository | |
2629 | and connect to that. By default, the connection will perform a handshake |
|
2629 | and connect to that. By default, the connection will perform a handshake | |
2630 | and establish an appropriate peer instance. |
|
2630 | and establish an appropriate peer instance. | |
2631 |
|
2631 | |||
2632 | ``--peer`` can be used to bypass the handshake protocol and construct a |
|
2632 | ``--peer`` can be used to bypass the handshake protocol and construct a | |
2633 | peer instance using the specified class type. Valid values are ``raw``, |
|
2633 | peer instance using the specified class type. Valid values are ``raw``, | |
2634 | ``ssh1``, and ``ssh2``. ``raw`` instances only allow sending raw data |
|
2634 | ``ssh1``, and ``ssh2``. ``raw`` instances only allow sending raw data | |
2635 | payloads and don't support higher-level command actions. |
|
2635 | payloads and don't support higher-level command actions. | |
2636 |
|
2636 | |||
2637 | ``--noreadstderr`` can be used to disable automatic reading from stderr |
|
2637 | ``--noreadstderr`` can be used to disable automatic reading from stderr | |
2638 | of the peer (for SSH connections only). Disabling automatic reading of |
|
2638 | of the peer (for SSH connections only). Disabling automatic reading of | |
2639 | stderr is useful for making output more deterministic. |
|
2639 | stderr is useful for making output more deterministic. | |
2640 |
|
2640 | |||
2641 | Commands are issued via a mini language which is specified via stdin. |
|
2641 | Commands are issued via a mini language which is specified via stdin. | |
2642 | The language consists of individual actions to perform. An action is |
|
2642 | The language consists of individual actions to perform. An action is | |
2643 | defined by a block. A block is defined as a line with no leading |
|
2643 | defined by a block. A block is defined as a line with no leading | |
2644 | space followed by 0 or more lines with leading space. Blocks are |
|
2644 | space followed by 0 or more lines with leading space. Blocks are | |
2645 | effectively a high-level command with additional metadata. |
|
2645 | effectively a high-level command with additional metadata. | |
2646 |
|
2646 | |||
2647 | Lines beginning with ``#`` are ignored. |
|
2647 | Lines beginning with ``#`` are ignored. | |
2648 |
|
2648 | |||
2649 | The following sections denote available actions. |
|
2649 | The following sections denote available actions. | |
2650 |
|
2650 | |||
2651 | raw |
|
2651 | raw | |
2652 | --- |
|
2652 | --- | |
2653 |
|
2653 | |||
2654 | Send raw data to the server. |
|
2654 | Send raw data to the server. | |
2655 |
|
2655 | |||
2656 | The block payload contains the raw data to send as one atomic send |
|
2656 | The block payload contains the raw data to send as one atomic send | |
2657 | operation. The data may not actually be delivered in a single system |
|
2657 | operation. The data may not actually be delivered in a single system | |
2658 | call: it depends on the abilities of the transport being used. |
|
2658 | call: it depends on the abilities of the transport being used. | |
2659 |
|
2659 | |||
2660 | Each line in the block is de-indented and concatenated. Then, that |
|
2660 | Each line in the block is de-indented and concatenated. Then, that | |
2661 | value is evaluated as a Python b'' literal. This allows the use of |
|
2661 | value is evaluated as a Python b'' literal. This allows the use of | |
2662 | backslash escaping, etc. |
|
2662 | backslash escaping, etc. | |
2663 |
|
2663 | |||
2664 | raw+ |
|
2664 | raw+ | |
2665 | ---- |
|
2665 | ---- | |
2666 |
|
2666 | |||
2667 | Behaves like ``raw`` except flushes output afterwards. |
|
2667 | Behaves like ``raw`` except flushes output afterwards. | |
2668 |
|
2668 | |||
2669 | command <X> |
|
2669 | command <X> | |
2670 | ----------- |
|
2670 | ----------- | |
2671 |
|
2671 | |||
2672 | Send a request to run a named command, whose name follows the ``command`` |
|
2672 | Send a request to run a named command, whose name follows the ``command`` | |
2673 | string. |
|
2673 | string. | |
2674 |
|
2674 | |||
2675 | Arguments to the command are defined as lines in this block. The format of |
|
2675 | Arguments to the command are defined as lines in this block. The format of | |
2676 | each line is ``<key> <value>``. e.g.:: |
|
2676 | each line is ``<key> <value>``. e.g.:: | |
2677 |
|
2677 | |||
2678 | command listkeys |
|
2678 | command listkeys | |
2679 | namespace bookmarks |
|
2679 | namespace bookmarks | |
2680 |
|
2680 | |||
2681 | Values are interpreted as Python b'' literals. This allows encoding |
|
2681 | Values are interpreted as Python b'' literals. This allows encoding | |
2682 | special byte sequences via backslash escaping. |
|
2682 | special byte sequences via backslash escaping. | |
2683 |
|
2683 | |||
2684 | The following arguments have special meaning: |
|
2684 | The following arguments have special meaning: | |
2685 |
|
2685 | |||
2686 | ``PUSHFILE`` |
|
2686 | ``PUSHFILE`` | |
2687 | When defined, the *push* mechanism of the peer will be used instead |
|
2687 | When defined, the *push* mechanism of the peer will be used instead | |
2688 | of the static request-response mechanism and the content of the |
|
2688 | of the static request-response mechanism and the content of the | |
2689 | file specified in the value of this argument will be sent as the |
|
2689 | file specified in the value of this argument will be sent as the | |
2690 | command payload. |
|
2690 | command payload. | |
2691 |
|
2691 | |||
2692 | This can be used to submit a local bundle file to the remote. |
|
2692 | This can be used to submit a local bundle file to the remote. | |
2693 |
|
2693 | |||
2694 | batchbegin |
|
2694 | batchbegin | |
2695 | ---------- |
|
2695 | ---------- | |
2696 |
|
2696 | |||
2697 | Instruct the peer to begin a batched send. |
|
2697 | Instruct the peer to begin a batched send. | |
2698 |
|
2698 | |||
2699 | All ``command`` blocks are queued for execution until the next |
|
2699 | All ``command`` blocks are queued for execution until the next | |
2700 | ``batchsubmit`` block. |
|
2700 | ``batchsubmit`` block. | |
2701 |
|
2701 | |||
2702 | batchsubmit |
|
2702 | batchsubmit | |
2703 | ----------- |
|
2703 | ----------- | |
2704 |
|
2704 | |||
2705 | Submit previously queued ``command`` blocks as a batch request. |
|
2705 | Submit previously queued ``command`` blocks as a batch request. | |
2706 |
|
2706 | |||
2707 | This action MUST be paired with a ``batchbegin`` action. |
|
2707 | This action MUST be paired with a ``batchbegin`` action. | |
2708 |
|
2708 | |||
2709 | httprequest <method> <path> |
|
2709 | httprequest <method> <path> | |
2710 | --------------------------- |
|
2710 | --------------------------- | |
2711 |
|
2711 | |||
2712 | (HTTP peer only) |
|
2712 | (HTTP peer only) | |
2713 |
|
2713 | |||
2714 | Send an HTTP request to the peer. |
|
2714 | Send an HTTP request to the peer. | |
2715 |
|
2715 | |||
2716 | The HTTP request line follows the ``httprequest`` action. e.g. ``GET /foo``. |
|
2716 | The HTTP request line follows the ``httprequest`` action. e.g. ``GET /foo``. | |
2717 |
|
2717 | |||
2718 | Arguments of the form ``<key>: <value>`` are interpreted as HTTP request |
|
2718 | Arguments of the form ``<key>: <value>`` are interpreted as HTTP request | |
2719 | headers to add to the request. e.g. ``Accept: foo``. |
|
2719 | headers to add to the request. e.g. ``Accept: foo``. | |
2720 |
|
2720 | |||
2721 | The following arguments are special: |
|
2721 | The following arguments are special: | |
2722 |
|
2722 | |||
2723 | ``BODYFILE`` |
|
2723 | ``BODYFILE`` | |
2724 | The content of the file defined as the value to this argument will be |
|
2724 | The content of the file defined as the value to this argument will be | |
2725 | transferred verbatim as the HTTP request body. |
|
2725 | transferred verbatim as the HTTP request body. | |
2726 |
|
2726 | |||
2727 | ``frame <type> <flags> <payload>`` |
|
2727 | ``frame <type> <flags> <payload>`` | |
2728 | Send a unified protocol frame as part of the request body. |
|
2728 | Send a unified protocol frame as part of the request body. | |
2729 |
|
2729 | |||
2730 | All frames will be collected and sent as the body to the HTTP |
|
2730 | All frames will be collected and sent as the body to the HTTP | |
2731 | request. |
|
2731 | request. | |
2732 |
|
2732 | |||
2733 | close |
|
2733 | close | |
2734 | ----- |
|
2734 | ----- | |
2735 |
|
2735 | |||
2736 | Close the connection to the server. |
|
2736 | Close the connection to the server. | |
2737 |
|
2737 | |||
2738 | flush |
|
2738 | flush | |
2739 | ----- |
|
2739 | ----- | |
2740 |
|
2740 | |||
2741 | Flush data written to the server. |
|
2741 | Flush data written to the server. | |
2742 |
|
2742 | |||
2743 | readavailable |
|
2743 | readavailable | |
2744 | ------------- |
|
2744 | ------------- | |
2745 |
|
2745 | |||
2746 | Close the write end of the connection and read all available data from |
|
2746 | Close the write end of the connection and read all available data from | |
2747 | the server. |
|
2747 | the server. | |
2748 |
|
2748 | |||
2749 | If the connection to the server encompasses multiple pipes, we poll both |
|
2749 | If the connection to the server encompasses multiple pipes, we poll both | |
2750 | pipes and read available data. |
|
2750 | pipes and read available data. | |
2751 |
|
2751 | |||
2752 | readline |
|
2752 | readline | |
2753 | -------- |
|
2753 | -------- | |
2754 |
|
2754 | |||
2755 | Read a line of output from the server. If there are multiple output |
|
2755 | Read a line of output from the server. If there are multiple output | |
2756 | pipes, reads only the main pipe. |
|
2756 | pipes, reads only the main pipe. | |
2757 |
|
2757 | |||
2758 | ereadline |
|
2758 | ereadline | |
2759 | --------- |
|
2759 | --------- | |
2760 |
|
2760 | |||
2761 | Like ``readline``, but read from the stderr pipe, if available. |
|
2761 | Like ``readline``, but read from the stderr pipe, if available. | |
2762 |
|
2762 | |||
2763 | read <X> |
|
2763 | read <X> | |
2764 | -------- |
|
2764 | -------- | |
2765 |
|
2765 | |||
2766 | ``read()`` N bytes from the server's main output pipe. |
|
2766 | ``read()`` N bytes from the server's main output pipe. | |
2767 |
|
2767 | |||
2768 | eread <X> |
|
2768 | eread <X> | |
2769 | --------- |
|
2769 | --------- | |
2770 |
|
2770 | |||
2771 | ``read()`` N bytes from the server's stderr pipe, if available. |
|
2771 | ``read()`` N bytes from the server's stderr pipe, if available. | |
2772 |
|
2772 | |||
2773 | Specifying Unified Frame-Based Protocol Frames |
|
2773 | Specifying Unified Frame-Based Protocol Frames | |
2774 | ---------------------------------------------- |
|
2774 | ---------------------------------------------- | |
2775 |
|
2775 | |||
2776 | It is possible to emit a *Unified Frame-Based Protocol* by using special |
|
2776 | It is possible to emit a *Unified Frame-Based Protocol* by using special | |
2777 | syntax. |
|
2777 | syntax. | |
2778 |
|
2778 | |||
2779 | A frame is composed as a type, flags, and payload. These can be parsed |
|
2779 | A frame is composed as a type, flags, and payload. These can be parsed | |
2780 | from a string of the form: |
|
2780 | from a string of the form: | |
2781 |
|
2781 | |||
2782 | <request-id> <stream-id> <stream-flags> <type> <flags> <payload> |
|
2782 | <request-id> <stream-id> <stream-flags> <type> <flags> <payload> | |
2783 |
|
2783 | |||
2784 | ``request-id`` and ``stream-id`` are integers defining the request and |
|
2784 | ``request-id`` and ``stream-id`` are integers defining the request and | |
2785 | stream identifiers. |
|
2785 | stream identifiers. | |
2786 |
|
2786 | |||
2787 | ``type`` can be an integer value for the frame type or the string name |
|
2787 | ``type`` can be an integer value for the frame type or the string name | |
2788 | of the type. The strings are defined in ``wireprotoframing.py``. e.g. |
|
2788 | of the type. The strings are defined in ``wireprotoframing.py``. e.g. | |
2789 | ``command-name``. |
|
2789 | ``command-name``. | |
2790 |
|
2790 | |||
2791 | ``stream-flags`` and ``flags`` are a ``|`` delimited list of flag |
|
2791 | ``stream-flags`` and ``flags`` are a ``|`` delimited list of flag | |
2792 | components. Each component (and there can be just one) can be an integer |
|
2792 | components. Each component (and there can be just one) can be an integer | |
2793 | or a flag name for stream flags or frame flags, respectively. Values are |
|
2793 | or a flag name for stream flags or frame flags, respectively. Values are | |
2794 | resolved to integers and then bitwise OR'd together. |
|
2794 | resolved to integers and then bitwise OR'd together. | |
2795 |
|
2795 | |||
2796 | ``payload`` represents the raw frame payload. If it begins with |
|
2796 | ``payload`` represents the raw frame payload. If it begins with | |
2797 | ``cbor:``, the following string is evaluated as Python code and the |
|
2797 | ``cbor:``, the following string is evaluated as Python code and the | |
2798 | resulting object is fed into a CBOR encoder. Otherwise it is interpreted |
|
2798 | resulting object is fed into a CBOR encoder. Otherwise it is interpreted | |
2799 | as a Python byte string literal. |
|
2799 | as a Python byte string literal. | |
2800 | """ |
|
2800 | """ | |
2801 | opts = pycompat.byteskwargs(opts) |
|
2801 | opts = pycompat.byteskwargs(opts) | |
2802 |
|
2802 | |||
2803 | if opts['localssh'] and not repo: |
|
2803 | if opts['localssh'] and not repo: | |
2804 | raise error.Abort(_('--localssh requires a repository')) |
|
2804 | raise error.Abort(_('--localssh requires a repository')) | |
2805 |
|
2805 | |||
2806 | if opts['peer'] and opts['peer'] not in ('raw', 'ssh1', 'ssh2'): |
|
2806 | if opts['peer'] and opts['peer'] not in ('raw', 'ssh1', 'ssh2'): | |
2807 | raise error.Abort(_('invalid value for --peer'), |
|
2807 | raise error.Abort(_('invalid value for --peer'), | |
2808 | hint=_('valid values are "raw", "ssh1", and "ssh2"')) |
|
2808 | hint=_('valid values are "raw", "ssh1", and "ssh2"')) | |
2809 |
|
2809 | |||
2810 | if path and opts['localssh']: |
|
2810 | if path and opts['localssh']: | |
2811 | raise error.Abort(_('cannot specify --localssh with an explicit ' |
|
2811 | raise error.Abort(_('cannot specify --localssh with an explicit ' | |
2812 | 'path')) |
|
2812 | 'path')) | |
2813 |
|
2813 | |||
2814 | if ui.interactive(): |
|
2814 | if ui.interactive(): | |
2815 | ui.write(_('(waiting for commands on stdin)\n')) |
|
2815 | ui.write(_('(waiting for commands on stdin)\n')) | |
2816 |
|
2816 | |||
2817 | blocks = list(_parsewirelangblocks(ui.fin)) |
|
2817 | blocks = list(_parsewirelangblocks(ui.fin)) | |
2818 |
|
2818 | |||
2819 | proc = None |
|
2819 | proc = None | |
2820 | stdin = None |
|
2820 | stdin = None | |
2821 | stdout = None |
|
2821 | stdout = None | |
2822 | stderr = None |
|
2822 | stderr = None | |
2823 | opener = None |
|
2823 | opener = None | |
2824 |
|
2824 | |||
2825 | if opts['localssh']: |
|
2825 | if opts['localssh']: | |
2826 | # We start the SSH server in its own process so there is process |
|
2826 | # We start the SSH server in its own process so there is process | |
2827 | # separation. This prevents a whole class of potential bugs around |
|
2827 | # separation. This prevents a whole class of potential bugs around | |
2828 | # shared state from interfering with server operation. |
|
2828 | # shared state from interfering with server operation. | |
2829 | args = procutil.hgcmd() + [ |
|
2829 | args = procutil.hgcmd() + [ | |
2830 | '-R', repo.root, |
|
2830 | '-R', repo.root, | |
2831 | 'debugserve', '--sshstdio', |
|
2831 | 'debugserve', '--sshstdio', | |
2832 | ] |
|
2832 | ] | |
2833 | proc = subprocess.Popen(args, stdin=subprocess.PIPE, |
|
2833 | proc = subprocess.Popen(args, stdin=subprocess.PIPE, | |
2834 | stdout=subprocess.PIPE, stderr=subprocess.PIPE, |
|
2834 | stdout=subprocess.PIPE, stderr=subprocess.PIPE, | |
2835 | bufsize=0) |
|
2835 | bufsize=0) | |
2836 |
|
2836 | |||
2837 | stdin = proc.stdin |
|
2837 | stdin = proc.stdin | |
2838 | stdout = proc.stdout |
|
2838 | stdout = proc.stdout | |
2839 | stderr = proc.stderr |
|
2839 | stderr = proc.stderr | |
2840 |
|
2840 | |||
2841 | # We turn the pipes into observers so we can log I/O. |
|
2841 | # We turn the pipes into observers so we can log I/O. | |
2842 | if ui.verbose or opts['peer'] == 'raw': |
|
2842 | if ui.verbose or opts['peer'] == 'raw': | |
2843 | stdin = util.makeloggingfileobject(ui, proc.stdin, b'i', |
|
2843 | stdin = util.makeloggingfileobject(ui, proc.stdin, b'i', | |
2844 | logdata=True) |
|
2844 | logdata=True) | |
2845 | stdout = util.makeloggingfileobject(ui, proc.stdout, b'o', |
|
2845 | stdout = util.makeloggingfileobject(ui, proc.stdout, b'o', | |
2846 | logdata=True) |
|
2846 | logdata=True) | |
2847 | stderr = util.makeloggingfileobject(ui, proc.stderr, b'e', |
|
2847 | stderr = util.makeloggingfileobject(ui, proc.stderr, b'e', | |
2848 | logdata=True) |
|
2848 | logdata=True) | |
2849 |
|
2849 | |||
2850 | # --localssh also implies the peer connection settings. |
|
2850 | # --localssh also implies the peer connection settings. | |
2851 |
|
2851 | |||
2852 | url = 'ssh://localserver' |
|
2852 | url = 'ssh://localserver' | |
2853 | autoreadstderr = not opts['noreadstderr'] |
|
2853 | autoreadstderr = not opts['noreadstderr'] | |
2854 |
|
2854 | |||
2855 | if opts['peer'] == 'ssh1': |
|
2855 | if opts['peer'] == 'ssh1': | |
2856 | ui.write(_('creating ssh peer for wire protocol version 1\n')) |
|
2856 | ui.write(_('creating ssh peer for wire protocol version 1\n')) | |
2857 | peer = sshpeer.sshv1peer(ui, url, proc, stdin, stdout, stderr, |
|
2857 | peer = sshpeer.sshv1peer(ui, url, proc, stdin, stdout, stderr, | |
2858 | None, autoreadstderr=autoreadstderr) |
|
2858 | None, autoreadstderr=autoreadstderr) | |
2859 | elif opts['peer'] == 'ssh2': |
|
2859 | elif opts['peer'] == 'ssh2': | |
2860 | ui.write(_('creating ssh peer for wire protocol version 2\n')) |
|
2860 | ui.write(_('creating ssh peer for wire protocol version 2\n')) | |
2861 | peer = sshpeer.sshv2peer(ui, url, proc, stdin, stdout, stderr, |
|
2861 | peer = sshpeer.sshv2peer(ui, url, proc, stdin, stdout, stderr, | |
2862 | None, autoreadstderr=autoreadstderr) |
|
2862 | None, autoreadstderr=autoreadstderr) | |
2863 | elif opts['peer'] == 'raw': |
|
2863 | elif opts['peer'] == 'raw': | |
2864 | ui.write(_('using raw connection to peer\n')) |
|
2864 | ui.write(_('using raw connection to peer\n')) | |
2865 | peer = None |
|
2865 | peer = None | |
2866 | else: |
|
2866 | else: | |
2867 | ui.write(_('creating ssh peer from handshake results\n')) |
|
2867 | ui.write(_('creating ssh peer from handshake results\n')) | |
2868 | peer = sshpeer.makepeer(ui, url, proc, stdin, stdout, stderr, |
|
2868 | peer = sshpeer.makepeer(ui, url, proc, stdin, stdout, stderr, | |
2869 | autoreadstderr=autoreadstderr) |
|
2869 | autoreadstderr=autoreadstderr) | |
2870 |
|
2870 | |||
2871 | elif path: |
|
2871 | elif path: | |
2872 | # We bypass hg.peer() so we can proxy the sockets. |
|
2872 | # We bypass hg.peer() so we can proxy the sockets. | |
2873 | # TODO consider not doing this because we skip |
|
2873 | # TODO consider not doing this because we skip | |
2874 | # ``hg.wirepeersetupfuncs`` and potentially other useful functionality. |
|
2874 | # ``hg.wirepeersetupfuncs`` and potentially other useful functionality. | |
2875 | u = util.url(path) |
|
2875 | u = util.url(path) | |
2876 | if u.scheme != 'http': |
|
2876 | if u.scheme != 'http': | |
2877 | raise error.Abort(_('only http:// paths are currently supported')) |
|
2877 | raise error.Abort(_('only http:// paths are currently supported')) | |
2878 |
|
2878 | |||
2879 | url, authinfo = u.authinfo() |
|
2879 | url, authinfo = u.authinfo() | |
2880 | openerargs = {} |
|
2880 | openerargs = {} | |
2881 |
|
2881 | |||
2882 | # Turn pipes/sockets into observers so we can log I/O. |
|
2882 | # Turn pipes/sockets into observers so we can log I/O. | |
2883 | if ui.verbose: |
|
2883 | if ui.verbose: | |
2884 | openerargs = { |
|
2884 | openerargs = { | |
2885 | r'loggingfh': ui, |
|
2885 | r'loggingfh': ui, | |
2886 | r'loggingname': b's', |
|
2886 | r'loggingname': b's', | |
2887 | r'loggingopts': { |
|
2887 | r'loggingopts': { | |
2888 | r'logdata': True, |
|
2888 | r'logdata': True, | |
2889 | r'logdataapis': False, |
|
2889 | r'logdataapis': False, | |
2890 | }, |
|
2890 | }, | |
2891 | } |
|
2891 | } | |
2892 |
|
2892 | |||
2893 | if ui.debugflag: |
|
2893 | if ui.debugflag: | |
2894 | openerargs[r'loggingopts'][r'logdataapis'] = True |
|
2894 | openerargs[r'loggingopts'][r'logdataapis'] = True | |
2895 |
|
2895 | |||
2896 | # Don't send default headers when in raw mode. This allows us to |
|
2896 | # Don't send default headers when in raw mode. This allows us to | |
2897 | # bypass most of the behavior of our URL handling code so we can |
|
2897 | # bypass most of the behavior of our URL handling code so we can | |
2898 | # have near complete control over what's sent on the wire. |
|
2898 | # have near complete control over what's sent on the wire. | |
2899 | if opts['peer'] == 'raw': |
|
2899 | if opts['peer'] == 'raw': | |
2900 | openerargs[r'sendaccept'] = False |
|
2900 | openerargs[r'sendaccept'] = False | |
2901 |
|
2901 | |||
2902 | opener = urlmod.opener(ui, authinfo, **openerargs) |
|
2902 | opener = urlmod.opener(ui, authinfo, **openerargs) | |
2903 |
|
2903 | |||
2904 | if opts['peer'] == 'raw': |
|
2904 | if opts['peer'] == 'raw': | |
2905 | ui.write(_('using raw connection to peer\n')) |
|
2905 | ui.write(_('using raw connection to peer\n')) | |
2906 | peer = None |
|
2906 | peer = None | |
2907 | elif opts['peer']: |
|
2907 | elif opts['peer']: | |
2908 | raise error.Abort(_('--peer %s not supported with HTTP peers') % |
|
2908 | raise error.Abort(_('--peer %s not supported with HTTP peers') % | |
2909 | opts['peer']) |
|
2909 | opts['peer']) | |
2910 | else: |
|
2910 | else: | |
2911 | peer = httppeer.httppeer(ui, path, url, opener) |
|
2911 | peer = httppeer.httppeer(ui, path, url, opener) | |
2912 | peer._fetchcaps() |
|
2912 | peer._fetchcaps() | |
2913 |
|
2913 | |||
2914 | # We /could/ populate stdin/stdout with sock.makefile()... |
|
2914 | # We /could/ populate stdin/stdout with sock.makefile()... | |
2915 | else: |
|
2915 | else: | |
2916 | raise error.Abort(_('unsupported connection configuration')) |
|
2916 | raise error.Abort(_('unsupported connection configuration')) | |
2917 |
|
2917 | |||
2918 | batchedcommands = None |
|
2918 | batchedcommands = None | |
2919 |
|
2919 | |||
2920 | # Now perform actions based on the parsed wire language instructions. |
|
2920 | # Now perform actions based on the parsed wire language instructions. | |
2921 | for action, lines in blocks: |
|
2921 | for action, lines in blocks: | |
2922 | if action in ('raw', 'raw+'): |
|
2922 | if action in ('raw', 'raw+'): | |
2923 | if not stdin: |
|
2923 | if not stdin: | |
2924 | raise error.Abort(_('cannot call raw/raw+ on this peer')) |
|
2924 | raise error.Abort(_('cannot call raw/raw+ on this peer')) | |
2925 |
|
2925 | |||
2926 | # Concatenate the data together. |
|
2926 | # Concatenate the data together. | |
2927 | data = ''.join(l.lstrip() for l in lines) |
|
2927 | data = ''.join(l.lstrip() for l in lines) | |
2928 | data = stringutil.unescapestr(data) |
|
2928 | data = stringutil.unescapestr(data) | |
2929 | stdin.write(data) |
|
2929 | stdin.write(data) | |
2930 |
|
2930 | |||
2931 | if action == 'raw+': |
|
2931 | if action == 'raw+': | |
2932 | stdin.flush() |
|
2932 | stdin.flush() | |
2933 | elif action == 'flush': |
|
2933 | elif action == 'flush': | |
2934 | if not stdin: |
|
2934 | if not stdin: | |
2935 | raise error.Abort(_('cannot call flush on this peer')) |
|
2935 | raise error.Abort(_('cannot call flush on this peer')) | |
2936 | stdin.flush() |
|
2936 | stdin.flush() | |
2937 | elif action.startswith('command'): |
|
2937 | elif action.startswith('command'): | |
2938 | if not peer: |
|
2938 | if not peer: | |
2939 | raise error.Abort(_('cannot send commands unless peer instance ' |
|
2939 | raise error.Abort(_('cannot send commands unless peer instance ' | |
2940 | 'is available')) |
|
2940 | 'is available')) | |
2941 |
|
2941 | |||
2942 | command = action.split(' ', 1)[1] |
|
2942 | command = action.split(' ', 1)[1] | |
2943 |
|
2943 | |||
2944 | args = {} |
|
2944 | args = {} | |
2945 | for line in lines: |
|
2945 | for line in lines: | |
2946 | # We need to allow empty values. |
|
2946 | # We need to allow empty values. | |
2947 | fields = line.lstrip().split(' ', 1) |
|
2947 | fields = line.lstrip().split(' ', 1) | |
2948 | if len(fields) == 1: |
|
2948 | if len(fields) == 1: | |
2949 | key = fields[0] |
|
2949 | key = fields[0] | |
2950 | value = '' |
|
2950 | value = '' | |
2951 | else: |
|
2951 | else: | |
2952 | key, value = fields |
|
2952 | key, value = fields | |
2953 |
|
2953 | |||
2954 | args[key] = stringutil.unescapestr(value) |
|
2954 | args[key] = stringutil.unescapestr(value) | |
2955 |
|
2955 | |||
2956 | if batchedcommands is not None: |
|
2956 | if batchedcommands is not None: | |
2957 | batchedcommands.append((command, args)) |
|
2957 | batchedcommands.append((command, args)) | |
2958 | continue |
|
2958 | continue | |
2959 |
|
2959 | |||
2960 | ui.status(_('sending %s command\n') % command) |
|
2960 | ui.status(_('sending %s command\n') % command) | |
2961 |
|
2961 | |||
2962 | if 'PUSHFILE' in args: |
|
2962 | if 'PUSHFILE' in args: | |
2963 | with open(args['PUSHFILE'], r'rb') as fh: |
|
2963 | with open(args['PUSHFILE'], r'rb') as fh: | |
2964 | del args['PUSHFILE'] |
|
2964 | del args['PUSHFILE'] | |
2965 | res, output = peer._callpush(command, fh, |
|
2965 | res, output = peer._callpush(command, fh, | |
2966 | **pycompat.strkwargs(args)) |
|
2966 | **pycompat.strkwargs(args)) | |
2967 | ui.status(_('result: %s\n') % stringutil.escapedata(res)) |
|
2967 | ui.status(_('result: %s\n') % stringutil.escapedata(res)) | |
2968 | ui.status(_('remote output: %s\n') % |
|
2968 | ui.status(_('remote output: %s\n') % | |
2969 | stringutil.escapedata(output)) |
|
2969 | stringutil.escapedata(output)) | |
2970 | else: |
|
2970 | else: | |
2971 | res = peer._call(command, **pycompat.strkwargs(args)) |
|
2971 | res = peer._call(command, **pycompat.strkwargs(args)) | |
2972 |
ui.status(_('response: %s\n') % stringutil. |
|
2972 | ui.status(_('response: %s\n') % stringutil.pprint(res)) | |
2973 |
|
2973 | |||
2974 | elif action == 'batchbegin': |
|
2974 | elif action == 'batchbegin': | |
2975 | if batchedcommands is not None: |
|
2975 | if batchedcommands is not None: | |
2976 | raise error.Abort(_('nested batchbegin not allowed')) |
|
2976 | raise error.Abort(_('nested batchbegin not allowed')) | |
2977 |
|
2977 | |||
2978 | batchedcommands = [] |
|
2978 | batchedcommands = [] | |
2979 | elif action == 'batchsubmit': |
|
2979 | elif action == 'batchsubmit': | |
2980 | # There is a batching API we could go through. But it would be |
|
2980 | # There is a batching API we could go through. But it would be | |
2981 | # difficult to normalize requests into function calls. It is easier |
|
2981 | # difficult to normalize requests into function calls. It is easier | |
2982 | # to bypass this layer and normalize to commands + args. |
|
2982 | # to bypass this layer and normalize to commands + args. | |
2983 | ui.status(_('sending batch with %d sub-commands\n') % |
|
2983 | ui.status(_('sending batch with %d sub-commands\n') % | |
2984 | len(batchedcommands)) |
|
2984 | len(batchedcommands)) | |
2985 | for i, chunk in enumerate(peer._submitbatch(batchedcommands)): |
|
2985 | for i, chunk in enumerate(peer._submitbatch(batchedcommands)): | |
2986 | ui.status(_('response #%d: %s\n') % |
|
2986 | ui.status(_('response #%d: %s\n') % | |
2987 | (i, stringutil.escapedata(chunk))) |
|
2987 | (i, stringutil.escapedata(chunk))) | |
2988 |
|
2988 | |||
2989 | batchedcommands = None |
|
2989 | batchedcommands = None | |
2990 |
|
2990 | |||
2991 | elif action.startswith('httprequest '): |
|
2991 | elif action.startswith('httprequest '): | |
2992 | if not opener: |
|
2992 | if not opener: | |
2993 | raise error.Abort(_('cannot use httprequest without an HTTP ' |
|
2993 | raise error.Abort(_('cannot use httprequest without an HTTP ' | |
2994 | 'peer')) |
|
2994 | 'peer')) | |
2995 |
|
2995 | |||
2996 | request = action.split(' ', 2) |
|
2996 | request = action.split(' ', 2) | |
2997 | if len(request) != 3: |
|
2997 | if len(request) != 3: | |
2998 | raise error.Abort(_('invalid httprequest: expected format is ' |
|
2998 | raise error.Abort(_('invalid httprequest: expected format is ' | |
2999 | '"httprequest <method> <path>')) |
|
2999 | '"httprequest <method> <path>')) | |
3000 |
|
3000 | |||
3001 | method, httppath = request[1:] |
|
3001 | method, httppath = request[1:] | |
3002 | headers = {} |
|
3002 | headers = {} | |
3003 | body = None |
|
3003 | body = None | |
3004 | frames = [] |
|
3004 | frames = [] | |
3005 | for line in lines: |
|
3005 | for line in lines: | |
3006 | line = line.lstrip() |
|
3006 | line = line.lstrip() | |
3007 | m = re.match(b'^([a-zA-Z0-9_-]+): (.*)$', line) |
|
3007 | m = re.match(b'^([a-zA-Z0-9_-]+): (.*)$', line) | |
3008 | if m: |
|
3008 | if m: | |
3009 | headers[m.group(1)] = m.group(2) |
|
3009 | headers[m.group(1)] = m.group(2) | |
3010 | continue |
|
3010 | continue | |
3011 |
|
3011 | |||
3012 | if line.startswith(b'BODYFILE '): |
|
3012 | if line.startswith(b'BODYFILE '): | |
3013 | with open(line.split(b' ', 1), 'rb') as fh: |
|
3013 | with open(line.split(b' ', 1), 'rb') as fh: | |
3014 | body = fh.read() |
|
3014 | body = fh.read() | |
3015 | elif line.startswith(b'frame '): |
|
3015 | elif line.startswith(b'frame '): | |
3016 | frame = wireprotoframing.makeframefromhumanstring( |
|
3016 | frame = wireprotoframing.makeframefromhumanstring( | |
3017 | line[len(b'frame '):]) |
|
3017 | line[len(b'frame '):]) | |
3018 |
|
3018 | |||
3019 | frames.append(frame) |
|
3019 | frames.append(frame) | |
3020 | else: |
|
3020 | else: | |
3021 | raise error.Abort(_('unknown argument to httprequest: %s') % |
|
3021 | raise error.Abort(_('unknown argument to httprequest: %s') % | |
3022 | line) |
|
3022 | line) | |
3023 |
|
3023 | |||
3024 | url = path + httppath |
|
3024 | url = path + httppath | |
3025 |
|
3025 | |||
3026 | if frames: |
|
3026 | if frames: | |
3027 | body = b''.join(bytes(f) for f in frames) |
|
3027 | body = b''.join(bytes(f) for f in frames) | |
3028 |
|
3028 | |||
3029 | req = urlmod.urlreq.request(pycompat.strurl(url), body, headers) |
|
3029 | req = urlmod.urlreq.request(pycompat.strurl(url), body, headers) | |
3030 |
|
3030 | |||
3031 | # urllib.Request insists on using has_data() as a proxy for |
|
3031 | # urllib.Request insists on using has_data() as a proxy for | |
3032 | # determining the request method. Override that to use our |
|
3032 | # determining the request method. Override that to use our | |
3033 | # explicitly requested method. |
|
3033 | # explicitly requested method. | |
3034 | req.get_method = lambda: method |
|
3034 | req.get_method = lambda: method | |
3035 |
|
3035 | |||
3036 | try: |
|
3036 | try: | |
3037 | opener.open(req).read() |
|
3037 | opener.open(req).read() | |
3038 | except util.urlerr.urlerror as e: |
|
3038 | except util.urlerr.urlerror as e: | |
3039 | e.read() |
|
3039 | e.read() | |
3040 |
|
3040 | |||
3041 | elif action == 'close': |
|
3041 | elif action == 'close': | |
3042 | peer.close() |
|
3042 | peer.close() | |
3043 | elif action == 'readavailable': |
|
3043 | elif action == 'readavailable': | |
3044 | if not stdout or not stderr: |
|
3044 | if not stdout or not stderr: | |
3045 | raise error.Abort(_('readavailable not available on this peer')) |
|
3045 | raise error.Abort(_('readavailable not available on this peer')) | |
3046 |
|
3046 | |||
3047 | stdin.close() |
|
3047 | stdin.close() | |
3048 | stdout.read() |
|
3048 | stdout.read() | |
3049 | stderr.read() |
|
3049 | stderr.read() | |
3050 |
|
3050 | |||
3051 | elif action == 'readline': |
|
3051 | elif action == 'readline': | |
3052 | if not stdout: |
|
3052 | if not stdout: | |
3053 | raise error.Abort(_('readline not available on this peer')) |
|
3053 | raise error.Abort(_('readline not available on this peer')) | |
3054 | stdout.readline() |
|
3054 | stdout.readline() | |
3055 | elif action == 'ereadline': |
|
3055 | elif action == 'ereadline': | |
3056 | if not stderr: |
|
3056 | if not stderr: | |
3057 | raise error.Abort(_('ereadline not available on this peer')) |
|
3057 | raise error.Abort(_('ereadline not available on this peer')) | |
3058 | stderr.readline() |
|
3058 | stderr.readline() | |
3059 | elif action.startswith('read '): |
|
3059 | elif action.startswith('read '): | |
3060 | count = int(action.split(' ', 1)[1]) |
|
3060 | count = int(action.split(' ', 1)[1]) | |
3061 | if not stdout: |
|
3061 | if not stdout: | |
3062 | raise error.Abort(_('read not available on this peer')) |
|
3062 | raise error.Abort(_('read not available on this peer')) | |
3063 | stdout.read(count) |
|
3063 | stdout.read(count) | |
3064 | elif action.startswith('eread '): |
|
3064 | elif action.startswith('eread '): | |
3065 | count = int(action.split(' ', 1)[1]) |
|
3065 | count = int(action.split(' ', 1)[1]) | |
3066 | if not stderr: |
|
3066 | if not stderr: | |
3067 | raise error.Abort(_('eread not available on this peer')) |
|
3067 | raise error.Abort(_('eread not available on this peer')) | |
3068 | stderr.read(count) |
|
3068 | stderr.read(count) | |
3069 | else: |
|
3069 | else: | |
3070 | raise error.Abort(_('unknown action: %s') % action) |
|
3070 | raise error.Abort(_('unknown action: %s') % action) | |
3071 |
|
3071 | |||
3072 | if batchedcommands is not None: |
|
3072 | if batchedcommands is not None: | |
3073 | raise error.Abort(_('unclosed "batchbegin" request')) |
|
3073 | raise error.Abort(_('unclosed "batchbegin" request')) | |
3074 |
|
3074 | |||
3075 | if peer: |
|
3075 | if peer: | |
3076 | peer.close() |
|
3076 | peer.close() | |
3077 |
|
3077 | |||
3078 | if proc: |
|
3078 | if proc: | |
3079 | proc.kill() |
|
3079 | proc.kill() |
@@ -1,526 +1,540 b'' | |||||
1 | # stringutil.py - utility for generic string formatting, parsing, etc. |
|
1 | # stringutil.py - utility for generic string formatting, parsing, etc. | |
2 | # |
|
2 | # | |
3 | # Copyright 2005 K. Thananchayan <thananck@yahoo.com> |
|
3 | # Copyright 2005 K. Thananchayan <thananck@yahoo.com> | |
4 | # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> |
|
4 | # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> | |
5 | # Copyright 2006 Vadim Gelfer <vadim.gelfer@gmail.com> |
|
5 | # Copyright 2006 Vadim Gelfer <vadim.gelfer@gmail.com> | |
6 | # |
|
6 | # | |
7 | # This software may be used and distributed according to the terms of the |
|
7 | # This software may be used and distributed according to the terms of the | |
8 | # GNU General Public License version 2 or any later version. |
|
8 | # GNU General Public License version 2 or any later version. | |
9 |
|
9 | |||
10 | from __future__ import absolute_import |
|
10 | from __future__ import absolute_import | |
11 |
|
11 | |||
12 | import __future__ |
|
12 | import __future__ | |
13 | import codecs |
|
13 | import codecs | |
14 | import re as remod |
|
14 | import re as remod | |
15 | import textwrap |
|
15 | import textwrap | |
16 |
|
16 | |||
17 | from ..i18n import _ |
|
17 | from ..i18n import _ | |
18 | from ..thirdparty import attr |
|
18 | from ..thirdparty import attr | |
19 |
|
19 | |||
20 | from .. import ( |
|
20 | from .. import ( | |
21 | encoding, |
|
21 | encoding, | |
22 | error, |
|
22 | error, | |
23 | pycompat, |
|
23 | pycompat, | |
24 | ) |
|
24 | ) | |
25 |
|
25 | |||
26 | _DATA_ESCAPE_MAP = {pycompat.bytechr(i): br'\x%02x' % i for i in range(256)} |
|
26 | _DATA_ESCAPE_MAP = {pycompat.bytechr(i): br'\x%02x' % i for i in range(256)} | |
27 | _DATA_ESCAPE_MAP.update({ |
|
27 | _DATA_ESCAPE_MAP.update({ | |
28 | b'\\': b'\\\\', |
|
28 | b'\\': b'\\\\', | |
29 | b'\r': br'\r', |
|
29 | b'\r': br'\r', | |
30 | b'\n': br'\n', |
|
30 | b'\n': br'\n', | |
31 | }) |
|
31 | }) | |
32 | _DATA_ESCAPE_RE = remod.compile(br'[\x00-\x08\x0a-\x1f\\\x7f-\xff]') |
|
32 | _DATA_ESCAPE_RE = remod.compile(br'[\x00-\x08\x0a-\x1f\\\x7f-\xff]') | |
33 |
|
33 | |||
34 | def escapedata(s): |
|
34 | def escapedata(s): | |
35 | if isinstance(s, bytearray): |
|
35 | if isinstance(s, bytearray): | |
36 | s = bytes(s) |
|
36 | s = bytes(s) | |
37 |
|
37 | |||
38 | return _DATA_ESCAPE_RE.sub(lambda m: _DATA_ESCAPE_MAP[m.group(0)], s) |
|
38 | return _DATA_ESCAPE_RE.sub(lambda m: _DATA_ESCAPE_MAP[m.group(0)], s) | |
39 |
|
39 | |||
|
40 | def pprint(o): | |||
|
41 | """Pretty print an object.""" | |||
|
42 | if isinstance(o, (bytes, bytearray)): | |||
|
43 | return "b'%s'" % escapedata(o) | |||
|
44 | elif isinstance(o, list): | |||
|
45 | return '[%s]' % (b', '.join(pprint(a) for a in o)) | |||
|
46 | elif isinstance(o, dict): | |||
|
47 | return '{%s}' % (b', '.join( | |||
|
48 | '%s: %s' % (pprint(k), pprint(v)) for k, v in sorted(o.items()))) | |||
|
49 | elif isinstance(o, bool): | |||
|
50 | return b'True' if o else b'False' | |||
|
51 | else: | |||
|
52 | raise error.ProgrammingError('do not know how to format %r' % o) | |||
|
53 | ||||
40 | def binary(s): |
|
54 | def binary(s): | |
41 | """return true if a string is binary data""" |
|
55 | """return true if a string is binary data""" | |
42 | return bool(s and '\0' in s) |
|
56 | return bool(s and '\0' in s) | |
43 |
|
57 | |||
44 | def stringmatcher(pattern, casesensitive=True): |
|
58 | def stringmatcher(pattern, casesensitive=True): | |
45 | """ |
|
59 | """ | |
46 | accepts a string, possibly starting with 're:' or 'literal:' prefix. |
|
60 | accepts a string, possibly starting with 're:' or 'literal:' prefix. | |
47 | returns the matcher name, pattern, and matcher function. |
|
61 | returns the matcher name, pattern, and matcher function. | |
48 | missing or unknown prefixes are treated as literal matches. |
|
62 | missing or unknown prefixes are treated as literal matches. | |
49 |
|
63 | |||
50 | helper for tests: |
|
64 | helper for tests: | |
51 | >>> def test(pattern, *tests): |
|
65 | >>> def test(pattern, *tests): | |
52 | ... kind, pattern, matcher = stringmatcher(pattern) |
|
66 | ... kind, pattern, matcher = stringmatcher(pattern) | |
53 | ... return (kind, pattern, [bool(matcher(t)) for t in tests]) |
|
67 | ... return (kind, pattern, [bool(matcher(t)) for t in tests]) | |
54 | >>> def itest(pattern, *tests): |
|
68 | >>> def itest(pattern, *tests): | |
55 | ... kind, pattern, matcher = stringmatcher(pattern, casesensitive=False) |
|
69 | ... kind, pattern, matcher = stringmatcher(pattern, casesensitive=False) | |
56 | ... return (kind, pattern, [bool(matcher(t)) for t in tests]) |
|
70 | ... return (kind, pattern, [bool(matcher(t)) for t in tests]) | |
57 |
|
71 | |||
58 | exact matching (no prefix): |
|
72 | exact matching (no prefix): | |
59 | >>> test(b'abcdefg', b'abc', b'def', b'abcdefg') |
|
73 | >>> test(b'abcdefg', b'abc', b'def', b'abcdefg') | |
60 | ('literal', 'abcdefg', [False, False, True]) |
|
74 | ('literal', 'abcdefg', [False, False, True]) | |
61 |
|
75 | |||
62 | regex matching ('re:' prefix) |
|
76 | regex matching ('re:' prefix) | |
63 | >>> test(b're:a.+b', b'nomatch', b'fooadef', b'fooadefbar') |
|
77 | >>> test(b're:a.+b', b'nomatch', b'fooadef', b'fooadefbar') | |
64 | ('re', 'a.+b', [False, False, True]) |
|
78 | ('re', 'a.+b', [False, False, True]) | |
65 |
|
79 | |||
66 | force exact matches ('literal:' prefix) |
|
80 | force exact matches ('literal:' prefix) | |
67 | >>> test(b'literal:re:foobar', b'foobar', b're:foobar') |
|
81 | >>> test(b'literal:re:foobar', b'foobar', b're:foobar') | |
68 | ('literal', 're:foobar', [False, True]) |
|
82 | ('literal', 're:foobar', [False, True]) | |
69 |
|
83 | |||
70 | unknown prefixes are ignored and treated as literals |
|
84 | unknown prefixes are ignored and treated as literals | |
71 | >>> test(b'foo:bar', b'foo', b'bar', b'foo:bar') |
|
85 | >>> test(b'foo:bar', b'foo', b'bar', b'foo:bar') | |
72 | ('literal', 'foo:bar', [False, False, True]) |
|
86 | ('literal', 'foo:bar', [False, False, True]) | |
73 |
|
87 | |||
74 | case insensitive regex matches |
|
88 | case insensitive regex matches | |
75 | >>> itest(b're:A.+b', b'nomatch', b'fooadef', b'fooadefBar') |
|
89 | >>> itest(b're:A.+b', b'nomatch', b'fooadef', b'fooadefBar') | |
76 | ('re', 'A.+b', [False, False, True]) |
|
90 | ('re', 'A.+b', [False, False, True]) | |
77 |
|
91 | |||
78 | case insensitive literal matches |
|
92 | case insensitive literal matches | |
79 | >>> itest(b'ABCDEFG', b'abc', b'def', b'abcdefg') |
|
93 | >>> itest(b'ABCDEFG', b'abc', b'def', b'abcdefg') | |
80 | ('literal', 'ABCDEFG', [False, False, True]) |
|
94 | ('literal', 'ABCDEFG', [False, False, True]) | |
81 | """ |
|
95 | """ | |
82 | if pattern.startswith('re:'): |
|
96 | if pattern.startswith('re:'): | |
83 | pattern = pattern[3:] |
|
97 | pattern = pattern[3:] | |
84 | try: |
|
98 | try: | |
85 | flags = 0 |
|
99 | flags = 0 | |
86 | if not casesensitive: |
|
100 | if not casesensitive: | |
87 | flags = remod.I |
|
101 | flags = remod.I | |
88 | regex = remod.compile(pattern, flags) |
|
102 | regex = remod.compile(pattern, flags) | |
89 | except remod.error as e: |
|
103 | except remod.error as e: | |
90 | raise error.ParseError(_('invalid regular expression: %s') |
|
104 | raise error.ParseError(_('invalid regular expression: %s') | |
91 | % e) |
|
105 | % e) | |
92 | return 're', pattern, regex.search |
|
106 | return 're', pattern, regex.search | |
93 | elif pattern.startswith('literal:'): |
|
107 | elif pattern.startswith('literal:'): | |
94 | pattern = pattern[8:] |
|
108 | pattern = pattern[8:] | |
95 |
|
109 | |||
96 | match = pattern.__eq__ |
|
110 | match = pattern.__eq__ | |
97 |
|
111 | |||
98 | if not casesensitive: |
|
112 | if not casesensitive: | |
99 | ipat = encoding.lower(pattern) |
|
113 | ipat = encoding.lower(pattern) | |
100 | match = lambda s: ipat == encoding.lower(s) |
|
114 | match = lambda s: ipat == encoding.lower(s) | |
101 | return 'literal', pattern, match |
|
115 | return 'literal', pattern, match | |
102 |
|
116 | |||
103 | def shortuser(user): |
|
117 | def shortuser(user): | |
104 | """Return a short representation of a user name or email address.""" |
|
118 | """Return a short representation of a user name or email address.""" | |
105 | f = user.find('@') |
|
119 | f = user.find('@') | |
106 | if f >= 0: |
|
120 | if f >= 0: | |
107 | user = user[:f] |
|
121 | user = user[:f] | |
108 | f = user.find('<') |
|
122 | f = user.find('<') | |
109 | if f >= 0: |
|
123 | if f >= 0: | |
110 | user = user[f + 1:] |
|
124 | user = user[f + 1:] | |
111 | f = user.find(' ') |
|
125 | f = user.find(' ') | |
112 | if f >= 0: |
|
126 | if f >= 0: | |
113 | user = user[:f] |
|
127 | user = user[:f] | |
114 | f = user.find('.') |
|
128 | f = user.find('.') | |
115 | if f >= 0: |
|
129 | if f >= 0: | |
116 | user = user[:f] |
|
130 | user = user[:f] | |
117 | return user |
|
131 | return user | |
118 |
|
132 | |||
119 | def emailuser(user): |
|
133 | def emailuser(user): | |
120 | """Return the user portion of an email address.""" |
|
134 | """Return the user portion of an email address.""" | |
121 | f = user.find('@') |
|
135 | f = user.find('@') | |
122 | if f >= 0: |
|
136 | if f >= 0: | |
123 | user = user[:f] |
|
137 | user = user[:f] | |
124 | f = user.find('<') |
|
138 | f = user.find('<') | |
125 | if f >= 0: |
|
139 | if f >= 0: | |
126 | user = user[f + 1:] |
|
140 | user = user[f + 1:] | |
127 | return user |
|
141 | return user | |
128 |
|
142 | |||
129 | def email(author): |
|
143 | def email(author): | |
130 | '''get email of author.''' |
|
144 | '''get email of author.''' | |
131 | r = author.find('>') |
|
145 | r = author.find('>') | |
132 | if r == -1: |
|
146 | if r == -1: | |
133 | r = None |
|
147 | r = None | |
134 | return author[author.find('<') + 1:r] |
|
148 | return author[author.find('<') + 1:r] | |
135 |
|
149 | |||
136 | def person(author): |
|
150 | def person(author): | |
137 | """Returns the name before an email address, |
|
151 | """Returns the name before an email address, | |
138 | interpreting it as per RFC 5322 |
|
152 | interpreting it as per RFC 5322 | |
139 |
|
153 | |||
140 | >>> person(b'foo@bar') |
|
154 | >>> person(b'foo@bar') | |
141 | 'foo' |
|
155 | 'foo' | |
142 | >>> person(b'Foo Bar <foo@bar>') |
|
156 | >>> person(b'Foo Bar <foo@bar>') | |
143 | 'Foo Bar' |
|
157 | 'Foo Bar' | |
144 | >>> person(b'"Foo Bar" <foo@bar>') |
|
158 | >>> person(b'"Foo Bar" <foo@bar>') | |
145 | 'Foo Bar' |
|
159 | 'Foo Bar' | |
146 | >>> person(b'"Foo \"buz\" Bar" <foo@bar>') |
|
160 | >>> person(b'"Foo \"buz\" Bar" <foo@bar>') | |
147 | 'Foo "buz" Bar' |
|
161 | 'Foo "buz" Bar' | |
148 | >>> # The following are invalid, but do exist in real-life |
|
162 | >>> # The following are invalid, but do exist in real-life | |
149 | ... |
|
163 | ... | |
150 | >>> person(b'Foo "buz" Bar <foo@bar>') |
|
164 | >>> person(b'Foo "buz" Bar <foo@bar>') | |
151 | 'Foo "buz" Bar' |
|
165 | 'Foo "buz" Bar' | |
152 | >>> person(b'"Foo Bar <foo@bar>') |
|
166 | >>> person(b'"Foo Bar <foo@bar>') | |
153 | 'Foo Bar' |
|
167 | 'Foo Bar' | |
154 | """ |
|
168 | """ | |
155 | if '@' not in author: |
|
169 | if '@' not in author: | |
156 | return author |
|
170 | return author | |
157 | f = author.find('<') |
|
171 | f = author.find('<') | |
158 | if f != -1: |
|
172 | if f != -1: | |
159 | return author[:f].strip(' "').replace('\\"', '"') |
|
173 | return author[:f].strip(' "').replace('\\"', '"') | |
160 | f = author.find('@') |
|
174 | f = author.find('@') | |
161 | return author[:f].replace('.', ' ') |
|
175 | return author[:f].replace('.', ' ') | |
162 |
|
176 | |||
163 | @attr.s(hash=True) |
|
177 | @attr.s(hash=True) | |
164 | class mailmapping(object): |
|
178 | class mailmapping(object): | |
165 | '''Represents a username/email key or value in |
|
179 | '''Represents a username/email key or value in | |
166 | a mailmap file''' |
|
180 | a mailmap file''' | |
167 | email = attr.ib() |
|
181 | email = attr.ib() | |
168 | name = attr.ib(default=None) |
|
182 | name = attr.ib(default=None) | |
169 |
|
183 | |||
170 | def _ismailmaplineinvalid(names, emails): |
|
184 | def _ismailmaplineinvalid(names, emails): | |
171 | '''Returns True if the parsed names and emails |
|
185 | '''Returns True if the parsed names and emails | |
172 | in a mailmap entry are invalid. |
|
186 | in a mailmap entry are invalid. | |
173 |
|
187 | |||
174 | >>> # No names or emails fails |
|
188 | >>> # No names or emails fails | |
175 | >>> names, emails = [], [] |
|
189 | >>> names, emails = [], [] | |
176 | >>> _ismailmaplineinvalid(names, emails) |
|
190 | >>> _ismailmaplineinvalid(names, emails) | |
177 | True |
|
191 | True | |
178 | >>> # Only one email fails |
|
192 | >>> # Only one email fails | |
179 | >>> emails = [b'email@email.com'] |
|
193 | >>> emails = [b'email@email.com'] | |
180 | >>> _ismailmaplineinvalid(names, emails) |
|
194 | >>> _ismailmaplineinvalid(names, emails) | |
181 | True |
|
195 | True | |
182 | >>> # One email and one name passes |
|
196 | >>> # One email and one name passes | |
183 | >>> names = [b'Test Name'] |
|
197 | >>> names = [b'Test Name'] | |
184 | >>> _ismailmaplineinvalid(names, emails) |
|
198 | >>> _ismailmaplineinvalid(names, emails) | |
185 | False |
|
199 | False | |
186 | >>> # No names but two emails passes |
|
200 | >>> # No names but two emails passes | |
187 | >>> names = [] |
|
201 | >>> names = [] | |
188 | >>> emails = [b'proper@email.com', b'commit@email.com'] |
|
202 | >>> emails = [b'proper@email.com', b'commit@email.com'] | |
189 | >>> _ismailmaplineinvalid(names, emails) |
|
203 | >>> _ismailmaplineinvalid(names, emails) | |
190 | False |
|
204 | False | |
191 | ''' |
|
205 | ''' | |
192 | return not emails or not names and len(emails) < 2 |
|
206 | return not emails or not names and len(emails) < 2 | |
193 |
|
207 | |||
194 | def parsemailmap(mailmapcontent): |
|
208 | def parsemailmap(mailmapcontent): | |
195 | """Parses data in the .mailmap format |
|
209 | """Parses data in the .mailmap format | |
196 |
|
210 | |||
197 | >>> mmdata = b"\\n".join([ |
|
211 | >>> mmdata = b"\\n".join([ | |
198 | ... b'# Comment', |
|
212 | ... b'# Comment', | |
199 | ... b'Name <commit1@email.xx>', |
|
213 | ... b'Name <commit1@email.xx>', | |
200 | ... b'<name@email.xx> <commit2@email.xx>', |
|
214 | ... b'<name@email.xx> <commit2@email.xx>', | |
201 | ... b'Name <proper@email.xx> <commit3@email.xx>', |
|
215 | ... b'Name <proper@email.xx> <commit3@email.xx>', | |
202 | ... b'Name <proper@email.xx> Commit <commit4@email.xx>', |
|
216 | ... b'Name <proper@email.xx> Commit <commit4@email.xx>', | |
203 | ... ]) |
|
217 | ... ]) | |
204 | >>> mm = parsemailmap(mmdata) |
|
218 | >>> mm = parsemailmap(mmdata) | |
205 | >>> for key in sorted(mm.keys()): |
|
219 | >>> for key in sorted(mm.keys()): | |
206 | ... print(key) |
|
220 | ... print(key) | |
207 | mailmapping(email='commit1@email.xx', name=None) |
|
221 | mailmapping(email='commit1@email.xx', name=None) | |
208 | mailmapping(email='commit2@email.xx', name=None) |
|
222 | mailmapping(email='commit2@email.xx', name=None) | |
209 | mailmapping(email='commit3@email.xx', name=None) |
|
223 | mailmapping(email='commit3@email.xx', name=None) | |
210 | mailmapping(email='commit4@email.xx', name='Commit') |
|
224 | mailmapping(email='commit4@email.xx', name='Commit') | |
211 | >>> for val in sorted(mm.values()): |
|
225 | >>> for val in sorted(mm.values()): | |
212 | ... print(val) |
|
226 | ... print(val) | |
213 | mailmapping(email='commit1@email.xx', name='Name') |
|
227 | mailmapping(email='commit1@email.xx', name='Name') | |
214 | mailmapping(email='name@email.xx', name=None) |
|
228 | mailmapping(email='name@email.xx', name=None) | |
215 | mailmapping(email='proper@email.xx', name='Name') |
|
229 | mailmapping(email='proper@email.xx', name='Name') | |
216 | mailmapping(email='proper@email.xx', name='Name') |
|
230 | mailmapping(email='proper@email.xx', name='Name') | |
217 | """ |
|
231 | """ | |
218 | mailmap = {} |
|
232 | mailmap = {} | |
219 |
|
233 | |||
220 | if mailmapcontent is None: |
|
234 | if mailmapcontent is None: | |
221 | return mailmap |
|
235 | return mailmap | |
222 |
|
236 | |||
223 | for line in mailmapcontent.splitlines(): |
|
237 | for line in mailmapcontent.splitlines(): | |
224 |
|
238 | |||
225 | # Don't bother checking the line if it is a comment or |
|
239 | # Don't bother checking the line if it is a comment or | |
226 | # is an improperly formed author field |
|
240 | # is an improperly formed author field | |
227 | if line.lstrip().startswith('#'): |
|
241 | if line.lstrip().startswith('#'): | |
228 | continue |
|
242 | continue | |
229 |
|
243 | |||
230 | # names, emails hold the parsed emails and names for each line |
|
244 | # names, emails hold the parsed emails and names for each line | |
231 | # name_builder holds the words in a persons name |
|
245 | # name_builder holds the words in a persons name | |
232 | names, emails = [], [] |
|
246 | names, emails = [], [] | |
233 | namebuilder = [] |
|
247 | namebuilder = [] | |
234 |
|
248 | |||
235 | for element in line.split(): |
|
249 | for element in line.split(): | |
236 | if element.startswith('#'): |
|
250 | if element.startswith('#'): | |
237 | # If we reach a comment in the mailmap file, move on |
|
251 | # If we reach a comment in the mailmap file, move on | |
238 | break |
|
252 | break | |
239 |
|
253 | |||
240 | elif element.startswith('<') and element.endswith('>'): |
|
254 | elif element.startswith('<') and element.endswith('>'): | |
241 | # We have found an email. |
|
255 | # We have found an email. | |
242 | # Parse it, and finalize any names from earlier |
|
256 | # Parse it, and finalize any names from earlier | |
243 | emails.append(element[1:-1]) # Slice off the "<>" |
|
257 | emails.append(element[1:-1]) # Slice off the "<>" | |
244 |
|
258 | |||
245 | if namebuilder: |
|
259 | if namebuilder: | |
246 | names.append(' '.join(namebuilder)) |
|
260 | names.append(' '.join(namebuilder)) | |
247 | namebuilder = [] |
|
261 | namebuilder = [] | |
248 |
|
262 | |||
249 | # Break if we have found a second email, any other |
|
263 | # Break if we have found a second email, any other | |
250 | # data does not fit the spec for .mailmap |
|
264 | # data does not fit the spec for .mailmap | |
251 | if len(emails) > 1: |
|
265 | if len(emails) > 1: | |
252 | break |
|
266 | break | |
253 |
|
267 | |||
254 | else: |
|
268 | else: | |
255 | # We have found another word in the committers name |
|
269 | # We have found another word in the committers name | |
256 | namebuilder.append(element) |
|
270 | namebuilder.append(element) | |
257 |
|
271 | |||
258 | # Check to see if we have parsed the line into a valid form |
|
272 | # Check to see if we have parsed the line into a valid form | |
259 | # We require at least one email, and either at least one |
|
273 | # We require at least one email, and either at least one | |
260 | # name or a second email |
|
274 | # name or a second email | |
261 | if _ismailmaplineinvalid(names, emails): |
|
275 | if _ismailmaplineinvalid(names, emails): | |
262 | continue |
|
276 | continue | |
263 |
|
277 | |||
264 | mailmapkey = mailmapping( |
|
278 | mailmapkey = mailmapping( | |
265 | email=emails[-1], |
|
279 | email=emails[-1], | |
266 | name=names[-1] if len(names) == 2 else None, |
|
280 | name=names[-1] if len(names) == 2 else None, | |
267 | ) |
|
281 | ) | |
268 |
|
282 | |||
269 | mailmap[mailmapkey] = mailmapping( |
|
283 | mailmap[mailmapkey] = mailmapping( | |
270 | email=emails[0], |
|
284 | email=emails[0], | |
271 | name=names[0] if names else None, |
|
285 | name=names[0] if names else None, | |
272 | ) |
|
286 | ) | |
273 |
|
287 | |||
274 | return mailmap |
|
288 | return mailmap | |
275 |
|
289 | |||
276 | def mapname(mailmap, author): |
|
290 | def mapname(mailmap, author): | |
277 | """Returns the author field according to the mailmap cache, or |
|
291 | """Returns the author field according to the mailmap cache, or | |
278 | the original author field. |
|
292 | the original author field. | |
279 |
|
293 | |||
280 | >>> mmdata = b"\\n".join([ |
|
294 | >>> mmdata = b"\\n".join([ | |
281 | ... b'# Comment', |
|
295 | ... b'# Comment', | |
282 | ... b'Name <commit1@email.xx>', |
|
296 | ... b'Name <commit1@email.xx>', | |
283 | ... b'<name@email.xx> <commit2@email.xx>', |
|
297 | ... b'<name@email.xx> <commit2@email.xx>', | |
284 | ... b'Name <proper@email.xx> <commit3@email.xx>', |
|
298 | ... b'Name <proper@email.xx> <commit3@email.xx>', | |
285 | ... b'Name <proper@email.xx> Commit <commit4@email.xx>', |
|
299 | ... b'Name <proper@email.xx> Commit <commit4@email.xx>', | |
286 | ... ]) |
|
300 | ... ]) | |
287 | >>> m = parsemailmap(mmdata) |
|
301 | >>> m = parsemailmap(mmdata) | |
288 | >>> mapname(m, b'Commit <commit1@email.xx>') |
|
302 | >>> mapname(m, b'Commit <commit1@email.xx>') | |
289 | 'Name <commit1@email.xx>' |
|
303 | 'Name <commit1@email.xx>' | |
290 | >>> mapname(m, b'Name <commit2@email.xx>') |
|
304 | >>> mapname(m, b'Name <commit2@email.xx>') | |
291 | 'Name <name@email.xx>' |
|
305 | 'Name <name@email.xx>' | |
292 | >>> mapname(m, b'Commit <commit3@email.xx>') |
|
306 | >>> mapname(m, b'Commit <commit3@email.xx>') | |
293 | 'Name <proper@email.xx>' |
|
307 | 'Name <proper@email.xx>' | |
294 | >>> mapname(m, b'Commit <commit4@email.xx>') |
|
308 | >>> mapname(m, b'Commit <commit4@email.xx>') | |
295 | 'Name <proper@email.xx>' |
|
309 | 'Name <proper@email.xx>' | |
296 | >>> mapname(m, b'Unknown Name <unknown@email.com>') |
|
310 | >>> mapname(m, b'Unknown Name <unknown@email.com>') | |
297 | 'Unknown Name <unknown@email.com>' |
|
311 | 'Unknown Name <unknown@email.com>' | |
298 | """ |
|
312 | """ | |
299 | # If the author field coming in isn't in the correct format, |
|
313 | # If the author field coming in isn't in the correct format, | |
300 | # or the mailmap is empty just return the original author field |
|
314 | # or the mailmap is empty just return the original author field | |
301 | if not isauthorwellformed(author) or not mailmap: |
|
315 | if not isauthorwellformed(author) or not mailmap: | |
302 | return author |
|
316 | return author | |
303 |
|
317 | |||
304 | # Turn the user name into a mailmapping |
|
318 | # Turn the user name into a mailmapping | |
305 | commit = mailmapping(name=person(author), email=email(author)) |
|
319 | commit = mailmapping(name=person(author), email=email(author)) | |
306 |
|
320 | |||
307 | try: |
|
321 | try: | |
308 | # Try and use both the commit email and name as the key |
|
322 | # Try and use both the commit email and name as the key | |
309 | proper = mailmap[commit] |
|
323 | proper = mailmap[commit] | |
310 |
|
324 | |||
311 | except KeyError: |
|
325 | except KeyError: | |
312 | # If the lookup fails, use just the email as the key instead |
|
326 | # If the lookup fails, use just the email as the key instead | |
313 | # We call this commit2 as not to erase original commit fields |
|
327 | # We call this commit2 as not to erase original commit fields | |
314 | commit2 = mailmapping(email=commit.email) |
|
328 | commit2 = mailmapping(email=commit.email) | |
315 | proper = mailmap.get(commit2, mailmapping(None, None)) |
|
329 | proper = mailmap.get(commit2, mailmapping(None, None)) | |
316 |
|
330 | |||
317 | # Return the author field with proper values filled in |
|
331 | # Return the author field with proper values filled in | |
318 | return '%s <%s>' % ( |
|
332 | return '%s <%s>' % ( | |
319 | proper.name if proper.name else commit.name, |
|
333 | proper.name if proper.name else commit.name, | |
320 | proper.email if proper.email else commit.email, |
|
334 | proper.email if proper.email else commit.email, | |
321 | ) |
|
335 | ) | |
322 |
|
336 | |||
323 | _correctauthorformat = remod.compile(br'^[^<]+\s\<[^<>]+@[^<>]+\>$') |
|
337 | _correctauthorformat = remod.compile(br'^[^<]+\s\<[^<>]+@[^<>]+\>$') | |
324 |
|
338 | |||
325 | def isauthorwellformed(author): |
|
339 | def isauthorwellformed(author): | |
326 | '''Return True if the author field is well formed |
|
340 | '''Return True if the author field is well formed | |
327 | (ie "Contributor Name <contrib@email.dom>") |
|
341 | (ie "Contributor Name <contrib@email.dom>") | |
328 |
|
342 | |||
329 | >>> isauthorwellformed(b'Good Author <good@author.com>') |
|
343 | >>> isauthorwellformed(b'Good Author <good@author.com>') | |
330 | True |
|
344 | True | |
331 | >>> isauthorwellformed(b'Author <good@author.com>') |
|
345 | >>> isauthorwellformed(b'Author <good@author.com>') | |
332 | True |
|
346 | True | |
333 | >>> isauthorwellformed(b'Bad Author') |
|
347 | >>> isauthorwellformed(b'Bad Author') | |
334 | False |
|
348 | False | |
335 | >>> isauthorwellformed(b'Bad Author <author@author.com') |
|
349 | >>> isauthorwellformed(b'Bad Author <author@author.com') | |
336 | False |
|
350 | False | |
337 | >>> isauthorwellformed(b'Bad Author author@author.com') |
|
351 | >>> isauthorwellformed(b'Bad Author author@author.com') | |
338 | False |
|
352 | False | |
339 | >>> isauthorwellformed(b'<author@author.com>') |
|
353 | >>> isauthorwellformed(b'<author@author.com>') | |
340 | False |
|
354 | False | |
341 | >>> isauthorwellformed(b'Bad Author <author>') |
|
355 | >>> isauthorwellformed(b'Bad Author <author>') | |
342 | False |
|
356 | False | |
343 | ''' |
|
357 | ''' | |
344 | return _correctauthorformat.match(author) is not None |
|
358 | return _correctauthorformat.match(author) is not None | |
345 |
|
359 | |||
346 | def ellipsis(text, maxlength=400): |
|
360 | def ellipsis(text, maxlength=400): | |
347 | """Trim string to at most maxlength (default: 400) columns in display.""" |
|
361 | """Trim string to at most maxlength (default: 400) columns in display.""" | |
348 | return encoding.trim(text, maxlength, ellipsis='...') |
|
362 | return encoding.trim(text, maxlength, ellipsis='...') | |
349 |
|
363 | |||
350 | def escapestr(s): |
|
364 | def escapestr(s): | |
351 | # call underlying function of s.encode('string_escape') directly for |
|
365 | # call underlying function of s.encode('string_escape') directly for | |
352 | # Python 3 compatibility |
|
366 | # Python 3 compatibility | |
353 | return codecs.escape_encode(s)[0] |
|
367 | return codecs.escape_encode(s)[0] | |
354 |
|
368 | |||
355 | def unescapestr(s): |
|
369 | def unescapestr(s): | |
356 | return codecs.escape_decode(s)[0] |
|
370 | return codecs.escape_decode(s)[0] | |
357 |
|
371 | |||
358 | def forcebytestr(obj): |
|
372 | def forcebytestr(obj): | |
359 | """Portably format an arbitrary object (e.g. exception) into a byte |
|
373 | """Portably format an arbitrary object (e.g. exception) into a byte | |
360 | string.""" |
|
374 | string.""" | |
361 | try: |
|
375 | try: | |
362 | return pycompat.bytestr(obj) |
|
376 | return pycompat.bytestr(obj) | |
363 | except UnicodeEncodeError: |
|
377 | except UnicodeEncodeError: | |
364 | # non-ascii string, may be lossy |
|
378 | # non-ascii string, may be lossy | |
365 | return pycompat.bytestr(encoding.strtolocal(str(obj))) |
|
379 | return pycompat.bytestr(encoding.strtolocal(str(obj))) | |
366 |
|
380 | |||
367 | def uirepr(s): |
|
381 | def uirepr(s): | |
368 | # Avoid double backslash in Windows path repr() |
|
382 | # Avoid double backslash in Windows path repr() | |
369 | return pycompat.byterepr(pycompat.bytestr(s)).replace(b'\\\\', b'\\') |
|
383 | return pycompat.byterepr(pycompat.bytestr(s)).replace(b'\\\\', b'\\') | |
370 |
|
384 | |||
371 | # delay import of textwrap |
|
385 | # delay import of textwrap | |
372 | def _MBTextWrapper(**kwargs): |
|
386 | def _MBTextWrapper(**kwargs): | |
373 | class tw(textwrap.TextWrapper): |
|
387 | class tw(textwrap.TextWrapper): | |
374 | """ |
|
388 | """ | |
375 | Extend TextWrapper for width-awareness. |
|
389 | Extend TextWrapper for width-awareness. | |
376 |
|
390 | |||
377 | Neither number of 'bytes' in any encoding nor 'characters' is |
|
391 | Neither number of 'bytes' in any encoding nor 'characters' is | |
378 | appropriate to calculate terminal columns for specified string. |
|
392 | appropriate to calculate terminal columns for specified string. | |
379 |
|
393 | |||
380 | Original TextWrapper implementation uses built-in 'len()' directly, |
|
394 | Original TextWrapper implementation uses built-in 'len()' directly, | |
381 | so overriding is needed to use width information of each characters. |
|
395 | so overriding is needed to use width information of each characters. | |
382 |
|
396 | |||
383 | In addition, characters classified into 'ambiguous' width are |
|
397 | In addition, characters classified into 'ambiguous' width are | |
384 | treated as wide in East Asian area, but as narrow in other. |
|
398 | treated as wide in East Asian area, but as narrow in other. | |
385 |
|
399 | |||
386 | This requires use decision to determine width of such characters. |
|
400 | This requires use decision to determine width of such characters. | |
387 | """ |
|
401 | """ | |
388 | def _cutdown(self, ucstr, space_left): |
|
402 | def _cutdown(self, ucstr, space_left): | |
389 | l = 0 |
|
403 | l = 0 | |
390 | colwidth = encoding.ucolwidth |
|
404 | colwidth = encoding.ucolwidth | |
391 | for i in xrange(len(ucstr)): |
|
405 | for i in xrange(len(ucstr)): | |
392 | l += colwidth(ucstr[i]) |
|
406 | l += colwidth(ucstr[i]) | |
393 | if space_left < l: |
|
407 | if space_left < l: | |
394 | return (ucstr[:i], ucstr[i:]) |
|
408 | return (ucstr[:i], ucstr[i:]) | |
395 | return ucstr, '' |
|
409 | return ucstr, '' | |
396 |
|
410 | |||
397 | # overriding of base class |
|
411 | # overriding of base class | |
398 | def _handle_long_word(self, reversed_chunks, cur_line, cur_len, width): |
|
412 | def _handle_long_word(self, reversed_chunks, cur_line, cur_len, width): | |
399 | space_left = max(width - cur_len, 1) |
|
413 | space_left = max(width - cur_len, 1) | |
400 |
|
414 | |||
401 | if self.break_long_words: |
|
415 | if self.break_long_words: | |
402 | cut, res = self._cutdown(reversed_chunks[-1], space_left) |
|
416 | cut, res = self._cutdown(reversed_chunks[-1], space_left) | |
403 | cur_line.append(cut) |
|
417 | cur_line.append(cut) | |
404 | reversed_chunks[-1] = res |
|
418 | reversed_chunks[-1] = res | |
405 | elif not cur_line: |
|
419 | elif not cur_line: | |
406 | cur_line.append(reversed_chunks.pop()) |
|
420 | cur_line.append(reversed_chunks.pop()) | |
407 |
|
421 | |||
408 | # this overriding code is imported from TextWrapper of Python 2.6 |
|
422 | # this overriding code is imported from TextWrapper of Python 2.6 | |
409 | # to calculate columns of string by 'encoding.ucolwidth()' |
|
423 | # to calculate columns of string by 'encoding.ucolwidth()' | |
410 | def _wrap_chunks(self, chunks): |
|
424 | def _wrap_chunks(self, chunks): | |
411 | colwidth = encoding.ucolwidth |
|
425 | colwidth = encoding.ucolwidth | |
412 |
|
426 | |||
413 | lines = [] |
|
427 | lines = [] | |
414 | if self.width <= 0: |
|
428 | if self.width <= 0: | |
415 | raise ValueError("invalid width %r (must be > 0)" % self.width) |
|
429 | raise ValueError("invalid width %r (must be > 0)" % self.width) | |
416 |
|
430 | |||
417 | # Arrange in reverse order so items can be efficiently popped |
|
431 | # Arrange in reverse order so items can be efficiently popped | |
418 | # from a stack of chucks. |
|
432 | # from a stack of chucks. | |
419 | chunks.reverse() |
|
433 | chunks.reverse() | |
420 |
|
434 | |||
421 | while chunks: |
|
435 | while chunks: | |
422 |
|
436 | |||
423 | # Start the list of chunks that will make up the current line. |
|
437 | # Start the list of chunks that will make up the current line. | |
424 | # cur_len is just the length of all the chunks in cur_line. |
|
438 | # cur_len is just the length of all the chunks in cur_line. | |
425 | cur_line = [] |
|
439 | cur_line = [] | |
426 | cur_len = 0 |
|
440 | cur_len = 0 | |
427 |
|
441 | |||
428 | # Figure out which static string will prefix this line. |
|
442 | # Figure out which static string will prefix this line. | |
429 | if lines: |
|
443 | if lines: | |
430 | indent = self.subsequent_indent |
|
444 | indent = self.subsequent_indent | |
431 | else: |
|
445 | else: | |
432 | indent = self.initial_indent |
|
446 | indent = self.initial_indent | |
433 |
|
447 | |||
434 | # Maximum width for this line. |
|
448 | # Maximum width for this line. | |
435 | width = self.width - len(indent) |
|
449 | width = self.width - len(indent) | |
436 |
|
450 | |||
437 | # First chunk on line is whitespace -- drop it, unless this |
|
451 | # First chunk on line is whitespace -- drop it, unless this | |
438 | # is the very beginning of the text (i.e. no lines started yet). |
|
452 | # is the very beginning of the text (i.e. no lines started yet). | |
439 | if self.drop_whitespace and chunks[-1].strip() == r'' and lines: |
|
453 | if self.drop_whitespace and chunks[-1].strip() == r'' and lines: | |
440 | del chunks[-1] |
|
454 | del chunks[-1] | |
441 |
|
455 | |||
442 | while chunks: |
|
456 | while chunks: | |
443 | l = colwidth(chunks[-1]) |
|
457 | l = colwidth(chunks[-1]) | |
444 |
|
458 | |||
445 | # Can at least squeeze this chunk onto the current line. |
|
459 | # Can at least squeeze this chunk onto the current line. | |
446 | if cur_len + l <= width: |
|
460 | if cur_len + l <= width: | |
447 | cur_line.append(chunks.pop()) |
|
461 | cur_line.append(chunks.pop()) | |
448 | cur_len += l |
|
462 | cur_len += l | |
449 |
|
463 | |||
450 | # Nope, this line is full. |
|
464 | # Nope, this line is full. | |
451 | else: |
|
465 | else: | |
452 | break |
|
466 | break | |
453 |
|
467 | |||
454 | # The current line is full, and the next chunk is too big to |
|
468 | # The current line is full, and the next chunk is too big to | |
455 | # fit on *any* line (not just this one). |
|
469 | # fit on *any* line (not just this one). | |
456 | if chunks and colwidth(chunks[-1]) > width: |
|
470 | if chunks and colwidth(chunks[-1]) > width: | |
457 | self._handle_long_word(chunks, cur_line, cur_len, width) |
|
471 | self._handle_long_word(chunks, cur_line, cur_len, width) | |
458 |
|
472 | |||
459 | # If the last chunk on this line is all whitespace, drop it. |
|
473 | # If the last chunk on this line is all whitespace, drop it. | |
460 | if (self.drop_whitespace and |
|
474 | if (self.drop_whitespace and | |
461 | cur_line and cur_line[-1].strip() == r''): |
|
475 | cur_line and cur_line[-1].strip() == r''): | |
462 | del cur_line[-1] |
|
476 | del cur_line[-1] | |
463 |
|
477 | |||
464 | # Convert current line back to a string and store it in list |
|
478 | # Convert current line back to a string and store it in list | |
465 | # of all lines (return value). |
|
479 | # of all lines (return value). | |
466 | if cur_line: |
|
480 | if cur_line: | |
467 | lines.append(indent + r''.join(cur_line)) |
|
481 | lines.append(indent + r''.join(cur_line)) | |
468 |
|
482 | |||
469 | return lines |
|
483 | return lines | |
470 |
|
484 | |||
471 | global _MBTextWrapper |
|
485 | global _MBTextWrapper | |
472 | _MBTextWrapper = tw |
|
486 | _MBTextWrapper = tw | |
473 | return tw(**kwargs) |
|
487 | return tw(**kwargs) | |
474 |
|
488 | |||
475 | def wrap(line, width, initindent='', hangindent=''): |
|
489 | def wrap(line, width, initindent='', hangindent=''): | |
476 | maxindent = max(len(hangindent), len(initindent)) |
|
490 | maxindent = max(len(hangindent), len(initindent)) | |
477 | if width <= maxindent: |
|
491 | if width <= maxindent: | |
478 | # adjust for weird terminal size |
|
492 | # adjust for weird terminal size | |
479 | width = max(78, maxindent + 1) |
|
493 | width = max(78, maxindent + 1) | |
480 | line = line.decode(pycompat.sysstr(encoding.encoding), |
|
494 | line = line.decode(pycompat.sysstr(encoding.encoding), | |
481 | pycompat.sysstr(encoding.encodingmode)) |
|
495 | pycompat.sysstr(encoding.encodingmode)) | |
482 | initindent = initindent.decode(pycompat.sysstr(encoding.encoding), |
|
496 | initindent = initindent.decode(pycompat.sysstr(encoding.encoding), | |
483 | pycompat.sysstr(encoding.encodingmode)) |
|
497 | pycompat.sysstr(encoding.encodingmode)) | |
484 | hangindent = hangindent.decode(pycompat.sysstr(encoding.encoding), |
|
498 | hangindent = hangindent.decode(pycompat.sysstr(encoding.encoding), | |
485 | pycompat.sysstr(encoding.encodingmode)) |
|
499 | pycompat.sysstr(encoding.encodingmode)) | |
486 | wrapper = _MBTextWrapper(width=width, |
|
500 | wrapper = _MBTextWrapper(width=width, | |
487 | initial_indent=initindent, |
|
501 | initial_indent=initindent, | |
488 | subsequent_indent=hangindent) |
|
502 | subsequent_indent=hangindent) | |
489 | return wrapper.fill(line).encode(pycompat.sysstr(encoding.encoding)) |
|
503 | return wrapper.fill(line).encode(pycompat.sysstr(encoding.encoding)) | |
490 |
|
504 | |||
491 | _booleans = {'1': True, 'yes': True, 'true': True, 'on': True, 'always': True, |
|
505 | _booleans = {'1': True, 'yes': True, 'true': True, 'on': True, 'always': True, | |
492 | '0': False, 'no': False, 'false': False, 'off': False, |
|
506 | '0': False, 'no': False, 'false': False, 'off': False, | |
493 | 'never': False} |
|
507 | 'never': False} | |
494 |
|
508 | |||
495 | def parsebool(s): |
|
509 | def parsebool(s): | |
496 | """Parse s into a boolean. |
|
510 | """Parse s into a boolean. | |
497 |
|
511 | |||
498 | If s is not a valid boolean, returns None. |
|
512 | If s is not a valid boolean, returns None. | |
499 | """ |
|
513 | """ | |
500 | return _booleans.get(s.lower(), None) |
|
514 | return _booleans.get(s.lower(), None) | |
501 |
|
515 | |||
502 | def evalpython(s): |
|
516 | def evalpython(s): | |
503 | """Evaluate a string containing a Python expression. |
|
517 | """Evaluate a string containing a Python expression. | |
504 |
|
518 | |||
505 | THIS FUNCTION IS NOT SAFE TO USE ON UNTRUSTED INPUT. IT'S USE SHOULD BE |
|
519 | THIS FUNCTION IS NOT SAFE TO USE ON UNTRUSTED INPUT. IT'S USE SHOULD BE | |
506 | LIMITED TO DEVELOPER-FACING FUNCTIONALITY. |
|
520 | LIMITED TO DEVELOPER-FACING FUNCTIONALITY. | |
507 | """ |
|
521 | """ | |
508 | globs = { |
|
522 | globs = { | |
509 | r'__builtins__': { |
|
523 | r'__builtins__': { | |
510 | r'None': None, |
|
524 | r'None': None, | |
511 | r'False': False, |
|
525 | r'False': False, | |
512 | r'True': True, |
|
526 | r'True': True, | |
513 | r'int': int, |
|
527 | r'int': int, | |
514 | r'set': set, |
|
528 | r'set': set, | |
515 | r'tuple': tuple, |
|
529 | r'tuple': tuple, | |
516 | # Don't need to expose dict and list because we can use |
|
530 | # Don't need to expose dict and list because we can use | |
517 | # literals. |
|
531 | # literals. | |
518 | }, |
|
532 | }, | |
519 | } |
|
533 | } | |
520 |
|
534 | |||
521 | # We can't use eval() directly because it inherits compiler |
|
535 | # We can't use eval() directly because it inherits compiler | |
522 | # flags from this module and we need unicode literals for Python 3 |
|
536 | # flags from this module and we need unicode literals for Python 3 | |
523 | # compatibility. |
|
537 | # compatibility. | |
524 | code = compile(s, r'<string>', r'eval', |
|
538 | code = compile(s, r'<string>', r'eval', | |
525 | __future__.unicode_literals.compiler_flag, True) |
|
539 | __future__.unicode_literals.compiler_flag, True) | |
526 | return eval(code, globs, {}) |
|
540 | return eval(code, globs, {}) |
@@ -1,239 +1,239 b'' | |||||
1 | $ cat >> $HGRCPATH << EOF |
|
1 | $ cat >> $HGRCPATH << EOF | |
2 | > [web] |
|
2 | > [web] | |
3 | > push_ssl = false |
|
3 | > push_ssl = false | |
4 | > allow_push = * |
|
4 | > allow_push = * | |
5 | > EOF |
|
5 | > EOF | |
6 |
|
6 | |||
7 | $ hg init server |
|
7 | $ hg init server | |
8 | $ cd server |
|
8 | $ cd server | |
9 | $ touch a |
|
9 | $ touch a | |
10 | $ hg -q commit -A -m initial |
|
10 | $ hg -q commit -A -m initial | |
11 | $ cd .. |
|
11 | $ cd .. | |
12 |
|
12 | |||
13 | $ hg serve -R server -p $HGPORT -d --pid-file hg.pid |
|
13 | $ hg serve -R server -p $HGPORT -d --pid-file hg.pid | |
14 | $ cat hg.pid >> $DAEMON_PIDS |
|
14 | $ cat hg.pid >> $DAEMON_PIDS | |
15 |
|
15 | |||
16 | compression formats are advertised in compression capability |
|
16 | compression formats are advertised in compression capability | |
17 |
|
17 | |||
18 | #if zstd |
|
18 | #if zstd | |
19 | $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=capabilities' | tr ' ' '\n' | grep '^compression=zstd,zlib$' > /dev/null |
|
19 | $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=capabilities' | tr ' ' '\n' | grep '^compression=zstd,zlib$' > /dev/null | |
20 | #else |
|
20 | #else | |
21 | $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=capabilities' | tr ' ' '\n' | grep '^compression=zlib$' > /dev/null |
|
21 | $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=capabilities' | tr ' ' '\n' | grep '^compression=zlib$' > /dev/null | |
22 | #endif |
|
22 | #endif | |
23 |
|
23 | |||
24 | $ killdaemons.py |
|
24 | $ killdaemons.py | |
25 |
|
25 | |||
26 | server.compressionengines can replace engines list wholesale |
|
26 | server.compressionengines can replace engines list wholesale | |
27 |
|
27 | |||
28 | $ hg serve --config server.compressionengines=none -R server -p $HGPORT -d --pid-file hg.pid |
|
28 | $ hg serve --config server.compressionengines=none -R server -p $HGPORT -d --pid-file hg.pid | |
29 | $ cat hg.pid > $DAEMON_PIDS |
|
29 | $ cat hg.pid > $DAEMON_PIDS | |
30 | $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=capabilities' | tr ' ' '\n' | grep '^compression=none$' > /dev/null |
|
30 | $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=capabilities' | tr ' ' '\n' | grep '^compression=none$' > /dev/null | |
31 |
|
31 | |||
32 | $ killdaemons.py |
|
32 | $ killdaemons.py | |
33 |
|
33 | |||
34 | Order of engines can also change |
|
34 | Order of engines can also change | |
35 |
|
35 | |||
36 | $ hg serve --config server.compressionengines=none,zlib -R server -p $HGPORT -d --pid-file hg.pid |
|
36 | $ hg serve --config server.compressionengines=none,zlib -R server -p $HGPORT -d --pid-file hg.pid | |
37 | $ cat hg.pid > $DAEMON_PIDS |
|
37 | $ cat hg.pid > $DAEMON_PIDS | |
38 | $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=capabilities' | tr ' ' '\n' | grep '^compression=none,zlib$' > /dev/null |
|
38 | $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=capabilities' | tr ' ' '\n' | grep '^compression=none,zlib$' > /dev/null | |
39 |
|
39 | |||
40 | $ killdaemons.py |
|
40 | $ killdaemons.py | |
41 |
|
41 | |||
42 | Start a default server again |
|
42 | Start a default server again | |
43 |
|
43 | |||
44 | $ hg serve -R server -p $HGPORT -d --pid-file hg.pid |
|
44 | $ hg serve -R server -p $HGPORT -d --pid-file hg.pid | |
45 | $ cat hg.pid > $DAEMON_PIDS |
|
45 | $ cat hg.pid > $DAEMON_PIDS | |
46 |
|
46 | |||
47 | Server should send application/mercurial-0.1 to clients if no Accept is used |
|
47 | Server should send application/mercurial-0.1 to clients if no Accept is used | |
48 |
|
48 | |||
49 | $ get-with-headers.py --headeronly $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' - |
|
49 | $ get-with-headers.py --headeronly $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' - | |
50 | 200 Script output follows |
|
50 | 200 Script output follows | |
51 | content-type: application/mercurial-0.1 |
|
51 | content-type: application/mercurial-0.1 | |
52 | date: $HTTP_DATE$ |
|
52 | date: $HTTP_DATE$ | |
53 | server: testing stub value |
|
53 | server: testing stub value | |
54 | transfer-encoding: chunked |
|
54 | transfer-encoding: chunked | |
55 |
|
55 | |||
56 | Server should send application/mercurial-0.1 when client says it wants it |
|
56 | Server should send application/mercurial-0.1 when client says it wants it | |
57 |
|
57 | |||
58 | $ get-with-headers.py --hgproto '0.1' --headeronly $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' - |
|
58 | $ get-with-headers.py --hgproto '0.1' --headeronly $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' - | |
59 | 200 Script output follows |
|
59 | 200 Script output follows | |
60 | content-type: application/mercurial-0.1 |
|
60 | content-type: application/mercurial-0.1 | |
61 | date: $HTTP_DATE$ |
|
61 | date: $HTTP_DATE$ | |
62 | server: testing stub value |
|
62 | server: testing stub value | |
63 | transfer-encoding: chunked |
|
63 | transfer-encoding: chunked | |
64 |
|
64 | |||
65 | Server should send application/mercurial-0.2 when client says it wants it |
|
65 | Server should send application/mercurial-0.2 when client says it wants it | |
66 |
|
66 | |||
67 | $ get-with-headers.py --hgproto '0.2' --headeronly $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' - |
|
67 | $ get-with-headers.py --hgproto '0.2' --headeronly $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' - | |
68 | 200 Script output follows |
|
68 | 200 Script output follows | |
69 | content-type: application/mercurial-0.2 |
|
69 | content-type: application/mercurial-0.2 | |
70 | date: $HTTP_DATE$ |
|
70 | date: $HTTP_DATE$ | |
71 | server: testing stub value |
|
71 | server: testing stub value | |
72 | transfer-encoding: chunked |
|
72 | transfer-encoding: chunked | |
73 |
|
73 | |||
74 | $ get-with-headers.py --hgproto '0.1 0.2' --headeronly $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' - |
|
74 | $ get-with-headers.py --hgproto '0.1 0.2' --headeronly $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' - | |
75 | 200 Script output follows |
|
75 | 200 Script output follows | |
76 | content-type: application/mercurial-0.2 |
|
76 | content-type: application/mercurial-0.2 | |
77 | date: $HTTP_DATE$ |
|
77 | date: $HTTP_DATE$ | |
78 | server: testing stub value |
|
78 | server: testing stub value | |
79 | transfer-encoding: chunked |
|
79 | transfer-encoding: chunked | |
80 |
|
80 | |||
81 | Requesting a compression format that server doesn't support results will fall back to 0.1 |
|
81 | Requesting a compression format that server doesn't support results will fall back to 0.1 | |
82 |
|
82 | |||
83 | $ get-with-headers.py --hgproto '0.2 comp=aa' --headeronly $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' - |
|
83 | $ get-with-headers.py --hgproto '0.2 comp=aa' --headeronly $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' - | |
84 | 200 Script output follows |
|
84 | 200 Script output follows | |
85 | content-type: application/mercurial-0.1 |
|
85 | content-type: application/mercurial-0.1 | |
86 | date: $HTTP_DATE$ |
|
86 | date: $HTTP_DATE$ | |
87 | server: testing stub value |
|
87 | server: testing stub value | |
88 | transfer-encoding: chunked |
|
88 | transfer-encoding: chunked | |
89 |
|
89 | |||
90 | #if zstd |
|
90 | #if zstd | |
91 | zstd is used if available |
|
91 | zstd is used if available | |
92 |
|
92 | |||
93 | $ get-with-headers.py --hgproto '0.2 comp=zstd' $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' > resp |
|
93 | $ get-with-headers.py --hgproto '0.2 comp=zstd' $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' > resp | |
94 | $ f --size --hexdump --bytes 36 --sha1 resp |
|
94 | $ f --size --hexdump --bytes 36 --sha1 resp | |
95 | resp: size=248, sha1=4d8d8f87fb82bd542ce52881fdc94f850748 |
|
95 | resp: size=248, sha1=4d8d8f87fb82bd542ce52881fdc94f850748 | |
96 | 0000: 32 30 30 20 53 63 72 69 70 74 20 6f 75 74 70 75 |200 Script outpu| |
|
96 | 0000: 32 30 30 20 53 63 72 69 70 74 20 6f 75 74 70 75 |200 Script outpu| | |
97 | 0010: 74 20 66 6f 6c 6c 6f 77 73 0a 0a 04 7a 73 74 64 |t follows...zstd| |
|
97 | 0010: 74 20 66 6f 6c 6c 6f 77 73 0a 0a 04 7a 73 74 64 |t follows...zstd| | |
98 | 0020: 28 b5 2f fd |(./.| |
|
98 | 0020: 28 b5 2f fd |(./.| | |
99 |
|
99 | |||
100 | #endif |
|
100 | #endif | |
101 |
|
101 | |||
102 | application/mercurial-0.2 is not yet used on non-streaming responses |
|
102 | application/mercurial-0.2 is not yet used on non-streaming responses | |
103 |
|
103 | |||
104 | $ get-with-headers.py --hgproto '0.2' $LOCALIP:$HGPORT '?cmd=heads' - |
|
104 | $ get-with-headers.py --hgproto '0.2' $LOCALIP:$HGPORT '?cmd=heads' - | |
105 | 200 Script output follows |
|
105 | 200 Script output follows | |
106 | content-length: 41 |
|
106 | content-length: 41 | |
107 | content-type: application/mercurial-0.1 |
|
107 | content-type: application/mercurial-0.1 | |
108 | date: $HTTP_DATE$ |
|
108 | date: $HTTP_DATE$ | |
109 | server: testing stub value |
|
109 | server: testing stub value | |
110 |
|
110 | |||
111 | e93700bd72895c5addab234c56d4024b487a362f |
|
111 | e93700bd72895c5addab234c56d4024b487a362f | |
112 |
|
112 | |||
113 | Now test protocol preference usage |
|
113 | Now test protocol preference usage | |
114 |
|
114 | |||
115 | $ killdaemons.py |
|
115 | $ killdaemons.py | |
116 | $ hg serve --config server.compressionengines=none,zlib -R server -p $HGPORT -d --pid-file hg.pid |
|
116 | $ hg serve --config server.compressionengines=none,zlib -R server -p $HGPORT -d --pid-file hg.pid | |
117 | $ cat hg.pid > $DAEMON_PIDS |
|
117 | $ cat hg.pid > $DAEMON_PIDS | |
118 |
|
118 | |||
119 | No Accept will send 0.1+zlib, even though "none" is preferred b/c "none" isn't supported on 0.1 |
|
119 | No Accept will send 0.1+zlib, even though "none" is preferred b/c "none" isn't supported on 0.1 | |
120 |
|
120 | |||
121 | $ get-with-headers.py --headeronly $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' Content-Type |
|
121 | $ get-with-headers.py --headeronly $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' Content-Type | |
122 | 200 Script output follows |
|
122 | 200 Script output follows | |
123 | content-type: application/mercurial-0.1 |
|
123 | content-type: application/mercurial-0.1 | |
124 |
|
124 | |||
125 | $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' > resp |
|
125 | $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' > resp | |
126 | $ f --size --hexdump --bytes 28 --sha1 resp |
|
126 | $ f --size --hexdump --bytes 28 --sha1 resp | |
127 | resp: size=227, sha1=35a4c074da74f32f5440da3cbf04 |
|
127 | resp: size=227, sha1=35a4c074da74f32f5440da3cbf04 | |
128 | 0000: 32 30 30 20 53 63 72 69 70 74 20 6f 75 74 70 75 |200 Script outpu| |
|
128 | 0000: 32 30 30 20 53 63 72 69 70 74 20 6f 75 74 70 75 |200 Script outpu| | |
129 | 0010: 74 20 66 6f 6c 6c 6f 77 73 0a 0a 78 |t follows..x| |
|
129 | 0010: 74 20 66 6f 6c 6c 6f 77 73 0a 0a 78 |t follows..x| | |
130 |
|
130 | |||
131 | Explicit 0.1 will send zlib because "none" isn't supported on 0.1 |
|
131 | Explicit 0.1 will send zlib because "none" isn't supported on 0.1 | |
132 |
|
132 | |||
133 | $ get-with-headers.py --hgproto '0.1' $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' > resp |
|
133 | $ get-with-headers.py --hgproto '0.1' $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' > resp | |
134 | $ f --size --hexdump --bytes 28 --sha1 resp |
|
134 | $ f --size --hexdump --bytes 28 --sha1 resp | |
135 | resp: size=227, sha1=35a4c074da74f32f5440da3cbf04 |
|
135 | resp: size=227, sha1=35a4c074da74f32f5440da3cbf04 | |
136 | 0000: 32 30 30 20 53 63 72 69 70 74 20 6f 75 74 70 75 |200 Script outpu| |
|
136 | 0000: 32 30 30 20 53 63 72 69 70 74 20 6f 75 74 70 75 |200 Script outpu| | |
137 | 0010: 74 20 66 6f 6c 6c 6f 77 73 0a 0a 78 |t follows..x| |
|
137 | 0010: 74 20 66 6f 6c 6c 6f 77 73 0a 0a 78 |t follows..x| | |
138 |
|
138 | |||
139 | 0.2 with no compression will get "none" because that is server's preference |
|
139 | 0.2 with no compression will get "none" because that is server's preference | |
140 | (spec says ZL and UN are implicitly supported) |
|
140 | (spec says ZL and UN are implicitly supported) | |
141 |
|
141 | |||
142 | $ get-with-headers.py --hgproto '0.2' $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' > resp |
|
142 | $ get-with-headers.py --hgproto '0.2' $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' > resp | |
143 | $ f --size --hexdump --bytes 32 --sha1 resp |
|
143 | $ f --size --hexdump --bytes 32 --sha1 resp | |
144 | resp: size=432, sha1=ac931b412ec185a02e0e5bcff98dac83 |
|
144 | resp: size=432, sha1=ac931b412ec185a02e0e5bcff98dac83 | |
145 | 0000: 32 30 30 20 53 63 72 69 70 74 20 6f 75 74 70 75 |200 Script outpu| |
|
145 | 0000: 32 30 30 20 53 63 72 69 70 74 20 6f 75 74 70 75 |200 Script outpu| | |
146 | 0010: 74 20 66 6f 6c 6c 6f 77 73 0a 0a 04 6e 6f 6e 65 |t follows...none| |
|
146 | 0010: 74 20 66 6f 6c 6c 6f 77 73 0a 0a 04 6e 6f 6e 65 |t follows...none| | |
147 |
|
147 | |||
148 | Client receives server preference even if local order doesn't match |
|
148 | Client receives server preference even if local order doesn't match | |
149 |
|
149 | |||
150 | $ get-with-headers.py --hgproto '0.2 comp=zlib,none' $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' > resp |
|
150 | $ get-with-headers.py --hgproto '0.2 comp=zlib,none' $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' > resp | |
151 | $ f --size --hexdump --bytes 32 --sha1 resp |
|
151 | $ f --size --hexdump --bytes 32 --sha1 resp | |
152 | resp: size=432, sha1=ac931b412ec185a02e0e5bcff98dac83 |
|
152 | resp: size=432, sha1=ac931b412ec185a02e0e5bcff98dac83 | |
153 | 0000: 32 30 30 20 53 63 72 69 70 74 20 6f 75 74 70 75 |200 Script outpu| |
|
153 | 0000: 32 30 30 20 53 63 72 69 70 74 20 6f 75 74 70 75 |200 Script outpu| | |
154 | 0010: 74 20 66 6f 6c 6c 6f 77 73 0a 0a 04 6e 6f 6e 65 |t follows...none| |
|
154 | 0010: 74 20 66 6f 6c 6c 6f 77 73 0a 0a 04 6e 6f 6e 65 |t follows...none| | |
155 |
|
155 | |||
156 | Client receives only supported format even if not server preferred format |
|
156 | Client receives only supported format even if not server preferred format | |
157 |
|
157 | |||
158 | $ get-with-headers.py --hgproto '0.2 comp=zlib' $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' > resp |
|
158 | $ get-with-headers.py --hgproto '0.2 comp=zlib' $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' > resp | |
159 | $ f --size --hexdump --bytes 33 --sha1 resp |
|
159 | $ f --size --hexdump --bytes 33 --sha1 resp | |
160 | resp: size=232, sha1=a1c727f0c9693ca15742a75c30419bc36 |
|
160 | resp: size=232, sha1=a1c727f0c9693ca15742a75c30419bc36 | |
161 | 0000: 32 30 30 20 53 63 72 69 70 74 20 6f 75 74 70 75 |200 Script outpu| |
|
161 | 0000: 32 30 30 20 53 63 72 69 70 74 20 6f 75 74 70 75 |200 Script outpu| | |
162 | 0010: 74 20 66 6f 6c 6c 6f 77 73 0a 0a 04 7a 6c 69 62 |t follows...zlib| |
|
162 | 0010: 74 20 66 6f 6c 6c 6f 77 73 0a 0a 04 7a 6c 69 62 |t follows...zlib| | |
163 | 0020: 78 |x| |
|
163 | 0020: 78 |x| | |
164 |
|
164 | |||
165 | $ killdaemons.py |
|
165 | $ killdaemons.py | |
166 | $ cd .. |
|
166 | $ cd .. | |
167 |
|
167 | |||
168 | Test listkeys for listing namespaces |
|
168 | Test listkeys for listing namespaces | |
169 |
|
169 | |||
170 | $ hg init empty |
|
170 | $ hg init empty | |
171 | $ hg -R empty serve -p $HGPORT -d --pid-file hg.pid |
|
171 | $ hg -R empty serve -p $HGPORT -d --pid-file hg.pid | |
172 | $ cat hg.pid > $DAEMON_PIDS |
|
172 | $ cat hg.pid > $DAEMON_PIDS | |
173 |
|
173 | |||
174 | $ hg --verbose debugwireproto http://$LOCALIP:$HGPORT << EOF |
|
174 | $ hg --verbose debugwireproto http://$LOCALIP:$HGPORT << EOF | |
175 | > command listkeys |
|
175 | > command listkeys | |
176 | > namespace namespaces |
|
176 | > namespace namespaces | |
177 | > EOF |
|
177 | > EOF | |
178 | s> GET /?cmd=capabilities HTTP/1.1\r\n |
|
178 | s> GET /?cmd=capabilities HTTP/1.1\r\n | |
179 | s> Accept-Encoding: identity\r\n |
|
179 | s> Accept-Encoding: identity\r\n | |
180 | s> accept: application/mercurial-0.1\r\n |
|
180 | s> accept: application/mercurial-0.1\r\n | |
181 | s> host: $LOCALIP:$HGPORT\r\n (glob) |
|
181 | s> host: $LOCALIP:$HGPORT\r\n (glob) | |
182 | s> user-agent: mercurial/proto-1.0 (Mercurial *)\r\n (glob) |
|
182 | s> user-agent: mercurial/proto-1.0 (Mercurial *)\r\n (glob) | |
183 | s> \r\n |
|
183 | s> \r\n | |
184 | s> makefile('rb', None) |
|
184 | s> makefile('rb', None) | |
185 | s> HTTP/1.1 200 Script output follows\r\n |
|
185 | s> HTTP/1.1 200 Script output follows\r\n | |
186 | s> Server: testing stub value\r\n |
|
186 | s> Server: testing stub value\r\n | |
187 | s> Date: $HTTP_DATE$\r\n |
|
187 | s> Date: $HTTP_DATE$\r\n | |
188 | s> Content-Type: application/mercurial-0.1\r\n |
|
188 | s> Content-Type: application/mercurial-0.1\r\n | |
189 | s> Content-Length: *\r\n (glob) |
|
189 | s> Content-Length: *\r\n (glob) | |
190 | s> \r\n |
|
190 | s> \r\n | |
191 | s> lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx compression=$BUNDLE2_COMPRESSIONS$ |
|
191 | s> lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx compression=$BUNDLE2_COMPRESSIONS$ | |
192 | sending listkeys command |
|
192 | sending listkeys command | |
193 | s> GET /?cmd=listkeys HTTP/1.1\r\n |
|
193 | s> GET /?cmd=listkeys HTTP/1.1\r\n | |
194 | s> Accept-Encoding: identity\r\n |
|
194 | s> Accept-Encoding: identity\r\n | |
195 | s> vary: X-HgArg-1,X-HgProto-1\r\n |
|
195 | s> vary: X-HgArg-1,X-HgProto-1\r\n | |
196 | s> x-hgarg-1: namespace=namespaces\r\n |
|
196 | s> x-hgarg-1: namespace=namespaces\r\n | |
197 | s> x-hgproto-1: 0.1 0.2 comp=$USUAL_COMPRESSIONS$\r\n |
|
197 | s> x-hgproto-1: 0.1 0.2 comp=$USUAL_COMPRESSIONS$\r\n | |
198 | s> accept: application/mercurial-0.1\r\n |
|
198 | s> accept: application/mercurial-0.1\r\n | |
199 | s> host: $LOCALIP:$HGPORT\r\n (glob) |
|
199 | s> host: $LOCALIP:$HGPORT\r\n (glob) | |
200 | s> user-agent: mercurial/proto-1.0 (Mercurial *)\r\n (glob) |
|
200 | s> user-agent: mercurial/proto-1.0 (Mercurial *)\r\n (glob) | |
201 | s> \r\n |
|
201 | s> \r\n | |
202 | s> makefile('rb', None) |
|
202 | s> makefile('rb', None) | |
203 | s> HTTP/1.1 200 Script output follows\r\n |
|
203 | s> HTTP/1.1 200 Script output follows\r\n | |
204 | s> Server: testing stub value\r\n |
|
204 | s> Server: testing stub value\r\n | |
205 | s> Date: $HTTP_DATE$\r\n |
|
205 | s> Date: $HTTP_DATE$\r\n | |
206 | s> Content-Type: application/mercurial-0.1\r\n |
|
206 | s> Content-Type: application/mercurial-0.1\r\n | |
207 | s> Content-Length: 30\r\n |
|
207 | s> Content-Length: 30\r\n | |
208 | s> \r\n |
|
208 | s> \r\n | |
209 | s> bookmarks \n |
|
209 | s> bookmarks \n | |
210 | s> namespaces \n |
|
210 | s> namespaces \n | |
211 | s> phases |
|
211 | s> phases | |
212 |
response: b |
|
212 | response: b'bookmarks \nnamespaces \nphases ' | |
213 |
|
213 | |||
214 | Same thing, but with "httprequest" command |
|
214 | Same thing, but with "httprequest" command | |
215 |
|
215 | |||
216 | $ hg --verbose debugwireproto --peer raw http://$LOCALIP:$HGPORT << EOF |
|
216 | $ hg --verbose debugwireproto --peer raw http://$LOCALIP:$HGPORT << EOF | |
217 | > httprequest GET ?cmd=listkeys |
|
217 | > httprequest GET ?cmd=listkeys | |
218 | > user-agent: test |
|
218 | > user-agent: test | |
219 | > x-hgarg-1: namespace=namespaces |
|
219 | > x-hgarg-1: namespace=namespaces | |
220 | > EOF |
|
220 | > EOF | |
221 | using raw connection to peer |
|
221 | using raw connection to peer | |
222 | s> GET /?cmd=listkeys HTTP/1.1\r\n |
|
222 | s> GET /?cmd=listkeys HTTP/1.1\r\n | |
223 | s> Accept-Encoding: identity\r\n |
|
223 | s> Accept-Encoding: identity\r\n | |
224 | s> user-agent: test\r\n |
|
224 | s> user-agent: test\r\n | |
225 | s> x-hgarg-1: namespace=namespaces\r\n |
|
225 | s> x-hgarg-1: namespace=namespaces\r\n | |
226 | s> host: $LOCALIP:$HGPORT\r\n (glob) |
|
226 | s> host: $LOCALIP:$HGPORT\r\n (glob) | |
227 | s> \r\n |
|
227 | s> \r\n | |
228 | s> makefile('rb', None) |
|
228 | s> makefile('rb', None) | |
229 | s> HTTP/1.1 200 Script output follows\r\n |
|
229 | s> HTTP/1.1 200 Script output follows\r\n | |
230 | s> Server: testing stub value\r\n |
|
230 | s> Server: testing stub value\r\n | |
231 | s> Date: $HTTP_DATE$\r\n |
|
231 | s> Date: $HTTP_DATE$\r\n | |
232 | s> Content-Type: application/mercurial-0.1\r\n |
|
232 | s> Content-Type: application/mercurial-0.1\r\n | |
233 | s> Content-Length: 30\r\n |
|
233 | s> Content-Length: 30\r\n | |
234 | s> \r\n |
|
234 | s> \r\n | |
235 | s> bookmarks \n |
|
235 | s> bookmarks \n | |
236 | s> namespaces \n |
|
236 | s> namespaces \n | |
237 | s> phases |
|
237 | s> phases | |
238 |
|
238 | |||
239 | $ killdaemons.py |
|
239 | $ killdaemons.py |
@@ -1,2145 +1,2145 b'' | |||||
1 | $ cat > hgrc-sshv2 << EOF |
|
1 | $ cat > hgrc-sshv2 << EOF | |
2 | > %include $HGRCPATH |
|
2 | > %include $HGRCPATH | |
3 | > [experimental] |
|
3 | > [experimental] | |
4 | > sshpeer.advertise-v2 = true |
|
4 | > sshpeer.advertise-v2 = true | |
5 | > sshserver.support-v2 = true |
|
5 | > sshserver.support-v2 = true | |
6 | > EOF |
|
6 | > EOF | |
7 |
|
7 | |||
8 | Helper function to run protocol tests against multiple protocol versions. |
|
8 | Helper function to run protocol tests against multiple protocol versions. | |
9 | This is easier than using #testcases because managing differences between |
|
9 | This is easier than using #testcases because managing differences between | |
10 | protocols with inline conditional output is hard to read. |
|
10 | protocols with inline conditional output is hard to read. | |
11 |
|
11 | |||
12 | $ debugwireproto() { |
|
12 | $ debugwireproto() { | |
13 | > commands=`cat -` |
|
13 | > commands=`cat -` | |
14 | > echo 'testing ssh1' |
|
14 | > echo 'testing ssh1' | |
15 | > echo "${commands}" | hg --verbose debugwireproto --localssh |
|
15 | > echo "${commands}" | hg --verbose debugwireproto --localssh | |
16 | > echo "" |
|
16 | > echo "" | |
17 | > echo 'testing ssh2' |
|
17 | > echo 'testing ssh2' | |
18 | > echo "${commands}" | HGRCPATH=$TESTTMP/hgrc-sshv2 hg --verbose debugwireproto --localssh |
|
18 | > echo "${commands}" | HGRCPATH=$TESTTMP/hgrc-sshv2 hg --verbose debugwireproto --localssh | |
19 | > } |
|
19 | > } | |
20 |
|
20 | |||
21 | $ cat >> $HGRCPATH << EOF |
|
21 | $ cat >> $HGRCPATH << EOF | |
22 | > [ui] |
|
22 | > [ui] | |
23 | > ssh = $PYTHON "$TESTDIR/dummyssh" |
|
23 | > ssh = $PYTHON "$TESTDIR/dummyssh" | |
24 | > [devel] |
|
24 | > [devel] | |
25 | > debug.peer-request = true |
|
25 | > debug.peer-request = true | |
26 | > [extensions] |
|
26 | > [extensions] | |
27 | > sshprotoext = $TESTDIR/sshprotoext.py |
|
27 | > sshprotoext = $TESTDIR/sshprotoext.py | |
28 | > EOF |
|
28 | > EOF | |
29 |
|
29 | |||
30 | $ hg init server |
|
30 | $ hg init server | |
31 | $ cd server |
|
31 | $ cd server | |
32 | $ echo 0 > foo |
|
32 | $ echo 0 > foo | |
33 | $ hg -q add foo |
|
33 | $ hg -q add foo | |
34 | $ hg commit -m initial |
|
34 | $ hg commit -m initial | |
35 |
|
35 | |||
36 | A no-op connection performs a handshake |
|
36 | A no-op connection performs a handshake | |
37 |
|
37 | |||
38 | $ hg debugwireproto --localssh << EOF |
|
38 | $ hg debugwireproto --localssh << EOF | |
39 | > EOF |
|
39 | > EOF | |
40 | creating ssh peer from handshake results |
|
40 | creating ssh peer from handshake results | |
41 |
|
41 | |||
42 | Raw peers don't perform any activity |
|
42 | Raw peers don't perform any activity | |
43 |
|
43 | |||
44 | $ hg debugwireproto --localssh --peer raw << EOF |
|
44 | $ hg debugwireproto --localssh --peer raw << EOF | |
45 | > EOF |
|
45 | > EOF | |
46 | using raw connection to peer |
|
46 | using raw connection to peer | |
47 | $ hg debugwireproto --localssh --peer ssh1 << EOF |
|
47 | $ hg debugwireproto --localssh --peer ssh1 << EOF | |
48 | > EOF |
|
48 | > EOF | |
49 | creating ssh peer for wire protocol version 1 |
|
49 | creating ssh peer for wire protocol version 1 | |
50 | $ hg debugwireproto --localssh --peer ssh2 << EOF |
|
50 | $ hg debugwireproto --localssh --peer ssh2 << EOF | |
51 | > EOF |
|
51 | > EOF | |
52 | creating ssh peer for wire protocol version 2 |
|
52 | creating ssh peer for wire protocol version 2 | |
53 |
|
53 | |||
54 | Test a normal behaving server, for sanity |
|
54 | Test a normal behaving server, for sanity | |
55 |
|
55 | |||
56 | $ cd .. |
|
56 | $ cd .. | |
57 |
|
57 | |||
58 | $ hg --debug debugpeer ssh://user@dummy/server |
|
58 | $ hg --debug debugpeer ssh://user@dummy/server | |
59 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) |
|
59 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) | |
60 | running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !) |
|
60 | running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !) | |
61 | devel-peer-request: hello |
|
61 | devel-peer-request: hello | |
62 | sending hello command |
|
62 | sending hello command | |
63 | devel-peer-request: between |
|
63 | devel-peer-request: between | |
64 | devel-peer-request: pairs: 81 bytes |
|
64 | devel-peer-request: pairs: 81 bytes | |
65 | sending between command |
|
65 | sending between command | |
66 | remote: 403 |
|
66 | remote: 403 | |
67 | remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch |
|
67 | remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch | |
68 | remote: 1 |
|
68 | remote: 1 | |
69 | url: ssh://user@dummy/server |
|
69 | url: ssh://user@dummy/server | |
70 | local: no |
|
70 | local: no | |
71 | pushable: yes |
|
71 | pushable: yes | |
72 |
|
72 | |||
73 | Server should answer the "hello" command in isolation |
|
73 | Server should answer the "hello" command in isolation | |
74 |
|
74 | |||
75 | $ hg -R server debugwireproto --localssh --peer raw << EOF |
|
75 | $ hg -R server debugwireproto --localssh --peer raw << EOF | |
76 | > raw |
|
76 | > raw | |
77 | > hello\n |
|
77 | > hello\n | |
78 | > readline |
|
78 | > readline | |
79 | > readline |
|
79 | > readline | |
80 | > EOF |
|
80 | > EOF | |
81 | using raw connection to peer |
|
81 | using raw connection to peer | |
82 | i> write(6) -> 6: |
|
82 | i> write(6) -> 6: | |
83 | i> hello\n |
|
83 | i> hello\n | |
84 | o> readline() -> 4: |
|
84 | o> readline() -> 4: | |
85 | o> 403\n |
|
85 | o> 403\n | |
86 | o> readline() -> 403: |
|
86 | o> readline() -> 403: | |
87 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n |
|
87 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n | |
88 |
|
88 | |||
89 | `hg debugserve --sshstdio` works |
|
89 | `hg debugserve --sshstdio` works | |
90 |
|
90 | |||
91 | $ cd server |
|
91 | $ cd server | |
92 | $ hg debugserve --sshstdio << EOF |
|
92 | $ hg debugserve --sshstdio << EOF | |
93 | > hello |
|
93 | > hello | |
94 | > EOF |
|
94 | > EOF | |
95 | 403 |
|
95 | 403 | |
96 | capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch |
|
96 | capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch | |
97 |
|
97 | |||
98 | I/O logging works |
|
98 | I/O logging works | |
99 |
|
99 | |||
100 | $ hg debugserve --sshstdio --logiofd 1 << EOF |
|
100 | $ hg debugserve --sshstdio --logiofd 1 << EOF | |
101 | > hello |
|
101 | > hello | |
102 | > EOF |
|
102 | > EOF | |
103 | o> write(4) -> 4: |
|
103 | o> write(4) -> 4: | |
104 | o> 403\n |
|
104 | o> 403\n | |
105 | o> write(403) -> 403: |
|
105 | o> write(403) -> 403: | |
106 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n |
|
106 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n | |
107 | 403 |
|
107 | 403 | |
108 | capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch |
|
108 | capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch | |
109 | o> flush() -> None |
|
109 | o> flush() -> None | |
110 |
|
110 | |||
111 | $ hg debugserve --sshstdio --logiofile $TESTTMP/io << EOF |
|
111 | $ hg debugserve --sshstdio --logiofile $TESTTMP/io << EOF | |
112 | > hello |
|
112 | > hello | |
113 | > EOF |
|
113 | > EOF | |
114 | 403 |
|
114 | 403 | |
115 | capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch |
|
115 | capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch | |
116 |
|
116 | |||
117 | $ cat $TESTTMP/io |
|
117 | $ cat $TESTTMP/io | |
118 | o> write(4) -> 4: |
|
118 | o> write(4) -> 4: | |
119 | o> 403\n |
|
119 | o> 403\n | |
120 | o> write(403) -> 403: |
|
120 | o> write(403) -> 403: | |
121 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n |
|
121 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n | |
122 | o> flush() -> None |
|
122 | o> flush() -> None | |
123 |
|
123 | |||
124 | $ cd .. |
|
124 | $ cd .. | |
125 |
|
125 | |||
126 | >=0.9.1 clients send a "hello" + "between" for the null range as part of handshake. |
|
126 | >=0.9.1 clients send a "hello" + "between" for the null range as part of handshake. | |
127 | Server should reply with capabilities and should send "1\n\n" as a successful |
|
127 | Server should reply with capabilities and should send "1\n\n" as a successful | |
128 | reply with empty response to the "between". |
|
128 | reply with empty response to the "between". | |
129 |
|
129 | |||
130 | $ hg -R server debugwireproto --localssh --peer raw << EOF |
|
130 | $ hg -R server debugwireproto --localssh --peer raw << EOF | |
131 | > raw |
|
131 | > raw | |
132 | > hello\n |
|
132 | > hello\n | |
133 | > readline |
|
133 | > readline | |
134 | > readline |
|
134 | > readline | |
135 | > raw |
|
135 | > raw | |
136 | > between\n |
|
136 | > between\n | |
137 | > pairs 81\n |
|
137 | > pairs 81\n | |
138 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
138 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
139 | > readline |
|
139 | > readline | |
140 | > readline |
|
140 | > readline | |
141 | > EOF |
|
141 | > EOF | |
142 | using raw connection to peer |
|
142 | using raw connection to peer | |
143 | i> write(6) -> 6: |
|
143 | i> write(6) -> 6: | |
144 | i> hello\n |
|
144 | i> hello\n | |
145 | o> readline() -> 4: |
|
145 | o> readline() -> 4: | |
146 | o> 403\n |
|
146 | o> 403\n | |
147 | o> readline() -> 403: |
|
147 | o> readline() -> 403: | |
148 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n |
|
148 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n | |
149 | i> write(98) -> 98: |
|
149 | i> write(98) -> 98: | |
150 | i> between\n |
|
150 | i> between\n | |
151 | i> pairs 81\n |
|
151 | i> pairs 81\n | |
152 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
152 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
153 | o> readline() -> 2: |
|
153 | o> readline() -> 2: | |
154 | o> 1\n |
|
154 | o> 1\n | |
155 | o> readline() -> 1: |
|
155 | o> readline() -> 1: | |
156 | o> \n |
|
156 | o> \n | |
157 |
|
157 | |||
158 | SSH banner is not printed by default, ignored by clients |
|
158 | SSH banner is not printed by default, ignored by clients | |
159 |
|
159 | |||
160 | $ SSHSERVERMODE=banner hg debugpeer ssh://user@dummy/server |
|
160 | $ SSHSERVERMODE=banner hg debugpeer ssh://user@dummy/server | |
161 | url: ssh://user@dummy/server |
|
161 | url: ssh://user@dummy/server | |
162 | local: no |
|
162 | local: no | |
163 | pushable: yes |
|
163 | pushable: yes | |
164 |
|
164 | |||
165 | --debug will print the banner |
|
165 | --debug will print the banner | |
166 |
|
166 | |||
167 | $ SSHSERVERMODE=banner hg --debug debugpeer ssh://user@dummy/server |
|
167 | $ SSHSERVERMODE=banner hg --debug debugpeer ssh://user@dummy/server | |
168 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) |
|
168 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) | |
169 | running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !) |
|
169 | running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !) | |
170 | devel-peer-request: hello |
|
170 | devel-peer-request: hello | |
171 | sending hello command |
|
171 | sending hello command | |
172 | devel-peer-request: between |
|
172 | devel-peer-request: between | |
173 | devel-peer-request: pairs: 81 bytes |
|
173 | devel-peer-request: pairs: 81 bytes | |
174 | sending between command |
|
174 | sending between command | |
175 | remote: banner: line 0 |
|
175 | remote: banner: line 0 | |
176 | remote: banner: line 1 |
|
176 | remote: banner: line 1 | |
177 | remote: banner: line 2 |
|
177 | remote: banner: line 2 | |
178 | remote: banner: line 3 |
|
178 | remote: banner: line 3 | |
179 | remote: banner: line 4 |
|
179 | remote: banner: line 4 | |
180 | remote: banner: line 5 |
|
180 | remote: banner: line 5 | |
181 | remote: banner: line 6 |
|
181 | remote: banner: line 6 | |
182 | remote: banner: line 7 |
|
182 | remote: banner: line 7 | |
183 | remote: banner: line 8 |
|
183 | remote: banner: line 8 | |
184 | remote: banner: line 9 |
|
184 | remote: banner: line 9 | |
185 | remote: 403 |
|
185 | remote: 403 | |
186 | remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch |
|
186 | remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch | |
187 | remote: 1 |
|
187 | remote: 1 | |
188 | url: ssh://user@dummy/server |
|
188 | url: ssh://user@dummy/server | |
189 | local: no |
|
189 | local: no | |
190 | pushable: yes |
|
190 | pushable: yes | |
191 |
|
191 | |||
192 | And test the banner with the raw protocol |
|
192 | And test the banner with the raw protocol | |
193 |
|
193 | |||
194 | $ SSHSERVERMODE=banner hg -R server debugwireproto --localssh --peer raw << EOF |
|
194 | $ SSHSERVERMODE=banner hg -R server debugwireproto --localssh --peer raw << EOF | |
195 | > raw |
|
195 | > raw | |
196 | > hello\n |
|
196 | > hello\n | |
197 | > readline |
|
197 | > readline | |
198 | > readline |
|
198 | > readline | |
199 | > readline |
|
199 | > readline | |
200 | > readline |
|
200 | > readline | |
201 | > readline |
|
201 | > readline | |
202 | > readline |
|
202 | > readline | |
203 | > readline |
|
203 | > readline | |
204 | > readline |
|
204 | > readline | |
205 | > readline |
|
205 | > readline | |
206 | > readline |
|
206 | > readline | |
207 | > readline |
|
207 | > readline | |
208 | > readline |
|
208 | > readline | |
209 | > raw |
|
209 | > raw | |
210 | > between\n |
|
210 | > between\n | |
211 | > pairs 81\n |
|
211 | > pairs 81\n | |
212 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
212 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
213 | > readline |
|
213 | > readline | |
214 | > readline |
|
214 | > readline | |
215 | > EOF |
|
215 | > EOF | |
216 | using raw connection to peer |
|
216 | using raw connection to peer | |
217 | i> write(6) -> 6: |
|
217 | i> write(6) -> 6: | |
218 | i> hello\n |
|
218 | i> hello\n | |
219 | o> readline() -> 15: |
|
219 | o> readline() -> 15: | |
220 | o> banner: line 0\n |
|
220 | o> banner: line 0\n | |
221 | o> readline() -> 15: |
|
221 | o> readline() -> 15: | |
222 | o> banner: line 1\n |
|
222 | o> banner: line 1\n | |
223 | o> readline() -> 15: |
|
223 | o> readline() -> 15: | |
224 | o> banner: line 2\n |
|
224 | o> banner: line 2\n | |
225 | o> readline() -> 15: |
|
225 | o> readline() -> 15: | |
226 | o> banner: line 3\n |
|
226 | o> banner: line 3\n | |
227 | o> readline() -> 15: |
|
227 | o> readline() -> 15: | |
228 | o> banner: line 4\n |
|
228 | o> banner: line 4\n | |
229 | o> readline() -> 15: |
|
229 | o> readline() -> 15: | |
230 | o> banner: line 5\n |
|
230 | o> banner: line 5\n | |
231 | o> readline() -> 15: |
|
231 | o> readline() -> 15: | |
232 | o> banner: line 6\n |
|
232 | o> banner: line 6\n | |
233 | o> readline() -> 15: |
|
233 | o> readline() -> 15: | |
234 | o> banner: line 7\n |
|
234 | o> banner: line 7\n | |
235 | o> readline() -> 15: |
|
235 | o> readline() -> 15: | |
236 | o> banner: line 8\n |
|
236 | o> banner: line 8\n | |
237 | o> readline() -> 15: |
|
237 | o> readline() -> 15: | |
238 | o> banner: line 9\n |
|
238 | o> banner: line 9\n | |
239 | o> readline() -> 4: |
|
239 | o> readline() -> 4: | |
240 | o> 403\n |
|
240 | o> 403\n | |
241 | o> readline() -> 403: |
|
241 | o> readline() -> 403: | |
242 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n |
|
242 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n | |
243 | i> write(98) -> 98: |
|
243 | i> write(98) -> 98: | |
244 | i> between\n |
|
244 | i> between\n | |
245 | i> pairs 81\n |
|
245 | i> pairs 81\n | |
246 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
246 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
247 | o> readline() -> 2: |
|
247 | o> readline() -> 2: | |
248 | o> 1\n |
|
248 | o> 1\n | |
249 | o> readline() -> 1: |
|
249 | o> readline() -> 1: | |
250 | o> \n |
|
250 | o> \n | |
251 |
|
251 | |||
252 | Connecting to a <0.9.1 server that doesn't support the hello command. |
|
252 | Connecting to a <0.9.1 server that doesn't support the hello command. | |
253 | The client should refuse, as we dropped support for connecting to such |
|
253 | The client should refuse, as we dropped support for connecting to such | |
254 | servers. |
|
254 | servers. | |
255 |
|
255 | |||
256 | $ SSHSERVERMODE=no-hello hg --debug debugpeer ssh://user@dummy/server |
|
256 | $ SSHSERVERMODE=no-hello hg --debug debugpeer ssh://user@dummy/server | |
257 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) |
|
257 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) | |
258 | running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !) |
|
258 | running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !) | |
259 | devel-peer-request: hello |
|
259 | devel-peer-request: hello | |
260 | sending hello command |
|
260 | sending hello command | |
261 | devel-peer-request: between |
|
261 | devel-peer-request: between | |
262 | devel-peer-request: pairs: 81 bytes |
|
262 | devel-peer-request: pairs: 81 bytes | |
263 | sending between command |
|
263 | sending between command | |
264 | remote: 0 |
|
264 | remote: 0 | |
265 | remote: 1 |
|
265 | remote: 1 | |
266 | abort: no suitable response from remote hg! |
|
266 | abort: no suitable response from remote hg! | |
267 | [255] |
|
267 | [255] | |
268 |
|
268 | |||
269 | Sending an unknown command to the server results in an empty response to that command |
|
269 | Sending an unknown command to the server results in an empty response to that command | |
270 |
|
270 | |||
271 | $ hg -R server debugwireproto --localssh --peer raw << EOF |
|
271 | $ hg -R server debugwireproto --localssh --peer raw << EOF | |
272 | > raw |
|
272 | > raw | |
273 | > pre-hello\n |
|
273 | > pre-hello\n | |
274 | > readline |
|
274 | > readline | |
275 | > raw |
|
275 | > raw | |
276 | > hello\n |
|
276 | > hello\n | |
277 | > readline |
|
277 | > readline | |
278 | > raw |
|
278 | > raw | |
279 | > between\n |
|
279 | > between\n | |
280 | > pairs 81\n |
|
280 | > pairs 81\n | |
281 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
281 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
282 | > readline |
|
282 | > readline | |
283 | > readline |
|
283 | > readline | |
284 | > EOF |
|
284 | > EOF | |
285 | using raw connection to peer |
|
285 | using raw connection to peer | |
286 | i> write(10) -> 10: |
|
286 | i> write(10) -> 10: | |
287 | i> pre-hello\n |
|
287 | i> pre-hello\n | |
288 | o> readline() -> 2: |
|
288 | o> readline() -> 2: | |
289 | o> 0\n |
|
289 | o> 0\n | |
290 | i> write(6) -> 6: |
|
290 | i> write(6) -> 6: | |
291 | i> hello\n |
|
291 | i> hello\n | |
292 | o> readline() -> 4: |
|
292 | o> readline() -> 4: | |
293 | o> 403\n |
|
293 | o> 403\n | |
294 | i> write(98) -> 98: |
|
294 | i> write(98) -> 98: | |
295 | i> between\n |
|
295 | i> between\n | |
296 | i> pairs 81\n |
|
296 | i> pairs 81\n | |
297 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
297 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
298 | o> readline() -> 403: |
|
298 | o> readline() -> 403: | |
299 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n |
|
299 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n | |
300 | o> readline() -> 2: |
|
300 | o> readline() -> 2: | |
301 | o> 1\n |
|
301 | o> 1\n | |
302 |
|
302 | |||
303 | $ hg --config sshpeer.mode=extra-handshake-commands --config sshpeer.handshake-mode=pre-no-args --debug debugpeer ssh://user@dummy/server |
|
303 | $ hg --config sshpeer.mode=extra-handshake-commands --config sshpeer.handshake-mode=pre-no-args --debug debugpeer ssh://user@dummy/server | |
304 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) |
|
304 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) | |
305 | running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !) |
|
305 | running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !) | |
306 | sending no-args command |
|
306 | sending no-args command | |
307 | devel-peer-request: hello |
|
307 | devel-peer-request: hello | |
308 | sending hello command |
|
308 | sending hello command | |
309 | devel-peer-request: between |
|
309 | devel-peer-request: between | |
310 | devel-peer-request: pairs: 81 bytes |
|
310 | devel-peer-request: pairs: 81 bytes | |
311 | sending between command |
|
311 | sending between command | |
312 | remote: 0 |
|
312 | remote: 0 | |
313 | remote: 403 |
|
313 | remote: 403 | |
314 | remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch |
|
314 | remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch | |
315 | remote: 1 |
|
315 | remote: 1 | |
316 | url: ssh://user@dummy/server |
|
316 | url: ssh://user@dummy/server | |
317 | local: no |
|
317 | local: no | |
318 | pushable: yes |
|
318 | pushable: yes | |
319 |
|
319 | |||
320 | Send multiple unknown commands before hello |
|
320 | Send multiple unknown commands before hello | |
321 |
|
321 | |||
322 | $ hg -R server debugwireproto --localssh --peer raw << EOF |
|
322 | $ hg -R server debugwireproto --localssh --peer raw << EOF | |
323 | > raw |
|
323 | > raw | |
324 | > unknown1\n |
|
324 | > unknown1\n | |
325 | > readline |
|
325 | > readline | |
326 | > raw |
|
326 | > raw | |
327 | > unknown2\n |
|
327 | > unknown2\n | |
328 | > readline |
|
328 | > readline | |
329 | > raw |
|
329 | > raw | |
330 | > unknown3\n |
|
330 | > unknown3\n | |
331 | > readline |
|
331 | > readline | |
332 | > raw |
|
332 | > raw | |
333 | > hello\n |
|
333 | > hello\n | |
334 | > readline |
|
334 | > readline | |
335 | > readline |
|
335 | > readline | |
336 | > raw |
|
336 | > raw | |
337 | > between\n |
|
337 | > between\n | |
338 | > pairs 81\n |
|
338 | > pairs 81\n | |
339 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
339 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
340 | > readline |
|
340 | > readline | |
341 | > readline |
|
341 | > readline | |
342 | > EOF |
|
342 | > EOF | |
343 | using raw connection to peer |
|
343 | using raw connection to peer | |
344 | i> write(9) -> 9: |
|
344 | i> write(9) -> 9: | |
345 | i> unknown1\n |
|
345 | i> unknown1\n | |
346 | o> readline() -> 2: |
|
346 | o> readline() -> 2: | |
347 | o> 0\n |
|
347 | o> 0\n | |
348 | i> write(9) -> 9: |
|
348 | i> write(9) -> 9: | |
349 | i> unknown2\n |
|
349 | i> unknown2\n | |
350 | o> readline() -> 2: |
|
350 | o> readline() -> 2: | |
351 | o> 0\n |
|
351 | o> 0\n | |
352 | i> write(9) -> 9: |
|
352 | i> write(9) -> 9: | |
353 | i> unknown3\n |
|
353 | i> unknown3\n | |
354 | o> readline() -> 2: |
|
354 | o> readline() -> 2: | |
355 | o> 0\n |
|
355 | o> 0\n | |
356 | i> write(6) -> 6: |
|
356 | i> write(6) -> 6: | |
357 | i> hello\n |
|
357 | i> hello\n | |
358 | o> readline() -> 4: |
|
358 | o> readline() -> 4: | |
359 | o> 403\n |
|
359 | o> 403\n | |
360 | o> readline() -> 403: |
|
360 | o> readline() -> 403: | |
361 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n |
|
361 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n | |
362 | i> write(98) -> 98: |
|
362 | i> write(98) -> 98: | |
363 | i> between\n |
|
363 | i> between\n | |
364 | i> pairs 81\n |
|
364 | i> pairs 81\n | |
365 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
365 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
366 | o> readline() -> 2: |
|
366 | o> readline() -> 2: | |
367 | o> 1\n |
|
367 | o> 1\n | |
368 | o> readline() -> 1: |
|
368 | o> readline() -> 1: | |
369 | o> \n |
|
369 | o> \n | |
370 |
|
370 | |||
371 | $ hg --config sshpeer.mode=extra-handshake-commands --config sshpeer.handshake-mode=pre-multiple-no-args --debug debugpeer ssh://user@dummy/server |
|
371 | $ hg --config sshpeer.mode=extra-handshake-commands --config sshpeer.handshake-mode=pre-multiple-no-args --debug debugpeer ssh://user@dummy/server | |
372 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) |
|
372 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) | |
373 | running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !) |
|
373 | running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !) | |
374 | sending unknown1 command |
|
374 | sending unknown1 command | |
375 | sending unknown2 command |
|
375 | sending unknown2 command | |
376 | sending unknown3 command |
|
376 | sending unknown3 command | |
377 | devel-peer-request: hello |
|
377 | devel-peer-request: hello | |
378 | sending hello command |
|
378 | sending hello command | |
379 | devel-peer-request: between |
|
379 | devel-peer-request: between | |
380 | devel-peer-request: pairs: 81 bytes |
|
380 | devel-peer-request: pairs: 81 bytes | |
381 | sending between command |
|
381 | sending between command | |
382 | remote: 0 |
|
382 | remote: 0 | |
383 | remote: 0 |
|
383 | remote: 0 | |
384 | remote: 0 |
|
384 | remote: 0 | |
385 | remote: 403 |
|
385 | remote: 403 | |
386 | remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch |
|
386 | remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch | |
387 | remote: 1 |
|
387 | remote: 1 | |
388 | url: ssh://user@dummy/server |
|
388 | url: ssh://user@dummy/server | |
389 | local: no |
|
389 | local: no | |
390 | pushable: yes |
|
390 | pushable: yes | |
391 |
|
391 | |||
392 | Send an unknown command before hello that has arguments |
|
392 | Send an unknown command before hello that has arguments | |
393 |
|
393 | |||
394 | $ cd server |
|
394 | $ cd server | |
395 |
|
395 | |||
396 | $ hg debugwireproto --localssh --peer raw << EOF |
|
396 | $ hg debugwireproto --localssh --peer raw << EOF | |
397 | > raw |
|
397 | > raw | |
398 | > with-args\n |
|
398 | > with-args\n | |
399 | > foo 13\n |
|
399 | > foo 13\n | |
400 | > value for foo\n |
|
400 | > value for foo\n | |
401 | > bar 13\n |
|
401 | > bar 13\n | |
402 | > value for bar\n |
|
402 | > value for bar\n | |
403 | > readline |
|
403 | > readline | |
404 | > readline |
|
404 | > readline | |
405 | > readline |
|
405 | > readline | |
406 | > readline |
|
406 | > readline | |
407 | > readline |
|
407 | > readline | |
408 | > raw |
|
408 | > raw | |
409 | > hello\n |
|
409 | > hello\n | |
410 | > readline |
|
410 | > readline | |
411 | > readline |
|
411 | > readline | |
412 | > raw |
|
412 | > raw | |
413 | > between\n |
|
413 | > between\n | |
414 | > pairs 81\n |
|
414 | > pairs 81\n | |
415 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
415 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
416 | > readline |
|
416 | > readline | |
417 | > readline |
|
417 | > readline | |
418 | > EOF |
|
418 | > EOF | |
419 | using raw connection to peer |
|
419 | using raw connection to peer | |
420 | i> write(52) -> 52: |
|
420 | i> write(52) -> 52: | |
421 | i> with-args\n |
|
421 | i> with-args\n | |
422 | i> foo 13\n |
|
422 | i> foo 13\n | |
423 | i> value for foo\n |
|
423 | i> value for foo\n | |
424 | i> bar 13\n |
|
424 | i> bar 13\n | |
425 | i> value for bar\n |
|
425 | i> value for bar\n | |
426 | o> readline() -> 2: |
|
426 | o> readline() -> 2: | |
427 | o> 0\n |
|
427 | o> 0\n | |
428 | o> readline() -> 2: |
|
428 | o> readline() -> 2: | |
429 | o> 0\n |
|
429 | o> 0\n | |
430 | o> readline() -> 2: |
|
430 | o> readline() -> 2: | |
431 | o> 0\n |
|
431 | o> 0\n | |
432 | o> readline() -> 2: |
|
432 | o> readline() -> 2: | |
433 | o> 0\n |
|
433 | o> 0\n | |
434 | o> readline() -> 2: |
|
434 | o> readline() -> 2: | |
435 | o> 0\n |
|
435 | o> 0\n | |
436 | i> write(6) -> 6: |
|
436 | i> write(6) -> 6: | |
437 | i> hello\n |
|
437 | i> hello\n | |
438 | o> readline() -> 4: |
|
438 | o> readline() -> 4: | |
439 | o> 403\n |
|
439 | o> 403\n | |
440 | o> readline() -> 403: |
|
440 | o> readline() -> 403: | |
441 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n |
|
441 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n | |
442 | i> write(98) -> 98: |
|
442 | i> write(98) -> 98: | |
443 | i> between\n |
|
443 | i> between\n | |
444 | i> pairs 81\n |
|
444 | i> pairs 81\n | |
445 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
445 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
446 | o> readline() -> 2: |
|
446 | o> readline() -> 2: | |
447 | o> 1\n |
|
447 | o> 1\n | |
448 | o> readline() -> 1: |
|
448 | o> readline() -> 1: | |
449 | o> \n |
|
449 | o> \n | |
450 |
|
450 | |||
451 | Send an unknown command having an argument that looks numeric |
|
451 | Send an unknown command having an argument that looks numeric | |
452 |
|
452 | |||
453 | $ hg debugwireproto --localssh --peer raw << EOF |
|
453 | $ hg debugwireproto --localssh --peer raw << EOF | |
454 | > raw |
|
454 | > raw | |
455 | > unknown\n |
|
455 | > unknown\n | |
456 | > foo 1\n |
|
456 | > foo 1\n | |
457 | > 0\n |
|
457 | > 0\n | |
458 | > readline |
|
458 | > readline | |
459 | > readline |
|
459 | > readline | |
460 | > readline |
|
460 | > readline | |
461 | > raw |
|
461 | > raw | |
462 | > hello\n |
|
462 | > hello\n | |
463 | > readline |
|
463 | > readline | |
464 | > readline |
|
464 | > readline | |
465 | > raw |
|
465 | > raw | |
466 | > between\n |
|
466 | > between\n | |
467 | > pairs 81\n |
|
467 | > pairs 81\n | |
468 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
468 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
469 | > readline |
|
469 | > readline | |
470 | > readline |
|
470 | > readline | |
471 | > EOF |
|
471 | > EOF | |
472 | using raw connection to peer |
|
472 | using raw connection to peer | |
473 | i> write(16) -> 16: |
|
473 | i> write(16) -> 16: | |
474 | i> unknown\n |
|
474 | i> unknown\n | |
475 | i> foo 1\n |
|
475 | i> foo 1\n | |
476 | i> 0\n |
|
476 | i> 0\n | |
477 | o> readline() -> 2: |
|
477 | o> readline() -> 2: | |
478 | o> 0\n |
|
478 | o> 0\n | |
479 | o> readline() -> 2: |
|
479 | o> readline() -> 2: | |
480 | o> 0\n |
|
480 | o> 0\n | |
481 | o> readline() -> 2: |
|
481 | o> readline() -> 2: | |
482 | o> 0\n |
|
482 | o> 0\n | |
483 | i> write(6) -> 6: |
|
483 | i> write(6) -> 6: | |
484 | i> hello\n |
|
484 | i> hello\n | |
485 | o> readline() -> 4: |
|
485 | o> readline() -> 4: | |
486 | o> 403\n |
|
486 | o> 403\n | |
487 | o> readline() -> 403: |
|
487 | o> readline() -> 403: | |
488 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n |
|
488 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n | |
489 | i> write(98) -> 98: |
|
489 | i> write(98) -> 98: | |
490 | i> between\n |
|
490 | i> between\n | |
491 | i> pairs 81\n |
|
491 | i> pairs 81\n | |
492 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
492 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
493 | o> readline() -> 2: |
|
493 | o> readline() -> 2: | |
494 | o> 1\n |
|
494 | o> 1\n | |
495 | o> readline() -> 1: |
|
495 | o> readline() -> 1: | |
496 | o> \n |
|
496 | o> \n | |
497 |
|
497 | |||
498 | $ hg debugwireproto --localssh --peer raw << EOF |
|
498 | $ hg debugwireproto --localssh --peer raw << EOF | |
499 | > raw |
|
499 | > raw | |
500 | > unknown\n |
|
500 | > unknown\n | |
501 | > foo 1\n |
|
501 | > foo 1\n | |
502 | > 1\n |
|
502 | > 1\n | |
503 | > readline |
|
503 | > readline | |
504 | > readline |
|
504 | > readline | |
505 | > readline |
|
505 | > readline | |
506 | > raw |
|
506 | > raw | |
507 | > hello\n |
|
507 | > hello\n | |
508 | > readline |
|
508 | > readline | |
509 | > readline |
|
509 | > readline | |
510 | > raw |
|
510 | > raw | |
511 | > between\n |
|
511 | > between\n | |
512 | > pairs 81\n |
|
512 | > pairs 81\n | |
513 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
513 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
514 | > readline |
|
514 | > readline | |
515 | > readline |
|
515 | > readline | |
516 | > EOF |
|
516 | > EOF | |
517 | using raw connection to peer |
|
517 | using raw connection to peer | |
518 | i> write(16) -> 16: |
|
518 | i> write(16) -> 16: | |
519 | i> unknown\n |
|
519 | i> unknown\n | |
520 | i> foo 1\n |
|
520 | i> foo 1\n | |
521 | i> 1\n |
|
521 | i> 1\n | |
522 | o> readline() -> 2: |
|
522 | o> readline() -> 2: | |
523 | o> 0\n |
|
523 | o> 0\n | |
524 | o> readline() -> 2: |
|
524 | o> readline() -> 2: | |
525 | o> 0\n |
|
525 | o> 0\n | |
526 | o> readline() -> 2: |
|
526 | o> readline() -> 2: | |
527 | o> 0\n |
|
527 | o> 0\n | |
528 | i> write(6) -> 6: |
|
528 | i> write(6) -> 6: | |
529 | i> hello\n |
|
529 | i> hello\n | |
530 | o> readline() -> 4: |
|
530 | o> readline() -> 4: | |
531 | o> 403\n |
|
531 | o> 403\n | |
532 | o> readline() -> 403: |
|
532 | o> readline() -> 403: | |
533 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n |
|
533 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n | |
534 | i> write(98) -> 98: |
|
534 | i> write(98) -> 98: | |
535 | i> between\n |
|
535 | i> between\n | |
536 | i> pairs 81\n |
|
536 | i> pairs 81\n | |
537 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
537 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
538 | o> readline() -> 2: |
|
538 | o> readline() -> 2: | |
539 | o> 1\n |
|
539 | o> 1\n | |
540 | o> readline() -> 1: |
|
540 | o> readline() -> 1: | |
541 | o> \n |
|
541 | o> \n | |
542 |
|
542 | |||
543 | When sending a dict argument value, it is serialized to |
|
543 | When sending a dict argument value, it is serialized to | |
544 | "<arg> <item count>" followed by "<key> <len>\n<value>" for each item |
|
544 | "<arg> <item count>" followed by "<key> <len>\n<value>" for each item | |
545 | in the dict. |
|
545 | in the dict. | |
546 |
|
546 | |||
547 | Dictionary value for unknown command |
|
547 | Dictionary value for unknown command | |
548 |
|
548 | |||
549 | $ hg debugwireproto --localssh --peer raw << EOF |
|
549 | $ hg debugwireproto --localssh --peer raw << EOF | |
550 | > raw |
|
550 | > raw | |
551 | > unknown\n |
|
551 | > unknown\n | |
552 | > dict 3\n |
|
552 | > dict 3\n | |
553 | > key1 3\n |
|
553 | > key1 3\n | |
554 | > foo\n |
|
554 | > foo\n | |
555 | > key2 3\n |
|
555 | > key2 3\n | |
556 | > bar\n |
|
556 | > bar\n | |
557 | > key3 3\n |
|
557 | > key3 3\n | |
558 | > baz\n |
|
558 | > baz\n | |
559 | > readline |
|
559 | > readline | |
560 | > readline |
|
560 | > readline | |
561 | > readline |
|
561 | > readline | |
562 | > readline |
|
562 | > readline | |
563 | > readline |
|
563 | > readline | |
564 | > readline |
|
564 | > readline | |
565 | > readline |
|
565 | > readline | |
566 | > readline |
|
566 | > readline | |
567 | > raw |
|
567 | > raw | |
568 | > hello\n |
|
568 | > hello\n | |
569 | > readline |
|
569 | > readline | |
570 | > readline |
|
570 | > readline | |
571 | > EOF |
|
571 | > EOF | |
572 | using raw connection to peer |
|
572 | using raw connection to peer | |
573 | i> write(48) -> 48: |
|
573 | i> write(48) -> 48: | |
574 | i> unknown\n |
|
574 | i> unknown\n | |
575 | i> dict 3\n |
|
575 | i> dict 3\n | |
576 | i> key1 3\n |
|
576 | i> key1 3\n | |
577 | i> foo\n |
|
577 | i> foo\n | |
578 | i> key2 3\n |
|
578 | i> key2 3\n | |
579 | i> bar\n |
|
579 | i> bar\n | |
580 | i> key3 3\n |
|
580 | i> key3 3\n | |
581 | i> baz\n |
|
581 | i> baz\n | |
582 | o> readline() -> 2: |
|
582 | o> readline() -> 2: | |
583 | o> 0\n |
|
583 | o> 0\n | |
584 | o> readline() -> 2: |
|
584 | o> readline() -> 2: | |
585 | o> 0\n |
|
585 | o> 0\n | |
586 | o> readline() -> 2: |
|
586 | o> readline() -> 2: | |
587 | o> 0\n |
|
587 | o> 0\n | |
588 | o> readline() -> 2: |
|
588 | o> readline() -> 2: | |
589 | o> 0\n |
|
589 | o> 0\n | |
590 | o> readline() -> 2: |
|
590 | o> readline() -> 2: | |
591 | o> 0\n |
|
591 | o> 0\n | |
592 | o> readline() -> 2: |
|
592 | o> readline() -> 2: | |
593 | o> 0\n |
|
593 | o> 0\n | |
594 | o> readline() -> 2: |
|
594 | o> readline() -> 2: | |
595 | o> 0\n |
|
595 | o> 0\n | |
596 | o> readline() -> 2: |
|
596 | o> readline() -> 2: | |
597 | o> 0\n |
|
597 | o> 0\n | |
598 | i> write(6) -> 6: |
|
598 | i> write(6) -> 6: | |
599 | i> hello\n |
|
599 | i> hello\n | |
600 | o> readline() -> 4: |
|
600 | o> readline() -> 4: | |
601 | o> 403\n |
|
601 | o> 403\n | |
602 | o> readline() -> 403: |
|
602 | o> readline() -> 403: | |
603 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n |
|
603 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n | |
604 |
|
604 | |||
605 | Incomplete dictionary send |
|
605 | Incomplete dictionary send | |
606 |
|
606 | |||
607 | $ hg debugwireproto --localssh --peer raw << EOF |
|
607 | $ hg debugwireproto --localssh --peer raw << EOF | |
608 | > raw |
|
608 | > raw | |
609 | > unknown\n |
|
609 | > unknown\n | |
610 | > dict 3\n |
|
610 | > dict 3\n | |
611 | > key1 3\n |
|
611 | > key1 3\n | |
612 | > foo\n |
|
612 | > foo\n | |
613 | > readline |
|
613 | > readline | |
614 | > readline |
|
614 | > readline | |
615 | > readline |
|
615 | > readline | |
616 | > readline |
|
616 | > readline | |
617 | > EOF |
|
617 | > EOF | |
618 | using raw connection to peer |
|
618 | using raw connection to peer | |
619 | i> write(26) -> 26: |
|
619 | i> write(26) -> 26: | |
620 | i> unknown\n |
|
620 | i> unknown\n | |
621 | i> dict 3\n |
|
621 | i> dict 3\n | |
622 | i> key1 3\n |
|
622 | i> key1 3\n | |
623 | i> foo\n |
|
623 | i> foo\n | |
624 | o> readline() -> 2: |
|
624 | o> readline() -> 2: | |
625 | o> 0\n |
|
625 | o> 0\n | |
626 | o> readline() -> 2: |
|
626 | o> readline() -> 2: | |
627 | o> 0\n |
|
627 | o> 0\n | |
628 | o> readline() -> 2: |
|
628 | o> readline() -> 2: | |
629 | o> 0\n |
|
629 | o> 0\n | |
630 | o> readline() -> 2: |
|
630 | o> readline() -> 2: | |
631 | o> 0\n |
|
631 | o> 0\n | |
632 |
|
632 | |||
633 | Incomplete value send |
|
633 | Incomplete value send | |
634 |
|
634 | |||
635 | $ hg debugwireproto --localssh --peer raw << EOF |
|
635 | $ hg debugwireproto --localssh --peer raw << EOF | |
636 | > raw |
|
636 | > raw | |
637 | > unknown\n |
|
637 | > unknown\n | |
638 | > dict 3\n |
|
638 | > dict 3\n | |
639 | > key1 3\n |
|
639 | > key1 3\n | |
640 | > fo |
|
640 | > fo | |
641 | > readline |
|
641 | > readline | |
642 | > readline |
|
642 | > readline | |
643 | > readline |
|
643 | > readline | |
644 | > EOF |
|
644 | > EOF | |
645 | using raw connection to peer |
|
645 | using raw connection to peer | |
646 | i> write(24) -> 24: |
|
646 | i> write(24) -> 24: | |
647 | i> unknown\n |
|
647 | i> unknown\n | |
648 | i> dict 3\n |
|
648 | i> dict 3\n | |
649 | i> key1 3\n |
|
649 | i> key1 3\n | |
650 | i> fo |
|
650 | i> fo | |
651 | o> readline() -> 2: |
|
651 | o> readline() -> 2: | |
652 | o> 0\n |
|
652 | o> 0\n | |
653 | o> readline() -> 2: |
|
653 | o> readline() -> 2: | |
654 | o> 0\n |
|
654 | o> 0\n | |
655 | o> readline() -> 2: |
|
655 | o> readline() -> 2: | |
656 | o> 0\n |
|
656 | o> 0\n | |
657 |
|
657 | |||
658 | Send a command line with spaces |
|
658 | Send a command line with spaces | |
659 |
|
659 | |||
660 | $ hg debugwireproto --localssh --peer raw << EOF |
|
660 | $ hg debugwireproto --localssh --peer raw << EOF | |
661 | > raw |
|
661 | > raw | |
662 | > unknown withspace\n |
|
662 | > unknown withspace\n | |
663 | > readline |
|
663 | > readline | |
664 | > raw |
|
664 | > raw | |
665 | > hello\n |
|
665 | > hello\n | |
666 | > readline |
|
666 | > readline | |
667 | > readline |
|
667 | > readline | |
668 | > raw |
|
668 | > raw | |
669 | > between\n |
|
669 | > between\n | |
670 | > pairs 81\n |
|
670 | > pairs 81\n | |
671 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
671 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
672 | > readline |
|
672 | > readline | |
673 | > readline |
|
673 | > readline | |
674 | > EOF |
|
674 | > EOF | |
675 | using raw connection to peer |
|
675 | using raw connection to peer | |
676 | i> write(18) -> 18: |
|
676 | i> write(18) -> 18: | |
677 | i> unknown withspace\n |
|
677 | i> unknown withspace\n | |
678 | o> readline() -> 2: |
|
678 | o> readline() -> 2: | |
679 | o> 0\n |
|
679 | o> 0\n | |
680 | i> write(6) -> 6: |
|
680 | i> write(6) -> 6: | |
681 | i> hello\n |
|
681 | i> hello\n | |
682 | o> readline() -> 4: |
|
682 | o> readline() -> 4: | |
683 | o> 403\n |
|
683 | o> 403\n | |
684 | o> readline() -> 403: |
|
684 | o> readline() -> 403: | |
685 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n |
|
685 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n | |
686 | i> write(98) -> 98: |
|
686 | i> write(98) -> 98: | |
687 | i> between\n |
|
687 | i> between\n | |
688 | i> pairs 81\n |
|
688 | i> pairs 81\n | |
689 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
689 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
690 | o> readline() -> 2: |
|
690 | o> readline() -> 2: | |
691 | o> 1\n |
|
691 | o> 1\n | |
692 | o> readline() -> 1: |
|
692 | o> readline() -> 1: | |
693 | o> \n |
|
693 | o> \n | |
694 |
|
694 | |||
695 | $ hg debugwireproto --localssh --peer raw << EOF |
|
695 | $ hg debugwireproto --localssh --peer raw << EOF | |
696 | > raw |
|
696 | > raw | |
697 | > unknown with multiple spaces\n |
|
697 | > unknown with multiple spaces\n | |
698 | > readline |
|
698 | > readline | |
699 | > raw |
|
699 | > raw | |
700 | > hello\n |
|
700 | > hello\n | |
701 | > readline |
|
701 | > readline | |
702 | > readline |
|
702 | > readline | |
703 | > raw |
|
703 | > raw | |
704 | > between\n |
|
704 | > between\n | |
705 | > pairs 81\n |
|
705 | > pairs 81\n | |
706 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
706 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
707 | > readline |
|
707 | > readline | |
708 | > EOF |
|
708 | > EOF | |
709 | using raw connection to peer |
|
709 | using raw connection to peer | |
710 | i> write(29) -> 29: |
|
710 | i> write(29) -> 29: | |
711 | i> unknown with multiple spaces\n |
|
711 | i> unknown with multiple spaces\n | |
712 | o> readline() -> 2: |
|
712 | o> readline() -> 2: | |
713 | o> 0\n |
|
713 | o> 0\n | |
714 | i> write(6) -> 6: |
|
714 | i> write(6) -> 6: | |
715 | i> hello\n |
|
715 | i> hello\n | |
716 | o> readline() -> 4: |
|
716 | o> readline() -> 4: | |
717 | o> 403\n |
|
717 | o> 403\n | |
718 | o> readline() -> 403: |
|
718 | o> readline() -> 403: | |
719 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n |
|
719 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n | |
720 | i> write(98) -> 98: |
|
720 | i> write(98) -> 98: | |
721 | i> between\n |
|
721 | i> between\n | |
722 | i> pairs 81\n |
|
722 | i> pairs 81\n | |
723 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
723 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
724 | o> readline() -> 2: |
|
724 | o> readline() -> 2: | |
725 | o> 1\n |
|
725 | o> 1\n | |
726 |
|
726 | |||
727 | $ hg debugwireproto --localssh --peer raw << EOF |
|
727 | $ hg debugwireproto --localssh --peer raw << EOF | |
728 | > raw |
|
728 | > raw | |
729 | > unknown with spaces\n |
|
729 | > unknown with spaces\n | |
730 | > key 10\n |
|
730 | > key 10\n | |
731 | > some value\n |
|
731 | > some value\n | |
732 | > readline |
|
732 | > readline | |
733 | > readline |
|
733 | > readline | |
734 | > readline |
|
734 | > readline | |
735 | > raw |
|
735 | > raw | |
736 | > hello\n |
|
736 | > hello\n | |
737 | > readline |
|
737 | > readline | |
738 | > readline |
|
738 | > readline | |
739 | > raw |
|
739 | > raw | |
740 | > between\n |
|
740 | > between\n | |
741 | > pairs 81\n |
|
741 | > pairs 81\n | |
742 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
742 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
743 | > readline |
|
743 | > readline | |
744 | > readline |
|
744 | > readline | |
745 | > EOF |
|
745 | > EOF | |
746 | using raw connection to peer |
|
746 | using raw connection to peer | |
747 | i> write(38) -> 38: |
|
747 | i> write(38) -> 38: | |
748 | i> unknown with spaces\n |
|
748 | i> unknown with spaces\n | |
749 | i> key 10\n |
|
749 | i> key 10\n | |
750 | i> some value\n |
|
750 | i> some value\n | |
751 | o> readline() -> 2: |
|
751 | o> readline() -> 2: | |
752 | o> 0\n |
|
752 | o> 0\n | |
753 | o> readline() -> 2: |
|
753 | o> readline() -> 2: | |
754 | o> 0\n |
|
754 | o> 0\n | |
755 | o> readline() -> 2: |
|
755 | o> readline() -> 2: | |
756 | o> 0\n |
|
756 | o> 0\n | |
757 | i> write(6) -> 6: |
|
757 | i> write(6) -> 6: | |
758 | i> hello\n |
|
758 | i> hello\n | |
759 | o> readline() -> 4: |
|
759 | o> readline() -> 4: | |
760 | o> 403\n |
|
760 | o> 403\n | |
761 | o> readline() -> 403: |
|
761 | o> readline() -> 403: | |
762 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n |
|
762 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n | |
763 | i> write(98) -> 98: |
|
763 | i> write(98) -> 98: | |
764 | i> between\n |
|
764 | i> between\n | |
765 | i> pairs 81\n |
|
765 | i> pairs 81\n | |
766 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
766 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
767 | o> readline() -> 2: |
|
767 | o> readline() -> 2: | |
768 | o> 1\n |
|
768 | o> 1\n | |
769 | o> readline() -> 1: |
|
769 | o> readline() -> 1: | |
770 | o> \n |
|
770 | o> \n | |
771 | Send an unknown command after the "between" |
|
771 | Send an unknown command after the "between" | |
772 |
|
772 | |||
773 | $ hg debugwireproto --localssh --peer raw << EOF |
|
773 | $ hg debugwireproto --localssh --peer raw << EOF | |
774 | > raw |
|
774 | > raw | |
775 | > hello\n |
|
775 | > hello\n | |
776 | > readline |
|
776 | > readline | |
777 | > readline |
|
777 | > readline | |
778 | > raw |
|
778 | > raw | |
779 | > between\n |
|
779 | > between\n | |
780 | > pairs 81\n |
|
780 | > pairs 81\n | |
781 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000unknown |
|
781 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000unknown | |
782 | > readline |
|
782 | > readline | |
783 | > readline |
|
783 | > readline | |
784 | > EOF |
|
784 | > EOF | |
785 | using raw connection to peer |
|
785 | using raw connection to peer | |
786 | i> write(6) -> 6: |
|
786 | i> write(6) -> 6: | |
787 | i> hello\n |
|
787 | i> hello\n | |
788 | o> readline() -> 4: |
|
788 | o> readline() -> 4: | |
789 | o> 403\n |
|
789 | o> 403\n | |
790 | o> readline() -> 403: |
|
790 | o> readline() -> 403: | |
791 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n |
|
791 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n | |
792 | i> write(105) -> 105: |
|
792 | i> write(105) -> 105: | |
793 | i> between\n |
|
793 | i> between\n | |
794 | i> pairs 81\n |
|
794 | i> pairs 81\n | |
795 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000unknown |
|
795 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000unknown | |
796 | o> readline() -> 2: |
|
796 | o> readline() -> 2: | |
797 | o> 1\n |
|
797 | o> 1\n | |
798 | o> readline() -> 1: |
|
798 | o> readline() -> 1: | |
799 | o> \n |
|
799 | o> \n | |
800 |
|
800 | |||
801 | And one with arguments |
|
801 | And one with arguments | |
802 |
|
802 | |||
803 | $ hg debugwireproto --localssh --peer raw << EOF |
|
803 | $ hg debugwireproto --localssh --peer raw << EOF | |
804 | > raw |
|
804 | > raw | |
805 | > hello\n |
|
805 | > hello\n | |
806 | > between\n |
|
806 | > between\n | |
807 | > pairs 81\n |
|
807 | > pairs 81\n | |
808 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
808 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
809 | > readline |
|
809 | > readline | |
810 | > readline |
|
810 | > readline | |
811 | > readline |
|
811 | > readline | |
812 | > readline |
|
812 | > readline | |
813 | > raw |
|
813 | > raw | |
814 | > unknown\n |
|
814 | > unknown\n | |
815 | > foo 5\n |
|
815 | > foo 5\n | |
816 | > \nvalue\n |
|
816 | > \nvalue\n | |
817 | > bar 3\n |
|
817 | > bar 3\n | |
818 | > baz\n |
|
818 | > baz\n | |
819 | > readline |
|
819 | > readline | |
820 | > readline |
|
820 | > readline | |
821 | > readline |
|
821 | > readline | |
822 | > EOF |
|
822 | > EOF | |
823 | using raw connection to peer |
|
823 | using raw connection to peer | |
824 | i> write(104) -> 104: |
|
824 | i> write(104) -> 104: | |
825 | i> hello\n |
|
825 | i> hello\n | |
826 | i> between\n |
|
826 | i> between\n | |
827 | i> pairs 81\n |
|
827 | i> pairs 81\n | |
828 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
828 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
829 | o> readline() -> 4: |
|
829 | o> readline() -> 4: | |
830 | o> 403\n |
|
830 | o> 403\n | |
831 | o> readline() -> 403: |
|
831 | o> readline() -> 403: | |
832 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n |
|
832 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n | |
833 | o> readline() -> 2: |
|
833 | o> readline() -> 2: | |
834 | o> 1\n |
|
834 | o> 1\n | |
835 | o> readline() -> 1: |
|
835 | o> readline() -> 1: | |
836 | o> \n |
|
836 | o> \n | |
837 | i> write(31) -> 31: |
|
837 | i> write(31) -> 31: | |
838 | i> unknown\n |
|
838 | i> unknown\n | |
839 | i> foo 5\n |
|
839 | i> foo 5\n | |
840 | i> \n |
|
840 | i> \n | |
841 | i> value\n |
|
841 | i> value\n | |
842 | i> bar 3\n |
|
842 | i> bar 3\n | |
843 | i> baz\n |
|
843 | i> baz\n | |
844 | o> readline() -> 2: |
|
844 | o> readline() -> 2: | |
845 | o> 0\n |
|
845 | o> 0\n | |
846 | o> readline() -> 2: |
|
846 | o> readline() -> 2: | |
847 | o> 0\n |
|
847 | o> 0\n | |
848 | o> readline() -> 0: |
|
848 | o> readline() -> 0: | |
849 |
|
849 | |||
850 | Send a valid command before the handshake |
|
850 | Send a valid command before the handshake | |
851 |
|
851 | |||
852 | $ hg debugwireproto --localssh --peer raw << EOF |
|
852 | $ hg debugwireproto --localssh --peer raw << EOF | |
853 | > raw |
|
853 | > raw | |
854 | > heads\n |
|
854 | > heads\n | |
855 | > readline |
|
855 | > readline | |
856 | > raw |
|
856 | > raw | |
857 | > hello\n |
|
857 | > hello\n | |
858 | > between\n |
|
858 | > between\n | |
859 | > pairs 81\n |
|
859 | > pairs 81\n | |
860 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
860 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
861 | > readline |
|
861 | > readline | |
862 | > readline |
|
862 | > readline | |
863 | > readline |
|
863 | > readline | |
864 | > readline |
|
864 | > readline | |
865 | > EOF |
|
865 | > EOF | |
866 | using raw connection to peer |
|
866 | using raw connection to peer | |
867 | i> write(6) -> 6: |
|
867 | i> write(6) -> 6: | |
868 | i> heads\n |
|
868 | i> heads\n | |
869 | o> readline() -> 3: |
|
869 | o> readline() -> 3: | |
870 | o> 41\n |
|
870 | o> 41\n | |
871 | i> write(104) -> 104: |
|
871 | i> write(104) -> 104: | |
872 | i> hello\n |
|
872 | i> hello\n | |
873 | i> between\n |
|
873 | i> between\n | |
874 | i> pairs 81\n |
|
874 | i> pairs 81\n | |
875 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
875 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
876 | o> readline() -> 41: |
|
876 | o> readline() -> 41: | |
877 | o> 68986213bd4485ea51533535e3fc9e78007a711f\n |
|
877 | o> 68986213bd4485ea51533535e3fc9e78007a711f\n | |
878 | o> readline() -> 4: |
|
878 | o> readline() -> 4: | |
879 | o> 403\n |
|
879 | o> 403\n | |
880 | o> readline() -> 403: |
|
880 | o> readline() -> 403: | |
881 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n |
|
881 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n | |
882 | o> readline() -> 2: |
|
882 | o> readline() -> 2: | |
883 | o> 1\n |
|
883 | o> 1\n | |
884 |
|
884 | |||
885 | And a variation that doesn't send the between command |
|
885 | And a variation that doesn't send the between command | |
886 |
|
886 | |||
887 | $ hg debugwireproto --localssh --peer raw << EOF |
|
887 | $ hg debugwireproto --localssh --peer raw << EOF | |
888 | > raw |
|
888 | > raw | |
889 | > heads\n |
|
889 | > heads\n | |
890 | > readline |
|
890 | > readline | |
891 | > raw |
|
891 | > raw | |
892 | > hello\n |
|
892 | > hello\n | |
893 | > readline |
|
893 | > readline | |
894 | > readline |
|
894 | > readline | |
895 | > EOF |
|
895 | > EOF | |
896 | using raw connection to peer |
|
896 | using raw connection to peer | |
897 | i> write(6) -> 6: |
|
897 | i> write(6) -> 6: | |
898 | i> heads\n |
|
898 | i> heads\n | |
899 | o> readline() -> 3: |
|
899 | o> readline() -> 3: | |
900 | o> 41\n |
|
900 | o> 41\n | |
901 | i> write(6) -> 6: |
|
901 | i> write(6) -> 6: | |
902 | i> hello\n |
|
902 | i> hello\n | |
903 | o> readline() -> 41: |
|
903 | o> readline() -> 41: | |
904 | o> 68986213bd4485ea51533535e3fc9e78007a711f\n |
|
904 | o> 68986213bd4485ea51533535e3fc9e78007a711f\n | |
905 | o> readline() -> 4: |
|
905 | o> readline() -> 4: | |
906 | o> 403\n |
|
906 | o> 403\n | |
907 |
|
907 | |||
908 | Send an upgrade request to a server that doesn't support that command |
|
908 | Send an upgrade request to a server that doesn't support that command | |
909 |
|
909 | |||
910 | $ hg debugwireproto --localssh --peer raw << EOF |
|
910 | $ hg debugwireproto --localssh --peer raw << EOF | |
911 | > raw |
|
911 | > raw | |
912 | > upgrade 2e82ab3f-9ce3-4b4e-8f8c-6fd1c0e9e23a proto=irrelevant1%2Cirrelevant2\n |
|
912 | > upgrade 2e82ab3f-9ce3-4b4e-8f8c-6fd1c0e9e23a proto=irrelevant1%2Cirrelevant2\n | |
913 | > readline |
|
913 | > readline | |
914 | > raw |
|
914 | > raw | |
915 | > hello\n |
|
915 | > hello\n | |
916 | > between\n |
|
916 | > between\n | |
917 | > pairs 81\n |
|
917 | > pairs 81\n | |
918 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
918 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
919 | > readline |
|
919 | > readline | |
920 | > readline |
|
920 | > readline | |
921 | > readline |
|
921 | > readline | |
922 | > readline |
|
922 | > readline | |
923 | > EOF |
|
923 | > EOF | |
924 | using raw connection to peer |
|
924 | using raw connection to peer | |
925 | i> write(77) -> 77: |
|
925 | i> write(77) -> 77: | |
926 | i> upgrade 2e82ab3f-9ce3-4b4e-8f8c-6fd1c0e9e23a proto=irrelevant1%2Cirrelevant2\n |
|
926 | i> upgrade 2e82ab3f-9ce3-4b4e-8f8c-6fd1c0e9e23a proto=irrelevant1%2Cirrelevant2\n | |
927 | o> readline() -> 2: |
|
927 | o> readline() -> 2: | |
928 | o> 0\n |
|
928 | o> 0\n | |
929 | i> write(104) -> 104: |
|
929 | i> write(104) -> 104: | |
930 | i> hello\n |
|
930 | i> hello\n | |
931 | i> between\n |
|
931 | i> between\n | |
932 | i> pairs 81\n |
|
932 | i> pairs 81\n | |
933 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
933 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
934 | o> readline() -> 4: |
|
934 | o> readline() -> 4: | |
935 | o> 403\n |
|
935 | o> 403\n | |
936 | o> readline() -> 403: |
|
936 | o> readline() -> 403: | |
937 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n |
|
937 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n | |
938 | o> readline() -> 2: |
|
938 | o> readline() -> 2: | |
939 | o> 1\n |
|
939 | o> 1\n | |
940 | o> readline() -> 1: |
|
940 | o> readline() -> 1: | |
941 | o> \n |
|
941 | o> \n | |
942 |
|
942 | |||
943 | $ cd .. |
|
943 | $ cd .. | |
944 |
|
944 | |||
945 | $ hg --config experimental.sshpeer.advertise-v2=true --debug debugpeer ssh://user@dummy/server |
|
945 | $ hg --config experimental.sshpeer.advertise-v2=true --debug debugpeer ssh://user@dummy/server | |
946 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) |
|
946 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) | |
947 | running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !) |
|
947 | running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !) | |
948 | sending upgrade request: * proto=exp-ssh-v2-0001 (glob) |
|
948 | sending upgrade request: * proto=exp-ssh-v2-0001 (glob) | |
949 | devel-peer-request: hello |
|
949 | devel-peer-request: hello | |
950 | sending hello command |
|
950 | sending hello command | |
951 | devel-peer-request: between |
|
951 | devel-peer-request: between | |
952 | devel-peer-request: pairs: 81 bytes |
|
952 | devel-peer-request: pairs: 81 bytes | |
953 | sending between command |
|
953 | sending between command | |
954 | remote: 0 |
|
954 | remote: 0 | |
955 | remote: 403 |
|
955 | remote: 403 | |
956 | remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch |
|
956 | remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch | |
957 | remote: 1 |
|
957 | remote: 1 | |
958 | url: ssh://user@dummy/server |
|
958 | url: ssh://user@dummy/server | |
959 | local: no |
|
959 | local: no | |
960 | pushable: yes |
|
960 | pushable: yes | |
961 |
|
961 | |||
962 | Enable version 2 support on server. We need to do this in hgrc because we can't |
|
962 | Enable version 2 support on server. We need to do this in hgrc because we can't | |
963 | use --config with `hg serve --stdio`. |
|
963 | use --config with `hg serve --stdio`. | |
964 |
|
964 | |||
965 | $ cat >> server/.hg/hgrc << EOF |
|
965 | $ cat >> server/.hg/hgrc << EOF | |
966 | > [experimental] |
|
966 | > [experimental] | |
967 | > sshserver.support-v2 = true |
|
967 | > sshserver.support-v2 = true | |
968 | > EOF |
|
968 | > EOF | |
969 |
|
969 | |||
970 | Send an upgrade request to a server that supports upgrade |
|
970 | Send an upgrade request to a server that supports upgrade | |
971 |
|
971 | |||
972 | $ cd server |
|
972 | $ cd server | |
973 |
|
973 | |||
974 | $ hg debugwireproto --localssh --peer raw << EOF |
|
974 | $ hg debugwireproto --localssh --peer raw << EOF | |
975 | > raw |
|
975 | > raw | |
976 | > upgrade this-is-some-token proto=exp-ssh-v2-0001\n |
|
976 | > upgrade this-is-some-token proto=exp-ssh-v2-0001\n | |
977 | > hello\n |
|
977 | > hello\n | |
978 | > between\n |
|
978 | > between\n | |
979 | > pairs 81\n |
|
979 | > pairs 81\n | |
980 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
980 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
981 | > readline |
|
981 | > readline | |
982 | > readline |
|
982 | > readline | |
983 | > readline |
|
983 | > readline | |
984 | > EOF |
|
984 | > EOF | |
985 | using raw connection to peer |
|
985 | using raw connection to peer | |
986 | i> write(153) -> 153: |
|
986 | i> write(153) -> 153: | |
987 | i> upgrade this-is-some-token proto=exp-ssh-v2-0001\n |
|
987 | i> upgrade this-is-some-token proto=exp-ssh-v2-0001\n | |
988 | i> hello\n |
|
988 | i> hello\n | |
989 | i> between\n |
|
989 | i> between\n | |
990 | i> pairs 81\n |
|
990 | i> pairs 81\n | |
991 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
991 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
992 | o> readline() -> 44: |
|
992 | o> readline() -> 44: | |
993 | o> upgraded this-is-some-token exp-ssh-v2-0001\n |
|
993 | o> upgraded this-is-some-token exp-ssh-v2-0001\n | |
994 | o> readline() -> 4: |
|
994 | o> readline() -> 4: | |
995 | o> 402\n |
|
995 | o> 402\n | |
996 | o> readline() -> 403: |
|
996 | o> readline() -> 403: | |
997 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n |
|
997 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n | |
998 |
|
998 | |||
999 | $ cd .. |
|
999 | $ cd .. | |
1000 |
|
1000 | |||
1001 | $ hg --config experimental.sshpeer.advertise-v2=true --debug debugpeer ssh://user@dummy/server |
|
1001 | $ hg --config experimental.sshpeer.advertise-v2=true --debug debugpeer ssh://user@dummy/server | |
1002 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) |
|
1002 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) | |
1003 | running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !) |
|
1003 | running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !) | |
1004 | sending upgrade request: * proto=exp-ssh-v2-0001 (glob) |
|
1004 | sending upgrade request: * proto=exp-ssh-v2-0001 (glob) | |
1005 | devel-peer-request: hello |
|
1005 | devel-peer-request: hello | |
1006 | sending hello command |
|
1006 | sending hello command | |
1007 | devel-peer-request: between |
|
1007 | devel-peer-request: between | |
1008 | devel-peer-request: pairs: 81 bytes |
|
1008 | devel-peer-request: pairs: 81 bytes | |
1009 | sending between command |
|
1009 | sending between command | |
1010 | protocol upgraded to exp-ssh-v2-0001 |
|
1010 | protocol upgraded to exp-ssh-v2-0001 | |
1011 | remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch |
|
1011 | remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch | |
1012 | url: ssh://user@dummy/server |
|
1012 | url: ssh://user@dummy/server | |
1013 | local: no |
|
1013 | local: no | |
1014 | pushable: yes |
|
1014 | pushable: yes | |
1015 |
|
1015 | |||
1016 | Verify the peer has capabilities |
|
1016 | Verify the peer has capabilities | |
1017 |
|
1017 | |||
1018 | $ hg --config experimental.sshpeer.advertise-v2=true --debug debugcapabilities ssh://user@dummy/server |
|
1018 | $ hg --config experimental.sshpeer.advertise-v2=true --debug debugcapabilities ssh://user@dummy/server | |
1019 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) |
|
1019 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) | |
1020 | running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !) |
|
1020 | running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !) | |
1021 | sending upgrade request: * proto=exp-ssh-v2-0001 (glob) |
|
1021 | sending upgrade request: * proto=exp-ssh-v2-0001 (glob) | |
1022 | devel-peer-request: hello |
|
1022 | devel-peer-request: hello | |
1023 | sending hello command |
|
1023 | sending hello command | |
1024 | devel-peer-request: between |
|
1024 | devel-peer-request: between | |
1025 | devel-peer-request: pairs: 81 bytes |
|
1025 | devel-peer-request: pairs: 81 bytes | |
1026 | sending between command |
|
1026 | sending between command | |
1027 | protocol upgraded to exp-ssh-v2-0001 |
|
1027 | protocol upgraded to exp-ssh-v2-0001 | |
1028 | remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch |
|
1028 | remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch | |
1029 | Main capabilities: |
|
1029 | Main capabilities: | |
1030 | batch |
|
1030 | batch | |
1031 | branchmap |
|
1031 | branchmap | |
1032 | $USUAL_BUNDLE2_CAPS_SERVER$ |
|
1032 | $USUAL_BUNDLE2_CAPS_SERVER$ | |
1033 | changegroupsubset |
|
1033 | changegroupsubset | |
1034 | getbundle |
|
1034 | getbundle | |
1035 | known |
|
1035 | known | |
1036 | lookup |
|
1036 | lookup | |
1037 | pushkey |
|
1037 | pushkey | |
1038 | streamreqs=generaldelta,revlogv1 |
|
1038 | streamreqs=generaldelta,revlogv1 | |
1039 | unbundle=HG10GZ,HG10BZ,HG10UN |
|
1039 | unbundle=HG10GZ,HG10BZ,HG10UN | |
1040 | unbundlehash |
|
1040 | unbundlehash | |
1041 | Bundle2 capabilities: |
|
1041 | Bundle2 capabilities: | |
1042 | HG20 |
|
1042 | HG20 | |
1043 | bookmarks |
|
1043 | bookmarks | |
1044 | changegroup |
|
1044 | changegroup | |
1045 | 01 |
|
1045 | 01 | |
1046 | 02 |
|
1046 | 02 | |
1047 | digests |
|
1047 | digests | |
1048 | md5 |
|
1048 | md5 | |
1049 | sha1 |
|
1049 | sha1 | |
1050 | sha512 |
|
1050 | sha512 | |
1051 | error |
|
1051 | error | |
1052 | abort |
|
1052 | abort | |
1053 | unsupportedcontent |
|
1053 | unsupportedcontent | |
1054 | pushraced |
|
1054 | pushraced | |
1055 | pushkey |
|
1055 | pushkey | |
1056 | hgtagsfnodes |
|
1056 | hgtagsfnodes | |
1057 | listkeys |
|
1057 | listkeys | |
1058 | phases |
|
1058 | phases | |
1059 | heads |
|
1059 | heads | |
1060 | pushkey |
|
1060 | pushkey | |
1061 | remote-changegroup |
|
1061 | remote-changegroup | |
1062 | http |
|
1062 | http | |
1063 | https |
|
1063 | https | |
1064 | rev-branch-cache |
|
1064 | rev-branch-cache | |
1065 |
|
1065 | |||
1066 | Command after upgrade to version 2 is processed |
|
1066 | Command after upgrade to version 2 is processed | |
1067 |
|
1067 | |||
1068 | $ cd server |
|
1068 | $ cd server | |
1069 |
|
1069 | |||
1070 | $ hg debugwireproto --localssh --peer raw << EOF |
|
1070 | $ hg debugwireproto --localssh --peer raw << EOF | |
1071 | > raw |
|
1071 | > raw | |
1072 | > upgrade this-is-some-token proto=exp-ssh-v2-0001\n |
|
1072 | > upgrade this-is-some-token proto=exp-ssh-v2-0001\n | |
1073 | > hello\n |
|
1073 | > hello\n | |
1074 | > between\n |
|
1074 | > between\n | |
1075 | > pairs 81\n |
|
1075 | > pairs 81\n | |
1076 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1076 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1077 | > readline |
|
1077 | > readline | |
1078 | > readline |
|
1078 | > readline | |
1079 | > readline |
|
1079 | > readline | |
1080 | > raw |
|
1080 | > raw | |
1081 | > hello\n |
|
1081 | > hello\n | |
1082 | > readline |
|
1082 | > readline | |
1083 | > readline |
|
1083 | > readline | |
1084 | > EOF |
|
1084 | > EOF | |
1085 | using raw connection to peer |
|
1085 | using raw connection to peer | |
1086 | i> write(153) -> 153: |
|
1086 | i> write(153) -> 153: | |
1087 | i> upgrade this-is-some-token proto=exp-ssh-v2-0001\n |
|
1087 | i> upgrade this-is-some-token proto=exp-ssh-v2-0001\n | |
1088 | i> hello\n |
|
1088 | i> hello\n | |
1089 | i> between\n |
|
1089 | i> between\n | |
1090 | i> pairs 81\n |
|
1090 | i> pairs 81\n | |
1091 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1091 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1092 | o> readline() -> 44: |
|
1092 | o> readline() -> 44: | |
1093 | o> upgraded this-is-some-token exp-ssh-v2-0001\n |
|
1093 | o> upgraded this-is-some-token exp-ssh-v2-0001\n | |
1094 | o> readline() -> 4: |
|
1094 | o> readline() -> 4: | |
1095 | o> 402\n |
|
1095 | o> 402\n | |
1096 | o> readline() -> 403: |
|
1096 | o> readline() -> 403: | |
1097 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n |
|
1097 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n | |
1098 | i> write(6) -> 6: |
|
1098 | i> write(6) -> 6: | |
1099 | i> hello\n |
|
1099 | i> hello\n | |
1100 | o> readline() -> 4: |
|
1100 | o> readline() -> 4: | |
1101 | o> 403\n |
|
1101 | o> 403\n | |
1102 | o> readline() -> 403: |
|
1102 | o> readline() -> 403: | |
1103 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n |
|
1103 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n | |
1104 |
|
1104 | |||
1105 | Multiple upgrades is not allowed |
|
1105 | Multiple upgrades is not allowed | |
1106 |
|
1106 | |||
1107 | $ hg debugwireproto --localssh --peer raw << EOF |
|
1107 | $ hg debugwireproto --localssh --peer raw << EOF | |
1108 | > raw |
|
1108 | > raw | |
1109 | > upgrade this-is-some-token proto=exp-ssh-v2-0001\n |
|
1109 | > upgrade this-is-some-token proto=exp-ssh-v2-0001\n | |
1110 | > hello\n |
|
1110 | > hello\n | |
1111 | > between\n |
|
1111 | > between\n | |
1112 | > pairs 81\n |
|
1112 | > pairs 81\n | |
1113 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1113 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1114 | > readline |
|
1114 | > readline | |
1115 | > readline |
|
1115 | > readline | |
1116 | > readline |
|
1116 | > readline | |
1117 | > raw |
|
1117 | > raw | |
1118 | > upgrade another-token proto=irrelevant\n |
|
1118 | > upgrade another-token proto=irrelevant\n | |
1119 | > hello\n |
|
1119 | > hello\n | |
1120 | > readline |
|
1120 | > readline | |
1121 | > readavailable |
|
1121 | > readavailable | |
1122 | > EOF |
|
1122 | > EOF | |
1123 | using raw connection to peer |
|
1123 | using raw connection to peer | |
1124 | i> write(153) -> 153: |
|
1124 | i> write(153) -> 153: | |
1125 | i> upgrade this-is-some-token proto=exp-ssh-v2-0001\n |
|
1125 | i> upgrade this-is-some-token proto=exp-ssh-v2-0001\n | |
1126 | i> hello\n |
|
1126 | i> hello\n | |
1127 | i> between\n |
|
1127 | i> between\n | |
1128 | i> pairs 81\n |
|
1128 | i> pairs 81\n | |
1129 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1129 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1130 | o> readline() -> 44: |
|
1130 | o> readline() -> 44: | |
1131 | o> upgraded this-is-some-token exp-ssh-v2-0001\n |
|
1131 | o> upgraded this-is-some-token exp-ssh-v2-0001\n | |
1132 | o> readline() -> 4: |
|
1132 | o> readline() -> 4: | |
1133 | o> 402\n |
|
1133 | o> 402\n | |
1134 | o> readline() -> 403: |
|
1134 | o> readline() -> 403: | |
1135 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n |
|
1135 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n | |
1136 | i> write(45) -> 45: |
|
1136 | i> write(45) -> 45: | |
1137 | i> upgrade another-token proto=irrelevant\n |
|
1137 | i> upgrade another-token proto=irrelevant\n | |
1138 | i> hello\n |
|
1138 | i> hello\n | |
1139 | o> readline() -> 1: |
|
1139 | o> readline() -> 1: | |
1140 | o> \n |
|
1140 | o> \n | |
1141 | o> read(-1) -> 0: |
|
1141 | o> read(-1) -> 0: | |
1142 | e> read(-1) -> 42: |
|
1142 | e> read(-1) -> 42: | |
1143 | e> cannot upgrade protocols multiple times\n |
|
1143 | e> cannot upgrade protocols multiple times\n | |
1144 | e> -\n |
|
1144 | e> -\n | |
1145 |
|
1145 | |||
1146 | Malformed upgrade request line (not exactly 3 space delimited tokens) |
|
1146 | Malformed upgrade request line (not exactly 3 space delimited tokens) | |
1147 |
|
1147 | |||
1148 | $ hg debugwireproto --localssh --peer raw << EOF |
|
1148 | $ hg debugwireproto --localssh --peer raw << EOF | |
1149 | > raw |
|
1149 | > raw | |
1150 | > upgrade\n |
|
1150 | > upgrade\n | |
1151 | > readline |
|
1151 | > readline | |
1152 | > EOF |
|
1152 | > EOF | |
1153 | using raw connection to peer |
|
1153 | using raw connection to peer | |
1154 | i> write(8) -> 8: |
|
1154 | i> write(8) -> 8: | |
1155 | i> upgrade\n |
|
1155 | i> upgrade\n | |
1156 | o> readline() -> 2: |
|
1156 | o> readline() -> 2: | |
1157 | o> 0\n |
|
1157 | o> 0\n | |
1158 |
|
1158 | |||
1159 | $ hg debugwireproto --localssh --peer raw << EOF |
|
1159 | $ hg debugwireproto --localssh --peer raw << EOF | |
1160 | > raw |
|
1160 | > raw | |
1161 | > upgrade token\n |
|
1161 | > upgrade token\n | |
1162 | > readline |
|
1162 | > readline | |
1163 | > EOF |
|
1163 | > EOF | |
1164 | using raw connection to peer |
|
1164 | using raw connection to peer | |
1165 | i> write(14) -> 14: |
|
1165 | i> write(14) -> 14: | |
1166 | i> upgrade token\n |
|
1166 | i> upgrade token\n | |
1167 | o> readline() -> 2: |
|
1167 | o> readline() -> 2: | |
1168 | o> 0\n |
|
1168 | o> 0\n | |
1169 |
|
1169 | |||
1170 | $ hg debugwireproto --localssh --peer raw << EOF |
|
1170 | $ hg debugwireproto --localssh --peer raw << EOF | |
1171 | > raw |
|
1171 | > raw | |
1172 | > upgrade token foo=bar extra-token\n |
|
1172 | > upgrade token foo=bar extra-token\n | |
1173 | > readline |
|
1173 | > readline | |
1174 | > EOF |
|
1174 | > EOF | |
1175 | using raw connection to peer |
|
1175 | using raw connection to peer | |
1176 | i> write(34) -> 34: |
|
1176 | i> write(34) -> 34: | |
1177 | i> upgrade token foo=bar extra-token\n |
|
1177 | i> upgrade token foo=bar extra-token\n | |
1178 | o> readline() -> 2: |
|
1178 | o> readline() -> 2: | |
1179 | o> 0\n |
|
1179 | o> 0\n | |
1180 |
|
1180 | |||
1181 | Upgrade request to unsupported protocol is ignored |
|
1181 | Upgrade request to unsupported protocol is ignored | |
1182 |
|
1182 | |||
1183 | $ hg debugwireproto --localssh --peer raw << EOF |
|
1183 | $ hg debugwireproto --localssh --peer raw << EOF | |
1184 | > raw |
|
1184 | > raw | |
1185 | > upgrade this-is-some-token proto=unknown1,unknown2\n |
|
1185 | > upgrade this-is-some-token proto=unknown1,unknown2\n | |
1186 | > readline |
|
1186 | > readline | |
1187 | > raw |
|
1187 | > raw | |
1188 | > hello\n |
|
1188 | > hello\n | |
1189 | > readline |
|
1189 | > readline | |
1190 | > readline |
|
1190 | > readline | |
1191 | > raw |
|
1191 | > raw | |
1192 | > between\n |
|
1192 | > between\n | |
1193 | > pairs 81\n |
|
1193 | > pairs 81\n | |
1194 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1194 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1195 | > readline |
|
1195 | > readline | |
1196 | > readline |
|
1196 | > readline | |
1197 | > EOF |
|
1197 | > EOF | |
1198 | using raw connection to peer |
|
1198 | using raw connection to peer | |
1199 | i> write(51) -> 51: |
|
1199 | i> write(51) -> 51: | |
1200 | i> upgrade this-is-some-token proto=unknown1,unknown2\n |
|
1200 | i> upgrade this-is-some-token proto=unknown1,unknown2\n | |
1201 | o> readline() -> 2: |
|
1201 | o> readline() -> 2: | |
1202 | o> 0\n |
|
1202 | o> 0\n | |
1203 | i> write(6) -> 6: |
|
1203 | i> write(6) -> 6: | |
1204 | i> hello\n |
|
1204 | i> hello\n | |
1205 | o> readline() -> 4: |
|
1205 | o> readline() -> 4: | |
1206 | o> 403\n |
|
1206 | o> 403\n | |
1207 | o> readline() -> 403: |
|
1207 | o> readline() -> 403: | |
1208 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n |
|
1208 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n | |
1209 | i> write(98) -> 98: |
|
1209 | i> write(98) -> 98: | |
1210 | i> between\n |
|
1210 | i> between\n | |
1211 | i> pairs 81\n |
|
1211 | i> pairs 81\n | |
1212 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1212 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1213 | o> readline() -> 2: |
|
1213 | o> readline() -> 2: | |
1214 | o> 1\n |
|
1214 | o> 1\n | |
1215 | o> readline() -> 1: |
|
1215 | o> readline() -> 1: | |
1216 | o> \n |
|
1216 | o> \n | |
1217 |
|
1217 | |||
1218 | Upgrade request must be followed by hello + between |
|
1218 | Upgrade request must be followed by hello + between | |
1219 |
|
1219 | |||
1220 | $ hg debugwireproto --localssh --peer raw << EOF |
|
1220 | $ hg debugwireproto --localssh --peer raw << EOF | |
1221 | > raw |
|
1221 | > raw | |
1222 | > upgrade token proto=exp-ssh-v2-0001\n |
|
1222 | > upgrade token proto=exp-ssh-v2-0001\n | |
1223 | > invalid\n |
|
1223 | > invalid\n | |
1224 | > readline |
|
1224 | > readline | |
1225 | > readavailable |
|
1225 | > readavailable | |
1226 | > EOF |
|
1226 | > EOF | |
1227 | using raw connection to peer |
|
1227 | using raw connection to peer | |
1228 | i> write(44) -> 44: |
|
1228 | i> write(44) -> 44: | |
1229 | i> upgrade token proto=exp-ssh-v2-0001\n |
|
1229 | i> upgrade token proto=exp-ssh-v2-0001\n | |
1230 | i> invalid\n |
|
1230 | i> invalid\n | |
1231 | o> readline() -> 1: |
|
1231 | o> readline() -> 1: | |
1232 | o> \n |
|
1232 | o> \n | |
1233 | o> read(-1) -> 0: |
|
1233 | o> read(-1) -> 0: | |
1234 | e> read(-1) -> 46: |
|
1234 | e> read(-1) -> 46: | |
1235 | e> malformed handshake protocol: missing hello\n |
|
1235 | e> malformed handshake protocol: missing hello\n | |
1236 | e> -\n |
|
1236 | e> -\n | |
1237 |
|
1237 | |||
1238 | $ hg debugwireproto --localssh --peer raw << EOF |
|
1238 | $ hg debugwireproto --localssh --peer raw << EOF | |
1239 | > raw |
|
1239 | > raw | |
1240 | > upgrade token proto=exp-ssh-v2-0001\n |
|
1240 | > upgrade token proto=exp-ssh-v2-0001\n | |
1241 | > hello\n |
|
1241 | > hello\n | |
1242 | > invalid\n |
|
1242 | > invalid\n | |
1243 | > readline |
|
1243 | > readline | |
1244 | > readavailable |
|
1244 | > readavailable | |
1245 | > EOF |
|
1245 | > EOF | |
1246 | using raw connection to peer |
|
1246 | using raw connection to peer | |
1247 | i> write(50) -> 50: |
|
1247 | i> write(50) -> 50: | |
1248 | i> upgrade token proto=exp-ssh-v2-0001\n |
|
1248 | i> upgrade token proto=exp-ssh-v2-0001\n | |
1249 | i> hello\n |
|
1249 | i> hello\n | |
1250 | i> invalid\n |
|
1250 | i> invalid\n | |
1251 | o> readline() -> 1: |
|
1251 | o> readline() -> 1: | |
1252 | o> \n |
|
1252 | o> \n | |
1253 | o> read(-1) -> 0: |
|
1253 | o> read(-1) -> 0: | |
1254 | e> read(-1) -> 48: |
|
1254 | e> read(-1) -> 48: | |
1255 | e> malformed handshake protocol: missing between\n |
|
1255 | e> malformed handshake protocol: missing between\n | |
1256 | e> -\n |
|
1256 | e> -\n | |
1257 |
|
1257 | |||
1258 | $ hg debugwireproto --localssh --peer raw << EOF |
|
1258 | $ hg debugwireproto --localssh --peer raw << EOF | |
1259 | > raw |
|
1259 | > raw | |
1260 | > upgrade token proto=exp-ssh-v2-0001\n |
|
1260 | > upgrade token proto=exp-ssh-v2-0001\n | |
1261 | > hello\n |
|
1261 | > hello\n | |
1262 | > between\n |
|
1262 | > between\n | |
1263 | > invalid\n |
|
1263 | > invalid\n | |
1264 | > readline |
|
1264 | > readline | |
1265 | > readavailable |
|
1265 | > readavailable | |
1266 | > EOF |
|
1266 | > EOF | |
1267 | using raw connection to peer |
|
1267 | using raw connection to peer | |
1268 | i> write(58) -> 58: |
|
1268 | i> write(58) -> 58: | |
1269 | i> upgrade token proto=exp-ssh-v2-0001\n |
|
1269 | i> upgrade token proto=exp-ssh-v2-0001\n | |
1270 | i> hello\n |
|
1270 | i> hello\n | |
1271 | i> between\n |
|
1271 | i> between\n | |
1272 | i> invalid\n |
|
1272 | i> invalid\n | |
1273 | o> readline() -> 1: |
|
1273 | o> readline() -> 1: | |
1274 | o> \n |
|
1274 | o> \n | |
1275 | o> read(-1) -> 0: |
|
1275 | o> read(-1) -> 0: | |
1276 | e> read(-1) -> 49: |
|
1276 | e> read(-1) -> 49: | |
1277 | e> malformed handshake protocol: missing pairs 81\n |
|
1277 | e> malformed handshake protocol: missing pairs 81\n | |
1278 | e> -\n |
|
1278 | e> -\n | |
1279 |
|
1279 | |||
1280 | Legacy commands are not exposed to version 2 of protocol |
|
1280 | Legacy commands are not exposed to version 2 of protocol | |
1281 |
|
1281 | |||
1282 | TODO re-enable these once we're back to actually using v2 commands |
|
1282 | TODO re-enable these once we're back to actually using v2 commands | |
1283 |
|
1283 | |||
1284 | $ hg --config experimental.sshpeer.advertise-v2=true debugwireproto --localssh << EOF |
|
1284 | $ hg --config experimental.sshpeer.advertise-v2=true debugwireproto --localssh << EOF | |
1285 | > command branches |
|
1285 | > command branches | |
1286 | > nodes 0000000000000000000000000000000000000000 |
|
1286 | > nodes 0000000000000000000000000000000000000000 | |
1287 | > EOF |
|
1287 | > EOF | |
1288 | creating ssh peer from handshake results |
|
1288 | creating ssh peer from handshake results | |
1289 | sending branches command |
|
1289 | sending branches command | |
1290 | response: |
|
1290 | response: | |
1291 |
|
1291 | |||
1292 | $ hg --config experimental.sshpeer.advertise-v2=true debugwireproto --localssh << EOF |
|
1292 | $ hg --config experimental.sshpeer.advertise-v2=true debugwireproto --localssh << EOF | |
1293 | > command changegroup |
|
1293 | > command changegroup | |
1294 | > roots 0000000000000000000000000000000000000000 |
|
1294 | > roots 0000000000000000000000000000000000000000 | |
1295 | > EOF |
|
1295 | > EOF | |
1296 | creating ssh peer from handshake results |
|
1296 | creating ssh peer from handshake results | |
1297 | sending changegroup command |
|
1297 | sending changegroup command | |
1298 | response: |
|
1298 | response: | |
1299 |
|
1299 | |||
1300 | $ hg --config experimental.sshpeer.advertise-v2=true debugwireproto --localssh << EOF |
|
1300 | $ hg --config experimental.sshpeer.advertise-v2=true debugwireproto --localssh << EOF | |
1301 | > command changegroupsubset |
|
1301 | > command changegroupsubset | |
1302 | > bases 0000000000000000000000000000000000000000 |
|
1302 | > bases 0000000000000000000000000000000000000000 | |
1303 | > heads 0000000000000000000000000000000000000000 |
|
1303 | > heads 0000000000000000000000000000000000000000 | |
1304 | > EOF |
|
1304 | > EOF | |
1305 | creating ssh peer from handshake results |
|
1305 | creating ssh peer from handshake results | |
1306 | sending changegroupsubset command |
|
1306 | sending changegroupsubset command | |
1307 | response: |
|
1307 | response: | |
1308 |
|
1308 | |||
1309 | $ cd .. |
|
1309 | $ cd .. | |
1310 |
|
1310 | |||
1311 | Test listkeys for listing namespaces |
|
1311 | Test listkeys for listing namespaces | |
1312 |
|
1312 | |||
1313 | $ hg init empty |
|
1313 | $ hg init empty | |
1314 | $ cd empty |
|
1314 | $ cd empty | |
1315 | $ debugwireproto << EOF |
|
1315 | $ debugwireproto << EOF | |
1316 | > command listkeys |
|
1316 | > command listkeys | |
1317 | > namespace namespaces |
|
1317 | > namespace namespaces | |
1318 | > EOF |
|
1318 | > EOF | |
1319 | testing ssh1 |
|
1319 | testing ssh1 | |
1320 | creating ssh peer from handshake results |
|
1320 | creating ssh peer from handshake results | |
1321 | i> write(104) -> 104: |
|
1321 | i> write(104) -> 104: | |
1322 | i> hello\n |
|
1322 | i> hello\n | |
1323 | i> between\n |
|
1323 | i> between\n | |
1324 | i> pairs 81\n |
|
1324 | i> pairs 81\n | |
1325 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1325 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1326 | i> flush() -> None |
|
1326 | i> flush() -> None | |
1327 | o> readline() -> 4: |
|
1327 | o> readline() -> 4: | |
1328 | o> 403\n |
|
1328 | o> 403\n | |
1329 | o> readline() -> 403: |
|
1329 | o> readline() -> 403: | |
1330 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n |
|
1330 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n | |
1331 | o> readline() -> 2: |
|
1331 | o> readline() -> 2: | |
1332 | o> 1\n |
|
1332 | o> 1\n | |
1333 | o> readline() -> 1: |
|
1333 | o> readline() -> 1: | |
1334 | o> \n |
|
1334 | o> \n | |
1335 | sending listkeys command |
|
1335 | sending listkeys command | |
1336 | i> write(9) -> 9: |
|
1336 | i> write(9) -> 9: | |
1337 | i> listkeys\n |
|
1337 | i> listkeys\n | |
1338 | i> write(13) -> 13: |
|
1338 | i> write(13) -> 13: | |
1339 | i> namespace 10\n |
|
1339 | i> namespace 10\n | |
1340 | i> write(10) -> 10: namespaces |
|
1340 | i> write(10) -> 10: namespaces | |
1341 | i> flush() -> None |
|
1341 | i> flush() -> None | |
1342 | o> bufferedreadline() -> 3: |
|
1342 | o> bufferedreadline() -> 3: | |
1343 | o> 30\n |
|
1343 | o> 30\n | |
1344 | o> bufferedread(30) -> 30: |
|
1344 | o> bufferedread(30) -> 30: | |
1345 | o> bookmarks \n |
|
1345 | o> bookmarks \n | |
1346 | o> namespaces \n |
|
1346 | o> namespaces \n | |
1347 | o> phases |
|
1347 | o> phases | |
1348 | response: bookmarks \nnamespaces \nphases |
|
1348 | response: b'bookmarks \nnamespaces \nphases ' | |
1349 |
|
1349 | |||
1350 | testing ssh2 |
|
1350 | testing ssh2 | |
1351 | creating ssh peer from handshake results |
|
1351 | creating ssh peer from handshake results | |
1352 | i> write(171) -> 171: |
|
1352 | i> write(171) -> 171: | |
1353 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
1353 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) | |
1354 | i> hello\n |
|
1354 | i> hello\n | |
1355 | i> between\n |
|
1355 | i> between\n | |
1356 | i> pairs 81\n |
|
1356 | i> pairs 81\n | |
1357 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1357 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1358 | i> flush() -> None |
|
1358 | i> flush() -> None | |
1359 | o> readline() -> 62: |
|
1359 | o> readline() -> 62: | |
1360 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
1360 | o> upgraded * exp-ssh-v2-0001\n (glob) | |
1361 | o> readline() -> 4: |
|
1361 | o> readline() -> 4: | |
1362 | o> 402\n |
|
1362 | o> 402\n | |
1363 | o> read(402) -> 402: capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch |
|
1363 | o> read(402) -> 402: capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch | |
1364 | o> read(1) -> 1: |
|
1364 | o> read(1) -> 1: | |
1365 | o> \n |
|
1365 | o> \n | |
1366 | sending listkeys command |
|
1366 | sending listkeys command | |
1367 | i> write(9) -> 9: |
|
1367 | i> write(9) -> 9: | |
1368 | i> listkeys\n |
|
1368 | i> listkeys\n | |
1369 | i> write(13) -> 13: |
|
1369 | i> write(13) -> 13: | |
1370 | i> namespace 10\n |
|
1370 | i> namespace 10\n | |
1371 | i> write(10) -> 10: namespaces |
|
1371 | i> write(10) -> 10: namespaces | |
1372 | i> flush() -> None |
|
1372 | i> flush() -> None | |
1373 | o> bufferedreadline() -> 3: |
|
1373 | o> bufferedreadline() -> 3: | |
1374 | o> 30\n |
|
1374 | o> 30\n | |
1375 | o> bufferedread(30) -> 30: |
|
1375 | o> bufferedread(30) -> 30: | |
1376 | o> bookmarks \n |
|
1376 | o> bookmarks \n | |
1377 | o> namespaces \n |
|
1377 | o> namespaces \n | |
1378 | o> phases |
|
1378 | o> phases | |
1379 | response: bookmarks \nnamespaces \nphases |
|
1379 | response: b'bookmarks \nnamespaces \nphases ' | |
1380 |
|
1380 | |||
1381 | $ cd .. |
|
1381 | $ cd .. | |
1382 |
|
1382 | |||
1383 | Test listkeys for bookmarks |
|
1383 | Test listkeys for bookmarks | |
1384 |
|
1384 | |||
1385 | $ hg init bookmarkrepo |
|
1385 | $ hg init bookmarkrepo | |
1386 | $ cd bookmarkrepo |
|
1386 | $ cd bookmarkrepo | |
1387 | $ echo 0 > foo |
|
1387 | $ echo 0 > foo | |
1388 | $ hg add foo |
|
1388 | $ hg add foo | |
1389 | $ hg -q commit -m initial |
|
1389 | $ hg -q commit -m initial | |
1390 | $ echo 1 > foo |
|
1390 | $ echo 1 > foo | |
1391 | $ hg commit -m second |
|
1391 | $ hg commit -m second | |
1392 |
|
1392 | |||
1393 | With no bookmarks set |
|
1393 | With no bookmarks set | |
1394 |
|
1394 | |||
1395 | $ debugwireproto << EOF |
|
1395 | $ debugwireproto << EOF | |
1396 | > command listkeys |
|
1396 | > command listkeys | |
1397 | > namespace bookmarks |
|
1397 | > namespace bookmarks | |
1398 | > EOF |
|
1398 | > EOF | |
1399 | testing ssh1 |
|
1399 | testing ssh1 | |
1400 | creating ssh peer from handshake results |
|
1400 | creating ssh peer from handshake results | |
1401 | i> write(104) -> 104: |
|
1401 | i> write(104) -> 104: | |
1402 | i> hello\n |
|
1402 | i> hello\n | |
1403 | i> between\n |
|
1403 | i> between\n | |
1404 | i> pairs 81\n |
|
1404 | i> pairs 81\n | |
1405 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1405 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1406 | i> flush() -> None |
|
1406 | i> flush() -> None | |
1407 | o> readline() -> 4: |
|
1407 | o> readline() -> 4: | |
1408 | o> 403\n |
|
1408 | o> 403\n | |
1409 | o> readline() -> 403: |
|
1409 | o> readline() -> 403: | |
1410 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n |
|
1410 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n | |
1411 | o> readline() -> 2: |
|
1411 | o> readline() -> 2: | |
1412 | o> 1\n |
|
1412 | o> 1\n | |
1413 | o> readline() -> 1: |
|
1413 | o> readline() -> 1: | |
1414 | o> \n |
|
1414 | o> \n | |
1415 | sending listkeys command |
|
1415 | sending listkeys command | |
1416 | i> write(9) -> 9: |
|
1416 | i> write(9) -> 9: | |
1417 | i> listkeys\n |
|
1417 | i> listkeys\n | |
1418 | i> write(12) -> 12: |
|
1418 | i> write(12) -> 12: | |
1419 | i> namespace 9\n |
|
1419 | i> namespace 9\n | |
1420 | i> write(9) -> 9: bookmarks |
|
1420 | i> write(9) -> 9: bookmarks | |
1421 | i> flush() -> None |
|
1421 | i> flush() -> None | |
1422 | o> bufferedreadline() -> 2: |
|
1422 | o> bufferedreadline() -> 2: | |
1423 | o> 0\n |
|
1423 | o> 0\n | |
1424 | response: |
|
1424 | response: b'' | |
1425 |
|
1425 | |||
1426 | testing ssh2 |
|
1426 | testing ssh2 | |
1427 | creating ssh peer from handshake results |
|
1427 | creating ssh peer from handshake results | |
1428 | i> write(171) -> 171: |
|
1428 | i> write(171) -> 171: | |
1429 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
1429 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) | |
1430 | i> hello\n |
|
1430 | i> hello\n | |
1431 | i> between\n |
|
1431 | i> between\n | |
1432 | i> pairs 81\n |
|
1432 | i> pairs 81\n | |
1433 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1433 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1434 | i> flush() -> None |
|
1434 | i> flush() -> None | |
1435 | o> readline() -> 62: |
|
1435 | o> readline() -> 62: | |
1436 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
1436 | o> upgraded * exp-ssh-v2-0001\n (glob) | |
1437 | o> readline() -> 4: |
|
1437 | o> readline() -> 4: | |
1438 | o> 402\n |
|
1438 | o> 402\n | |
1439 | o> read(402) -> 402: capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch |
|
1439 | o> read(402) -> 402: capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch | |
1440 | o> read(1) -> 1: |
|
1440 | o> read(1) -> 1: | |
1441 | o> \n |
|
1441 | o> \n | |
1442 | sending listkeys command |
|
1442 | sending listkeys command | |
1443 | i> write(9) -> 9: |
|
1443 | i> write(9) -> 9: | |
1444 | i> listkeys\n |
|
1444 | i> listkeys\n | |
1445 | i> write(12) -> 12: |
|
1445 | i> write(12) -> 12: | |
1446 | i> namespace 9\n |
|
1446 | i> namespace 9\n | |
1447 | i> write(9) -> 9: bookmarks |
|
1447 | i> write(9) -> 9: bookmarks | |
1448 | i> flush() -> None |
|
1448 | i> flush() -> None | |
1449 | o> bufferedreadline() -> 2: |
|
1449 | o> bufferedreadline() -> 2: | |
1450 | o> 0\n |
|
1450 | o> 0\n | |
1451 | response: |
|
1451 | response: b'' | |
1452 |
|
1452 | |||
1453 | With a single bookmark set |
|
1453 | With a single bookmark set | |
1454 |
|
1454 | |||
1455 | $ hg book -r 0 bookA |
|
1455 | $ hg book -r 0 bookA | |
1456 | $ debugwireproto << EOF |
|
1456 | $ debugwireproto << EOF | |
1457 | > command listkeys |
|
1457 | > command listkeys | |
1458 | > namespace bookmarks |
|
1458 | > namespace bookmarks | |
1459 | > EOF |
|
1459 | > EOF | |
1460 | testing ssh1 |
|
1460 | testing ssh1 | |
1461 | creating ssh peer from handshake results |
|
1461 | creating ssh peer from handshake results | |
1462 | i> write(104) -> 104: |
|
1462 | i> write(104) -> 104: | |
1463 | i> hello\n |
|
1463 | i> hello\n | |
1464 | i> between\n |
|
1464 | i> between\n | |
1465 | i> pairs 81\n |
|
1465 | i> pairs 81\n | |
1466 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1466 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1467 | i> flush() -> None |
|
1467 | i> flush() -> None | |
1468 | o> readline() -> 4: |
|
1468 | o> readline() -> 4: | |
1469 | o> 403\n |
|
1469 | o> 403\n | |
1470 | o> readline() -> 403: |
|
1470 | o> readline() -> 403: | |
1471 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n |
|
1471 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n | |
1472 | o> readline() -> 2: |
|
1472 | o> readline() -> 2: | |
1473 | o> 1\n |
|
1473 | o> 1\n | |
1474 | o> readline() -> 1: |
|
1474 | o> readline() -> 1: | |
1475 | o> \n |
|
1475 | o> \n | |
1476 | sending listkeys command |
|
1476 | sending listkeys command | |
1477 | i> write(9) -> 9: |
|
1477 | i> write(9) -> 9: | |
1478 | i> listkeys\n |
|
1478 | i> listkeys\n | |
1479 | i> write(12) -> 12: |
|
1479 | i> write(12) -> 12: | |
1480 | i> namespace 9\n |
|
1480 | i> namespace 9\n | |
1481 | i> write(9) -> 9: bookmarks |
|
1481 | i> write(9) -> 9: bookmarks | |
1482 | i> flush() -> None |
|
1482 | i> flush() -> None | |
1483 | o> bufferedreadline() -> 3: |
|
1483 | o> bufferedreadline() -> 3: | |
1484 | o> 46\n |
|
1484 | o> 46\n | |
1485 | o> bufferedread(46) -> 46: bookA 68986213bd4485ea51533535e3fc9e78007a711f |
|
1485 | o> bufferedread(46) -> 46: bookA 68986213bd4485ea51533535e3fc9e78007a711f | |
1486 | response: bookA 68986213bd4485ea51533535e3fc9e78007a711f |
|
1486 | response: b'bookA 68986213bd4485ea51533535e3fc9e78007a711f' | |
1487 |
|
1487 | |||
1488 | testing ssh2 |
|
1488 | testing ssh2 | |
1489 | creating ssh peer from handshake results |
|
1489 | creating ssh peer from handshake results | |
1490 | i> write(171) -> 171: |
|
1490 | i> write(171) -> 171: | |
1491 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
1491 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) | |
1492 | i> hello\n |
|
1492 | i> hello\n | |
1493 | i> between\n |
|
1493 | i> between\n | |
1494 | i> pairs 81\n |
|
1494 | i> pairs 81\n | |
1495 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1495 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1496 | i> flush() -> None |
|
1496 | i> flush() -> None | |
1497 | o> readline() -> 62: |
|
1497 | o> readline() -> 62: | |
1498 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
1498 | o> upgraded * exp-ssh-v2-0001\n (glob) | |
1499 | o> readline() -> 4: |
|
1499 | o> readline() -> 4: | |
1500 | o> 402\n |
|
1500 | o> 402\n | |
1501 | o> read(402) -> 402: capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch |
|
1501 | o> read(402) -> 402: capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch | |
1502 | o> read(1) -> 1: |
|
1502 | o> read(1) -> 1: | |
1503 | o> \n |
|
1503 | o> \n | |
1504 | sending listkeys command |
|
1504 | sending listkeys command | |
1505 | i> write(9) -> 9: |
|
1505 | i> write(9) -> 9: | |
1506 | i> listkeys\n |
|
1506 | i> listkeys\n | |
1507 | i> write(12) -> 12: |
|
1507 | i> write(12) -> 12: | |
1508 | i> namespace 9\n |
|
1508 | i> namespace 9\n | |
1509 | i> write(9) -> 9: bookmarks |
|
1509 | i> write(9) -> 9: bookmarks | |
1510 | i> flush() -> None |
|
1510 | i> flush() -> None | |
1511 | o> bufferedreadline() -> 3: |
|
1511 | o> bufferedreadline() -> 3: | |
1512 | o> 46\n |
|
1512 | o> 46\n | |
1513 | o> bufferedread(46) -> 46: bookA 68986213bd4485ea51533535e3fc9e78007a711f |
|
1513 | o> bufferedread(46) -> 46: bookA 68986213bd4485ea51533535e3fc9e78007a711f | |
1514 | response: bookA 68986213bd4485ea51533535e3fc9e78007a711f |
|
1514 | response: b'bookA 68986213bd4485ea51533535e3fc9e78007a711f' | |
1515 |
|
1515 | |||
1516 | With multiple bookmarks set |
|
1516 | With multiple bookmarks set | |
1517 |
|
1517 | |||
1518 | $ hg book -r 1 bookB |
|
1518 | $ hg book -r 1 bookB | |
1519 | $ debugwireproto << EOF |
|
1519 | $ debugwireproto << EOF | |
1520 | > command listkeys |
|
1520 | > command listkeys | |
1521 | > namespace bookmarks |
|
1521 | > namespace bookmarks | |
1522 | > EOF |
|
1522 | > EOF | |
1523 | testing ssh1 |
|
1523 | testing ssh1 | |
1524 | creating ssh peer from handshake results |
|
1524 | creating ssh peer from handshake results | |
1525 | i> write(104) -> 104: |
|
1525 | i> write(104) -> 104: | |
1526 | i> hello\n |
|
1526 | i> hello\n | |
1527 | i> between\n |
|
1527 | i> between\n | |
1528 | i> pairs 81\n |
|
1528 | i> pairs 81\n | |
1529 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1529 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1530 | i> flush() -> None |
|
1530 | i> flush() -> None | |
1531 | o> readline() -> 4: |
|
1531 | o> readline() -> 4: | |
1532 | o> 403\n |
|
1532 | o> 403\n | |
1533 | o> readline() -> 403: |
|
1533 | o> readline() -> 403: | |
1534 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n |
|
1534 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n | |
1535 | o> readline() -> 2: |
|
1535 | o> readline() -> 2: | |
1536 | o> 1\n |
|
1536 | o> 1\n | |
1537 | o> readline() -> 1: |
|
1537 | o> readline() -> 1: | |
1538 | o> \n |
|
1538 | o> \n | |
1539 | sending listkeys command |
|
1539 | sending listkeys command | |
1540 | i> write(9) -> 9: |
|
1540 | i> write(9) -> 9: | |
1541 | i> listkeys\n |
|
1541 | i> listkeys\n | |
1542 | i> write(12) -> 12: |
|
1542 | i> write(12) -> 12: | |
1543 | i> namespace 9\n |
|
1543 | i> namespace 9\n | |
1544 | i> write(9) -> 9: bookmarks |
|
1544 | i> write(9) -> 9: bookmarks | |
1545 | i> flush() -> None |
|
1545 | i> flush() -> None | |
1546 | o> bufferedreadline() -> 3: |
|
1546 | o> bufferedreadline() -> 3: | |
1547 | o> 93\n |
|
1547 | o> 93\n | |
1548 | o> bufferedread(93) -> 93: |
|
1548 | o> bufferedread(93) -> 93: | |
1549 | o> bookA 68986213bd4485ea51533535e3fc9e78007a711f\n |
|
1549 | o> bookA 68986213bd4485ea51533535e3fc9e78007a711f\n | |
1550 | o> bookB 1880f3755e2e52e3199e0ee5638128b08642f34d |
|
1550 | o> bookB 1880f3755e2e52e3199e0ee5638128b08642f34d | |
1551 | response: bookA 68986213bd4485ea51533535e3fc9e78007a711f\nbookB 1880f3755e2e52e3199e0ee5638128b08642f34d |
|
1551 | response: b'bookA 68986213bd4485ea51533535e3fc9e78007a711f\nbookB 1880f3755e2e52e3199e0ee5638128b08642f34d' | |
1552 |
|
1552 | |||
1553 | testing ssh2 |
|
1553 | testing ssh2 | |
1554 | creating ssh peer from handshake results |
|
1554 | creating ssh peer from handshake results | |
1555 | i> write(171) -> 171: |
|
1555 | i> write(171) -> 171: | |
1556 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
1556 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) | |
1557 | i> hello\n |
|
1557 | i> hello\n | |
1558 | i> between\n |
|
1558 | i> between\n | |
1559 | i> pairs 81\n |
|
1559 | i> pairs 81\n | |
1560 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1560 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1561 | i> flush() -> None |
|
1561 | i> flush() -> None | |
1562 | o> readline() -> 62: |
|
1562 | o> readline() -> 62: | |
1563 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
1563 | o> upgraded * exp-ssh-v2-0001\n (glob) | |
1564 | o> readline() -> 4: |
|
1564 | o> readline() -> 4: | |
1565 | o> 402\n |
|
1565 | o> 402\n | |
1566 | o> read(402) -> 402: capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch |
|
1566 | o> read(402) -> 402: capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch | |
1567 | o> read(1) -> 1: |
|
1567 | o> read(1) -> 1: | |
1568 | o> \n |
|
1568 | o> \n | |
1569 | sending listkeys command |
|
1569 | sending listkeys command | |
1570 | i> write(9) -> 9: |
|
1570 | i> write(9) -> 9: | |
1571 | i> listkeys\n |
|
1571 | i> listkeys\n | |
1572 | i> write(12) -> 12: |
|
1572 | i> write(12) -> 12: | |
1573 | i> namespace 9\n |
|
1573 | i> namespace 9\n | |
1574 | i> write(9) -> 9: bookmarks |
|
1574 | i> write(9) -> 9: bookmarks | |
1575 | i> flush() -> None |
|
1575 | i> flush() -> None | |
1576 | o> bufferedreadline() -> 3: |
|
1576 | o> bufferedreadline() -> 3: | |
1577 | o> 93\n |
|
1577 | o> 93\n | |
1578 | o> bufferedread(93) -> 93: |
|
1578 | o> bufferedread(93) -> 93: | |
1579 | o> bookA 68986213bd4485ea51533535e3fc9e78007a711f\n |
|
1579 | o> bookA 68986213bd4485ea51533535e3fc9e78007a711f\n | |
1580 | o> bookB 1880f3755e2e52e3199e0ee5638128b08642f34d |
|
1580 | o> bookB 1880f3755e2e52e3199e0ee5638128b08642f34d | |
1581 | response: bookA 68986213bd4485ea51533535e3fc9e78007a711f\nbookB 1880f3755e2e52e3199e0ee5638128b08642f34d |
|
1581 | response: b'bookA 68986213bd4485ea51533535e3fc9e78007a711f\nbookB 1880f3755e2e52e3199e0ee5638128b08642f34d' | |
1582 |
|
1582 | |||
1583 | Test pushkey for bookmarks |
|
1583 | Test pushkey for bookmarks | |
1584 |
|
1584 | |||
1585 | $ debugwireproto << EOF |
|
1585 | $ debugwireproto << EOF | |
1586 | > command pushkey |
|
1586 | > command pushkey | |
1587 | > namespace bookmarks |
|
1587 | > namespace bookmarks | |
1588 | > key remote |
|
1588 | > key remote | |
1589 | > old |
|
1589 | > old | |
1590 | > new 68986213bd4485ea51533535e3fc9e78007a711f |
|
1590 | > new 68986213bd4485ea51533535e3fc9e78007a711f | |
1591 | > EOF |
|
1591 | > EOF | |
1592 | testing ssh1 |
|
1592 | testing ssh1 | |
1593 | creating ssh peer from handshake results |
|
1593 | creating ssh peer from handshake results | |
1594 | i> write(104) -> 104: |
|
1594 | i> write(104) -> 104: | |
1595 | i> hello\n |
|
1595 | i> hello\n | |
1596 | i> between\n |
|
1596 | i> between\n | |
1597 | i> pairs 81\n |
|
1597 | i> pairs 81\n | |
1598 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1598 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1599 | i> flush() -> None |
|
1599 | i> flush() -> None | |
1600 | o> readline() -> 4: |
|
1600 | o> readline() -> 4: | |
1601 | o> 403\n |
|
1601 | o> 403\n | |
1602 | o> readline() -> 403: |
|
1602 | o> readline() -> 403: | |
1603 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n |
|
1603 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n | |
1604 | o> readline() -> 2: |
|
1604 | o> readline() -> 2: | |
1605 | o> 1\n |
|
1605 | o> 1\n | |
1606 | o> readline() -> 1: |
|
1606 | o> readline() -> 1: | |
1607 | o> \n |
|
1607 | o> \n | |
1608 | sending pushkey command |
|
1608 | sending pushkey command | |
1609 | i> write(8) -> 8: |
|
1609 | i> write(8) -> 8: | |
1610 | i> pushkey\n |
|
1610 | i> pushkey\n | |
1611 | i> write(6) -> 6: |
|
1611 | i> write(6) -> 6: | |
1612 | i> key 6\n |
|
1612 | i> key 6\n | |
1613 | i> write(6) -> 6: remote |
|
1613 | i> write(6) -> 6: remote | |
1614 | i> write(12) -> 12: |
|
1614 | i> write(12) -> 12: | |
1615 | i> namespace 9\n |
|
1615 | i> namespace 9\n | |
1616 | i> write(9) -> 9: bookmarks |
|
1616 | i> write(9) -> 9: bookmarks | |
1617 | i> write(7) -> 7: |
|
1617 | i> write(7) -> 7: | |
1618 | i> new 40\n |
|
1618 | i> new 40\n | |
1619 | i> write(40) -> 40: 68986213bd4485ea51533535e3fc9e78007a711f |
|
1619 | i> write(40) -> 40: 68986213bd4485ea51533535e3fc9e78007a711f | |
1620 | i> write(6) -> 6: |
|
1620 | i> write(6) -> 6: | |
1621 | i> old 0\n |
|
1621 | i> old 0\n | |
1622 | i> flush() -> None |
|
1622 | i> flush() -> None | |
1623 | o> bufferedreadline() -> 2: |
|
1623 | o> bufferedreadline() -> 2: | |
1624 | o> 2\n |
|
1624 | o> 2\n | |
1625 | o> bufferedread(2) -> 2: |
|
1625 | o> bufferedread(2) -> 2: | |
1626 | o> 1\n |
|
1626 | o> 1\n | |
1627 | response: 1\n |
|
1627 | response: b'1\n' | |
1628 |
|
1628 | |||
1629 | testing ssh2 |
|
1629 | testing ssh2 | |
1630 | creating ssh peer from handshake results |
|
1630 | creating ssh peer from handshake results | |
1631 | i> write(171) -> 171: |
|
1631 | i> write(171) -> 171: | |
1632 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
1632 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) | |
1633 | i> hello\n |
|
1633 | i> hello\n | |
1634 | i> between\n |
|
1634 | i> between\n | |
1635 | i> pairs 81\n |
|
1635 | i> pairs 81\n | |
1636 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1636 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1637 | i> flush() -> None |
|
1637 | i> flush() -> None | |
1638 | o> readline() -> 62: |
|
1638 | o> readline() -> 62: | |
1639 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
1639 | o> upgraded * exp-ssh-v2-0001\n (glob) | |
1640 | o> readline() -> 4: |
|
1640 | o> readline() -> 4: | |
1641 | o> 402\n |
|
1641 | o> 402\n | |
1642 | o> read(402) -> 402: capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch |
|
1642 | o> read(402) -> 402: capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch | |
1643 | o> read(1) -> 1: |
|
1643 | o> read(1) -> 1: | |
1644 | o> \n |
|
1644 | o> \n | |
1645 | sending pushkey command |
|
1645 | sending pushkey command | |
1646 | i> write(8) -> 8: |
|
1646 | i> write(8) -> 8: | |
1647 | i> pushkey\n |
|
1647 | i> pushkey\n | |
1648 | i> write(6) -> 6: |
|
1648 | i> write(6) -> 6: | |
1649 | i> key 6\n |
|
1649 | i> key 6\n | |
1650 | i> write(6) -> 6: remote |
|
1650 | i> write(6) -> 6: remote | |
1651 | i> write(12) -> 12: |
|
1651 | i> write(12) -> 12: | |
1652 | i> namespace 9\n |
|
1652 | i> namespace 9\n | |
1653 | i> write(9) -> 9: bookmarks |
|
1653 | i> write(9) -> 9: bookmarks | |
1654 | i> write(7) -> 7: |
|
1654 | i> write(7) -> 7: | |
1655 | i> new 40\n |
|
1655 | i> new 40\n | |
1656 | i> write(40) -> 40: 68986213bd4485ea51533535e3fc9e78007a711f |
|
1656 | i> write(40) -> 40: 68986213bd4485ea51533535e3fc9e78007a711f | |
1657 | i> write(6) -> 6: |
|
1657 | i> write(6) -> 6: | |
1658 | i> old 0\n |
|
1658 | i> old 0\n | |
1659 | i> flush() -> None |
|
1659 | i> flush() -> None | |
1660 | o> bufferedreadline() -> 2: |
|
1660 | o> bufferedreadline() -> 2: | |
1661 | o> 2\n |
|
1661 | o> 2\n | |
1662 | o> bufferedread(2) -> 2: |
|
1662 | o> bufferedread(2) -> 2: | |
1663 | o> 1\n |
|
1663 | o> 1\n | |
1664 | response: 1\n |
|
1664 | response: b'1\n' | |
1665 |
|
1665 | |||
1666 | $ hg bookmarks |
|
1666 | $ hg bookmarks | |
1667 | bookA 0:68986213bd44 |
|
1667 | bookA 0:68986213bd44 | |
1668 | bookB 1:1880f3755e2e |
|
1668 | bookB 1:1880f3755e2e | |
1669 | remote 0:68986213bd44 |
|
1669 | remote 0:68986213bd44 | |
1670 |
|
1670 | |||
1671 | $ cd .. |
|
1671 | $ cd .. | |
1672 |
|
1672 | |||
1673 | Test listkeys for phases |
|
1673 | Test listkeys for phases | |
1674 |
|
1674 | |||
1675 | $ hg init phasesrepo |
|
1675 | $ hg init phasesrepo | |
1676 | $ cd phasesrepo |
|
1676 | $ cd phasesrepo | |
1677 |
|
1677 | |||
1678 | Phases on empty repo |
|
1678 | Phases on empty repo | |
1679 |
|
1679 | |||
1680 | $ debugwireproto << EOF |
|
1680 | $ debugwireproto << EOF | |
1681 | > command listkeys |
|
1681 | > command listkeys | |
1682 | > namespace phases |
|
1682 | > namespace phases | |
1683 | > EOF |
|
1683 | > EOF | |
1684 | testing ssh1 |
|
1684 | testing ssh1 | |
1685 | creating ssh peer from handshake results |
|
1685 | creating ssh peer from handshake results | |
1686 | i> write(104) -> 104: |
|
1686 | i> write(104) -> 104: | |
1687 | i> hello\n |
|
1687 | i> hello\n | |
1688 | i> between\n |
|
1688 | i> between\n | |
1689 | i> pairs 81\n |
|
1689 | i> pairs 81\n | |
1690 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1690 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1691 | i> flush() -> None |
|
1691 | i> flush() -> None | |
1692 | o> readline() -> 4: |
|
1692 | o> readline() -> 4: | |
1693 | o> 403\n |
|
1693 | o> 403\n | |
1694 | o> readline() -> 403: |
|
1694 | o> readline() -> 403: | |
1695 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n |
|
1695 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n | |
1696 | o> readline() -> 2: |
|
1696 | o> readline() -> 2: | |
1697 | o> 1\n |
|
1697 | o> 1\n | |
1698 | o> readline() -> 1: |
|
1698 | o> readline() -> 1: | |
1699 | o> \n |
|
1699 | o> \n | |
1700 | sending listkeys command |
|
1700 | sending listkeys command | |
1701 | i> write(9) -> 9: |
|
1701 | i> write(9) -> 9: | |
1702 | i> listkeys\n |
|
1702 | i> listkeys\n | |
1703 | i> write(12) -> 12: |
|
1703 | i> write(12) -> 12: | |
1704 | i> namespace 6\n |
|
1704 | i> namespace 6\n | |
1705 | i> write(6) -> 6: phases |
|
1705 | i> write(6) -> 6: phases | |
1706 | i> flush() -> None |
|
1706 | i> flush() -> None | |
1707 | o> bufferedreadline() -> 3: |
|
1707 | o> bufferedreadline() -> 3: | |
1708 | o> 15\n |
|
1708 | o> 15\n | |
1709 | o> bufferedread(15) -> 15: publishing True |
|
1709 | o> bufferedread(15) -> 15: publishing True | |
1710 | response: publishing True |
|
1710 | response: b'publishing True' | |
1711 |
|
1711 | |||
1712 | testing ssh2 |
|
1712 | testing ssh2 | |
1713 | creating ssh peer from handshake results |
|
1713 | creating ssh peer from handshake results | |
1714 | i> write(171) -> 171: |
|
1714 | i> write(171) -> 171: | |
1715 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
1715 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) | |
1716 | i> hello\n |
|
1716 | i> hello\n | |
1717 | i> between\n |
|
1717 | i> between\n | |
1718 | i> pairs 81\n |
|
1718 | i> pairs 81\n | |
1719 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1719 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1720 | i> flush() -> None |
|
1720 | i> flush() -> None | |
1721 | o> readline() -> 62: |
|
1721 | o> readline() -> 62: | |
1722 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
1722 | o> upgraded * exp-ssh-v2-0001\n (glob) | |
1723 | o> readline() -> 4: |
|
1723 | o> readline() -> 4: | |
1724 | o> 402\n |
|
1724 | o> 402\n | |
1725 | o> read(402) -> 402: capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch |
|
1725 | o> read(402) -> 402: capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch | |
1726 | o> read(1) -> 1: |
|
1726 | o> read(1) -> 1: | |
1727 | o> \n |
|
1727 | o> \n | |
1728 | sending listkeys command |
|
1728 | sending listkeys command | |
1729 | i> write(9) -> 9: |
|
1729 | i> write(9) -> 9: | |
1730 | i> listkeys\n |
|
1730 | i> listkeys\n | |
1731 | i> write(12) -> 12: |
|
1731 | i> write(12) -> 12: | |
1732 | i> namespace 6\n |
|
1732 | i> namespace 6\n | |
1733 | i> write(6) -> 6: phases |
|
1733 | i> write(6) -> 6: phases | |
1734 | i> flush() -> None |
|
1734 | i> flush() -> None | |
1735 | o> bufferedreadline() -> 3: |
|
1735 | o> bufferedreadline() -> 3: | |
1736 | o> 15\n |
|
1736 | o> 15\n | |
1737 | o> bufferedread(15) -> 15: publishing True |
|
1737 | o> bufferedread(15) -> 15: publishing True | |
1738 | response: publishing True |
|
1738 | response: b'publishing True' | |
1739 |
|
1739 | |||
1740 | Create some commits |
|
1740 | Create some commits | |
1741 |
|
1741 | |||
1742 | $ echo 0 > foo |
|
1742 | $ echo 0 > foo | |
1743 | $ hg add foo |
|
1743 | $ hg add foo | |
1744 | $ hg -q commit -m initial |
|
1744 | $ hg -q commit -m initial | |
1745 | $ hg phase --public |
|
1745 | $ hg phase --public | |
1746 | $ echo 1 > foo |
|
1746 | $ echo 1 > foo | |
1747 | $ hg commit -m 'head 1 commit 1' |
|
1747 | $ hg commit -m 'head 1 commit 1' | |
1748 | $ echo 2 > foo |
|
1748 | $ echo 2 > foo | |
1749 | $ hg commit -m 'head 1 commit 2' |
|
1749 | $ hg commit -m 'head 1 commit 2' | |
1750 | $ hg -q up 0 |
|
1750 | $ hg -q up 0 | |
1751 | $ echo 1a > foo |
|
1751 | $ echo 1a > foo | |
1752 | $ hg commit -m 'head 2 commit 1' |
|
1752 | $ hg commit -m 'head 2 commit 1' | |
1753 | created new head |
|
1753 | created new head | |
1754 | $ echo 2a > foo |
|
1754 | $ echo 2a > foo | |
1755 | $ hg commit -m 'head 2 commit 2' |
|
1755 | $ hg commit -m 'head 2 commit 2' | |
1756 |
|
1756 | |||
1757 | Two draft heads |
|
1757 | Two draft heads | |
1758 |
|
1758 | |||
1759 | $ debugwireproto << EOF |
|
1759 | $ debugwireproto << EOF | |
1760 | > command listkeys |
|
1760 | > command listkeys | |
1761 | > namespace phases |
|
1761 | > namespace phases | |
1762 | > EOF |
|
1762 | > EOF | |
1763 | testing ssh1 |
|
1763 | testing ssh1 | |
1764 | creating ssh peer from handshake results |
|
1764 | creating ssh peer from handshake results | |
1765 | i> write(104) -> 104: |
|
1765 | i> write(104) -> 104: | |
1766 | i> hello\n |
|
1766 | i> hello\n | |
1767 | i> between\n |
|
1767 | i> between\n | |
1768 | i> pairs 81\n |
|
1768 | i> pairs 81\n | |
1769 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1769 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1770 | i> flush() -> None |
|
1770 | i> flush() -> None | |
1771 | o> readline() -> 4: |
|
1771 | o> readline() -> 4: | |
1772 | o> 403\n |
|
1772 | o> 403\n | |
1773 | o> readline() -> 403: |
|
1773 | o> readline() -> 403: | |
1774 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n |
|
1774 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n | |
1775 | o> readline() -> 2: |
|
1775 | o> readline() -> 2: | |
1776 | o> 1\n |
|
1776 | o> 1\n | |
1777 | o> readline() -> 1: |
|
1777 | o> readline() -> 1: | |
1778 | o> \n |
|
1778 | o> \n | |
1779 | sending listkeys command |
|
1779 | sending listkeys command | |
1780 | i> write(9) -> 9: |
|
1780 | i> write(9) -> 9: | |
1781 | i> listkeys\n |
|
1781 | i> listkeys\n | |
1782 | i> write(12) -> 12: |
|
1782 | i> write(12) -> 12: | |
1783 | i> namespace 6\n |
|
1783 | i> namespace 6\n | |
1784 | i> write(6) -> 6: phases |
|
1784 | i> write(6) -> 6: phases | |
1785 | i> flush() -> None |
|
1785 | i> flush() -> None | |
1786 | o> bufferedreadline() -> 4: |
|
1786 | o> bufferedreadline() -> 4: | |
1787 | o> 101\n |
|
1787 | o> 101\n | |
1788 | o> bufferedread(101) -> 101: |
|
1788 | o> bufferedread(101) -> 101: | |
1789 | o> 20b8a89289d80036e6c4e87c2083e3bea1586637 1\n |
|
1789 | o> 20b8a89289d80036e6c4e87c2083e3bea1586637 1\n | |
1790 | o> c4750011d906c18ea2f0527419cbc1a544435150 1\n |
|
1790 | o> c4750011d906c18ea2f0527419cbc1a544435150 1\n | |
1791 | o> publishing True |
|
1791 | o> publishing True | |
1792 | response: 20b8a89289d80036e6c4e87c2083e3bea1586637 1\nc4750011d906c18ea2f0527419cbc1a544435150 1\npublishing True |
|
1792 | response: b'20b8a89289d80036e6c4e87c2083e3bea1586637 1\nc4750011d906c18ea2f0527419cbc1a544435150 1\npublishing True' | |
1793 |
|
1793 | |||
1794 | testing ssh2 |
|
1794 | testing ssh2 | |
1795 | creating ssh peer from handshake results |
|
1795 | creating ssh peer from handshake results | |
1796 | i> write(171) -> 171: |
|
1796 | i> write(171) -> 171: | |
1797 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
1797 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) | |
1798 | i> hello\n |
|
1798 | i> hello\n | |
1799 | i> between\n |
|
1799 | i> between\n | |
1800 | i> pairs 81\n |
|
1800 | i> pairs 81\n | |
1801 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1801 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1802 | i> flush() -> None |
|
1802 | i> flush() -> None | |
1803 | o> readline() -> 62: |
|
1803 | o> readline() -> 62: | |
1804 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
1804 | o> upgraded * exp-ssh-v2-0001\n (glob) | |
1805 | o> readline() -> 4: |
|
1805 | o> readline() -> 4: | |
1806 | o> 402\n |
|
1806 | o> 402\n | |
1807 | o> read(402) -> 402: capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch |
|
1807 | o> read(402) -> 402: capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch | |
1808 | o> read(1) -> 1: |
|
1808 | o> read(1) -> 1: | |
1809 | o> \n |
|
1809 | o> \n | |
1810 | sending listkeys command |
|
1810 | sending listkeys command | |
1811 | i> write(9) -> 9: |
|
1811 | i> write(9) -> 9: | |
1812 | i> listkeys\n |
|
1812 | i> listkeys\n | |
1813 | i> write(12) -> 12: |
|
1813 | i> write(12) -> 12: | |
1814 | i> namespace 6\n |
|
1814 | i> namespace 6\n | |
1815 | i> write(6) -> 6: phases |
|
1815 | i> write(6) -> 6: phases | |
1816 | i> flush() -> None |
|
1816 | i> flush() -> None | |
1817 | o> bufferedreadline() -> 4: |
|
1817 | o> bufferedreadline() -> 4: | |
1818 | o> 101\n |
|
1818 | o> 101\n | |
1819 | o> bufferedread(101) -> 101: |
|
1819 | o> bufferedread(101) -> 101: | |
1820 | o> 20b8a89289d80036e6c4e87c2083e3bea1586637 1\n |
|
1820 | o> 20b8a89289d80036e6c4e87c2083e3bea1586637 1\n | |
1821 | o> c4750011d906c18ea2f0527419cbc1a544435150 1\n |
|
1821 | o> c4750011d906c18ea2f0527419cbc1a544435150 1\n | |
1822 | o> publishing True |
|
1822 | o> publishing True | |
1823 | response: 20b8a89289d80036e6c4e87c2083e3bea1586637 1\nc4750011d906c18ea2f0527419cbc1a544435150 1\npublishing True |
|
1823 | response: b'20b8a89289d80036e6c4e87c2083e3bea1586637 1\nc4750011d906c18ea2f0527419cbc1a544435150 1\npublishing True' | |
1824 |
|
1824 | |||
1825 | Single draft head |
|
1825 | Single draft head | |
1826 |
|
1826 | |||
1827 | $ hg phase --public -r 2 |
|
1827 | $ hg phase --public -r 2 | |
1828 | $ debugwireproto << EOF |
|
1828 | $ debugwireproto << EOF | |
1829 | > command listkeys |
|
1829 | > command listkeys | |
1830 | > namespace phases |
|
1830 | > namespace phases | |
1831 | > EOF |
|
1831 | > EOF | |
1832 | testing ssh1 |
|
1832 | testing ssh1 | |
1833 | creating ssh peer from handshake results |
|
1833 | creating ssh peer from handshake results | |
1834 | i> write(104) -> 104: |
|
1834 | i> write(104) -> 104: | |
1835 | i> hello\n |
|
1835 | i> hello\n | |
1836 | i> between\n |
|
1836 | i> between\n | |
1837 | i> pairs 81\n |
|
1837 | i> pairs 81\n | |
1838 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1838 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1839 | i> flush() -> None |
|
1839 | i> flush() -> None | |
1840 | o> readline() -> 4: |
|
1840 | o> readline() -> 4: | |
1841 | o> 403\n |
|
1841 | o> 403\n | |
1842 | o> readline() -> 403: |
|
1842 | o> readline() -> 403: | |
1843 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n |
|
1843 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n | |
1844 | o> readline() -> 2: |
|
1844 | o> readline() -> 2: | |
1845 | o> 1\n |
|
1845 | o> 1\n | |
1846 | o> readline() -> 1: |
|
1846 | o> readline() -> 1: | |
1847 | o> \n |
|
1847 | o> \n | |
1848 | sending listkeys command |
|
1848 | sending listkeys command | |
1849 | i> write(9) -> 9: |
|
1849 | i> write(9) -> 9: | |
1850 | i> listkeys\n |
|
1850 | i> listkeys\n | |
1851 | i> write(12) -> 12: |
|
1851 | i> write(12) -> 12: | |
1852 | i> namespace 6\n |
|
1852 | i> namespace 6\n | |
1853 | i> write(6) -> 6: phases |
|
1853 | i> write(6) -> 6: phases | |
1854 | i> flush() -> None |
|
1854 | i> flush() -> None | |
1855 | o> bufferedreadline() -> 3: |
|
1855 | o> bufferedreadline() -> 3: | |
1856 | o> 58\n |
|
1856 | o> 58\n | |
1857 | o> bufferedread(58) -> 58: |
|
1857 | o> bufferedread(58) -> 58: | |
1858 | o> c4750011d906c18ea2f0527419cbc1a544435150 1\n |
|
1858 | o> c4750011d906c18ea2f0527419cbc1a544435150 1\n | |
1859 | o> publishing True |
|
1859 | o> publishing True | |
1860 | response: c4750011d906c18ea2f0527419cbc1a544435150 1\npublishing True |
|
1860 | response: b'c4750011d906c18ea2f0527419cbc1a544435150 1\npublishing True' | |
1861 |
|
1861 | |||
1862 | testing ssh2 |
|
1862 | testing ssh2 | |
1863 | creating ssh peer from handshake results |
|
1863 | creating ssh peer from handshake results | |
1864 | i> write(171) -> 171: |
|
1864 | i> write(171) -> 171: | |
1865 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
1865 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) | |
1866 | i> hello\n |
|
1866 | i> hello\n | |
1867 | i> between\n |
|
1867 | i> between\n | |
1868 | i> pairs 81\n |
|
1868 | i> pairs 81\n | |
1869 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1869 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1870 | i> flush() -> None |
|
1870 | i> flush() -> None | |
1871 | o> readline() -> 62: |
|
1871 | o> readline() -> 62: | |
1872 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
1872 | o> upgraded * exp-ssh-v2-0001\n (glob) | |
1873 | o> readline() -> 4: |
|
1873 | o> readline() -> 4: | |
1874 | o> 402\n |
|
1874 | o> 402\n | |
1875 | o> read(402) -> 402: capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch |
|
1875 | o> read(402) -> 402: capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch | |
1876 | o> read(1) -> 1: |
|
1876 | o> read(1) -> 1: | |
1877 | o> \n |
|
1877 | o> \n | |
1878 | sending listkeys command |
|
1878 | sending listkeys command | |
1879 | i> write(9) -> 9: |
|
1879 | i> write(9) -> 9: | |
1880 | i> listkeys\n |
|
1880 | i> listkeys\n | |
1881 | i> write(12) -> 12: |
|
1881 | i> write(12) -> 12: | |
1882 | i> namespace 6\n |
|
1882 | i> namespace 6\n | |
1883 | i> write(6) -> 6: phases |
|
1883 | i> write(6) -> 6: phases | |
1884 | i> flush() -> None |
|
1884 | i> flush() -> None | |
1885 | o> bufferedreadline() -> 3: |
|
1885 | o> bufferedreadline() -> 3: | |
1886 | o> 58\n |
|
1886 | o> 58\n | |
1887 | o> bufferedread(58) -> 58: |
|
1887 | o> bufferedread(58) -> 58: | |
1888 | o> c4750011d906c18ea2f0527419cbc1a544435150 1\n |
|
1888 | o> c4750011d906c18ea2f0527419cbc1a544435150 1\n | |
1889 | o> publishing True |
|
1889 | o> publishing True | |
1890 | response: c4750011d906c18ea2f0527419cbc1a544435150 1\npublishing True |
|
1890 | response: b'c4750011d906c18ea2f0527419cbc1a544435150 1\npublishing True' | |
1891 |
|
1891 | |||
1892 | All public heads |
|
1892 | All public heads | |
1893 |
|
1893 | |||
1894 | $ hg phase --public -r 4 |
|
1894 | $ hg phase --public -r 4 | |
1895 | $ debugwireproto << EOF |
|
1895 | $ debugwireproto << EOF | |
1896 | > command listkeys |
|
1896 | > command listkeys | |
1897 | > namespace phases |
|
1897 | > namespace phases | |
1898 | > EOF |
|
1898 | > EOF | |
1899 | testing ssh1 |
|
1899 | testing ssh1 | |
1900 | creating ssh peer from handshake results |
|
1900 | creating ssh peer from handshake results | |
1901 | i> write(104) -> 104: |
|
1901 | i> write(104) -> 104: | |
1902 | i> hello\n |
|
1902 | i> hello\n | |
1903 | i> between\n |
|
1903 | i> between\n | |
1904 | i> pairs 81\n |
|
1904 | i> pairs 81\n | |
1905 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1905 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1906 | i> flush() -> None |
|
1906 | i> flush() -> None | |
1907 | o> readline() -> 4: |
|
1907 | o> readline() -> 4: | |
1908 | o> 403\n |
|
1908 | o> 403\n | |
1909 | o> readline() -> 403: |
|
1909 | o> readline() -> 403: | |
1910 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n |
|
1910 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n | |
1911 | o> readline() -> 2: |
|
1911 | o> readline() -> 2: | |
1912 | o> 1\n |
|
1912 | o> 1\n | |
1913 | o> readline() -> 1: |
|
1913 | o> readline() -> 1: | |
1914 | o> \n |
|
1914 | o> \n | |
1915 | sending listkeys command |
|
1915 | sending listkeys command | |
1916 | i> write(9) -> 9: |
|
1916 | i> write(9) -> 9: | |
1917 | i> listkeys\n |
|
1917 | i> listkeys\n | |
1918 | i> write(12) -> 12: |
|
1918 | i> write(12) -> 12: | |
1919 | i> namespace 6\n |
|
1919 | i> namespace 6\n | |
1920 | i> write(6) -> 6: phases |
|
1920 | i> write(6) -> 6: phases | |
1921 | i> flush() -> None |
|
1921 | i> flush() -> None | |
1922 | o> bufferedreadline() -> 3: |
|
1922 | o> bufferedreadline() -> 3: | |
1923 | o> 15\n |
|
1923 | o> 15\n | |
1924 | o> bufferedread(15) -> 15: publishing True |
|
1924 | o> bufferedread(15) -> 15: publishing True | |
1925 | response: publishing True |
|
1925 | response: b'publishing True' | |
1926 |
|
1926 | |||
1927 | testing ssh2 |
|
1927 | testing ssh2 | |
1928 | creating ssh peer from handshake results |
|
1928 | creating ssh peer from handshake results | |
1929 | i> write(171) -> 171: |
|
1929 | i> write(171) -> 171: | |
1930 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
1930 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) | |
1931 | i> hello\n |
|
1931 | i> hello\n | |
1932 | i> between\n |
|
1932 | i> between\n | |
1933 | i> pairs 81\n |
|
1933 | i> pairs 81\n | |
1934 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1934 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1935 | i> flush() -> None |
|
1935 | i> flush() -> None | |
1936 | o> readline() -> 62: |
|
1936 | o> readline() -> 62: | |
1937 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
1937 | o> upgraded * exp-ssh-v2-0001\n (glob) | |
1938 | o> readline() -> 4: |
|
1938 | o> readline() -> 4: | |
1939 | o> 402\n |
|
1939 | o> 402\n | |
1940 | o> read(402) -> 402: capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch |
|
1940 | o> read(402) -> 402: capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch | |
1941 | o> read(1) -> 1: |
|
1941 | o> read(1) -> 1: | |
1942 | o> \n |
|
1942 | o> \n | |
1943 | sending listkeys command |
|
1943 | sending listkeys command | |
1944 | i> write(9) -> 9: |
|
1944 | i> write(9) -> 9: | |
1945 | i> listkeys\n |
|
1945 | i> listkeys\n | |
1946 | i> write(12) -> 12: |
|
1946 | i> write(12) -> 12: | |
1947 | i> namespace 6\n |
|
1947 | i> namespace 6\n | |
1948 | i> write(6) -> 6: phases |
|
1948 | i> write(6) -> 6: phases | |
1949 | i> flush() -> None |
|
1949 | i> flush() -> None | |
1950 | o> bufferedreadline() -> 3: |
|
1950 | o> bufferedreadline() -> 3: | |
1951 | o> 15\n |
|
1951 | o> 15\n | |
1952 | o> bufferedread(15) -> 15: publishing True |
|
1952 | o> bufferedread(15) -> 15: publishing True | |
1953 | response: publishing True |
|
1953 | response: b'publishing True' | |
1954 |
|
1954 | |||
1955 | Setting public phase via pushkey |
|
1955 | Setting public phase via pushkey | |
1956 |
|
1956 | |||
1957 | $ hg phase --draft --force -r . |
|
1957 | $ hg phase --draft --force -r . | |
1958 |
|
1958 | |||
1959 | $ debugwireproto << EOF |
|
1959 | $ debugwireproto << EOF | |
1960 | > command pushkey |
|
1960 | > command pushkey | |
1961 | > namespace phases |
|
1961 | > namespace phases | |
1962 | > key 7127240a084fd9dc86fe8d1f98e26229161ec82b |
|
1962 | > key 7127240a084fd9dc86fe8d1f98e26229161ec82b | |
1963 | > old 1 |
|
1963 | > old 1 | |
1964 | > new 0 |
|
1964 | > new 0 | |
1965 | > EOF |
|
1965 | > EOF | |
1966 | testing ssh1 |
|
1966 | testing ssh1 | |
1967 | creating ssh peer from handshake results |
|
1967 | creating ssh peer from handshake results | |
1968 | i> write(104) -> 104: |
|
1968 | i> write(104) -> 104: | |
1969 | i> hello\n |
|
1969 | i> hello\n | |
1970 | i> between\n |
|
1970 | i> between\n | |
1971 | i> pairs 81\n |
|
1971 | i> pairs 81\n | |
1972 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1972 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1973 | i> flush() -> None |
|
1973 | i> flush() -> None | |
1974 | o> readline() -> 4: |
|
1974 | o> readline() -> 4: | |
1975 | o> 403\n |
|
1975 | o> 403\n | |
1976 | o> readline() -> 403: |
|
1976 | o> readline() -> 403: | |
1977 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n |
|
1977 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n | |
1978 | o> readline() -> 2: |
|
1978 | o> readline() -> 2: | |
1979 | o> 1\n |
|
1979 | o> 1\n | |
1980 | o> readline() -> 1: |
|
1980 | o> readline() -> 1: | |
1981 | o> \n |
|
1981 | o> \n | |
1982 | sending pushkey command |
|
1982 | sending pushkey command | |
1983 | i> write(8) -> 8: |
|
1983 | i> write(8) -> 8: | |
1984 | i> pushkey\n |
|
1984 | i> pushkey\n | |
1985 | i> write(7) -> 7: |
|
1985 | i> write(7) -> 7: | |
1986 | i> key 40\n |
|
1986 | i> key 40\n | |
1987 | i> write(40) -> 40: 7127240a084fd9dc86fe8d1f98e26229161ec82b |
|
1987 | i> write(40) -> 40: 7127240a084fd9dc86fe8d1f98e26229161ec82b | |
1988 | i> write(12) -> 12: |
|
1988 | i> write(12) -> 12: | |
1989 | i> namespace 6\n |
|
1989 | i> namespace 6\n | |
1990 | i> write(6) -> 6: phases |
|
1990 | i> write(6) -> 6: phases | |
1991 | i> write(6) -> 6: |
|
1991 | i> write(6) -> 6: | |
1992 | i> new 1\n |
|
1992 | i> new 1\n | |
1993 | i> write(1) -> 1: 0 |
|
1993 | i> write(1) -> 1: 0 | |
1994 | i> write(6) -> 6: |
|
1994 | i> write(6) -> 6: | |
1995 | i> old 1\n |
|
1995 | i> old 1\n | |
1996 | i> write(1) -> 1: 1 |
|
1996 | i> write(1) -> 1: 1 | |
1997 | i> flush() -> None |
|
1997 | i> flush() -> None | |
1998 | o> bufferedreadline() -> 2: |
|
1998 | o> bufferedreadline() -> 2: | |
1999 | o> 2\n |
|
1999 | o> 2\n | |
2000 | o> bufferedread(2) -> 2: |
|
2000 | o> bufferedread(2) -> 2: | |
2001 | o> 1\n |
|
2001 | o> 1\n | |
2002 | response: 1\n |
|
2002 | response: b'1\n' | |
2003 |
|
2003 | |||
2004 | testing ssh2 |
|
2004 | testing ssh2 | |
2005 | creating ssh peer from handshake results |
|
2005 | creating ssh peer from handshake results | |
2006 | i> write(171) -> 171: |
|
2006 | i> write(171) -> 171: | |
2007 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
2007 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) | |
2008 | i> hello\n |
|
2008 | i> hello\n | |
2009 | i> between\n |
|
2009 | i> between\n | |
2010 | i> pairs 81\n |
|
2010 | i> pairs 81\n | |
2011 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
2011 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
2012 | i> flush() -> None |
|
2012 | i> flush() -> None | |
2013 | o> readline() -> 62: |
|
2013 | o> readline() -> 62: | |
2014 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
2014 | o> upgraded * exp-ssh-v2-0001\n (glob) | |
2015 | o> readline() -> 4: |
|
2015 | o> readline() -> 4: | |
2016 | o> 402\n |
|
2016 | o> 402\n | |
2017 | o> read(402) -> 402: capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch |
|
2017 | o> read(402) -> 402: capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch | |
2018 | o> read(1) -> 1: |
|
2018 | o> read(1) -> 1: | |
2019 | o> \n |
|
2019 | o> \n | |
2020 | sending pushkey command |
|
2020 | sending pushkey command | |
2021 | i> write(8) -> 8: |
|
2021 | i> write(8) -> 8: | |
2022 | i> pushkey\n |
|
2022 | i> pushkey\n | |
2023 | i> write(7) -> 7: |
|
2023 | i> write(7) -> 7: | |
2024 | i> key 40\n |
|
2024 | i> key 40\n | |
2025 | i> write(40) -> 40: 7127240a084fd9dc86fe8d1f98e26229161ec82b |
|
2025 | i> write(40) -> 40: 7127240a084fd9dc86fe8d1f98e26229161ec82b | |
2026 | i> write(12) -> 12: |
|
2026 | i> write(12) -> 12: | |
2027 | i> namespace 6\n |
|
2027 | i> namespace 6\n | |
2028 | i> write(6) -> 6: phases |
|
2028 | i> write(6) -> 6: phases | |
2029 | i> write(6) -> 6: |
|
2029 | i> write(6) -> 6: | |
2030 | i> new 1\n |
|
2030 | i> new 1\n | |
2031 | i> write(1) -> 1: 0 |
|
2031 | i> write(1) -> 1: 0 | |
2032 | i> write(6) -> 6: |
|
2032 | i> write(6) -> 6: | |
2033 | i> old 1\n |
|
2033 | i> old 1\n | |
2034 | i> write(1) -> 1: 1 |
|
2034 | i> write(1) -> 1: 1 | |
2035 | i> flush() -> None |
|
2035 | i> flush() -> None | |
2036 | o> bufferedreadline() -> 2: |
|
2036 | o> bufferedreadline() -> 2: | |
2037 | o> 2\n |
|
2037 | o> 2\n | |
2038 | o> bufferedread(2) -> 2: |
|
2038 | o> bufferedread(2) -> 2: | |
2039 | o> 1\n |
|
2039 | o> 1\n | |
2040 | response: 1\n |
|
2040 | response: b'1\n' | |
2041 |
|
2041 | |||
2042 | $ hg phase . |
|
2042 | $ hg phase . | |
2043 | 4: public |
|
2043 | 4: public | |
2044 |
|
2044 | |||
2045 | $ cd .. |
|
2045 | $ cd .. | |
2046 |
|
2046 | |||
2047 | Test batching of requests |
|
2047 | Test batching of requests | |
2048 |
|
2048 | |||
2049 | $ hg init batching |
|
2049 | $ hg init batching | |
2050 | $ cd batching |
|
2050 | $ cd batching | |
2051 | $ echo 0 > foo |
|
2051 | $ echo 0 > foo | |
2052 | $ hg add foo |
|
2052 | $ hg add foo | |
2053 | $ hg -q commit -m initial |
|
2053 | $ hg -q commit -m initial | |
2054 | $ hg phase --public |
|
2054 | $ hg phase --public | |
2055 | $ echo 1 > foo |
|
2055 | $ echo 1 > foo | |
2056 | $ hg commit -m 'commit 1' |
|
2056 | $ hg commit -m 'commit 1' | |
2057 | $ hg -q up 0 |
|
2057 | $ hg -q up 0 | |
2058 | $ echo 2 > foo |
|
2058 | $ echo 2 > foo | |
2059 | $ hg commit -m 'commit 2' |
|
2059 | $ hg commit -m 'commit 2' | |
2060 | created new head |
|
2060 | created new head | |
2061 | $ hg book -r 1 bookA |
|
2061 | $ hg book -r 1 bookA | |
2062 | $ hg book -r 2 bookB |
|
2062 | $ hg book -r 2 bookB | |
2063 |
|
2063 | |||
2064 | $ debugwireproto << EOF |
|
2064 | $ debugwireproto << EOF | |
2065 | > batchbegin |
|
2065 | > batchbegin | |
2066 | > command heads |
|
2066 | > command heads | |
2067 | > command listkeys |
|
2067 | > command listkeys | |
2068 | > namespace bookmarks |
|
2068 | > namespace bookmarks | |
2069 | > command listkeys |
|
2069 | > command listkeys | |
2070 | > namespace phases |
|
2070 | > namespace phases | |
2071 | > batchsubmit |
|
2071 | > batchsubmit | |
2072 | > EOF |
|
2072 | > EOF | |
2073 | testing ssh1 |
|
2073 | testing ssh1 | |
2074 | creating ssh peer from handshake results |
|
2074 | creating ssh peer from handshake results | |
2075 | i> write(104) -> 104: |
|
2075 | i> write(104) -> 104: | |
2076 | i> hello\n |
|
2076 | i> hello\n | |
2077 | i> between\n |
|
2077 | i> between\n | |
2078 | i> pairs 81\n |
|
2078 | i> pairs 81\n | |
2079 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
2079 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
2080 | i> flush() -> None |
|
2080 | i> flush() -> None | |
2081 | o> readline() -> 4: |
|
2081 | o> readline() -> 4: | |
2082 | o> 403\n |
|
2082 | o> 403\n | |
2083 | o> readline() -> 403: |
|
2083 | o> readline() -> 403: | |
2084 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n |
|
2084 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n | |
2085 | o> readline() -> 2: |
|
2085 | o> readline() -> 2: | |
2086 | o> 1\n |
|
2086 | o> 1\n | |
2087 | o> readline() -> 1: |
|
2087 | o> readline() -> 1: | |
2088 | o> \n |
|
2088 | o> \n | |
2089 | sending batch with 3 sub-commands |
|
2089 | sending batch with 3 sub-commands | |
2090 | i> write(6) -> 6: |
|
2090 | i> write(6) -> 6: | |
2091 | i> batch\n |
|
2091 | i> batch\n | |
2092 | i> write(4) -> 4: |
|
2092 | i> write(4) -> 4: | |
2093 | i> * 0\n |
|
2093 | i> * 0\n | |
2094 | i> write(8) -> 8: |
|
2094 | i> write(8) -> 8: | |
2095 | i> cmds 61\n |
|
2095 | i> cmds 61\n | |
2096 | i> write(61) -> 61: heads ;listkeys namespace=bookmarks;listkeys namespace=phases |
|
2096 | i> write(61) -> 61: heads ;listkeys namespace=bookmarks;listkeys namespace=phases | |
2097 | i> flush() -> None |
|
2097 | i> flush() -> None | |
2098 | o> bufferedreadline() -> 4: |
|
2098 | o> bufferedreadline() -> 4: | |
2099 | o> 278\n |
|
2099 | o> 278\n | |
2100 | o> bufferedread(278) -> 278: |
|
2100 | o> bufferedread(278) -> 278: | |
2101 | o> bfebe6bd38eebc6f8202e419c1171268987ea6a6 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n |
|
2101 | o> bfebe6bd38eebc6f8202e419c1171268987ea6a6 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n | |
2102 | o> ;bookA 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n |
|
2102 | o> ;bookA 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n | |
2103 | o> bookB bfebe6bd38eebc6f8202e419c1171268987ea6a6;4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab 1\n |
|
2103 | o> bookB bfebe6bd38eebc6f8202e419c1171268987ea6a6;4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab 1\n | |
2104 | o> bfebe6bd38eebc6f8202e419c1171268987ea6a6 1\n |
|
2104 | o> bfebe6bd38eebc6f8202e419c1171268987ea6a6 1\n | |
2105 | o> publishing True |
|
2105 | o> publishing True | |
2106 | response #0: bfebe6bd38eebc6f8202e419c1171268987ea6a6 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n |
|
2106 | response #0: bfebe6bd38eebc6f8202e419c1171268987ea6a6 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n | |
2107 | response #1: bookA 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\nbookB bfebe6bd38eebc6f8202e419c1171268987ea6a6 |
|
2107 | response #1: bookA 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\nbookB bfebe6bd38eebc6f8202e419c1171268987ea6a6 | |
2108 | response #2: 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab 1\nbfebe6bd38eebc6f8202e419c1171268987ea6a6 1\npublishing True |
|
2108 | response #2: 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab 1\nbfebe6bd38eebc6f8202e419c1171268987ea6a6 1\npublishing True | |
2109 |
|
2109 | |||
2110 | testing ssh2 |
|
2110 | testing ssh2 | |
2111 | creating ssh peer from handshake results |
|
2111 | creating ssh peer from handshake results | |
2112 | i> write(171) -> 171: |
|
2112 | i> write(171) -> 171: | |
2113 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
2113 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) | |
2114 | i> hello\n |
|
2114 | i> hello\n | |
2115 | i> between\n |
|
2115 | i> between\n | |
2116 | i> pairs 81\n |
|
2116 | i> pairs 81\n | |
2117 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
2117 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
2118 | i> flush() -> None |
|
2118 | i> flush() -> None | |
2119 | o> readline() -> 62: |
|
2119 | o> readline() -> 62: | |
2120 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
2120 | o> upgraded * exp-ssh-v2-0001\n (glob) | |
2121 | o> readline() -> 4: |
|
2121 | o> readline() -> 4: | |
2122 | o> 402\n |
|
2122 | o> 402\n | |
2123 | o> read(402) -> 402: capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch |
|
2123 | o> read(402) -> 402: capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch | |
2124 | o> read(1) -> 1: |
|
2124 | o> read(1) -> 1: | |
2125 | o> \n |
|
2125 | o> \n | |
2126 | sending batch with 3 sub-commands |
|
2126 | sending batch with 3 sub-commands | |
2127 | i> write(6) -> 6: |
|
2127 | i> write(6) -> 6: | |
2128 | i> batch\n |
|
2128 | i> batch\n | |
2129 | i> write(4) -> 4: |
|
2129 | i> write(4) -> 4: | |
2130 | i> * 0\n |
|
2130 | i> * 0\n | |
2131 | i> write(8) -> 8: |
|
2131 | i> write(8) -> 8: | |
2132 | i> cmds 61\n |
|
2132 | i> cmds 61\n | |
2133 | i> write(61) -> 61: heads ;listkeys namespace=bookmarks;listkeys namespace=phases |
|
2133 | i> write(61) -> 61: heads ;listkeys namespace=bookmarks;listkeys namespace=phases | |
2134 | i> flush() -> None |
|
2134 | i> flush() -> None | |
2135 | o> bufferedreadline() -> 4: |
|
2135 | o> bufferedreadline() -> 4: | |
2136 | o> 278\n |
|
2136 | o> 278\n | |
2137 | o> bufferedread(278) -> 278: |
|
2137 | o> bufferedread(278) -> 278: | |
2138 | o> bfebe6bd38eebc6f8202e419c1171268987ea6a6 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n |
|
2138 | o> bfebe6bd38eebc6f8202e419c1171268987ea6a6 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n | |
2139 | o> ;bookA 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n |
|
2139 | o> ;bookA 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n | |
2140 | o> bookB bfebe6bd38eebc6f8202e419c1171268987ea6a6;4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab 1\n |
|
2140 | o> bookB bfebe6bd38eebc6f8202e419c1171268987ea6a6;4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab 1\n | |
2141 | o> bfebe6bd38eebc6f8202e419c1171268987ea6a6 1\n |
|
2141 | o> bfebe6bd38eebc6f8202e419c1171268987ea6a6 1\n | |
2142 | o> publishing True |
|
2142 | o> publishing True | |
2143 | response #0: bfebe6bd38eebc6f8202e419c1171268987ea6a6 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n |
|
2143 | response #0: bfebe6bd38eebc6f8202e419c1171268987ea6a6 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n | |
2144 | response #1: bookA 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\nbookB bfebe6bd38eebc6f8202e419c1171268987ea6a6 |
|
2144 | response #1: bookA 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\nbookB bfebe6bd38eebc6f8202e419c1171268987ea6a6 | |
2145 | response #2: 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab 1\nbfebe6bd38eebc6f8202e419c1171268987ea6a6 1\npublishing True |
|
2145 | response #2: 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab 1\nbfebe6bd38eebc6f8202e419c1171268987ea6a6 1\npublishing True |
General Comments 0
You need to be logged in to leave comments.
Login now