##// END OF EJS Templates
debugcommands: add debugwireproto command...
Gregory Szorc -
r36545:72e48785 default
parent child Browse files
Show More
@@ -1,2531 +1,2734 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 socket
17 import socket
18 import ssl
18 import ssl
19 import string
19 import string
20 import subprocess
20 import sys
21 import sys
21 import tempfile
22 import tempfile
22 import time
23 import time
23
24
24 from .i18n import _
25 from .i18n import _
25 from .node import (
26 from .node import (
26 bin,
27 bin,
27 hex,
28 hex,
28 nullhex,
29 nullhex,
29 nullid,
30 nullid,
30 nullrev,
31 nullrev,
31 short,
32 short,
32 )
33 )
33 from . import (
34 from . import (
34 bundle2,
35 bundle2,
35 changegroup,
36 changegroup,
36 cmdutil,
37 cmdutil,
37 color,
38 color,
38 context,
39 context,
39 dagparser,
40 dagparser,
40 dagutil,
41 dagutil,
41 encoding,
42 encoding,
42 error,
43 error,
43 exchange,
44 exchange,
44 extensions,
45 extensions,
45 filemerge,
46 filemerge,
46 fileset,
47 fileset,
47 formatter,
48 formatter,
48 hg,
49 hg,
49 localrepo,
50 localrepo,
50 lock as lockmod,
51 lock as lockmod,
51 logcmdutil,
52 logcmdutil,
52 merge as mergemod,
53 merge as mergemod,
53 obsolete,
54 obsolete,
54 obsutil,
55 obsutil,
55 phases,
56 phases,
56 policy,
57 policy,
57 pvec,
58 pvec,
58 pycompat,
59 pycompat,
59 registrar,
60 registrar,
60 repair,
61 repair,
61 revlog,
62 revlog,
62 revset,
63 revset,
63 revsetlang,
64 revsetlang,
64 scmutil,
65 scmutil,
65 setdiscovery,
66 setdiscovery,
66 simplemerge,
67 simplemerge,
67 smartset,
68 smartset,
69 sshpeer,
68 sslutil,
70 sslutil,
69 streamclone,
71 streamclone,
70 templater,
72 templater,
71 treediscovery,
73 treediscovery,
72 upgrade,
74 upgrade,
73 url as urlmod,
75 url as urlmod,
74 util,
76 util,
75 vfs as vfsmod,
77 vfs as vfsmod,
76 wireprotoserver,
78 wireprotoserver,
77 )
79 )
78
80
79 release = lockmod.release
81 release = lockmod.release
80
82
81 command = registrar.command()
83 command = registrar.command()
82
84
83 @command('debugancestor', [], _('[INDEX] REV1 REV2'), optionalrepo=True)
85 @command('debugancestor', [], _('[INDEX] REV1 REV2'), optionalrepo=True)
84 def debugancestor(ui, repo, *args):
86 def debugancestor(ui, repo, *args):
85 """find the ancestor revision of two revisions in a given index"""
87 """find the ancestor revision of two revisions in a given index"""
86 if len(args) == 3:
88 if len(args) == 3:
87 index, rev1, rev2 = args
89 index, rev1, rev2 = args
88 r = revlog.revlog(vfsmod.vfs(pycompat.getcwd(), audit=False), index)
90 r = revlog.revlog(vfsmod.vfs(pycompat.getcwd(), audit=False), index)
89 lookup = r.lookup
91 lookup = r.lookup
90 elif len(args) == 2:
92 elif len(args) == 2:
91 if not repo:
93 if not repo:
92 raise error.Abort(_('there is no Mercurial repository here '
94 raise error.Abort(_('there is no Mercurial repository here '
93 '(.hg not found)'))
95 '(.hg not found)'))
94 rev1, rev2 = args
96 rev1, rev2 = args
95 r = repo.changelog
97 r = repo.changelog
96 lookup = repo.lookup
98 lookup = repo.lookup
97 else:
99 else:
98 raise error.Abort(_('either two or three arguments required'))
100 raise error.Abort(_('either two or three arguments required'))
99 a = r.ancestor(lookup(rev1), lookup(rev2))
101 a = r.ancestor(lookup(rev1), lookup(rev2))
100 ui.write('%d:%s\n' % (r.rev(a), hex(a)))
102 ui.write('%d:%s\n' % (r.rev(a), hex(a)))
101
103
102 @command('debugapplystreamclonebundle', [], 'FILE')
104 @command('debugapplystreamclonebundle', [], 'FILE')
103 def debugapplystreamclonebundle(ui, repo, fname):
105 def debugapplystreamclonebundle(ui, repo, fname):
104 """apply a stream clone bundle file"""
106 """apply a stream clone bundle file"""
105 f = hg.openpath(ui, fname)
107 f = hg.openpath(ui, fname)
106 gen = exchange.readbundle(ui, f, fname)
108 gen = exchange.readbundle(ui, f, fname)
107 gen.apply(repo)
109 gen.apply(repo)
108
110
109 @command('debugbuilddag',
111 @command('debugbuilddag',
110 [('m', 'mergeable-file', None, _('add single file mergeable changes')),
112 [('m', 'mergeable-file', None, _('add single file mergeable changes')),
111 ('o', 'overwritten-file', None, _('add single file all revs overwrite')),
113 ('o', 'overwritten-file', None, _('add single file all revs overwrite')),
112 ('n', 'new-file', None, _('add new file at each rev'))],
114 ('n', 'new-file', None, _('add new file at each rev'))],
113 _('[OPTION]... [TEXT]'))
115 _('[OPTION]... [TEXT]'))
114 def debugbuilddag(ui, repo, text=None,
116 def debugbuilddag(ui, repo, text=None,
115 mergeable_file=False,
117 mergeable_file=False,
116 overwritten_file=False,
118 overwritten_file=False,
117 new_file=False):
119 new_file=False):
118 """builds a repo with a given DAG from scratch in the current empty repo
120 """builds a repo with a given DAG from scratch in the current empty repo
119
121
120 The description of the DAG is read from stdin if not given on the
122 The description of the DAG is read from stdin if not given on the
121 command line.
123 command line.
122
124
123 Elements:
125 Elements:
124
126
125 - "+n" is a linear run of n nodes based on the current default parent
127 - "+n" is a linear run of n nodes based on the current default parent
126 - "." is a single node based on the current default parent
128 - "." is a single node based on the current default parent
127 - "$" resets the default parent to null (implied at the start);
129 - "$" resets the default parent to null (implied at the start);
128 otherwise the default parent is always the last node created
130 otherwise the default parent is always the last node created
129 - "<p" sets the default parent to the backref p
131 - "<p" sets the default parent to the backref p
130 - "*p" is a fork at parent p, which is a backref
132 - "*p" is a fork at parent p, which is a backref
131 - "*p1/p2" is a merge of parents p1 and p2, which are backrefs
133 - "*p1/p2" is a merge of parents p1 and p2, which are backrefs
132 - "/p2" is a merge of the preceding node and p2
134 - "/p2" is a merge of the preceding node and p2
133 - ":tag" defines a local tag for the preceding node
135 - ":tag" defines a local tag for the preceding node
134 - "@branch" sets the named branch for subsequent nodes
136 - "@branch" sets the named branch for subsequent nodes
135 - "#...\\n" is a comment up to the end of the line
137 - "#...\\n" is a comment up to the end of the line
136
138
137 Whitespace between the above elements is ignored.
139 Whitespace between the above elements is ignored.
138
140
139 A backref is either
141 A backref is either
140
142
141 - a number n, which references the node curr-n, where curr is the current
143 - a number n, which references the node curr-n, where curr is the current
142 node, or
144 node, or
143 - the name of a local tag you placed earlier using ":tag", or
145 - the name of a local tag you placed earlier using ":tag", or
144 - empty to denote the default parent.
146 - empty to denote the default parent.
145
147
146 All string valued-elements are either strictly alphanumeric, or must
148 All string valued-elements are either strictly alphanumeric, or must
147 be enclosed in double quotes ("..."), with "\\" as escape character.
149 be enclosed in double quotes ("..."), with "\\" as escape character.
148 """
150 """
149
151
150 if text is None:
152 if text is None:
151 ui.status(_("reading DAG from stdin\n"))
153 ui.status(_("reading DAG from stdin\n"))
152 text = ui.fin.read()
154 text = ui.fin.read()
153
155
154 cl = repo.changelog
156 cl = repo.changelog
155 if len(cl) > 0:
157 if len(cl) > 0:
156 raise error.Abort(_('repository is not empty'))
158 raise error.Abort(_('repository is not empty'))
157
159
158 # determine number of revs in DAG
160 # determine number of revs in DAG
159 total = 0
161 total = 0
160 for type, data in dagparser.parsedag(text):
162 for type, data in dagparser.parsedag(text):
161 if type == 'n':
163 if type == 'n':
162 total += 1
164 total += 1
163
165
164 if mergeable_file:
166 if mergeable_file:
165 linesperrev = 2
167 linesperrev = 2
166 # make a file with k lines per rev
168 # make a file with k lines per rev
167 initialmergedlines = ['%d' % i for i in xrange(0, total * linesperrev)]
169 initialmergedlines = ['%d' % i for i in xrange(0, total * linesperrev)]
168 initialmergedlines.append("")
170 initialmergedlines.append("")
169
171
170 tags = []
172 tags = []
171
173
172 wlock = lock = tr = None
174 wlock = lock = tr = None
173 try:
175 try:
174 wlock = repo.wlock()
176 wlock = repo.wlock()
175 lock = repo.lock()
177 lock = repo.lock()
176 tr = repo.transaction("builddag")
178 tr = repo.transaction("builddag")
177
179
178 at = -1
180 at = -1
179 atbranch = 'default'
181 atbranch = 'default'
180 nodeids = []
182 nodeids = []
181 id = 0
183 id = 0
182 ui.progress(_('building'), id, unit=_('revisions'), total=total)
184 ui.progress(_('building'), id, unit=_('revisions'), total=total)
183 for type, data in dagparser.parsedag(text):
185 for type, data in dagparser.parsedag(text):
184 if type == 'n':
186 if type == 'n':
185 ui.note(('node %s\n' % pycompat.bytestr(data)))
187 ui.note(('node %s\n' % pycompat.bytestr(data)))
186 id, ps = data
188 id, ps = data
187
189
188 files = []
190 files = []
189 filecontent = {}
191 filecontent = {}
190
192
191 p2 = None
193 p2 = None
192 if mergeable_file:
194 if mergeable_file:
193 fn = "mf"
195 fn = "mf"
194 p1 = repo[ps[0]]
196 p1 = repo[ps[0]]
195 if len(ps) > 1:
197 if len(ps) > 1:
196 p2 = repo[ps[1]]
198 p2 = repo[ps[1]]
197 pa = p1.ancestor(p2)
199 pa = p1.ancestor(p2)
198 base, local, other = [x[fn].data() for x in (pa, p1,
200 base, local, other = [x[fn].data() for x in (pa, p1,
199 p2)]
201 p2)]
200 m3 = simplemerge.Merge3Text(base, local, other)
202 m3 = simplemerge.Merge3Text(base, local, other)
201 ml = [l.strip() for l in m3.merge_lines()]
203 ml = [l.strip() for l in m3.merge_lines()]
202 ml.append("")
204 ml.append("")
203 elif at > 0:
205 elif at > 0:
204 ml = p1[fn].data().split("\n")
206 ml = p1[fn].data().split("\n")
205 else:
207 else:
206 ml = initialmergedlines
208 ml = initialmergedlines
207 ml[id * linesperrev] += " r%i" % id
209 ml[id * linesperrev] += " r%i" % id
208 mergedtext = "\n".join(ml)
210 mergedtext = "\n".join(ml)
209 files.append(fn)
211 files.append(fn)
210 filecontent[fn] = mergedtext
212 filecontent[fn] = mergedtext
211
213
212 if overwritten_file:
214 if overwritten_file:
213 fn = "of"
215 fn = "of"
214 files.append(fn)
216 files.append(fn)
215 filecontent[fn] = "r%i\n" % id
217 filecontent[fn] = "r%i\n" % id
216
218
217 if new_file:
219 if new_file:
218 fn = "nf%i" % id
220 fn = "nf%i" % id
219 files.append(fn)
221 files.append(fn)
220 filecontent[fn] = "r%i\n" % id
222 filecontent[fn] = "r%i\n" % id
221 if len(ps) > 1:
223 if len(ps) > 1:
222 if not p2:
224 if not p2:
223 p2 = repo[ps[1]]
225 p2 = repo[ps[1]]
224 for fn in p2:
226 for fn in p2:
225 if fn.startswith("nf"):
227 if fn.startswith("nf"):
226 files.append(fn)
228 files.append(fn)
227 filecontent[fn] = p2[fn].data()
229 filecontent[fn] = p2[fn].data()
228
230
229 def fctxfn(repo, cx, path):
231 def fctxfn(repo, cx, path):
230 if path in filecontent:
232 if path in filecontent:
231 return context.memfilectx(repo, cx, path,
233 return context.memfilectx(repo, cx, path,
232 filecontent[path])
234 filecontent[path])
233 return None
235 return None
234
236
235 if len(ps) == 0 or ps[0] < 0:
237 if len(ps) == 0 or ps[0] < 0:
236 pars = [None, None]
238 pars = [None, None]
237 elif len(ps) == 1:
239 elif len(ps) == 1:
238 pars = [nodeids[ps[0]], None]
240 pars = [nodeids[ps[0]], None]
239 else:
241 else:
240 pars = [nodeids[p] for p in ps]
242 pars = [nodeids[p] for p in ps]
241 cx = context.memctx(repo, pars, "r%i" % id, files, fctxfn,
243 cx = context.memctx(repo, pars, "r%i" % id, files, fctxfn,
242 date=(id, 0),
244 date=(id, 0),
243 user="debugbuilddag",
245 user="debugbuilddag",
244 extra={'branch': atbranch})
246 extra={'branch': atbranch})
245 nodeid = repo.commitctx(cx)
247 nodeid = repo.commitctx(cx)
246 nodeids.append(nodeid)
248 nodeids.append(nodeid)
247 at = id
249 at = id
248 elif type == 'l':
250 elif type == 'l':
249 id, name = data
251 id, name = data
250 ui.note(('tag %s\n' % name))
252 ui.note(('tag %s\n' % name))
251 tags.append("%s %s\n" % (hex(repo.changelog.node(id)), name))
253 tags.append("%s %s\n" % (hex(repo.changelog.node(id)), name))
252 elif type == 'a':
254 elif type == 'a':
253 ui.note(('branch %s\n' % data))
255 ui.note(('branch %s\n' % data))
254 atbranch = data
256 atbranch = data
255 ui.progress(_('building'), id, unit=_('revisions'), total=total)
257 ui.progress(_('building'), id, unit=_('revisions'), total=total)
256 tr.close()
258 tr.close()
257
259
258 if tags:
260 if tags:
259 repo.vfs.write("localtags", "".join(tags))
261 repo.vfs.write("localtags", "".join(tags))
260 finally:
262 finally:
261 ui.progress(_('building'), None)
263 ui.progress(_('building'), None)
262 release(tr, lock, wlock)
264 release(tr, lock, wlock)
263
265
264 def _debugchangegroup(ui, gen, all=None, indent=0, **opts):
266 def _debugchangegroup(ui, gen, all=None, indent=0, **opts):
265 indent_string = ' ' * indent
267 indent_string = ' ' * indent
266 if all:
268 if all:
267 ui.write(("%sformat: id, p1, p2, cset, delta base, len(delta)\n")
269 ui.write(("%sformat: id, p1, p2, cset, delta base, len(delta)\n")
268 % indent_string)
270 % indent_string)
269
271
270 def showchunks(named):
272 def showchunks(named):
271 ui.write("\n%s%s\n" % (indent_string, named))
273 ui.write("\n%s%s\n" % (indent_string, named))
272 for deltadata in gen.deltaiter():
274 for deltadata in gen.deltaiter():
273 node, p1, p2, cs, deltabase, delta, flags = deltadata
275 node, p1, p2, cs, deltabase, delta, flags = deltadata
274 ui.write("%s%s %s %s %s %s %d\n" %
276 ui.write("%s%s %s %s %s %s %d\n" %
275 (indent_string, hex(node), hex(p1), hex(p2),
277 (indent_string, hex(node), hex(p1), hex(p2),
276 hex(cs), hex(deltabase), len(delta)))
278 hex(cs), hex(deltabase), len(delta)))
277
279
278 chunkdata = gen.changelogheader()
280 chunkdata = gen.changelogheader()
279 showchunks("changelog")
281 showchunks("changelog")
280 chunkdata = gen.manifestheader()
282 chunkdata = gen.manifestheader()
281 showchunks("manifest")
283 showchunks("manifest")
282 for chunkdata in iter(gen.filelogheader, {}):
284 for chunkdata in iter(gen.filelogheader, {}):
283 fname = chunkdata['filename']
285 fname = chunkdata['filename']
284 showchunks(fname)
286 showchunks(fname)
285 else:
287 else:
286 if isinstance(gen, bundle2.unbundle20):
288 if isinstance(gen, bundle2.unbundle20):
287 raise error.Abort(_('use debugbundle2 for this file'))
289 raise error.Abort(_('use debugbundle2 for this file'))
288 chunkdata = gen.changelogheader()
290 chunkdata = gen.changelogheader()
289 for deltadata in gen.deltaiter():
291 for deltadata in gen.deltaiter():
290 node, p1, p2, cs, deltabase, delta, flags = deltadata
292 node, p1, p2, cs, deltabase, delta, flags = deltadata
291 ui.write("%s%s\n" % (indent_string, hex(node)))
293 ui.write("%s%s\n" % (indent_string, hex(node)))
292
294
293 def _debugobsmarkers(ui, part, indent=0, **opts):
295 def _debugobsmarkers(ui, part, indent=0, **opts):
294 """display version and markers contained in 'data'"""
296 """display version and markers contained in 'data'"""
295 opts = pycompat.byteskwargs(opts)
297 opts = pycompat.byteskwargs(opts)
296 data = part.read()
298 data = part.read()
297 indent_string = ' ' * indent
299 indent_string = ' ' * indent
298 try:
300 try:
299 version, markers = obsolete._readmarkers(data)
301 version, markers = obsolete._readmarkers(data)
300 except error.UnknownVersion as exc:
302 except error.UnknownVersion as exc:
301 msg = "%sunsupported version: %s (%d bytes)\n"
303 msg = "%sunsupported version: %s (%d bytes)\n"
302 msg %= indent_string, exc.version, len(data)
304 msg %= indent_string, exc.version, len(data)
303 ui.write(msg)
305 ui.write(msg)
304 else:
306 else:
305 msg = "%sversion: %d (%d bytes)\n"
307 msg = "%sversion: %d (%d bytes)\n"
306 msg %= indent_string, version, len(data)
308 msg %= indent_string, version, len(data)
307 ui.write(msg)
309 ui.write(msg)
308 fm = ui.formatter('debugobsolete', opts)
310 fm = ui.formatter('debugobsolete', opts)
309 for rawmarker in sorted(markers):
311 for rawmarker in sorted(markers):
310 m = obsutil.marker(None, rawmarker)
312 m = obsutil.marker(None, rawmarker)
311 fm.startitem()
313 fm.startitem()
312 fm.plain(indent_string)
314 fm.plain(indent_string)
313 cmdutil.showmarker(fm, m)
315 cmdutil.showmarker(fm, m)
314 fm.end()
316 fm.end()
315
317
316 def _debugphaseheads(ui, data, indent=0):
318 def _debugphaseheads(ui, data, indent=0):
317 """display version and markers contained in 'data'"""
319 """display version and markers contained in 'data'"""
318 indent_string = ' ' * indent
320 indent_string = ' ' * indent
319 headsbyphase = phases.binarydecode(data)
321 headsbyphase = phases.binarydecode(data)
320 for phase in phases.allphases:
322 for phase in phases.allphases:
321 for head in headsbyphase[phase]:
323 for head in headsbyphase[phase]:
322 ui.write(indent_string)
324 ui.write(indent_string)
323 ui.write('%s %s\n' % (hex(head), phases.phasenames[phase]))
325 ui.write('%s %s\n' % (hex(head), phases.phasenames[phase]))
324
326
325 def _quasirepr(thing):
327 def _quasirepr(thing):
326 if isinstance(thing, (dict, util.sortdict, collections.OrderedDict)):
328 if isinstance(thing, (dict, util.sortdict, collections.OrderedDict)):
327 return '{%s}' % (
329 return '{%s}' % (
328 b', '.join(b'%s: %s' % (k, thing[k]) for k in sorted(thing)))
330 b', '.join(b'%s: %s' % (k, thing[k]) for k in sorted(thing)))
329 return pycompat.bytestr(repr(thing))
331 return pycompat.bytestr(repr(thing))
330
332
331 def _debugbundle2(ui, gen, all=None, **opts):
333 def _debugbundle2(ui, gen, all=None, **opts):
332 """lists the contents of a bundle2"""
334 """lists the contents of a bundle2"""
333 if not isinstance(gen, bundle2.unbundle20):
335 if not isinstance(gen, bundle2.unbundle20):
334 raise error.Abort(_('not a bundle2 file'))
336 raise error.Abort(_('not a bundle2 file'))
335 ui.write(('Stream params: %s\n' % _quasirepr(gen.params)))
337 ui.write(('Stream params: %s\n' % _quasirepr(gen.params)))
336 parttypes = opts.get(r'part_type', [])
338 parttypes = opts.get(r'part_type', [])
337 for part in gen.iterparts():
339 for part in gen.iterparts():
338 if parttypes and part.type not in parttypes:
340 if parttypes and part.type not in parttypes:
339 continue
341 continue
340 ui.write('%s -- %s\n' % (part.type, _quasirepr(part.params)))
342 ui.write('%s -- %s\n' % (part.type, _quasirepr(part.params)))
341 if part.type == 'changegroup':
343 if part.type == 'changegroup':
342 version = part.params.get('version', '01')
344 version = part.params.get('version', '01')
343 cg = changegroup.getunbundler(version, part, 'UN')
345 cg = changegroup.getunbundler(version, part, 'UN')
344 _debugchangegroup(ui, cg, all=all, indent=4, **opts)
346 _debugchangegroup(ui, cg, all=all, indent=4, **opts)
345 if part.type == 'obsmarkers':
347 if part.type == 'obsmarkers':
346 _debugobsmarkers(ui, part, indent=4, **opts)
348 _debugobsmarkers(ui, part, indent=4, **opts)
347 if part.type == 'phase-heads':
349 if part.type == 'phase-heads':
348 _debugphaseheads(ui, part, indent=4)
350 _debugphaseheads(ui, part, indent=4)
349
351
350 @command('debugbundle',
352 @command('debugbundle',
351 [('a', 'all', None, _('show all details')),
353 [('a', 'all', None, _('show all details')),
352 ('', 'part-type', [], _('show only the named part type')),
354 ('', 'part-type', [], _('show only the named part type')),
353 ('', 'spec', None, _('print the bundlespec of the bundle'))],
355 ('', 'spec', None, _('print the bundlespec of the bundle'))],
354 _('FILE'),
356 _('FILE'),
355 norepo=True)
357 norepo=True)
356 def debugbundle(ui, bundlepath, all=None, spec=None, **opts):
358 def debugbundle(ui, bundlepath, all=None, spec=None, **opts):
357 """lists the contents of a bundle"""
359 """lists the contents of a bundle"""
358 with hg.openpath(ui, bundlepath) as f:
360 with hg.openpath(ui, bundlepath) as f:
359 if spec:
361 if spec:
360 spec = exchange.getbundlespec(ui, f)
362 spec = exchange.getbundlespec(ui, f)
361 ui.write('%s\n' % spec)
363 ui.write('%s\n' % spec)
362 return
364 return
363
365
364 gen = exchange.readbundle(ui, f, bundlepath)
366 gen = exchange.readbundle(ui, f, bundlepath)
365 if isinstance(gen, bundle2.unbundle20):
367 if isinstance(gen, bundle2.unbundle20):
366 return _debugbundle2(ui, gen, all=all, **opts)
368 return _debugbundle2(ui, gen, all=all, **opts)
367 _debugchangegroup(ui, gen, all=all, **opts)
369 _debugchangegroup(ui, gen, all=all, **opts)
368
370
369 @command('debugcapabilities',
371 @command('debugcapabilities',
370 [], _('PATH'),
372 [], _('PATH'),
371 norepo=True)
373 norepo=True)
372 def debugcapabilities(ui, path, **opts):
374 def debugcapabilities(ui, path, **opts):
373 """lists the capabilities of a remote peer"""
375 """lists the capabilities of a remote peer"""
374 opts = pycompat.byteskwargs(opts)
376 opts = pycompat.byteskwargs(opts)
375 peer = hg.peer(ui, opts, path)
377 peer = hg.peer(ui, opts, path)
376 caps = peer.capabilities()
378 caps = peer.capabilities()
377 ui.write(('Main capabilities:\n'))
379 ui.write(('Main capabilities:\n'))
378 for c in sorted(caps):
380 for c in sorted(caps):
379 ui.write((' %s\n') % c)
381 ui.write((' %s\n') % c)
380 b2caps = bundle2.bundle2caps(peer)
382 b2caps = bundle2.bundle2caps(peer)
381 if b2caps:
383 if b2caps:
382 ui.write(('Bundle2 capabilities:\n'))
384 ui.write(('Bundle2 capabilities:\n'))
383 for key, values in sorted(b2caps.iteritems()):
385 for key, values in sorted(b2caps.iteritems()):
384 ui.write((' %s\n') % key)
386 ui.write((' %s\n') % key)
385 for v in values:
387 for v in values:
386 ui.write((' %s\n') % v)
388 ui.write((' %s\n') % v)
387
389
388 @command('debugcheckstate', [], '')
390 @command('debugcheckstate', [], '')
389 def debugcheckstate(ui, repo):
391 def debugcheckstate(ui, repo):
390 """validate the correctness of the current dirstate"""
392 """validate the correctness of the current dirstate"""
391 parent1, parent2 = repo.dirstate.parents()
393 parent1, parent2 = repo.dirstate.parents()
392 m1 = repo[parent1].manifest()
394 m1 = repo[parent1].manifest()
393 m2 = repo[parent2].manifest()
395 m2 = repo[parent2].manifest()
394 errors = 0
396 errors = 0
395 for f in repo.dirstate:
397 for f in repo.dirstate:
396 state = repo.dirstate[f]
398 state = repo.dirstate[f]
397 if state in "nr" and f not in m1:
399 if state in "nr" and f not in m1:
398 ui.warn(_("%s in state %s, but not in manifest1\n") % (f, state))
400 ui.warn(_("%s in state %s, but not in manifest1\n") % (f, state))
399 errors += 1
401 errors += 1
400 if state in "a" and f in m1:
402 if state in "a" and f in m1:
401 ui.warn(_("%s in state %s, but also in manifest1\n") % (f, state))
403 ui.warn(_("%s in state %s, but also in manifest1\n") % (f, state))
402 errors += 1
404 errors += 1
403 if state in "m" and f not in m1 and f not in m2:
405 if state in "m" and f not in m1 and f not in m2:
404 ui.warn(_("%s in state %s, but not in either manifest\n") %
406 ui.warn(_("%s in state %s, but not in either manifest\n") %
405 (f, state))
407 (f, state))
406 errors += 1
408 errors += 1
407 for f in m1:
409 for f in m1:
408 state = repo.dirstate[f]
410 state = repo.dirstate[f]
409 if state not in "nrm":
411 if state not in "nrm":
410 ui.warn(_("%s in manifest1, but listed as state %s") % (f, state))
412 ui.warn(_("%s in manifest1, but listed as state %s") % (f, state))
411 errors += 1
413 errors += 1
412 if errors:
414 if errors:
413 error = _(".hg/dirstate inconsistent with current parent's manifest")
415 error = _(".hg/dirstate inconsistent with current parent's manifest")
414 raise error.Abort(error)
416 raise error.Abort(error)
415
417
416 @command('debugcolor',
418 @command('debugcolor',
417 [('', 'style', None, _('show all configured styles'))],
419 [('', 'style', None, _('show all configured styles'))],
418 'hg debugcolor')
420 'hg debugcolor')
419 def debugcolor(ui, repo, **opts):
421 def debugcolor(ui, repo, **opts):
420 """show available color, effects or style"""
422 """show available color, effects or style"""
421 ui.write(('color mode: %s\n') % ui._colormode)
423 ui.write(('color mode: %s\n') % ui._colormode)
422 if opts.get(r'style'):
424 if opts.get(r'style'):
423 return _debugdisplaystyle(ui)
425 return _debugdisplaystyle(ui)
424 else:
426 else:
425 return _debugdisplaycolor(ui)
427 return _debugdisplaycolor(ui)
426
428
427 def _debugdisplaycolor(ui):
429 def _debugdisplaycolor(ui):
428 ui = ui.copy()
430 ui = ui.copy()
429 ui._styles.clear()
431 ui._styles.clear()
430 for effect in color._activeeffects(ui).keys():
432 for effect in color._activeeffects(ui).keys():
431 ui._styles[effect] = effect
433 ui._styles[effect] = effect
432 if ui._terminfoparams:
434 if ui._terminfoparams:
433 for k, v in ui.configitems('color'):
435 for k, v in ui.configitems('color'):
434 if k.startswith('color.'):
436 if k.startswith('color.'):
435 ui._styles[k] = k[6:]
437 ui._styles[k] = k[6:]
436 elif k.startswith('terminfo.'):
438 elif k.startswith('terminfo.'):
437 ui._styles[k] = k[9:]
439 ui._styles[k] = k[9:]
438 ui.write(_('available colors:\n'))
440 ui.write(_('available colors:\n'))
439 # sort label with a '_' after the other to group '_background' entry.
441 # sort label with a '_' after the other to group '_background' entry.
440 items = sorted(ui._styles.items(),
442 items = sorted(ui._styles.items(),
441 key=lambda i: ('_' in i[0], i[0], i[1]))
443 key=lambda i: ('_' in i[0], i[0], i[1]))
442 for colorname, label in items:
444 for colorname, label in items:
443 ui.write(('%s\n') % colorname, label=label)
445 ui.write(('%s\n') % colorname, label=label)
444
446
445 def _debugdisplaystyle(ui):
447 def _debugdisplaystyle(ui):
446 ui.write(_('available style:\n'))
448 ui.write(_('available style:\n'))
447 width = max(len(s) for s in ui._styles)
449 width = max(len(s) for s in ui._styles)
448 for label, effects in sorted(ui._styles.items()):
450 for label, effects in sorted(ui._styles.items()):
449 ui.write('%s' % label, label=label)
451 ui.write('%s' % label, label=label)
450 if effects:
452 if effects:
451 # 50
453 # 50
452 ui.write(': ')
454 ui.write(': ')
453 ui.write(' ' * (max(0, width - len(label))))
455 ui.write(' ' * (max(0, width - len(label))))
454 ui.write(', '.join(ui.label(e, e) for e in effects.split()))
456 ui.write(', '.join(ui.label(e, e) for e in effects.split()))
455 ui.write('\n')
457 ui.write('\n')
456
458
457 @command('debugcreatestreamclonebundle', [], 'FILE')
459 @command('debugcreatestreamclonebundle', [], 'FILE')
458 def debugcreatestreamclonebundle(ui, repo, fname):
460 def debugcreatestreamclonebundle(ui, repo, fname):
459 """create a stream clone bundle file
461 """create a stream clone bundle file
460
462
461 Stream bundles are special bundles that are essentially archives of
463 Stream bundles are special bundles that are essentially archives of
462 revlog files. They are commonly used for cloning very quickly.
464 revlog files. They are commonly used for cloning very quickly.
463 """
465 """
464 # TODO we may want to turn this into an abort when this functionality
466 # TODO we may want to turn this into an abort when this functionality
465 # is moved into `hg bundle`.
467 # is moved into `hg bundle`.
466 if phases.hassecret(repo):
468 if phases.hassecret(repo):
467 ui.warn(_('(warning: stream clone bundle will contain secret '
469 ui.warn(_('(warning: stream clone bundle will contain secret '
468 'revisions)\n'))
470 'revisions)\n'))
469
471
470 requirements, gen = streamclone.generatebundlev1(repo)
472 requirements, gen = streamclone.generatebundlev1(repo)
471 changegroup.writechunks(ui, gen, fname)
473 changegroup.writechunks(ui, gen, fname)
472
474
473 ui.write(_('bundle requirements: %s\n') % ', '.join(sorted(requirements)))
475 ui.write(_('bundle requirements: %s\n') % ', '.join(sorted(requirements)))
474
476
475 @command('debugdag',
477 @command('debugdag',
476 [('t', 'tags', None, _('use tags as labels')),
478 [('t', 'tags', None, _('use tags as labels')),
477 ('b', 'branches', None, _('annotate with branch names')),
479 ('b', 'branches', None, _('annotate with branch names')),
478 ('', 'dots', None, _('use dots for runs')),
480 ('', 'dots', None, _('use dots for runs')),
479 ('s', 'spaces', None, _('separate elements by spaces'))],
481 ('s', 'spaces', None, _('separate elements by spaces'))],
480 _('[OPTION]... [FILE [REV]...]'),
482 _('[OPTION]... [FILE [REV]...]'),
481 optionalrepo=True)
483 optionalrepo=True)
482 def debugdag(ui, repo, file_=None, *revs, **opts):
484 def debugdag(ui, repo, file_=None, *revs, **opts):
483 """format the changelog or an index DAG as a concise textual description
485 """format the changelog or an index DAG as a concise textual description
484
486
485 If you pass a revlog index, the revlog's DAG is emitted. If you list
487 If you pass a revlog index, the revlog's DAG is emitted. If you list
486 revision numbers, they get labeled in the output as rN.
488 revision numbers, they get labeled in the output as rN.
487
489
488 Otherwise, the changelog DAG of the current repo is emitted.
490 Otherwise, the changelog DAG of the current repo is emitted.
489 """
491 """
490 spaces = opts.get(r'spaces')
492 spaces = opts.get(r'spaces')
491 dots = opts.get(r'dots')
493 dots = opts.get(r'dots')
492 if file_:
494 if file_:
493 rlog = revlog.revlog(vfsmod.vfs(pycompat.getcwd(), audit=False),
495 rlog = revlog.revlog(vfsmod.vfs(pycompat.getcwd(), audit=False),
494 file_)
496 file_)
495 revs = set((int(r) for r in revs))
497 revs = set((int(r) for r in revs))
496 def events():
498 def events():
497 for r in rlog:
499 for r in rlog:
498 yield 'n', (r, list(p for p in rlog.parentrevs(r)
500 yield 'n', (r, list(p for p in rlog.parentrevs(r)
499 if p != -1))
501 if p != -1))
500 if r in revs:
502 if r in revs:
501 yield 'l', (r, "r%i" % r)
503 yield 'l', (r, "r%i" % r)
502 elif repo:
504 elif repo:
503 cl = repo.changelog
505 cl = repo.changelog
504 tags = opts.get(r'tags')
506 tags = opts.get(r'tags')
505 branches = opts.get(r'branches')
507 branches = opts.get(r'branches')
506 if tags:
508 if tags:
507 labels = {}
509 labels = {}
508 for l, n in repo.tags().items():
510 for l, n in repo.tags().items():
509 labels.setdefault(cl.rev(n), []).append(l)
511 labels.setdefault(cl.rev(n), []).append(l)
510 def events():
512 def events():
511 b = "default"
513 b = "default"
512 for r in cl:
514 for r in cl:
513 if branches:
515 if branches:
514 newb = cl.read(cl.node(r))[5]['branch']
516 newb = cl.read(cl.node(r))[5]['branch']
515 if newb != b:
517 if newb != b:
516 yield 'a', newb
518 yield 'a', newb
517 b = newb
519 b = newb
518 yield 'n', (r, list(p for p in cl.parentrevs(r)
520 yield 'n', (r, list(p for p in cl.parentrevs(r)
519 if p != -1))
521 if p != -1))
520 if tags:
522 if tags:
521 ls = labels.get(r)
523 ls = labels.get(r)
522 if ls:
524 if ls:
523 for l in ls:
525 for l in ls:
524 yield 'l', (r, l)
526 yield 'l', (r, l)
525 else:
527 else:
526 raise error.Abort(_('need repo for changelog dag'))
528 raise error.Abort(_('need repo for changelog dag'))
527
529
528 for line in dagparser.dagtextlines(events(),
530 for line in dagparser.dagtextlines(events(),
529 addspaces=spaces,
531 addspaces=spaces,
530 wraplabels=True,
532 wraplabels=True,
531 wrapannotations=True,
533 wrapannotations=True,
532 wrapnonlinear=dots,
534 wrapnonlinear=dots,
533 usedots=dots,
535 usedots=dots,
534 maxlinewidth=70):
536 maxlinewidth=70):
535 ui.write(line)
537 ui.write(line)
536 ui.write("\n")
538 ui.write("\n")
537
539
538 @command('debugdata', cmdutil.debugrevlogopts, _('-c|-m|FILE REV'))
540 @command('debugdata', cmdutil.debugrevlogopts, _('-c|-m|FILE REV'))
539 def debugdata(ui, repo, file_, rev=None, **opts):
541 def debugdata(ui, repo, file_, rev=None, **opts):
540 """dump the contents of a data file revision"""
542 """dump the contents of a data file revision"""
541 opts = pycompat.byteskwargs(opts)
543 opts = pycompat.byteskwargs(opts)
542 if opts.get('changelog') or opts.get('manifest') or opts.get('dir'):
544 if opts.get('changelog') or opts.get('manifest') or opts.get('dir'):
543 if rev is not None:
545 if rev is not None:
544 raise error.CommandError('debugdata', _('invalid arguments'))
546 raise error.CommandError('debugdata', _('invalid arguments'))
545 file_, rev = None, file_
547 file_, rev = None, file_
546 elif rev is None:
548 elif rev is None:
547 raise error.CommandError('debugdata', _('invalid arguments'))
549 raise error.CommandError('debugdata', _('invalid arguments'))
548 r = cmdutil.openrevlog(repo, 'debugdata', file_, opts)
550 r = cmdutil.openrevlog(repo, 'debugdata', file_, opts)
549 try:
551 try:
550 ui.write(r.revision(r.lookup(rev), raw=True))
552 ui.write(r.revision(r.lookup(rev), raw=True))
551 except KeyError:
553 except KeyError:
552 raise error.Abort(_('invalid revision identifier %s') % rev)
554 raise error.Abort(_('invalid revision identifier %s') % rev)
553
555
554 @command('debugdate',
556 @command('debugdate',
555 [('e', 'extended', None, _('try extended date formats'))],
557 [('e', 'extended', None, _('try extended date formats'))],
556 _('[-e] DATE [RANGE]'),
558 _('[-e] DATE [RANGE]'),
557 norepo=True, optionalrepo=True)
559 norepo=True, optionalrepo=True)
558 def debugdate(ui, date, range=None, **opts):
560 def debugdate(ui, date, range=None, **opts):
559 """parse and display a date"""
561 """parse and display a date"""
560 if opts[r"extended"]:
562 if opts[r"extended"]:
561 d = util.parsedate(date, util.extendeddateformats)
563 d = util.parsedate(date, util.extendeddateformats)
562 else:
564 else:
563 d = util.parsedate(date)
565 d = util.parsedate(date)
564 ui.write(("internal: %d %d\n") % d)
566 ui.write(("internal: %d %d\n") % d)
565 ui.write(("standard: %s\n") % util.datestr(d))
567 ui.write(("standard: %s\n") % util.datestr(d))
566 if range:
568 if range:
567 m = util.matchdate(range)
569 m = util.matchdate(range)
568 ui.write(("match: %s\n") % m(d[0]))
570 ui.write(("match: %s\n") % m(d[0]))
569
571
570 @command('debugdeltachain',
572 @command('debugdeltachain',
571 cmdutil.debugrevlogopts + cmdutil.formatteropts,
573 cmdutil.debugrevlogopts + cmdutil.formatteropts,
572 _('-c|-m|FILE'),
574 _('-c|-m|FILE'),
573 optionalrepo=True)
575 optionalrepo=True)
574 def debugdeltachain(ui, repo, file_=None, **opts):
576 def debugdeltachain(ui, repo, file_=None, **opts):
575 """dump information about delta chains in a revlog
577 """dump information about delta chains in a revlog
576
578
577 Output can be templatized. Available template keywords are:
579 Output can be templatized. Available template keywords are:
578
580
579 :``rev``: revision number
581 :``rev``: revision number
580 :``chainid``: delta chain identifier (numbered by unique base)
582 :``chainid``: delta chain identifier (numbered by unique base)
581 :``chainlen``: delta chain length to this revision
583 :``chainlen``: delta chain length to this revision
582 :``prevrev``: previous revision in delta chain
584 :``prevrev``: previous revision in delta chain
583 :``deltatype``: role of delta / how it was computed
585 :``deltatype``: role of delta / how it was computed
584 :``compsize``: compressed size of revision
586 :``compsize``: compressed size of revision
585 :``uncompsize``: uncompressed size of revision
587 :``uncompsize``: uncompressed size of revision
586 :``chainsize``: total size of compressed revisions in chain
588 :``chainsize``: total size of compressed revisions in chain
587 :``chainratio``: total chain size divided by uncompressed revision size
589 :``chainratio``: total chain size divided by uncompressed revision size
588 (new delta chains typically start at ratio 2.00)
590 (new delta chains typically start at ratio 2.00)
589 :``lindist``: linear distance from base revision in delta chain to end
591 :``lindist``: linear distance from base revision in delta chain to end
590 of this revision
592 of this revision
591 :``extradist``: total size of revisions not part of this delta chain from
593 :``extradist``: total size of revisions not part of this delta chain from
592 base of delta chain to end of this revision; a measurement
594 base of delta chain to end of this revision; a measurement
593 of how much extra data we need to read/seek across to read
595 of how much extra data we need to read/seek across to read
594 the delta chain for this revision
596 the delta chain for this revision
595 :``extraratio``: extradist divided by chainsize; another representation of
597 :``extraratio``: extradist divided by chainsize; another representation of
596 how much unrelated data is needed to load this delta chain
598 how much unrelated data is needed to load this delta chain
597
599
598 If the repository is configured to use the sparse read, additional keywords
600 If the repository is configured to use the sparse read, additional keywords
599 are available:
601 are available:
600
602
601 :``readsize``: total size of data read from the disk for a revision
603 :``readsize``: total size of data read from the disk for a revision
602 (sum of the sizes of all the blocks)
604 (sum of the sizes of all the blocks)
603 :``largestblock``: size of the largest block of data read from the disk
605 :``largestblock``: size of the largest block of data read from the disk
604 :``readdensity``: density of useful bytes in the data read from the disk
606 :``readdensity``: density of useful bytes in the data read from the disk
605 :``srchunks``: in how many data hunks the whole revision would be read
607 :``srchunks``: in how many data hunks the whole revision would be read
606
608
607 The sparse read can be enabled with experimental.sparse-read = True
609 The sparse read can be enabled with experimental.sparse-read = True
608 """
610 """
609 opts = pycompat.byteskwargs(opts)
611 opts = pycompat.byteskwargs(opts)
610 r = cmdutil.openrevlog(repo, 'debugdeltachain', file_, opts)
612 r = cmdutil.openrevlog(repo, 'debugdeltachain', file_, opts)
611 index = r.index
613 index = r.index
612 generaldelta = r.version & revlog.FLAG_GENERALDELTA
614 generaldelta = r.version & revlog.FLAG_GENERALDELTA
613 withsparseread = getattr(r, '_withsparseread', False)
615 withsparseread = getattr(r, '_withsparseread', False)
614
616
615 def revinfo(rev):
617 def revinfo(rev):
616 e = index[rev]
618 e = index[rev]
617 compsize = e[1]
619 compsize = e[1]
618 uncompsize = e[2]
620 uncompsize = e[2]
619 chainsize = 0
621 chainsize = 0
620
622
621 if generaldelta:
623 if generaldelta:
622 if e[3] == e[5]:
624 if e[3] == e[5]:
623 deltatype = 'p1'
625 deltatype = 'p1'
624 elif e[3] == e[6]:
626 elif e[3] == e[6]:
625 deltatype = 'p2'
627 deltatype = 'p2'
626 elif e[3] == rev - 1:
628 elif e[3] == rev - 1:
627 deltatype = 'prev'
629 deltatype = 'prev'
628 elif e[3] == rev:
630 elif e[3] == rev:
629 deltatype = 'base'
631 deltatype = 'base'
630 else:
632 else:
631 deltatype = 'other'
633 deltatype = 'other'
632 else:
634 else:
633 if e[3] == rev:
635 if e[3] == rev:
634 deltatype = 'base'
636 deltatype = 'base'
635 else:
637 else:
636 deltatype = 'prev'
638 deltatype = 'prev'
637
639
638 chain = r._deltachain(rev)[0]
640 chain = r._deltachain(rev)[0]
639 for iterrev in chain:
641 for iterrev in chain:
640 e = index[iterrev]
642 e = index[iterrev]
641 chainsize += e[1]
643 chainsize += e[1]
642
644
643 return compsize, uncompsize, deltatype, chain, chainsize
645 return compsize, uncompsize, deltatype, chain, chainsize
644
646
645 fm = ui.formatter('debugdeltachain', opts)
647 fm = ui.formatter('debugdeltachain', opts)
646
648
647 fm.plain(' rev chain# chainlen prev delta '
649 fm.plain(' rev chain# chainlen prev delta '
648 'size rawsize chainsize ratio lindist extradist '
650 'size rawsize chainsize ratio lindist extradist '
649 'extraratio')
651 'extraratio')
650 if withsparseread:
652 if withsparseread:
651 fm.plain(' readsize largestblk rddensity srchunks')
653 fm.plain(' readsize largestblk rddensity srchunks')
652 fm.plain('\n')
654 fm.plain('\n')
653
655
654 chainbases = {}
656 chainbases = {}
655 for rev in r:
657 for rev in r:
656 comp, uncomp, deltatype, chain, chainsize = revinfo(rev)
658 comp, uncomp, deltatype, chain, chainsize = revinfo(rev)
657 chainbase = chain[0]
659 chainbase = chain[0]
658 chainid = chainbases.setdefault(chainbase, len(chainbases) + 1)
660 chainid = chainbases.setdefault(chainbase, len(chainbases) + 1)
659 start = r.start
661 start = r.start
660 length = r.length
662 length = r.length
661 basestart = start(chainbase)
663 basestart = start(chainbase)
662 revstart = start(rev)
664 revstart = start(rev)
663 lineardist = revstart + comp - basestart
665 lineardist = revstart + comp - basestart
664 extradist = lineardist - chainsize
666 extradist = lineardist - chainsize
665 try:
667 try:
666 prevrev = chain[-2]
668 prevrev = chain[-2]
667 except IndexError:
669 except IndexError:
668 prevrev = -1
670 prevrev = -1
669
671
670 chainratio = float(chainsize) / float(uncomp)
672 chainratio = float(chainsize) / float(uncomp)
671 extraratio = float(extradist) / float(chainsize)
673 extraratio = float(extradist) / float(chainsize)
672
674
673 fm.startitem()
675 fm.startitem()
674 fm.write('rev chainid chainlen prevrev deltatype compsize '
676 fm.write('rev chainid chainlen prevrev deltatype compsize '
675 'uncompsize chainsize chainratio lindist extradist '
677 'uncompsize chainsize chainratio lindist extradist '
676 'extraratio',
678 'extraratio',
677 '%7d %7d %8d %8d %7s %10d %10d %10d %9.5f %9d %9d %10.5f',
679 '%7d %7d %8d %8d %7s %10d %10d %10d %9.5f %9d %9d %10.5f',
678 rev, chainid, len(chain), prevrev, deltatype, comp,
680 rev, chainid, len(chain), prevrev, deltatype, comp,
679 uncomp, chainsize, chainratio, lineardist, extradist,
681 uncomp, chainsize, chainratio, lineardist, extradist,
680 extraratio,
682 extraratio,
681 rev=rev, chainid=chainid, chainlen=len(chain),
683 rev=rev, chainid=chainid, chainlen=len(chain),
682 prevrev=prevrev, deltatype=deltatype, compsize=comp,
684 prevrev=prevrev, deltatype=deltatype, compsize=comp,
683 uncompsize=uncomp, chainsize=chainsize,
685 uncompsize=uncomp, chainsize=chainsize,
684 chainratio=chainratio, lindist=lineardist,
686 chainratio=chainratio, lindist=lineardist,
685 extradist=extradist, extraratio=extraratio)
687 extradist=extradist, extraratio=extraratio)
686 if withsparseread:
688 if withsparseread:
687 readsize = 0
689 readsize = 0
688 largestblock = 0
690 largestblock = 0
689 srchunks = 0
691 srchunks = 0
690
692
691 for revschunk in revlog._slicechunk(r, chain):
693 for revschunk in revlog._slicechunk(r, chain):
692 srchunks += 1
694 srchunks += 1
693 blkend = start(revschunk[-1]) + length(revschunk[-1])
695 blkend = start(revschunk[-1]) + length(revschunk[-1])
694 blksize = blkend - start(revschunk[0])
696 blksize = blkend - start(revschunk[0])
695
697
696 readsize += blksize
698 readsize += blksize
697 if largestblock < blksize:
699 if largestblock < blksize:
698 largestblock = blksize
700 largestblock = blksize
699
701
700 readdensity = float(chainsize) / float(readsize)
702 readdensity = float(chainsize) / float(readsize)
701
703
702 fm.write('readsize largestblock readdensity srchunks',
704 fm.write('readsize largestblock readdensity srchunks',
703 ' %10d %10d %9.5f %8d',
705 ' %10d %10d %9.5f %8d',
704 readsize, largestblock, readdensity, srchunks,
706 readsize, largestblock, readdensity, srchunks,
705 readsize=readsize, largestblock=largestblock,
707 readsize=readsize, largestblock=largestblock,
706 readdensity=readdensity, srchunks=srchunks)
708 readdensity=readdensity, srchunks=srchunks)
707
709
708 fm.plain('\n')
710 fm.plain('\n')
709
711
710 fm.end()
712 fm.end()
711
713
712 @command('debugdirstate|debugstate',
714 @command('debugdirstate|debugstate',
713 [('', 'nodates', None, _('do not display the saved mtime')),
715 [('', 'nodates', None, _('do not display the saved mtime')),
714 ('', 'datesort', None, _('sort by saved mtime'))],
716 ('', 'datesort', None, _('sort by saved mtime'))],
715 _('[OPTION]...'))
717 _('[OPTION]...'))
716 def debugstate(ui, repo, **opts):
718 def debugstate(ui, repo, **opts):
717 """show the contents of the current dirstate"""
719 """show the contents of the current dirstate"""
718
720
719 nodates = opts.get(r'nodates')
721 nodates = opts.get(r'nodates')
720 datesort = opts.get(r'datesort')
722 datesort = opts.get(r'datesort')
721
723
722 timestr = ""
724 timestr = ""
723 if datesort:
725 if datesort:
724 keyfunc = lambda x: (x[1][3], x[0]) # sort by mtime, then by filename
726 keyfunc = lambda x: (x[1][3], x[0]) # sort by mtime, then by filename
725 else:
727 else:
726 keyfunc = None # sort by filename
728 keyfunc = None # sort by filename
727 for file_, ent in sorted(repo.dirstate._map.iteritems(), key=keyfunc):
729 for file_, ent in sorted(repo.dirstate._map.iteritems(), key=keyfunc):
728 if ent[3] == -1:
730 if ent[3] == -1:
729 timestr = 'unset '
731 timestr = 'unset '
730 elif nodates:
732 elif nodates:
731 timestr = 'set '
733 timestr = 'set '
732 else:
734 else:
733 timestr = time.strftime(r"%Y-%m-%d %H:%M:%S ",
735 timestr = time.strftime(r"%Y-%m-%d %H:%M:%S ",
734 time.localtime(ent[3]))
736 time.localtime(ent[3]))
735 timestr = encoding.strtolocal(timestr)
737 timestr = encoding.strtolocal(timestr)
736 if ent[1] & 0o20000:
738 if ent[1] & 0o20000:
737 mode = 'lnk'
739 mode = 'lnk'
738 else:
740 else:
739 mode = '%3o' % (ent[1] & 0o777 & ~util.umask)
741 mode = '%3o' % (ent[1] & 0o777 & ~util.umask)
740 ui.write("%c %s %10d %s%s\n" % (ent[0], mode, ent[2], timestr, file_))
742 ui.write("%c %s %10d %s%s\n" % (ent[0], mode, ent[2], timestr, file_))
741 for f in repo.dirstate.copies():
743 for f in repo.dirstate.copies():
742 ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copied(f), f))
744 ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copied(f), f))
743
745
744 @command('debugdiscovery',
746 @command('debugdiscovery',
745 [('', 'old', None, _('use old-style discovery')),
747 [('', 'old', None, _('use old-style discovery')),
746 ('', 'nonheads', None,
748 ('', 'nonheads', None,
747 _('use old-style discovery with non-heads included')),
749 _('use old-style discovery with non-heads included')),
748 ('', 'rev', [], 'restrict discovery to this set of revs'),
750 ('', 'rev', [], 'restrict discovery to this set of revs'),
749 ] + cmdutil.remoteopts,
751 ] + cmdutil.remoteopts,
750 _('[--rev REV] [OTHER]'))
752 _('[--rev REV] [OTHER]'))
751 def debugdiscovery(ui, repo, remoteurl="default", **opts):
753 def debugdiscovery(ui, repo, remoteurl="default", **opts):
752 """runs the changeset discovery protocol in isolation"""
754 """runs the changeset discovery protocol in isolation"""
753 opts = pycompat.byteskwargs(opts)
755 opts = pycompat.byteskwargs(opts)
754 remoteurl, branches = hg.parseurl(ui.expandpath(remoteurl))
756 remoteurl, branches = hg.parseurl(ui.expandpath(remoteurl))
755 remote = hg.peer(repo, opts, remoteurl)
757 remote = hg.peer(repo, opts, remoteurl)
756 ui.status(_('comparing with %s\n') % util.hidepassword(remoteurl))
758 ui.status(_('comparing with %s\n') % util.hidepassword(remoteurl))
757
759
758 # make sure tests are repeatable
760 # make sure tests are repeatable
759 random.seed(12323)
761 random.seed(12323)
760
762
761 def doit(pushedrevs, remoteheads, remote=remote):
763 def doit(pushedrevs, remoteheads, remote=remote):
762 if opts.get('old'):
764 if opts.get('old'):
763 if not util.safehasattr(remote, 'branches'):
765 if not util.safehasattr(remote, 'branches'):
764 # enable in-client legacy support
766 # enable in-client legacy support
765 remote = localrepo.locallegacypeer(remote.local())
767 remote = localrepo.locallegacypeer(remote.local())
766 common, _in, hds = treediscovery.findcommonincoming(repo, remote,
768 common, _in, hds = treediscovery.findcommonincoming(repo, remote,
767 force=True)
769 force=True)
768 common = set(common)
770 common = set(common)
769 if not opts.get('nonheads'):
771 if not opts.get('nonheads'):
770 ui.write(("unpruned common: %s\n") %
772 ui.write(("unpruned common: %s\n") %
771 " ".join(sorted(short(n) for n in common)))
773 " ".join(sorted(short(n) for n in common)))
772 dag = dagutil.revlogdag(repo.changelog)
774 dag = dagutil.revlogdag(repo.changelog)
773 all = dag.ancestorset(dag.internalizeall(common))
775 all = dag.ancestorset(dag.internalizeall(common))
774 common = dag.externalizeall(dag.headsetofconnecteds(all))
776 common = dag.externalizeall(dag.headsetofconnecteds(all))
775 else:
777 else:
776 nodes = None
778 nodes = None
777 if pushedrevs:
779 if pushedrevs:
778 revs = scmutil.revrange(repo, pushedrevs)
780 revs = scmutil.revrange(repo, pushedrevs)
779 nodes = [repo[r].node() for r in revs]
781 nodes = [repo[r].node() for r in revs]
780 common, any, hds = setdiscovery.findcommonheads(ui, repo, remote,
782 common, any, hds = setdiscovery.findcommonheads(ui, repo, remote,
781 ancestorsof=nodes)
783 ancestorsof=nodes)
782 common = set(common)
784 common = set(common)
783 rheads = set(hds)
785 rheads = set(hds)
784 lheads = set(repo.heads())
786 lheads = set(repo.heads())
785 ui.write(("common heads: %s\n") %
787 ui.write(("common heads: %s\n") %
786 " ".join(sorted(short(n) for n in common)))
788 " ".join(sorted(short(n) for n in common)))
787 if lheads <= common:
789 if lheads <= common:
788 ui.write(("local is subset\n"))
790 ui.write(("local is subset\n"))
789 elif rheads <= common:
791 elif rheads <= common:
790 ui.write(("remote is subset\n"))
792 ui.write(("remote is subset\n"))
791
793
792 remoterevs, _checkout = hg.addbranchrevs(repo, remote, branches, revs=None)
794 remoterevs, _checkout = hg.addbranchrevs(repo, remote, branches, revs=None)
793 localrevs = opts['rev']
795 localrevs = opts['rev']
794 doit(localrevs, remoterevs)
796 doit(localrevs, remoterevs)
795
797
796 _chunksize = 4 << 10
798 _chunksize = 4 << 10
797
799
798 @command('debugdownload',
800 @command('debugdownload',
799 [
801 [
800 ('o', 'output', '', _('path')),
802 ('o', 'output', '', _('path')),
801 ],
803 ],
802 optionalrepo=True)
804 optionalrepo=True)
803 def debugdownload(ui, repo, url, output=None, **opts):
805 def debugdownload(ui, repo, url, output=None, **opts):
804 """download a resource using Mercurial logic and config
806 """download a resource using Mercurial logic and config
805 """
807 """
806 fh = urlmod.open(ui, url, output)
808 fh = urlmod.open(ui, url, output)
807
809
808 dest = ui
810 dest = ui
809 if output:
811 if output:
810 dest = open(output, "wb", _chunksize)
812 dest = open(output, "wb", _chunksize)
811 try:
813 try:
812 data = fh.read(_chunksize)
814 data = fh.read(_chunksize)
813 while data:
815 while data:
814 dest.write(data)
816 dest.write(data)
815 data = fh.read(_chunksize)
817 data = fh.read(_chunksize)
816 finally:
818 finally:
817 if output:
819 if output:
818 dest.close()
820 dest.close()
819
821
820 @command('debugextensions', cmdutil.formatteropts, [], norepo=True)
822 @command('debugextensions', cmdutil.formatteropts, [], norepo=True)
821 def debugextensions(ui, **opts):
823 def debugextensions(ui, **opts):
822 '''show information about active extensions'''
824 '''show information about active extensions'''
823 opts = pycompat.byteskwargs(opts)
825 opts = pycompat.byteskwargs(opts)
824 exts = extensions.extensions(ui)
826 exts = extensions.extensions(ui)
825 hgver = util.version()
827 hgver = util.version()
826 fm = ui.formatter('debugextensions', opts)
828 fm = ui.formatter('debugextensions', opts)
827 for extname, extmod in sorted(exts, key=operator.itemgetter(0)):
829 for extname, extmod in sorted(exts, key=operator.itemgetter(0)):
828 isinternal = extensions.ismoduleinternal(extmod)
830 isinternal = extensions.ismoduleinternal(extmod)
829 extsource = pycompat.fsencode(extmod.__file__)
831 extsource = pycompat.fsencode(extmod.__file__)
830 if isinternal:
832 if isinternal:
831 exttestedwith = [] # never expose magic string to users
833 exttestedwith = [] # never expose magic string to users
832 else:
834 else:
833 exttestedwith = getattr(extmod, 'testedwith', '').split()
835 exttestedwith = getattr(extmod, 'testedwith', '').split()
834 extbuglink = getattr(extmod, 'buglink', None)
836 extbuglink = getattr(extmod, 'buglink', None)
835
837
836 fm.startitem()
838 fm.startitem()
837
839
838 if ui.quiet or ui.verbose:
840 if ui.quiet or ui.verbose:
839 fm.write('name', '%s\n', extname)
841 fm.write('name', '%s\n', extname)
840 else:
842 else:
841 fm.write('name', '%s', extname)
843 fm.write('name', '%s', extname)
842 if isinternal or hgver in exttestedwith:
844 if isinternal or hgver in exttestedwith:
843 fm.plain('\n')
845 fm.plain('\n')
844 elif not exttestedwith:
846 elif not exttestedwith:
845 fm.plain(_(' (untested!)\n'))
847 fm.plain(_(' (untested!)\n'))
846 else:
848 else:
847 lasttestedversion = exttestedwith[-1]
849 lasttestedversion = exttestedwith[-1]
848 fm.plain(' (%s!)\n' % lasttestedversion)
850 fm.plain(' (%s!)\n' % lasttestedversion)
849
851
850 fm.condwrite(ui.verbose and extsource, 'source',
852 fm.condwrite(ui.verbose and extsource, 'source',
851 _(' location: %s\n'), extsource or "")
853 _(' location: %s\n'), extsource or "")
852
854
853 if ui.verbose:
855 if ui.verbose:
854 fm.plain(_(' bundled: %s\n') % ['no', 'yes'][isinternal])
856 fm.plain(_(' bundled: %s\n') % ['no', 'yes'][isinternal])
855 fm.data(bundled=isinternal)
857 fm.data(bundled=isinternal)
856
858
857 fm.condwrite(ui.verbose and exttestedwith, 'testedwith',
859 fm.condwrite(ui.verbose and exttestedwith, 'testedwith',
858 _(' tested with: %s\n'),
860 _(' tested with: %s\n'),
859 fm.formatlist(exttestedwith, name='ver'))
861 fm.formatlist(exttestedwith, name='ver'))
860
862
861 fm.condwrite(ui.verbose and extbuglink, 'buglink',
863 fm.condwrite(ui.verbose and extbuglink, 'buglink',
862 _(' bug reporting: %s\n'), extbuglink or "")
864 _(' bug reporting: %s\n'), extbuglink or "")
863
865
864 fm.end()
866 fm.end()
865
867
866 @command('debugfileset',
868 @command('debugfileset',
867 [('r', 'rev', '', _('apply the filespec on this revision'), _('REV'))],
869 [('r', 'rev', '', _('apply the filespec on this revision'), _('REV'))],
868 _('[-r REV] FILESPEC'))
870 _('[-r REV] FILESPEC'))
869 def debugfileset(ui, repo, expr, **opts):
871 def debugfileset(ui, repo, expr, **opts):
870 '''parse and apply a fileset specification'''
872 '''parse and apply a fileset specification'''
871 ctx = scmutil.revsingle(repo, opts.get(r'rev'), None)
873 ctx = scmutil.revsingle(repo, opts.get(r'rev'), None)
872 if ui.verbose:
874 if ui.verbose:
873 tree = fileset.parse(expr)
875 tree = fileset.parse(expr)
874 ui.note(fileset.prettyformat(tree), "\n")
876 ui.note(fileset.prettyformat(tree), "\n")
875
877
876 for f in ctx.getfileset(expr):
878 for f in ctx.getfileset(expr):
877 ui.write("%s\n" % f)
879 ui.write("%s\n" % f)
878
880
879 @command('debugformat',
881 @command('debugformat',
880 [] + cmdutil.formatteropts,
882 [] + cmdutil.formatteropts,
881 _(''))
883 _(''))
882 def debugformat(ui, repo, **opts):
884 def debugformat(ui, repo, **opts):
883 """display format information about the current repository
885 """display format information about the current repository
884
886
885 Use --verbose to get extra information about current config value and
887 Use --verbose to get extra information about current config value and
886 Mercurial default."""
888 Mercurial default."""
887 opts = pycompat.byteskwargs(opts)
889 opts = pycompat.byteskwargs(opts)
888 maxvariantlength = max(len(fv.name) for fv in upgrade.allformatvariant)
890 maxvariantlength = max(len(fv.name) for fv in upgrade.allformatvariant)
889 maxvariantlength = max(len('format-variant'), maxvariantlength)
891 maxvariantlength = max(len('format-variant'), maxvariantlength)
890
892
891 def makeformatname(name):
893 def makeformatname(name):
892 return '%s:' + (' ' * (maxvariantlength - len(name)))
894 return '%s:' + (' ' * (maxvariantlength - len(name)))
893
895
894 fm = ui.formatter('debugformat', opts)
896 fm = ui.formatter('debugformat', opts)
895 if fm.isplain():
897 if fm.isplain():
896 def formatvalue(value):
898 def formatvalue(value):
897 if util.safehasattr(value, 'startswith'):
899 if util.safehasattr(value, 'startswith'):
898 return value
900 return value
899 if value:
901 if value:
900 return 'yes'
902 return 'yes'
901 else:
903 else:
902 return 'no'
904 return 'no'
903 else:
905 else:
904 formatvalue = pycompat.identity
906 formatvalue = pycompat.identity
905
907
906 fm.plain('format-variant')
908 fm.plain('format-variant')
907 fm.plain(' ' * (maxvariantlength - len('format-variant')))
909 fm.plain(' ' * (maxvariantlength - len('format-variant')))
908 fm.plain(' repo')
910 fm.plain(' repo')
909 if ui.verbose:
911 if ui.verbose:
910 fm.plain(' config default')
912 fm.plain(' config default')
911 fm.plain('\n')
913 fm.plain('\n')
912 for fv in upgrade.allformatvariant:
914 for fv in upgrade.allformatvariant:
913 fm.startitem()
915 fm.startitem()
914 repovalue = fv.fromrepo(repo)
916 repovalue = fv.fromrepo(repo)
915 configvalue = fv.fromconfig(repo)
917 configvalue = fv.fromconfig(repo)
916
918
917 if repovalue != configvalue:
919 if repovalue != configvalue:
918 namelabel = 'formatvariant.name.mismatchconfig'
920 namelabel = 'formatvariant.name.mismatchconfig'
919 repolabel = 'formatvariant.repo.mismatchconfig'
921 repolabel = 'formatvariant.repo.mismatchconfig'
920 elif repovalue != fv.default:
922 elif repovalue != fv.default:
921 namelabel = 'formatvariant.name.mismatchdefault'
923 namelabel = 'formatvariant.name.mismatchdefault'
922 repolabel = 'formatvariant.repo.mismatchdefault'
924 repolabel = 'formatvariant.repo.mismatchdefault'
923 else:
925 else:
924 namelabel = 'formatvariant.name.uptodate'
926 namelabel = 'formatvariant.name.uptodate'
925 repolabel = 'formatvariant.repo.uptodate'
927 repolabel = 'formatvariant.repo.uptodate'
926
928
927 fm.write('name', makeformatname(fv.name), fv.name,
929 fm.write('name', makeformatname(fv.name), fv.name,
928 label=namelabel)
930 label=namelabel)
929 fm.write('repo', ' %3s', formatvalue(repovalue),
931 fm.write('repo', ' %3s', formatvalue(repovalue),
930 label=repolabel)
932 label=repolabel)
931 if fv.default != configvalue:
933 if fv.default != configvalue:
932 configlabel = 'formatvariant.config.special'
934 configlabel = 'formatvariant.config.special'
933 else:
935 else:
934 configlabel = 'formatvariant.config.default'
936 configlabel = 'formatvariant.config.default'
935 fm.condwrite(ui.verbose, 'config', ' %6s', formatvalue(configvalue),
937 fm.condwrite(ui.verbose, 'config', ' %6s', formatvalue(configvalue),
936 label=configlabel)
938 label=configlabel)
937 fm.condwrite(ui.verbose, 'default', ' %7s', formatvalue(fv.default),
939 fm.condwrite(ui.verbose, 'default', ' %7s', formatvalue(fv.default),
938 label='formatvariant.default')
940 label='formatvariant.default')
939 fm.plain('\n')
941 fm.plain('\n')
940 fm.end()
942 fm.end()
941
943
942 @command('debugfsinfo', [], _('[PATH]'), norepo=True)
944 @command('debugfsinfo', [], _('[PATH]'), norepo=True)
943 def debugfsinfo(ui, path="."):
945 def debugfsinfo(ui, path="."):
944 """show information detected about current filesystem"""
946 """show information detected about current filesystem"""
945 ui.write(('path: %s\n') % path)
947 ui.write(('path: %s\n') % path)
946 ui.write(('mounted on: %s\n') % (util.getfsmountpoint(path) or '(unknown)'))
948 ui.write(('mounted on: %s\n') % (util.getfsmountpoint(path) or '(unknown)'))
947 ui.write(('exec: %s\n') % (util.checkexec(path) and 'yes' or 'no'))
949 ui.write(('exec: %s\n') % (util.checkexec(path) and 'yes' or 'no'))
948 ui.write(('fstype: %s\n') % (util.getfstype(path) or '(unknown)'))
950 ui.write(('fstype: %s\n') % (util.getfstype(path) or '(unknown)'))
949 ui.write(('symlink: %s\n') % (util.checklink(path) and 'yes' or 'no'))
951 ui.write(('symlink: %s\n') % (util.checklink(path) and 'yes' or 'no'))
950 ui.write(('hardlink: %s\n') % (util.checknlink(path) and 'yes' or 'no'))
952 ui.write(('hardlink: %s\n') % (util.checknlink(path) and 'yes' or 'no'))
951 casesensitive = '(unknown)'
953 casesensitive = '(unknown)'
952 try:
954 try:
953 with tempfile.NamedTemporaryFile(prefix='.debugfsinfo', dir=path) as f:
955 with tempfile.NamedTemporaryFile(prefix='.debugfsinfo', dir=path) as f:
954 casesensitive = util.fscasesensitive(f.name) and 'yes' or 'no'
956 casesensitive = util.fscasesensitive(f.name) and 'yes' or 'no'
955 except OSError:
957 except OSError:
956 pass
958 pass
957 ui.write(('case-sensitive: %s\n') % casesensitive)
959 ui.write(('case-sensitive: %s\n') % casesensitive)
958
960
959 @command('debuggetbundle',
961 @command('debuggetbundle',
960 [('H', 'head', [], _('id of head node'), _('ID')),
962 [('H', 'head', [], _('id of head node'), _('ID')),
961 ('C', 'common', [], _('id of common node'), _('ID')),
963 ('C', 'common', [], _('id of common node'), _('ID')),
962 ('t', 'type', 'bzip2', _('bundle compression type to use'), _('TYPE'))],
964 ('t', 'type', 'bzip2', _('bundle compression type to use'), _('TYPE'))],
963 _('REPO FILE [-H|-C ID]...'),
965 _('REPO FILE [-H|-C ID]...'),
964 norepo=True)
966 norepo=True)
965 def debuggetbundle(ui, repopath, bundlepath, head=None, common=None, **opts):
967 def debuggetbundle(ui, repopath, bundlepath, head=None, common=None, **opts):
966 """retrieves a bundle from a repo
968 """retrieves a bundle from a repo
967
969
968 Every ID must be a full-length hex node id string. Saves the bundle to the
970 Every ID must be a full-length hex node id string. Saves the bundle to the
969 given file.
971 given file.
970 """
972 """
971 opts = pycompat.byteskwargs(opts)
973 opts = pycompat.byteskwargs(opts)
972 repo = hg.peer(ui, opts, repopath)
974 repo = hg.peer(ui, opts, repopath)
973 if not repo.capable('getbundle'):
975 if not repo.capable('getbundle'):
974 raise error.Abort("getbundle() not supported by target repository")
976 raise error.Abort("getbundle() not supported by target repository")
975 args = {}
977 args = {}
976 if common:
978 if common:
977 args[r'common'] = [bin(s) for s in common]
979 args[r'common'] = [bin(s) for s in common]
978 if head:
980 if head:
979 args[r'heads'] = [bin(s) for s in head]
981 args[r'heads'] = [bin(s) for s in head]
980 # TODO: get desired bundlecaps from command line.
982 # TODO: get desired bundlecaps from command line.
981 args[r'bundlecaps'] = None
983 args[r'bundlecaps'] = None
982 bundle = repo.getbundle('debug', **args)
984 bundle = repo.getbundle('debug', **args)
983
985
984 bundletype = opts.get('type', 'bzip2').lower()
986 bundletype = opts.get('type', 'bzip2').lower()
985 btypes = {'none': 'HG10UN',
987 btypes = {'none': 'HG10UN',
986 'bzip2': 'HG10BZ',
988 'bzip2': 'HG10BZ',
987 'gzip': 'HG10GZ',
989 'gzip': 'HG10GZ',
988 'bundle2': 'HG20'}
990 'bundle2': 'HG20'}
989 bundletype = btypes.get(bundletype)
991 bundletype = btypes.get(bundletype)
990 if bundletype not in bundle2.bundletypes:
992 if bundletype not in bundle2.bundletypes:
991 raise error.Abort(_('unknown bundle type specified with --type'))
993 raise error.Abort(_('unknown bundle type specified with --type'))
992 bundle2.writebundle(ui, bundle, bundlepath, bundletype)
994 bundle2.writebundle(ui, bundle, bundlepath, bundletype)
993
995
994 @command('debugignore', [], '[FILE]')
996 @command('debugignore', [], '[FILE]')
995 def debugignore(ui, repo, *files, **opts):
997 def debugignore(ui, repo, *files, **opts):
996 """display the combined ignore pattern and information about ignored files
998 """display the combined ignore pattern and information about ignored files
997
999
998 With no argument display the combined ignore pattern.
1000 With no argument display the combined ignore pattern.
999
1001
1000 Given space separated file names, shows if the given file is ignored and
1002 Given space separated file names, shows if the given file is ignored and
1001 if so, show the ignore rule (file and line number) that matched it.
1003 if so, show the ignore rule (file and line number) that matched it.
1002 """
1004 """
1003 ignore = repo.dirstate._ignore
1005 ignore = repo.dirstate._ignore
1004 if not files:
1006 if not files:
1005 # Show all the patterns
1007 # Show all the patterns
1006 ui.write("%s\n" % repr(ignore))
1008 ui.write("%s\n" % repr(ignore))
1007 else:
1009 else:
1008 m = scmutil.match(repo[None], pats=files)
1010 m = scmutil.match(repo[None], pats=files)
1009 for f in m.files():
1011 for f in m.files():
1010 nf = util.normpath(f)
1012 nf = util.normpath(f)
1011 ignored = None
1013 ignored = None
1012 ignoredata = None
1014 ignoredata = None
1013 if nf != '.':
1015 if nf != '.':
1014 if ignore(nf):
1016 if ignore(nf):
1015 ignored = nf
1017 ignored = nf
1016 ignoredata = repo.dirstate._ignorefileandline(nf)
1018 ignoredata = repo.dirstate._ignorefileandline(nf)
1017 else:
1019 else:
1018 for p in util.finddirs(nf):
1020 for p in util.finddirs(nf):
1019 if ignore(p):
1021 if ignore(p):
1020 ignored = p
1022 ignored = p
1021 ignoredata = repo.dirstate._ignorefileandline(p)
1023 ignoredata = repo.dirstate._ignorefileandline(p)
1022 break
1024 break
1023 if ignored:
1025 if ignored:
1024 if ignored == nf:
1026 if ignored == nf:
1025 ui.write(_("%s is ignored\n") % m.uipath(f))
1027 ui.write(_("%s is ignored\n") % m.uipath(f))
1026 else:
1028 else:
1027 ui.write(_("%s is ignored because of "
1029 ui.write(_("%s is ignored because of "
1028 "containing folder %s\n")
1030 "containing folder %s\n")
1029 % (m.uipath(f), ignored))
1031 % (m.uipath(f), ignored))
1030 ignorefile, lineno, line = ignoredata
1032 ignorefile, lineno, line = ignoredata
1031 ui.write(_("(ignore rule in %s, line %d: '%s')\n")
1033 ui.write(_("(ignore rule in %s, line %d: '%s')\n")
1032 % (ignorefile, lineno, line))
1034 % (ignorefile, lineno, line))
1033 else:
1035 else:
1034 ui.write(_("%s is not ignored\n") % m.uipath(f))
1036 ui.write(_("%s is not ignored\n") % m.uipath(f))
1035
1037
1036 @command('debugindex', cmdutil.debugrevlogopts +
1038 @command('debugindex', cmdutil.debugrevlogopts +
1037 [('f', 'format', 0, _('revlog format'), _('FORMAT'))],
1039 [('f', 'format', 0, _('revlog format'), _('FORMAT'))],
1038 _('[-f FORMAT] -c|-m|FILE'),
1040 _('[-f FORMAT] -c|-m|FILE'),
1039 optionalrepo=True)
1041 optionalrepo=True)
1040 def debugindex(ui, repo, file_=None, **opts):
1042 def debugindex(ui, repo, file_=None, **opts):
1041 """dump the contents of an index file"""
1043 """dump the contents of an index file"""
1042 opts = pycompat.byteskwargs(opts)
1044 opts = pycompat.byteskwargs(opts)
1043 r = cmdutil.openrevlog(repo, 'debugindex', file_, opts)
1045 r = cmdutil.openrevlog(repo, 'debugindex', file_, opts)
1044 format = opts.get('format', 0)
1046 format = opts.get('format', 0)
1045 if format not in (0, 1):
1047 if format not in (0, 1):
1046 raise error.Abort(_("unknown format %d") % format)
1048 raise error.Abort(_("unknown format %d") % format)
1047
1049
1048 generaldelta = r.version & revlog.FLAG_GENERALDELTA
1050 generaldelta = r.version & revlog.FLAG_GENERALDELTA
1049 if generaldelta:
1051 if generaldelta:
1050 basehdr = ' delta'
1052 basehdr = ' delta'
1051 else:
1053 else:
1052 basehdr = ' base'
1054 basehdr = ' base'
1053
1055
1054 if ui.debugflag:
1056 if ui.debugflag:
1055 shortfn = hex
1057 shortfn = hex
1056 else:
1058 else:
1057 shortfn = short
1059 shortfn = short
1058
1060
1059 # There might not be anything in r, so have a sane default
1061 # There might not be anything in r, so have a sane default
1060 idlen = 12
1062 idlen = 12
1061 for i in r:
1063 for i in r:
1062 idlen = len(shortfn(r.node(i)))
1064 idlen = len(shortfn(r.node(i)))
1063 break
1065 break
1064
1066
1065 if format == 0:
1067 if format == 0:
1066 ui.write((" rev offset length " + basehdr + " linkrev"
1068 ui.write((" rev offset length " + basehdr + " linkrev"
1067 " %s %s p2\n") % ("nodeid".ljust(idlen), "p1".ljust(idlen)))
1069 " %s %s p2\n") % ("nodeid".ljust(idlen), "p1".ljust(idlen)))
1068 elif format == 1:
1070 elif format == 1:
1069 ui.write((" rev flag offset length"
1071 ui.write((" rev flag offset length"
1070 " size " + basehdr + " link p1 p2"
1072 " size " + basehdr + " link p1 p2"
1071 " %s\n") % "nodeid".rjust(idlen))
1073 " %s\n") % "nodeid".rjust(idlen))
1072
1074
1073 for i in r:
1075 for i in r:
1074 node = r.node(i)
1076 node = r.node(i)
1075 if generaldelta:
1077 if generaldelta:
1076 base = r.deltaparent(i)
1078 base = r.deltaparent(i)
1077 else:
1079 else:
1078 base = r.chainbase(i)
1080 base = r.chainbase(i)
1079 if format == 0:
1081 if format == 0:
1080 try:
1082 try:
1081 pp = r.parents(node)
1083 pp = r.parents(node)
1082 except Exception:
1084 except Exception:
1083 pp = [nullid, nullid]
1085 pp = [nullid, nullid]
1084 ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % (
1086 ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % (
1085 i, r.start(i), r.length(i), base, r.linkrev(i),
1087 i, r.start(i), r.length(i), base, r.linkrev(i),
1086 shortfn(node), shortfn(pp[0]), shortfn(pp[1])))
1088 shortfn(node), shortfn(pp[0]), shortfn(pp[1])))
1087 elif format == 1:
1089 elif format == 1:
1088 pr = r.parentrevs(i)
1090 pr = r.parentrevs(i)
1089 ui.write("% 6d %04x % 8d % 8d % 8d % 6d % 6d % 6d % 6d %s\n" % (
1091 ui.write("% 6d %04x % 8d % 8d % 8d % 6d % 6d % 6d % 6d %s\n" % (
1090 i, r.flags(i), r.start(i), r.length(i), r.rawsize(i),
1092 i, r.flags(i), r.start(i), r.length(i), r.rawsize(i),
1091 base, r.linkrev(i), pr[0], pr[1], shortfn(node)))
1093 base, r.linkrev(i), pr[0], pr[1], shortfn(node)))
1092
1094
1093 @command('debugindexdot', cmdutil.debugrevlogopts,
1095 @command('debugindexdot', cmdutil.debugrevlogopts,
1094 _('-c|-m|FILE'), optionalrepo=True)
1096 _('-c|-m|FILE'), optionalrepo=True)
1095 def debugindexdot(ui, repo, file_=None, **opts):
1097 def debugindexdot(ui, repo, file_=None, **opts):
1096 """dump an index DAG as a graphviz dot file"""
1098 """dump an index DAG as a graphviz dot file"""
1097 opts = pycompat.byteskwargs(opts)
1099 opts = pycompat.byteskwargs(opts)
1098 r = cmdutil.openrevlog(repo, 'debugindexdot', file_, opts)
1100 r = cmdutil.openrevlog(repo, 'debugindexdot', file_, opts)
1099 ui.write(("digraph G {\n"))
1101 ui.write(("digraph G {\n"))
1100 for i in r:
1102 for i in r:
1101 node = r.node(i)
1103 node = r.node(i)
1102 pp = r.parents(node)
1104 pp = r.parents(node)
1103 ui.write("\t%d -> %d\n" % (r.rev(pp[0]), i))
1105 ui.write("\t%d -> %d\n" % (r.rev(pp[0]), i))
1104 if pp[1] != nullid:
1106 if pp[1] != nullid:
1105 ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i))
1107 ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i))
1106 ui.write("}\n")
1108 ui.write("}\n")
1107
1109
1108 @command('debuginstall', [] + cmdutil.formatteropts, '', norepo=True)
1110 @command('debuginstall', [] + cmdutil.formatteropts, '', norepo=True)
1109 def debuginstall(ui, **opts):
1111 def debuginstall(ui, **opts):
1110 '''test Mercurial installation
1112 '''test Mercurial installation
1111
1113
1112 Returns 0 on success.
1114 Returns 0 on success.
1113 '''
1115 '''
1114 opts = pycompat.byteskwargs(opts)
1116 opts = pycompat.byteskwargs(opts)
1115
1117
1116 def writetemp(contents):
1118 def writetemp(contents):
1117 (fd, name) = tempfile.mkstemp(prefix="hg-debuginstall-")
1119 (fd, name) = tempfile.mkstemp(prefix="hg-debuginstall-")
1118 f = os.fdopen(fd, pycompat.sysstr("wb"))
1120 f = os.fdopen(fd, pycompat.sysstr("wb"))
1119 f.write(contents)
1121 f.write(contents)
1120 f.close()
1122 f.close()
1121 return name
1123 return name
1122
1124
1123 problems = 0
1125 problems = 0
1124
1126
1125 fm = ui.formatter('debuginstall', opts)
1127 fm = ui.formatter('debuginstall', opts)
1126 fm.startitem()
1128 fm.startitem()
1127
1129
1128 # encoding
1130 # encoding
1129 fm.write('encoding', _("checking encoding (%s)...\n"), encoding.encoding)
1131 fm.write('encoding', _("checking encoding (%s)...\n"), encoding.encoding)
1130 err = None
1132 err = None
1131 try:
1133 try:
1132 codecs.lookup(pycompat.sysstr(encoding.encoding))
1134 codecs.lookup(pycompat.sysstr(encoding.encoding))
1133 except LookupError as inst:
1135 except LookupError as inst:
1134 err = util.forcebytestr(inst)
1136 err = util.forcebytestr(inst)
1135 problems += 1
1137 problems += 1
1136 fm.condwrite(err, 'encodingerror', _(" %s\n"
1138 fm.condwrite(err, 'encodingerror', _(" %s\n"
1137 " (check that your locale is properly set)\n"), err)
1139 " (check that your locale is properly set)\n"), err)
1138
1140
1139 # Python
1141 # Python
1140 fm.write('pythonexe', _("checking Python executable (%s)\n"),
1142 fm.write('pythonexe', _("checking Python executable (%s)\n"),
1141 pycompat.sysexecutable)
1143 pycompat.sysexecutable)
1142 fm.write('pythonver', _("checking Python version (%s)\n"),
1144 fm.write('pythonver', _("checking Python version (%s)\n"),
1143 ("%d.%d.%d" % sys.version_info[:3]))
1145 ("%d.%d.%d" % sys.version_info[:3]))
1144 fm.write('pythonlib', _("checking Python lib (%s)...\n"),
1146 fm.write('pythonlib', _("checking Python lib (%s)...\n"),
1145 os.path.dirname(pycompat.fsencode(os.__file__)))
1147 os.path.dirname(pycompat.fsencode(os.__file__)))
1146
1148
1147 security = set(sslutil.supportedprotocols)
1149 security = set(sslutil.supportedprotocols)
1148 if sslutil.hassni:
1150 if sslutil.hassni:
1149 security.add('sni')
1151 security.add('sni')
1150
1152
1151 fm.write('pythonsecurity', _("checking Python security support (%s)\n"),
1153 fm.write('pythonsecurity', _("checking Python security support (%s)\n"),
1152 fm.formatlist(sorted(security), name='protocol',
1154 fm.formatlist(sorted(security), name='protocol',
1153 fmt='%s', sep=','))
1155 fmt='%s', sep=','))
1154
1156
1155 # These are warnings, not errors. So don't increment problem count. This
1157 # These are warnings, not errors. So don't increment problem count. This
1156 # may change in the future.
1158 # may change in the future.
1157 if 'tls1.2' not in security:
1159 if 'tls1.2' not in security:
1158 fm.plain(_(' TLS 1.2 not supported by Python install; '
1160 fm.plain(_(' TLS 1.2 not supported by Python install; '
1159 'network connections lack modern security\n'))
1161 'network connections lack modern security\n'))
1160 if 'sni' not in security:
1162 if 'sni' not in security:
1161 fm.plain(_(' SNI not supported by Python install; may have '
1163 fm.plain(_(' SNI not supported by Python install; may have '
1162 'connectivity issues with some servers\n'))
1164 'connectivity issues with some servers\n'))
1163
1165
1164 # TODO print CA cert info
1166 # TODO print CA cert info
1165
1167
1166 # hg version
1168 # hg version
1167 hgver = util.version()
1169 hgver = util.version()
1168 fm.write('hgver', _("checking Mercurial version (%s)\n"),
1170 fm.write('hgver', _("checking Mercurial version (%s)\n"),
1169 hgver.split('+')[0])
1171 hgver.split('+')[0])
1170 fm.write('hgverextra', _("checking Mercurial custom build (%s)\n"),
1172 fm.write('hgverextra', _("checking Mercurial custom build (%s)\n"),
1171 '+'.join(hgver.split('+')[1:]))
1173 '+'.join(hgver.split('+')[1:]))
1172
1174
1173 # compiled modules
1175 # compiled modules
1174 fm.write('hgmodulepolicy', _("checking module policy (%s)\n"),
1176 fm.write('hgmodulepolicy', _("checking module policy (%s)\n"),
1175 policy.policy)
1177 policy.policy)
1176 fm.write('hgmodules', _("checking installed modules (%s)...\n"),
1178 fm.write('hgmodules', _("checking installed modules (%s)...\n"),
1177 os.path.dirname(pycompat.fsencode(__file__)))
1179 os.path.dirname(pycompat.fsencode(__file__)))
1178
1180
1179 if policy.policy in ('c', 'allow'):
1181 if policy.policy in ('c', 'allow'):
1180 err = None
1182 err = None
1181 try:
1183 try:
1182 from .cext import (
1184 from .cext import (
1183 base85,
1185 base85,
1184 bdiff,
1186 bdiff,
1185 mpatch,
1187 mpatch,
1186 osutil,
1188 osutil,
1187 )
1189 )
1188 dir(bdiff), dir(mpatch), dir(base85), dir(osutil) # quiet pyflakes
1190 dir(bdiff), dir(mpatch), dir(base85), dir(osutil) # quiet pyflakes
1189 except Exception as inst:
1191 except Exception as inst:
1190 err = util.forcebytestr(inst)
1192 err = util.forcebytestr(inst)
1191 problems += 1
1193 problems += 1
1192 fm.condwrite(err, 'extensionserror', " %s\n", err)
1194 fm.condwrite(err, 'extensionserror', " %s\n", err)
1193
1195
1194 compengines = util.compengines._engines.values()
1196 compengines = util.compengines._engines.values()
1195 fm.write('compengines', _('checking registered compression engines (%s)\n'),
1197 fm.write('compengines', _('checking registered compression engines (%s)\n'),
1196 fm.formatlist(sorted(e.name() for e in compengines),
1198 fm.formatlist(sorted(e.name() for e in compengines),
1197 name='compengine', fmt='%s', sep=', '))
1199 name='compengine', fmt='%s', sep=', '))
1198 fm.write('compenginesavail', _('checking available compression engines '
1200 fm.write('compenginesavail', _('checking available compression engines '
1199 '(%s)\n'),
1201 '(%s)\n'),
1200 fm.formatlist(sorted(e.name() for e in compengines
1202 fm.formatlist(sorted(e.name() for e in compengines
1201 if e.available()),
1203 if e.available()),
1202 name='compengine', fmt='%s', sep=', '))
1204 name='compengine', fmt='%s', sep=', '))
1203 wirecompengines = util.compengines.supportedwireengines(util.SERVERROLE)
1205 wirecompengines = util.compengines.supportedwireengines(util.SERVERROLE)
1204 fm.write('compenginesserver', _('checking available compression engines '
1206 fm.write('compenginesserver', _('checking available compression engines '
1205 'for wire protocol (%s)\n'),
1207 'for wire protocol (%s)\n'),
1206 fm.formatlist([e.name() for e in wirecompengines
1208 fm.formatlist([e.name() for e in wirecompengines
1207 if e.wireprotosupport()],
1209 if e.wireprotosupport()],
1208 name='compengine', fmt='%s', sep=', '))
1210 name='compengine', fmt='%s', sep=', '))
1209 re2 = 'missing'
1211 re2 = 'missing'
1210 if util._re2:
1212 if util._re2:
1211 re2 = 'available'
1213 re2 = 'available'
1212 fm.plain(_('checking "re2" regexp engine (%s)\n') % re2)
1214 fm.plain(_('checking "re2" regexp engine (%s)\n') % re2)
1213 fm.data(re2=bool(util._re2))
1215 fm.data(re2=bool(util._re2))
1214
1216
1215 # templates
1217 # templates
1216 p = templater.templatepaths()
1218 p = templater.templatepaths()
1217 fm.write('templatedirs', 'checking templates (%s)...\n', ' '.join(p))
1219 fm.write('templatedirs', 'checking templates (%s)...\n', ' '.join(p))
1218 fm.condwrite(not p, '', _(" no template directories found\n"))
1220 fm.condwrite(not p, '', _(" no template directories found\n"))
1219 if p:
1221 if p:
1220 m = templater.templatepath("map-cmdline.default")
1222 m = templater.templatepath("map-cmdline.default")
1221 if m:
1223 if m:
1222 # template found, check if it is working
1224 # template found, check if it is working
1223 err = None
1225 err = None
1224 try:
1226 try:
1225 templater.templater.frommapfile(m)
1227 templater.templater.frommapfile(m)
1226 except Exception as inst:
1228 except Exception as inst:
1227 err = util.forcebytestr(inst)
1229 err = util.forcebytestr(inst)
1228 p = None
1230 p = None
1229 fm.condwrite(err, 'defaulttemplateerror', " %s\n", err)
1231 fm.condwrite(err, 'defaulttemplateerror', " %s\n", err)
1230 else:
1232 else:
1231 p = None
1233 p = None
1232 fm.condwrite(p, 'defaulttemplate',
1234 fm.condwrite(p, 'defaulttemplate',
1233 _("checking default template (%s)\n"), m)
1235 _("checking default template (%s)\n"), m)
1234 fm.condwrite(not m, 'defaulttemplatenotfound',
1236 fm.condwrite(not m, 'defaulttemplatenotfound',
1235 _(" template '%s' not found\n"), "default")
1237 _(" template '%s' not found\n"), "default")
1236 if not p:
1238 if not p:
1237 problems += 1
1239 problems += 1
1238 fm.condwrite(not p, '',
1240 fm.condwrite(not p, '',
1239 _(" (templates seem to have been installed incorrectly)\n"))
1241 _(" (templates seem to have been installed incorrectly)\n"))
1240
1242
1241 # editor
1243 # editor
1242 editor = ui.geteditor()
1244 editor = ui.geteditor()
1243 editor = util.expandpath(editor)
1245 editor = util.expandpath(editor)
1244 editorbin = util.shellsplit(editor)[0]
1246 editorbin = util.shellsplit(editor)[0]
1245 fm.write('editor', _("checking commit editor... (%s)\n"), editorbin)
1247 fm.write('editor', _("checking commit editor... (%s)\n"), editorbin)
1246 cmdpath = util.findexe(editorbin)
1248 cmdpath = util.findexe(editorbin)
1247 fm.condwrite(not cmdpath and editor == 'vi', 'vinotfound',
1249 fm.condwrite(not cmdpath and editor == 'vi', 'vinotfound',
1248 _(" No commit editor set and can't find %s in PATH\n"
1250 _(" No commit editor set and can't find %s in PATH\n"
1249 " (specify a commit editor in your configuration"
1251 " (specify a commit editor in your configuration"
1250 " file)\n"), not cmdpath and editor == 'vi' and editorbin)
1252 " file)\n"), not cmdpath and editor == 'vi' and editorbin)
1251 fm.condwrite(not cmdpath and editor != 'vi', 'editornotfound',
1253 fm.condwrite(not cmdpath and editor != 'vi', 'editornotfound',
1252 _(" Can't find editor '%s' in PATH\n"
1254 _(" Can't find editor '%s' in PATH\n"
1253 " (specify a commit editor in your configuration"
1255 " (specify a commit editor in your configuration"
1254 " file)\n"), not cmdpath and editorbin)
1256 " file)\n"), not cmdpath and editorbin)
1255 if not cmdpath and editor != 'vi':
1257 if not cmdpath and editor != 'vi':
1256 problems += 1
1258 problems += 1
1257
1259
1258 # check username
1260 # check username
1259 username = None
1261 username = None
1260 err = None
1262 err = None
1261 try:
1263 try:
1262 username = ui.username()
1264 username = ui.username()
1263 except error.Abort as e:
1265 except error.Abort as e:
1264 err = util.forcebytestr(e)
1266 err = util.forcebytestr(e)
1265 problems += 1
1267 problems += 1
1266
1268
1267 fm.condwrite(username, 'username', _("checking username (%s)\n"), username)
1269 fm.condwrite(username, 'username', _("checking username (%s)\n"), username)
1268 fm.condwrite(err, 'usernameerror', _("checking username...\n %s\n"
1270 fm.condwrite(err, 'usernameerror', _("checking username...\n %s\n"
1269 " (specify a username in your configuration file)\n"), err)
1271 " (specify a username in your configuration file)\n"), err)
1270
1272
1271 fm.condwrite(not problems, '',
1273 fm.condwrite(not problems, '',
1272 _("no problems detected\n"))
1274 _("no problems detected\n"))
1273 if not problems:
1275 if not problems:
1274 fm.data(problems=problems)
1276 fm.data(problems=problems)
1275 fm.condwrite(problems, 'problems',
1277 fm.condwrite(problems, 'problems',
1276 _("%d problems detected,"
1278 _("%d problems detected,"
1277 " please check your install!\n"), problems)
1279 " please check your install!\n"), problems)
1278 fm.end()
1280 fm.end()
1279
1281
1280 return problems
1282 return problems
1281
1283
1282 @command('debugknown', [], _('REPO ID...'), norepo=True)
1284 @command('debugknown', [], _('REPO ID...'), norepo=True)
1283 def debugknown(ui, repopath, *ids, **opts):
1285 def debugknown(ui, repopath, *ids, **opts):
1284 """test whether node ids are known to a repo
1286 """test whether node ids are known to a repo
1285
1287
1286 Every ID must be a full-length hex node id string. Returns a list of 0s
1288 Every ID must be a full-length hex node id string. Returns a list of 0s
1287 and 1s indicating unknown/known.
1289 and 1s indicating unknown/known.
1288 """
1290 """
1289 opts = pycompat.byteskwargs(opts)
1291 opts = pycompat.byteskwargs(opts)
1290 repo = hg.peer(ui, opts, repopath)
1292 repo = hg.peer(ui, opts, repopath)
1291 if not repo.capable('known'):
1293 if not repo.capable('known'):
1292 raise error.Abort("known() not supported by target repository")
1294 raise error.Abort("known() not supported by target repository")
1293 flags = repo.known([bin(s) for s in ids])
1295 flags = repo.known([bin(s) for s in ids])
1294 ui.write("%s\n" % ("".join([f and "1" or "0" for f in flags])))
1296 ui.write("%s\n" % ("".join([f and "1" or "0" for f in flags])))
1295
1297
1296 @command('debuglabelcomplete', [], _('LABEL...'))
1298 @command('debuglabelcomplete', [], _('LABEL...'))
1297 def debuglabelcomplete(ui, repo, *args):
1299 def debuglabelcomplete(ui, repo, *args):
1298 '''backwards compatibility with old bash completion scripts (DEPRECATED)'''
1300 '''backwards compatibility with old bash completion scripts (DEPRECATED)'''
1299 debugnamecomplete(ui, repo, *args)
1301 debugnamecomplete(ui, repo, *args)
1300
1302
1301 @command('debuglocks',
1303 @command('debuglocks',
1302 [('L', 'force-lock', None, _('free the store lock (DANGEROUS)')),
1304 [('L', 'force-lock', None, _('free the store lock (DANGEROUS)')),
1303 ('W', 'force-wlock', None,
1305 ('W', 'force-wlock', None,
1304 _('free the working state lock (DANGEROUS)')),
1306 _('free the working state lock (DANGEROUS)')),
1305 ('s', 'set-lock', None, _('set the store lock until stopped')),
1307 ('s', 'set-lock', None, _('set the store lock until stopped')),
1306 ('S', 'set-wlock', None,
1308 ('S', 'set-wlock', None,
1307 _('set the working state lock until stopped'))],
1309 _('set the working state lock until stopped'))],
1308 _('[OPTION]...'))
1310 _('[OPTION]...'))
1309 def debuglocks(ui, repo, **opts):
1311 def debuglocks(ui, repo, **opts):
1310 """show or modify state of locks
1312 """show or modify state of locks
1311
1313
1312 By default, this command will show which locks are held. This
1314 By default, this command will show which locks are held. This
1313 includes the user and process holding the lock, the amount of time
1315 includes the user and process holding the lock, the amount of time
1314 the lock has been held, and the machine name where the process is
1316 the lock has been held, and the machine name where the process is
1315 running if it's not local.
1317 running if it's not local.
1316
1318
1317 Locks protect the integrity of Mercurial's data, so should be
1319 Locks protect the integrity of Mercurial's data, so should be
1318 treated with care. System crashes or other interruptions may cause
1320 treated with care. System crashes or other interruptions may cause
1319 locks to not be properly released, though Mercurial will usually
1321 locks to not be properly released, though Mercurial will usually
1320 detect and remove such stale locks automatically.
1322 detect and remove such stale locks automatically.
1321
1323
1322 However, detecting stale locks may not always be possible (for
1324 However, detecting stale locks may not always be possible (for
1323 instance, on a shared filesystem). Removing locks may also be
1325 instance, on a shared filesystem). Removing locks may also be
1324 blocked by filesystem permissions.
1326 blocked by filesystem permissions.
1325
1327
1326 Setting a lock will prevent other commands from changing the data.
1328 Setting a lock will prevent other commands from changing the data.
1327 The command will wait until an interruption (SIGINT, SIGTERM, ...) occurs.
1329 The command will wait until an interruption (SIGINT, SIGTERM, ...) occurs.
1328 The set locks are removed when the command exits.
1330 The set locks are removed when the command exits.
1329
1331
1330 Returns 0 if no locks are held.
1332 Returns 0 if no locks are held.
1331
1333
1332 """
1334 """
1333
1335
1334 if opts.get(r'force_lock'):
1336 if opts.get(r'force_lock'):
1335 repo.svfs.unlink('lock')
1337 repo.svfs.unlink('lock')
1336 if opts.get(r'force_wlock'):
1338 if opts.get(r'force_wlock'):
1337 repo.vfs.unlink('wlock')
1339 repo.vfs.unlink('wlock')
1338 if opts.get(r'force_lock') or opts.get(r'force_wlock'):
1340 if opts.get(r'force_lock') or opts.get(r'force_wlock'):
1339 return 0
1341 return 0
1340
1342
1341 locks = []
1343 locks = []
1342 try:
1344 try:
1343 if opts.get(r'set_wlock'):
1345 if opts.get(r'set_wlock'):
1344 try:
1346 try:
1345 locks.append(repo.wlock(False))
1347 locks.append(repo.wlock(False))
1346 except error.LockHeld:
1348 except error.LockHeld:
1347 raise error.Abort(_('wlock is already held'))
1349 raise error.Abort(_('wlock is already held'))
1348 if opts.get(r'set_lock'):
1350 if opts.get(r'set_lock'):
1349 try:
1351 try:
1350 locks.append(repo.lock(False))
1352 locks.append(repo.lock(False))
1351 except error.LockHeld:
1353 except error.LockHeld:
1352 raise error.Abort(_('lock is already held'))
1354 raise error.Abort(_('lock is already held'))
1353 if len(locks):
1355 if len(locks):
1354 ui.promptchoice(_("ready to release the lock (y)? $$ &Yes"))
1356 ui.promptchoice(_("ready to release the lock (y)? $$ &Yes"))
1355 return 0
1357 return 0
1356 finally:
1358 finally:
1357 release(*locks)
1359 release(*locks)
1358
1360
1359 now = time.time()
1361 now = time.time()
1360 held = 0
1362 held = 0
1361
1363
1362 def report(vfs, name, method):
1364 def report(vfs, name, method):
1363 # this causes stale locks to get reaped for more accurate reporting
1365 # this causes stale locks to get reaped for more accurate reporting
1364 try:
1366 try:
1365 l = method(False)
1367 l = method(False)
1366 except error.LockHeld:
1368 except error.LockHeld:
1367 l = None
1369 l = None
1368
1370
1369 if l:
1371 if l:
1370 l.release()
1372 l.release()
1371 else:
1373 else:
1372 try:
1374 try:
1373 stat = vfs.lstat(name)
1375 stat = vfs.lstat(name)
1374 age = now - stat.st_mtime
1376 age = now - stat.st_mtime
1375 user = util.username(stat.st_uid)
1377 user = util.username(stat.st_uid)
1376 locker = vfs.readlock(name)
1378 locker = vfs.readlock(name)
1377 if ":" in locker:
1379 if ":" in locker:
1378 host, pid = locker.split(':')
1380 host, pid = locker.split(':')
1379 if host == socket.gethostname():
1381 if host == socket.gethostname():
1380 locker = 'user %s, process %s' % (user, pid)
1382 locker = 'user %s, process %s' % (user, pid)
1381 else:
1383 else:
1382 locker = 'user %s, process %s, host %s' \
1384 locker = 'user %s, process %s, host %s' \
1383 % (user, pid, host)
1385 % (user, pid, host)
1384 ui.write(("%-6s %s (%ds)\n") % (name + ":", locker, age))
1386 ui.write(("%-6s %s (%ds)\n") % (name + ":", locker, age))
1385 return 1
1387 return 1
1386 except OSError as e:
1388 except OSError as e:
1387 if e.errno != errno.ENOENT:
1389 if e.errno != errno.ENOENT:
1388 raise
1390 raise
1389
1391
1390 ui.write(("%-6s free\n") % (name + ":"))
1392 ui.write(("%-6s free\n") % (name + ":"))
1391 return 0
1393 return 0
1392
1394
1393 held += report(repo.svfs, "lock", repo.lock)
1395 held += report(repo.svfs, "lock", repo.lock)
1394 held += report(repo.vfs, "wlock", repo.wlock)
1396 held += report(repo.vfs, "wlock", repo.wlock)
1395
1397
1396 return held
1398 return held
1397
1399
1398 @command('debugmergestate', [], '')
1400 @command('debugmergestate', [], '')
1399 def debugmergestate(ui, repo, *args):
1401 def debugmergestate(ui, repo, *args):
1400 """print merge state
1402 """print merge state
1401
1403
1402 Use --verbose to print out information about whether v1 or v2 merge state
1404 Use --verbose to print out information about whether v1 or v2 merge state
1403 was chosen."""
1405 was chosen."""
1404 def _hashornull(h):
1406 def _hashornull(h):
1405 if h == nullhex:
1407 if h == nullhex:
1406 return 'null'
1408 return 'null'
1407 else:
1409 else:
1408 return h
1410 return h
1409
1411
1410 def printrecords(version):
1412 def printrecords(version):
1411 ui.write(('* version %d records\n') % version)
1413 ui.write(('* version %d records\n') % version)
1412 if version == 1:
1414 if version == 1:
1413 records = v1records
1415 records = v1records
1414 else:
1416 else:
1415 records = v2records
1417 records = v2records
1416
1418
1417 for rtype, record in records:
1419 for rtype, record in records:
1418 # pretty print some record types
1420 # pretty print some record types
1419 if rtype == 'L':
1421 if rtype == 'L':
1420 ui.write(('local: %s\n') % record)
1422 ui.write(('local: %s\n') % record)
1421 elif rtype == 'O':
1423 elif rtype == 'O':
1422 ui.write(('other: %s\n') % record)
1424 ui.write(('other: %s\n') % record)
1423 elif rtype == 'm':
1425 elif rtype == 'm':
1424 driver, mdstate = record.split('\0', 1)
1426 driver, mdstate = record.split('\0', 1)
1425 ui.write(('merge driver: %s (state "%s")\n')
1427 ui.write(('merge driver: %s (state "%s")\n')
1426 % (driver, mdstate))
1428 % (driver, mdstate))
1427 elif rtype in 'FDC':
1429 elif rtype in 'FDC':
1428 r = record.split('\0')
1430 r = record.split('\0')
1429 f, state, hash, lfile, afile, anode, ofile = r[0:7]
1431 f, state, hash, lfile, afile, anode, ofile = r[0:7]
1430 if version == 1:
1432 if version == 1:
1431 onode = 'not stored in v1 format'
1433 onode = 'not stored in v1 format'
1432 flags = r[7]
1434 flags = r[7]
1433 else:
1435 else:
1434 onode, flags = r[7:9]
1436 onode, flags = r[7:9]
1435 ui.write(('file: %s (record type "%s", state "%s", hash %s)\n')
1437 ui.write(('file: %s (record type "%s", state "%s", hash %s)\n')
1436 % (f, rtype, state, _hashornull(hash)))
1438 % (f, rtype, state, _hashornull(hash)))
1437 ui.write((' local path: %s (flags "%s")\n') % (lfile, flags))
1439 ui.write((' local path: %s (flags "%s")\n') % (lfile, flags))
1438 ui.write((' ancestor path: %s (node %s)\n')
1440 ui.write((' ancestor path: %s (node %s)\n')
1439 % (afile, _hashornull(anode)))
1441 % (afile, _hashornull(anode)))
1440 ui.write((' other path: %s (node %s)\n')
1442 ui.write((' other path: %s (node %s)\n')
1441 % (ofile, _hashornull(onode)))
1443 % (ofile, _hashornull(onode)))
1442 elif rtype == 'f':
1444 elif rtype == 'f':
1443 filename, rawextras = record.split('\0', 1)
1445 filename, rawextras = record.split('\0', 1)
1444 extras = rawextras.split('\0')
1446 extras = rawextras.split('\0')
1445 i = 0
1447 i = 0
1446 extrastrings = []
1448 extrastrings = []
1447 while i < len(extras):
1449 while i < len(extras):
1448 extrastrings.append('%s = %s' % (extras[i], extras[i + 1]))
1450 extrastrings.append('%s = %s' % (extras[i], extras[i + 1]))
1449 i += 2
1451 i += 2
1450
1452
1451 ui.write(('file extras: %s (%s)\n')
1453 ui.write(('file extras: %s (%s)\n')
1452 % (filename, ', '.join(extrastrings)))
1454 % (filename, ', '.join(extrastrings)))
1453 elif rtype == 'l':
1455 elif rtype == 'l':
1454 labels = record.split('\0', 2)
1456 labels = record.split('\0', 2)
1455 labels = [l for l in labels if len(l) > 0]
1457 labels = [l for l in labels if len(l) > 0]
1456 ui.write(('labels:\n'))
1458 ui.write(('labels:\n'))
1457 ui.write((' local: %s\n' % labels[0]))
1459 ui.write((' local: %s\n' % labels[0]))
1458 ui.write((' other: %s\n' % labels[1]))
1460 ui.write((' other: %s\n' % labels[1]))
1459 if len(labels) > 2:
1461 if len(labels) > 2:
1460 ui.write((' base: %s\n' % labels[2]))
1462 ui.write((' base: %s\n' % labels[2]))
1461 else:
1463 else:
1462 ui.write(('unrecognized entry: %s\t%s\n')
1464 ui.write(('unrecognized entry: %s\t%s\n')
1463 % (rtype, record.replace('\0', '\t')))
1465 % (rtype, record.replace('\0', '\t')))
1464
1466
1465 # Avoid mergestate.read() since it may raise an exception for unsupported
1467 # Avoid mergestate.read() since it may raise an exception for unsupported
1466 # merge state records. We shouldn't be doing this, but this is OK since this
1468 # merge state records. We shouldn't be doing this, but this is OK since this
1467 # command is pretty low-level.
1469 # command is pretty low-level.
1468 ms = mergemod.mergestate(repo)
1470 ms = mergemod.mergestate(repo)
1469
1471
1470 # sort so that reasonable information is on top
1472 # sort so that reasonable information is on top
1471 v1records = ms._readrecordsv1()
1473 v1records = ms._readrecordsv1()
1472 v2records = ms._readrecordsv2()
1474 v2records = ms._readrecordsv2()
1473 order = 'LOml'
1475 order = 'LOml'
1474 def key(r):
1476 def key(r):
1475 idx = order.find(r[0])
1477 idx = order.find(r[0])
1476 if idx == -1:
1478 if idx == -1:
1477 return (1, r[1])
1479 return (1, r[1])
1478 else:
1480 else:
1479 return (0, idx)
1481 return (0, idx)
1480 v1records.sort(key=key)
1482 v1records.sort(key=key)
1481 v2records.sort(key=key)
1483 v2records.sort(key=key)
1482
1484
1483 if not v1records and not v2records:
1485 if not v1records and not v2records:
1484 ui.write(('no merge state found\n'))
1486 ui.write(('no merge state found\n'))
1485 elif not v2records:
1487 elif not v2records:
1486 ui.note(('no version 2 merge state\n'))
1488 ui.note(('no version 2 merge state\n'))
1487 printrecords(1)
1489 printrecords(1)
1488 elif ms._v1v2match(v1records, v2records):
1490 elif ms._v1v2match(v1records, v2records):
1489 ui.note(('v1 and v2 states match: using v2\n'))
1491 ui.note(('v1 and v2 states match: using v2\n'))
1490 printrecords(2)
1492 printrecords(2)
1491 else:
1493 else:
1492 ui.note(('v1 and v2 states mismatch: using v1\n'))
1494 ui.note(('v1 and v2 states mismatch: using v1\n'))
1493 printrecords(1)
1495 printrecords(1)
1494 if ui.verbose:
1496 if ui.verbose:
1495 printrecords(2)
1497 printrecords(2)
1496
1498
1497 @command('debugnamecomplete', [], _('NAME...'))
1499 @command('debugnamecomplete', [], _('NAME...'))
1498 def debugnamecomplete(ui, repo, *args):
1500 def debugnamecomplete(ui, repo, *args):
1499 '''complete "names" - tags, open branch names, bookmark names'''
1501 '''complete "names" - tags, open branch names, bookmark names'''
1500
1502
1501 names = set()
1503 names = set()
1502 # since we previously only listed open branches, we will handle that
1504 # since we previously only listed open branches, we will handle that
1503 # specially (after this for loop)
1505 # specially (after this for loop)
1504 for name, ns in repo.names.iteritems():
1506 for name, ns in repo.names.iteritems():
1505 if name != 'branches':
1507 if name != 'branches':
1506 names.update(ns.listnames(repo))
1508 names.update(ns.listnames(repo))
1507 names.update(tag for (tag, heads, tip, closed)
1509 names.update(tag for (tag, heads, tip, closed)
1508 in repo.branchmap().iterbranches() if not closed)
1510 in repo.branchmap().iterbranches() if not closed)
1509 completions = set()
1511 completions = set()
1510 if not args:
1512 if not args:
1511 args = ['']
1513 args = ['']
1512 for a in args:
1514 for a in args:
1513 completions.update(n for n in names if n.startswith(a))
1515 completions.update(n for n in names if n.startswith(a))
1514 ui.write('\n'.join(sorted(completions)))
1516 ui.write('\n'.join(sorted(completions)))
1515 ui.write('\n')
1517 ui.write('\n')
1516
1518
1517 @command('debugobsolete',
1519 @command('debugobsolete',
1518 [('', 'flags', 0, _('markers flag')),
1520 [('', 'flags', 0, _('markers flag')),
1519 ('', 'record-parents', False,
1521 ('', 'record-parents', False,
1520 _('record parent information for the precursor')),
1522 _('record parent information for the precursor')),
1521 ('r', 'rev', [], _('display markers relevant to REV')),
1523 ('r', 'rev', [], _('display markers relevant to REV')),
1522 ('', 'exclusive', False, _('restrict display to markers only '
1524 ('', 'exclusive', False, _('restrict display to markers only '
1523 'relevant to REV')),
1525 'relevant to REV')),
1524 ('', 'index', False, _('display index of the marker')),
1526 ('', 'index', False, _('display index of the marker')),
1525 ('', 'delete', [], _('delete markers specified by indices')),
1527 ('', 'delete', [], _('delete markers specified by indices')),
1526 ] + cmdutil.commitopts2 + cmdutil.formatteropts,
1528 ] + cmdutil.commitopts2 + cmdutil.formatteropts,
1527 _('[OBSOLETED [REPLACEMENT ...]]'))
1529 _('[OBSOLETED [REPLACEMENT ...]]'))
1528 def debugobsolete(ui, repo, precursor=None, *successors, **opts):
1530 def debugobsolete(ui, repo, precursor=None, *successors, **opts):
1529 """create arbitrary obsolete marker
1531 """create arbitrary obsolete marker
1530
1532
1531 With no arguments, displays the list of obsolescence markers."""
1533 With no arguments, displays the list of obsolescence markers."""
1532
1534
1533 opts = pycompat.byteskwargs(opts)
1535 opts = pycompat.byteskwargs(opts)
1534
1536
1535 def parsenodeid(s):
1537 def parsenodeid(s):
1536 try:
1538 try:
1537 # We do not use revsingle/revrange functions here to accept
1539 # We do not use revsingle/revrange functions here to accept
1538 # arbitrary node identifiers, possibly not present in the
1540 # arbitrary node identifiers, possibly not present in the
1539 # local repository.
1541 # local repository.
1540 n = bin(s)
1542 n = bin(s)
1541 if len(n) != len(nullid):
1543 if len(n) != len(nullid):
1542 raise TypeError()
1544 raise TypeError()
1543 return n
1545 return n
1544 except TypeError:
1546 except TypeError:
1545 raise error.Abort('changeset references must be full hexadecimal '
1547 raise error.Abort('changeset references must be full hexadecimal '
1546 'node identifiers')
1548 'node identifiers')
1547
1549
1548 if opts.get('delete'):
1550 if opts.get('delete'):
1549 indices = []
1551 indices = []
1550 for v in opts.get('delete'):
1552 for v in opts.get('delete'):
1551 try:
1553 try:
1552 indices.append(int(v))
1554 indices.append(int(v))
1553 except ValueError:
1555 except ValueError:
1554 raise error.Abort(_('invalid index value: %r') % v,
1556 raise error.Abort(_('invalid index value: %r') % v,
1555 hint=_('use integers for indices'))
1557 hint=_('use integers for indices'))
1556
1558
1557 if repo.currenttransaction():
1559 if repo.currenttransaction():
1558 raise error.Abort(_('cannot delete obsmarkers in the middle '
1560 raise error.Abort(_('cannot delete obsmarkers in the middle '
1559 'of transaction.'))
1561 'of transaction.'))
1560
1562
1561 with repo.lock():
1563 with repo.lock():
1562 n = repair.deleteobsmarkers(repo.obsstore, indices)
1564 n = repair.deleteobsmarkers(repo.obsstore, indices)
1563 ui.write(_('deleted %i obsolescence markers\n') % n)
1565 ui.write(_('deleted %i obsolescence markers\n') % n)
1564
1566
1565 return
1567 return
1566
1568
1567 if precursor is not None:
1569 if precursor is not None:
1568 if opts['rev']:
1570 if opts['rev']:
1569 raise error.Abort('cannot select revision when creating marker')
1571 raise error.Abort('cannot select revision when creating marker')
1570 metadata = {}
1572 metadata = {}
1571 metadata['user'] = opts['user'] or ui.username()
1573 metadata['user'] = opts['user'] or ui.username()
1572 succs = tuple(parsenodeid(succ) for succ in successors)
1574 succs = tuple(parsenodeid(succ) for succ in successors)
1573 l = repo.lock()
1575 l = repo.lock()
1574 try:
1576 try:
1575 tr = repo.transaction('debugobsolete')
1577 tr = repo.transaction('debugobsolete')
1576 try:
1578 try:
1577 date = opts.get('date')
1579 date = opts.get('date')
1578 if date:
1580 if date:
1579 date = util.parsedate(date)
1581 date = util.parsedate(date)
1580 else:
1582 else:
1581 date = None
1583 date = None
1582 prec = parsenodeid(precursor)
1584 prec = parsenodeid(precursor)
1583 parents = None
1585 parents = None
1584 if opts['record_parents']:
1586 if opts['record_parents']:
1585 if prec not in repo.unfiltered():
1587 if prec not in repo.unfiltered():
1586 raise error.Abort('cannot used --record-parents on '
1588 raise error.Abort('cannot used --record-parents on '
1587 'unknown changesets')
1589 'unknown changesets')
1588 parents = repo.unfiltered()[prec].parents()
1590 parents = repo.unfiltered()[prec].parents()
1589 parents = tuple(p.node() for p in parents)
1591 parents = tuple(p.node() for p in parents)
1590 repo.obsstore.create(tr, prec, succs, opts['flags'],
1592 repo.obsstore.create(tr, prec, succs, opts['flags'],
1591 parents=parents, date=date,
1593 parents=parents, date=date,
1592 metadata=metadata, ui=ui)
1594 metadata=metadata, ui=ui)
1593 tr.close()
1595 tr.close()
1594 except ValueError as exc:
1596 except ValueError as exc:
1595 raise error.Abort(_('bad obsmarker input: %s') %
1597 raise error.Abort(_('bad obsmarker input: %s') %
1596 pycompat.bytestr(exc))
1598 pycompat.bytestr(exc))
1597 finally:
1599 finally:
1598 tr.release()
1600 tr.release()
1599 finally:
1601 finally:
1600 l.release()
1602 l.release()
1601 else:
1603 else:
1602 if opts['rev']:
1604 if opts['rev']:
1603 revs = scmutil.revrange(repo, opts['rev'])
1605 revs = scmutil.revrange(repo, opts['rev'])
1604 nodes = [repo[r].node() for r in revs]
1606 nodes = [repo[r].node() for r in revs]
1605 markers = list(obsutil.getmarkers(repo, nodes=nodes,
1607 markers = list(obsutil.getmarkers(repo, nodes=nodes,
1606 exclusive=opts['exclusive']))
1608 exclusive=opts['exclusive']))
1607 markers.sort(key=lambda x: x._data)
1609 markers.sort(key=lambda x: x._data)
1608 else:
1610 else:
1609 markers = obsutil.getmarkers(repo)
1611 markers = obsutil.getmarkers(repo)
1610
1612
1611 markerstoiter = markers
1613 markerstoiter = markers
1612 isrelevant = lambda m: True
1614 isrelevant = lambda m: True
1613 if opts.get('rev') and opts.get('index'):
1615 if opts.get('rev') and opts.get('index'):
1614 markerstoiter = obsutil.getmarkers(repo)
1616 markerstoiter = obsutil.getmarkers(repo)
1615 markerset = set(markers)
1617 markerset = set(markers)
1616 isrelevant = lambda m: m in markerset
1618 isrelevant = lambda m: m in markerset
1617
1619
1618 fm = ui.formatter('debugobsolete', opts)
1620 fm = ui.formatter('debugobsolete', opts)
1619 for i, m in enumerate(markerstoiter):
1621 for i, m in enumerate(markerstoiter):
1620 if not isrelevant(m):
1622 if not isrelevant(m):
1621 # marker can be irrelevant when we're iterating over a set
1623 # marker can be irrelevant when we're iterating over a set
1622 # of markers (markerstoiter) which is bigger than the set
1624 # of markers (markerstoiter) which is bigger than the set
1623 # of markers we want to display (markers)
1625 # of markers we want to display (markers)
1624 # this can happen if both --index and --rev options are
1626 # this can happen if both --index and --rev options are
1625 # provided and thus we need to iterate over all of the markers
1627 # provided and thus we need to iterate over all of the markers
1626 # to get the correct indices, but only display the ones that
1628 # to get the correct indices, but only display the ones that
1627 # are relevant to --rev value
1629 # are relevant to --rev value
1628 continue
1630 continue
1629 fm.startitem()
1631 fm.startitem()
1630 ind = i if opts.get('index') else None
1632 ind = i if opts.get('index') else None
1631 cmdutil.showmarker(fm, m, index=ind)
1633 cmdutil.showmarker(fm, m, index=ind)
1632 fm.end()
1634 fm.end()
1633
1635
1634 @command('debugpathcomplete',
1636 @command('debugpathcomplete',
1635 [('f', 'full', None, _('complete an entire path')),
1637 [('f', 'full', None, _('complete an entire path')),
1636 ('n', 'normal', None, _('show only normal files')),
1638 ('n', 'normal', None, _('show only normal files')),
1637 ('a', 'added', None, _('show only added files')),
1639 ('a', 'added', None, _('show only added files')),
1638 ('r', 'removed', None, _('show only removed files'))],
1640 ('r', 'removed', None, _('show only removed files'))],
1639 _('FILESPEC...'))
1641 _('FILESPEC...'))
1640 def debugpathcomplete(ui, repo, *specs, **opts):
1642 def debugpathcomplete(ui, repo, *specs, **opts):
1641 '''complete part or all of a tracked path
1643 '''complete part or all of a tracked path
1642
1644
1643 This command supports shells that offer path name completion. It
1645 This command supports shells that offer path name completion. It
1644 currently completes only files already known to the dirstate.
1646 currently completes only files already known to the dirstate.
1645
1647
1646 Completion extends only to the next path segment unless
1648 Completion extends only to the next path segment unless
1647 --full is specified, in which case entire paths are used.'''
1649 --full is specified, in which case entire paths are used.'''
1648
1650
1649 def complete(path, acceptable):
1651 def complete(path, acceptable):
1650 dirstate = repo.dirstate
1652 dirstate = repo.dirstate
1651 spec = os.path.normpath(os.path.join(pycompat.getcwd(), path))
1653 spec = os.path.normpath(os.path.join(pycompat.getcwd(), path))
1652 rootdir = repo.root + pycompat.ossep
1654 rootdir = repo.root + pycompat.ossep
1653 if spec != repo.root and not spec.startswith(rootdir):
1655 if spec != repo.root and not spec.startswith(rootdir):
1654 return [], []
1656 return [], []
1655 if os.path.isdir(spec):
1657 if os.path.isdir(spec):
1656 spec += '/'
1658 spec += '/'
1657 spec = spec[len(rootdir):]
1659 spec = spec[len(rootdir):]
1658 fixpaths = pycompat.ossep != '/'
1660 fixpaths = pycompat.ossep != '/'
1659 if fixpaths:
1661 if fixpaths:
1660 spec = spec.replace(pycompat.ossep, '/')
1662 spec = spec.replace(pycompat.ossep, '/')
1661 speclen = len(spec)
1663 speclen = len(spec)
1662 fullpaths = opts[r'full']
1664 fullpaths = opts[r'full']
1663 files, dirs = set(), set()
1665 files, dirs = set(), set()
1664 adddir, addfile = dirs.add, files.add
1666 adddir, addfile = dirs.add, files.add
1665 for f, st in dirstate.iteritems():
1667 for f, st in dirstate.iteritems():
1666 if f.startswith(spec) and st[0] in acceptable:
1668 if f.startswith(spec) and st[0] in acceptable:
1667 if fixpaths:
1669 if fixpaths:
1668 f = f.replace('/', pycompat.ossep)
1670 f = f.replace('/', pycompat.ossep)
1669 if fullpaths:
1671 if fullpaths:
1670 addfile(f)
1672 addfile(f)
1671 continue
1673 continue
1672 s = f.find(pycompat.ossep, speclen)
1674 s = f.find(pycompat.ossep, speclen)
1673 if s >= 0:
1675 if s >= 0:
1674 adddir(f[:s])
1676 adddir(f[:s])
1675 else:
1677 else:
1676 addfile(f)
1678 addfile(f)
1677 return files, dirs
1679 return files, dirs
1678
1680
1679 acceptable = ''
1681 acceptable = ''
1680 if opts[r'normal']:
1682 if opts[r'normal']:
1681 acceptable += 'nm'
1683 acceptable += 'nm'
1682 if opts[r'added']:
1684 if opts[r'added']:
1683 acceptable += 'a'
1685 acceptable += 'a'
1684 if opts[r'removed']:
1686 if opts[r'removed']:
1685 acceptable += 'r'
1687 acceptable += 'r'
1686 cwd = repo.getcwd()
1688 cwd = repo.getcwd()
1687 if not specs:
1689 if not specs:
1688 specs = ['.']
1690 specs = ['.']
1689
1691
1690 files, dirs = set(), set()
1692 files, dirs = set(), set()
1691 for spec in specs:
1693 for spec in specs:
1692 f, d = complete(spec, acceptable or 'nmar')
1694 f, d = complete(spec, acceptable or 'nmar')
1693 files.update(f)
1695 files.update(f)
1694 dirs.update(d)
1696 dirs.update(d)
1695 files.update(dirs)
1697 files.update(dirs)
1696 ui.write('\n'.join(repo.pathto(p, cwd) for p in sorted(files)))
1698 ui.write('\n'.join(repo.pathto(p, cwd) for p in sorted(files)))
1697 ui.write('\n')
1699 ui.write('\n')
1698
1700
1699 @command('debugpeer', [], _('PATH'), norepo=True)
1701 @command('debugpeer', [], _('PATH'), norepo=True)
1700 def debugpeer(ui, path):
1702 def debugpeer(ui, path):
1701 """establish a connection to a peer repository"""
1703 """establish a connection to a peer repository"""
1702 # Always enable peer request logging. Requires --debug to display
1704 # Always enable peer request logging. Requires --debug to display
1703 # though.
1705 # though.
1704 overrides = {
1706 overrides = {
1705 ('devel', 'debug.peer-request'): True,
1707 ('devel', 'debug.peer-request'): True,
1706 }
1708 }
1707
1709
1708 with ui.configoverride(overrides):
1710 with ui.configoverride(overrides):
1709 peer = hg.peer(ui, {}, path)
1711 peer = hg.peer(ui, {}, path)
1710
1712
1711 local = peer.local() is not None
1713 local = peer.local() is not None
1712 canpush = peer.canpush()
1714 canpush = peer.canpush()
1713
1715
1714 ui.write(_('url: %s\n') % peer.url())
1716 ui.write(_('url: %s\n') % peer.url())
1715 ui.write(_('local: %s\n') % (_('yes') if local else _('no')))
1717 ui.write(_('local: %s\n') % (_('yes') if local else _('no')))
1716 ui.write(_('pushable: %s\n') % (_('yes') if canpush else _('no')))
1718 ui.write(_('pushable: %s\n') % (_('yes') if canpush else _('no')))
1717
1719
1718 @command('debugpickmergetool',
1720 @command('debugpickmergetool',
1719 [('r', 'rev', '', _('check for files in this revision'), _('REV')),
1721 [('r', 'rev', '', _('check for files in this revision'), _('REV')),
1720 ('', 'changedelete', None, _('emulate merging change and delete')),
1722 ('', 'changedelete', None, _('emulate merging change and delete')),
1721 ] + cmdutil.walkopts + cmdutil.mergetoolopts,
1723 ] + cmdutil.walkopts + cmdutil.mergetoolopts,
1722 _('[PATTERN]...'),
1724 _('[PATTERN]...'),
1723 inferrepo=True)
1725 inferrepo=True)
1724 def debugpickmergetool(ui, repo, *pats, **opts):
1726 def debugpickmergetool(ui, repo, *pats, **opts):
1725 """examine which merge tool is chosen for specified file
1727 """examine which merge tool is chosen for specified file
1726
1728
1727 As described in :hg:`help merge-tools`, Mercurial examines
1729 As described in :hg:`help merge-tools`, Mercurial examines
1728 configurations below in this order to decide which merge tool is
1730 configurations below in this order to decide which merge tool is
1729 chosen for specified file.
1731 chosen for specified file.
1730
1732
1731 1. ``--tool`` option
1733 1. ``--tool`` option
1732 2. ``HGMERGE`` environment variable
1734 2. ``HGMERGE`` environment variable
1733 3. configurations in ``merge-patterns`` section
1735 3. configurations in ``merge-patterns`` section
1734 4. configuration of ``ui.merge``
1736 4. configuration of ``ui.merge``
1735 5. configurations in ``merge-tools`` section
1737 5. configurations in ``merge-tools`` section
1736 6. ``hgmerge`` tool (for historical reason only)
1738 6. ``hgmerge`` tool (for historical reason only)
1737 7. default tool for fallback (``:merge`` or ``:prompt``)
1739 7. default tool for fallback (``:merge`` or ``:prompt``)
1738
1740
1739 This command writes out examination result in the style below::
1741 This command writes out examination result in the style below::
1740
1742
1741 FILE = MERGETOOL
1743 FILE = MERGETOOL
1742
1744
1743 By default, all files known in the first parent context of the
1745 By default, all files known in the first parent context of the
1744 working directory are examined. Use file patterns and/or -I/-X
1746 working directory are examined. Use file patterns and/or -I/-X
1745 options to limit target files. -r/--rev is also useful to examine
1747 options to limit target files. -r/--rev is also useful to examine
1746 files in another context without actual updating to it.
1748 files in another context without actual updating to it.
1747
1749
1748 With --debug, this command shows warning messages while matching
1750 With --debug, this command shows warning messages while matching
1749 against ``merge-patterns`` and so on, too. It is recommended to
1751 against ``merge-patterns`` and so on, too. It is recommended to
1750 use this option with explicit file patterns and/or -I/-X options,
1752 use this option with explicit file patterns and/or -I/-X options,
1751 because this option increases amount of output per file according
1753 because this option increases amount of output per file according
1752 to configurations in hgrc.
1754 to configurations in hgrc.
1753
1755
1754 With -v/--verbose, this command shows configurations below at
1756 With -v/--verbose, this command shows configurations below at
1755 first (only if specified).
1757 first (only if specified).
1756
1758
1757 - ``--tool`` option
1759 - ``--tool`` option
1758 - ``HGMERGE`` environment variable
1760 - ``HGMERGE`` environment variable
1759 - configuration of ``ui.merge``
1761 - configuration of ``ui.merge``
1760
1762
1761 If merge tool is chosen before matching against
1763 If merge tool is chosen before matching against
1762 ``merge-patterns``, this command can't show any helpful
1764 ``merge-patterns``, this command can't show any helpful
1763 information, even with --debug. In such case, information above is
1765 information, even with --debug. In such case, information above is
1764 useful to know why a merge tool is chosen.
1766 useful to know why a merge tool is chosen.
1765 """
1767 """
1766 opts = pycompat.byteskwargs(opts)
1768 opts = pycompat.byteskwargs(opts)
1767 overrides = {}
1769 overrides = {}
1768 if opts['tool']:
1770 if opts['tool']:
1769 overrides[('ui', 'forcemerge')] = opts['tool']
1771 overrides[('ui', 'forcemerge')] = opts['tool']
1770 ui.note(('with --tool %r\n') % (opts['tool']))
1772 ui.note(('with --tool %r\n') % (opts['tool']))
1771
1773
1772 with ui.configoverride(overrides, 'debugmergepatterns'):
1774 with ui.configoverride(overrides, 'debugmergepatterns'):
1773 hgmerge = encoding.environ.get("HGMERGE")
1775 hgmerge = encoding.environ.get("HGMERGE")
1774 if hgmerge is not None:
1776 if hgmerge is not None:
1775 ui.note(('with HGMERGE=%r\n') % (hgmerge))
1777 ui.note(('with HGMERGE=%r\n') % (hgmerge))
1776 uimerge = ui.config("ui", "merge")
1778 uimerge = ui.config("ui", "merge")
1777 if uimerge:
1779 if uimerge:
1778 ui.note(('with ui.merge=%r\n') % (uimerge))
1780 ui.note(('with ui.merge=%r\n') % (uimerge))
1779
1781
1780 ctx = scmutil.revsingle(repo, opts.get('rev'))
1782 ctx = scmutil.revsingle(repo, opts.get('rev'))
1781 m = scmutil.match(ctx, pats, opts)
1783 m = scmutil.match(ctx, pats, opts)
1782 changedelete = opts['changedelete']
1784 changedelete = opts['changedelete']
1783 for path in ctx.walk(m):
1785 for path in ctx.walk(m):
1784 fctx = ctx[path]
1786 fctx = ctx[path]
1785 try:
1787 try:
1786 if not ui.debugflag:
1788 if not ui.debugflag:
1787 ui.pushbuffer(error=True)
1789 ui.pushbuffer(error=True)
1788 tool, toolpath = filemerge._picktool(repo, ui, path,
1790 tool, toolpath = filemerge._picktool(repo, ui, path,
1789 fctx.isbinary(),
1791 fctx.isbinary(),
1790 'l' in fctx.flags(),
1792 'l' in fctx.flags(),
1791 changedelete)
1793 changedelete)
1792 finally:
1794 finally:
1793 if not ui.debugflag:
1795 if not ui.debugflag:
1794 ui.popbuffer()
1796 ui.popbuffer()
1795 ui.write(('%s = %s\n') % (path, tool))
1797 ui.write(('%s = %s\n') % (path, tool))
1796
1798
1797 @command('debugpushkey', [], _('REPO NAMESPACE [KEY OLD NEW]'), norepo=True)
1799 @command('debugpushkey', [], _('REPO NAMESPACE [KEY OLD NEW]'), norepo=True)
1798 def debugpushkey(ui, repopath, namespace, *keyinfo, **opts):
1800 def debugpushkey(ui, repopath, namespace, *keyinfo, **opts):
1799 '''access the pushkey key/value protocol
1801 '''access the pushkey key/value protocol
1800
1802
1801 With two args, list the keys in the given namespace.
1803 With two args, list the keys in the given namespace.
1802
1804
1803 With five args, set a key to new if it currently is set to old.
1805 With five args, set a key to new if it currently is set to old.
1804 Reports success or failure.
1806 Reports success or failure.
1805 '''
1807 '''
1806
1808
1807 target = hg.peer(ui, {}, repopath)
1809 target = hg.peer(ui, {}, repopath)
1808 if keyinfo:
1810 if keyinfo:
1809 key, old, new = keyinfo
1811 key, old, new = keyinfo
1810 r = target.pushkey(namespace, key, old, new)
1812 r = target.pushkey(namespace, key, old, new)
1811 ui.status(str(r) + '\n')
1813 ui.status(str(r) + '\n')
1812 return not r
1814 return not r
1813 else:
1815 else:
1814 for k, v in sorted(target.listkeys(namespace).iteritems()):
1816 for k, v in sorted(target.listkeys(namespace).iteritems()):
1815 ui.write("%s\t%s\n" % (util.escapestr(k),
1817 ui.write("%s\t%s\n" % (util.escapestr(k),
1816 util.escapestr(v)))
1818 util.escapestr(v)))
1817
1819
1818 @command('debugpvec', [], _('A B'))
1820 @command('debugpvec', [], _('A B'))
1819 def debugpvec(ui, repo, a, b=None):
1821 def debugpvec(ui, repo, a, b=None):
1820 ca = scmutil.revsingle(repo, a)
1822 ca = scmutil.revsingle(repo, a)
1821 cb = scmutil.revsingle(repo, b)
1823 cb = scmutil.revsingle(repo, b)
1822 pa = pvec.ctxpvec(ca)
1824 pa = pvec.ctxpvec(ca)
1823 pb = pvec.ctxpvec(cb)
1825 pb = pvec.ctxpvec(cb)
1824 if pa == pb:
1826 if pa == pb:
1825 rel = "="
1827 rel = "="
1826 elif pa > pb:
1828 elif pa > pb:
1827 rel = ">"
1829 rel = ">"
1828 elif pa < pb:
1830 elif pa < pb:
1829 rel = "<"
1831 rel = "<"
1830 elif pa | pb:
1832 elif pa | pb:
1831 rel = "|"
1833 rel = "|"
1832 ui.write(_("a: %s\n") % pa)
1834 ui.write(_("a: %s\n") % pa)
1833 ui.write(_("b: %s\n") % pb)
1835 ui.write(_("b: %s\n") % pb)
1834 ui.write(_("depth(a): %d depth(b): %d\n") % (pa._depth, pb._depth))
1836 ui.write(_("depth(a): %d depth(b): %d\n") % (pa._depth, pb._depth))
1835 ui.write(_("delta: %d hdist: %d distance: %d relation: %s\n") %
1837 ui.write(_("delta: %d hdist: %d distance: %d relation: %s\n") %
1836 (abs(pa._depth - pb._depth), pvec._hamming(pa._vec, pb._vec),
1838 (abs(pa._depth - pb._depth), pvec._hamming(pa._vec, pb._vec),
1837 pa.distance(pb), rel))
1839 pa.distance(pb), rel))
1838
1840
1839 @command('debugrebuilddirstate|debugrebuildstate',
1841 @command('debugrebuilddirstate|debugrebuildstate',
1840 [('r', 'rev', '', _('revision to rebuild to'), _('REV')),
1842 [('r', 'rev', '', _('revision to rebuild to'), _('REV')),
1841 ('', 'minimal', None, _('only rebuild files that are inconsistent with '
1843 ('', 'minimal', None, _('only rebuild files that are inconsistent with '
1842 'the working copy parent')),
1844 'the working copy parent')),
1843 ],
1845 ],
1844 _('[-r REV]'))
1846 _('[-r REV]'))
1845 def debugrebuilddirstate(ui, repo, rev, **opts):
1847 def debugrebuilddirstate(ui, repo, rev, **opts):
1846 """rebuild the dirstate as it would look like for the given revision
1848 """rebuild the dirstate as it would look like for the given revision
1847
1849
1848 If no revision is specified the first current parent will be used.
1850 If no revision is specified the first current parent will be used.
1849
1851
1850 The dirstate will be set to the files of the given revision.
1852 The dirstate will be set to the files of the given revision.
1851 The actual working directory content or existing dirstate
1853 The actual working directory content or existing dirstate
1852 information such as adds or removes is not considered.
1854 information such as adds or removes is not considered.
1853
1855
1854 ``minimal`` will only rebuild the dirstate status for files that claim to be
1856 ``minimal`` will only rebuild the dirstate status for files that claim to be
1855 tracked but are not in the parent manifest, or that exist in the parent
1857 tracked but are not in the parent manifest, or that exist in the parent
1856 manifest but are not in the dirstate. It will not change adds, removes, or
1858 manifest but are not in the dirstate. It will not change adds, removes, or
1857 modified files that are in the working copy parent.
1859 modified files that are in the working copy parent.
1858
1860
1859 One use of this command is to make the next :hg:`status` invocation
1861 One use of this command is to make the next :hg:`status` invocation
1860 check the actual file content.
1862 check the actual file content.
1861 """
1863 """
1862 ctx = scmutil.revsingle(repo, rev)
1864 ctx = scmutil.revsingle(repo, rev)
1863 with repo.wlock():
1865 with repo.wlock():
1864 dirstate = repo.dirstate
1866 dirstate = repo.dirstate
1865 changedfiles = None
1867 changedfiles = None
1866 # See command doc for what minimal does.
1868 # See command doc for what minimal does.
1867 if opts.get(r'minimal'):
1869 if opts.get(r'minimal'):
1868 manifestfiles = set(ctx.manifest().keys())
1870 manifestfiles = set(ctx.manifest().keys())
1869 dirstatefiles = set(dirstate)
1871 dirstatefiles = set(dirstate)
1870 manifestonly = manifestfiles - dirstatefiles
1872 manifestonly = manifestfiles - dirstatefiles
1871 dsonly = dirstatefiles - manifestfiles
1873 dsonly = dirstatefiles - manifestfiles
1872 dsnotadded = set(f for f in dsonly if dirstate[f] != 'a')
1874 dsnotadded = set(f for f in dsonly if dirstate[f] != 'a')
1873 changedfiles = manifestonly | dsnotadded
1875 changedfiles = manifestonly | dsnotadded
1874
1876
1875 dirstate.rebuild(ctx.node(), ctx.manifest(), changedfiles)
1877 dirstate.rebuild(ctx.node(), ctx.manifest(), changedfiles)
1876
1878
1877 @command('debugrebuildfncache', [], '')
1879 @command('debugrebuildfncache', [], '')
1878 def debugrebuildfncache(ui, repo):
1880 def debugrebuildfncache(ui, repo):
1879 """rebuild the fncache file"""
1881 """rebuild the fncache file"""
1880 repair.rebuildfncache(ui, repo)
1882 repair.rebuildfncache(ui, repo)
1881
1883
1882 @command('debugrename',
1884 @command('debugrename',
1883 [('r', 'rev', '', _('revision to debug'), _('REV'))],
1885 [('r', 'rev', '', _('revision to debug'), _('REV'))],
1884 _('[-r REV] FILE'))
1886 _('[-r REV] FILE'))
1885 def debugrename(ui, repo, file1, *pats, **opts):
1887 def debugrename(ui, repo, file1, *pats, **opts):
1886 """dump rename information"""
1888 """dump rename information"""
1887
1889
1888 opts = pycompat.byteskwargs(opts)
1890 opts = pycompat.byteskwargs(opts)
1889 ctx = scmutil.revsingle(repo, opts.get('rev'))
1891 ctx = scmutil.revsingle(repo, opts.get('rev'))
1890 m = scmutil.match(ctx, (file1,) + pats, opts)
1892 m = scmutil.match(ctx, (file1,) + pats, opts)
1891 for abs in ctx.walk(m):
1893 for abs in ctx.walk(m):
1892 fctx = ctx[abs]
1894 fctx = ctx[abs]
1893 o = fctx.filelog().renamed(fctx.filenode())
1895 o = fctx.filelog().renamed(fctx.filenode())
1894 rel = m.rel(abs)
1896 rel = m.rel(abs)
1895 if o:
1897 if o:
1896 ui.write(_("%s renamed from %s:%s\n") % (rel, o[0], hex(o[1])))
1898 ui.write(_("%s renamed from %s:%s\n") % (rel, o[0], hex(o[1])))
1897 else:
1899 else:
1898 ui.write(_("%s not renamed\n") % rel)
1900 ui.write(_("%s not renamed\n") % rel)
1899
1901
1900 @command('debugrevlog', cmdutil.debugrevlogopts +
1902 @command('debugrevlog', cmdutil.debugrevlogopts +
1901 [('d', 'dump', False, _('dump index data'))],
1903 [('d', 'dump', False, _('dump index data'))],
1902 _('-c|-m|FILE'),
1904 _('-c|-m|FILE'),
1903 optionalrepo=True)
1905 optionalrepo=True)
1904 def debugrevlog(ui, repo, file_=None, **opts):
1906 def debugrevlog(ui, repo, file_=None, **opts):
1905 """show data and statistics about a revlog"""
1907 """show data and statistics about a revlog"""
1906 opts = pycompat.byteskwargs(opts)
1908 opts = pycompat.byteskwargs(opts)
1907 r = cmdutil.openrevlog(repo, 'debugrevlog', file_, opts)
1909 r = cmdutil.openrevlog(repo, 'debugrevlog', file_, opts)
1908
1910
1909 if opts.get("dump"):
1911 if opts.get("dump"):
1910 numrevs = len(r)
1912 numrevs = len(r)
1911 ui.write(("# rev p1rev p2rev start end deltastart base p1 p2"
1913 ui.write(("# rev p1rev p2rev start end deltastart base p1 p2"
1912 " rawsize totalsize compression heads chainlen\n"))
1914 " rawsize totalsize compression heads chainlen\n"))
1913 ts = 0
1915 ts = 0
1914 heads = set()
1916 heads = set()
1915
1917
1916 for rev in xrange(numrevs):
1918 for rev in xrange(numrevs):
1917 dbase = r.deltaparent(rev)
1919 dbase = r.deltaparent(rev)
1918 if dbase == -1:
1920 if dbase == -1:
1919 dbase = rev
1921 dbase = rev
1920 cbase = r.chainbase(rev)
1922 cbase = r.chainbase(rev)
1921 clen = r.chainlen(rev)
1923 clen = r.chainlen(rev)
1922 p1, p2 = r.parentrevs(rev)
1924 p1, p2 = r.parentrevs(rev)
1923 rs = r.rawsize(rev)
1925 rs = r.rawsize(rev)
1924 ts = ts + rs
1926 ts = ts + rs
1925 heads -= set(r.parentrevs(rev))
1927 heads -= set(r.parentrevs(rev))
1926 heads.add(rev)
1928 heads.add(rev)
1927 try:
1929 try:
1928 compression = ts / r.end(rev)
1930 compression = ts / r.end(rev)
1929 except ZeroDivisionError:
1931 except ZeroDivisionError:
1930 compression = 0
1932 compression = 0
1931 ui.write("%5d %5d %5d %5d %5d %10d %4d %4d %4d %7d %9d "
1933 ui.write("%5d %5d %5d %5d %5d %10d %4d %4d %4d %7d %9d "
1932 "%11d %5d %8d\n" %
1934 "%11d %5d %8d\n" %
1933 (rev, p1, p2, r.start(rev), r.end(rev),
1935 (rev, p1, p2, r.start(rev), r.end(rev),
1934 r.start(dbase), r.start(cbase),
1936 r.start(dbase), r.start(cbase),
1935 r.start(p1), r.start(p2),
1937 r.start(p1), r.start(p2),
1936 rs, ts, compression, len(heads), clen))
1938 rs, ts, compression, len(heads), clen))
1937 return 0
1939 return 0
1938
1940
1939 v = r.version
1941 v = r.version
1940 format = v & 0xFFFF
1942 format = v & 0xFFFF
1941 flags = []
1943 flags = []
1942 gdelta = False
1944 gdelta = False
1943 if v & revlog.FLAG_INLINE_DATA:
1945 if v & revlog.FLAG_INLINE_DATA:
1944 flags.append('inline')
1946 flags.append('inline')
1945 if v & revlog.FLAG_GENERALDELTA:
1947 if v & revlog.FLAG_GENERALDELTA:
1946 gdelta = True
1948 gdelta = True
1947 flags.append('generaldelta')
1949 flags.append('generaldelta')
1948 if not flags:
1950 if not flags:
1949 flags = ['(none)']
1951 flags = ['(none)']
1950
1952
1951 nummerges = 0
1953 nummerges = 0
1952 numfull = 0
1954 numfull = 0
1953 numprev = 0
1955 numprev = 0
1954 nump1 = 0
1956 nump1 = 0
1955 nump2 = 0
1957 nump2 = 0
1956 numother = 0
1958 numother = 0
1957 nump1prev = 0
1959 nump1prev = 0
1958 nump2prev = 0
1960 nump2prev = 0
1959 chainlengths = []
1961 chainlengths = []
1960 chainbases = []
1962 chainbases = []
1961 chainspans = []
1963 chainspans = []
1962
1964
1963 datasize = [None, 0, 0]
1965 datasize = [None, 0, 0]
1964 fullsize = [None, 0, 0]
1966 fullsize = [None, 0, 0]
1965 deltasize = [None, 0, 0]
1967 deltasize = [None, 0, 0]
1966 chunktypecounts = {}
1968 chunktypecounts = {}
1967 chunktypesizes = {}
1969 chunktypesizes = {}
1968
1970
1969 def addsize(size, l):
1971 def addsize(size, l):
1970 if l[0] is None or size < l[0]:
1972 if l[0] is None or size < l[0]:
1971 l[0] = size
1973 l[0] = size
1972 if size > l[1]:
1974 if size > l[1]:
1973 l[1] = size
1975 l[1] = size
1974 l[2] += size
1976 l[2] += size
1975
1977
1976 numrevs = len(r)
1978 numrevs = len(r)
1977 for rev in xrange(numrevs):
1979 for rev in xrange(numrevs):
1978 p1, p2 = r.parentrevs(rev)
1980 p1, p2 = r.parentrevs(rev)
1979 delta = r.deltaparent(rev)
1981 delta = r.deltaparent(rev)
1980 if format > 0:
1982 if format > 0:
1981 addsize(r.rawsize(rev), datasize)
1983 addsize(r.rawsize(rev), datasize)
1982 if p2 != nullrev:
1984 if p2 != nullrev:
1983 nummerges += 1
1985 nummerges += 1
1984 size = r.length(rev)
1986 size = r.length(rev)
1985 if delta == nullrev:
1987 if delta == nullrev:
1986 chainlengths.append(0)
1988 chainlengths.append(0)
1987 chainbases.append(r.start(rev))
1989 chainbases.append(r.start(rev))
1988 chainspans.append(size)
1990 chainspans.append(size)
1989 numfull += 1
1991 numfull += 1
1990 addsize(size, fullsize)
1992 addsize(size, fullsize)
1991 else:
1993 else:
1992 chainlengths.append(chainlengths[delta] + 1)
1994 chainlengths.append(chainlengths[delta] + 1)
1993 baseaddr = chainbases[delta]
1995 baseaddr = chainbases[delta]
1994 revaddr = r.start(rev)
1996 revaddr = r.start(rev)
1995 chainbases.append(baseaddr)
1997 chainbases.append(baseaddr)
1996 chainspans.append((revaddr - baseaddr) + size)
1998 chainspans.append((revaddr - baseaddr) + size)
1997 addsize(size, deltasize)
1999 addsize(size, deltasize)
1998 if delta == rev - 1:
2000 if delta == rev - 1:
1999 numprev += 1
2001 numprev += 1
2000 if delta == p1:
2002 if delta == p1:
2001 nump1prev += 1
2003 nump1prev += 1
2002 elif delta == p2:
2004 elif delta == p2:
2003 nump2prev += 1
2005 nump2prev += 1
2004 elif delta == p1:
2006 elif delta == p1:
2005 nump1 += 1
2007 nump1 += 1
2006 elif delta == p2:
2008 elif delta == p2:
2007 nump2 += 1
2009 nump2 += 1
2008 elif delta != nullrev:
2010 elif delta != nullrev:
2009 numother += 1
2011 numother += 1
2010
2012
2011 # Obtain data on the raw chunks in the revlog.
2013 # Obtain data on the raw chunks in the revlog.
2012 segment = r._getsegmentforrevs(rev, rev)[1]
2014 segment = r._getsegmentforrevs(rev, rev)[1]
2013 if segment:
2015 if segment:
2014 chunktype = bytes(segment[0:1])
2016 chunktype = bytes(segment[0:1])
2015 else:
2017 else:
2016 chunktype = 'empty'
2018 chunktype = 'empty'
2017
2019
2018 if chunktype not in chunktypecounts:
2020 if chunktype not in chunktypecounts:
2019 chunktypecounts[chunktype] = 0
2021 chunktypecounts[chunktype] = 0
2020 chunktypesizes[chunktype] = 0
2022 chunktypesizes[chunktype] = 0
2021
2023
2022 chunktypecounts[chunktype] += 1
2024 chunktypecounts[chunktype] += 1
2023 chunktypesizes[chunktype] += size
2025 chunktypesizes[chunktype] += size
2024
2026
2025 # Adjust size min value for empty cases
2027 # Adjust size min value for empty cases
2026 for size in (datasize, fullsize, deltasize):
2028 for size in (datasize, fullsize, deltasize):
2027 if size[0] is None:
2029 if size[0] is None:
2028 size[0] = 0
2030 size[0] = 0
2029
2031
2030 numdeltas = numrevs - numfull
2032 numdeltas = numrevs - numfull
2031 numoprev = numprev - nump1prev - nump2prev
2033 numoprev = numprev - nump1prev - nump2prev
2032 totalrawsize = datasize[2]
2034 totalrawsize = datasize[2]
2033 datasize[2] /= numrevs
2035 datasize[2] /= numrevs
2034 fulltotal = fullsize[2]
2036 fulltotal = fullsize[2]
2035 fullsize[2] /= numfull
2037 fullsize[2] /= numfull
2036 deltatotal = deltasize[2]
2038 deltatotal = deltasize[2]
2037 if numrevs - numfull > 0:
2039 if numrevs - numfull > 0:
2038 deltasize[2] /= numrevs - numfull
2040 deltasize[2] /= numrevs - numfull
2039 totalsize = fulltotal + deltatotal
2041 totalsize = fulltotal + deltatotal
2040 avgchainlen = sum(chainlengths) / numrevs
2042 avgchainlen = sum(chainlengths) / numrevs
2041 maxchainlen = max(chainlengths)
2043 maxchainlen = max(chainlengths)
2042 maxchainspan = max(chainspans)
2044 maxchainspan = max(chainspans)
2043 compratio = 1
2045 compratio = 1
2044 if totalsize:
2046 if totalsize:
2045 compratio = totalrawsize / totalsize
2047 compratio = totalrawsize / totalsize
2046
2048
2047 basedfmtstr = '%%%dd\n'
2049 basedfmtstr = '%%%dd\n'
2048 basepcfmtstr = '%%%dd %s(%%5.2f%%%%)\n'
2050 basepcfmtstr = '%%%dd %s(%%5.2f%%%%)\n'
2049
2051
2050 def dfmtstr(max):
2052 def dfmtstr(max):
2051 return basedfmtstr % len(str(max))
2053 return basedfmtstr % len(str(max))
2052 def pcfmtstr(max, padding=0):
2054 def pcfmtstr(max, padding=0):
2053 return basepcfmtstr % (len(str(max)), ' ' * padding)
2055 return basepcfmtstr % (len(str(max)), ' ' * padding)
2054
2056
2055 def pcfmt(value, total):
2057 def pcfmt(value, total):
2056 if total:
2058 if total:
2057 return (value, 100 * float(value) / total)
2059 return (value, 100 * float(value) / total)
2058 else:
2060 else:
2059 return value, 100.0
2061 return value, 100.0
2060
2062
2061 ui.write(('format : %d\n') % format)
2063 ui.write(('format : %d\n') % format)
2062 ui.write(('flags : %s\n') % ', '.join(flags))
2064 ui.write(('flags : %s\n') % ', '.join(flags))
2063
2065
2064 ui.write('\n')
2066 ui.write('\n')
2065 fmt = pcfmtstr(totalsize)
2067 fmt = pcfmtstr(totalsize)
2066 fmt2 = dfmtstr(totalsize)
2068 fmt2 = dfmtstr(totalsize)
2067 ui.write(('revisions : ') + fmt2 % numrevs)
2069 ui.write(('revisions : ') + fmt2 % numrevs)
2068 ui.write((' merges : ') + fmt % pcfmt(nummerges, numrevs))
2070 ui.write((' merges : ') + fmt % pcfmt(nummerges, numrevs))
2069 ui.write((' normal : ') + fmt % pcfmt(numrevs - nummerges, numrevs))
2071 ui.write((' normal : ') + fmt % pcfmt(numrevs - nummerges, numrevs))
2070 ui.write(('revisions : ') + fmt2 % numrevs)
2072 ui.write(('revisions : ') + fmt2 % numrevs)
2071 ui.write((' full : ') + fmt % pcfmt(numfull, numrevs))
2073 ui.write((' full : ') + fmt % pcfmt(numfull, numrevs))
2072 ui.write((' deltas : ') + fmt % pcfmt(numdeltas, numrevs))
2074 ui.write((' deltas : ') + fmt % pcfmt(numdeltas, numrevs))
2073 ui.write(('revision size : ') + fmt2 % totalsize)
2075 ui.write(('revision size : ') + fmt2 % totalsize)
2074 ui.write((' full : ') + fmt % pcfmt(fulltotal, totalsize))
2076 ui.write((' full : ') + fmt % pcfmt(fulltotal, totalsize))
2075 ui.write((' deltas : ') + fmt % pcfmt(deltatotal, totalsize))
2077 ui.write((' deltas : ') + fmt % pcfmt(deltatotal, totalsize))
2076
2078
2077 def fmtchunktype(chunktype):
2079 def fmtchunktype(chunktype):
2078 if chunktype == 'empty':
2080 if chunktype == 'empty':
2079 return ' %s : ' % chunktype
2081 return ' %s : ' % chunktype
2080 elif chunktype in pycompat.bytestr(string.ascii_letters):
2082 elif chunktype in pycompat.bytestr(string.ascii_letters):
2081 return ' 0x%s (%s) : ' % (hex(chunktype), chunktype)
2083 return ' 0x%s (%s) : ' % (hex(chunktype), chunktype)
2082 else:
2084 else:
2083 return ' 0x%s : ' % hex(chunktype)
2085 return ' 0x%s : ' % hex(chunktype)
2084
2086
2085 ui.write('\n')
2087 ui.write('\n')
2086 ui.write(('chunks : ') + fmt2 % numrevs)
2088 ui.write(('chunks : ') + fmt2 % numrevs)
2087 for chunktype in sorted(chunktypecounts):
2089 for chunktype in sorted(chunktypecounts):
2088 ui.write(fmtchunktype(chunktype))
2090 ui.write(fmtchunktype(chunktype))
2089 ui.write(fmt % pcfmt(chunktypecounts[chunktype], numrevs))
2091 ui.write(fmt % pcfmt(chunktypecounts[chunktype], numrevs))
2090 ui.write(('chunks size : ') + fmt2 % totalsize)
2092 ui.write(('chunks size : ') + fmt2 % totalsize)
2091 for chunktype in sorted(chunktypecounts):
2093 for chunktype in sorted(chunktypecounts):
2092 ui.write(fmtchunktype(chunktype))
2094 ui.write(fmtchunktype(chunktype))
2093 ui.write(fmt % pcfmt(chunktypesizes[chunktype], totalsize))
2095 ui.write(fmt % pcfmt(chunktypesizes[chunktype], totalsize))
2094
2096
2095 ui.write('\n')
2097 ui.write('\n')
2096 fmt = dfmtstr(max(avgchainlen, maxchainlen, maxchainspan, compratio))
2098 fmt = dfmtstr(max(avgchainlen, maxchainlen, maxchainspan, compratio))
2097 ui.write(('avg chain length : ') + fmt % avgchainlen)
2099 ui.write(('avg chain length : ') + fmt % avgchainlen)
2098 ui.write(('max chain length : ') + fmt % maxchainlen)
2100 ui.write(('max chain length : ') + fmt % maxchainlen)
2099 ui.write(('max chain reach : ') + fmt % maxchainspan)
2101 ui.write(('max chain reach : ') + fmt % maxchainspan)
2100 ui.write(('compression ratio : ') + fmt % compratio)
2102 ui.write(('compression ratio : ') + fmt % compratio)
2101
2103
2102 if format > 0:
2104 if format > 0:
2103 ui.write('\n')
2105 ui.write('\n')
2104 ui.write(('uncompressed data size (min/max/avg) : %d / %d / %d\n')
2106 ui.write(('uncompressed data size (min/max/avg) : %d / %d / %d\n')
2105 % tuple(datasize))
2107 % tuple(datasize))
2106 ui.write(('full revision size (min/max/avg) : %d / %d / %d\n')
2108 ui.write(('full revision size (min/max/avg) : %d / %d / %d\n')
2107 % tuple(fullsize))
2109 % tuple(fullsize))
2108 ui.write(('delta size (min/max/avg) : %d / %d / %d\n')
2110 ui.write(('delta size (min/max/avg) : %d / %d / %d\n')
2109 % tuple(deltasize))
2111 % tuple(deltasize))
2110
2112
2111 if numdeltas > 0:
2113 if numdeltas > 0:
2112 ui.write('\n')
2114 ui.write('\n')
2113 fmt = pcfmtstr(numdeltas)
2115 fmt = pcfmtstr(numdeltas)
2114 fmt2 = pcfmtstr(numdeltas, 4)
2116 fmt2 = pcfmtstr(numdeltas, 4)
2115 ui.write(('deltas against prev : ') + fmt % pcfmt(numprev, numdeltas))
2117 ui.write(('deltas against prev : ') + fmt % pcfmt(numprev, numdeltas))
2116 if numprev > 0:
2118 if numprev > 0:
2117 ui.write((' where prev = p1 : ') + fmt2 % pcfmt(nump1prev,
2119 ui.write((' where prev = p1 : ') + fmt2 % pcfmt(nump1prev,
2118 numprev))
2120 numprev))
2119 ui.write((' where prev = p2 : ') + fmt2 % pcfmt(nump2prev,
2121 ui.write((' where prev = p2 : ') + fmt2 % pcfmt(nump2prev,
2120 numprev))
2122 numprev))
2121 ui.write((' other : ') + fmt2 % pcfmt(numoprev,
2123 ui.write((' other : ') + fmt2 % pcfmt(numoprev,
2122 numprev))
2124 numprev))
2123 if gdelta:
2125 if gdelta:
2124 ui.write(('deltas against p1 : ')
2126 ui.write(('deltas against p1 : ')
2125 + fmt % pcfmt(nump1, numdeltas))
2127 + fmt % pcfmt(nump1, numdeltas))
2126 ui.write(('deltas against p2 : ')
2128 ui.write(('deltas against p2 : ')
2127 + fmt % pcfmt(nump2, numdeltas))
2129 + fmt % pcfmt(nump2, numdeltas))
2128 ui.write(('deltas against other : ') + fmt % pcfmt(numother,
2130 ui.write(('deltas against other : ') + fmt % pcfmt(numother,
2129 numdeltas))
2131 numdeltas))
2130
2132
2131 @command('debugrevspec',
2133 @command('debugrevspec',
2132 [('', 'optimize', None,
2134 [('', 'optimize', None,
2133 _('print parsed tree after optimizing (DEPRECATED)')),
2135 _('print parsed tree after optimizing (DEPRECATED)')),
2134 ('', 'show-revs', True, _('print list of result revisions (default)')),
2136 ('', 'show-revs', True, _('print list of result revisions (default)')),
2135 ('s', 'show-set', None, _('print internal representation of result set')),
2137 ('s', 'show-set', None, _('print internal representation of result set')),
2136 ('p', 'show-stage', [],
2138 ('p', 'show-stage', [],
2137 _('print parsed tree at the given stage'), _('NAME')),
2139 _('print parsed tree at the given stage'), _('NAME')),
2138 ('', 'no-optimized', False, _('evaluate tree without optimization')),
2140 ('', 'no-optimized', False, _('evaluate tree without optimization')),
2139 ('', 'verify-optimized', False, _('verify optimized result')),
2141 ('', 'verify-optimized', False, _('verify optimized result')),
2140 ],
2142 ],
2141 ('REVSPEC'))
2143 ('REVSPEC'))
2142 def debugrevspec(ui, repo, expr, **opts):
2144 def debugrevspec(ui, repo, expr, **opts):
2143 """parse and apply a revision specification
2145 """parse and apply a revision specification
2144
2146
2145 Use -p/--show-stage option to print the parsed tree at the given stages.
2147 Use -p/--show-stage option to print the parsed tree at the given stages.
2146 Use -p all to print tree at every stage.
2148 Use -p all to print tree at every stage.
2147
2149
2148 Use --no-show-revs option with -s or -p to print only the set
2150 Use --no-show-revs option with -s or -p to print only the set
2149 representation or the parsed tree respectively.
2151 representation or the parsed tree respectively.
2150
2152
2151 Use --verify-optimized to compare the optimized result with the unoptimized
2153 Use --verify-optimized to compare the optimized result with the unoptimized
2152 one. Returns 1 if the optimized result differs.
2154 one. Returns 1 if the optimized result differs.
2153 """
2155 """
2154 opts = pycompat.byteskwargs(opts)
2156 opts = pycompat.byteskwargs(opts)
2155 aliases = ui.configitems('revsetalias')
2157 aliases = ui.configitems('revsetalias')
2156 stages = [
2158 stages = [
2157 ('parsed', lambda tree: tree),
2159 ('parsed', lambda tree: tree),
2158 ('expanded', lambda tree: revsetlang.expandaliases(tree, aliases,
2160 ('expanded', lambda tree: revsetlang.expandaliases(tree, aliases,
2159 ui.warn)),
2161 ui.warn)),
2160 ('concatenated', revsetlang.foldconcat),
2162 ('concatenated', revsetlang.foldconcat),
2161 ('analyzed', revsetlang.analyze),
2163 ('analyzed', revsetlang.analyze),
2162 ('optimized', revsetlang.optimize),
2164 ('optimized', revsetlang.optimize),
2163 ]
2165 ]
2164 if opts['no_optimized']:
2166 if opts['no_optimized']:
2165 stages = stages[:-1]
2167 stages = stages[:-1]
2166 if opts['verify_optimized'] and opts['no_optimized']:
2168 if opts['verify_optimized'] and opts['no_optimized']:
2167 raise error.Abort(_('cannot use --verify-optimized with '
2169 raise error.Abort(_('cannot use --verify-optimized with '
2168 '--no-optimized'))
2170 '--no-optimized'))
2169 stagenames = set(n for n, f in stages)
2171 stagenames = set(n for n, f in stages)
2170
2172
2171 showalways = set()
2173 showalways = set()
2172 showchanged = set()
2174 showchanged = set()
2173 if ui.verbose and not opts['show_stage']:
2175 if ui.verbose and not opts['show_stage']:
2174 # show parsed tree by --verbose (deprecated)
2176 # show parsed tree by --verbose (deprecated)
2175 showalways.add('parsed')
2177 showalways.add('parsed')
2176 showchanged.update(['expanded', 'concatenated'])
2178 showchanged.update(['expanded', 'concatenated'])
2177 if opts['optimize']:
2179 if opts['optimize']:
2178 showalways.add('optimized')
2180 showalways.add('optimized')
2179 if opts['show_stage'] and opts['optimize']:
2181 if opts['show_stage'] and opts['optimize']:
2180 raise error.Abort(_('cannot use --optimize with --show-stage'))
2182 raise error.Abort(_('cannot use --optimize with --show-stage'))
2181 if opts['show_stage'] == ['all']:
2183 if opts['show_stage'] == ['all']:
2182 showalways.update(stagenames)
2184 showalways.update(stagenames)
2183 else:
2185 else:
2184 for n in opts['show_stage']:
2186 for n in opts['show_stage']:
2185 if n not in stagenames:
2187 if n not in stagenames:
2186 raise error.Abort(_('invalid stage name: %s') % n)
2188 raise error.Abort(_('invalid stage name: %s') % n)
2187 showalways.update(opts['show_stage'])
2189 showalways.update(opts['show_stage'])
2188
2190
2189 treebystage = {}
2191 treebystage = {}
2190 printedtree = None
2192 printedtree = None
2191 tree = revsetlang.parse(expr, lookup=repo.__contains__)
2193 tree = revsetlang.parse(expr, lookup=repo.__contains__)
2192 for n, f in stages:
2194 for n, f in stages:
2193 treebystage[n] = tree = f(tree)
2195 treebystage[n] = tree = f(tree)
2194 if n in showalways or (n in showchanged and tree != printedtree):
2196 if n in showalways or (n in showchanged and tree != printedtree):
2195 if opts['show_stage'] or n != 'parsed':
2197 if opts['show_stage'] or n != 'parsed':
2196 ui.write(("* %s:\n") % n)
2198 ui.write(("* %s:\n") % n)
2197 ui.write(revsetlang.prettyformat(tree), "\n")
2199 ui.write(revsetlang.prettyformat(tree), "\n")
2198 printedtree = tree
2200 printedtree = tree
2199
2201
2200 if opts['verify_optimized']:
2202 if opts['verify_optimized']:
2201 arevs = revset.makematcher(treebystage['analyzed'])(repo)
2203 arevs = revset.makematcher(treebystage['analyzed'])(repo)
2202 brevs = revset.makematcher(treebystage['optimized'])(repo)
2204 brevs = revset.makematcher(treebystage['optimized'])(repo)
2203 if opts['show_set'] or (opts['show_set'] is None and ui.verbose):
2205 if opts['show_set'] or (opts['show_set'] is None and ui.verbose):
2204 ui.write(("* analyzed set:\n"), smartset.prettyformat(arevs), "\n")
2206 ui.write(("* analyzed set:\n"), smartset.prettyformat(arevs), "\n")
2205 ui.write(("* optimized set:\n"), smartset.prettyformat(brevs), "\n")
2207 ui.write(("* optimized set:\n"), smartset.prettyformat(brevs), "\n")
2206 arevs = list(arevs)
2208 arevs = list(arevs)
2207 brevs = list(brevs)
2209 brevs = list(brevs)
2208 if arevs == brevs:
2210 if arevs == brevs:
2209 return 0
2211 return 0
2210 ui.write(('--- analyzed\n'), label='diff.file_a')
2212 ui.write(('--- analyzed\n'), label='diff.file_a')
2211 ui.write(('+++ optimized\n'), label='diff.file_b')
2213 ui.write(('+++ optimized\n'), label='diff.file_b')
2212 sm = difflib.SequenceMatcher(None, arevs, brevs)
2214 sm = difflib.SequenceMatcher(None, arevs, brevs)
2213 for tag, alo, ahi, blo, bhi in sm.get_opcodes():
2215 for tag, alo, ahi, blo, bhi in sm.get_opcodes():
2214 if tag in ('delete', 'replace'):
2216 if tag in ('delete', 'replace'):
2215 for c in arevs[alo:ahi]:
2217 for c in arevs[alo:ahi]:
2216 ui.write('-%s\n' % c, label='diff.deleted')
2218 ui.write('-%s\n' % c, label='diff.deleted')
2217 if tag in ('insert', 'replace'):
2219 if tag in ('insert', 'replace'):
2218 for c in brevs[blo:bhi]:
2220 for c in brevs[blo:bhi]:
2219 ui.write('+%s\n' % c, label='diff.inserted')
2221 ui.write('+%s\n' % c, label='diff.inserted')
2220 if tag == 'equal':
2222 if tag == 'equal':
2221 for c in arevs[alo:ahi]:
2223 for c in arevs[alo:ahi]:
2222 ui.write(' %s\n' % c)
2224 ui.write(' %s\n' % c)
2223 return 1
2225 return 1
2224
2226
2225 func = revset.makematcher(tree)
2227 func = revset.makematcher(tree)
2226 revs = func(repo)
2228 revs = func(repo)
2227 if opts['show_set'] or (opts['show_set'] is None and ui.verbose):
2229 if opts['show_set'] or (opts['show_set'] is None and ui.verbose):
2228 ui.write(("* set:\n"), smartset.prettyformat(revs), "\n")
2230 ui.write(("* set:\n"), smartset.prettyformat(revs), "\n")
2229 if not opts['show_revs']:
2231 if not opts['show_revs']:
2230 return
2232 return
2231 for c in revs:
2233 for c in revs:
2232 ui.write("%d\n" % c)
2234 ui.write("%d\n" % c)
2233
2235
2234 @command('debugserve', [
2236 @command('debugserve', [
2235 ('', 'sshstdio', False, _('run an SSH server bound to process handles')),
2237 ('', 'sshstdio', False, _('run an SSH server bound to process handles')),
2236 ('', 'logiofd', '', _('file descriptor to log server I/O to')),
2238 ('', 'logiofd', '', _('file descriptor to log server I/O to')),
2237 ('', 'logiofile', '', _('file to log server I/O to')),
2239 ('', 'logiofile', '', _('file to log server I/O to')),
2238 ], '')
2240 ], '')
2239 def debugserve(ui, repo, **opts):
2241 def debugserve(ui, repo, **opts):
2240 """run a server with advanced settings
2242 """run a server with advanced settings
2241
2243
2242 This command is similar to :hg:`serve`. It exists partially as a
2244 This command is similar to :hg:`serve`. It exists partially as a
2243 workaround to the fact that ``hg serve --stdio`` must have specific
2245 workaround to the fact that ``hg serve --stdio`` must have specific
2244 arguments for security reasons.
2246 arguments for security reasons.
2245 """
2247 """
2246 opts = pycompat.byteskwargs(opts)
2248 opts = pycompat.byteskwargs(opts)
2247
2249
2248 if not opts['sshstdio']:
2250 if not opts['sshstdio']:
2249 raise error.Abort(_('only --sshstdio is currently supported'))
2251 raise error.Abort(_('only --sshstdio is currently supported'))
2250
2252
2251 logfh = None
2253 logfh = None
2252
2254
2253 if opts['logiofd'] and opts['logiofile']:
2255 if opts['logiofd'] and opts['logiofile']:
2254 raise error.Abort(_('cannot use both --logiofd and --logiofile'))
2256 raise error.Abort(_('cannot use both --logiofd and --logiofile'))
2255
2257
2256 if opts['logiofd']:
2258 if opts['logiofd']:
2257 # Line buffered because output is line based.
2259 # Line buffered because output is line based.
2258 logfh = os.fdopen(int(opts['logiofd']), 'ab', 1)
2260 logfh = os.fdopen(int(opts['logiofd']), 'ab', 1)
2259 elif opts['logiofile']:
2261 elif opts['logiofile']:
2260 logfh = open(opts['logiofile'], 'ab', 1)
2262 logfh = open(opts['logiofile'], 'ab', 1)
2261
2263
2262 s = wireprotoserver.sshserver(ui, repo, logfh=logfh)
2264 s = wireprotoserver.sshserver(ui, repo, logfh=logfh)
2263 s.serve_forever()
2265 s.serve_forever()
2264
2266
2265 @command('debugsetparents', [], _('REV1 [REV2]'))
2267 @command('debugsetparents', [], _('REV1 [REV2]'))
2266 def debugsetparents(ui, repo, rev1, rev2=None):
2268 def debugsetparents(ui, repo, rev1, rev2=None):
2267 """manually set the parents of the current working directory
2269 """manually set the parents of the current working directory
2268
2270
2269 This is useful for writing repository conversion tools, but should
2271 This is useful for writing repository conversion tools, but should
2270 be used with care. For example, neither the working directory nor the
2272 be used with care. For example, neither the working directory nor the
2271 dirstate is updated, so file status may be incorrect after running this
2273 dirstate is updated, so file status may be incorrect after running this
2272 command.
2274 command.
2273
2275
2274 Returns 0 on success.
2276 Returns 0 on success.
2275 """
2277 """
2276
2278
2277 r1 = scmutil.revsingle(repo, rev1).node()
2279 r1 = scmutil.revsingle(repo, rev1).node()
2278 r2 = scmutil.revsingle(repo, rev2, 'null').node()
2280 r2 = scmutil.revsingle(repo, rev2, 'null').node()
2279
2281
2280 with repo.wlock():
2282 with repo.wlock():
2281 repo.setparents(r1, r2)
2283 repo.setparents(r1, r2)
2282
2284
2283 @command('debugssl', [], '[SOURCE]', optionalrepo=True)
2285 @command('debugssl', [], '[SOURCE]', optionalrepo=True)
2284 def debugssl(ui, repo, source=None, **opts):
2286 def debugssl(ui, repo, source=None, **opts):
2285 '''test a secure connection to a server
2287 '''test a secure connection to a server
2286
2288
2287 This builds the certificate chain for the server on Windows, installing the
2289 This builds the certificate chain for the server on Windows, installing the
2288 missing intermediates and trusted root via Windows Update if necessary. It
2290 missing intermediates and trusted root via Windows Update if necessary. It
2289 does nothing on other platforms.
2291 does nothing on other platforms.
2290
2292
2291 If SOURCE is omitted, the 'default' path will be used. If a URL is given,
2293 If SOURCE is omitted, the 'default' path will be used. If a URL is given,
2292 that server is used. See :hg:`help urls` for more information.
2294 that server is used. See :hg:`help urls` for more information.
2293
2295
2294 If the update succeeds, retry the original operation. Otherwise, the cause
2296 If the update succeeds, retry the original operation. Otherwise, the cause
2295 of the SSL error is likely another issue.
2297 of the SSL error is likely another issue.
2296 '''
2298 '''
2297 if not pycompat.iswindows:
2299 if not pycompat.iswindows:
2298 raise error.Abort(_('certificate chain building is only possible on '
2300 raise error.Abort(_('certificate chain building is only possible on '
2299 'Windows'))
2301 'Windows'))
2300
2302
2301 if not source:
2303 if not source:
2302 if not repo:
2304 if not repo:
2303 raise error.Abort(_("there is no Mercurial repository here, and no "
2305 raise error.Abort(_("there is no Mercurial repository here, and no "
2304 "server specified"))
2306 "server specified"))
2305 source = "default"
2307 source = "default"
2306
2308
2307 source, branches = hg.parseurl(ui.expandpath(source))
2309 source, branches = hg.parseurl(ui.expandpath(source))
2308 url = util.url(source)
2310 url = util.url(source)
2309 addr = None
2311 addr = None
2310
2312
2311 defaultport = {'https': 443, 'ssh': 22}
2313 defaultport = {'https': 443, 'ssh': 22}
2312 if url.scheme in defaultport:
2314 if url.scheme in defaultport:
2313 try:
2315 try:
2314 addr = (url.host, int(url.port or defaultport[url.scheme]))
2316 addr = (url.host, int(url.port or defaultport[url.scheme]))
2315 except ValueError:
2317 except ValueError:
2316 raise error.Abort(_("malformed port number in URL"))
2318 raise error.Abort(_("malformed port number in URL"))
2317 else:
2319 else:
2318 raise error.Abort(_("only https and ssh connections are supported"))
2320 raise error.Abort(_("only https and ssh connections are supported"))
2319
2321
2320 from . import win32
2322 from . import win32
2321
2323
2322 s = ssl.wrap_socket(socket.socket(), ssl_version=ssl.PROTOCOL_TLS,
2324 s = ssl.wrap_socket(socket.socket(), ssl_version=ssl.PROTOCOL_TLS,
2323 cert_reqs=ssl.CERT_NONE, ca_certs=None)
2325 cert_reqs=ssl.CERT_NONE, ca_certs=None)
2324
2326
2325 try:
2327 try:
2326 s.connect(addr)
2328 s.connect(addr)
2327 cert = s.getpeercert(True)
2329 cert = s.getpeercert(True)
2328
2330
2329 ui.status(_('checking the certificate chain for %s\n') % url.host)
2331 ui.status(_('checking the certificate chain for %s\n') % url.host)
2330
2332
2331 complete = win32.checkcertificatechain(cert, build=False)
2333 complete = win32.checkcertificatechain(cert, build=False)
2332
2334
2333 if not complete:
2335 if not complete:
2334 ui.status(_('certificate chain is incomplete, updating... '))
2336 ui.status(_('certificate chain is incomplete, updating... '))
2335
2337
2336 if not win32.checkcertificatechain(cert):
2338 if not win32.checkcertificatechain(cert):
2337 ui.status(_('failed.\n'))
2339 ui.status(_('failed.\n'))
2338 else:
2340 else:
2339 ui.status(_('done.\n'))
2341 ui.status(_('done.\n'))
2340 else:
2342 else:
2341 ui.status(_('full certificate chain is available\n'))
2343 ui.status(_('full certificate chain is available\n'))
2342 finally:
2344 finally:
2343 s.close()
2345 s.close()
2344
2346
2345 @command('debugsub',
2347 @command('debugsub',
2346 [('r', 'rev', '',
2348 [('r', 'rev', '',
2347 _('revision to check'), _('REV'))],
2349 _('revision to check'), _('REV'))],
2348 _('[-r REV] [REV]'))
2350 _('[-r REV] [REV]'))
2349 def debugsub(ui, repo, rev=None):
2351 def debugsub(ui, repo, rev=None):
2350 ctx = scmutil.revsingle(repo, rev, None)
2352 ctx = scmutil.revsingle(repo, rev, None)
2351 for k, v in sorted(ctx.substate.items()):
2353 for k, v in sorted(ctx.substate.items()):
2352 ui.write(('path %s\n') % k)
2354 ui.write(('path %s\n') % k)
2353 ui.write((' source %s\n') % v[0])
2355 ui.write((' source %s\n') % v[0])
2354 ui.write((' revision %s\n') % v[1])
2356 ui.write((' revision %s\n') % v[1])
2355
2357
2356 @command('debugsuccessorssets',
2358 @command('debugsuccessorssets',
2357 [('', 'closest', False, _('return closest successors sets only'))],
2359 [('', 'closest', False, _('return closest successors sets only'))],
2358 _('[REV]'))
2360 _('[REV]'))
2359 def debugsuccessorssets(ui, repo, *revs, **opts):
2361 def debugsuccessorssets(ui, repo, *revs, **opts):
2360 """show set of successors for revision
2362 """show set of successors for revision
2361
2363
2362 A successors set of changeset A is a consistent group of revisions that
2364 A successors set of changeset A is a consistent group of revisions that
2363 succeed A. It contains non-obsolete changesets only unless closests
2365 succeed A. It contains non-obsolete changesets only unless closests
2364 successors set is set.
2366 successors set is set.
2365
2367
2366 In most cases a changeset A has a single successors set containing a single
2368 In most cases a changeset A has a single successors set containing a single
2367 successor (changeset A replaced by A').
2369 successor (changeset A replaced by A').
2368
2370
2369 A changeset that is made obsolete with no successors are called "pruned".
2371 A changeset that is made obsolete with no successors are called "pruned".
2370 Such changesets have no successors sets at all.
2372 Such changesets have no successors sets at all.
2371
2373
2372 A changeset that has been "split" will have a successors set containing
2374 A changeset that has been "split" will have a successors set containing
2373 more than one successor.
2375 more than one successor.
2374
2376
2375 A changeset that has been rewritten in multiple different ways is called
2377 A changeset that has been rewritten in multiple different ways is called
2376 "divergent". Such changesets have multiple successor sets (each of which
2378 "divergent". Such changesets have multiple successor sets (each of which
2377 may also be split, i.e. have multiple successors).
2379 may also be split, i.e. have multiple successors).
2378
2380
2379 Results are displayed as follows::
2381 Results are displayed as follows::
2380
2382
2381 <rev1>
2383 <rev1>
2382 <successors-1A>
2384 <successors-1A>
2383 <rev2>
2385 <rev2>
2384 <successors-2A>
2386 <successors-2A>
2385 <successors-2B1> <successors-2B2> <successors-2B3>
2387 <successors-2B1> <successors-2B2> <successors-2B3>
2386
2388
2387 Here rev2 has two possible (i.e. divergent) successors sets. The first
2389 Here rev2 has two possible (i.e. divergent) successors sets. The first
2388 holds one element, whereas the second holds three (i.e. the changeset has
2390 holds one element, whereas the second holds three (i.e. the changeset has
2389 been split).
2391 been split).
2390 """
2392 """
2391 # passed to successorssets caching computation from one call to another
2393 # passed to successorssets caching computation from one call to another
2392 cache = {}
2394 cache = {}
2393 ctx2str = bytes
2395 ctx2str = bytes
2394 node2str = short
2396 node2str = short
2395 for rev in scmutil.revrange(repo, revs):
2397 for rev in scmutil.revrange(repo, revs):
2396 ctx = repo[rev]
2398 ctx = repo[rev]
2397 ui.write('%s\n'% ctx2str(ctx))
2399 ui.write('%s\n'% ctx2str(ctx))
2398 for succsset in obsutil.successorssets(repo, ctx.node(),
2400 for succsset in obsutil.successorssets(repo, ctx.node(),
2399 closest=opts[r'closest'],
2401 closest=opts[r'closest'],
2400 cache=cache):
2402 cache=cache):
2401 if succsset:
2403 if succsset:
2402 ui.write(' ')
2404 ui.write(' ')
2403 ui.write(node2str(succsset[0]))
2405 ui.write(node2str(succsset[0]))
2404 for node in succsset[1:]:
2406 for node in succsset[1:]:
2405 ui.write(' ')
2407 ui.write(' ')
2406 ui.write(node2str(node))
2408 ui.write(node2str(node))
2407 ui.write('\n')
2409 ui.write('\n')
2408
2410
2409 @command('debugtemplate',
2411 @command('debugtemplate',
2410 [('r', 'rev', [], _('apply template on changesets'), _('REV')),
2412 [('r', 'rev', [], _('apply template on changesets'), _('REV')),
2411 ('D', 'define', [], _('define template keyword'), _('KEY=VALUE'))],
2413 ('D', 'define', [], _('define template keyword'), _('KEY=VALUE'))],
2412 _('[-r REV]... [-D KEY=VALUE]... TEMPLATE'),
2414 _('[-r REV]... [-D KEY=VALUE]... TEMPLATE'),
2413 optionalrepo=True)
2415 optionalrepo=True)
2414 def debugtemplate(ui, repo, tmpl, **opts):
2416 def debugtemplate(ui, repo, tmpl, **opts):
2415 """parse and apply a template
2417 """parse and apply a template
2416
2418
2417 If -r/--rev is given, the template is processed as a log template and
2419 If -r/--rev is given, the template is processed as a log template and
2418 applied to the given changesets. Otherwise, it is processed as a generic
2420 applied to the given changesets. Otherwise, it is processed as a generic
2419 template.
2421 template.
2420
2422
2421 Use --verbose to print the parsed tree.
2423 Use --verbose to print the parsed tree.
2422 """
2424 """
2423 revs = None
2425 revs = None
2424 if opts[r'rev']:
2426 if opts[r'rev']:
2425 if repo is None:
2427 if repo is None:
2426 raise error.RepoError(_('there is no Mercurial repository here '
2428 raise error.RepoError(_('there is no Mercurial repository here '
2427 '(.hg not found)'))
2429 '(.hg not found)'))
2428 revs = scmutil.revrange(repo, opts[r'rev'])
2430 revs = scmutil.revrange(repo, opts[r'rev'])
2429
2431
2430 props = {}
2432 props = {}
2431 for d in opts[r'define']:
2433 for d in opts[r'define']:
2432 try:
2434 try:
2433 k, v = (e.strip() for e in d.split('=', 1))
2435 k, v = (e.strip() for e in d.split('=', 1))
2434 if not k or k == 'ui':
2436 if not k or k == 'ui':
2435 raise ValueError
2437 raise ValueError
2436 props[k] = v
2438 props[k] = v
2437 except ValueError:
2439 except ValueError:
2438 raise error.Abort(_('malformed keyword definition: %s') % d)
2440 raise error.Abort(_('malformed keyword definition: %s') % d)
2439
2441
2440 if ui.verbose:
2442 if ui.verbose:
2441 aliases = ui.configitems('templatealias')
2443 aliases = ui.configitems('templatealias')
2442 tree = templater.parse(tmpl)
2444 tree = templater.parse(tmpl)
2443 ui.note(templater.prettyformat(tree), '\n')
2445 ui.note(templater.prettyformat(tree), '\n')
2444 newtree = templater.expandaliases(tree, aliases)
2446 newtree = templater.expandaliases(tree, aliases)
2445 if newtree != tree:
2447 if newtree != tree:
2446 ui.note(("* expanded:\n"), templater.prettyformat(newtree), '\n')
2448 ui.note(("* expanded:\n"), templater.prettyformat(newtree), '\n')
2447
2449
2448 if revs is None:
2450 if revs is None:
2449 tres = formatter.templateresources(ui, repo)
2451 tres = formatter.templateresources(ui, repo)
2450 t = formatter.maketemplater(ui, tmpl, resources=tres)
2452 t = formatter.maketemplater(ui, tmpl, resources=tres)
2451 ui.write(t.render(props))
2453 ui.write(t.render(props))
2452 else:
2454 else:
2453 displayer = logcmdutil.maketemplater(ui, repo, tmpl)
2455 displayer = logcmdutil.maketemplater(ui, repo, tmpl)
2454 for r in revs:
2456 for r in revs:
2455 displayer.show(repo[r], **pycompat.strkwargs(props))
2457 displayer.show(repo[r], **pycompat.strkwargs(props))
2456 displayer.close()
2458 displayer.close()
2457
2459
2458 @command('debugupdatecaches', [])
2460 @command('debugupdatecaches', [])
2459 def debugupdatecaches(ui, repo, *pats, **opts):
2461 def debugupdatecaches(ui, repo, *pats, **opts):
2460 """warm all known caches in the repository"""
2462 """warm all known caches in the repository"""
2461 with repo.wlock(), repo.lock():
2463 with repo.wlock(), repo.lock():
2462 repo.updatecaches()
2464 repo.updatecaches()
2463
2465
2464 @command('debugupgraderepo', [
2466 @command('debugupgraderepo', [
2465 ('o', 'optimize', [], _('extra optimization to perform'), _('NAME')),
2467 ('o', 'optimize', [], _('extra optimization to perform'), _('NAME')),
2466 ('', 'run', False, _('performs an upgrade')),
2468 ('', 'run', False, _('performs an upgrade')),
2467 ])
2469 ])
2468 def debugupgraderepo(ui, repo, run=False, optimize=None):
2470 def debugupgraderepo(ui, repo, run=False, optimize=None):
2469 """upgrade a repository to use different features
2471 """upgrade a repository to use different features
2470
2472
2471 If no arguments are specified, the repository is evaluated for upgrade
2473 If no arguments are specified, the repository is evaluated for upgrade
2472 and a list of problems and potential optimizations is printed.
2474 and a list of problems and potential optimizations is printed.
2473
2475
2474 With ``--run``, a repository upgrade is performed. Behavior of the upgrade
2476 With ``--run``, a repository upgrade is performed. Behavior of the upgrade
2475 can be influenced via additional arguments. More details will be provided
2477 can be influenced via additional arguments. More details will be provided
2476 by the command output when run without ``--run``.
2478 by the command output when run without ``--run``.
2477
2479
2478 During the upgrade, the repository will be locked and no writes will be
2480 During the upgrade, the repository will be locked and no writes will be
2479 allowed.
2481 allowed.
2480
2482
2481 At the end of the upgrade, the repository may not be readable while new
2483 At the end of the upgrade, the repository may not be readable while new
2482 repository data is swapped in. This window will be as long as it takes to
2484 repository data is swapped in. This window will be as long as it takes to
2483 rename some directories inside the ``.hg`` directory. On most machines, this
2485 rename some directories inside the ``.hg`` directory. On most machines, this
2484 should complete almost instantaneously and the chances of a consumer being
2486 should complete almost instantaneously and the chances of a consumer being
2485 unable to access the repository should be low.
2487 unable to access the repository should be low.
2486 """
2488 """
2487 return upgrade.upgraderepo(ui, repo, run=run, optimize=optimize)
2489 return upgrade.upgraderepo(ui, repo, run=run, optimize=optimize)
2488
2490
2489 @command('debugwalk', cmdutil.walkopts, _('[OPTION]... [FILE]...'),
2491 @command('debugwalk', cmdutil.walkopts, _('[OPTION]... [FILE]...'),
2490 inferrepo=True)
2492 inferrepo=True)
2491 def debugwalk(ui, repo, *pats, **opts):
2493 def debugwalk(ui, repo, *pats, **opts):
2492 """show how files match on given patterns"""
2494 """show how files match on given patterns"""
2493 opts = pycompat.byteskwargs(opts)
2495 opts = pycompat.byteskwargs(opts)
2494 m = scmutil.match(repo[None], pats, opts)
2496 m = scmutil.match(repo[None], pats, opts)
2495 ui.write(('matcher: %r\n' % m))
2497 ui.write(('matcher: %r\n' % m))
2496 items = list(repo[None].walk(m))
2498 items = list(repo[None].walk(m))
2497 if not items:
2499 if not items:
2498 return
2500 return
2499 f = lambda fn: fn
2501 f = lambda fn: fn
2500 if ui.configbool('ui', 'slash') and pycompat.ossep != '/':
2502 if ui.configbool('ui', 'slash') and pycompat.ossep != '/':
2501 f = lambda fn: util.normpath(fn)
2503 f = lambda fn: util.normpath(fn)
2502 fmt = 'f %%-%ds %%-%ds %%s' % (
2504 fmt = 'f %%-%ds %%-%ds %%s' % (
2503 max([len(abs) for abs in items]),
2505 max([len(abs) for abs in items]),
2504 max([len(m.rel(abs)) for abs in items]))
2506 max([len(m.rel(abs)) for abs in items]))
2505 for abs in items:
2507 for abs in items:
2506 line = fmt % (abs, f(m.rel(abs)), m.exact(abs) and 'exact' or '')
2508 line = fmt % (abs, f(m.rel(abs)), m.exact(abs) and 'exact' or '')
2507 ui.write("%s\n" % line.rstrip())
2509 ui.write("%s\n" % line.rstrip())
2508
2510
2509 @command('debugwireargs',
2511 @command('debugwireargs',
2510 [('', 'three', '', 'three'),
2512 [('', 'three', '', 'three'),
2511 ('', 'four', '', 'four'),
2513 ('', 'four', '', 'four'),
2512 ('', 'five', '', 'five'),
2514 ('', 'five', '', 'five'),
2513 ] + cmdutil.remoteopts,
2515 ] + cmdutil.remoteopts,
2514 _('REPO [OPTIONS]... [ONE [TWO]]'),
2516 _('REPO [OPTIONS]... [ONE [TWO]]'),
2515 norepo=True)
2517 norepo=True)
2516 def debugwireargs(ui, repopath, *vals, **opts):
2518 def debugwireargs(ui, repopath, *vals, **opts):
2517 opts = pycompat.byteskwargs(opts)
2519 opts = pycompat.byteskwargs(opts)
2518 repo = hg.peer(ui, opts, repopath)
2520 repo = hg.peer(ui, opts, repopath)
2519 for opt in cmdutil.remoteopts:
2521 for opt in cmdutil.remoteopts:
2520 del opts[opt[1]]
2522 del opts[opt[1]]
2521 args = {}
2523 args = {}
2522 for k, v in opts.iteritems():
2524 for k, v in opts.iteritems():
2523 if v:
2525 if v:
2524 args[k] = v
2526 args[k] = v
2525 args = pycompat.strkwargs(args)
2527 args = pycompat.strkwargs(args)
2526 # run twice to check that we don't mess up the stream for the next command
2528 # run twice to check that we don't mess up the stream for the next command
2527 res1 = repo.debugwireargs(*vals, **args)
2529 res1 = repo.debugwireargs(*vals, **args)
2528 res2 = repo.debugwireargs(*vals, **args)
2530 res2 = repo.debugwireargs(*vals, **args)
2529 ui.write("%s\n" % res1)
2531 ui.write("%s\n" % res1)
2530 if res1 != res2:
2532 if res1 != res2:
2531 ui.warn("%s\n" % res2)
2533 ui.warn("%s\n" % res2)
2534
2535 def _parsewirelangblocks(fh):
2536 activeaction = None
2537 blocklines = []
2538
2539 for line in fh:
2540 line = line.rstrip()
2541 if not line:
2542 continue
2543
2544 if line.startswith(b'#'):
2545 continue
2546
2547 if not line.startswith(' '):
2548 # New block. Flush previous one.
2549 if activeaction:
2550 yield activeaction, blocklines
2551
2552 activeaction = line
2553 blocklines = []
2554 continue
2555
2556 # Else we start with an indent.
2557
2558 if not activeaction:
2559 raise error.Abort(_('indented line outside of block'))
2560
2561 blocklines.append(line)
2562
2563 # Flush last block.
2564 if activeaction:
2565 yield activeaction, blocklines
2566
2567 @command('debugwireproto',
2568 [
2569 ('', 'localssh', False, _('start an SSH server for this repo')),
2570 ('', 'peer', '', _('construct a specific version of the peer')),
2571 ] + cmdutil.remoteopts,
2572 _('[REPO]'),
2573 optionalrepo=True)
2574 def debugwireproto(ui, repo, **opts):
2575 """send wire protocol commands to a server
2576
2577 This command can be used to issue wire protocol commands to remote
2578 peers and to debug the raw data being exchanged.
2579
2580 ``--localssh`` will start an SSH server against the current repository
2581 and connect to that. By default, the connection will perform a handshake
2582 and establish an appropriate peer instance.
2583
2584 ``--peer`` can be used to bypass the handshake protocol and construct a
2585 peer instance using the specified class type. Valid values are ``raw``,
2586 ``ssh1``, and ``ssh2``. ``raw`` instances only allow sending raw data
2587 payloads and don't support higher-level command actions.
2588
2589 Commands are issued via a mini language which is specified via stdin.
2590 The language consists of individual actions to perform. An action is
2591 defined by a block. A block is defined as a line with no leading
2592 space followed by 0 or more lines with leading space. Blocks are
2593 effectively a high-level command with additional metadata.
2594
2595 Lines beginning with ``#`` are ignored.
2596
2597 The following sections denote available actions.
2598
2599 raw
2600 ---
2601
2602 Send raw data to the server.
2603
2604 The block payload contains the raw data to send as one atomic send
2605 operation. The data may not actually be delivered in a single system
2606 call: it depends on the abilities of the transport being used.
2607
2608 Each line in the block is de-indented and concatenated. Then, that
2609 value is evaluated as a Python b'' literal. This allows the use of
2610 backslash escaping, etc.
2611
2612 raw+
2613 ----
2614
2615 Behaves like ``raw`` except flushes output afterwards.
2616
2617 close
2618 -----
2619
2620 Close the connection to the server.
2621
2622 flush
2623 -----
2624
2625 Flush data written to the server.
2626
2627 readavailable
2628 -------------
2629
2630 Read all available data from the server.
2631
2632 If the connection to the server encompasses multiple pipes, we poll both
2633 pipes and read available data.
2634
2635 readline
2636 --------
2637
2638 Read a line of output from the server. If there are multiple output
2639 pipes, reads only the main pipe.
2640 """
2641 opts = pycompat.byteskwargs(opts)
2642
2643 if opts['localssh'] and not repo:
2644 raise error.Abort(_('--localssh requires a repository'))
2645
2646 if opts['peer'] and opts['peer'] not in ('raw', 'ssh1', 'ssh2'):
2647 raise error.Abort(_('invalid value for --peer'),
2648 hint=_('valid values are "raw", "ssh1", and "ssh2"'))
2649
2650 if ui.interactive():
2651 ui.write(_('(waiting for commands on stdin)\n'))
2652
2653 blocks = list(_parsewirelangblocks(ui.fin))
2654
2655 proc = None
2656
2657 if opts['localssh']:
2658 # We start the SSH server in its own process so there is process
2659 # separation. This prevents a whole class of potential bugs around
2660 # shared state from interfering with server operation.
2661 args = util.hgcmd() + [
2662 '-R', repo.root,
2663 'debugserve', '--sshstdio',
2664 ]
2665 proc = subprocess.Popen(args, stdin=subprocess.PIPE,
2666 stdout=subprocess.PIPE, stderr=subprocess.PIPE,
2667 bufsize=0)
2668
2669 stdin = proc.stdin
2670 stdout = proc.stdout
2671 stderr = proc.stderr
2672
2673 # We turn the pipes into observers so we can log I/O.
2674 if ui.verbose or opts['peer'] == 'raw':
2675 stdin = util.makeloggingfileobject(ui, proc.stdin, b'i',
2676 logdata=True)
2677 stdout = util.makeloggingfileobject(ui, proc.stdout, b'o',
2678 logdata=True)
2679 stderr = util.makeloggingfileobject(ui, proc.stderr, b'e',
2680 logdata=True)
2681
2682 # --localssh also implies the peer connection settings.
2683
2684 url = 'ssh://localserver'
2685
2686 if opts['peer'] == 'ssh1':
2687 ui.write(_('creating ssh peer for wire protocol version 1\n'))
2688 peer = sshpeer.sshv1peer(ui, url, proc, stdin, stdout, stderr,
2689 None)
2690 elif opts['peer'] == 'ssh2':
2691 ui.write(_('creating ssh peer for wire protocol version 2\n'))
2692 peer = sshpeer.sshv2peer(ui, url, proc, stdin, stdout, stderr,
2693 None)
2694 elif opts['peer'] == 'raw':
2695 ui.write(_('using raw connection to peer\n'))
2696 peer = None
2697 else:
2698 ui.write(_('creating ssh peer from handshake results\n'))
2699 peer = sshpeer.makepeer(ui, url, proc, stdin, stdout, stderr)
2700
2701 else:
2702 raise error.Abort(_('only --localssh is currently supported'))
2703
2704 # Now perform actions based on the parsed wire language instructions.
2705 for action, lines in blocks:
2706 if action in ('raw', 'raw+'):
2707 # Concatenate the data together.
2708 data = ''.join(l.lstrip() for l in lines)
2709 data = util.unescapestr(data)
2710 stdin.write(data)
2711
2712 if action == 'raw+':
2713 stdin.flush()
2714 elif action == 'flush':
2715 stdin.flush()
2716 elif action == 'close':
2717 peer.close()
2718 elif action == 'readavailable':
2719 fds = util.poll([stdout.fileno(), stderr.fileno()])
2720
2721 if stdout.fileno() in fds:
2722 util.readpipe(stdout)
2723 if stderr.fileno() in fds:
2724 util.readpipe(stderr)
2725 elif action == 'readline':
2726 stdout.readline()
2727 else:
2728 raise error.Abort(_('unknown action: %s') % action)
2729
2730 if peer:
2731 peer.close()
2732
2733 if proc:
2734 proc.kill()
@@ -1,393 +1,395 b''
1 Show all commands except debug commands
1 Show all commands except debug commands
2 $ hg debugcomplete
2 $ hg debugcomplete
3 add
3 add
4 addremove
4 addremove
5 annotate
5 annotate
6 archive
6 archive
7 backout
7 backout
8 bisect
8 bisect
9 bookmarks
9 bookmarks
10 branch
10 branch
11 branches
11 branches
12 bundle
12 bundle
13 cat
13 cat
14 clone
14 clone
15 commit
15 commit
16 config
16 config
17 copy
17 copy
18 diff
18 diff
19 export
19 export
20 files
20 files
21 forget
21 forget
22 graft
22 graft
23 grep
23 grep
24 heads
24 heads
25 help
25 help
26 identify
26 identify
27 import
27 import
28 incoming
28 incoming
29 init
29 init
30 locate
30 locate
31 log
31 log
32 manifest
32 manifest
33 merge
33 merge
34 outgoing
34 outgoing
35 parents
35 parents
36 paths
36 paths
37 phase
37 phase
38 pull
38 pull
39 push
39 push
40 recover
40 recover
41 remove
41 remove
42 rename
42 rename
43 resolve
43 resolve
44 revert
44 revert
45 rollback
45 rollback
46 root
46 root
47 serve
47 serve
48 status
48 status
49 summary
49 summary
50 tag
50 tag
51 tags
51 tags
52 tip
52 tip
53 unbundle
53 unbundle
54 update
54 update
55 verify
55 verify
56 version
56 version
57
57
58 Show all commands that start with "a"
58 Show all commands that start with "a"
59 $ hg debugcomplete a
59 $ hg debugcomplete a
60 add
60 add
61 addremove
61 addremove
62 annotate
62 annotate
63 archive
63 archive
64
64
65 Do not show debug commands if there are other candidates
65 Do not show debug commands if there are other candidates
66 $ hg debugcomplete d
66 $ hg debugcomplete d
67 diff
67 diff
68
68
69 Show debug commands if there are no other candidates
69 Show debug commands if there are no other candidates
70 $ hg debugcomplete debug
70 $ hg debugcomplete debug
71 debugancestor
71 debugancestor
72 debugapplystreamclonebundle
72 debugapplystreamclonebundle
73 debugbuilddag
73 debugbuilddag
74 debugbundle
74 debugbundle
75 debugcapabilities
75 debugcapabilities
76 debugcheckstate
76 debugcheckstate
77 debugcolor
77 debugcolor
78 debugcommands
78 debugcommands
79 debugcomplete
79 debugcomplete
80 debugconfig
80 debugconfig
81 debugcreatestreamclonebundle
81 debugcreatestreamclonebundle
82 debugdag
82 debugdag
83 debugdata
83 debugdata
84 debugdate
84 debugdate
85 debugdeltachain
85 debugdeltachain
86 debugdirstate
86 debugdirstate
87 debugdiscovery
87 debugdiscovery
88 debugdownload
88 debugdownload
89 debugextensions
89 debugextensions
90 debugfileset
90 debugfileset
91 debugformat
91 debugformat
92 debugfsinfo
92 debugfsinfo
93 debuggetbundle
93 debuggetbundle
94 debugignore
94 debugignore
95 debugindex
95 debugindex
96 debugindexdot
96 debugindexdot
97 debuginstall
97 debuginstall
98 debugknown
98 debugknown
99 debuglabelcomplete
99 debuglabelcomplete
100 debuglocks
100 debuglocks
101 debugmergestate
101 debugmergestate
102 debugnamecomplete
102 debugnamecomplete
103 debugobsolete
103 debugobsolete
104 debugpathcomplete
104 debugpathcomplete
105 debugpeer
105 debugpeer
106 debugpickmergetool
106 debugpickmergetool
107 debugpushkey
107 debugpushkey
108 debugpvec
108 debugpvec
109 debugrebuilddirstate
109 debugrebuilddirstate
110 debugrebuildfncache
110 debugrebuildfncache
111 debugrename
111 debugrename
112 debugrevlog
112 debugrevlog
113 debugrevspec
113 debugrevspec
114 debugserve
114 debugserve
115 debugsetparents
115 debugsetparents
116 debugssl
116 debugssl
117 debugsub
117 debugsub
118 debugsuccessorssets
118 debugsuccessorssets
119 debugtemplate
119 debugtemplate
120 debugupdatecaches
120 debugupdatecaches
121 debugupgraderepo
121 debugupgraderepo
122 debugwalk
122 debugwalk
123 debugwireargs
123 debugwireargs
124 debugwireproto
124
125
125 Do not show the alias of a debug command if there are other candidates
126 Do not show the alias of a debug command if there are other candidates
126 (this should hide rawcommit)
127 (this should hide rawcommit)
127 $ hg debugcomplete r
128 $ hg debugcomplete r
128 recover
129 recover
129 remove
130 remove
130 rename
131 rename
131 resolve
132 resolve
132 revert
133 revert
133 rollback
134 rollback
134 root
135 root
135 Show the alias of a debug command if there are no other candidates
136 Show the alias of a debug command if there are no other candidates
136 $ hg debugcomplete rawc
137 $ hg debugcomplete rawc
137
138
138
139
139 Show the global options
140 Show the global options
140 $ hg debugcomplete --options | sort
141 $ hg debugcomplete --options | sort
141 --color
142 --color
142 --config
143 --config
143 --cwd
144 --cwd
144 --debug
145 --debug
145 --debugger
146 --debugger
146 --encoding
147 --encoding
147 --encodingmode
148 --encodingmode
148 --help
149 --help
149 --hidden
150 --hidden
150 --noninteractive
151 --noninteractive
151 --pager
152 --pager
152 --profile
153 --profile
153 --quiet
154 --quiet
154 --repository
155 --repository
155 --time
156 --time
156 --traceback
157 --traceback
157 --verbose
158 --verbose
158 --version
159 --version
159 -R
160 -R
160 -h
161 -h
161 -q
162 -q
162 -v
163 -v
163 -y
164 -y
164
165
165 Show the options for the "serve" command
166 Show the options for the "serve" command
166 $ hg debugcomplete --options serve | sort
167 $ hg debugcomplete --options serve | sort
167 --accesslog
168 --accesslog
168 --address
169 --address
169 --certificate
170 --certificate
170 --cmdserver
171 --cmdserver
171 --color
172 --color
172 --config
173 --config
173 --cwd
174 --cwd
174 --daemon
175 --daemon
175 --daemon-postexec
176 --daemon-postexec
176 --debug
177 --debug
177 --debugger
178 --debugger
178 --encoding
179 --encoding
179 --encodingmode
180 --encodingmode
180 --errorlog
181 --errorlog
181 --help
182 --help
182 --hidden
183 --hidden
183 --ipv6
184 --ipv6
184 --name
185 --name
185 --noninteractive
186 --noninteractive
186 --pager
187 --pager
187 --pid-file
188 --pid-file
188 --port
189 --port
189 --prefix
190 --prefix
190 --profile
191 --profile
191 --quiet
192 --quiet
192 --repository
193 --repository
193 --stdio
194 --stdio
194 --style
195 --style
195 --subrepos
196 --subrepos
196 --templates
197 --templates
197 --time
198 --time
198 --traceback
199 --traceback
199 --verbose
200 --verbose
200 --version
201 --version
201 --web-conf
202 --web-conf
202 -6
203 -6
203 -A
204 -A
204 -E
205 -E
205 -R
206 -R
206 -S
207 -S
207 -a
208 -a
208 -d
209 -d
209 -h
210 -h
210 -n
211 -n
211 -p
212 -p
212 -q
213 -q
213 -t
214 -t
214 -v
215 -v
215 -y
216 -y
216
217
217 Show an error if we use --options with an ambiguous abbreviation
218 Show an error if we use --options with an ambiguous abbreviation
218 $ hg debugcomplete --options s
219 $ hg debugcomplete --options s
219 hg: command 's' is ambiguous:
220 hg: command 's' is ambiguous:
220 serve showconfig status summary
221 serve showconfig status summary
221 [255]
222 [255]
222
223
223 Show all commands + options
224 Show all commands + options
224 $ hg debugcommands
225 $ hg debugcommands
225 add: include, exclude, subrepos, dry-run
226 add: include, exclude, subrepos, dry-run
226 annotate: rev, follow, no-follow, text, user, file, date, number, changeset, line-number, skip, ignore-all-space, ignore-space-change, ignore-blank-lines, ignore-space-at-eol, include, exclude, template
227 annotate: rev, follow, no-follow, text, user, file, date, number, changeset, line-number, skip, ignore-all-space, ignore-space-change, ignore-blank-lines, ignore-space-at-eol, include, exclude, template
227 clone: noupdate, updaterev, rev, branch, pull, uncompressed, stream, ssh, remotecmd, insecure
228 clone: noupdate, updaterev, rev, branch, pull, uncompressed, stream, ssh, remotecmd, insecure
228 commit: addremove, close-branch, amend, secret, edit, interactive, include, exclude, message, logfile, date, user, subrepos
229 commit: addremove, close-branch, amend, secret, edit, interactive, include, exclude, message, logfile, date, user, subrepos
229 diff: rev, change, text, git, binary, nodates, noprefix, show-function, reverse, ignore-all-space, ignore-space-change, ignore-blank-lines, ignore-space-at-eol, unified, stat, root, include, exclude, subrepos
230 diff: rev, change, text, git, binary, nodates, noprefix, show-function, reverse, ignore-all-space, ignore-space-change, ignore-blank-lines, ignore-space-at-eol, unified, stat, root, include, exclude, subrepos
230 export: output, switch-parent, rev, text, git, binary, nodates
231 export: output, switch-parent, rev, text, git, binary, nodates
231 forget: include, exclude
232 forget: include, exclude
232 init: ssh, remotecmd, insecure
233 init: ssh, remotecmd, insecure
233 log: follow, follow-first, date, copies, keyword, rev, line-range, removed, only-merges, user, only-branch, branch, prune, patch, git, limit, no-merges, stat, graph, style, template, include, exclude
234 log: follow, follow-first, date, copies, keyword, rev, line-range, removed, only-merges, user, only-branch, branch, prune, patch, git, limit, no-merges, stat, graph, style, template, include, exclude
234 merge: force, rev, preview, abort, tool
235 merge: force, rev, preview, abort, tool
235 pull: update, force, rev, bookmark, branch, ssh, remotecmd, insecure
236 pull: update, force, rev, bookmark, branch, ssh, remotecmd, insecure
236 push: force, rev, bookmark, branch, new-branch, pushvars, ssh, remotecmd, insecure
237 push: force, rev, bookmark, branch, new-branch, pushvars, ssh, remotecmd, insecure
237 remove: after, force, subrepos, include, exclude
238 remove: after, force, subrepos, include, exclude
238 serve: accesslog, daemon, daemon-postexec, errorlog, port, address, prefix, name, web-conf, webdir-conf, pid-file, stdio, cmdserver, templates, style, ipv6, certificate, subrepos
239 serve: accesslog, daemon, daemon-postexec, errorlog, port, address, prefix, name, web-conf, webdir-conf, pid-file, stdio, cmdserver, templates, style, ipv6, certificate, subrepos
239 status: all, modified, added, removed, deleted, clean, unknown, ignored, no-status, terse, copies, print0, rev, change, include, exclude, subrepos, template
240 status: all, modified, added, removed, deleted, clean, unknown, ignored, no-status, terse, copies, print0, rev, change, include, exclude, subrepos, template
240 summary: remote
241 summary: remote
241 update: clean, check, merge, date, rev, tool
242 update: clean, check, merge, date, rev, tool
242 addremove: similarity, subrepos, include, exclude, dry-run
243 addremove: similarity, subrepos, include, exclude, dry-run
243 archive: no-decode, prefix, rev, type, subrepos, include, exclude
244 archive: no-decode, prefix, rev, type, subrepos, include, exclude
244 backout: merge, commit, no-commit, parent, rev, edit, tool, include, exclude, message, logfile, date, user
245 backout: merge, commit, no-commit, parent, rev, edit, tool, include, exclude, message, logfile, date, user
245 bisect: reset, good, bad, skip, extend, command, noupdate
246 bisect: reset, good, bad, skip, extend, command, noupdate
246 bookmarks: force, rev, delete, rename, inactive, template
247 bookmarks: force, rev, delete, rename, inactive, template
247 branch: force, clean, rev
248 branch: force, clean, rev
248 branches: active, closed, template
249 branches: active, closed, template
249 bundle: force, rev, branch, base, all, type, ssh, remotecmd, insecure
250 bundle: force, rev, branch, base, all, type, ssh, remotecmd, insecure
250 cat: output, rev, decode, include, exclude, template
251 cat: output, rev, decode, include, exclude, template
251 config: untrusted, edit, local, global, template
252 config: untrusted, edit, local, global, template
252 copy: after, force, include, exclude, dry-run
253 copy: after, force, include, exclude, dry-run
253 debugancestor:
254 debugancestor:
254 debugapplystreamclonebundle:
255 debugapplystreamclonebundle:
255 debugbuilddag: mergeable-file, overwritten-file, new-file
256 debugbuilddag: mergeable-file, overwritten-file, new-file
256 debugbundle: all, part-type, spec
257 debugbundle: all, part-type, spec
257 debugcapabilities:
258 debugcapabilities:
258 debugcheckstate:
259 debugcheckstate:
259 debugcolor: style
260 debugcolor: style
260 debugcommands:
261 debugcommands:
261 debugcomplete: options
262 debugcomplete: options
262 debugcreatestreamclonebundle:
263 debugcreatestreamclonebundle:
263 debugdag: tags, branches, dots, spaces
264 debugdag: tags, branches, dots, spaces
264 debugdata: changelog, manifest, dir
265 debugdata: changelog, manifest, dir
265 debugdate: extended
266 debugdate: extended
266 debugdeltachain: changelog, manifest, dir, template
267 debugdeltachain: changelog, manifest, dir, template
267 debugdirstate: nodates, datesort
268 debugdirstate: nodates, datesort
268 debugdiscovery: old, nonheads, rev, ssh, remotecmd, insecure
269 debugdiscovery: old, nonheads, rev, ssh, remotecmd, insecure
269 debugdownload: output
270 debugdownload: output
270 debugextensions: template
271 debugextensions: template
271 debugfileset: rev
272 debugfileset: rev
272 debugformat: template
273 debugformat: template
273 debugfsinfo:
274 debugfsinfo:
274 debuggetbundle: head, common, type
275 debuggetbundle: head, common, type
275 debugignore:
276 debugignore:
276 debugindex: changelog, manifest, dir, format
277 debugindex: changelog, manifest, dir, format
277 debugindexdot: changelog, manifest, dir
278 debugindexdot: changelog, manifest, dir
278 debuginstall: template
279 debuginstall: template
279 debugknown:
280 debugknown:
280 debuglabelcomplete:
281 debuglabelcomplete:
281 debuglocks: force-lock, force-wlock, set-lock, set-wlock
282 debuglocks: force-lock, force-wlock, set-lock, set-wlock
282 debugmergestate:
283 debugmergestate:
283 debugnamecomplete:
284 debugnamecomplete:
284 debugobsolete: flags, record-parents, rev, exclusive, index, delete, date, user, template
285 debugobsolete: flags, record-parents, rev, exclusive, index, delete, date, user, template
285 debugpathcomplete: full, normal, added, removed
286 debugpathcomplete: full, normal, added, removed
286 debugpeer:
287 debugpeer:
287 debugpickmergetool: rev, changedelete, include, exclude, tool
288 debugpickmergetool: rev, changedelete, include, exclude, tool
288 debugpushkey:
289 debugpushkey:
289 debugpvec:
290 debugpvec:
290 debugrebuilddirstate: rev, minimal
291 debugrebuilddirstate: rev, minimal
291 debugrebuildfncache:
292 debugrebuildfncache:
292 debugrename: rev
293 debugrename: rev
293 debugrevlog: changelog, manifest, dir, dump
294 debugrevlog: changelog, manifest, dir, dump
294 debugrevspec: optimize, show-revs, show-set, show-stage, no-optimized, verify-optimized
295 debugrevspec: optimize, show-revs, show-set, show-stage, no-optimized, verify-optimized
295 debugserve: sshstdio, logiofd, logiofile
296 debugserve: sshstdio, logiofd, logiofile
296 debugsetparents:
297 debugsetparents:
297 debugssl:
298 debugssl:
298 debugsub: rev
299 debugsub: rev
299 debugsuccessorssets: closest
300 debugsuccessorssets: closest
300 debugtemplate: rev, define
301 debugtemplate: rev, define
301 debugupdatecaches:
302 debugupdatecaches:
302 debugupgraderepo: optimize, run
303 debugupgraderepo: optimize, run
303 debugwalk: include, exclude
304 debugwalk: include, exclude
304 debugwireargs: three, four, five, ssh, remotecmd, insecure
305 debugwireargs: three, four, five, ssh, remotecmd, insecure
306 debugwireproto: localssh, peer, ssh, remotecmd, insecure
305 files: rev, print0, include, exclude, template, subrepos
307 files: rev, print0, include, exclude, template, subrepos
306 graft: rev, continue, edit, log, force, currentdate, currentuser, date, user, tool, dry-run
308 graft: rev, continue, edit, log, force, currentdate, currentuser, date, user, tool, dry-run
307 grep: print0, all, text, follow, ignore-case, files-with-matches, line-number, rev, user, date, template, include, exclude
309 grep: print0, all, text, follow, ignore-case, files-with-matches, line-number, rev, user, date, template, include, exclude
308 heads: rev, topo, active, closed, style, template
310 heads: rev, topo, active, closed, style, template
309 help: extension, command, keyword, system
311 help: extension, command, keyword, system
310 identify: rev, num, id, branch, tags, bookmarks, ssh, remotecmd, insecure, template
312 identify: rev, num, id, branch, tags, bookmarks, ssh, remotecmd, insecure, template
311 import: strip, base, edit, force, no-commit, bypass, partial, exact, prefix, import-branch, message, logfile, date, user, similarity
313 import: strip, base, edit, force, no-commit, bypass, partial, exact, prefix, import-branch, message, logfile, date, user, similarity
312 incoming: force, newest-first, bundle, rev, bookmarks, branch, patch, git, limit, no-merges, stat, graph, style, template, ssh, remotecmd, insecure, subrepos
314 incoming: force, newest-first, bundle, rev, bookmarks, branch, patch, git, limit, no-merges, stat, graph, style, template, ssh, remotecmd, insecure, subrepos
313 locate: rev, print0, fullpath, include, exclude
315 locate: rev, print0, fullpath, include, exclude
314 manifest: rev, all, template
316 manifest: rev, all, template
315 outgoing: force, rev, newest-first, bookmarks, branch, patch, git, limit, no-merges, stat, graph, style, template, ssh, remotecmd, insecure, subrepos
317 outgoing: force, rev, newest-first, bookmarks, branch, patch, git, limit, no-merges, stat, graph, style, template, ssh, remotecmd, insecure, subrepos
316 parents: rev, style, template
318 parents: rev, style, template
317 paths: template
319 paths: template
318 phase: public, draft, secret, force, rev
320 phase: public, draft, secret, force, rev
319 recover:
321 recover:
320 rename: after, force, include, exclude, dry-run
322 rename: after, force, include, exclude, dry-run
321 resolve: all, list, mark, unmark, no-status, tool, include, exclude, template
323 resolve: all, list, mark, unmark, no-status, tool, include, exclude, template
322 revert: all, date, rev, no-backup, interactive, include, exclude, dry-run
324 revert: all, date, rev, no-backup, interactive, include, exclude, dry-run
323 rollback: dry-run, force
325 rollback: dry-run, force
324 root:
326 root:
325 tag: force, local, rev, remove, edit, message, date, user
327 tag: force, local, rev, remove, edit, message, date, user
326 tags: template
328 tags: template
327 tip: patch, git, style, template
329 tip: patch, git, style, template
328 unbundle: update
330 unbundle: update
329 verify:
331 verify:
330 version: template
332 version: template
331
333
332 $ hg init a
334 $ hg init a
333 $ cd a
335 $ cd a
334 $ echo fee > fee
336 $ echo fee > fee
335 $ hg ci -q -Amfee
337 $ hg ci -q -Amfee
336 $ hg tag fee
338 $ hg tag fee
337 $ mkdir fie
339 $ mkdir fie
338 $ echo dead > fie/dead
340 $ echo dead > fie/dead
339 $ echo live > fie/live
341 $ echo live > fie/live
340 $ hg bookmark fo
342 $ hg bookmark fo
341 $ hg branch -q fie
343 $ hg branch -q fie
342 $ hg ci -q -Amfie
344 $ hg ci -q -Amfie
343 $ echo fo > fo
345 $ echo fo > fo
344 $ hg branch -qf default
346 $ hg branch -qf default
345 $ hg ci -q -Amfo
347 $ hg ci -q -Amfo
346 $ echo Fum > Fum
348 $ echo Fum > Fum
347 $ hg ci -q -AmFum
349 $ hg ci -q -AmFum
348 $ hg bookmark Fum
350 $ hg bookmark Fum
349
351
350 Test debugpathcomplete
352 Test debugpathcomplete
351
353
352 $ hg debugpathcomplete f
354 $ hg debugpathcomplete f
353 fee
355 fee
354 fie
356 fie
355 fo
357 fo
356 $ hg debugpathcomplete -f f
358 $ hg debugpathcomplete -f f
357 fee
359 fee
358 fie/dead
360 fie/dead
359 fie/live
361 fie/live
360 fo
362 fo
361
363
362 $ hg rm Fum
364 $ hg rm Fum
363 $ hg debugpathcomplete -r F
365 $ hg debugpathcomplete -r F
364 Fum
366 Fum
365
367
366 Test debugnamecomplete
368 Test debugnamecomplete
367
369
368 $ hg debugnamecomplete
370 $ hg debugnamecomplete
369 Fum
371 Fum
370 default
372 default
371 fee
373 fee
372 fie
374 fie
373 fo
375 fo
374 tip
376 tip
375 $ hg debugnamecomplete f
377 $ hg debugnamecomplete f
376 fee
378 fee
377 fie
379 fie
378 fo
380 fo
379
381
380 Test debuglabelcomplete, a deprecated name for debugnamecomplete that is still
382 Test debuglabelcomplete, a deprecated name for debugnamecomplete that is still
381 used for completions in some shells.
383 used for completions in some shells.
382
384
383 $ hg debuglabelcomplete
385 $ hg debuglabelcomplete
384 Fum
386 Fum
385 default
387 default
386 fee
388 fee
387 fie
389 fie
388 fo
390 fo
389 tip
391 tip
390 $ hg debuglabelcomplete f
392 $ hg debuglabelcomplete f
391 fee
393 fee
392 fie
394 fie
393 fo
395 fo
@@ -1,3474 +1,3476 b''
1 Short help:
1 Short help:
2
2
3 $ hg
3 $ hg
4 Mercurial Distributed SCM
4 Mercurial Distributed SCM
5
5
6 basic commands:
6 basic commands:
7
7
8 add add the specified files on the next commit
8 add add the specified files on the next commit
9 annotate show changeset information by line for each file
9 annotate show changeset information by line for each file
10 clone make a copy of an existing repository
10 clone make a copy of an existing repository
11 commit commit the specified files or all outstanding changes
11 commit commit the specified files or all outstanding changes
12 diff diff repository (or selected files)
12 diff diff repository (or selected files)
13 export dump the header and diffs for one or more changesets
13 export dump the header and diffs for one or more changesets
14 forget forget the specified files on the next commit
14 forget forget the specified files on the next commit
15 init create a new repository in the given directory
15 init create a new repository in the given directory
16 log show revision history of entire repository or files
16 log show revision history of entire repository or files
17 merge merge another revision into working directory
17 merge merge another revision into working directory
18 pull pull changes from the specified source
18 pull pull changes from the specified source
19 push push changes to the specified destination
19 push push changes to the specified destination
20 remove remove the specified files on the next commit
20 remove remove the specified files on the next commit
21 serve start stand-alone webserver
21 serve start stand-alone webserver
22 status show changed files in the working directory
22 status show changed files in the working directory
23 summary summarize working directory state
23 summary summarize working directory state
24 update update working directory (or switch revisions)
24 update update working directory (or switch revisions)
25
25
26 (use 'hg help' for the full list of commands or 'hg -v' for details)
26 (use 'hg help' for the full list of commands or 'hg -v' for details)
27
27
28 $ hg -q
28 $ hg -q
29 add add the specified files on the next commit
29 add add the specified files on the next commit
30 annotate show changeset information by line for each file
30 annotate show changeset information by line for each file
31 clone make a copy of an existing repository
31 clone make a copy of an existing repository
32 commit commit the specified files or all outstanding changes
32 commit commit the specified files or all outstanding changes
33 diff diff repository (or selected files)
33 diff diff repository (or selected files)
34 export dump the header and diffs for one or more changesets
34 export dump the header and diffs for one or more changesets
35 forget forget the specified files on the next commit
35 forget forget the specified files on the next commit
36 init create a new repository in the given directory
36 init create a new repository in the given directory
37 log show revision history of entire repository or files
37 log show revision history of entire repository or files
38 merge merge another revision into working directory
38 merge merge another revision into working directory
39 pull pull changes from the specified source
39 pull pull changes from the specified source
40 push push changes to the specified destination
40 push push changes to the specified destination
41 remove remove the specified files on the next commit
41 remove remove the specified files on the next commit
42 serve start stand-alone webserver
42 serve start stand-alone webserver
43 status show changed files in the working directory
43 status show changed files in the working directory
44 summary summarize working directory state
44 summary summarize working directory state
45 update update working directory (or switch revisions)
45 update update working directory (or switch revisions)
46
46
47 $ hg help
47 $ hg help
48 Mercurial Distributed SCM
48 Mercurial Distributed SCM
49
49
50 list of commands:
50 list of commands:
51
51
52 add add the specified files on the next commit
52 add add the specified files on the next commit
53 addremove add all new files, delete all missing files
53 addremove add all new files, delete all missing files
54 annotate show changeset information by line for each file
54 annotate show changeset information by line for each file
55 archive create an unversioned archive of a repository revision
55 archive create an unversioned archive of a repository revision
56 backout reverse effect of earlier changeset
56 backout reverse effect of earlier changeset
57 bisect subdivision search of changesets
57 bisect subdivision search of changesets
58 bookmarks create a new bookmark or list existing bookmarks
58 bookmarks create a new bookmark or list existing bookmarks
59 branch set or show the current branch name
59 branch set or show the current branch name
60 branches list repository named branches
60 branches list repository named branches
61 bundle create a bundle file
61 bundle create a bundle file
62 cat output the current or given revision of files
62 cat output the current or given revision of files
63 clone make a copy of an existing repository
63 clone make a copy of an existing repository
64 commit commit the specified files or all outstanding changes
64 commit commit the specified files or all outstanding changes
65 config show combined config settings from all hgrc files
65 config show combined config settings from all hgrc files
66 copy mark files as copied for the next commit
66 copy mark files as copied for the next commit
67 diff diff repository (or selected files)
67 diff diff repository (or selected files)
68 export dump the header and diffs for one or more changesets
68 export dump the header and diffs for one or more changesets
69 files list tracked files
69 files list tracked files
70 forget forget the specified files on the next commit
70 forget forget the specified files on the next commit
71 graft copy changes from other branches onto the current branch
71 graft copy changes from other branches onto the current branch
72 grep search revision history for a pattern in specified files
72 grep search revision history for a pattern in specified files
73 heads show branch heads
73 heads show branch heads
74 help show help for a given topic or a help overview
74 help show help for a given topic or a help overview
75 identify identify the working directory or specified revision
75 identify identify the working directory or specified revision
76 import import an ordered set of patches
76 import import an ordered set of patches
77 incoming show new changesets found in source
77 incoming show new changesets found in source
78 init create a new repository in the given directory
78 init create a new repository in the given directory
79 log show revision history of entire repository or files
79 log show revision history of entire repository or files
80 manifest output the current or given revision of the project manifest
80 manifest output the current or given revision of the project manifest
81 merge merge another revision into working directory
81 merge merge another revision into working directory
82 outgoing show changesets not found in the destination
82 outgoing show changesets not found in the destination
83 paths show aliases for remote repositories
83 paths show aliases for remote repositories
84 phase set or show the current phase name
84 phase set or show the current phase name
85 pull pull changes from the specified source
85 pull pull changes from the specified source
86 push push changes to the specified destination
86 push push changes to the specified destination
87 recover roll back an interrupted transaction
87 recover roll back an interrupted transaction
88 remove remove the specified files on the next commit
88 remove remove the specified files on the next commit
89 rename rename files; equivalent of copy + remove
89 rename rename files; equivalent of copy + remove
90 resolve redo merges or set/view the merge status of files
90 resolve redo merges or set/view the merge status of files
91 revert restore files to their checkout state
91 revert restore files to their checkout state
92 root print the root (top) of the current working directory
92 root print the root (top) of the current working directory
93 serve start stand-alone webserver
93 serve start stand-alone webserver
94 status show changed files in the working directory
94 status show changed files in the working directory
95 summary summarize working directory state
95 summary summarize working directory state
96 tag add one or more tags for the current or given revision
96 tag add one or more tags for the current or given revision
97 tags list repository tags
97 tags list repository tags
98 unbundle apply one or more bundle files
98 unbundle apply one or more bundle files
99 update update working directory (or switch revisions)
99 update update working directory (or switch revisions)
100 verify verify the integrity of the repository
100 verify verify the integrity of the repository
101 version output version and copyright information
101 version output version and copyright information
102
102
103 additional help topics:
103 additional help topics:
104
104
105 bundlespec Bundle File Formats
105 bundlespec Bundle File Formats
106 color Colorizing Outputs
106 color Colorizing Outputs
107 config Configuration Files
107 config Configuration Files
108 dates Date Formats
108 dates Date Formats
109 diffs Diff Formats
109 diffs Diff Formats
110 environment Environment Variables
110 environment Environment Variables
111 extensions Using Additional Features
111 extensions Using Additional Features
112 filesets Specifying File Sets
112 filesets Specifying File Sets
113 flags Command-line flags
113 flags Command-line flags
114 glossary Glossary
114 glossary Glossary
115 hgignore Syntax for Mercurial Ignore Files
115 hgignore Syntax for Mercurial Ignore Files
116 hgweb Configuring hgweb
116 hgweb Configuring hgweb
117 internals Technical implementation topics
117 internals Technical implementation topics
118 merge-tools Merge Tools
118 merge-tools Merge Tools
119 pager Pager Support
119 pager Pager Support
120 patterns File Name Patterns
120 patterns File Name Patterns
121 phases Working with Phases
121 phases Working with Phases
122 revisions Specifying Revisions
122 revisions Specifying Revisions
123 scripting Using Mercurial from scripts and automation
123 scripting Using Mercurial from scripts and automation
124 subrepos Subrepositories
124 subrepos Subrepositories
125 templating Template Usage
125 templating Template Usage
126 urls URL Paths
126 urls URL Paths
127
127
128 (use 'hg help -v' to show built-in aliases and global options)
128 (use 'hg help -v' to show built-in aliases and global options)
129
129
130 $ hg -q help
130 $ hg -q help
131 add add the specified files on the next commit
131 add add the specified files on the next commit
132 addremove add all new files, delete all missing files
132 addremove add all new files, delete all missing files
133 annotate show changeset information by line for each file
133 annotate show changeset information by line for each file
134 archive create an unversioned archive of a repository revision
134 archive create an unversioned archive of a repository revision
135 backout reverse effect of earlier changeset
135 backout reverse effect of earlier changeset
136 bisect subdivision search of changesets
136 bisect subdivision search of changesets
137 bookmarks create a new bookmark or list existing bookmarks
137 bookmarks create a new bookmark or list existing bookmarks
138 branch set or show the current branch name
138 branch set or show the current branch name
139 branches list repository named branches
139 branches list repository named branches
140 bundle create a bundle file
140 bundle create a bundle file
141 cat output the current or given revision of files
141 cat output the current or given revision of files
142 clone make a copy of an existing repository
142 clone make a copy of an existing repository
143 commit commit the specified files or all outstanding changes
143 commit commit the specified files or all outstanding changes
144 config show combined config settings from all hgrc files
144 config show combined config settings from all hgrc files
145 copy mark files as copied for the next commit
145 copy mark files as copied for the next commit
146 diff diff repository (or selected files)
146 diff diff repository (or selected files)
147 export dump the header and diffs for one or more changesets
147 export dump the header and diffs for one or more changesets
148 files list tracked files
148 files list tracked files
149 forget forget the specified files on the next commit
149 forget forget the specified files on the next commit
150 graft copy changes from other branches onto the current branch
150 graft copy changes from other branches onto the current branch
151 grep search revision history for a pattern in specified files
151 grep search revision history for a pattern in specified files
152 heads show branch heads
152 heads show branch heads
153 help show help for a given topic or a help overview
153 help show help for a given topic or a help overview
154 identify identify the working directory or specified revision
154 identify identify the working directory or specified revision
155 import import an ordered set of patches
155 import import an ordered set of patches
156 incoming show new changesets found in source
156 incoming show new changesets found in source
157 init create a new repository in the given directory
157 init create a new repository in the given directory
158 log show revision history of entire repository or files
158 log show revision history of entire repository or files
159 manifest output the current or given revision of the project manifest
159 manifest output the current or given revision of the project manifest
160 merge merge another revision into working directory
160 merge merge another revision into working directory
161 outgoing show changesets not found in the destination
161 outgoing show changesets not found in the destination
162 paths show aliases for remote repositories
162 paths show aliases for remote repositories
163 phase set or show the current phase name
163 phase set or show the current phase name
164 pull pull changes from the specified source
164 pull pull changes from the specified source
165 push push changes to the specified destination
165 push push changes to the specified destination
166 recover roll back an interrupted transaction
166 recover roll back an interrupted transaction
167 remove remove the specified files on the next commit
167 remove remove the specified files on the next commit
168 rename rename files; equivalent of copy + remove
168 rename rename files; equivalent of copy + remove
169 resolve redo merges or set/view the merge status of files
169 resolve redo merges or set/view the merge status of files
170 revert restore files to their checkout state
170 revert restore files to their checkout state
171 root print the root (top) of the current working directory
171 root print the root (top) of the current working directory
172 serve start stand-alone webserver
172 serve start stand-alone webserver
173 status show changed files in the working directory
173 status show changed files in the working directory
174 summary summarize working directory state
174 summary summarize working directory state
175 tag add one or more tags for the current or given revision
175 tag add one or more tags for the current or given revision
176 tags list repository tags
176 tags list repository tags
177 unbundle apply one or more bundle files
177 unbundle apply one or more bundle files
178 update update working directory (or switch revisions)
178 update update working directory (or switch revisions)
179 verify verify the integrity of the repository
179 verify verify the integrity of the repository
180 version output version and copyright information
180 version output version and copyright information
181
181
182 additional help topics:
182 additional help topics:
183
183
184 bundlespec Bundle File Formats
184 bundlespec Bundle File Formats
185 color Colorizing Outputs
185 color Colorizing Outputs
186 config Configuration Files
186 config Configuration Files
187 dates Date Formats
187 dates Date Formats
188 diffs Diff Formats
188 diffs Diff Formats
189 environment Environment Variables
189 environment Environment Variables
190 extensions Using Additional Features
190 extensions Using Additional Features
191 filesets Specifying File Sets
191 filesets Specifying File Sets
192 flags Command-line flags
192 flags Command-line flags
193 glossary Glossary
193 glossary Glossary
194 hgignore Syntax for Mercurial Ignore Files
194 hgignore Syntax for Mercurial Ignore Files
195 hgweb Configuring hgweb
195 hgweb Configuring hgweb
196 internals Technical implementation topics
196 internals Technical implementation topics
197 merge-tools Merge Tools
197 merge-tools Merge Tools
198 pager Pager Support
198 pager Pager Support
199 patterns File Name Patterns
199 patterns File Name Patterns
200 phases Working with Phases
200 phases Working with Phases
201 revisions Specifying Revisions
201 revisions Specifying Revisions
202 scripting Using Mercurial from scripts and automation
202 scripting Using Mercurial from scripts and automation
203 subrepos Subrepositories
203 subrepos Subrepositories
204 templating Template Usage
204 templating Template Usage
205 urls URL Paths
205 urls URL Paths
206
206
207 Test extension help:
207 Test extension help:
208 $ hg help extensions --config extensions.rebase= --config extensions.children=
208 $ hg help extensions --config extensions.rebase= --config extensions.children=
209 Using Additional Features
209 Using Additional Features
210 """""""""""""""""""""""""
210 """""""""""""""""""""""""
211
211
212 Mercurial has the ability to add new features through the use of
212 Mercurial has the ability to add new features through the use of
213 extensions. Extensions may add new commands, add options to existing
213 extensions. Extensions may add new commands, add options to existing
214 commands, change the default behavior of commands, or implement hooks.
214 commands, change the default behavior of commands, or implement hooks.
215
215
216 To enable the "foo" extension, either shipped with Mercurial or in the
216 To enable the "foo" extension, either shipped with Mercurial or in the
217 Python search path, create an entry for it in your configuration file,
217 Python search path, create an entry for it in your configuration file,
218 like this:
218 like this:
219
219
220 [extensions]
220 [extensions]
221 foo =
221 foo =
222
222
223 You may also specify the full path to an extension:
223 You may also specify the full path to an extension:
224
224
225 [extensions]
225 [extensions]
226 myfeature = ~/.hgext/myfeature.py
226 myfeature = ~/.hgext/myfeature.py
227
227
228 See 'hg help config' for more information on configuration files.
228 See 'hg help config' for more information on configuration files.
229
229
230 Extensions are not loaded by default for a variety of reasons: they can
230 Extensions are not loaded by default for a variety of reasons: they can
231 increase startup overhead; they may be meant for advanced usage only; they
231 increase startup overhead; they may be meant for advanced usage only; they
232 may provide potentially dangerous abilities (such as letting you destroy
232 may provide potentially dangerous abilities (such as letting you destroy
233 or modify history); they might not be ready for prime time; or they may
233 or modify history); they might not be ready for prime time; or they may
234 alter some usual behaviors of stock Mercurial. It is thus up to the user
234 alter some usual behaviors of stock Mercurial. It is thus up to the user
235 to activate extensions as needed.
235 to activate extensions as needed.
236
236
237 To explicitly disable an extension enabled in a configuration file of
237 To explicitly disable an extension enabled in a configuration file of
238 broader scope, prepend its path with !:
238 broader scope, prepend its path with !:
239
239
240 [extensions]
240 [extensions]
241 # disabling extension bar residing in /path/to/extension/bar.py
241 # disabling extension bar residing in /path/to/extension/bar.py
242 bar = !/path/to/extension/bar.py
242 bar = !/path/to/extension/bar.py
243 # ditto, but no path was supplied for extension baz
243 # ditto, but no path was supplied for extension baz
244 baz = !
244 baz = !
245
245
246 enabled extensions:
246 enabled extensions:
247
247
248 children command to display child changesets (DEPRECATED)
248 children command to display child changesets (DEPRECATED)
249 rebase command to move sets of revisions to a different ancestor
249 rebase command to move sets of revisions to a different ancestor
250
250
251 disabled extensions:
251 disabled extensions:
252
252
253 acl hooks for controlling repository access
253 acl hooks for controlling repository access
254 blackbox log repository events to a blackbox for debugging
254 blackbox log repository events to a blackbox for debugging
255 bugzilla hooks for integrating with the Bugzilla bug tracker
255 bugzilla hooks for integrating with the Bugzilla bug tracker
256 censor erase file content at a given revision
256 censor erase file content at a given revision
257 churn command to display statistics about repository history
257 churn command to display statistics about repository history
258 clonebundles advertise pre-generated bundles to seed clones
258 clonebundles advertise pre-generated bundles to seed clones
259 convert import revisions from foreign VCS repositories into
259 convert import revisions from foreign VCS repositories into
260 Mercurial
260 Mercurial
261 eol automatically manage newlines in repository files
261 eol automatically manage newlines in repository files
262 extdiff command to allow external programs to compare revisions
262 extdiff command to allow external programs to compare revisions
263 factotum http authentication with factotum
263 factotum http authentication with factotum
264 githelp try mapping git commands to Mercurial commands
264 githelp try mapping git commands to Mercurial commands
265 gpg commands to sign and verify changesets
265 gpg commands to sign and verify changesets
266 hgk browse the repository in a graphical way
266 hgk browse the repository in a graphical way
267 highlight syntax highlighting for hgweb (requires Pygments)
267 highlight syntax highlighting for hgweb (requires Pygments)
268 histedit interactive history editing
268 histedit interactive history editing
269 keyword expand keywords in tracked files
269 keyword expand keywords in tracked files
270 largefiles track large binary files
270 largefiles track large binary files
271 mq manage a stack of patches
271 mq manage a stack of patches
272 notify hooks for sending email push notifications
272 notify hooks for sending email push notifications
273 patchbomb command to send changesets as (a series of) patch emails
273 patchbomb command to send changesets as (a series of) patch emails
274 purge command to delete untracked files from the working
274 purge command to delete untracked files from the working
275 directory
275 directory
276 relink recreates hardlinks between repository clones
276 relink recreates hardlinks between repository clones
277 remotenames showing remotebookmarks and remotebranches in UI
277 remotenames showing remotebookmarks and remotebranches in UI
278 schemes extend schemes with shortcuts to repository swarms
278 schemes extend schemes with shortcuts to repository swarms
279 share share a common history between several working directories
279 share share a common history between several working directories
280 shelve save and restore changes to the working directory
280 shelve save and restore changes to the working directory
281 strip strip changesets and their descendants from history
281 strip strip changesets and their descendants from history
282 transplant command to transplant changesets from another branch
282 transplant command to transplant changesets from another branch
283 win32mbcs allow the use of MBCS paths with problematic encodings
283 win32mbcs allow the use of MBCS paths with problematic encodings
284 zeroconf discover and advertise repositories on the local network
284 zeroconf discover and advertise repositories on the local network
285
285
286 Verify that deprecated extensions are included if --verbose:
286 Verify that deprecated extensions are included if --verbose:
287
287
288 $ hg -v help extensions | grep children
288 $ hg -v help extensions | grep children
289 children command to display child changesets (DEPRECATED)
289 children command to display child changesets (DEPRECATED)
290
290
291 Verify that extension keywords appear in help templates
291 Verify that extension keywords appear in help templates
292
292
293 $ hg help --config extensions.transplant= templating|grep transplant > /dev/null
293 $ hg help --config extensions.transplant= templating|grep transplant > /dev/null
294
294
295 Test short command list with verbose option
295 Test short command list with verbose option
296
296
297 $ hg -v help shortlist
297 $ hg -v help shortlist
298 Mercurial Distributed SCM
298 Mercurial Distributed SCM
299
299
300 basic commands:
300 basic commands:
301
301
302 add add the specified files on the next commit
302 add add the specified files on the next commit
303 annotate, blame
303 annotate, blame
304 show changeset information by line for each file
304 show changeset information by line for each file
305 clone make a copy of an existing repository
305 clone make a copy of an existing repository
306 commit, ci commit the specified files or all outstanding changes
306 commit, ci commit the specified files or all outstanding changes
307 diff diff repository (or selected files)
307 diff diff repository (or selected files)
308 export dump the header and diffs for one or more changesets
308 export dump the header and diffs for one or more changesets
309 forget forget the specified files on the next commit
309 forget forget the specified files on the next commit
310 init create a new repository in the given directory
310 init create a new repository in the given directory
311 log, history show revision history of entire repository or files
311 log, history show revision history of entire repository or files
312 merge merge another revision into working directory
312 merge merge another revision into working directory
313 pull pull changes from the specified source
313 pull pull changes from the specified source
314 push push changes to the specified destination
314 push push changes to the specified destination
315 remove, rm remove the specified files on the next commit
315 remove, rm remove the specified files on the next commit
316 serve start stand-alone webserver
316 serve start stand-alone webserver
317 status, st show changed files in the working directory
317 status, st show changed files in the working directory
318 summary, sum summarize working directory state
318 summary, sum summarize working directory state
319 update, up, checkout, co
319 update, up, checkout, co
320 update working directory (or switch revisions)
320 update working directory (or switch revisions)
321
321
322 global options ([+] can be repeated):
322 global options ([+] can be repeated):
323
323
324 -R --repository REPO repository root directory or name of overlay bundle
324 -R --repository REPO repository root directory or name of overlay bundle
325 file
325 file
326 --cwd DIR change working directory
326 --cwd DIR change working directory
327 -y --noninteractive do not prompt, automatically pick the first choice for
327 -y --noninteractive do not prompt, automatically pick the first choice for
328 all prompts
328 all prompts
329 -q --quiet suppress output
329 -q --quiet suppress output
330 -v --verbose enable additional output
330 -v --verbose enable additional output
331 --color TYPE when to colorize (boolean, always, auto, never, or
331 --color TYPE when to colorize (boolean, always, auto, never, or
332 debug)
332 debug)
333 --config CONFIG [+] set/override config option (use 'section.name=value')
333 --config CONFIG [+] set/override config option (use 'section.name=value')
334 --debug enable debugging output
334 --debug enable debugging output
335 --debugger start debugger
335 --debugger start debugger
336 --encoding ENCODE set the charset encoding (default: ascii)
336 --encoding ENCODE set the charset encoding (default: ascii)
337 --encodingmode MODE set the charset encoding mode (default: strict)
337 --encodingmode MODE set the charset encoding mode (default: strict)
338 --traceback always print a traceback on exception
338 --traceback always print a traceback on exception
339 --time time how long the command takes
339 --time time how long the command takes
340 --profile print command execution profile
340 --profile print command execution profile
341 --version output version information and exit
341 --version output version information and exit
342 -h --help display help and exit
342 -h --help display help and exit
343 --hidden consider hidden changesets
343 --hidden consider hidden changesets
344 --pager TYPE when to paginate (boolean, always, auto, or never)
344 --pager TYPE when to paginate (boolean, always, auto, or never)
345 (default: auto)
345 (default: auto)
346
346
347 (use 'hg help' for the full list of commands)
347 (use 'hg help' for the full list of commands)
348
348
349 $ hg add -h
349 $ hg add -h
350 hg add [OPTION]... [FILE]...
350 hg add [OPTION]... [FILE]...
351
351
352 add the specified files on the next commit
352 add the specified files on the next commit
353
353
354 Schedule files to be version controlled and added to the repository.
354 Schedule files to be version controlled and added to the repository.
355
355
356 The files will be added to the repository at the next commit. To undo an
356 The files will be added to the repository at the next commit. To undo an
357 add before that, see 'hg forget'.
357 add before that, see 'hg forget'.
358
358
359 If no names are given, add all files to the repository (except files
359 If no names are given, add all files to the repository (except files
360 matching ".hgignore").
360 matching ".hgignore").
361
361
362 Returns 0 if all files are successfully added.
362 Returns 0 if all files are successfully added.
363
363
364 options ([+] can be repeated):
364 options ([+] can be repeated):
365
365
366 -I --include PATTERN [+] include names matching the given patterns
366 -I --include PATTERN [+] include names matching the given patterns
367 -X --exclude PATTERN [+] exclude names matching the given patterns
367 -X --exclude PATTERN [+] exclude names matching the given patterns
368 -S --subrepos recurse into subrepositories
368 -S --subrepos recurse into subrepositories
369 -n --dry-run do not perform actions, just print output
369 -n --dry-run do not perform actions, just print output
370
370
371 (some details hidden, use --verbose to show complete help)
371 (some details hidden, use --verbose to show complete help)
372
372
373 Verbose help for add
373 Verbose help for add
374
374
375 $ hg add -hv
375 $ hg add -hv
376 hg add [OPTION]... [FILE]...
376 hg add [OPTION]... [FILE]...
377
377
378 add the specified files on the next commit
378 add the specified files on the next commit
379
379
380 Schedule files to be version controlled and added to the repository.
380 Schedule files to be version controlled and added to the repository.
381
381
382 The files will be added to the repository at the next commit. To undo an
382 The files will be added to the repository at the next commit. To undo an
383 add before that, see 'hg forget'.
383 add before that, see 'hg forget'.
384
384
385 If no names are given, add all files to the repository (except files
385 If no names are given, add all files to the repository (except files
386 matching ".hgignore").
386 matching ".hgignore").
387
387
388 Examples:
388 Examples:
389
389
390 - New (unknown) files are added automatically by 'hg add':
390 - New (unknown) files are added automatically by 'hg add':
391
391
392 $ ls
392 $ ls
393 foo.c
393 foo.c
394 $ hg status
394 $ hg status
395 ? foo.c
395 ? foo.c
396 $ hg add
396 $ hg add
397 adding foo.c
397 adding foo.c
398 $ hg status
398 $ hg status
399 A foo.c
399 A foo.c
400
400
401 - Specific files to be added can be specified:
401 - Specific files to be added can be specified:
402
402
403 $ ls
403 $ ls
404 bar.c foo.c
404 bar.c foo.c
405 $ hg status
405 $ hg status
406 ? bar.c
406 ? bar.c
407 ? foo.c
407 ? foo.c
408 $ hg add bar.c
408 $ hg add bar.c
409 $ hg status
409 $ hg status
410 A bar.c
410 A bar.c
411 ? foo.c
411 ? foo.c
412
412
413 Returns 0 if all files are successfully added.
413 Returns 0 if all files are successfully added.
414
414
415 options ([+] can be repeated):
415 options ([+] can be repeated):
416
416
417 -I --include PATTERN [+] include names matching the given patterns
417 -I --include PATTERN [+] include names matching the given patterns
418 -X --exclude PATTERN [+] exclude names matching the given patterns
418 -X --exclude PATTERN [+] exclude names matching the given patterns
419 -S --subrepos recurse into subrepositories
419 -S --subrepos recurse into subrepositories
420 -n --dry-run do not perform actions, just print output
420 -n --dry-run do not perform actions, just print output
421
421
422 global options ([+] can be repeated):
422 global options ([+] can be repeated):
423
423
424 -R --repository REPO repository root directory or name of overlay bundle
424 -R --repository REPO repository root directory or name of overlay bundle
425 file
425 file
426 --cwd DIR change working directory
426 --cwd DIR change working directory
427 -y --noninteractive do not prompt, automatically pick the first choice for
427 -y --noninteractive do not prompt, automatically pick the first choice for
428 all prompts
428 all prompts
429 -q --quiet suppress output
429 -q --quiet suppress output
430 -v --verbose enable additional output
430 -v --verbose enable additional output
431 --color TYPE when to colorize (boolean, always, auto, never, or
431 --color TYPE when to colorize (boolean, always, auto, never, or
432 debug)
432 debug)
433 --config CONFIG [+] set/override config option (use 'section.name=value')
433 --config CONFIG [+] set/override config option (use 'section.name=value')
434 --debug enable debugging output
434 --debug enable debugging output
435 --debugger start debugger
435 --debugger start debugger
436 --encoding ENCODE set the charset encoding (default: ascii)
436 --encoding ENCODE set the charset encoding (default: ascii)
437 --encodingmode MODE set the charset encoding mode (default: strict)
437 --encodingmode MODE set the charset encoding mode (default: strict)
438 --traceback always print a traceback on exception
438 --traceback always print a traceback on exception
439 --time time how long the command takes
439 --time time how long the command takes
440 --profile print command execution profile
440 --profile print command execution profile
441 --version output version information and exit
441 --version output version information and exit
442 -h --help display help and exit
442 -h --help display help and exit
443 --hidden consider hidden changesets
443 --hidden consider hidden changesets
444 --pager TYPE when to paginate (boolean, always, auto, or never)
444 --pager TYPE when to paginate (boolean, always, auto, or never)
445 (default: auto)
445 (default: auto)
446
446
447 Test the textwidth config option
447 Test the textwidth config option
448
448
449 $ hg root -h --config ui.textwidth=50
449 $ hg root -h --config ui.textwidth=50
450 hg root
450 hg root
451
451
452 print the root (top) of the current working
452 print the root (top) of the current working
453 directory
453 directory
454
454
455 Print the root directory of the current
455 Print the root directory of the current
456 repository.
456 repository.
457
457
458 Returns 0 on success.
458 Returns 0 on success.
459
459
460 (some details hidden, use --verbose to show
460 (some details hidden, use --verbose to show
461 complete help)
461 complete help)
462
462
463 Test help option with version option
463 Test help option with version option
464
464
465 $ hg add -h --version
465 $ hg add -h --version
466 Mercurial Distributed SCM (version *) (glob)
466 Mercurial Distributed SCM (version *) (glob)
467 (see https://mercurial-scm.org for more information)
467 (see https://mercurial-scm.org for more information)
468
468
469 Copyright (C) 2005-* Matt Mackall and others (glob)
469 Copyright (C) 2005-* Matt Mackall and others (glob)
470 This is free software; see the source for copying conditions. There is NO
470 This is free software; see the source for copying conditions. There is NO
471 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
471 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
472
472
473 $ hg add --skjdfks
473 $ hg add --skjdfks
474 hg add: option --skjdfks not recognized
474 hg add: option --skjdfks not recognized
475 hg add [OPTION]... [FILE]...
475 hg add [OPTION]... [FILE]...
476
476
477 add the specified files on the next commit
477 add the specified files on the next commit
478
478
479 options ([+] can be repeated):
479 options ([+] can be repeated):
480
480
481 -I --include PATTERN [+] include names matching the given patterns
481 -I --include PATTERN [+] include names matching the given patterns
482 -X --exclude PATTERN [+] exclude names matching the given patterns
482 -X --exclude PATTERN [+] exclude names matching the given patterns
483 -S --subrepos recurse into subrepositories
483 -S --subrepos recurse into subrepositories
484 -n --dry-run do not perform actions, just print output
484 -n --dry-run do not perform actions, just print output
485
485
486 (use 'hg add -h' to show more help)
486 (use 'hg add -h' to show more help)
487 [255]
487 [255]
488
488
489 Test ambiguous command help
489 Test ambiguous command help
490
490
491 $ hg help ad
491 $ hg help ad
492 list of commands:
492 list of commands:
493
493
494 add add the specified files on the next commit
494 add add the specified files on the next commit
495 addremove add all new files, delete all missing files
495 addremove add all new files, delete all missing files
496
496
497 (use 'hg help -v ad' to show built-in aliases and global options)
497 (use 'hg help -v ad' to show built-in aliases and global options)
498
498
499 Test command without options
499 Test command without options
500
500
501 $ hg help verify
501 $ hg help verify
502 hg verify
502 hg verify
503
503
504 verify the integrity of the repository
504 verify the integrity of the repository
505
505
506 Verify the integrity of the current repository.
506 Verify the integrity of the current repository.
507
507
508 This will perform an extensive check of the repository's integrity,
508 This will perform an extensive check of the repository's integrity,
509 validating the hashes and checksums of each entry in the changelog,
509 validating the hashes and checksums of each entry in the changelog,
510 manifest, and tracked files, as well as the integrity of their crosslinks
510 manifest, and tracked files, as well as the integrity of their crosslinks
511 and indices.
511 and indices.
512
512
513 Please see https://mercurial-scm.org/wiki/RepositoryCorruption for more
513 Please see https://mercurial-scm.org/wiki/RepositoryCorruption for more
514 information about recovery from corruption of the repository.
514 information about recovery from corruption of the repository.
515
515
516 Returns 0 on success, 1 if errors are encountered.
516 Returns 0 on success, 1 if errors are encountered.
517
517
518 (some details hidden, use --verbose to show complete help)
518 (some details hidden, use --verbose to show complete help)
519
519
520 $ hg help diff
520 $ hg help diff
521 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
521 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
522
522
523 diff repository (or selected files)
523 diff repository (or selected files)
524
524
525 Show differences between revisions for the specified files.
525 Show differences between revisions for the specified files.
526
526
527 Differences between files are shown using the unified diff format.
527 Differences between files are shown using the unified diff format.
528
528
529 Note:
529 Note:
530 'hg diff' may generate unexpected results for merges, as it will
530 'hg diff' may generate unexpected results for merges, as it will
531 default to comparing against the working directory's first parent
531 default to comparing against the working directory's first parent
532 changeset if no revisions are specified.
532 changeset if no revisions are specified.
533
533
534 When two revision arguments are given, then changes are shown between
534 When two revision arguments are given, then changes are shown between
535 those revisions. If only one revision is specified then that revision is
535 those revisions. If only one revision is specified then that revision is
536 compared to the working directory, and, when no revisions are specified,
536 compared to the working directory, and, when no revisions are specified,
537 the working directory files are compared to its first parent.
537 the working directory files are compared to its first parent.
538
538
539 Alternatively you can specify -c/--change with a revision to see the
539 Alternatively you can specify -c/--change with a revision to see the
540 changes in that changeset relative to its first parent.
540 changes in that changeset relative to its first parent.
541
541
542 Without the -a/--text option, diff will avoid generating diffs of files it
542 Without the -a/--text option, diff will avoid generating diffs of files it
543 detects as binary. With -a, diff will generate a diff anyway, probably
543 detects as binary. With -a, diff will generate a diff anyway, probably
544 with undesirable results.
544 with undesirable results.
545
545
546 Use the -g/--git option to generate diffs in the git extended diff format.
546 Use the -g/--git option to generate diffs in the git extended diff format.
547 For more information, read 'hg help diffs'.
547 For more information, read 'hg help diffs'.
548
548
549 Returns 0 on success.
549 Returns 0 on success.
550
550
551 options ([+] can be repeated):
551 options ([+] can be repeated):
552
552
553 -r --rev REV [+] revision
553 -r --rev REV [+] revision
554 -c --change REV change made by revision
554 -c --change REV change made by revision
555 -a --text treat all files as text
555 -a --text treat all files as text
556 -g --git use git extended diff format
556 -g --git use git extended diff format
557 --binary generate binary diffs in git mode (default)
557 --binary generate binary diffs in git mode (default)
558 --nodates omit dates from diff headers
558 --nodates omit dates from diff headers
559 --noprefix omit a/ and b/ prefixes from filenames
559 --noprefix omit a/ and b/ prefixes from filenames
560 -p --show-function show which function each change is in
560 -p --show-function show which function each change is in
561 --reverse produce a diff that undoes the changes
561 --reverse produce a diff that undoes the changes
562 -w --ignore-all-space ignore white space when comparing lines
562 -w --ignore-all-space ignore white space when comparing lines
563 -b --ignore-space-change ignore changes in the amount of white space
563 -b --ignore-space-change ignore changes in the amount of white space
564 -B --ignore-blank-lines ignore changes whose lines are all blank
564 -B --ignore-blank-lines ignore changes whose lines are all blank
565 -Z --ignore-space-at-eol ignore changes in whitespace at EOL
565 -Z --ignore-space-at-eol ignore changes in whitespace at EOL
566 -U --unified NUM number of lines of context to show
566 -U --unified NUM number of lines of context to show
567 --stat output diffstat-style summary of changes
567 --stat output diffstat-style summary of changes
568 --root DIR produce diffs relative to subdirectory
568 --root DIR produce diffs relative to subdirectory
569 -I --include PATTERN [+] include names matching the given patterns
569 -I --include PATTERN [+] include names matching the given patterns
570 -X --exclude PATTERN [+] exclude names matching the given patterns
570 -X --exclude PATTERN [+] exclude names matching the given patterns
571 -S --subrepos recurse into subrepositories
571 -S --subrepos recurse into subrepositories
572
572
573 (some details hidden, use --verbose to show complete help)
573 (some details hidden, use --verbose to show complete help)
574
574
575 $ hg help status
575 $ hg help status
576 hg status [OPTION]... [FILE]...
576 hg status [OPTION]... [FILE]...
577
577
578 aliases: st
578 aliases: st
579
579
580 show changed files in the working directory
580 show changed files in the working directory
581
581
582 Show status of files in the repository. If names are given, only files
582 Show status of files in the repository. If names are given, only files
583 that match are shown. Files that are clean or ignored or the source of a
583 that match are shown. Files that are clean or ignored or the source of a
584 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
584 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
585 -C/--copies or -A/--all are given. Unless options described with "show
585 -C/--copies or -A/--all are given. Unless options described with "show
586 only ..." are given, the options -mardu are used.
586 only ..." are given, the options -mardu are used.
587
587
588 Option -q/--quiet hides untracked (unknown and ignored) files unless
588 Option -q/--quiet hides untracked (unknown and ignored) files unless
589 explicitly requested with -u/--unknown or -i/--ignored.
589 explicitly requested with -u/--unknown or -i/--ignored.
590
590
591 Note:
591 Note:
592 'hg status' may appear to disagree with diff if permissions have
592 'hg status' may appear to disagree with diff if permissions have
593 changed or a merge has occurred. The standard diff format does not
593 changed or a merge has occurred. The standard diff format does not
594 report permission changes and diff only reports changes relative to one
594 report permission changes and diff only reports changes relative to one
595 merge parent.
595 merge parent.
596
596
597 If one revision is given, it is used as the base revision. If two
597 If one revision is given, it is used as the base revision. If two
598 revisions are given, the differences between them are shown. The --change
598 revisions are given, the differences between them are shown. The --change
599 option can also be used as a shortcut to list the changed files of a
599 option can also be used as a shortcut to list the changed files of a
600 revision from its first parent.
600 revision from its first parent.
601
601
602 The codes used to show the status of files are:
602 The codes used to show the status of files are:
603
603
604 M = modified
604 M = modified
605 A = added
605 A = added
606 R = removed
606 R = removed
607 C = clean
607 C = clean
608 ! = missing (deleted by non-hg command, but still tracked)
608 ! = missing (deleted by non-hg command, but still tracked)
609 ? = not tracked
609 ? = not tracked
610 I = ignored
610 I = ignored
611 = origin of the previous file (with --copies)
611 = origin of the previous file (with --copies)
612
612
613 Returns 0 on success.
613 Returns 0 on success.
614
614
615 options ([+] can be repeated):
615 options ([+] can be repeated):
616
616
617 -A --all show status of all files
617 -A --all show status of all files
618 -m --modified show only modified files
618 -m --modified show only modified files
619 -a --added show only added files
619 -a --added show only added files
620 -r --removed show only removed files
620 -r --removed show only removed files
621 -d --deleted show only deleted (but tracked) files
621 -d --deleted show only deleted (but tracked) files
622 -c --clean show only files without changes
622 -c --clean show only files without changes
623 -u --unknown show only unknown (not tracked) files
623 -u --unknown show only unknown (not tracked) files
624 -i --ignored show only ignored files
624 -i --ignored show only ignored files
625 -n --no-status hide status prefix
625 -n --no-status hide status prefix
626 -C --copies show source of copied files
626 -C --copies show source of copied files
627 -0 --print0 end filenames with NUL, for use with xargs
627 -0 --print0 end filenames with NUL, for use with xargs
628 --rev REV [+] show difference from revision
628 --rev REV [+] show difference from revision
629 --change REV list the changed files of a revision
629 --change REV list the changed files of a revision
630 -I --include PATTERN [+] include names matching the given patterns
630 -I --include PATTERN [+] include names matching the given patterns
631 -X --exclude PATTERN [+] exclude names matching the given patterns
631 -X --exclude PATTERN [+] exclude names matching the given patterns
632 -S --subrepos recurse into subrepositories
632 -S --subrepos recurse into subrepositories
633
633
634 (some details hidden, use --verbose to show complete help)
634 (some details hidden, use --verbose to show complete help)
635
635
636 $ hg -q help status
636 $ hg -q help status
637 hg status [OPTION]... [FILE]...
637 hg status [OPTION]... [FILE]...
638
638
639 show changed files in the working directory
639 show changed files in the working directory
640
640
641 $ hg help foo
641 $ hg help foo
642 abort: no such help topic: foo
642 abort: no such help topic: foo
643 (try 'hg help --keyword foo')
643 (try 'hg help --keyword foo')
644 [255]
644 [255]
645
645
646 $ hg skjdfks
646 $ hg skjdfks
647 hg: unknown command 'skjdfks'
647 hg: unknown command 'skjdfks'
648 Mercurial Distributed SCM
648 Mercurial Distributed SCM
649
649
650 basic commands:
650 basic commands:
651
651
652 add add the specified files on the next commit
652 add add the specified files on the next commit
653 annotate show changeset information by line for each file
653 annotate show changeset information by line for each file
654 clone make a copy of an existing repository
654 clone make a copy of an existing repository
655 commit commit the specified files or all outstanding changes
655 commit commit the specified files or all outstanding changes
656 diff diff repository (or selected files)
656 diff diff repository (or selected files)
657 export dump the header and diffs for one or more changesets
657 export dump the header and diffs for one or more changesets
658 forget forget the specified files on the next commit
658 forget forget the specified files on the next commit
659 init create a new repository in the given directory
659 init create a new repository in the given directory
660 log show revision history of entire repository or files
660 log show revision history of entire repository or files
661 merge merge another revision into working directory
661 merge merge another revision into working directory
662 pull pull changes from the specified source
662 pull pull changes from the specified source
663 push push changes to the specified destination
663 push push changes to the specified destination
664 remove remove the specified files on the next commit
664 remove remove the specified files on the next commit
665 serve start stand-alone webserver
665 serve start stand-alone webserver
666 status show changed files in the working directory
666 status show changed files in the working directory
667 summary summarize working directory state
667 summary summarize working directory state
668 update update working directory (or switch revisions)
668 update update working directory (or switch revisions)
669
669
670 (use 'hg help' for the full list of commands or 'hg -v' for details)
670 (use 'hg help' for the full list of commands or 'hg -v' for details)
671 [255]
671 [255]
672
672
673 Typoed command gives suggestion
673 Typoed command gives suggestion
674 $ hg puls
674 $ hg puls
675 hg: unknown command 'puls'
675 hg: unknown command 'puls'
676 (did you mean one of pull, push?)
676 (did you mean one of pull, push?)
677 [255]
677 [255]
678
678
679 Not enabled extension gets suggested
679 Not enabled extension gets suggested
680
680
681 $ hg rebase
681 $ hg rebase
682 hg: unknown command 'rebase'
682 hg: unknown command 'rebase'
683 'rebase' is provided by the following extension:
683 'rebase' is provided by the following extension:
684
684
685 rebase command to move sets of revisions to a different ancestor
685 rebase command to move sets of revisions to a different ancestor
686
686
687 (use 'hg help extensions' for information on enabling extensions)
687 (use 'hg help extensions' for information on enabling extensions)
688 [255]
688 [255]
689
689
690 Disabled extension gets suggested
690 Disabled extension gets suggested
691 $ hg --config extensions.rebase=! rebase
691 $ hg --config extensions.rebase=! rebase
692 hg: unknown command 'rebase'
692 hg: unknown command 'rebase'
693 'rebase' is provided by the following extension:
693 'rebase' is provided by the following extension:
694
694
695 rebase command to move sets of revisions to a different ancestor
695 rebase command to move sets of revisions to a different ancestor
696
696
697 (use 'hg help extensions' for information on enabling extensions)
697 (use 'hg help extensions' for information on enabling extensions)
698 [255]
698 [255]
699
699
700 Make sure that we don't run afoul of the help system thinking that
700 Make sure that we don't run afoul of the help system thinking that
701 this is a section and erroring out weirdly.
701 this is a section and erroring out weirdly.
702
702
703 $ hg .log
703 $ hg .log
704 hg: unknown command '.log'
704 hg: unknown command '.log'
705 (did you mean log?)
705 (did you mean log?)
706 [255]
706 [255]
707
707
708 $ hg log.
708 $ hg log.
709 hg: unknown command 'log.'
709 hg: unknown command 'log.'
710 (did you mean log?)
710 (did you mean log?)
711 [255]
711 [255]
712 $ hg pu.lh
712 $ hg pu.lh
713 hg: unknown command 'pu.lh'
713 hg: unknown command 'pu.lh'
714 (did you mean one of pull, push?)
714 (did you mean one of pull, push?)
715 [255]
715 [255]
716
716
717 $ cat > helpext.py <<EOF
717 $ cat > helpext.py <<EOF
718 > import os
718 > import os
719 > from mercurial import commands, registrar
719 > from mercurial import commands, registrar
720 >
720 >
721 > cmdtable = {}
721 > cmdtable = {}
722 > command = registrar.command(cmdtable)
722 > command = registrar.command(cmdtable)
723 >
723 >
724 > @command(b'nohelp',
724 > @command(b'nohelp',
725 > [(b'', b'longdesc', 3, b'x'*90),
725 > [(b'', b'longdesc', 3, b'x'*90),
726 > (b'n', b'', None, b'normal desc'),
726 > (b'n', b'', None, b'normal desc'),
727 > (b'', b'newline', b'', b'line1\nline2')],
727 > (b'', b'newline', b'', b'line1\nline2')],
728 > b'hg nohelp',
728 > b'hg nohelp',
729 > norepo=True)
729 > norepo=True)
730 > @command(b'debugoptADV', [(b'', b'aopt', None, b'option is (ADVANCED)')])
730 > @command(b'debugoptADV', [(b'', b'aopt', None, b'option is (ADVANCED)')])
731 > @command(b'debugoptDEP', [(b'', b'dopt', None, b'option is (DEPRECATED)')])
731 > @command(b'debugoptDEP', [(b'', b'dopt', None, b'option is (DEPRECATED)')])
732 > @command(b'debugoptEXP', [(b'', b'eopt', None, b'option is (EXPERIMENTAL)')])
732 > @command(b'debugoptEXP', [(b'', b'eopt', None, b'option is (EXPERIMENTAL)')])
733 > def nohelp(ui, *args, **kwargs):
733 > def nohelp(ui, *args, **kwargs):
734 > pass
734 > pass
735 >
735 >
736 > def uisetup(ui):
736 > def uisetup(ui):
737 > ui.setconfig(b'alias', b'shellalias', b'!echo hi', b'helpext')
737 > ui.setconfig(b'alias', b'shellalias', b'!echo hi', b'helpext')
738 > ui.setconfig(b'alias', b'hgalias', b'summary', b'helpext')
738 > ui.setconfig(b'alias', b'hgalias', b'summary', b'helpext')
739 >
739 >
740 > EOF
740 > EOF
741 $ echo '[extensions]' >> $HGRCPATH
741 $ echo '[extensions]' >> $HGRCPATH
742 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
742 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
743
743
744 Test for aliases
744 Test for aliases
745
745
746 $ hg help hgalias
746 $ hg help hgalias
747 hg hgalias [--remote]
747 hg hgalias [--remote]
748
748
749 alias for: hg summary
749 alias for: hg summary
750
750
751 summarize working directory state
751 summarize working directory state
752
752
753 This generates a brief summary of the working directory state, including
753 This generates a brief summary of the working directory state, including
754 parents, branch, commit status, phase and available updates.
754 parents, branch, commit status, phase and available updates.
755
755
756 With the --remote option, this will check the default paths for incoming
756 With the --remote option, this will check the default paths for incoming
757 and outgoing changes. This can be time-consuming.
757 and outgoing changes. This can be time-consuming.
758
758
759 Returns 0 on success.
759 Returns 0 on success.
760
760
761 defined by: helpext
761 defined by: helpext
762
762
763 options:
763 options:
764
764
765 --remote check for push and pull
765 --remote check for push and pull
766
766
767 (some details hidden, use --verbose to show complete help)
767 (some details hidden, use --verbose to show complete help)
768
768
769 $ hg help shellalias
769 $ hg help shellalias
770 hg shellalias
770 hg shellalias
771
771
772 shell alias for:
772 shell alias for:
773
773
774 echo hi
774 echo hi
775
775
776 defined by: helpext
776 defined by: helpext
777
777
778 (some details hidden, use --verbose to show complete help)
778 (some details hidden, use --verbose to show complete help)
779
779
780 Test command with no help text
780 Test command with no help text
781
781
782 $ hg help nohelp
782 $ hg help nohelp
783 hg nohelp
783 hg nohelp
784
784
785 (no help text available)
785 (no help text available)
786
786
787 options:
787 options:
788
788
789 --longdesc VALUE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
789 --longdesc VALUE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
790 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (default: 3)
790 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (default: 3)
791 -n -- normal desc
791 -n -- normal desc
792 --newline VALUE line1 line2
792 --newline VALUE line1 line2
793
793
794 (some details hidden, use --verbose to show complete help)
794 (some details hidden, use --verbose to show complete help)
795
795
796 $ hg help -k nohelp
796 $ hg help -k nohelp
797 Commands:
797 Commands:
798
798
799 nohelp hg nohelp
799 nohelp hg nohelp
800
800
801 Extension Commands:
801 Extension Commands:
802
802
803 nohelp (no help text available)
803 nohelp (no help text available)
804
804
805 Test that default list of commands omits extension commands
805 Test that default list of commands omits extension commands
806
806
807 $ hg help
807 $ hg help
808 Mercurial Distributed SCM
808 Mercurial Distributed SCM
809
809
810 list of commands:
810 list of commands:
811
811
812 add add the specified files on the next commit
812 add add the specified files on the next commit
813 addremove add all new files, delete all missing files
813 addremove add all new files, delete all missing files
814 annotate show changeset information by line for each file
814 annotate show changeset information by line for each file
815 archive create an unversioned archive of a repository revision
815 archive create an unversioned archive of a repository revision
816 backout reverse effect of earlier changeset
816 backout reverse effect of earlier changeset
817 bisect subdivision search of changesets
817 bisect subdivision search of changesets
818 bookmarks create a new bookmark or list existing bookmarks
818 bookmarks create a new bookmark or list existing bookmarks
819 branch set or show the current branch name
819 branch set or show the current branch name
820 branches list repository named branches
820 branches list repository named branches
821 bundle create a bundle file
821 bundle create a bundle file
822 cat output the current or given revision of files
822 cat output the current or given revision of files
823 clone make a copy of an existing repository
823 clone make a copy of an existing repository
824 commit commit the specified files or all outstanding changes
824 commit commit the specified files or all outstanding changes
825 config show combined config settings from all hgrc files
825 config show combined config settings from all hgrc files
826 copy mark files as copied for the next commit
826 copy mark files as copied for the next commit
827 diff diff repository (or selected files)
827 diff diff repository (or selected files)
828 export dump the header and diffs for one or more changesets
828 export dump the header and diffs for one or more changesets
829 files list tracked files
829 files list tracked files
830 forget forget the specified files on the next commit
830 forget forget the specified files on the next commit
831 graft copy changes from other branches onto the current branch
831 graft copy changes from other branches onto the current branch
832 grep search revision history for a pattern in specified files
832 grep search revision history for a pattern in specified files
833 heads show branch heads
833 heads show branch heads
834 help show help for a given topic or a help overview
834 help show help for a given topic or a help overview
835 identify identify the working directory or specified revision
835 identify identify the working directory or specified revision
836 import import an ordered set of patches
836 import import an ordered set of patches
837 incoming show new changesets found in source
837 incoming show new changesets found in source
838 init create a new repository in the given directory
838 init create a new repository in the given directory
839 log show revision history of entire repository or files
839 log show revision history of entire repository or files
840 manifest output the current or given revision of the project manifest
840 manifest output the current or given revision of the project manifest
841 merge merge another revision into working directory
841 merge merge another revision into working directory
842 outgoing show changesets not found in the destination
842 outgoing show changesets not found in the destination
843 paths show aliases for remote repositories
843 paths show aliases for remote repositories
844 phase set or show the current phase name
844 phase set or show the current phase name
845 pull pull changes from the specified source
845 pull pull changes from the specified source
846 push push changes to the specified destination
846 push push changes to the specified destination
847 recover roll back an interrupted transaction
847 recover roll back an interrupted transaction
848 remove remove the specified files on the next commit
848 remove remove the specified files on the next commit
849 rename rename files; equivalent of copy + remove
849 rename rename files; equivalent of copy + remove
850 resolve redo merges or set/view the merge status of files
850 resolve redo merges or set/view the merge status of files
851 revert restore files to their checkout state
851 revert restore files to their checkout state
852 root print the root (top) of the current working directory
852 root print the root (top) of the current working directory
853 serve start stand-alone webserver
853 serve start stand-alone webserver
854 status show changed files in the working directory
854 status show changed files in the working directory
855 summary summarize working directory state
855 summary summarize working directory state
856 tag add one or more tags for the current or given revision
856 tag add one or more tags for the current or given revision
857 tags list repository tags
857 tags list repository tags
858 unbundle apply one or more bundle files
858 unbundle apply one or more bundle files
859 update update working directory (or switch revisions)
859 update update working directory (or switch revisions)
860 verify verify the integrity of the repository
860 verify verify the integrity of the repository
861 version output version and copyright information
861 version output version and copyright information
862
862
863 enabled extensions:
863 enabled extensions:
864
864
865 helpext (no help text available)
865 helpext (no help text available)
866
866
867 additional help topics:
867 additional help topics:
868
868
869 bundlespec Bundle File Formats
869 bundlespec Bundle File Formats
870 color Colorizing Outputs
870 color Colorizing Outputs
871 config Configuration Files
871 config Configuration Files
872 dates Date Formats
872 dates Date Formats
873 diffs Diff Formats
873 diffs Diff Formats
874 environment Environment Variables
874 environment Environment Variables
875 extensions Using Additional Features
875 extensions Using Additional Features
876 filesets Specifying File Sets
876 filesets Specifying File Sets
877 flags Command-line flags
877 flags Command-line flags
878 glossary Glossary
878 glossary Glossary
879 hgignore Syntax for Mercurial Ignore Files
879 hgignore Syntax for Mercurial Ignore Files
880 hgweb Configuring hgweb
880 hgweb Configuring hgweb
881 internals Technical implementation topics
881 internals Technical implementation topics
882 merge-tools Merge Tools
882 merge-tools Merge Tools
883 pager Pager Support
883 pager Pager Support
884 patterns File Name Patterns
884 patterns File Name Patterns
885 phases Working with Phases
885 phases Working with Phases
886 revisions Specifying Revisions
886 revisions Specifying Revisions
887 scripting Using Mercurial from scripts and automation
887 scripting Using Mercurial from scripts and automation
888 subrepos Subrepositories
888 subrepos Subrepositories
889 templating Template Usage
889 templating Template Usage
890 urls URL Paths
890 urls URL Paths
891
891
892 (use 'hg help -v' to show built-in aliases and global options)
892 (use 'hg help -v' to show built-in aliases and global options)
893
893
894
894
895 Test list of internal help commands
895 Test list of internal help commands
896
896
897 $ hg help debug
897 $ hg help debug
898 debug commands (internal and unsupported):
898 debug commands (internal and unsupported):
899
899
900 debugancestor
900 debugancestor
901 find the ancestor revision of two revisions in a given index
901 find the ancestor revision of two revisions in a given index
902 debugapplystreamclonebundle
902 debugapplystreamclonebundle
903 apply a stream clone bundle file
903 apply a stream clone bundle file
904 debugbuilddag
904 debugbuilddag
905 builds a repo with a given DAG from scratch in the current
905 builds a repo with a given DAG from scratch in the current
906 empty repo
906 empty repo
907 debugbundle lists the contents of a bundle
907 debugbundle lists the contents of a bundle
908 debugcapabilities
908 debugcapabilities
909 lists the capabilities of a remote peer
909 lists the capabilities of a remote peer
910 debugcheckstate
910 debugcheckstate
911 validate the correctness of the current dirstate
911 validate the correctness of the current dirstate
912 debugcolor show available color, effects or style
912 debugcolor show available color, effects or style
913 debugcommands
913 debugcommands
914 list all available commands and options
914 list all available commands and options
915 debugcomplete
915 debugcomplete
916 returns the completion list associated with the given command
916 returns the completion list associated with the given command
917 debugcreatestreamclonebundle
917 debugcreatestreamclonebundle
918 create a stream clone bundle file
918 create a stream clone bundle file
919 debugdag format the changelog or an index DAG as a concise textual
919 debugdag format the changelog or an index DAG as a concise textual
920 description
920 description
921 debugdata dump the contents of a data file revision
921 debugdata dump the contents of a data file revision
922 debugdate parse and display a date
922 debugdate parse and display a date
923 debugdeltachain
923 debugdeltachain
924 dump information about delta chains in a revlog
924 dump information about delta chains in a revlog
925 debugdirstate
925 debugdirstate
926 show the contents of the current dirstate
926 show the contents of the current dirstate
927 debugdiscovery
927 debugdiscovery
928 runs the changeset discovery protocol in isolation
928 runs the changeset discovery protocol in isolation
929 debugdownload
929 debugdownload
930 download a resource using Mercurial logic and config
930 download a resource using Mercurial logic and config
931 debugextensions
931 debugextensions
932 show information about active extensions
932 show information about active extensions
933 debugfileset parse and apply a fileset specification
933 debugfileset parse and apply a fileset specification
934 debugformat display format information about the current repository
934 debugformat display format information about the current repository
935 debugfsinfo show information detected about current filesystem
935 debugfsinfo show information detected about current filesystem
936 debuggetbundle
936 debuggetbundle
937 retrieves a bundle from a repo
937 retrieves a bundle from a repo
938 debugignore display the combined ignore pattern and information about
938 debugignore display the combined ignore pattern and information about
939 ignored files
939 ignored files
940 debugindex dump the contents of an index file
940 debugindex dump the contents of an index file
941 debugindexdot
941 debugindexdot
942 dump an index DAG as a graphviz dot file
942 dump an index DAG as a graphviz dot file
943 debuginstall test Mercurial installation
943 debuginstall test Mercurial installation
944 debugknown test whether node ids are known to a repo
944 debugknown test whether node ids are known to a repo
945 debuglocks show or modify state of locks
945 debuglocks show or modify state of locks
946 debugmergestate
946 debugmergestate
947 print merge state
947 print merge state
948 debugnamecomplete
948 debugnamecomplete
949 complete "names" - tags, open branch names, bookmark names
949 complete "names" - tags, open branch names, bookmark names
950 debugobsolete
950 debugobsolete
951 create arbitrary obsolete marker
951 create arbitrary obsolete marker
952 debugoptADV (no help text available)
952 debugoptADV (no help text available)
953 debugoptDEP (no help text available)
953 debugoptDEP (no help text available)
954 debugoptEXP (no help text available)
954 debugoptEXP (no help text available)
955 debugpathcomplete
955 debugpathcomplete
956 complete part or all of a tracked path
956 complete part or all of a tracked path
957 debugpeer establish a connection to a peer repository
957 debugpeer establish a connection to a peer repository
958 debugpickmergetool
958 debugpickmergetool
959 examine which merge tool is chosen for specified file
959 examine which merge tool is chosen for specified file
960 debugpushkey access the pushkey key/value protocol
960 debugpushkey access the pushkey key/value protocol
961 debugpvec (no help text available)
961 debugpvec (no help text available)
962 debugrebuilddirstate
962 debugrebuilddirstate
963 rebuild the dirstate as it would look like for the given
963 rebuild the dirstate as it would look like for the given
964 revision
964 revision
965 debugrebuildfncache
965 debugrebuildfncache
966 rebuild the fncache file
966 rebuild the fncache file
967 debugrename dump rename information
967 debugrename dump rename information
968 debugrevlog show data and statistics about a revlog
968 debugrevlog show data and statistics about a revlog
969 debugrevspec parse and apply a revision specification
969 debugrevspec parse and apply a revision specification
970 debugserve run a server with advanced settings
970 debugserve run a server with advanced settings
971 debugsetparents
971 debugsetparents
972 manually set the parents of the current working directory
972 manually set the parents of the current working directory
973 debugssl test a secure connection to a server
973 debugssl test a secure connection to a server
974 debugsub (no help text available)
974 debugsub (no help text available)
975 debugsuccessorssets
975 debugsuccessorssets
976 show set of successors for revision
976 show set of successors for revision
977 debugtemplate
977 debugtemplate
978 parse and apply a template
978 parse and apply a template
979 debugupdatecaches
979 debugupdatecaches
980 warm all known caches in the repository
980 warm all known caches in the repository
981 debugupgraderepo
981 debugupgraderepo
982 upgrade a repository to use different features
982 upgrade a repository to use different features
983 debugwalk show how files match on given patterns
983 debugwalk show how files match on given patterns
984 debugwireargs
984 debugwireargs
985 (no help text available)
985 (no help text available)
986 debugwireproto
987 send wire protocol commands to a server
986
988
987 (use 'hg help -v debug' to show built-in aliases and global options)
989 (use 'hg help -v debug' to show built-in aliases and global options)
988
990
989 internals topic renders index of available sub-topics
991 internals topic renders index of available sub-topics
990
992
991 $ hg help internals
993 $ hg help internals
992 Technical implementation topics
994 Technical implementation topics
993 """""""""""""""""""""""""""""""
995 """""""""""""""""""""""""""""""
994
996
995 To access a subtopic, use "hg help internals.{subtopic-name}"
997 To access a subtopic, use "hg help internals.{subtopic-name}"
996
998
997 bundle2 Bundle2
999 bundle2 Bundle2
998 bundles Bundles
1000 bundles Bundles
999 censor Censor
1001 censor Censor
1000 changegroups Changegroups
1002 changegroups Changegroups
1001 config Config Registrar
1003 config Config Registrar
1002 requirements Repository Requirements
1004 requirements Repository Requirements
1003 revlogs Revision Logs
1005 revlogs Revision Logs
1004 wireprotocol Wire Protocol
1006 wireprotocol Wire Protocol
1005
1007
1006 sub-topics can be accessed
1008 sub-topics can be accessed
1007
1009
1008 $ hg help internals.changegroups
1010 $ hg help internals.changegroups
1009 Changegroups
1011 Changegroups
1010 """"""""""""
1012 """"""""""""
1011
1013
1012 Changegroups are representations of repository revlog data, specifically
1014 Changegroups are representations of repository revlog data, specifically
1013 the changelog data, root/flat manifest data, treemanifest data, and
1015 the changelog data, root/flat manifest data, treemanifest data, and
1014 filelogs.
1016 filelogs.
1015
1017
1016 There are 3 versions of changegroups: "1", "2", and "3". From a high-
1018 There are 3 versions of changegroups: "1", "2", and "3". From a high-
1017 level, versions "1" and "2" are almost exactly the same, with the only
1019 level, versions "1" and "2" are almost exactly the same, with the only
1018 difference being an additional item in the *delta header*. Version "3"
1020 difference being an additional item in the *delta header*. Version "3"
1019 adds support for revlog flags in the *delta header* and optionally
1021 adds support for revlog flags in the *delta header* and optionally
1020 exchanging treemanifests (enabled by setting an option on the
1022 exchanging treemanifests (enabled by setting an option on the
1021 "changegroup" part in the bundle2).
1023 "changegroup" part in the bundle2).
1022
1024
1023 Changegroups when not exchanging treemanifests consist of 3 logical
1025 Changegroups when not exchanging treemanifests consist of 3 logical
1024 segments:
1026 segments:
1025
1027
1026 +---------------------------------+
1028 +---------------------------------+
1027 | | | |
1029 | | | |
1028 | changeset | manifest | filelogs |
1030 | changeset | manifest | filelogs |
1029 | | | |
1031 | | | |
1030 | | | |
1032 | | | |
1031 +---------------------------------+
1033 +---------------------------------+
1032
1034
1033 When exchanging treemanifests, there are 4 logical segments:
1035 When exchanging treemanifests, there are 4 logical segments:
1034
1036
1035 +-------------------------------------------------+
1037 +-------------------------------------------------+
1036 | | | | |
1038 | | | | |
1037 | changeset | root | treemanifests | filelogs |
1039 | changeset | root | treemanifests | filelogs |
1038 | | manifest | | |
1040 | | manifest | | |
1039 | | | | |
1041 | | | | |
1040 +-------------------------------------------------+
1042 +-------------------------------------------------+
1041
1043
1042 The principle building block of each segment is a *chunk*. A *chunk* is a
1044 The principle building block of each segment is a *chunk*. A *chunk* is a
1043 framed piece of data:
1045 framed piece of data:
1044
1046
1045 +---------------------------------------+
1047 +---------------------------------------+
1046 | | |
1048 | | |
1047 | length | data |
1049 | length | data |
1048 | (4 bytes) | (<length - 4> bytes) |
1050 | (4 bytes) | (<length - 4> bytes) |
1049 | | |
1051 | | |
1050 +---------------------------------------+
1052 +---------------------------------------+
1051
1053
1052 All integers are big-endian signed integers. Each chunk starts with a
1054 All integers are big-endian signed integers. Each chunk starts with a
1053 32-bit integer indicating the length of the entire chunk (including the
1055 32-bit integer indicating the length of the entire chunk (including the
1054 length field itself).
1056 length field itself).
1055
1057
1056 There is a special case chunk that has a value of 0 for the length
1058 There is a special case chunk that has a value of 0 for the length
1057 ("0x00000000"). We call this an *empty chunk*.
1059 ("0x00000000"). We call this an *empty chunk*.
1058
1060
1059 Delta Groups
1061 Delta Groups
1060 ============
1062 ============
1061
1063
1062 A *delta group* expresses the content of a revlog as a series of deltas,
1064 A *delta group* expresses the content of a revlog as a series of deltas,
1063 or patches against previous revisions.
1065 or patches against previous revisions.
1064
1066
1065 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
1067 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
1066 to signal the end of the delta group:
1068 to signal the end of the delta group:
1067
1069
1068 +------------------------------------------------------------------------+
1070 +------------------------------------------------------------------------+
1069 | | | | | |
1071 | | | | | |
1070 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
1072 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
1071 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
1073 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
1072 | | | | | |
1074 | | | | | |
1073 +------------------------------------------------------------------------+
1075 +------------------------------------------------------------------------+
1074
1076
1075 Each *chunk*'s data consists of the following:
1077 Each *chunk*'s data consists of the following:
1076
1078
1077 +---------------------------------------+
1079 +---------------------------------------+
1078 | | |
1080 | | |
1079 | delta header | delta data |
1081 | delta header | delta data |
1080 | (various by version) | (various) |
1082 | (various by version) | (various) |
1081 | | |
1083 | | |
1082 +---------------------------------------+
1084 +---------------------------------------+
1083
1085
1084 The *delta data* is a series of *delta*s that describe a diff from an
1086 The *delta data* is a series of *delta*s that describe a diff from an
1085 existing entry (either that the recipient already has, or previously
1087 existing entry (either that the recipient already has, or previously
1086 specified in the bundle/changegroup).
1088 specified in the bundle/changegroup).
1087
1089
1088 The *delta header* is different between versions "1", "2", and "3" of the
1090 The *delta header* is different between versions "1", "2", and "3" of the
1089 changegroup format.
1091 changegroup format.
1090
1092
1091 Version 1 (headerlen=80):
1093 Version 1 (headerlen=80):
1092
1094
1093 +------------------------------------------------------+
1095 +------------------------------------------------------+
1094 | | | | |
1096 | | | | |
1095 | node | p1 node | p2 node | link node |
1097 | node | p1 node | p2 node | link node |
1096 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1098 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1097 | | | | |
1099 | | | | |
1098 +------------------------------------------------------+
1100 +------------------------------------------------------+
1099
1101
1100 Version 2 (headerlen=100):
1102 Version 2 (headerlen=100):
1101
1103
1102 +------------------------------------------------------------------+
1104 +------------------------------------------------------------------+
1103 | | | | | |
1105 | | | | | |
1104 | node | p1 node | p2 node | base node | link node |
1106 | node | p1 node | p2 node | base node | link node |
1105 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1107 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1106 | | | | | |
1108 | | | | | |
1107 +------------------------------------------------------------------+
1109 +------------------------------------------------------------------+
1108
1110
1109 Version 3 (headerlen=102):
1111 Version 3 (headerlen=102):
1110
1112
1111 +------------------------------------------------------------------------------+
1113 +------------------------------------------------------------------------------+
1112 | | | | | | |
1114 | | | | | | |
1113 | node | p1 node | p2 node | base node | link node | flags |
1115 | node | p1 node | p2 node | base node | link node | flags |
1114 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
1116 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
1115 | | | | | | |
1117 | | | | | | |
1116 +------------------------------------------------------------------------------+
1118 +------------------------------------------------------------------------------+
1117
1119
1118 The *delta data* consists of "chunklen - 4 - headerlen" bytes, which
1120 The *delta data* consists of "chunklen - 4 - headerlen" bytes, which
1119 contain a series of *delta*s, densely packed (no separators). These deltas
1121 contain a series of *delta*s, densely packed (no separators). These deltas
1120 describe a diff from an existing entry (either that the recipient already
1122 describe a diff from an existing entry (either that the recipient already
1121 has, or previously specified in the bundle/changegroup). The format is
1123 has, or previously specified in the bundle/changegroup). The format is
1122 described more fully in "hg help internals.bdiff", but briefly:
1124 described more fully in "hg help internals.bdiff", but briefly:
1123
1125
1124 +---------------------------------------------------------------+
1126 +---------------------------------------------------------------+
1125 | | | | |
1127 | | | | |
1126 | start offset | end offset | new length | content |
1128 | start offset | end offset | new length | content |
1127 | (4 bytes) | (4 bytes) | (4 bytes) | (<new length> bytes) |
1129 | (4 bytes) | (4 bytes) | (4 bytes) | (<new length> bytes) |
1128 | | | | |
1130 | | | | |
1129 +---------------------------------------------------------------+
1131 +---------------------------------------------------------------+
1130
1132
1131 Please note that the length field in the delta data does *not* include
1133 Please note that the length field in the delta data does *not* include
1132 itself.
1134 itself.
1133
1135
1134 In version 1, the delta is always applied against the previous node from
1136 In version 1, the delta is always applied against the previous node from
1135 the changegroup or the first parent if this is the first entry in the
1137 the changegroup or the first parent if this is the first entry in the
1136 changegroup.
1138 changegroup.
1137
1139
1138 In version 2 and up, the delta base node is encoded in the entry in the
1140 In version 2 and up, the delta base node is encoded in the entry in the
1139 changegroup. This allows the delta to be expressed against any parent,
1141 changegroup. This allows the delta to be expressed against any parent,
1140 which can result in smaller deltas and more efficient encoding of data.
1142 which can result in smaller deltas and more efficient encoding of data.
1141
1143
1142 Changeset Segment
1144 Changeset Segment
1143 =================
1145 =================
1144
1146
1145 The *changeset segment* consists of a single *delta group* holding
1147 The *changeset segment* consists of a single *delta group* holding
1146 changelog data. The *empty chunk* at the end of the *delta group* denotes
1148 changelog data. The *empty chunk* at the end of the *delta group* denotes
1147 the boundary to the *manifest segment*.
1149 the boundary to the *manifest segment*.
1148
1150
1149 Manifest Segment
1151 Manifest Segment
1150 ================
1152 ================
1151
1153
1152 The *manifest segment* consists of a single *delta group* holding manifest
1154 The *manifest segment* consists of a single *delta group* holding manifest
1153 data. If treemanifests are in use, it contains only the manifest for the
1155 data. If treemanifests are in use, it contains only the manifest for the
1154 root directory of the repository. Otherwise, it contains the entire
1156 root directory of the repository. Otherwise, it contains the entire
1155 manifest data. The *empty chunk* at the end of the *delta group* denotes
1157 manifest data. The *empty chunk* at the end of the *delta group* denotes
1156 the boundary to the next segment (either the *treemanifests segment* or
1158 the boundary to the next segment (either the *treemanifests segment* or
1157 the *filelogs segment*, depending on version and the request options).
1159 the *filelogs segment*, depending on version and the request options).
1158
1160
1159 Treemanifests Segment
1161 Treemanifests Segment
1160 ---------------------
1162 ---------------------
1161
1163
1162 The *treemanifests segment* only exists in changegroup version "3", and
1164 The *treemanifests segment* only exists in changegroup version "3", and
1163 only if the 'treemanifest' param is part of the bundle2 changegroup part
1165 only if the 'treemanifest' param is part of the bundle2 changegroup part
1164 (it is not possible to use changegroup version 3 outside of bundle2).
1166 (it is not possible to use changegroup version 3 outside of bundle2).
1165 Aside from the filenames in the *treemanifests segment* containing a
1167 Aside from the filenames in the *treemanifests segment* containing a
1166 trailing "/" character, it behaves identically to the *filelogs segment*
1168 trailing "/" character, it behaves identically to the *filelogs segment*
1167 (see below). The final sub-segment is followed by an *empty chunk*
1169 (see below). The final sub-segment is followed by an *empty chunk*
1168 (logically, a sub-segment with filename size 0). This denotes the boundary
1170 (logically, a sub-segment with filename size 0). This denotes the boundary
1169 to the *filelogs segment*.
1171 to the *filelogs segment*.
1170
1172
1171 Filelogs Segment
1173 Filelogs Segment
1172 ================
1174 ================
1173
1175
1174 The *filelogs segment* consists of multiple sub-segments, each
1176 The *filelogs segment* consists of multiple sub-segments, each
1175 corresponding to an individual file whose data is being described:
1177 corresponding to an individual file whose data is being described:
1176
1178
1177 +--------------------------------------------------+
1179 +--------------------------------------------------+
1178 | | | | | |
1180 | | | | | |
1179 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
1181 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
1180 | | | | | (4 bytes) |
1182 | | | | | (4 bytes) |
1181 | | | | | |
1183 | | | | | |
1182 +--------------------------------------------------+
1184 +--------------------------------------------------+
1183
1185
1184 The final filelog sub-segment is followed by an *empty chunk* (logically,
1186 The final filelog sub-segment is followed by an *empty chunk* (logically,
1185 a sub-segment with filename size 0). This denotes the end of the segment
1187 a sub-segment with filename size 0). This denotes the end of the segment
1186 and of the overall changegroup.
1188 and of the overall changegroup.
1187
1189
1188 Each filelog sub-segment consists of the following:
1190 Each filelog sub-segment consists of the following:
1189
1191
1190 +------------------------------------------------------+
1192 +------------------------------------------------------+
1191 | | | |
1193 | | | |
1192 | filename length | filename | delta group |
1194 | filename length | filename | delta group |
1193 | (4 bytes) | (<length - 4> bytes) | (various) |
1195 | (4 bytes) | (<length - 4> bytes) | (various) |
1194 | | | |
1196 | | | |
1195 +------------------------------------------------------+
1197 +------------------------------------------------------+
1196
1198
1197 That is, a *chunk* consisting of the filename (not terminated or padded)
1199 That is, a *chunk* consisting of the filename (not terminated or padded)
1198 followed by N chunks constituting the *delta group* for this file. The
1200 followed by N chunks constituting the *delta group* for this file. The
1199 *empty chunk* at the end of each *delta group* denotes the boundary to the
1201 *empty chunk* at the end of each *delta group* denotes the boundary to the
1200 next filelog sub-segment.
1202 next filelog sub-segment.
1201
1203
1202 Test list of commands with command with no help text
1204 Test list of commands with command with no help text
1203
1205
1204 $ hg help helpext
1206 $ hg help helpext
1205 helpext extension - no help text available
1207 helpext extension - no help text available
1206
1208
1207 list of commands:
1209 list of commands:
1208
1210
1209 nohelp (no help text available)
1211 nohelp (no help text available)
1210
1212
1211 (use 'hg help -v helpext' to show built-in aliases and global options)
1213 (use 'hg help -v helpext' to show built-in aliases and global options)
1212
1214
1213
1215
1214 test advanced, deprecated and experimental options are hidden in command help
1216 test advanced, deprecated and experimental options are hidden in command help
1215 $ hg help debugoptADV
1217 $ hg help debugoptADV
1216 hg debugoptADV
1218 hg debugoptADV
1217
1219
1218 (no help text available)
1220 (no help text available)
1219
1221
1220 options:
1222 options:
1221
1223
1222 (some details hidden, use --verbose to show complete help)
1224 (some details hidden, use --verbose to show complete help)
1223 $ hg help debugoptDEP
1225 $ hg help debugoptDEP
1224 hg debugoptDEP
1226 hg debugoptDEP
1225
1227
1226 (no help text available)
1228 (no help text available)
1227
1229
1228 options:
1230 options:
1229
1231
1230 (some details hidden, use --verbose to show complete help)
1232 (some details hidden, use --verbose to show complete help)
1231
1233
1232 $ hg help debugoptEXP
1234 $ hg help debugoptEXP
1233 hg debugoptEXP
1235 hg debugoptEXP
1234
1236
1235 (no help text available)
1237 (no help text available)
1236
1238
1237 options:
1239 options:
1238
1240
1239 (some details hidden, use --verbose to show complete help)
1241 (some details hidden, use --verbose to show complete help)
1240
1242
1241 test advanced, deprecated and experimental options are shown with -v
1243 test advanced, deprecated and experimental options are shown with -v
1242 $ hg help -v debugoptADV | grep aopt
1244 $ hg help -v debugoptADV | grep aopt
1243 --aopt option is (ADVANCED)
1245 --aopt option is (ADVANCED)
1244 $ hg help -v debugoptDEP | grep dopt
1246 $ hg help -v debugoptDEP | grep dopt
1245 --dopt option is (DEPRECATED)
1247 --dopt option is (DEPRECATED)
1246 $ hg help -v debugoptEXP | grep eopt
1248 $ hg help -v debugoptEXP | grep eopt
1247 --eopt option is (EXPERIMENTAL)
1249 --eopt option is (EXPERIMENTAL)
1248
1250
1249 #if gettext
1251 #if gettext
1250 test deprecated option is hidden with translation with untranslated description
1252 test deprecated option is hidden with translation with untranslated description
1251 (use many globy for not failing on changed transaction)
1253 (use many globy for not failing on changed transaction)
1252 $ LANGUAGE=sv hg help debugoptDEP
1254 $ LANGUAGE=sv hg help debugoptDEP
1253 hg debugoptDEP
1255 hg debugoptDEP
1254
1256
1255 (*) (glob)
1257 (*) (glob)
1256
1258
1257 options:
1259 options:
1258
1260
1259 (some details hidden, use --verbose to show complete help)
1261 (some details hidden, use --verbose to show complete help)
1260 #endif
1262 #endif
1261
1263
1262 Test commands that collide with topics (issue4240)
1264 Test commands that collide with topics (issue4240)
1263
1265
1264 $ hg config -hq
1266 $ hg config -hq
1265 hg config [-u] [NAME]...
1267 hg config [-u] [NAME]...
1266
1268
1267 show combined config settings from all hgrc files
1269 show combined config settings from all hgrc files
1268 $ hg showconfig -hq
1270 $ hg showconfig -hq
1269 hg config [-u] [NAME]...
1271 hg config [-u] [NAME]...
1270
1272
1271 show combined config settings from all hgrc files
1273 show combined config settings from all hgrc files
1272
1274
1273 Test a help topic
1275 Test a help topic
1274
1276
1275 $ hg help dates
1277 $ hg help dates
1276 Date Formats
1278 Date Formats
1277 """"""""""""
1279 """"""""""""
1278
1280
1279 Some commands allow the user to specify a date, e.g.:
1281 Some commands allow the user to specify a date, e.g.:
1280
1282
1281 - backout, commit, import, tag: Specify the commit date.
1283 - backout, commit, import, tag: Specify the commit date.
1282 - log, revert, update: Select revision(s) by date.
1284 - log, revert, update: Select revision(s) by date.
1283
1285
1284 Many date formats are valid. Here are some examples:
1286 Many date formats are valid. Here are some examples:
1285
1287
1286 - "Wed Dec 6 13:18:29 2006" (local timezone assumed)
1288 - "Wed Dec 6 13:18:29 2006" (local timezone assumed)
1287 - "Dec 6 13:18 -0600" (year assumed, time offset provided)
1289 - "Dec 6 13:18 -0600" (year assumed, time offset provided)
1288 - "Dec 6 13:18 UTC" (UTC and GMT are aliases for +0000)
1290 - "Dec 6 13:18 UTC" (UTC and GMT are aliases for +0000)
1289 - "Dec 6" (midnight)
1291 - "Dec 6" (midnight)
1290 - "13:18" (today assumed)
1292 - "13:18" (today assumed)
1291 - "3:39" (3:39AM assumed)
1293 - "3:39" (3:39AM assumed)
1292 - "3:39pm" (15:39)
1294 - "3:39pm" (15:39)
1293 - "2006-12-06 13:18:29" (ISO 8601 format)
1295 - "2006-12-06 13:18:29" (ISO 8601 format)
1294 - "2006-12-6 13:18"
1296 - "2006-12-6 13:18"
1295 - "2006-12-6"
1297 - "2006-12-6"
1296 - "12-6"
1298 - "12-6"
1297 - "12/6"
1299 - "12/6"
1298 - "12/6/6" (Dec 6 2006)
1300 - "12/6/6" (Dec 6 2006)
1299 - "today" (midnight)
1301 - "today" (midnight)
1300 - "yesterday" (midnight)
1302 - "yesterday" (midnight)
1301 - "now" - right now
1303 - "now" - right now
1302
1304
1303 Lastly, there is Mercurial's internal format:
1305 Lastly, there is Mercurial's internal format:
1304
1306
1305 - "1165411109 0" (Wed Dec 6 13:18:29 2006 UTC)
1307 - "1165411109 0" (Wed Dec 6 13:18:29 2006 UTC)
1306
1308
1307 This is the internal representation format for dates. The first number is
1309 This is the internal representation format for dates. The first number is
1308 the number of seconds since the epoch (1970-01-01 00:00 UTC). The second
1310 the number of seconds since the epoch (1970-01-01 00:00 UTC). The second
1309 is the offset of the local timezone, in seconds west of UTC (negative if
1311 is the offset of the local timezone, in seconds west of UTC (negative if
1310 the timezone is east of UTC).
1312 the timezone is east of UTC).
1311
1313
1312 The log command also accepts date ranges:
1314 The log command also accepts date ranges:
1313
1315
1314 - "<DATE" - at or before a given date/time
1316 - "<DATE" - at or before a given date/time
1315 - ">DATE" - on or after a given date/time
1317 - ">DATE" - on or after a given date/time
1316 - "DATE to DATE" - a date range, inclusive
1318 - "DATE to DATE" - a date range, inclusive
1317 - "-DAYS" - within a given number of days of today
1319 - "-DAYS" - within a given number of days of today
1318
1320
1319 Test repeated config section name
1321 Test repeated config section name
1320
1322
1321 $ hg help config.host
1323 $ hg help config.host
1322 "http_proxy.host"
1324 "http_proxy.host"
1323 Host name and (optional) port of the proxy server, for example
1325 Host name and (optional) port of the proxy server, for example
1324 "myproxy:8000".
1326 "myproxy:8000".
1325
1327
1326 "smtp.host"
1328 "smtp.host"
1327 Host name of mail server, e.g. "mail.example.com".
1329 Host name of mail server, e.g. "mail.example.com".
1328
1330
1329 Unrelated trailing paragraphs shouldn't be included
1331 Unrelated trailing paragraphs shouldn't be included
1330
1332
1331 $ hg help config.extramsg | grep '^$'
1333 $ hg help config.extramsg | grep '^$'
1332
1334
1333
1335
1334 Test capitalized section name
1336 Test capitalized section name
1335
1337
1336 $ hg help scripting.HGPLAIN > /dev/null
1338 $ hg help scripting.HGPLAIN > /dev/null
1337
1339
1338 Help subsection:
1340 Help subsection:
1339
1341
1340 $ hg help config.charsets |grep "Email example:" > /dev/null
1342 $ hg help config.charsets |grep "Email example:" > /dev/null
1341 [1]
1343 [1]
1342
1344
1343 Show nested definitions
1345 Show nested definitions
1344 ("profiling.type"[break]"ls"[break]"stat"[break])
1346 ("profiling.type"[break]"ls"[break]"stat"[break])
1345
1347
1346 $ hg help config.type | egrep '^$'|wc -l
1348 $ hg help config.type | egrep '^$'|wc -l
1347 \s*3 (re)
1349 \s*3 (re)
1348
1350
1349 Separate sections from subsections
1351 Separate sections from subsections
1350
1352
1351 $ hg help config.format | egrep '^ ("|-)|^\s*$' | uniq
1353 $ hg help config.format | egrep '^ ("|-)|^\s*$' | uniq
1352 "format"
1354 "format"
1353 --------
1355 --------
1354
1356
1355 "usegeneraldelta"
1357 "usegeneraldelta"
1356
1358
1357 "dotencode"
1359 "dotencode"
1358
1360
1359 "usefncache"
1361 "usefncache"
1360
1362
1361 "usestore"
1363 "usestore"
1362
1364
1363 "profiling"
1365 "profiling"
1364 -----------
1366 -----------
1365
1367
1366 "format"
1368 "format"
1367
1369
1368 "progress"
1370 "progress"
1369 ----------
1371 ----------
1370
1372
1371 "format"
1373 "format"
1372
1374
1373
1375
1374 Last item in help config.*:
1376 Last item in help config.*:
1375
1377
1376 $ hg help config.`hg help config|grep '^ "'| \
1378 $ hg help config.`hg help config|grep '^ "'| \
1377 > tail -1|sed 's![ "]*!!g'`| \
1379 > tail -1|sed 's![ "]*!!g'`| \
1378 > grep 'hg help -c config' > /dev/null
1380 > grep 'hg help -c config' > /dev/null
1379 [1]
1381 [1]
1380
1382
1381 note to use help -c for general hg help config:
1383 note to use help -c for general hg help config:
1382
1384
1383 $ hg help config |grep 'hg help -c config' > /dev/null
1385 $ hg help config |grep 'hg help -c config' > /dev/null
1384
1386
1385 Test templating help
1387 Test templating help
1386
1388
1387 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
1389 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
1388 desc String. The text of the changeset description.
1390 desc String. The text of the changeset description.
1389 diffstat String. Statistics of changes with the following format:
1391 diffstat String. Statistics of changes with the following format:
1390 firstline Any text. Returns the first line of text.
1392 firstline Any text. Returns the first line of text.
1391 nonempty Any text. Returns '(none)' if the string is empty.
1393 nonempty Any text. Returns '(none)' if the string is empty.
1392
1394
1393 Test deprecated items
1395 Test deprecated items
1394
1396
1395 $ hg help -v templating | grep currentbookmark
1397 $ hg help -v templating | grep currentbookmark
1396 currentbookmark
1398 currentbookmark
1397 $ hg help templating | (grep currentbookmark || true)
1399 $ hg help templating | (grep currentbookmark || true)
1398
1400
1399 Test help hooks
1401 Test help hooks
1400
1402
1401 $ cat > helphook1.py <<EOF
1403 $ cat > helphook1.py <<EOF
1402 > from mercurial import help
1404 > from mercurial import help
1403 >
1405 >
1404 > def rewrite(ui, topic, doc):
1406 > def rewrite(ui, topic, doc):
1405 > return doc + '\nhelphook1\n'
1407 > return doc + '\nhelphook1\n'
1406 >
1408 >
1407 > def extsetup(ui):
1409 > def extsetup(ui):
1408 > help.addtopichook('revisions', rewrite)
1410 > help.addtopichook('revisions', rewrite)
1409 > EOF
1411 > EOF
1410 $ cat > helphook2.py <<EOF
1412 $ cat > helphook2.py <<EOF
1411 > from mercurial import help
1413 > from mercurial import help
1412 >
1414 >
1413 > def rewrite(ui, topic, doc):
1415 > def rewrite(ui, topic, doc):
1414 > return doc + '\nhelphook2\n'
1416 > return doc + '\nhelphook2\n'
1415 >
1417 >
1416 > def extsetup(ui):
1418 > def extsetup(ui):
1417 > help.addtopichook('revisions', rewrite)
1419 > help.addtopichook('revisions', rewrite)
1418 > EOF
1420 > EOF
1419 $ echo '[extensions]' >> $HGRCPATH
1421 $ echo '[extensions]' >> $HGRCPATH
1420 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
1422 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
1421 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
1423 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
1422 $ hg help revsets | grep helphook
1424 $ hg help revsets | grep helphook
1423 helphook1
1425 helphook1
1424 helphook2
1426 helphook2
1425
1427
1426 help -c should only show debug --debug
1428 help -c should only show debug --debug
1427
1429
1428 $ hg help -c --debug|egrep debug|wc -l|egrep '^\s*0\s*$'
1430 $ hg help -c --debug|egrep debug|wc -l|egrep '^\s*0\s*$'
1429 [1]
1431 [1]
1430
1432
1431 help -c should only show deprecated for -v
1433 help -c should only show deprecated for -v
1432
1434
1433 $ hg help -c -v|egrep DEPRECATED|wc -l|egrep '^\s*0\s*$'
1435 $ hg help -c -v|egrep DEPRECATED|wc -l|egrep '^\s*0\s*$'
1434 [1]
1436 [1]
1435
1437
1436 Test -s / --system
1438 Test -s / --system
1437
1439
1438 $ hg help config.files -s windows |grep 'etc/mercurial' | \
1440 $ hg help config.files -s windows |grep 'etc/mercurial' | \
1439 > wc -l | sed -e 's/ //g'
1441 > wc -l | sed -e 's/ //g'
1440 0
1442 0
1441 $ hg help config.files --system unix | grep 'USER' | \
1443 $ hg help config.files --system unix | grep 'USER' | \
1442 > wc -l | sed -e 's/ //g'
1444 > wc -l | sed -e 's/ //g'
1443 0
1445 0
1444
1446
1445 Test -e / -c / -k combinations
1447 Test -e / -c / -k combinations
1446
1448
1447 $ hg help -c|egrep '^[A-Z].*:|^ debug'
1449 $ hg help -c|egrep '^[A-Z].*:|^ debug'
1448 Commands:
1450 Commands:
1449 $ hg help -e|egrep '^[A-Z].*:|^ debug'
1451 $ hg help -e|egrep '^[A-Z].*:|^ debug'
1450 Extensions:
1452 Extensions:
1451 $ hg help -k|egrep '^[A-Z].*:|^ debug'
1453 $ hg help -k|egrep '^[A-Z].*:|^ debug'
1452 Topics:
1454 Topics:
1453 Commands:
1455 Commands:
1454 Extensions:
1456 Extensions:
1455 Extension Commands:
1457 Extension Commands:
1456 $ hg help -c schemes
1458 $ hg help -c schemes
1457 abort: no such help topic: schemes
1459 abort: no such help topic: schemes
1458 (try 'hg help --keyword schemes')
1460 (try 'hg help --keyword schemes')
1459 [255]
1461 [255]
1460 $ hg help -e schemes |head -1
1462 $ hg help -e schemes |head -1
1461 schemes extension - extend schemes with shortcuts to repository swarms
1463 schemes extension - extend schemes with shortcuts to repository swarms
1462 $ hg help -c -k dates |egrep '^(Topics|Extensions|Commands):'
1464 $ hg help -c -k dates |egrep '^(Topics|Extensions|Commands):'
1463 Commands:
1465 Commands:
1464 $ hg help -e -k a |egrep '^(Topics|Extensions|Commands):'
1466 $ hg help -e -k a |egrep '^(Topics|Extensions|Commands):'
1465 Extensions:
1467 Extensions:
1466 $ hg help -e -c -k date |egrep '^(Topics|Extensions|Commands):'
1468 $ hg help -e -c -k date |egrep '^(Topics|Extensions|Commands):'
1467 Extensions:
1469 Extensions:
1468 Commands:
1470 Commands:
1469 $ hg help -c commit > /dev/null
1471 $ hg help -c commit > /dev/null
1470 $ hg help -e -c commit > /dev/null
1472 $ hg help -e -c commit > /dev/null
1471 $ hg help -e commit > /dev/null
1473 $ hg help -e commit > /dev/null
1472 abort: no such help topic: commit
1474 abort: no such help topic: commit
1473 (try 'hg help --keyword commit')
1475 (try 'hg help --keyword commit')
1474 [255]
1476 [255]
1475
1477
1476 Test keyword search help
1478 Test keyword search help
1477
1479
1478 $ cat > prefixedname.py <<EOF
1480 $ cat > prefixedname.py <<EOF
1479 > '''matched against word "clone"
1481 > '''matched against word "clone"
1480 > '''
1482 > '''
1481 > EOF
1483 > EOF
1482 $ echo '[extensions]' >> $HGRCPATH
1484 $ echo '[extensions]' >> $HGRCPATH
1483 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
1485 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
1484 $ hg help -k clone
1486 $ hg help -k clone
1485 Topics:
1487 Topics:
1486
1488
1487 config Configuration Files
1489 config Configuration Files
1488 extensions Using Additional Features
1490 extensions Using Additional Features
1489 glossary Glossary
1491 glossary Glossary
1490 phases Working with Phases
1492 phases Working with Phases
1491 subrepos Subrepositories
1493 subrepos Subrepositories
1492 urls URL Paths
1494 urls URL Paths
1493
1495
1494 Commands:
1496 Commands:
1495
1497
1496 bookmarks create a new bookmark or list existing bookmarks
1498 bookmarks create a new bookmark or list existing bookmarks
1497 clone make a copy of an existing repository
1499 clone make a copy of an existing repository
1498 paths show aliases for remote repositories
1500 paths show aliases for remote repositories
1499 update update working directory (or switch revisions)
1501 update update working directory (or switch revisions)
1500
1502
1501 Extensions:
1503 Extensions:
1502
1504
1503 clonebundles advertise pre-generated bundles to seed clones
1505 clonebundles advertise pre-generated bundles to seed clones
1504 narrow create clones which fetch history data for subset of files
1506 narrow create clones which fetch history data for subset of files
1505 (EXPERIMENTAL)
1507 (EXPERIMENTAL)
1506 prefixedname matched against word "clone"
1508 prefixedname matched against word "clone"
1507 relink recreates hardlinks between repository clones
1509 relink recreates hardlinks between repository clones
1508
1510
1509 Extension Commands:
1511 Extension Commands:
1510
1512
1511 qclone clone main and patch repository at same time
1513 qclone clone main and patch repository at same time
1512
1514
1513 Test unfound topic
1515 Test unfound topic
1514
1516
1515 $ hg help nonexistingtopicthatwillneverexisteverever
1517 $ hg help nonexistingtopicthatwillneverexisteverever
1516 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
1518 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
1517 (try 'hg help --keyword nonexistingtopicthatwillneverexisteverever')
1519 (try 'hg help --keyword nonexistingtopicthatwillneverexisteverever')
1518 [255]
1520 [255]
1519
1521
1520 Test unfound keyword
1522 Test unfound keyword
1521
1523
1522 $ hg help --keyword nonexistingwordthatwillneverexisteverever
1524 $ hg help --keyword nonexistingwordthatwillneverexisteverever
1523 abort: no matches
1525 abort: no matches
1524 (try 'hg help' for a list of topics)
1526 (try 'hg help' for a list of topics)
1525 [255]
1527 [255]
1526
1528
1527 Test omit indicating for help
1529 Test omit indicating for help
1528
1530
1529 $ cat > addverboseitems.py <<EOF
1531 $ cat > addverboseitems.py <<EOF
1530 > '''extension to test omit indicating.
1532 > '''extension to test omit indicating.
1531 >
1533 >
1532 > This paragraph is never omitted (for extension)
1534 > This paragraph is never omitted (for extension)
1533 >
1535 >
1534 > .. container:: verbose
1536 > .. container:: verbose
1535 >
1537 >
1536 > This paragraph is omitted,
1538 > This paragraph is omitted,
1537 > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension)
1539 > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension)
1538 >
1540 >
1539 > This paragraph is never omitted, too (for extension)
1541 > This paragraph is never omitted, too (for extension)
1540 > '''
1542 > '''
1541 > from __future__ import absolute_import
1543 > from __future__ import absolute_import
1542 > from mercurial import commands, help
1544 > from mercurial import commands, help
1543 > testtopic = """This paragraph is never omitted (for topic).
1545 > testtopic = """This paragraph is never omitted (for topic).
1544 >
1546 >
1545 > .. container:: verbose
1547 > .. container:: verbose
1546 >
1548 >
1547 > This paragraph is omitted,
1549 > This paragraph is omitted,
1548 > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic)
1550 > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic)
1549 >
1551 >
1550 > This paragraph is never omitted, too (for topic)
1552 > This paragraph is never omitted, too (for topic)
1551 > """
1553 > """
1552 > def extsetup(ui):
1554 > def extsetup(ui):
1553 > help.helptable.append((["topic-containing-verbose"],
1555 > help.helptable.append((["topic-containing-verbose"],
1554 > "This is the topic to test omit indicating.",
1556 > "This is the topic to test omit indicating.",
1555 > lambda ui: testtopic))
1557 > lambda ui: testtopic))
1556 > EOF
1558 > EOF
1557 $ echo '[extensions]' >> $HGRCPATH
1559 $ echo '[extensions]' >> $HGRCPATH
1558 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1560 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1559 $ hg help addverboseitems
1561 $ hg help addverboseitems
1560 addverboseitems extension - extension to test omit indicating.
1562 addverboseitems extension - extension to test omit indicating.
1561
1563
1562 This paragraph is never omitted (for extension)
1564 This paragraph is never omitted (for extension)
1563
1565
1564 This paragraph is never omitted, too (for extension)
1566 This paragraph is never omitted, too (for extension)
1565
1567
1566 (some details hidden, use --verbose to show complete help)
1568 (some details hidden, use --verbose to show complete help)
1567
1569
1568 no commands defined
1570 no commands defined
1569 $ hg help -v addverboseitems
1571 $ hg help -v addverboseitems
1570 addverboseitems extension - extension to test omit indicating.
1572 addverboseitems extension - extension to test omit indicating.
1571
1573
1572 This paragraph is never omitted (for extension)
1574 This paragraph is never omitted (for extension)
1573
1575
1574 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1576 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1575 extension)
1577 extension)
1576
1578
1577 This paragraph is never omitted, too (for extension)
1579 This paragraph is never omitted, too (for extension)
1578
1580
1579 no commands defined
1581 no commands defined
1580 $ hg help topic-containing-verbose
1582 $ hg help topic-containing-verbose
1581 This is the topic to test omit indicating.
1583 This is the topic to test omit indicating.
1582 """"""""""""""""""""""""""""""""""""""""""
1584 """"""""""""""""""""""""""""""""""""""""""
1583
1585
1584 This paragraph is never omitted (for topic).
1586 This paragraph is never omitted (for topic).
1585
1587
1586 This paragraph is never omitted, too (for topic)
1588 This paragraph is never omitted, too (for topic)
1587
1589
1588 (some details hidden, use --verbose to show complete help)
1590 (some details hidden, use --verbose to show complete help)
1589 $ hg help -v topic-containing-verbose
1591 $ hg help -v topic-containing-verbose
1590 This is the topic to test omit indicating.
1592 This is the topic to test omit indicating.
1591 """"""""""""""""""""""""""""""""""""""""""
1593 """"""""""""""""""""""""""""""""""""""""""
1592
1594
1593 This paragraph is never omitted (for topic).
1595 This paragraph is never omitted (for topic).
1594
1596
1595 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1597 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1596 topic)
1598 topic)
1597
1599
1598 This paragraph is never omitted, too (for topic)
1600 This paragraph is never omitted, too (for topic)
1599
1601
1600 Test section lookup
1602 Test section lookup
1601
1603
1602 $ hg help revset.merge
1604 $ hg help revset.merge
1603 "merge()"
1605 "merge()"
1604 Changeset is a merge changeset.
1606 Changeset is a merge changeset.
1605
1607
1606 $ hg help glossary.dag
1608 $ hg help glossary.dag
1607 DAG
1609 DAG
1608 The repository of changesets of a distributed version control system
1610 The repository of changesets of a distributed version control system
1609 (DVCS) can be described as a directed acyclic graph (DAG), consisting
1611 (DVCS) can be described as a directed acyclic graph (DAG), consisting
1610 of nodes and edges, where nodes correspond to changesets and edges
1612 of nodes and edges, where nodes correspond to changesets and edges
1611 imply a parent -> child relation. This graph can be visualized by
1613 imply a parent -> child relation. This graph can be visualized by
1612 graphical tools such as 'hg log --graph'. In Mercurial, the DAG is
1614 graphical tools such as 'hg log --graph'. In Mercurial, the DAG is
1613 limited by the requirement for children to have at most two parents.
1615 limited by the requirement for children to have at most two parents.
1614
1616
1615
1617
1616 $ hg help hgrc.paths
1618 $ hg help hgrc.paths
1617 "paths"
1619 "paths"
1618 -------
1620 -------
1619
1621
1620 Assigns symbolic names and behavior to repositories.
1622 Assigns symbolic names and behavior to repositories.
1621
1623
1622 Options are symbolic names defining the URL or directory that is the
1624 Options are symbolic names defining the URL or directory that is the
1623 location of the repository. Example:
1625 location of the repository. Example:
1624
1626
1625 [paths]
1627 [paths]
1626 my_server = https://example.com/my_repo
1628 my_server = https://example.com/my_repo
1627 local_path = /home/me/repo
1629 local_path = /home/me/repo
1628
1630
1629 These symbolic names can be used from the command line. To pull from
1631 These symbolic names can be used from the command line. To pull from
1630 "my_server": 'hg pull my_server'. To push to "local_path": 'hg push
1632 "my_server": 'hg pull my_server'. To push to "local_path": 'hg push
1631 local_path'.
1633 local_path'.
1632
1634
1633 Options containing colons (":") denote sub-options that can influence
1635 Options containing colons (":") denote sub-options that can influence
1634 behavior for that specific path. Example:
1636 behavior for that specific path. Example:
1635
1637
1636 [paths]
1638 [paths]
1637 my_server = https://example.com/my_path
1639 my_server = https://example.com/my_path
1638 my_server:pushurl = ssh://example.com/my_path
1640 my_server:pushurl = ssh://example.com/my_path
1639
1641
1640 The following sub-options can be defined:
1642 The following sub-options can be defined:
1641
1643
1642 "pushurl"
1644 "pushurl"
1643 The URL to use for push operations. If not defined, the location
1645 The URL to use for push operations. If not defined, the location
1644 defined by the path's main entry is used.
1646 defined by the path's main entry is used.
1645
1647
1646 "pushrev"
1648 "pushrev"
1647 A revset defining which revisions to push by default.
1649 A revset defining which revisions to push by default.
1648
1650
1649 When 'hg push' is executed without a "-r" argument, the revset defined
1651 When 'hg push' is executed without a "-r" argument, the revset defined
1650 by this sub-option is evaluated to determine what to push.
1652 by this sub-option is evaluated to determine what to push.
1651
1653
1652 For example, a value of "." will push the working directory's revision
1654 For example, a value of "." will push the working directory's revision
1653 by default.
1655 by default.
1654
1656
1655 Revsets specifying bookmarks will not result in the bookmark being
1657 Revsets specifying bookmarks will not result in the bookmark being
1656 pushed.
1658 pushed.
1657
1659
1658 The following special named paths exist:
1660 The following special named paths exist:
1659
1661
1660 "default"
1662 "default"
1661 The URL or directory to use when no source or remote is specified.
1663 The URL or directory to use when no source or remote is specified.
1662
1664
1663 'hg clone' will automatically define this path to the location the
1665 'hg clone' will automatically define this path to the location the
1664 repository was cloned from.
1666 repository was cloned from.
1665
1667
1666 "default-push"
1668 "default-push"
1667 (deprecated) The URL or directory for the default 'hg push' location.
1669 (deprecated) The URL or directory for the default 'hg push' location.
1668 "default:pushurl" should be used instead.
1670 "default:pushurl" should be used instead.
1669
1671
1670 $ hg help glossary.mcguffin
1672 $ hg help glossary.mcguffin
1671 abort: help section not found: glossary.mcguffin
1673 abort: help section not found: glossary.mcguffin
1672 [255]
1674 [255]
1673
1675
1674 $ hg help glossary.mc.guffin
1676 $ hg help glossary.mc.guffin
1675 abort: help section not found: glossary.mc.guffin
1677 abort: help section not found: glossary.mc.guffin
1676 [255]
1678 [255]
1677
1679
1678 $ hg help template.files
1680 $ hg help template.files
1679 files List of strings. All files modified, added, or removed by
1681 files List of strings. All files modified, added, or removed by
1680 this changeset.
1682 this changeset.
1681 files(pattern)
1683 files(pattern)
1682 All files of the current changeset matching the pattern. See
1684 All files of the current changeset matching the pattern. See
1683 'hg help patterns'.
1685 'hg help patterns'.
1684
1686
1685 Test section lookup by translated message
1687 Test section lookup by translated message
1686
1688
1687 str.lower() instead of encoding.lower(str) on translated message might
1689 str.lower() instead of encoding.lower(str) on translated message might
1688 make message meaningless, because some encoding uses 0x41(A) - 0x5a(Z)
1690 make message meaningless, because some encoding uses 0x41(A) - 0x5a(Z)
1689 as the second or later byte of multi-byte character.
1691 as the second or later byte of multi-byte character.
1690
1692
1691 For example, "\x8bL\x98^" (translation of "record" in ja_JP.cp932)
1693 For example, "\x8bL\x98^" (translation of "record" in ja_JP.cp932)
1692 contains 0x4c (L). str.lower() replaces 0x4c(L) by 0x6c(l) and this
1694 contains 0x4c (L). str.lower() replaces 0x4c(L) by 0x6c(l) and this
1693 replacement makes message meaningless.
1695 replacement makes message meaningless.
1694
1696
1695 This tests that section lookup by translated string isn't broken by
1697 This tests that section lookup by translated string isn't broken by
1696 such str.lower().
1698 such str.lower().
1697
1699
1698 $ $PYTHON <<EOF
1700 $ $PYTHON <<EOF
1699 > def escape(s):
1701 > def escape(s):
1700 > return ''.join('\u%x' % ord(uc) for uc in s.decode('cp932'))
1702 > return ''.join('\u%x' % ord(uc) for uc in s.decode('cp932'))
1701 > # translation of "record" in ja_JP.cp932
1703 > # translation of "record" in ja_JP.cp932
1702 > upper = "\x8bL\x98^"
1704 > upper = "\x8bL\x98^"
1703 > # str.lower()-ed section name should be treated as different one
1705 > # str.lower()-ed section name should be treated as different one
1704 > lower = "\x8bl\x98^"
1706 > lower = "\x8bl\x98^"
1705 > with open('ambiguous.py', 'w') as fp:
1707 > with open('ambiguous.py', 'w') as fp:
1706 > fp.write("""# ambiguous section names in ja_JP.cp932
1708 > fp.write("""# ambiguous section names in ja_JP.cp932
1707 > u'''summary of extension
1709 > u'''summary of extension
1708 >
1710 >
1709 > %s
1711 > %s
1710 > ----
1712 > ----
1711 >
1713 >
1712 > Upper name should show only this message
1714 > Upper name should show only this message
1713 >
1715 >
1714 > %s
1716 > %s
1715 > ----
1717 > ----
1716 >
1718 >
1717 > Lower name should show only this message
1719 > Lower name should show only this message
1718 >
1720 >
1719 > subsequent section
1721 > subsequent section
1720 > ------------------
1722 > ------------------
1721 >
1723 >
1722 > This should be hidden at 'hg help ambiguous' with section name.
1724 > This should be hidden at 'hg help ambiguous' with section name.
1723 > '''
1725 > '''
1724 > """ % (escape(upper), escape(lower)))
1726 > """ % (escape(upper), escape(lower)))
1725 > EOF
1727 > EOF
1726
1728
1727 $ cat >> $HGRCPATH <<EOF
1729 $ cat >> $HGRCPATH <<EOF
1728 > [extensions]
1730 > [extensions]
1729 > ambiguous = ./ambiguous.py
1731 > ambiguous = ./ambiguous.py
1730 > EOF
1732 > EOF
1731
1733
1732 $ $PYTHON <<EOF | sh
1734 $ $PYTHON <<EOF | sh
1733 > upper = "\x8bL\x98^"
1735 > upper = "\x8bL\x98^"
1734 > print("hg --encoding cp932 help -e ambiguous.%s" % upper)
1736 > print("hg --encoding cp932 help -e ambiguous.%s" % upper)
1735 > EOF
1737 > EOF
1736 \x8bL\x98^ (esc)
1738 \x8bL\x98^ (esc)
1737 ----
1739 ----
1738
1740
1739 Upper name should show only this message
1741 Upper name should show only this message
1740
1742
1741
1743
1742 $ $PYTHON <<EOF | sh
1744 $ $PYTHON <<EOF | sh
1743 > lower = "\x8bl\x98^"
1745 > lower = "\x8bl\x98^"
1744 > print("hg --encoding cp932 help -e ambiguous.%s" % lower)
1746 > print("hg --encoding cp932 help -e ambiguous.%s" % lower)
1745 > EOF
1747 > EOF
1746 \x8bl\x98^ (esc)
1748 \x8bl\x98^ (esc)
1747 ----
1749 ----
1748
1750
1749 Lower name should show only this message
1751 Lower name should show only this message
1750
1752
1751
1753
1752 $ cat >> $HGRCPATH <<EOF
1754 $ cat >> $HGRCPATH <<EOF
1753 > [extensions]
1755 > [extensions]
1754 > ambiguous = !
1756 > ambiguous = !
1755 > EOF
1757 > EOF
1756
1758
1757 Show help content of disabled extensions
1759 Show help content of disabled extensions
1758
1760
1759 $ cat >> $HGRCPATH <<EOF
1761 $ cat >> $HGRCPATH <<EOF
1760 > [extensions]
1762 > [extensions]
1761 > ambiguous = !./ambiguous.py
1763 > ambiguous = !./ambiguous.py
1762 > EOF
1764 > EOF
1763 $ hg help -e ambiguous
1765 $ hg help -e ambiguous
1764 ambiguous extension - (no help text available)
1766 ambiguous extension - (no help text available)
1765
1767
1766 (use 'hg help extensions' for information on enabling extensions)
1768 (use 'hg help extensions' for information on enabling extensions)
1767
1769
1768 Test dynamic list of merge tools only shows up once
1770 Test dynamic list of merge tools only shows up once
1769 $ hg help merge-tools
1771 $ hg help merge-tools
1770 Merge Tools
1772 Merge Tools
1771 """""""""""
1773 """""""""""
1772
1774
1773 To merge files Mercurial uses merge tools.
1775 To merge files Mercurial uses merge tools.
1774
1776
1775 A merge tool combines two different versions of a file into a merged file.
1777 A merge tool combines two different versions of a file into a merged file.
1776 Merge tools are given the two files and the greatest common ancestor of
1778 Merge tools are given the two files and the greatest common ancestor of
1777 the two file versions, so they can determine the changes made on both
1779 the two file versions, so they can determine the changes made on both
1778 branches.
1780 branches.
1779
1781
1780 Merge tools are used both for 'hg resolve', 'hg merge', 'hg update', 'hg
1782 Merge tools are used both for 'hg resolve', 'hg merge', 'hg update', 'hg
1781 backout' and in several extensions.
1783 backout' and in several extensions.
1782
1784
1783 Usually, the merge tool tries to automatically reconcile the files by
1785 Usually, the merge tool tries to automatically reconcile the files by
1784 combining all non-overlapping changes that occurred separately in the two
1786 combining all non-overlapping changes that occurred separately in the two
1785 different evolutions of the same initial base file. Furthermore, some
1787 different evolutions of the same initial base file. Furthermore, some
1786 interactive merge programs make it easier to manually resolve conflicting
1788 interactive merge programs make it easier to manually resolve conflicting
1787 merges, either in a graphical way, or by inserting some conflict markers.
1789 merges, either in a graphical way, or by inserting some conflict markers.
1788 Mercurial does not include any interactive merge programs but relies on
1790 Mercurial does not include any interactive merge programs but relies on
1789 external tools for that.
1791 external tools for that.
1790
1792
1791 Available merge tools
1793 Available merge tools
1792 =====================
1794 =====================
1793
1795
1794 External merge tools and their properties are configured in the merge-
1796 External merge tools and their properties are configured in the merge-
1795 tools configuration section - see hgrc(5) - but they can often just be
1797 tools configuration section - see hgrc(5) - but they can often just be
1796 named by their executable.
1798 named by their executable.
1797
1799
1798 A merge tool is generally usable if its executable can be found on the
1800 A merge tool is generally usable if its executable can be found on the
1799 system and if it can handle the merge. The executable is found if it is an
1801 system and if it can handle the merge. The executable is found if it is an
1800 absolute or relative executable path or the name of an application in the
1802 absolute or relative executable path or the name of an application in the
1801 executable search path. The tool is assumed to be able to handle the merge
1803 executable search path. The tool is assumed to be able to handle the merge
1802 if it can handle symlinks if the file is a symlink, if it can handle
1804 if it can handle symlinks if the file is a symlink, if it can handle
1803 binary files if the file is binary, and if a GUI is available if the tool
1805 binary files if the file is binary, and if a GUI is available if the tool
1804 requires a GUI.
1806 requires a GUI.
1805
1807
1806 There are some internal merge tools which can be used. The internal merge
1808 There are some internal merge tools which can be used. The internal merge
1807 tools are:
1809 tools are:
1808
1810
1809 ":dump"
1811 ":dump"
1810 Creates three versions of the files to merge, containing the contents of
1812 Creates three versions of the files to merge, containing the contents of
1811 local, other and base. These files can then be used to perform a merge
1813 local, other and base. These files can then be used to perform a merge
1812 manually. If the file to be merged is named "a.txt", these files will
1814 manually. If the file to be merged is named "a.txt", these files will
1813 accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and
1815 accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and
1814 they will be placed in the same directory as "a.txt".
1816 they will be placed in the same directory as "a.txt".
1815
1817
1816 This implies premerge. Therefore, files aren't dumped, if premerge runs
1818 This implies premerge. Therefore, files aren't dumped, if premerge runs
1817 successfully. Use :forcedump to forcibly write files out.
1819 successfully. Use :forcedump to forcibly write files out.
1818
1820
1819 ":fail"
1821 ":fail"
1820 Rather than attempting to merge files that were modified on both
1822 Rather than attempting to merge files that were modified on both
1821 branches, it marks them as unresolved. The resolve command must be used
1823 branches, it marks them as unresolved. The resolve command must be used
1822 to resolve these conflicts.
1824 to resolve these conflicts.
1823
1825
1824 ":forcedump"
1826 ":forcedump"
1825 Creates three versions of the files as same as :dump, but omits
1827 Creates three versions of the files as same as :dump, but omits
1826 premerge.
1828 premerge.
1827
1829
1828 ":local"
1830 ":local"
1829 Uses the local 'p1()' version of files as the merged version.
1831 Uses the local 'p1()' version of files as the merged version.
1830
1832
1831 ":merge"
1833 ":merge"
1832 Uses the internal non-interactive simple merge algorithm for merging
1834 Uses the internal non-interactive simple merge algorithm for merging
1833 files. It will fail if there are any conflicts and leave markers in the
1835 files. It will fail if there are any conflicts and leave markers in the
1834 partially merged file. Markers will have two sections, one for each side
1836 partially merged file. Markers will have two sections, one for each side
1835 of merge.
1837 of merge.
1836
1838
1837 ":merge-local"
1839 ":merge-local"
1838 Like :merge, but resolve all conflicts non-interactively in favor of the
1840 Like :merge, but resolve all conflicts non-interactively in favor of the
1839 local 'p1()' changes.
1841 local 'p1()' changes.
1840
1842
1841 ":merge-other"
1843 ":merge-other"
1842 Like :merge, but resolve all conflicts non-interactively in favor of the
1844 Like :merge, but resolve all conflicts non-interactively in favor of the
1843 other 'p2()' changes.
1845 other 'p2()' changes.
1844
1846
1845 ":merge3"
1847 ":merge3"
1846 Uses the internal non-interactive simple merge algorithm for merging
1848 Uses the internal non-interactive simple merge algorithm for merging
1847 files. It will fail if there are any conflicts and leave markers in the
1849 files. It will fail if there are any conflicts and leave markers in the
1848 partially merged file. Marker will have three sections, one from each
1850 partially merged file. Marker will have three sections, one from each
1849 side of the merge and one for the base content.
1851 side of the merge and one for the base content.
1850
1852
1851 ":other"
1853 ":other"
1852 Uses the other 'p2()' version of files as the merged version.
1854 Uses the other 'p2()' version of files as the merged version.
1853
1855
1854 ":prompt"
1856 ":prompt"
1855 Asks the user which of the local 'p1()' or the other 'p2()' version to
1857 Asks the user which of the local 'p1()' or the other 'p2()' version to
1856 keep as the merged version.
1858 keep as the merged version.
1857
1859
1858 ":tagmerge"
1860 ":tagmerge"
1859 Uses the internal tag merge algorithm (experimental).
1861 Uses the internal tag merge algorithm (experimental).
1860
1862
1861 ":union"
1863 ":union"
1862 Uses the internal non-interactive simple merge algorithm for merging
1864 Uses the internal non-interactive simple merge algorithm for merging
1863 files. It will use both left and right sides for conflict regions. No
1865 files. It will use both left and right sides for conflict regions. No
1864 markers are inserted.
1866 markers are inserted.
1865
1867
1866 Internal tools are always available and do not require a GUI but will by
1868 Internal tools are always available and do not require a GUI but will by
1867 default not handle symlinks or binary files.
1869 default not handle symlinks or binary files.
1868
1870
1869 Choosing a merge tool
1871 Choosing a merge tool
1870 =====================
1872 =====================
1871
1873
1872 Mercurial uses these rules when deciding which merge tool to use:
1874 Mercurial uses these rules when deciding which merge tool to use:
1873
1875
1874 1. If a tool has been specified with the --tool option to merge or
1876 1. If a tool has been specified with the --tool option to merge or
1875 resolve, it is used. If it is the name of a tool in the merge-tools
1877 resolve, it is used. If it is the name of a tool in the merge-tools
1876 configuration, its configuration is used. Otherwise the specified tool
1878 configuration, its configuration is used. Otherwise the specified tool
1877 must be executable by the shell.
1879 must be executable by the shell.
1878 2. If the "HGMERGE" environment variable is present, its value is used and
1880 2. If the "HGMERGE" environment variable is present, its value is used and
1879 must be executable by the shell.
1881 must be executable by the shell.
1880 3. If the filename of the file to be merged matches any of the patterns in
1882 3. If the filename of the file to be merged matches any of the patterns in
1881 the merge-patterns configuration section, the first usable merge tool
1883 the merge-patterns configuration section, the first usable merge tool
1882 corresponding to a matching pattern is used. Here, binary capabilities
1884 corresponding to a matching pattern is used. Here, binary capabilities
1883 of the merge tool are not considered.
1885 of the merge tool are not considered.
1884 4. If ui.merge is set it will be considered next. If the value is not the
1886 4. If ui.merge is set it will be considered next. If the value is not the
1885 name of a configured tool, the specified value is used and must be
1887 name of a configured tool, the specified value is used and must be
1886 executable by the shell. Otherwise the named tool is used if it is
1888 executable by the shell. Otherwise the named tool is used if it is
1887 usable.
1889 usable.
1888 5. If any usable merge tools are present in the merge-tools configuration
1890 5. If any usable merge tools are present in the merge-tools configuration
1889 section, the one with the highest priority is used.
1891 section, the one with the highest priority is used.
1890 6. If a program named "hgmerge" can be found on the system, it is used -
1892 6. If a program named "hgmerge" can be found on the system, it is used -
1891 but it will by default not be used for symlinks and binary files.
1893 but it will by default not be used for symlinks and binary files.
1892 7. If the file to be merged is not binary and is not a symlink, then
1894 7. If the file to be merged is not binary and is not a symlink, then
1893 internal ":merge" is used.
1895 internal ":merge" is used.
1894 8. Otherwise, ":prompt" is used.
1896 8. Otherwise, ":prompt" is used.
1895
1897
1896 Note:
1898 Note:
1897 After selecting a merge program, Mercurial will by default attempt to
1899 After selecting a merge program, Mercurial will by default attempt to
1898 merge the files using a simple merge algorithm first. Only if it
1900 merge the files using a simple merge algorithm first. Only if it
1899 doesn't succeed because of conflicting changes will Mercurial actually
1901 doesn't succeed because of conflicting changes will Mercurial actually
1900 execute the merge program. Whether to use the simple merge algorithm
1902 execute the merge program. Whether to use the simple merge algorithm
1901 first can be controlled by the premerge setting of the merge tool.
1903 first can be controlled by the premerge setting of the merge tool.
1902 Premerge is enabled by default unless the file is binary or a symlink.
1904 Premerge is enabled by default unless the file is binary or a symlink.
1903
1905
1904 See the merge-tools and ui sections of hgrc(5) for details on the
1906 See the merge-tools and ui sections of hgrc(5) for details on the
1905 configuration of merge tools.
1907 configuration of merge tools.
1906
1908
1907 Compression engines listed in `hg help bundlespec`
1909 Compression engines listed in `hg help bundlespec`
1908
1910
1909 $ hg help bundlespec | grep gzip
1911 $ hg help bundlespec | grep gzip
1910 "v1" bundles can only use the "gzip", "bzip2", and "none" compression
1912 "v1" bundles can only use the "gzip", "bzip2", and "none" compression
1911 An algorithm that produces smaller bundles than "gzip".
1913 An algorithm that produces smaller bundles than "gzip".
1912 This engine will likely produce smaller bundles than "gzip" but will be
1914 This engine will likely produce smaller bundles than "gzip" but will be
1913 "gzip"
1915 "gzip"
1914 better compression than "gzip". It also frequently yields better (?)
1916 better compression than "gzip". It also frequently yields better (?)
1915
1917
1916 Test usage of section marks in help documents
1918 Test usage of section marks in help documents
1917
1919
1918 $ cd "$TESTDIR"/../doc
1920 $ cd "$TESTDIR"/../doc
1919 $ $PYTHON check-seclevel.py
1921 $ $PYTHON check-seclevel.py
1920 $ cd $TESTTMP
1922 $ cd $TESTTMP
1921
1923
1922 #if serve
1924 #if serve
1923
1925
1924 Test the help pages in hgweb.
1926 Test the help pages in hgweb.
1925
1927
1926 Dish up an empty repo; serve it cold.
1928 Dish up an empty repo; serve it cold.
1927
1929
1928 $ hg init "$TESTTMP/test"
1930 $ hg init "$TESTTMP/test"
1929 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
1931 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
1930 $ cat hg.pid >> $DAEMON_PIDS
1932 $ cat hg.pid >> $DAEMON_PIDS
1931
1933
1932 $ get-with-headers.py $LOCALIP:$HGPORT "help"
1934 $ get-with-headers.py $LOCALIP:$HGPORT "help"
1933 200 Script output follows
1935 200 Script output follows
1934
1936
1935 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1937 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1936 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1938 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1937 <head>
1939 <head>
1938 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1940 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1939 <meta name="robots" content="index, nofollow" />
1941 <meta name="robots" content="index, nofollow" />
1940 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1942 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1941 <script type="text/javascript" src="/static/mercurial.js"></script>
1943 <script type="text/javascript" src="/static/mercurial.js"></script>
1942
1944
1943 <title>Help: Index</title>
1945 <title>Help: Index</title>
1944 </head>
1946 </head>
1945 <body>
1947 <body>
1946
1948
1947 <div class="container">
1949 <div class="container">
1948 <div class="menu">
1950 <div class="menu">
1949 <div class="logo">
1951 <div class="logo">
1950 <a href="https://mercurial-scm.org/">
1952 <a href="https://mercurial-scm.org/">
1951 <img src="/static/hglogo.png" alt="mercurial" /></a>
1953 <img src="/static/hglogo.png" alt="mercurial" /></a>
1952 </div>
1954 </div>
1953 <ul>
1955 <ul>
1954 <li><a href="/shortlog">log</a></li>
1956 <li><a href="/shortlog">log</a></li>
1955 <li><a href="/graph">graph</a></li>
1957 <li><a href="/graph">graph</a></li>
1956 <li><a href="/tags">tags</a></li>
1958 <li><a href="/tags">tags</a></li>
1957 <li><a href="/bookmarks">bookmarks</a></li>
1959 <li><a href="/bookmarks">bookmarks</a></li>
1958 <li><a href="/branches">branches</a></li>
1960 <li><a href="/branches">branches</a></li>
1959 </ul>
1961 </ul>
1960 <ul>
1962 <ul>
1961 <li class="active">help</li>
1963 <li class="active">help</li>
1962 </ul>
1964 </ul>
1963 </div>
1965 </div>
1964
1966
1965 <div class="main">
1967 <div class="main">
1966 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1968 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1967
1969
1968 <form class="search" action="/log">
1970 <form class="search" action="/log">
1969
1971
1970 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
1972 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
1971 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1973 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1972 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1974 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1973 </form>
1975 </form>
1974 <table class="bigtable">
1976 <table class="bigtable">
1975 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
1977 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
1976
1978
1977 <tr><td>
1979 <tr><td>
1978 <a href="/help/bundlespec">
1980 <a href="/help/bundlespec">
1979 bundlespec
1981 bundlespec
1980 </a>
1982 </a>
1981 </td><td>
1983 </td><td>
1982 Bundle File Formats
1984 Bundle File Formats
1983 </td></tr>
1985 </td></tr>
1984 <tr><td>
1986 <tr><td>
1985 <a href="/help/color">
1987 <a href="/help/color">
1986 color
1988 color
1987 </a>
1989 </a>
1988 </td><td>
1990 </td><td>
1989 Colorizing Outputs
1991 Colorizing Outputs
1990 </td></tr>
1992 </td></tr>
1991 <tr><td>
1993 <tr><td>
1992 <a href="/help/config">
1994 <a href="/help/config">
1993 config
1995 config
1994 </a>
1996 </a>
1995 </td><td>
1997 </td><td>
1996 Configuration Files
1998 Configuration Files
1997 </td></tr>
1999 </td></tr>
1998 <tr><td>
2000 <tr><td>
1999 <a href="/help/dates">
2001 <a href="/help/dates">
2000 dates
2002 dates
2001 </a>
2003 </a>
2002 </td><td>
2004 </td><td>
2003 Date Formats
2005 Date Formats
2004 </td></tr>
2006 </td></tr>
2005 <tr><td>
2007 <tr><td>
2006 <a href="/help/diffs">
2008 <a href="/help/diffs">
2007 diffs
2009 diffs
2008 </a>
2010 </a>
2009 </td><td>
2011 </td><td>
2010 Diff Formats
2012 Diff Formats
2011 </td></tr>
2013 </td></tr>
2012 <tr><td>
2014 <tr><td>
2013 <a href="/help/environment">
2015 <a href="/help/environment">
2014 environment
2016 environment
2015 </a>
2017 </a>
2016 </td><td>
2018 </td><td>
2017 Environment Variables
2019 Environment Variables
2018 </td></tr>
2020 </td></tr>
2019 <tr><td>
2021 <tr><td>
2020 <a href="/help/extensions">
2022 <a href="/help/extensions">
2021 extensions
2023 extensions
2022 </a>
2024 </a>
2023 </td><td>
2025 </td><td>
2024 Using Additional Features
2026 Using Additional Features
2025 </td></tr>
2027 </td></tr>
2026 <tr><td>
2028 <tr><td>
2027 <a href="/help/filesets">
2029 <a href="/help/filesets">
2028 filesets
2030 filesets
2029 </a>
2031 </a>
2030 </td><td>
2032 </td><td>
2031 Specifying File Sets
2033 Specifying File Sets
2032 </td></tr>
2034 </td></tr>
2033 <tr><td>
2035 <tr><td>
2034 <a href="/help/flags">
2036 <a href="/help/flags">
2035 flags
2037 flags
2036 </a>
2038 </a>
2037 </td><td>
2039 </td><td>
2038 Command-line flags
2040 Command-line flags
2039 </td></tr>
2041 </td></tr>
2040 <tr><td>
2042 <tr><td>
2041 <a href="/help/glossary">
2043 <a href="/help/glossary">
2042 glossary
2044 glossary
2043 </a>
2045 </a>
2044 </td><td>
2046 </td><td>
2045 Glossary
2047 Glossary
2046 </td></tr>
2048 </td></tr>
2047 <tr><td>
2049 <tr><td>
2048 <a href="/help/hgignore">
2050 <a href="/help/hgignore">
2049 hgignore
2051 hgignore
2050 </a>
2052 </a>
2051 </td><td>
2053 </td><td>
2052 Syntax for Mercurial Ignore Files
2054 Syntax for Mercurial Ignore Files
2053 </td></tr>
2055 </td></tr>
2054 <tr><td>
2056 <tr><td>
2055 <a href="/help/hgweb">
2057 <a href="/help/hgweb">
2056 hgweb
2058 hgweb
2057 </a>
2059 </a>
2058 </td><td>
2060 </td><td>
2059 Configuring hgweb
2061 Configuring hgweb
2060 </td></tr>
2062 </td></tr>
2061 <tr><td>
2063 <tr><td>
2062 <a href="/help/internals">
2064 <a href="/help/internals">
2063 internals
2065 internals
2064 </a>
2066 </a>
2065 </td><td>
2067 </td><td>
2066 Technical implementation topics
2068 Technical implementation topics
2067 </td></tr>
2069 </td></tr>
2068 <tr><td>
2070 <tr><td>
2069 <a href="/help/merge-tools">
2071 <a href="/help/merge-tools">
2070 merge-tools
2072 merge-tools
2071 </a>
2073 </a>
2072 </td><td>
2074 </td><td>
2073 Merge Tools
2075 Merge Tools
2074 </td></tr>
2076 </td></tr>
2075 <tr><td>
2077 <tr><td>
2076 <a href="/help/pager">
2078 <a href="/help/pager">
2077 pager
2079 pager
2078 </a>
2080 </a>
2079 </td><td>
2081 </td><td>
2080 Pager Support
2082 Pager Support
2081 </td></tr>
2083 </td></tr>
2082 <tr><td>
2084 <tr><td>
2083 <a href="/help/patterns">
2085 <a href="/help/patterns">
2084 patterns
2086 patterns
2085 </a>
2087 </a>
2086 </td><td>
2088 </td><td>
2087 File Name Patterns
2089 File Name Patterns
2088 </td></tr>
2090 </td></tr>
2089 <tr><td>
2091 <tr><td>
2090 <a href="/help/phases">
2092 <a href="/help/phases">
2091 phases
2093 phases
2092 </a>
2094 </a>
2093 </td><td>
2095 </td><td>
2094 Working with Phases
2096 Working with Phases
2095 </td></tr>
2097 </td></tr>
2096 <tr><td>
2098 <tr><td>
2097 <a href="/help/revisions">
2099 <a href="/help/revisions">
2098 revisions
2100 revisions
2099 </a>
2101 </a>
2100 </td><td>
2102 </td><td>
2101 Specifying Revisions
2103 Specifying Revisions
2102 </td></tr>
2104 </td></tr>
2103 <tr><td>
2105 <tr><td>
2104 <a href="/help/scripting">
2106 <a href="/help/scripting">
2105 scripting
2107 scripting
2106 </a>
2108 </a>
2107 </td><td>
2109 </td><td>
2108 Using Mercurial from scripts and automation
2110 Using Mercurial from scripts and automation
2109 </td></tr>
2111 </td></tr>
2110 <tr><td>
2112 <tr><td>
2111 <a href="/help/subrepos">
2113 <a href="/help/subrepos">
2112 subrepos
2114 subrepos
2113 </a>
2115 </a>
2114 </td><td>
2116 </td><td>
2115 Subrepositories
2117 Subrepositories
2116 </td></tr>
2118 </td></tr>
2117 <tr><td>
2119 <tr><td>
2118 <a href="/help/templating">
2120 <a href="/help/templating">
2119 templating
2121 templating
2120 </a>
2122 </a>
2121 </td><td>
2123 </td><td>
2122 Template Usage
2124 Template Usage
2123 </td></tr>
2125 </td></tr>
2124 <tr><td>
2126 <tr><td>
2125 <a href="/help/urls">
2127 <a href="/help/urls">
2126 urls
2128 urls
2127 </a>
2129 </a>
2128 </td><td>
2130 </td><td>
2129 URL Paths
2131 URL Paths
2130 </td></tr>
2132 </td></tr>
2131 <tr><td>
2133 <tr><td>
2132 <a href="/help/topic-containing-verbose">
2134 <a href="/help/topic-containing-verbose">
2133 topic-containing-verbose
2135 topic-containing-verbose
2134 </a>
2136 </a>
2135 </td><td>
2137 </td><td>
2136 This is the topic to test omit indicating.
2138 This is the topic to test omit indicating.
2137 </td></tr>
2139 </td></tr>
2138
2140
2139
2141
2140 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
2142 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
2141
2143
2142 <tr><td>
2144 <tr><td>
2143 <a href="/help/add">
2145 <a href="/help/add">
2144 add
2146 add
2145 </a>
2147 </a>
2146 </td><td>
2148 </td><td>
2147 add the specified files on the next commit
2149 add the specified files on the next commit
2148 </td></tr>
2150 </td></tr>
2149 <tr><td>
2151 <tr><td>
2150 <a href="/help/annotate">
2152 <a href="/help/annotate">
2151 annotate
2153 annotate
2152 </a>
2154 </a>
2153 </td><td>
2155 </td><td>
2154 show changeset information by line for each file
2156 show changeset information by line for each file
2155 </td></tr>
2157 </td></tr>
2156 <tr><td>
2158 <tr><td>
2157 <a href="/help/clone">
2159 <a href="/help/clone">
2158 clone
2160 clone
2159 </a>
2161 </a>
2160 </td><td>
2162 </td><td>
2161 make a copy of an existing repository
2163 make a copy of an existing repository
2162 </td></tr>
2164 </td></tr>
2163 <tr><td>
2165 <tr><td>
2164 <a href="/help/commit">
2166 <a href="/help/commit">
2165 commit
2167 commit
2166 </a>
2168 </a>
2167 </td><td>
2169 </td><td>
2168 commit the specified files or all outstanding changes
2170 commit the specified files or all outstanding changes
2169 </td></tr>
2171 </td></tr>
2170 <tr><td>
2172 <tr><td>
2171 <a href="/help/diff">
2173 <a href="/help/diff">
2172 diff
2174 diff
2173 </a>
2175 </a>
2174 </td><td>
2176 </td><td>
2175 diff repository (or selected files)
2177 diff repository (or selected files)
2176 </td></tr>
2178 </td></tr>
2177 <tr><td>
2179 <tr><td>
2178 <a href="/help/export">
2180 <a href="/help/export">
2179 export
2181 export
2180 </a>
2182 </a>
2181 </td><td>
2183 </td><td>
2182 dump the header and diffs for one or more changesets
2184 dump the header and diffs for one or more changesets
2183 </td></tr>
2185 </td></tr>
2184 <tr><td>
2186 <tr><td>
2185 <a href="/help/forget">
2187 <a href="/help/forget">
2186 forget
2188 forget
2187 </a>
2189 </a>
2188 </td><td>
2190 </td><td>
2189 forget the specified files on the next commit
2191 forget the specified files on the next commit
2190 </td></tr>
2192 </td></tr>
2191 <tr><td>
2193 <tr><td>
2192 <a href="/help/init">
2194 <a href="/help/init">
2193 init
2195 init
2194 </a>
2196 </a>
2195 </td><td>
2197 </td><td>
2196 create a new repository in the given directory
2198 create a new repository in the given directory
2197 </td></tr>
2199 </td></tr>
2198 <tr><td>
2200 <tr><td>
2199 <a href="/help/log">
2201 <a href="/help/log">
2200 log
2202 log
2201 </a>
2203 </a>
2202 </td><td>
2204 </td><td>
2203 show revision history of entire repository or files
2205 show revision history of entire repository or files
2204 </td></tr>
2206 </td></tr>
2205 <tr><td>
2207 <tr><td>
2206 <a href="/help/merge">
2208 <a href="/help/merge">
2207 merge
2209 merge
2208 </a>
2210 </a>
2209 </td><td>
2211 </td><td>
2210 merge another revision into working directory
2212 merge another revision into working directory
2211 </td></tr>
2213 </td></tr>
2212 <tr><td>
2214 <tr><td>
2213 <a href="/help/pull">
2215 <a href="/help/pull">
2214 pull
2216 pull
2215 </a>
2217 </a>
2216 </td><td>
2218 </td><td>
2217 pull changes from the specified source
2219 pull changes from the specified source
2218 </td></tr>
2220 </td></tr>
2219 <tr><td>
2221 <tr><td>
2220 <a href="/help/push">
2222 <a href="/help/push">
2221 push
2223 push
2222 </a>
2224 </a>
2223 </td><td>
2225 </td><td>
2224 push changes to the specified destination
2226 push changes to the specified destination
2225 </td></tr>
2227 </td></tr>
2226 <tr><td>
2228 <tr><td>
2227 <a href="/help/remove">
2229 <a href="/help/remove">
2228 remove
2230 remove
2229 </a>
2231 </a>
2230 </td><td>
2232 </td><td>
2231 remove the specified files on the next commit
2233 remove the specified files on the next commit
2232 </td></tr>
2234 </td></tr>
2233 <tr><td>
2235 <tr><td>
2234 <a href="/help/serve">
2236 <a href="/help/serve">
2235 serve
2237 serve
2236 </a>
2238 </a>
2237 </td><td>
2239 </td><td>
2238 start stand-alone webserver
2240 start stand-alone webserver
2239 </td></tr>
2241 </td></tr>
2240 <tr><td>
2242 <tr><td>
2241 <a href="/help/status">
2243 <a href="/help/status">
2242 status
2244 status
2243 </a>
2245 </a>
2244 </td><td>
2246 </td><td>
2245 show changed files in the working directory
2247 show changed files in the working directory
2246 </td></tr>
2248 </td></tr>
2247 <tr><td>
2249 <tr><td>
2248 <a href="/help/summary">
2250 <a href="/help/summary">
2249 summary
2251 summary
2250 </a>
2252 </a>
2251 </td><td>
2253 </td><td>
2252 summarize working directory state
2254 summarize working directory state
2253 </td></tr>
2255 </td></tr>
2254 <tr><td>
2256 <tr><td>
2255 <a href="/help/update">
2257 <a href="/help/update">
2256 update
2258 update
2257 </a>
2259 </a>
2258 </td><td>
2260 </td><td>
2259 update working directory (or switch revisions)
2261 update working directory (or switch revisions)
2260 </td></tr>
2262 </td></tr>
2261
2263
2262
2264
2263
2265
2264 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
2266 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
2265
2267
2266 <tr><td>
2268 <tr><td>
2267 <a href="/help/addremove">
2269 <a href="/help/addremove">
2268 addremove
2270 addremove
2269 </a>
2271 </a>
2270 </td><td>
2272 </td><td>
2271 add all new files, delete all missing files
2273 add all new files, delete all missing files
2272 </td></tr>
2274 </td></tr>
2273 <tr><td>
2275 <tr><td>
2274 <a href="/help/archive">
2276 <a href="/help/archive">
2275 archive
2277 archive
2276 </a>
2278 </a>
2277 </td><td>
2279 </td><td>
2278 create an unversioned archive of a repository revision
2280 create an unversioned archive of a repository revision
2279 </td></tr>
2281 </td></tr>
2280 <tr><td>
2282 <tr><td>
2281 <a href="/help/backout">
2283 <a href="/help/backout">
2282 backout
2284 backout
2283 </a>
2285 </a>
2284 </td><td>
2286 </td><td>
2285 reverse effect of earlier changeset
2287 reverse effect of earlier changeset
2286 </td></tr>
2288 </td></tr>
2287 <tr><td>
2289 <tr><td>
2288 <a href="/help/bisect">
2290 <a href="/help/bisect">
2289 bisect
2291 bisect
2290 </a>
2292 </a>
2291 </td><td>
2293 </td><td>
2292 subdivision search of changesets
2294 subdivision search of changesets
2293 </td></tr>
2295 </td></tr>
2294 <tr><td>
2296 <tr><td>
2295 <a href="/help/bookmarks">
2297 <a href="/help/bookmarks">
2296 bookmarks
2298 bookmarks
2297 </a>
2299 </a>
2298 </td><td>
2300 </td><td>
2299 create a new bookmark or list existing bookmarks
2301 create a new bookmark or list existing bookmarks
2300 </td></tr>
2302 </td></tr>
2301 <tr><td>
2303 <tr><td>
2302 <a href="/help/branch">
2304 <a href="/help/branch">
2303 branch
2305 branch
2304 </a>
2306 </a>
2305 </td><td>
2307 </td><td>
2306 set or show the current branch name
2308 set or show the current branch name
2307 </td></tr>
2309 </td></tr>
2308 <tr><td>
2310 <tr><td>
2309 <a href="/help/branches">
2311 <a href="/help/branches">
2310 branches
2312 branches
2311 </a>
2313 </a>
2312 </td><td>
2314 </td><td>
2313 list repository named branches
2315 list repository named branches
2314 </td></tr>
2316 </td></tr>
2315 <tr><td>
2317 <tr><td>
2316 <a href="/help/bundle">
2318 <a href="/help/bundle">
2317 bundle
2319 bundle
2318 </a>
2320 </a>
2319 </td><td>
2321 </td><td>
2320 create a bundle file
2322 create a bundle file
2321 </td></tr>
2323 </td></tr>
2322 <tr><td>
2324 <tr><td>
2323 <a href="/help/cat">
2325 <a href="/help/cat">
2324 cat
2326 cat
2325 </a>
2327 </a>
2326 </td><td>
2328 </td><td>
2327 output the current or given revision of files
2329 output the current or given revision of files
2328 </td></tr>
2330 </td></tr>
2329 <tr><td>
2331 <tr><td>
2330 <a href="/help/config">
2332 <a href="/help/config">
2331 config
2333 config
2332 </a>
2334 </a>
2333 </td><td>
2335 </td><td>
2334 show combined config settings from all hgrc files
2336 show combined config settings from all hgrc files
2335 </td></tr>
2337 </td></tr>
2336 <tr><td>
2338 <tr><td>
2337 <a href="/help/copy">
2339 <a href="/help/copy">
2338 copy
2340 copy
2339 </a>
2341 </a>
2340 </td><td>
2342 </td><td>
2341 mark files as copied for the next commit
2343 mark files as copied for the next commit
2342 </td></tr>
2344 </td></tr>
2343 <tr><td>
2345 <tr><td>
2344 <a href="/help/files">
2346 <a href="/help/files">
2345 files
2347 files
2346 </a>
2348 </a>
2347 </td><td>
2349 </td><td>
2348 list tracked files
2350 list tracked files
2349 </td></tr>
2351 </td></tr>
2350 <tr><td>
2352 <tr><td>
2351 <a href="/help/graft">
2353 <a href="/help/graft">
2352 graft
2354 graft
2353 </a>
2355 </a>
2354 </td><td>
2356 </td><td>
2355 copy changes from other branches onto the current branch
2357 copy changes from other branches onto the current branch
2356 </td></tr>
2358 </td></tr>
2357 <tr><td>
2359 <tr><td>
2358 <a href="/help/grep">
2360 <a href="/help/grep">
2359 grep
2361 grep
2360 </a>
2362 </a>
2361 </td><td>
2363 </td><td>
2362 search revision history for a pattern in specified files
2364 search revision history for a pattern in specified files
2363 </td></tr>
2365 </td></tr>
2364 <tr><td>
2366 <tr><td>
2365 <a href="/help/heads">
2367 <a href="/help/heads">
2366 heads
2368 heads
2367 </a>
2369 </a>
2368 </td><td>
2370 </td><td>
2369 show branch heads
2371 show branch heads
2370 </td></tr>
2372 </td></tr>
2371 <tr><td>
2373 <tr><td>
2372 <a href="/help/help">
2374 <a href="/help/help">
2373 help
2375 help
2374 </a>
2376 </a>
2375 </td><td>
2377 </td><td>
2376 show help for a given topic or a help overview
2378 show help for a given topic or a help overview
2377 </td></tr>
2379 </td></tr>
2378 <tr><td>
2380 <tr><td>
2379 <a href="/help/hgalias">
2381 <a href="/help/hgalias">
2380 hgalias
2382 hgalias
2381 </a>
2383 </a>
2382 </td><td>
2384 </td><td>
2383 summarize working directory state
2385 summarize working directory state
2384 </td></tr>
2386 </td></tr>
2385 <tr><td>
2387 <tr><td>
2386 <a href="/help/identify">
2388 <a href="/help/identify">
2387 identify
2389 identify
2388 </a>
2390 </a>
2389 </td><td>
2391 </td><td>
2390 identify the working directory or specified revision
2392 identify the working directory or specified revision
2391 </td></tr>
2393 </td></tr>
2392 <tr><td>
2394 <tr><td>
2393 <a href="/help/import">
2395 <a href="/help/import">
2394 import
2396 import
2395 </a>
2397 </a>
2396 </td><td>
2398 </td><td>
2397 import an ordered set of patches
2399 import an ordered set of patches
2398 </td></tr>
2400 </td></tr>
2399 <tr><td>
2401 <tr><td>
2400 <a href="/help/incoming">
2402 <a href="/help/incoming">
2401 incoming
2403 incoming
2402 </a>
2404 </a>
2403 </td><td>
2405 </td><td>
2404 show new changesets found in source
2406 show new changesets found in source
2405 </td></tr>
2407 </td></tr>
2406 <tr><td>
2408 <tr><td>
2407 <a href="/help/manifest">
2409 <a href="/help/manifest">
2408 manifest
2410 manifest
2409 </a>
2411 </a>
2410 </td><td>
2412 </td><td>
2411 output the current or given revision of the project manifest
2413 output the current or given revision of the project manifest
2412 </td></tr>
2414 </td></tr>
2413 <tr><td>
2415 <tr><td>
2414 <a href="/help/nohelp">
2416 <a href="/help/nohelp">
2415 nohelp
2417 nohelp
2416 </a>
2418 </a>
2417 </td><td>
2419 </td><td>
2418 (no help text available)
2420 (no help text available)
2419 </td></tr>
2421 </td></tr>
2420 <tr><td>
2422 <tr><td>
2421 <a href="/help/outgoing">
2423 <a href="/help/outgoing">
2422 outgoing
2424 outgoing
2423 </a>
2425 </a>
2424 </td><td>
2426 </td><td>
2425 show changesets not found in the destination
2427 show changesets not found in the destination
2426 </td></tr>
2428 </td></tr>
2427 <tr><td>
2429 <tr><td>
2428 <a href="/help/paths">
2430 <a href="/help/paths">
2429 paths
2431 paths
2430 </a>
2432 </a>
2431 </td><td>
2433 </td><td>
2432 show aliases for remote repositories
2434 show aliases for remote repositories
2433 </td></tr>
2435 </td></tr>
2434 <tr><td>
2436 <tr><td>
2435 <a href="/help/phase">
2437 <a href="/help/phase">
2436 phase
2438 phase
2437 </a>
2439 </a>
2438 </td><td>
2440 </td><td>
2439 set or show the current phase name
2441 set or show the current phase name
2440 </td></tr>
2442 </td></tr>
2441 <tr><td>
2443 <tr><td>
2442 <a href="/help/recover">
2444 <a href="/help/recover">
2443 recover
2445 recover
2444 </a>
2446 </a>
2445 </td><td>
2447 </td><td>
2446 roll back an interrupted transaction
2448 roll back an interrupted transaction
2447 </td></tr>
2449 </td></tr>
2448 <tr><td>
2450 <tr><td>
2449 <a href="/help/rename">
2451 <a href="/help/rename">
2450 rename
2452 rename
2451 </a>
2453 </a>
2452 </td><td>
2454 </td><td>
2453 rename files; equivalent of copy + remove
2455 rename files; equivalent of copy + remove
2454 </td></tr>
2456 </td></tr>
2455 <tr><td>
2457 <tr><td>
2456 <a href="/help/resolve">
2458 <a href="/help/resolve">
2457 resolve
2459 resolve
2458 </a>
2460 </a>
2459 </td><td>
2461 </td><td>
2460 redo merges or set/view the merge status of files
2462 redo merges or set/view the merge status of files
2461 </td></tr>
2463 </td></tr>
2462 <tr><td>
2464 <tr><td>
2463 <a href="/help/revert">
2465 <a href="/help/revert">
2464 revert
2466 revert
2465 </a>
2467 </a>
2466 </td><td>
2468 </td><td>
2467 restore files to their checkout state
2469 restore files to their checkout state
2468 </td></tr>
2470 </td></tr>
2469 <tr><td>
2471 <tr><td>
2470 <a href="/help/root">
2472 <a href="/help/root">
2471 root
2473 root
2472 </a>
2474 </a>
2473 </td><td>
2475 </td><td>
2474 print the root (top) of the current working directory
2476 print the root (top) of the current working directory
2475 </td></tr>
2477 </td></tr>
2476 <tr><td>
2478 <tr><td>
2477 <a href="/help/shellalias">
2479 <a href="/help/shellalias">
2478 shellalias
2480 shellalias
2479 </a>
2481 </a>
2480 </td><td>
2482 </td><td>
2481 (no help text available)
2483 (no help text available)
2482 </td></tr>
2484 </td></tr>
2483 <tr><td>
2485 <tr><td>
2484 <a href="/help/tag">
2486 <a href="/help/tag">
2485 tag
2487 tag
2486 </a>
2488 </a>
2487 </td><td>
2489 </td><td>
2488 add one or more tags for the current or given revision
2490 add one or more tags for the current or given revision
2489 </td></tr>
2491 </td></tr>
2490 <tr><td>
2492 <tr><td>
2491 <a href="/help/tags">
2493 <a href="/help/tags">
2492 tags
2494 tags
2493 </a>
2495 </a>
2494 </td><td>
2496 </td><td>
2495 list repository tags
2497 list repository tags
2496 </td></tr>
2498 </td></tr>
2497 <tr><td>
2499 <tr><td>
2498 <a href="/help/unbundle">
2500 <a href="/help/unbundle">
2499 unbundle
2501 unbundle
2500 </a>
2502 </a>
2501 </td><td>
2503 </td><td>
2502 apply one or more bundle files
2504 apply one or more bundle files
2503 </td></tr>
2505 </td></tr>
2504 <tr><td>
2506 <tr><td>
2505 <a href="/help/verify">
2507 <a href="/help/verify">
2506 verify
2508 verify
2507 </a>
2509 </a>
2508 </td><td>
2510 </td><td>
2509 verify the integrity of the repository
2511 verify the integrity of the repository
2510 </td></tr>
2512 </td></tr>
2511 <tr><td>
2513 <tr><td>
2512 <a href="/help/version">
2514 <a href="/help/version">
2513 version
2515 version
2514 </a>
2516 </a>
2515 </td><td>
2517 </td><td>
2516 output version and copyright information
2518 output version and copyright information
2517 </td></tr>
2519 </td></tr>
2518
2520
2519
2521
2520 </table>
2522 </table>
2521 </div>
2523 </div>
2522 </div>
2524 </div>
2523
2525
2524
2526
2525
2527
2526 </body>
2528 </body>
2527 </html>
2529 </html>
2528
2530
2529
2531
2530 $ get-with-headers.py $LOCALIP:$HGPORT "help/add"
2532 $ get-with-headers.py $LOCALIP:$HGPORT "help/add"
2531 200 Script output follows
2533 200 Script output follows
2532
2534
2533 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2535 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2534 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2536 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2535 <head>
2537 <head>
2536 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2538 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2537 <meta name="robots" content="index, nofollow" />
2539 <meta name="robots" content="index, nofollow" />
2538 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2540 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2539 <script type="text/javascript" src="/static/mercurial.js"></script>
2541 <script type="text/javascript" src="/static/mercurial.js"></script>
2540
2542
2541 <title>Help: add</title>
2543 <title>Help: add</title>
2542 </head>
2544 </head>
2543 <body>
2545 <body>
2544
2546
2545 <div class="container">
2547 <div class="container">
2546 <div class="menu">
2548 <div class="menu">
2547 <div class="logo">
2549 <div class="logo">
2548 <a href="https://mercurial-scm.org/">
2550 <a href="https://mercurial-scm.org/">
2549 <img src="/static/hglogo.png" alt="mercurial" /></a>
2551 <img src="/static/hglogo.png" alt="mercurial" /></a>
2550 </div>
2552 </div>
2551 <ul>
2553 <ul>
2552 <li><a href="/shortlog">log</a></li>
2554 <li><a href="/shortlog">log</a></li>
2553 <li><a href="/graph">graph</a></li>
2555 <li><a href="/graph">graph</a></li>
2554 <li><a href="/tags">tags</a></li>
2556 <li><a href="/tags">tags</a></li>
2555 <li><a href="/bookmarks">bookmarks</a></li>
2557 <li><a href="/bookmarks">bookmarks</a></li>
2556 <li><a href="/branches">branches</a></li>
2558 <li><a href="/branches">branches</a></li>
2557 </ul>
2559 </ul>
2558 <ul>
2560 <ul>
2559 <li class="active"><a href="/help">help</a></li>
2561 <li class="active"><a href="/help">help</a></li>
2560 </ul>
2562 </ul>
2561 </div>
2563 </div>
2562
2564
2563 <div class="main">
2565 <div class="main">
2564 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2566 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2565 <h3>Help: add</h3>
2567 <h3>Help: add</h3>
2566
2568
2567 <form class="search" action="/log">
2569 <form class="search" action="/log">
2568
2570
2569 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2571 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2570 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2572 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2571 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2573 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2572 </form>
2574 </form>
2573 <div id="doc">
2575 <div id="doc">
2574 <p>
2576 <p>
2575 hg add [OPTION]... [FILE]...
2577 hg add [OPTION]... [FILE]...
2576 </p>
2578 </p>
2577 <p>
2579 <p>
2578 add the specified files on the next commit
2580 add the specified files on the next commit
2579 </p>
2581 </p>
2580 <p>
2582 <p>
2581 Schedule files to be version controlled and added to the
2583 Schedule files to be version controlled and added to the
2582 repository.
2584 repository.
2583 </p>
2585 </p>
2584 <p>
2586 <p>
2585 The files will be added to the repository at the next commit. To
2587 The files will be added to the repository at the next commit. To
2586 undo an add before that, see 'hg forget'.
2588 undo an add before that, see 'hg forget'.
2587 </p>
2589 </p>
2588 <p>
2590 <p>
2589 If no names are given, add all files to the repository (except
2591 If no names are given, add all files to the repository (except
2590 files matching &quot;.hgignore&quot;).
2592 files matching &quot;.hgignore&quot;).
2591 </p>
2593 </p>
2592 <p>
2594 <p>
2593 Examples:
2595 Examples:
2594 </p>
2596 </p>
2595 <ul>
2597 <ul>
2596 <li> New (unknown) files are added automatically by 'hg add':
2598 <li> New (unknown) files are added automatically by 'hg add':
2597 <pre>
2599 <pre>
2598 \$ ls (re)
2600 \$ ls (re)
2599 foo.c
2601 foo.c
2600 \$ hg status (re)
2602 \$ hg status (re)
2601 ? foo.c
2603 ? foo.c
2602 \$ hg add (re)
2604 \$ hg add (re)
2603 adding foo.c
2605 adding foo.c
2604 \$ hg status (re)
2606 \$ hg status (re)
2605 A foo.c
2607 A foo.c
2606 </pre>
2608 </pre>
2607 <li> Specific files to be added can be specified:
2609 <li> Specific files to be added can be specified:
2608 <pre>
2610 <pre>
2609 \$ ls (re)
2611 \$ ls (re)
2610 bar.c foo.c
2612 bar.c foo.c
2611 \$ hg status (re)
2613 \$ hg status (re)
2612 ? bar.c
2614 ? bar.c
2613 ? foo.c
2615 ? foo.c
2614 \$ hg add bar.c (re)
2616 \$ hg add bar.c (re)
2615 \$ hg status (re)
2617 \$ hg status (re)
2616 A bar.c
2618 A bar.c
2617 ? foo.c
2619 ? foo.c
2618 </pre>
2620 </pre>
2619 </ul>
2621 </ul>
2620 <p>
2622 <p>
2621 Returns 0 if all files are successfully added.
2623 Returns 0 if all files are successfully added.
2622 </p>
2624 </p>
2623 <p>
2625 <p>
2624 options ([+] can be repeated):
2626 options ([+] can be repeated):
2625 </p>
2627 </p>
2626 <table>
2628 <table>
2627 <tr><td>-I</td>
2629 <tr><td>-I</td>
2628 <td>--include PATTERN [+]</td>
2630 <td>--include PATTERN [+]</td>
2629 <td>include names matching the given patterns</td></tr>
2631 <td>include names matching the given patterns</td></tr>
2630 <tr><td>-X</td>
2632 <tr><td>-X</td>
2631 <td>--exclude PATTERN [+]</td>
2633 <td>--exclude PATTERN [+]</td>
2632 <td>exclude names matching the given patterns</td></tr>
2634 <td>exclude names matching the given patterns</td></tr>
2633 <tr><td>-S</td>
2635 <tr><td>-S</td>
2634 <td>--subrepos</td>
2636 <td>--subrepos</td>
2635 <td>recurse into subrepositories</td></tr>
2637 <td>recurse into subrepositories</td></tr>
2636 <tr><td>-n</td>
2638 <tr><td>-n</td>
2637 <td>--dry-run</td>
2639 <td>--dry-run</td>
2638 <td>do not perform actions, just print output</td></tr>
2640 <td>do not perform actions, just print output</td></tr>
2639 </table>
2641 </table>
2640 <p>
2642 <p>
2641 global options ([+] can be repeated):
2643 global options ([+] can be repeated):
2642 </p>
2644 </p>
2643 <table>
2645 <table>
2644 <tr><td>-R</td>
2646 <tr><td>-R</td>
2645 <td>--repository REPO</td>
2647 <td>--repository REPO</td>
2646 <td>repository root directory or name of overlay bundle file</td></tr>
2648 <td>repository root directory or name of overlay bundle file</td></tr>
2647 <tr><td></td>
2649 <tr><td></td>
2648 <td>--cwd DIR</td>
2650 <td>--cwd DIR</td>
2649 <td>change working directory</td></tr>
2651 <td>change working directory</td></tr>
2650 <tr><td>-y</td>
2652 <tr><td>-y</td>
2651 <td>--noninteractive</td>
2653 <td>--noninteractive</td>
2652 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2654 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2653 <tr><td>-q</td>
2655 <tr><td>-q</td>
2654 <td>--quiet</td>
2656 <td>--quiet</td>
2655 <td>suppress output</td></tr>
2657 <td>suppress output</td></tr>
2656 <tr><td>-v</td>
2658 <tr><td>-v</td>
2657 <td>--verbose</td>
2659 <td>--verbose</td>
2658 <td>enable additional output</td></tr>
2660 <td>enable additional output</td></tr>
2659 <tr><td></td>
2661 <tr><td></td>
2660 <td>--color TYPE</td>
2662 <td>--color TYPE</td>
2661 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2663 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2662 <tr><td></td>
2664 <tr><td></td>
2663 <td>--config CONFIG [+]</td>
2665 <td>--config CONFIG [+]</td>
2664 <td>set/override config option (use 'section.name=value')</td></tr>
2666 <td>set/override config option (use 'section.name=value')</td></tr>
2665 <tr><td></td>
2667 <tr><td></td>
2666 <td>--debug</td>
2668 <td>--debug</td>
2667 <td>enable debugging output</td></tr>
2669 <td>enable debugging output</td></tr>
2668 <tr><td></td>
2670 <tr><td></td>
2669 <td>--debugger</td>
2671 <td>--debugger</td>
2670 <td>start debugger</td></tr>
2672 <td>start debugger</td></tr>
2671 <tr><td></td>
2673 <tr><td></td>
2672 <td>--encoding ENCODE</td>
2674 <td>--encoding ENCODE</td>
2673 <td>set the charset encoding (default: ascii)</td></tr>
2675 <td>set the charset encoding (default: ascii)</td></tr>
2674 <tr><td></td>
2676 <tr><td></td>
2675 <td>--encodingmode MODE</td>
2677 <td>--encodingmode MODE</td>
2676 <td>set the charset encoding mode (default: strict)</td></tr>
2678 <td>set the charset encoding mode (default: strict)</td></tr>
2677 <tr><td></td>
2679 <tr><td></td>
2678 <td>--traceback</td>
2680 <td>--traceback</td>
2679 <td>always print a traceback on exception</td></tr>
2681 <td>always print a traceback on exception</td></tr>
2680 <tr><td></td>
2682 <tr><td></td>
2681 <td>--time</td>
2683 <td>--time</td>
2682 <td>time how long the command takes</td></tr>
2684 <td>time how long the command takes</td></tr>
2683 <tr><td></td>
2685 <tr><td></td>
2684 <td>--profile</td>
2686 <td>--profile</td>
2685 <td>print command execution profile</td></tr>
2687 <td>print command execution profile</td></tr>
2686 <tr><td></td>
2688 <tr><td></td>
2687 <td>--version</td>
2689 <td>--version</td>
2688 <td>output version information and exit</td></tr>
2690 <td>output version information and exit</td></tr>
2689 <tr><td>-h</td>
2691 <tr><td>-h</td>
2690 <td>--help</td>
2692 <td>--help</td>
2691 <td>display help and exit</td></tr>
2693 <td>display help and exit</td></tr>
2692 <tr><td></td>
2694 <tr><td></td>
2693 <td>--hidden</td>
2695 <td>--hidden</td>
2694 <td>consider hidden changesets</td></tr>
2696 <td>consider hidden changesets</td></tr>
2695 <tr><td></td>
2697 <tr><td></td>
2696 <td>--pager TYPE</td>
2698 <td>--pager TYPE</td>
2697 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2699 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2698 </table>
2700 </table>
2699
2701
2700 </div>
2702 </div>
2701 </div>
2703 </div>
2702 </div>
2704 </div>
2703
2705
2704
2706
2705
2707
2706 </body>
2708 </body>
2707 </html>
2709 </html>
2708
2710
2709
2711
2710 $ get-with-headers.py $LOCALIP:$HGPORT "help/remove"
2712 $ get-with-headers.py $LOCALIP:$HGPORT "help/remove"
2711 200 Script output follows
2713 200 Script output follows
2712
2714
2713 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2715 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2714 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2716 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2715 <head>
2717 <head>
2716 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2718 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2717 <meta name="robots" content="index, nofollow" />
2719 <meta name="robots" content="index, nofollow" />
2718 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2720 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2719 <script type="text/javascript" src="/static/mercurial.js"></script>
2721 <script type="text/javascript" src="/static/mercurial.js"></script>
2720
2722
2721 <title>Help: remove</title>
2723 <title>Help: remove</title>
2722 </head>
2724 </head>
2723 <body>
2725 <body>
2724
2726
2725 <div class="container">
2727 <div class="container">
2726 <div class="menu">
2728 <div class="menu">
2727 <div class="logo">
2729 <div class="logo">
2728 <a href="https://mercurial-scm.org/">
2730 <a href="https://mercurial-scm.org/">
2729 <img src="/static/hglogo.png" alt="mercurial" /></a>
2731 <img src="/static/hglogo.png" alt="mercurial" /></a>
2730 </div>
2732 </div>
2731 <ul>
2733 <ul>
2732 <li><a href="/shortlog">log</a></li>
2734 <li><a href="/shortlog">log</a></li>
2733 <li><a href="/graph">graph</a></li>
2735 <li><a href="/graph">graph</a></li>
2734 <li><a href="/tags">tags</a></li>
2736 <li><a href="/tags">tags</a></li>
2735 <li><a href="/bookmarks">bookmarks</a></li>
2737 <li><a href="/bookmarks">bookmarks</a></li>
2736 <li><a href="/branches">branches</a></li>
2738 <li><a href="/branches">branches</a></li>
2737 </ul>
2739 </ul>
2738 <ul>
2740 <ul>
2739 <li class="active"><a href="/help">help</a></li>
2741 <li class="active"><a href="/help">help</a></li>
2740 </ul>
2742 </ul>
2741 </div>
2743 </div>
2742
2744
2743 <div class="main">
2745 <div class="main">
2744 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2746 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2745 <h3>Help: remove</h3>
2747 <h3>Help: remove</h3>
2746
2748
2747 <form class="search" action="/log">
2749 <form class="search" action="/log">
2748
2750
2749 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2751 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2750 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2752 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2751 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2753 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2752 </form>
2754 </form>
2753 <div id="doc">
2755 <div id="doc">
2754 <p>
2756 <p>
2755 hg remove [OPTION]... FILE...
2757 hg remove [OPTION]... FILE...
2756 </p>
2758 </p>
2757 <p>
2759 <p>
2758 aliases: rm
2760 aliases: rm
2759 </p>
2761 </p>
2760 <p>
2762 <p>
2761 remove the specified files on the next commit
2763 remove the specified files on the next commit
2762 </p>
2764 </p>
2763 <p>
2765 <p>
2764 Schedule the indicated files for removal from the current branch.
2766 Schedule the indicated files for removal from the current branch.
2765 </p>
2767 </p>
2766 <p>
2768 <p>
2767 This command schedules the files to be removed at the next commit.
2769 This command schedules the files to be removed at the next commit.
2768 To undo a remove before that, see 'hg revert'. To undo added
2770 To undo a remove before that, see 'hg revert'. To undo added
2769 files, see 'hg forget'.
2771 files, see 'hg forget'.
2770 </p>
2772 </p>
2771 <p>
2773 <p>
2772 -A/--after can be used to remove only files that have already
2774 -A/--after can be used to remove only files that have already
2773 been deleted, -f/--force can be used to force deletion, and -Af
2775 been deleted, -f/--force can be used to force deletion, and -Af
2774 can be used to remove files from the next revision without
2776 can be used to remove files from the next revision without
2775 deleting them from the working directory.
2777 deleting them from the working directory.
2776 </p>
2778 </p>
2777 <p>
2779 <p>
2778 The following table details the behavior of remove for different
2780 The following table details the behavior of remove for different
2779 file states (columns) and option combinations (rows). The file
2781 file states (columns) and option combinations (rows). The file
2780 states are Added [A], Clean [C], Modified [M] and Missing [!]
2782 states are Added [A], Clean [C], Modified [M] and Missing [!]
2781 (as reported by 'hg status'). The actions are Warn, Remove
2783 (as reported by 'hg status'). The actions are Warn, Remove
2782 (from branch) and Delete (from disk):
2784 (from branch) and Delete (from disk):
2783 </p>
2785 </p>
2784 <table>
2786 <table>
2785 <tr><td>opt/state</td>
2787 <tr><td>opt/state</td>
2786 <td>A</td>
2788 <td>A</td>
2787 <td>C</td>
2789 <td>C</td>
2788 <td>M</td>
2790 <td>M</td>
2789 <td>!</td></tr>
2791 <td>!</td></tr>
2790 <tr><td>none</td>
2792 <tr><td>none</td>
2791 <td>W</td>
2793 <td>W</td>
2792 <td>RD</td>
2794 <td>RD</td>
2793 <td>W</td>
2795 <td>W</td>
2794 <td>R</td></tr>
2796 <td>R</td></tr>
2795 <tr><td>-f</td>
2797 <tr><td>-f</td>
2796 <td>R</td>
2798 <td>R</td>
2797 <td>RD</td>
2799 <td>RD</td>
2798 <td>RD</td>
2800 <td>RD</td>
2799 <td>R</td></tr>
2801 <td>R</td></tr>
2800 <tr><td>-A</td>
2802 <tr><td>-A</td>
2801 <td>W</td>
2803 <td>W</td>
2802 <td>W</td>
2804 <td>W</td>
2803 <td>W</td>
2805 <td>W</td>
2804 <td>R</td></tr>
2806 <td>R</td></tr>
2805 <tr><td>-Af</td>
2807 <tr><td>-Af</td>
2806 <td>R</td>
2808 <td>R</td>
2807 <td>R</td>
2809 <td>R</td>
2808 <td>R</td>
2810 <td>R</td>
2809 <td>R</td></tr>
2811 <td>R</td></tr>
2810 </table>
2812 </table>
2811 <p>
2813 <p>
2812 <b>Note:</b>
2814 <b>Note:</b>
2813 </p>
2815 </p>
2814 <p>
2816 <p>
2815 'hg remove' never deletes files in Added [A] state from the
2817 'hg remove' never deletes files in Added [A] state from the
2816 working directory, not even if &quot;--force&quot; is specified.
2818 working directory, not even if &quot;--force&quot; is specified.
2817 </p>
2819 </p>
2818 <p>
2820 <p>
2819 Returns 0 on success, 1 if any warnings encountered.
2821 Returns 0 on success, 1 if any warnings encountered.
2820 </p>
2822 </p>
2821 <p>
2823 <p>
2822 options ([+] can be repeated):
2824 options ([+] can be repeated):
2823 </p>
2825 </p>
2824 <table>
2826 <table>
2825 <tr><td>-A</td>
2827 <tr><td>-A</td>
2826 <td>--after</td>
2828 <td>--after</td>
2827 <td>record delete for missing files</td></tr>
2829 <td>record delete for missing files</td></tr>
2828 <tr><td>-f</td>
2830 <tr><td>-f</td>
2829 <td>--force</td>
2831 <td>--force</td>
2830 <td>forget added files, delete modified files</td></tr>
2832 <td>forget added files, delete modified files</td></tr>
2831 <tr><td>-S</td>
2833 <tr><td>-S</td>
2832 <td>--subrepos</td>
2834 <td>--subrepos</td>
2833 <td>recurse into subrepositories</td></tr>
2835 <td>recurse into subrepositories</td></tr>
2834 <tr><td>-I</td>
2836 <tr><td>-I</td>
2835 <td>--include PATTERN [+]</td>
2837 <td>--include PATTERN [+]</td>
2836 <td>include names matching the given patterns</td></tr>
2838 <td>include names matching the given patterns</td></tr>
2837 <tr><td>-X</td>
2839 <tr><td>-X</td>
2838 <td>--exclude PATTERN [+]</td>
2840 <td>--exclude PATTERN [+]</td>
2839 <td>exclude names matching the given patterns</td></tr>
2841 <td>exclude names matching the given patterns</td></tr>
2840 </table>
2842 </table>
2841 <p>
2843 <p>
2842 global options ([+] can be repeated):
2844 global options ([+] can be repeated):
2843 </p>
2845 </p>
2844 <table>
2846 <table>
2845 <tr><td>-R</td>
2847 <tr><td>-R</td>
2846 <td>--repository REPO</td>
2848 <td>--repository REPO</td>
2847 <td>repository root directory or name of overlay bundle file</td></tr>
2849 <td>repository root directory or name of overlay bundle file</td></tr>
2848 <tr><td></td>
2850 <tr><td></td>
2849 <td>--cwd DIR</td>
2851 <td>--cwd DIR</td>
2850 <td>change working directory</td></tr>
2852 <td>change working directory</td></tr>
2851 <tr><td>-y</td>
2853 <tr><td>-y</td>
2852 <td>--noninteractive</td>
2854 <td>--noninteractive</td>
2853 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2855 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2854 <tr><td>-q</td>
2856 <tr><td>-q</td>
2855 <td>--quiet</td>
2857 <td>--quiet</td>
2856 <td>suppress output</td></tr>
2858 <td>suppress output</td></tr>
2857 <tr><td>-v</td>
2859 <tr><td>-v</td>
2858 <td>--verbose</td>
2860 <td>--verbose</td>
2859 <td>enable additional output</td></tr>
2861 <td>enable additional output</td></tr>
2860 <tr><td></td>
2862 <tr><td></td>
2861 <td>--color TYPE</td>
2863 <td>--color TYPE</td>
2862 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2864 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2863 <tr><td></td>
2865 <tr><td></td>
2864 <td>--config CONFIG [+]</td>
2866 <td>--config CONFIG [+]</td>
2865 <td>set/override config option (use 'section.name=value')</td></tr>
2867 <td>set/override config option (use 'section.name=value')</td></tr>
2866 <tr><td></td>
2868 <tr><td></td>
2867 <td>--debug</td>
2869 <td>--debug</td>
2868 <td>enable debugging output</td></tr>
2870 <td>enable debugging output</td></tr>
2869 <tr><td></td>
2871 <tr><td></td>
2870 <td>--debugger</td>
2872 <td>--debugger</td>
2871 <td>start debugger</td></tr>
2873 <td>start debugger</td></tr>
2872 <tr><td></td>
2874 <tr><td></td>
2873 <td>--encoding ENCODE</td>
2875 <td>--encoding ENCODE</td>
2874 <td>set the charset encoding (default: ascii)</td></tr>
2876 <td>set the charset encoding (default: ascii)</td></tr>
2875 <tr><td></td>
2877 <tr><td></td>
2876 <td>--encodingmode MODE</td>
2878 <td>--encodingmode MODE</td>
2877 <td>set the charset encoding mode (default: strict)</td></tr>
2879 <td>set the charset encoding mode (default: strict)</td></tr>
2878 <tr><td></td>
2880 <tr><td></td>
2879 <td>--traceback</td>
2881 <td>--traceback</td>
2880 <td>always print a traceback on exception</td></tr>
2882 <td>always print a traceback on exception</td></tr>
2881 <tr><td></td>
2883 <tr><td></td>
2882 <td>--time</td>
2884 <td>--time</td>
2883 <td>time how long the command takes</td></tr>
2885 <td>time how long the command takes</td></tr>
2884 <tr><td></td>
2886 <tr><td></td>
2885 <td>--profile</td>
2887 <td>--profile</td>
2886 <td>print command execution profile</td></tr>
2888 <td>print command execution profile</td></tr>
2887 <tr><td></td>
2889 <tr><td></td>
2888 <td>--version</td>
2890 <td>--version</td>
2889 <td>output version information and exit</td></tr>
2891 <td>output version information and exit</td></tr>
2890 <tr><td>-h</td>
2892 <tr><td>-h</td>
2891 <td>--help</td>
2893 <td>--help</td>
2892 <td>display help and exit</td></tr>
2894 <td>display help and exit</td></tr>
2893 <tr><td></td>
2895 <tr><td></td>
2894 <td>--hidden</td>
2896 <td>--hidden</td>
2895 <td>consider hidden changesets</td></tr>
2897 <td>consider hidden changesets</td></tr>
2896 <tr><td></td>
2898 <tr><td></td>
2897 <td>--pager TYPE</td>
2899 <td>--pager TYPE</td>
2898 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2900 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2899 </table>
2901 </table>
2900
2902
2901 </div>
2903 </div>
2902 </div>
2904 </div>
2903 </div>
2905 </div>
2904
2906
2905
2907
2906
2908
2907 </body>
2909 </body>
2908 </html>
2910 </html>
2909
2911
2910
2912
2911 $ get-with-headers.py $LOCALIP:$HGPORT "help/dates"
2913 $ get-with-headers.py $LOCALIP:$HGPORT "help/dates"
2912 200 Script output follows
2914 200 Script output follows
2913
2915
2914 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2916 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2915 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2917 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2916 <head>
2918 <head>
2917 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2919 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2918 <meta name="robots" content="index, nofollow" />
2920 <meta name="robots" content="index, nofollow" />
2919 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2921 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2920 <script type="text/javascript" src="/static/mercurial.js"></script>
2922 <script type="text/javascript" src="/static/mercurial.js"></script>
2921
2923
2922 <title>Help: dates</title>
2924 <title>Help: dates</title>
2923 </head>
2925 </head>
2924 <body>
2926 <body>
2925
2927
2926 <div class="container">
2928 <div class="container">
2927 <div class="menu">
2929 <div class="menu">
2928 <div class="logo">
2930 <div class="logo">
2929 <a href="https://mercurial-scm.org/">
2931 <a href="https://mercurial-scm.org/">
2930 <img src="/static/hglogo.png" alt="mercurial" /></a>
2932 <img src="/static/hglogo.png" alt="mercurial" /></a>
2931 </div>
2933 </div>
2932 <ul>
2934 <ul>
2933 <li><a href="/shortlog">log</a></li>
2935 <li><a href="/shortlog">log</a></li>
2934 <li><a href="/graph">graph</a></li>
2936 <li><a href="/graph">graph</a></li>
2935 <li><a href="/tags">tags</a></li>
2937 <li><a href="/tags">tags</a></li>
2936 <li><a href="/bookmarks">bookmarks</a></li>
2938 <li><a href="/bookmarks">bookmarks</a></li>
2937 <li><a href="/branches">branches</a></li>
2939 <li><a href="/branches">branches</a></li>
2938 </ul>
2940 </ul>
2939 <ul>
2941 <ul>
2940 <li class="active"><a href="/help">help</a></li>
2942 <li class="active"><a href="/help">help</a></li>
2941 </ul>
2943 </ul>
2942 </div>
2944 </div>
2943
2945
2944 <div class="main">
2946 <div class="main">
2945 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2947 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2946 <h3>Help: dates</h3>
2948 <h3>Help: dates</h3>
2947
2949
2948 <form class="search" action="/log">
2950 <form class="search" action="/log">
2949
2951
2950 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2952 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2951 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2953 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2952 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2954 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2953 </form>
2955 </form>
2954 <div id="doc">
2956 <div id="doc">
2955 <h1>Date Formats</h1>
2957 <h1>Date Formats</h1>
2956 <p>
2958 <p>
2957 Some commands allow the user to specify a date, e.g.:
2959 Some commands allow the user to specify a date, e.g.:
2958 </p>
2960 </p>
2959 <ul>
2961 <ul>
2960 <li> backout, commit, import, tag: Specify the commit date.
2962 <li> backout, commit, import, tag: Specify the commit date.
2961 <li> log, revert, update: Select revision(s) by date.
2963 <li> log, revert, update: Select revision(s) by date.
2962 </ul>
2964 </ul>
2963 <p>
2965 <p>
2964 Many date formats are valid. Here are some examples:
2966 Many date formats are valid. Here are some examples:
2965 </p>
2967 </p>
2966 <ul>
2968 <ul>
2967 <li> &quot;Wed Dec 6 13:18:29 2006&quot; (local timezone assumed)
2969 <li> &quot;Wed Dec 6 13:18:29 2006&quot; (local timezone assumed)
2968 <li> &quot;Dec 6 13:18 -0600&quot; (year assumed, time offset provided)
2970 <li> &quot;Dec 6 13:18 -0600&quot; (year assumed, time offset provided)
2969 <li> &quot;Dec 6 13:18 UTC&quot; (UTC and GMT are aliases for +0000)
2971 <li> &quot;Dec 6 13:18 UTC&quot; (UTC and GMT are aliases for +0000)
2970 <li> &quot;Dec 6&quot; (midnight)
2972 <li> &quot;Dec 6&quot; (midnight)
2971 <li> &quot;13:18&quot; (today assumed)
2973 <li> &quot;13:18&quot; (today assumed)
2972 <li> &quot;3:39&quot; (3:39AM assumed)
2974 <li> &quot;3:39&quot; (3:39AM assumed)
2973 <li> &quot;3:39pm&quot; (15:39)
2975 <li> &quot;3:39pm&quot; (15:39)
2974 <li> &quot;2006-12-06 13:18:29&quot; (ISO 8601 format)
2976 <li> &quot;2006-12-06 13:18:29&quot; (ISO 8601 format)
2975 <li> &quot;2006-12-6 13:18&quot;
2977 <li> &quot;2006-12-6 13:18&quot;
2976 <li> &quot;2006-12-6&quot;
2978 <li> &quot;2006-12-6&quot;
2977 <li> &quot;12-6&quot;
2979 <li> &quot;12-6&quot;
2978 <li> &quot;12/6&quot;
2980 <li> &quot;12/6&quot;
2979 <li> &quot;12/6/6&quot; (Dec 6 2006)
2981 <li> &quot;12/6/6&quot; (Dec 6 2006)
2980 <li> &quot;today&quot; (midnight)
2982 <li> &quot;today&quot; (midnight)
2981 <li> &quot;yesterday&quot; (midnight)
2983 <li> &quot;yesterday&quot; (midnight)
2982 <li> &quot;now&quot; - right now
2984 <li> &quot;now&quot; - right now
2983 </ul>
2985 </ul>
2984 <p>
2986 <p>
2985 Lastly, there is Mercurial's internal format:
2987 Lastly, there is Mercurial's internal format:
2986 </p>
2988 </p>
2987 <ul>
2989 <ul>
2988 <li> &quot;1165411109 0&quot; (Wed Dec 6 13:18:29 2006 UTC)
2990 <li> &quot;1165411109 0&quot; (Wed Dec 6 13:18:29 2006 UTC)
2989 </ul>
2991 </ul>
2990 <p>
2992 <p>
2991 This is the internal representation format for dates. The first number
2993 This is the internal representation format for dates. The first number
2992 is the number of seconds since the epoch (1970-01-01 00:00 UTC). The
2994 is the number of seconds since the epoch (1970-01-01 00:00 UTC). The
2993 second is the offset of the local timezone, in seconds west of UTC
2995 second is the offset of the local timezone, in seconds west of UTC
2994 (negative if the timezone is east of UTC).
2996 (negative if the timezone is east of UTC).
2995 </p>
2997 </p>
2996 <p>
2998 <p>
2997 The log command also accepts date ranges:
2999 The log command also accepts date ranges:
2998 </p>
3000 </p>
2999 <ul>
3001 <ul>
3000 <li> &quot;&lt;DATE&quot; - at or before a given date/time
3002 <li> &quot;&lt;DATE&quot; - at or before a given date/time
3001 <li> &quot;&gt;DATE&quot; - on or after a given date/time
3003 <li> &quot;&gt;DATE&quot; - on or after a given date/time
3002 <li> &quot;DATE to DATE&quot; - a date range, inclusive
3004 <li> &quot;DATE to DATE&quot; - a date range, inclusive
3003 <li> &quot;-DAYS&quot; - within a given number of days of today
3005 <li> &quot;-DAYS&quot; - within a given number of days of today
3004 </ul>
3006 </ul>
3005
3007
3006 </div>
3008 </div>
3007 </div>
3009 </div>
3008 </div>
3010 </div>
3009
3011
3010
3012
3011
3013
3012 </body>
3014 </body>
3013 </html>
3015 </html>
3014
3016
3015
3017
3016 Sub-topic indexes rendered properly
3018 Sub-topic indexes rendered properly
3017
3019
3018 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals"
3020 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals"
3019 200 Script output follows
3021 200 Script output follows
3020
3022
3021 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3023 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3022 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3024 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3023 <head>
3025 <head>
3024 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3026 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3025 <meta name="robots" content="index, nofollow" />
3027 <meta name="robots" content="index, nofollow" />
3026 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3028 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3027 <script type="text/javascript" src="/static/mercurial.js"></script>
3029 <script type="text/javascript" src="/static/mercurial.js"></script>
3028
3030
3029 <title>Help: internals</title>
3031 <title>Help: internals</title>
3030 </head>
3032 </head>
3031 <body>
3033 <body>
3032
3034
3033 <div class="container">
3035 <div class="container">
3034 <div class="menu">
3036 <div class="menu">
3035 <div class="logo">
3037 <div class="logo">
3036 <a href="https://mercurial-scm.org/">
3038 <a href="https://mercurial-scm.org/">
3037 <img src="/static/hglogo.png" alt="mercurial" /></a>
3039 <img src="/static/hglogo.png" alt="mercurial" /></a>
3038 </div>
3040 </div>
3039 <ul>
3041 <ul>
3040 <li><a href="/shortlog">log</a></li>
3042 <li><a href="/shortlog">log</a></li>
3041 <li><a href="/graph">graph</a></li>
3043 <li><a href="/graph">graph</a></li>
3042 <li><a href="/tags">tags</a></li>
3044 <li><a href="/tags">tags</a></li>
3043 <li><a href="/bookmarks">bookmarks</a></li>
3045 <li><a href="/bookmarks">bookmarks</a></li>
3044 <li><a href="/branches">branches</a></li>
3046 <li><a href="/branches">branches</a></li>
3045 </ul>
3047 </ul>
3046 <ul>
3048 <ul>
3047 <li><a href="/help">help</a></li>
3049 <li><a href="/help">help</a></li>
3048 </ul>
3050 </ul>
3049 </div>
3051 </div>
3050
3052
3051 <div class="main">
3053 <div class="main">
3052 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3054 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3053
3055
3054 <form class="search" action="/log">
3056 <form class="search" action="/log">
3055
3057
3056 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3058 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3057 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3059 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3058 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3060 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3059 </form>
3061 </form>
3060 <table class="bigtable">
3062 <table class="bigtable">
3061 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
3063 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
3062
3064
3063 <tr><td>
3065 <tr><td>
3064 <a href="/help/internals.bundle2">
3066 <a href="/help/internals.bundle2">
3065 bundle2
3067 bundle2
3066 </a>
3068 </a>
3067 </td><td>
3069 </td><td>
3068 Bundle2
3070 Bundle2
3069 </td></tr>
3071 </td></tr>
3070 <tr><td>
3072 <tr><td>
3071 <a href="/help/internals.bundles">
3073 <a href="/help/internals.bundles">
3072 bundles
3074 bundles
3073 </a>
3075 </a>
3074 </td><td>
3076 </td><td>
3075 Bundles
3077 Bundles
3076 </td></tr>
3078 </td></tr>
3077 <tr><td>
3079 <tr><td>
3078 <a href="/help/internals.censor">
3080 <a href="/help/internals.censor">
3079 censor
3081 censor
3080 </a>
3082 </a>
3081 </td><td>
3083 </td><td>
3082 Censor
3084 Censor
3083 </td></tr>
3085 </td></tr>
3084 <tr><td>
3086 <tr><td>
3085 <a href="/help/internals.changegroups">
3087 <a href="/help/internals.changegroups">
3086 changegroups
3088 changegroups
3087 </a>
3089 </a>
3088 </td><td>
3090 </td><td>
3089 Changegroups
3091 Changegroups
3090 </td></tr>
3092 </td></tr>
3091 <tr><td>
3093 <tr><td>
3092 <a href="/help/internals.config">
3094 <a href="/help/internals.config">
3093 config
3095 config
3094 </a>
3096 </a>
3095 </td><td>
3097 </td><td>
3096 Config Registrar
3098 Config Registrar
3097 </td></tr>
3099 </td></tr>
3098 <tr><td>
3100 <tr><td>
3099 <a href="/help/internals.requirements">
3101 <a href="/help/internals.requirements">
3100 requirements
3102 requirements
3101 </a>
3103 </a>
3102 </td><td>
3104 </td><td>
3103 Repository Requirements
3105 Repository Requirements
3104 </td></tr>
3106 </td></tr>
3105 <tr><td>
3107 <tr><td>
3106 <a href="/help/internals.revlogs">
3108 <a href="/help/internals.revlogs">
3107 revlogs
3109 revlogs
3108 </a>
3110 </a>
3109 </td><td>
3111 </td><td>
3110 Revision Logs
3112 Revision Logs
3111 </td></tr>
3113 </td></tr>
3112 <tr><td>
3114 <tr><td>
3113 <a href="/help/internals.wireprotocol">
3115 <a href="/help/internals.wireprotocol">
3114 wireprotocol
3116 wireprotocol
3115 </a>
3117 </a>
3116 </td><td>
3118 </td><td>
3117 Wire Protocol
3119 Wire Protocol
3118 </td></tr>
3120 </td></tr>
3119
3121
3120
3122
3121
3123
3122
3124
3123
3125
3124 </table>
3126 </table>
3125 </div>
3127 </div>
3126 </div>
3128 </div>
3127
3129
3128
3130
3129
3131
3130 </body>
3132 </body>
3131 </html>
3133 </html>
3132
3134
3133
3135
3134 Sub-topic topics rendered properly
3136 Sub-topic topics rendered properly
3135
3137
3136 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals.changegroups"
3138 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals.changegroups"
3137 200 Script output follows
3139 200 Script output follows
3138
3140
3139 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3141 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3140 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3142 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3141 <head>
3143 <head>
3142 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3144 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3143 <meta name="robots" content="index, nofollow" />
3145 <meta name="robots" content="index, nofollow" />
3144 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3146 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3145 <script type="text/javascript" src="/static/mercurial.js"></script>
3147 <script type="text/javascript" src="/static/mercurial.js"></script>
3146
3148
3147 <title>Help: internals.changegroups</title>
3149 <title>Help: internals.changegroups</title>
3148 </head>
3150 </head>
3149 <body>
3151 <body>
3150
3152
3151 <div class="container">
3153 <div class="container">
3152 <div class="menu">
3154 <div class="menu">
3153 <div class="logo">
3155 <div class="logo">
3154 <a href="https://mercurial-scm.org/">
3156 <a href="https://mercurial-scm.org/">
3155 <img src="/static/hglogo.png" alt="mercurial" /></a>
3157 <img src="/static/hglogo.png" alt="mercurial" /></a>
3156 </div>
3158 </div>
3157 <ul>
3159 <ul>
3158 <li><a href="/shortlog">log</a></li>
3160 <li><a href="/shortlog">log</a></li>
3159 <li><a href="/graph">graph</a></li>
3161 <li><a href="/graph">graph</a></li>
3160 <li><a href="/tags">tags</a></li>
3162 <li><a href="/tags">tags</a></li>
3161 <li><a href="/bookmarks">bookmarks</a></li>
3163 <li><a href="/bookmarks">bookmarks</a></li>
3162 <li><a href="/branches">branches</a></li>
3164 <li><a href="/branches">branches</a></li>
3163 </ul>
3165 </ul>
3164 <ul>
3166 <ul>
3165 <li class="active"><a href="/help">help</a></li>
3167 <li class="active"><a href="/help">help</a></li>
3166 </ul>
3168 </ul>
3167 </div>
3169 </div>
3168
3170
3169 <div class="main">
3171 <div class="main">
3170 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3172 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3171 <h3>Help: internals.changegroups</h3>
3173 <h3>Help: internals.changegroups</h3>
3172
3174
3173 <form class="search" action="/log">
3175 <form class="search" action="/log">
3174
3176
3175 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3177 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3176 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3178 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3177 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3179 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3178 </form>
3180 </form>
3179 <div id="doc">
3181 <div id="doc">
3180 <h1>Changegroups</h1>
3182 <h1>Changegroups</h1>
3181 <p>
3183 <p>
3182 Changegroups are representations of repository revlog data, specifically
3184 Changegroups are representations of repository revlog data, specifically
3183 the changelog data, root/flat manifest data, treemanifest data, and
3185 the changelog data, root/flat manifest data, treemanifest data, and
3184 filelogs.
3186 filelogs.
3185 </p>
3187 </p>
3186 <p>
3188 <p>
3187 There are 3 versions of changegroups: &quot;1&quot;, &quot;2&quot;, and &quot;3&quot;. From a
3189 There are 3 versions of changegroups: &quot;1&quot;, &quot;2&quot;, and &quot;3&quot;. From a
3188 high-level, versions &quot;1&quot; and &quot;2&quot; are almost exactly the same, with the
3190 high-level, versions &quot;1&quot; and &quot;2&quot; are almost exactly the same, with the
3189 only difference being an additional item in the *delta header*. Version
3191 only difference being an additional item in the *delta header*. Version
3190 &quot;3&quot; adds support for revlog flags in the *delta header* and optionally
3192 &quot;3&quot; adds support for revlog flags in the *delta header* and optionally
3191 exchanging treemanifests (enabled by setting an option on the
3193 exchanging treemanifests (enabled by setting an option on the
3192 &quot;changegroup&quot; part in the bundle2).
3194 &quot;changegroup&quot; part in the bundle2).
3193 </p>
3195 </p>
3194 <p>
3196 <p>
3195 Changegroups when not exchanging treemanifests consist of 3 logical
3197 Changegroups when not exchanging treemanifests consist of 3 logical
3196 segments:
3198 segments:
3197 </p>
3199 </p>
3198 <pre>
3200 <pre>
3199 +---------------------------------+
3201 +---------------------------------+
3200 | | | |
3202 | | | |
3201 | changeset | manifest | filelogs |
3203 | changeset | manifest | filelogs |
3202 | | | |
3204 | | | |
3203 | | | |
3205 | | | |
3204 +---------------------------------+
3206 +---------------------------------+
3205 </pre>
3207 </pre>
3206 <p>
3208 <p>
3207 When exchanging treemanifests, there are 4 logical segments:
3209 When exchanging treemanifests, there are 4 logical segments:
3208 </p>
3210 </p>
3209 <pre>
3211 <pre>
3210 +-------------------------------------------------+
3212 +-------------------------------------------------+
3211 | | | | |
3213 | | | | |
3212 | changeset | root | treemanifests | filelogs |
3214 | changeset | root | treemanifests | filelogs |
3213 | | manifest | | |
3215 | | manifest | | |
3214 | | | | |
3216 | | | | |
3215 +-------------------------------------------------+
3217 +-------------------------------------------------+
3216 </pre>
3218 </pre>
3217 <p>
3219 <p>
3218 The principle building block of each segment is a *chunk*. A *chunk*
3220 The principle building block of each segment is a *chunk*. A *chunk*
3219 is a framed piece of data:
3221 is a framed piece of data:
3220 </p>
3222 </p>
3221 <pre>
3223 <pre>
3222 +---------------------------------------+
3224 +---------------------------------------+
3223 | | |
3225 | | |
3224 | length | data |
3226 | length | data |
3225 | (4 bytes) | (&lt;length - 4&gt; bytes) |
3227 | (4 bytes) | (&lt;length - 4&gt; bytes) |
3226 | | |
3228 | | |
3227 +---------------------------------------+
3229 +---------------------------------------+
3228 </pre>
3230 </pre>
3229 <p>
3231 <p>
3230 All integers are big-endian signed integers. Each chunk starts with a 32-bit
3232 All integers are big-endian signed integers. Each chunk starts with a 32-bit
3231 integer indicating the length of the entire chunk (including the length field
3233 integer indicating the length of the entire chunk (including the length field
3232 itself).
3234 itself).
3233 </p>
3235 </p>
3234 <p>
3236 <p>
3235 There is a special case chunk that has a value of 0 for the length
3237 There is a special case chunk that has a value of 0 for the length
3236 (&quot;0x00000000&quot;). We call this an *empty chunk*.
3238 (&quot;0x00000000&quot;). We call this an *empty chunk*.
3237 </p>
3239 </p>
3238 <h2>Delta Groups</h2>
3240 <h2>Delta Groups</h2>
3239 <p>
3241 <p>
3240 A *delta group* expresses the content of a revlog as a series of deltas,
3242 A *delta group* expresses the content of a revlog as a series of deltas,
3241 or patches against previous revisions.
3243 or patches against previous revisions.
3242 </p>
3244 </p>
3243 <p>
3245 <p>
3244 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
3246 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
3245 to signal the end of the delta group:
3247 to signal the end of the delta group:
3246 </p>
3248 </p>
3247 <pre>
3249 <pre>
3248 +------------------------------------------------------------------------+
3250 +------------------------------------------------------------------------+
3249 | | | | | |
3251 | | | | | |
3250 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
3252 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
3251 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
3253 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
3252 | | | | | |
3254 | | | | | |
3253 +------------------------------------------------------------------------+
3255 +------------------------------------------------------------------------+
3254 </pre>
3256 </pre>
3255 <p>
3257 <p>
3256 Each *chunk*'s data consists of the following:
3258 Each *chunk*'s data consists of the following:
3257 </p>
3259 </p>
3258 <pre>
3260 <pre>
3259 +---------------------------------------+
3261 +---------------------------------------+
3260 | | |
3262 | | |
3261 | delta header | delta data |
3263 | delta header | delta data |
3262 | (various by version) | (various) |
3264 | (various by version) | (various) |
3263 | | |
3265 | | |
3264 +---------------------------------------+
3266 +---------------------------------------+
3265 </pre>
3267 </pre>
3266 <p>
3268 <p>
3267 The *delta data* is a series of *delta*s that describe a diff from an existing
3269 The *delta data* is a series of *delta*s that describe a diff from an existing
3268 entry (either that the recipient already has, or previously specified in the
3270 entry (either that the recipient already has, or previously specified in the
3269 bundle/changegroup).
3271 bundle/changegroup).
3270 </p>
3272 </p>
3271 <p>
3273 <p>
3272 The *delta header* is different between versions &quot;1&quot;, &quot;2&quot;, and
3274 The *delta header* is different between versions &quot;1&quot;, &quot;2&quot;, and
3273 &quot;3&quot; of the changegroup format.
3275 &quot;3&quot; of the changegroup format.
3274 </p>
3276 </p>
3275 <p>
3277 <p>
3276 Version 1 (headerlen=80):
3278 Version 1 (headerlen=80):
3277 </p>
3279 </p>
3278 <pre>
3280 <pre>
3279 +------------------------------------------------------+
3281 +------------------------------------------------------+
3280 | | | | |
3282 | | | | |
3281 | node | p1 node | p2 node | link node |
3283 | node | p1 node | p2 node | link node |
3282 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3284 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3283 | | | | |
3285 | | | | |
3284 +------------------------------------------------------+
3286 +------------------------------------------------------+
3285 </pre>
3287 </pre>
3286 <p>
3288 <p>
3287 Version 2 (headerlen=100):
3289 Version 2 (headerlen=100):
3288 </p>
3290 </p>
3289 <pre>
3291 <pre>
3290 +------------------------------------------------------------------+
3292 +------------------------------------------------------------------+
3291 | | | | | |
3293 | | | | | |
3292 | node | p1 node | p2 node | base node | link node |
3294 | node | p1 node | p2 node | base node | link node |
3293 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3295 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3294 | | | | | |
3296 | | | | | |
3295 +------------------------------------------------------------------+
3297 +------------------------------------------------------------------+
3296 </pre>
3298 </pre>
3297 <p>
3299 <p>
3298 Version 3 (headerlen=102):
3300 Version 3 (headerlen=102):
3299 </p>
3301 </p>
3300 <pre>
3302 <pre>
3301 +------------------------------------------------------------------------------+
3303 +------------------------------------------------------------------------------+
3302 | | | | | | |
3304 | | | | | | |
3303 | node | p1 node | p2 node | base node | link node | flags |
3305 | node | p1 node | p2 node | base node | link node | flags |
3304 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
3306 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
3305 | | | | | | |
3307 | | | | | | |
3306 +------------------------------------------------------------------------------+
3308 +------------------------------------------------------------------------------+
3307 </pre>
3309 </pre>
3308 <p>
3310 <p>
3309 The *delta data* consists of &quot;chunklen - 4 - headerlen&quot; bytes, which contain a
3311 The *delta data* consists of &quot;chunklen - 4 - headerlen&quot; bytes, which contain a
3310 series of *delta*s, densely packed (no separators). These deltas describe a diff
3312 series of *delta*s, densely packed (no separators). These deltas describe a diff
3311 from an existing entry (either that the recipient already has, or previously
3313 from an existing entry (either that the recipient already has, or previously
3312 specified in the bundle/changegroup). The format is described more fully in
3314 specified in the bundle/changegroup). The format is described more fully in
3313 &quot;hg help internals.bdiff&quot;, but briefly:
3315 &quot;hg help internals.bdiff&quot;, but briefly:
3314 </p>
3316 </p>
3315 <pre>
3317 <pre>
3316 +---------------------------------------------------------------+
3318 +---------------------------------------------------------------+
3317 | | | | |
3319 | | | | |
3318 | start offset | end offset | new length | content |
3320 | start offset | end offset | new length | content |
3319 | (4 bytes) | (4 bytes) | (4 bytes) | (&lt;new length&gt; bytes) |
3321 | (4 bytes) | (4 bytes) | (4 bytes) | (&lt;new length&gt; bytes) |
3320 | | | | |
3322 | | | | |
3321 +---------------------------------------------------------------+
3323 +---------------------------------------------------------------+
3322 </pre>
3324 </pre>
3323 <p>
3325 <p>
3324 Please note that the length field in the delta data does *not* include itself.
3326 Please note that the length field in the delta data does *not* include itself.
3325 </p>
3327 </p>
3326 <p>
3328 <p>
3327 In version 1, the delta is always applied against the previous node from
3329 In version 1, the delta is always applied against the previous node from
3328 the changegroup or the first parent if this is the first entry in the
3330 the changegroup or the first parent if this is the first entry in the
3329 changegroup.
3331 changegroup.
3330 </p>
3332 </p>
3331 <p>
3333 <p>
3332 In version 2 and up, the delta base node is encoded in the entry in the
3334 In version 2 and up, the delta base node is encoded in the entry in the
3333 changegroup. This allows the delta to be expressed against any parent,
3335 changegroup. This allows the delta to be expressed against any parent,
3334 which can result in smaller deltas and more efficient encoding of data.
3336 which can result in smaller deltas and more efficient encoding of data.
3335 </p>
3337 </p>
3336 <h2>Changeset Segment</h2>
3338 <h2>Changeset Segment</h2>
3337 <p>
3339 <p>
3338 The *changeset segment* consists of a single *delta group* holding
3340 The *changeset segment* consists of a single *delta group* holding
3339 changelog data. The *empty chunk* at the end of the *delta group* denotes
3341 changelog data. The *empty chunk* at the end of the *delta group* denotes
3340 the boundary to the *manifest segment*.
3342 the boundary to the *manifest segment*.
3341 </p>
3343 </p>
3342 <h2>Manifest Segment</h2>
3344 <h2>Manifest Segment</h2>
3343 <p>
3345 <p>
3344 The *manifest segment* consists of a single *delta group* holding manifest
3346 The *manifest segment* consists of a single *delta group* holding manifest
3345 data. If treemanifests are in use, it contains only the manifest for the
3347 data. If treemanifests are in use, it contains only the manifest for the
3346 root directory of the repository. Otherwise, it contains the entire
3348 root directory of the repository. Otherwise, it contains the entire
3347 manifest data. The *empty chunk* at the end of the *delta group* denotes
3349 manifest data. The *empty chunk* at the end of the *delta group* denotes
3348 the boundary to the next segment (either the *treemanifests segment* or the
3350 the boundary to the next segment (either the *treemanifests segment* or the
3349 *filelogs segment*, depending on version and the request options).
3351 *filelogs segment*, depending on version and the request options).
3350 </p>
3352 </p>
3351 <h3>Treemanifests Segment</h3>
3353 <h3>Treemanifests Segment</h3>
3352 <p>
3354 <p>
3353 The *treemanifests segment* only exists in changegroup version &quot;3&quot;, and
3355 The *treemanifests segment* only exists in changegroup version &quot;3&quot;, and
3354 only if the 'treemanifest' param is part of the bundle2 changegroup part
3356 only if the 'treemanifest' param is part of the bundle2 changegroup part
3355 (it is not possible to use changegroup version 3 outside of bundle2).
3357 (it is not possible to use changegroup version 3 outside of bundle2).
3356 Aside from the filenames in the *treemanifests segment* containing a
3358 Aside from the filenames in the *treemanifests segment* containing a
3357 trailing &quot;/&quot; character, it behaves identically to the *filelogs segment*
3359 trailing &quot;/&quot; character, it behaves identically to the *filelogs segment*
3358 (see below). The final sub-segment is followed by an *empty chunk* (logically,
3360 (see below). The final sub-segment is followed by an *empty chunk* (logically,
3359 a sub-segment with filename size 0). This denotes the boundary to the
3361 a sub-segment with filename size 0). This denotes the boundary to the
3360 *filelogs segment*.
3362 *filelogs segment*.
3361 </p>
3363 </p>
3362 <h2>Filelogs Segment</h2>
3364 <h2>Filelogs Segment</h2>
3363 <p>
3365 <p>
3364 The *filelogs segment* consists of multiple sub-segments, each
3366 The *filelogs segment* consists of multiple sub-segments, each
3365 corresponding to an individual file whose data is being described:
3367 corresponding to an individual file whose data is being described:
3366 </p>
3368 </p>
3367 <pre>
3369 <pre>
3368 +--------------------------------------------------+
3370 +--------------------------------------------------+
3369 | | | | | |
3371 | | | | | |
3370 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
3372 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
3371 | | | | | (4 bytes) |
3373 | | | | | (4 bytes) |
3372 | | | | | |
3374 | | | | | |
3373 +--------------------------------------------------+
3375 +--------------------------------------------------+
3374 </pre>
3376 </pre>
3375 <p>
3377 <p>
3376 The final filelog sub-segment is followed by an *empty chunk* (logically,
3378 The final filelog sub-segment is followed by an *empty chunk* (logically,
3377 a sub-segment with filename size 0). This denotes the end of the segment
3379 a sub-segment with filename size 0). This denotes the end of the segment
3378 and of the overall changegroup.
3380 and of the overall changegroup.
3379 </p>
3381 </p>
3380 <p>
3382 <p>
3381 Each filelog sub-segment consists of the following:
3383 Each filelog sub-segment consists of the following:
3382 </p>
3384 </p>
3383 <pre>
3385 <pre>
3384 +------------------------------------------------------+
3386 +------------------------------------------------------+
3385 | | | |
3387 | | | |
3386 | filename length | filename | delta group |
3388 | filename length | filename | delta group |
3387 | (4 bytes) | (&lt;length - 4&gt; bytes) | (various) |
3389 | (4 bytes) | (&lt;length - 4&gt; bytes) | (various) |
3388 | | | |
3390 | | | |
3389 +------------------------------------------------------+
3391 +------------------------------------------------------+
3390 </pre>
3392 </pre>
3391 <p>
3393 <p>
3392 That is, a *chunk* consisting of the filename (not terminated or padded)
3394 That is, a *chunk* consisting of the filename (not terminated or padded)
3393 followed by N chunks constituting the *delta group* for this file. The
3395 followed by N chunks constituting the *delta group* for this file. The
3394 *empty chunk* at the end of each *delta group* denotes the boundary to the
3396 *empty chunk* at the end of each *delta group* denotes the boundary to the
3395 next filelog sub-segment.
3397 next filelog sub-segment.
3396 </p>
3398 </p>
3397
3399
3398 </div>
3400 </div>
3399 </div>
3401 </div>
3400 </div>
3402 </div>
3401
3403
3402
3404
3403
3405
3404 </body>
3406 </body>
3405 </html>
3407 </html>
3406
3408
3407
3409
3408 $ get-with-headers.py 127.0.0.1:$HGPORT "help/unknowntopic"
3410 $ get-with-headers.py 127.0.0.1:$HGPORT "help/unknowntopic"
3409 404 Not Found
3411 404 Not Found
3410
3412
3411 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3413 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3412 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3414 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3413 <head>
3415 <head>
3414 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3416 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3415 <meta name="robots" content="index, nofollow" />
3417 <meta name="robots" content="index, nofollow" />
3416 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3418 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3417 <script type="text/javascript" src="/static/mercurial.js"></script>
3419 <script type="text/javascript" src="/static/mercurial.js"></script>
3418
3420
3419 <title>test: error</title>
3421 <title>test: error</title>
3420 </head>
3422 </head>
3421 <body>
3423 <body>
3422
3424
3423 <div class="container">
3425 <div class="container">
3424 <div class="menu">
3426 <div class="menu">
3425 <div class="logo">
3427 <div class="logo">
3426 <a href="https://mercurial-scm.org/">
3428 <a href="https://mercurial-scm.org/">
3427 <img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial" /></a>
3429 <img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial" /></a>
3428 </div>
3430 </div>
3429 <ul>
3431 <ul>
3430 <li><a href="/shortlog">log</a></li>
3432 <li><a href="/shortlog">log</a></li>
3431 <li><a href="/graph">graph</a></li>
3433 <li><a href="/graph">graph</a></li>
3432 <li><a href="/tags">tags</a></li>
3434 <li><a href="/tags">tags</a></li>
3433 <li><a href="/bookmarks">bookmarks</a></li>
3435 <li><a href="/bookmarks">bookmarks</a></li>
3434 <li><a href="/branches">branches</a></li>
3436 <li><a href="/branches">branches</a></li>
3435 </ul>
3437 </ul>
3436 <ul>
3438 <ul>
3437 <li><a href="/help">help</a></li>
3439 <li><a href="/help">help</a></li>
3438 </ul>
3440 </ul>
3439 </div>
3441 </div>
3440
3442
3441 <div class="main">
3443 <div class="main">
3442
3444
3443 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3445 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3444 <h3>error</h3>
3446 <h3>error</h3>
3445
3447
3446
3448
3447 <form class="search" action="/log">
3449 <form class="search" action="/log">
3448
3450
3449 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3451 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3450 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3452 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3451 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3453 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3452 </form>
3454 </form>
3453
3455
3454 <div class="description">
3456 <div class="description">
3455 <p>
3457 <p>
3456 An error occurred while processing your request:
3458 An error occurred while processing your request:
3457 </p>
3459 </p>
3458 <p>
3460 <p>
3459 Not Found
3461 Not Found
3460 </p>
3462 </p>
3461 </div>
3463 </div>
3462 </div>
3464 </div>
3463 </div>
3465 </div>
3464
3466
3465
3467
3466
3468
3467 </body>
3469 </body>
3468 </html>
3470 </html>
3469
3471
3470 [1]
3472 [1]
3471
3473
3472 $ killdaemons.py
3474 $ killdaemons.py
3473
3475
3474 #endif
3476 #endif
This diff has been collapsed as it changes many lines, (1222 lines changed) Show them Hide them
@@ -1,672 +1,1254 b''
1 $ cat >> $HGRCPATH << EOF
1 $ cat >> $HGRCPATH << EOF
2 > [ui]
2 > [ui]
3 > ssh = $PYTHON "$TESTDIR/dummyssh"
3 > ssh = $PYTHON "$TESTDIR/dummyssh"
4 > [devel]
4 > [devel]
5 > debug.peer-request = true
5 > debug.peer-request = true
6 > [extensions]
6 > [extensions]
7 > sshprotoext = $TESTDIR/sshprotoext.py
7 > sshprotoext = $TESTDIR/sshprotoext.py
8 > EOF
8 > EOF
9
9
10 $ hg init server
10 $ hg init server
11 $ cd server
11 $ cd server
12 $ echo 0 > foo
12 $ echo 0 > foo
13 $ hg -q add foo
13 $ hg -q add foo
14 $ hg commit -m initial
14 $ hg commit -m initial
15 $ cd ..
15
16 A no-op connection performs a handshake
17
18 $ hg debugwireproto --localssh << EOF
19 > EOF
20 creating ssh peer from handshake results
21
22 Raw peers don't perform any activity
23
24 $ hg debugwireproto --localssh --peer raw << EOF
25 > EOF
26 using raw connection to peer
27 $ hg debugwireproto --localssh --peer ssh1 << EOF
28 > EOF
29 creating ssh peer for wire protocol version 1
30 $ hg debugwireproto --localssh --peer ssh2 << EOF
31 > EOF
32 creating ssh peer for wire protocol version 2
16
33
17 Test a normal behaving server, for sanity
34 Test a normal behaving server, for sanity
18
35
36 $ cd ..
37
19 $ hg --debug debugpeer ssh://user@dummy/server
38 $ hg --debug debugpeer ssh://user@dummy/server
20 running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !)
39 running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !)
21 running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !)
40 running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !)
22 devel-peer-request: hello
41 devel-peer-request: hello
23 sending hello command
42 sending hello command
24 devel-peer-request: between
43 devel-peer-request: between
25 devel-peer-request: pairs: 81 bytes
44 devel-peer-request: pairs: 81 bytes
26 sending between command
45 sending between command
27 remote: 384
46 remote: 384
28 remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
47 remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
29 remote: 1
48 remote: 1
30 url: ssh://user@dummy/server
49 url: ssh://user@dummy/server
31 local: no
50 local: no
32 pushable: yes
51 pushable: yes
33
52
34 Server should answer the "hello" command in isolation
53 Server should answer the "hello" command in isolation
35
54
36 $ hg -R server serve --stdio << EOF
55 $ hg -R server debugwireproto --localssh --peer raw << EOF
37 > hello
56 > raw
57 > hello\n
58 > readline
59 > readline
38 > EOF
60 > EOF
39 384
61 using raw connection to peer
40 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
62 i> write(6) -> None:
63 i> hello\n
64 o> readline() -> 4:
65 o> 384\n
66 o> readline() -> 384:
67 o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
41
68
42 `hg debugserve --sshstdio` works
69 `hg debugserve --sshstdio` works
43
70
44 $ cd server
71 $ cd server
45 $ hg debugserve --sshstdio << EOF
72 $ hg debugserve --sshstdio << EOF
46 > hello
73 > hello
47 > EOF
74 > EOF
48 384
75 384
49 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
76 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
50
77
51 I/O logging works
78 I/O logging works
52
79
53 $ hg debugserve --sshstdio --logiofd 1 << EOF
80 $ hg debugserve --sshstdio --logiofd 1 << EOF
54 > hello
81 > hello
55 > EOF
82 > EOF
56 o> write(4) -> None:
83 o> write(4) -> None:
57 o> 384\n
84 o> 384\n
58 o> write(384) -> None:
85 o> write(384) -> None:
59 o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
86 o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
60 384
87 384
61 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
88 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
62 o> flush() -> None
89 o> flush() -> None
63
90
64 $ hg debugserve --sshstdio --logiofile $TESTTMP/io << EOF
91 $ hg debugserve --sshstdio --logiofile $TESTTMP/io << EOF
65 > hello
92 > hello
66 > EOF
93 > EOF
67 384
94 384
68 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
95 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
69
96
70 $ cat $TESTTMP/io
97 $ cat $TESTTMP/io
71 o> write(4) -> None:
98 o> write(4) -> None:
72 o> 384\n
99 o> 384\n
73 o> write(384) -> None:
100 o> write(384) -> None:
74 o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
101 o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
75 o> flush() -> None
102 o> flush() -> None
76
103
77 $ cd ..
104 $ cd ..
78
105
79 >=0.9.1 clients send a "hello" + "between" for the null range as part of handshake.
106 >=0.9.1 clients send a "hello" + "between" for the null range as part of handshake.
80 Server should reply with capabilities and should send "1\n\n" as a successful
107 Server should reply with capabilities and should send "1\n\n" as a successful
81 reply with empty response to the "between".
108 reply with empty response to the "between".
82
109
83 $ hg -R server serve --stdio << EOF
110 $ hg -R server debugwireproto --localssh --peer raw << EOF
84 > hello
111 > raw
85 > between
112 > hello\n
86 > pairs 81
113 > readline
87 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
114 > readline
115 > raw
116 > between\n
117 > pairs 81\n
118 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
119 > readline
120 > readline
88 > EOF
121 > EOF
89 384
122 using raw connection to peer
90 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
123 i> write(6) -> None:
91 1
124 i> hello\n
92
125 o> readline() -> 4:
126 o> 384\n
127 o> readline() -> 384:
128 o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
129 i> write(98) -> None:
130 i> between\n
131 i> pairs 81\n
132 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
133 o> readline() -> 2:
134 o> 1\n
135 o> readline() -> 1:
136 o> \n
93
137
94 SSH banner is not printed by default, ignored by clients
138 SSH banner is not printed by default, ignored by clients
95
139
96 $ SSHSERVERMODE=banner hg debugpeer ssh://user@dummy/server
140 $ SSHSERVERMODE=banner hg debugpeer ssh://user@dummy/server
97 url: ssh://user@dummy/server
141 url: ssh://user@dummy/server
98 local: no
142 local: no
99 pushable: yes
143 pushable: yes
100
144
101 --debug will print the banner
145 --debug will print the banner
102
146
103 $ SSHSERVERMODE=banner hg --debug debugpeer ssh://user@dummy/server
147 $ SSHSERVERMODE=banner hg --debug debugpeer ssh://user@dummy/server
104 running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !)
148 running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !)
105 running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !)
149 running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !)
106 devel-peer-request: hello
150 devel-peer-request: hello
107 sending hello command
151 sending hello command
108 devel-peer-request: between
152 devel-peer-request: between
109 devel-peer-request: pairs: 81 bytes
153 devel-peer-request: pairs: 81 bytes
110 sending between command
154 sending between command
111 remote: banner: line 0
155 remote: banner: line 0
112 remote: banner: line 1
156 remote: banner: line 1
113 remote: banner: line 2
157 remote: banner: line 2
114 remote: banner: line 3
158 remote: banner: line 3
115 remote: banner: line 4
159 remote: banner: line 4
116 remote: banner: line 5
160 remote: banner: line 5
117 remote: banner: line 6
161 remote: banner: line 6
118 remote: banner: line 7
162 remote: banner: line 7
119 remote: banner: line 8
163 remote: banner: line 8
120 remote: banner: line 9
164 remote: banner: line 9
121 remote: 384
165 remote: 384
122 remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
166 remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
123 remote: 1
167 remote: 1
124 url: ssh://user@dummy/server
168 url: ssh://user@dummy/server
125 local: no
169 local: no
126 pushable: yes
170 pushable: yes
127
171
128 And test the banner with the raw protocol
172 And test the banner with the raw protocol
129
173
130 $ SSHSERVERMODE=banner hg -R server serve --stdio << EOF
174 $ SSHSERVERMODE=banner hg -R server debugwireproto --localssh --peer raw << EOF
131 > hello
175 > raw
132 > between
176 > hello\n
133 > pairs 81
177 > readline
134 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
178 > readline
179 > readline
180 > readline
181 > readline
182 > readline
183 > readline
184 > readline
185 > readline
186 > readline
187 > readline
188 > readline
189 > raw
190 > between\n
191 > pairs 81\n
192 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
193 > readline
194 > readline
135 > EOF
195 > EOF
136 banner: line 0
196 using raw connection to peer
137 banner: line 1
197 i> write(6) -> None:
138 banner: line 2
198 i> hello\n
139 banner: line 3
199 o> readline() -> 15:
140 banner: line 4
200 o> banner: line 0\n
141 banner: line 5
201 o> readline() -> 15:
142 banner: line 6
202 o> banner: line 1\n
143 banner: line 7
203 o> readline() -> 15:
144 banner: line 8
204 o> banner: line 2\n
145 banner: line 9
205 o> readline() -> 15:
146 384
206 o> banner: line 3\n
147 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
207 o> readline() -> 15:
148 1
208 o> banner: line 4\n
149
209 o> readline() -> 15:
210 o> banner: line 5\n
211 o> readline() -> 15:
212 o> banner: line 6\n
213 o> readline() -> 15:
214 o> banner: line 7\n
215 o> readline() -> 15:
216 o> banner: line 8\n
217 o> readline() -> 15:
218 o> banner: line 9\n
219 o> readline() -> 4:
220 o> 384\n
221 o> readline() -> 384:
222 o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
223 i> write(98) -> None:
224 i> between\n
225 i> pairs 81\n
226 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
227 o> readline() -> 2:
228 o> 1\n
229 o> readline() -> 1:
230 o> \n
150
231
151 Connecting to a <0.9.1 server that doesn't support the hello command.
232 Connecting to a <0.9.1 server that doesn't support the hello command.
152 The client should refuse, as we dropped support for connecting to such
233 The client should refuse, as we dropped support for connecting to such
153 servers.
234 servers.
154
235
155 $ SSHSERVERMODE=no-hello hg --debug debugpeer ssh://user@dummy/server
236 $ SSHSERVERMODE=no-hello hg --debug debugpeer ssh://user@dummy/server
156 running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !)
237 running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !)
157 running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !)
238 running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !)
158 devel-peer-request: hello
239 devel-peer-request: hello
159 sending hello command
240 sending hello command
160 devel-peer-request: between
241 devel-peer-request: between
161 devel-peer-request: pairs: 81 bytes
242 devel-peer-request: pairs: 81 bytes
162 sending between command
243 sending between command
163 remote: 0
244 remote: 0
164 remote: 1
245 remote: 1
165 abort: no suitable response from remote hg!
246 abort: no suitable response from remote hg!
166 [255]
247 [255]
167
248
168 Sending an unknown command to the server results in an empty response to that command
249 Sending an unknown command to the server results in an empty response to that command
169
250
170 $ hg -R server serve --stdio << EOF
251 $ hg -R server debugwireproto --localssh --peer raw << EOF
171 > pre-hello
252 > raw
172 > hello
253 > pre-hello\n
173 > between
254 > readline
174 > pairs 81
255 > raw
175 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
256 > hello\n
257 > readline
258 > raw
259 > between\n
260 > pairs 81\n
261 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
262 > readline
263 > readline
176 > EOF
264 > EOF
177 0
265 using raw connection to peer
178 384
266 i> write(10) -> None:
179 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
267 i> pre-hello\n
180 1
268 o> readline() -> 2:
181
269 o> 0\n
270 i> write(6) -> None:
271 i> hello\n
272 o> readline() -> 4:
273 o> 384\n
274 i> write(98) -> None:
275 i> between\n
276 i> pairs 81\n
277 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
278 o> readline() -> 384:
279 o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
280 o> readline() -> 2:
281 o> 1\n
182
282
183 $ hg --config sshpeer.mode=extra-handshake-commands --config sshpeer.handshake-mode=pre-no-args --debug debugpeer ssh://user@dummy/server
283 $ hg --config sshpeer.mode=extra-handshake-commands --config sshpeer.handshake-mode=pre-no-args --debug debugpeer ssh://user@dummy/server
184 running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !)
284 running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !)
185 running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !)
285 running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !)
186 sending no-args command
286 sending no-args command
187 devel-peer-request: hello
287 devel-peer-request: hello
188 sending hello command
288 sending hello command
189 devel-peer-request: between
289 devel-peer-request: between
190 devel-peer-request: pairs: 81 bytes
290 devel-peer-request: pairs: 81 bytes
191 sending between command
291 sending between command
192 remote: 0
292 remote: 0
193 remote: 384
293 remote: 384
194 remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
294 remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
195 remote: 1
295 remote: 1
196 url: ssh://user@dummy/server
296 url: ssh://user@dummy/server
197 local: no
297 local: no
198 pushable: yes
298 pushable: yes
199
299
200 Send multiple unknown commands before hello
300 Send multiple unknown commands before hello
201
301
202 $ hg -R server serve --stdio << EOF
302 $ hg -R server debugwireproto --localssh --peer raw << EOF
203 > unknown1
303 > raw
204 > unknown2
304 > unknown1\n
205 > unknown3
305 > readline
206 > hello
306 > raw
207 > between
307 > unknown2\n
208 > pairs 81
308 > readline
209 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
309 > raw
310 > unknown3\n
311 > readline
312 > raw
313 > hello\n
314 > readline
315 > readline
316 > raw
317 > between\n
318 > pairs 81\n
319 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
320 > readline
321 > readline
210 > EOF
322 > EOF
211 0
323 using raw connection to peer
212 0
324 i> write(9) -> None:
213 0
325 i> unknown1\n
214 384
326 o> readline() -> 2:
215 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
327 o> 0\n
216 1
328 i> write(9) -> None:
217
329 i> unknown2\n
330 o> readline() -> 2:
331 o> 0\n
332 i> write(9) -> None:
333 i> unknown3\n
334 o> readline() -> 2:
335 o> 0\n
336 i> write(6) -> None:
337 i> hello\n
338 o> readline() -> 4:
339 o> 384\n
340 o> readline() -> 384:
341 o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
342 i> write(98) -> None:
343 i> between\n
344 i> pairs 81\n
345 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
346 o> readline() -> 2:
347 o> 1\n
348 o> readline() -> 1:
349 o> \n
218
350
219 $ hg --config sshpeer.mode=extra-handshake-commands --config sshpeer.handshake-mode=pre-multiple-no-args --debug debugpeer ssh://user@dummy/server
351 $ hg --config sshpeer.mode=extra-handshake-commands --config sshpeer.handshake-mode=pre-multiple-no-args --debug debugpeer ssh://user@dummy/server
220 running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !)
352 running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !)
221 running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !)
353 running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !)
222 sending unknown1 command
354 sending unknown1 command
223 sending unknown2 command
355 sending unknown2 command
224 sending unknown3 command
356 sending unknown3 command
225 devel-peer-request: hello
357 devel-peer-request: hello
226 sending hello command
358 sending hello command
227 devel-peer-request: between
359 devel-peer-request: between
228 devel-peer-request: pairs: 81 bytes
360 devel-peer-request: pairs: 81 bytes
229 sending between command
361 sending between command
230 remote: 0
362 remote: 0
231 remote: 0
363 remote: 0
232 remote: 0
364 remote: 0
233 remote: 384
365 remote: 384
234 remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
366 remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
235 remote: 1
367 remote: 1
236 url: ssh://user@dummy/server
368 url: ssh://user@dummy/server
237 local: no
369 local: no
238 pushable: yes
370 pushable: yes
239
371
240 Send an unknown command before hello that has arguments
372 Send an unknown command before hello that has arguments
241
373
242 $ hg -R server serve --stdio << EOF
374 $ cd server
243 > with-args
375
244 > foo 13
376 $ hg debugwireproto --localssh --peer raw << EOF
245 > value for foo
377 > raw
246 > bar 13
378 > with-args\n
247 > value for bar
379 > foo 13\n
248 > hello
380 > value for foo\n
249 > between
381 > bar 13\n
250 > pairs 81
382 > value for bar\n
251 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
383 > readline
384 > readline
385 > readline
386 > readline
387 > readline
388 > raw
389 > hello\n
390 > readline
391 > readline
392 > raw
393 > between\n
394 > pairs 81\n
395 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
396 > readline
397 > readline
252 > EOF
398 > EOF
253 0
399 using raw connection to peer
254 0
400 i> write(52) -> None:
255 0
401 i> with-args\n
256 0
402 i> foo 13\n
257 0
403 i> value for foo\n
258 384
404 i> bar 13\n
259 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
405 i> value for bar\n
260 1
406 o> readline() -> 2:
261
407 o> 0\n
408 o> readline() -> 2:
409 o> 0\n
410 o> readline() -> 2:
411 o> 0\n
412 o> readline() -> 2:
413 o> 0\n
414 o> readline() -> 2:
415 o> 0\n
416 i> write(6) -> None:
417 i> hello\n
418 o> readline() -> 4:
419 o> 384\n
420 o> readline() -> 384:
421 o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
422 i> write(98) -> None:
423 i> between\n
424 i> pairs 81\n
425 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
426 o> readline() -> 2:
427 o> 1\n
428 o> readline() -> 1:
429 o> \n
262
430
263 Send an unknown command having an argument that looks numeric
431 Send an unknown command having an argument that looks numeric
264
432
265 $ hg -R server serve --stdio << EOF
433 $ hg debugwireproto --localssh --peer raw << EOF
266 > unknown
434 > raw
267 > foo 1
435 > unknown\n
268 > 0
436 > foo 1\n
269 > hello
437 > 0\n
270 > between
438 > readline
271 > pairs 81
439 > readline
272 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
440 > readline
441 > raw
442 > hello\n
443 > readline
444 > readline
445 > raw
446 > between\n
447 > pairs 81\n
448 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
449 > readline
450 > readline
273 > EOF
451 > EOF
274 0
452 using raw connection to peer
275 0
453 i> write(16) -> None:
276 0
454 i> unknown\n
277 384
455 i> foo 1\n
278 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
456 i> 0\n
279 1
457 o> readline() -> 2:
280
458 o> 0\n
459 o> readline() -> 2:
460 o> 0\n
461 o> readline() -> 2:
462 o> 0\n
463 i> write(6) -> None:
464 i> hello\n
465 o> readline() -> 4:
466 o> 384\n
467 o> readline() -> 384:
468 o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
469 i> write(98) -> None:
470 i> between\n
471 i> pairs 81\n
472 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
473 o> readline() -> 2:
474 o> 1\n
475 o> readline() -> 1:
476 o> \n
281
477
282 $ hg -R server serve --stdio << EOF
478 $ hg debugwireproto --localssh --peer raw << EOF
283 > unknown
479 > raw
284 > foo 1
480 > unknown\n
285 > 1
481 > foo 1\n
286 > hello
482 > 1\n
287 > between
483 > readline
288 > pairs 81
484 > readline
289 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
485 > readline
486 > raw
487 > hello\n
488 > readline
489 > readline
490 > raw
491 > between\n
492 > pairs 81\n
493 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
494 > readline
495 > readline
290 > EOF
496 > EOF
291 0
497 using raw connection to peer
292 0
498 i> write(16) -> None:
293 0
499 i> unknown\n
294 384
500 i> foo 1\n
295 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
501 i> 1\n
296 1
502 o> readline() -> 2:
297
503 o> 0\n
504 o> readline() -> 2:
505 o> 0\n
506 o> readline() -> 2:
507 o> 0\n
508 i> write(6) -> None:
509 i> hello\n
510 o> readline() -> 4:
511 o> 384\n
512 o> readline() -> 384:
513 o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
514 i> write(98) -> None:
515 i> between\n
516 i> pairs 81\n
517 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
518 o> readline() -> 2:
519 o> 1\n
520 o> readline() -> 1:
521 o> \n
298
522
299 When sending a dict argument value, it is serialized to
523 When sending a dict argument value, it is serialized to
300 "<arg> <item count>" followed by "<key> <len>\n<value>" for each item
524 "<arg> <item count>" followed by "<key> <len>\n<value>" for each item
301 in the dict.
525 in the dict.
302
526
303 Dictionary value for unknown command
527 Dictionary value for unknown command
304
528
305 $ hg -R server serve --stdio << EOF
529 $ hg debugwireproto --localssh --peer raw << EOF
306 > unknown
530 > raw
307 > dict 3
531 > unknown\n
308 > key1 3
532 > dict 3\n
309 > foo
533 > key1 3\n
310 > key2 3
534 > foo\n
311 > bar
535 > key2 3\n
312 > key3 3
536 > bar\n
313 > baz
537 > key3 3\n
314 > hello
538 > baz\n
539 > readline
540 > readline
541 > readline
542 > readline
543 > readline
544 > readline
545 > readline
546 > readline
547 > raw
548 > hello\n
549 > readline
550 > readline
315 > EOF
551 > EOF
316 0
552 using raw connection to peer
317 0
553 i> write(48) -> None:
318 0
554 i> unknown\n
319 0
555 i> dict 3\n
320 0
556 i> key1 3\n
321 0
557 i> foo\n
322 0
558 i> key2 3\n
323 0
559 i> bar\n
324 384
560 i> key3 3\n
325 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
561 i> baz\n
562 o> readline() -> 2:
563 o> 0\n
564 o> readline() -> 2:
565 o> 0\n
566 o> readline() -> 2:
567 o> 0\n
568 o> readline() -> 2:
569 o> 0\n
570 o> readline() -> 2:
571 o> 0\n
572 o> readline() -> 2:
573 o> 0\n
574 o> readline() -> 2:
575 o> 0\n
576 o> readline() -> 2:
577 o> 0\n
578 i> write(6) -> None:
579 i> hello\n
580 o> readline() -> 4:
581 o> 384\n
582 o> readline() -> 384:
583 o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
326
584
327 Incomplete dictionary send
585 Incomplete dictionary send
328
586
329 $ hg -R server serve --stdio << EOF
587 $ hg debugwireproto --localssh --peer raw << EOF
330 > unknown
588 > raw
331 > dict 3
589 > unknown\n
332 > key1 3
590 > dict 3\n
333 > foo
591 > key1 3\n
592 > foo\n
593 > readline
594 > readline
595 > readline
596 > readline
334 > EOF
597 > EOF
335 0
598 using raw connection to peer
336 0
599 i> write(26) -> None:
337 0
600 i> unknown\n
338 0
601 i> dict 3\n
602 i> key1 3\n
603 i> foo\n
604 o> readline() -> 2:
605 o> 0\n
606 o> readline() -> 2:
607 o> 0\n
608 o> readline() -> 2:
609 o> 0\n
610 o> readline() -> 2:
611 o> 0\n
339
612
340 Incomplete value send
613 Incomplete value send
341
614
342 $ hg -R server serve --stdio << EOF
615 $ hg debugwireproto --localssh --peer raw << EOF
343 > unknown
616 > raw
344 > dict 3
617 > unknown\n
345 > key1 3
618 > dict 3\n
346 > fo
619 > key1 3\n
620 > fo
621 > readline
622 > readline
623 > readline
347 > EOF
624 > EOF
348 0
625 using raw connection to peer
349 0
626 i> write(24) -> None:
350 0
627 i> unknown\n
351 0
628 i> dict 3\n
629 i> key1 3\n
630 i> fo
631 o> readline() -> 2:
632 o> 0\n
633 o> readline() -> 2:
634 o> 0\n
635 o> readline() -> 2:
636 o> 0\n
352
637
353 Send a command line with spaces
638 Send a command line with spaces
354
639
355 $ hg -R server serve --stdio << EOF
640 $ hg debugwireproto --localssh --peer raw << EOF
356 > unknown withspace
641 > raw
357 > hello
642 > unknown withspace\n
358 > between
643 > readline
359 > pairs 81
644 > raw
360 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
645 > hello\n
646 > readline
647 > readline
648 > raw
649 > between\n
650 > pairs 81\n
651 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
652 > readline
653 > readline
361 > EOF
654 > EOF
362 0
655 using raw connection to peer
363 384
656 i> write(18) -> None:
364 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
657 i> unknown withspace\n
365 1
658 o> readline() -> 2:
366
659 o> 0\n
660 i> write(6) -> None:
661 i> hello\n
662 o> readline() -> 4:
663 o> 384\n
664 o> readline() -> 384:
665 o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
666 i> write(98) -> None:
667 i> between\n
668 i> pairs 81\n
669 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
670 o> readline() -> 2:
671 o> 1\n
672 o> readline() -> 1:
673 o> \n
367
674
368 $ hg -R server serve --stdio << EOF
675 $ hg debugwireproto --localssh --peer raw << EOF
369 > unknown with multiple spaces
676 > raw
370 > hello
677 > unknown with multiple spaces\n
371 > between
678 > readline
372 > pairs 81
679 > raw
373 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
680 > hello\n
681 > readline
682 > readline
683 > raw
684 > between\n
685 > pairs 81\n
686 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
687 > readline
374 > EOF
688 > EOF
375 0
689 using raw connection to peer
376 384
690 i> write(29) -> None:
377 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
691 i> unknown with multiple spaces\n
378 1
692 o> readline() -> 2:
379
693 o> 0\n
694 i> write(6) -> None:
695 i> hello\n
696 o> readline() -> 4:
697 o> 384\n
698 o> readline() -> 384:
699 o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
700 i> write(98) -> None:
701 i> between\n
702 i> pairs 81\n
703 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
704 o> readline() -> 2:
705 o> 1\n
380
706
381 $ hg -R server serve --stdio << EOF
707 $ hg debugwireproto --localssh --peer raw << EOF
382 > unknown with spaces
708 > raw
383 > key 10
709 > unknown with spaces\n
384 > some value
710 > key 10\n
385 > hello
711 > some value\n
386 > between
712 > readline
387 > pairs 81
713 > readline
388 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
714 > readline
715 > raw
716 > hello\n
717 > readline
718 > readline
719 > raw
720 > between\n
721 > pairs 81\n
722 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
723 > readline
724 > readline
389 > EOF
725 > EOF
390 0
726 using raw connection to peer
391 0
727 i> write(38) -> None:
392 0
728 i> unknown with spaces\n
393 384
729 i> key 10\n
394 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
730 i> some value\n
395 1
731 o> readline() -> 2:
396
732 o> 0\n
733 o> readline() -> 2:
734 o> 0\n
735 o> readline() -> 2:
736 o> 0\n
737 i> write(6) -> None:
738 i> hello\n
739 o> readline() -> 4:
740 o> 384\n
741 o> readline() -> 384:
742 o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
743 i> write(98) -> None:
744 i> between\n
745 i> pairs 81\n
746 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
747 o> readline() -> 2:
748 o> 1\n
749 o> readline() -> 1:
750 o> \n
397
751
398 Send an unknown command after the "between"
752 Send an unknown command after the "between"
399
753
400 $ hg -R server serve --stdio << EOF
754 $ hg debugwireproto --localssh --peer raw << EOF
401 > hello
755 > raw
402 > between
756 > hello\n
403 > pairs 81
757 > readline
404 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000unknown
758 > readline
759 > raw
760 > between\n
761 > pairs 81\n
762 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000unknown
763 > readline
764 > readline
405 > EOF
765 > EOF
406 384
766 using raw connection to peer
407 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
767 i> write(6) -> None:
408 1
768 i> hello\n
409
769 o> readline() -> 4:
410 0
770 o> 384\n
771 o> readline() -> 384:
772 o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
773 i> write(105) -> None:
774 i> between\n
775 i> pairs 81\n
776 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000unknown
777 o> readline() -> 2:
778 o> 1\n
779 o> readline() -> 1:
780 o> \n
411
781
412 And one with arguments
782 And one with arguments
413
783
414 $ hg -R server serve --stdio << EOF
784 $ hg debugwireproto --localssh --peer raw << EOF
415 > hello
785 > raw
416 > between
786 > hello\n
417 > pairs 81
787 > between\n
418 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000unknown
788 > pairs 81\n
419 > foo 5
789 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
420 > value
790 > readline
421 > bar 3
791 > readline
422 > baz
792 > readline
793 > readline
794 > raw
795 > unknown\n
796 > foo 5\n
797 > \nvalue\n
798 > bar 3\n
799 > baz\n
800 > readline
801 > readline
802 > readline
423 > EOF
803 > EOF
424 384
804 using raw connection to peer
425 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
805 i> write(104) -> None:
426 1
806 i> hello\n
427
807 i> between\n
428 0
808 i> pairs 81\n
429 0
809 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
430 0
810 o> readline() -> 4:
431 0
811 o> 384\n
432 0
812 o> readline() -> 384:
813 o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
814 o> readline() -> 2:
815 o> 1\n
816 o> readline() -> 1:
817 o> \n
818 i> write(31) -> None:
819 i> unknown\n
820 i> foo 5\n
821 i> \n
822 i> value\n
823 i> bar 3\n
824 i> baz\n
825 o> readline() -> 2:
826 o> 0\n
827 o> readline() -> 2:
828 o> 0\n
829 o> readline() -> 0:
433
830
434 Send a valid command before the handshake
831 Send a valid command before the handshake
435
832
436 $ hg -R server serve --stdio << EOF
833 $ hg debugwireproto --localssh --peer raw << EOF
437 > heads
834 > raw
438 > hello
835 > heads\n
439 > between
836 > readline
440 > pairs 81
837 > raw
441 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
838 > hello\n
839 > between\n
840 > pairs 81\n
841 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
842 > readline
843 > readline
844 > readline
845 > readline
442 > EOF
846 > EOF
443 41
847 using raw connection to peer
444 68986213bd4485ea51533535e3fc9e78007a711f
848 i> write(6) -> None:
445 384
849 i> heads\n
446 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
850 o> readline() -> 3:
447 1
851 o> 41\n
448
852 i> write(104) -> None:
853 i> hello\n
854 i> between\n
855 i> pairs 81\n
856 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
857 o> readline() -> 41:
858 o> 68986213bd4485ea51533535e3fc9e78007a711f\n
859 o> readline() -> 4:
860 o> 384\n
861 o> readline() -> 384:
862 o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
863 o> readline() -> 2:
864 o> 1\n
449
865
450 And a variation that doesn't send the between command
866 And a variation that doesn't send the between command
451
867
452 $ hg -R server serve --stdio << EOF
868 $ hg debugwireproto --localssh --peer raw << EOF
453 > heads
869 > raw
454 > hello
870 > heads\n
871 > readline
872 > raw
873 > hello\n
874 > readline
875 > readline
455 > EOF
876 > EOF
456 41
877 using raw connection to peer
457 68986213bd4485ea51533535e3fc9e78007a711f
878 i> write(6) -> None:
458 384
879 i> heads\n
459 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
880 o> readline() -> 3:
881 o> 41\n
882 i> write(6) -> None:
883 i> hello\n
884 o> readline() -> 41:
885 o> 68986213bd4485ea51533535e3fc9e78007a711f\n
886 o> readline() -> 4:
887 o> 384\n
460
888
461 Send an upgrade request to a server that doesn't support that command
889 Send an upgrade request to a server that doesn't support that command
462
890
463 $ hg -R server serve --stdio << EOF
891 $ hg debugwireproto --localssh --peer raw << EOF
464 > upgrade 2e82ab3f-9ce3-4b4e-8f8c-6fd1c0e9e23a proto=irrelevant1%2Cirrelevant2
892 > raw
465 > hello
893 > upgrade 2e82ab3f-9ce3-4b4e-8f8c-6fd1c0e9e23a proto=irrelevant1%2Cirrelevant2\n
466 > between
894 > readline
467 > pairs 81
895 > raw
468 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
896 > hello\n
897 > between\n
898 > pairs 81\n
899 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
900 > readline
901 > readline
902 > readline
903 > readline
469 > EOF
904 > EOF
470 0
905 using raw connection to peer
471 384
906 i> write(77) -> None:
472 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
907 i> upgrade 2e82ab3f-9ce3-4b4e-8f8c-6fd1c0e9e23a proto=irrelevant1%2Cirrelevant2\n
473 1
908 o> readline() -> 2:
474
909 o> 0\n
910 i> write(104) -> None:
911 i> hello\n
912 i> between\n
913 i> pairs 81\n
914 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
915 o> readline() -> 4:
916 o> 384\n
917 o> readline() -> 384:
918 o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
919 o> readline() -> 2:
920 o> 1\n
921 o> readline() -> 1:
922 o> \n
923
924 $ cd ..
475
925
476 $ hg --config experimental.sshpeer.advertise-v2=true --debug debugpeer ssh://user@dummy/server
926 $ hg --config experimental.sshpeer.advertise-v2=true --debug debugpeer ssh://user@dummy/server
477 running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !)
927 running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !)
478 running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !)
928 running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !)
479 sending upgrade request: * proto=exp-ssh-v2-0001 (glob)
929 sending upgrade request: * proto=exp-ssh-v2-0001 (glob)
480 devel-peer-request: hello
930 devel-peer-request: hello
481 sending hello command
931 sending hello command
482 devel-peer-request: between
932 devel-peer-request: between
483 devel-peer-request: pairs: 81 bytes
933 devel-peer-request: pairs: 81 bytes
484 sending between command
934 sending between command
485 remote: 0
935 remote: 0
486 remote: 384
936 remote: 384
487 remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
937 remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
488 remote: 1
938 remote: 1
489 url: ssh://user@dummy/server
939 url: ssh://user@dummy/server
490 local: no
940 local: no
491 pushable: yes
941 pushable: yes
492
942
493 Enable version 2 support on server. We need to do this in hgrc because we can't
943 Enable version 2 support on server. We need to do this in hgrc because we can't
494 use --config with `hg serve --stdio`.
944 use --config with `hg serve --stdio`.
495
945
496 $ cat >> server/.hg/hgrc << EOF
946 $ cat >> server/.hg/hgrc << EOF
497 > [experimental]
947 > [experimental]
498 > sshserver.support-v2 = true
948 > sshserver.support-v2 = true
499 > EOF
949 > EOF
500
950
501 Send an upgrade request to a server that supports upgrade
951 Send an upgrade request to a server that supports upgrade
502
952
503 >>> with open('payload', 'wb') as fh:
953 $ cd server
504 ... fh.write(b'upgrade this-is-some-token proto=exp-ssh-v2-0001\n')
505 ... fh.write(b'hello\n')
506 ... fh.write(b'between\n')
507 ... fh.write(b'pairs 81\n')
508 ... fh.write(b'0000000000000000000000000000000000000000-0000000000000000000000000000000000000000')
509
954
510 $ hg -R server serve --stdio < payload
955 $ hg debugwireproto --localssh --peer raw << EOF
511 upgraded this-is-some-token exp-ssh-v2-0001
956 > raw
512 383
957 > upgrade this-is-some-token proto=exp-ssh-v2-0001\n
513 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
958 > hello\n
959 > between\n
960 > pairs 81\n
961 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
962 > readline
963 > readline
964 > readline
965 > EOF
966 using raw connection to peer
967 i> write(153) -> None:
968 i> upgrade this-is-some-token proto=exp-ssh-v2-0001\n
969 i> hello\n
970 i> between\n
971 i> pairs 81\n
972 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
973 o> readline() -> 44:
974 o> upgraded this-is-some-token exp-ssh-v2-0001\n
975 o> readline() -> 4:
976 o> 383\n
977 o> readline() -> 384:
978 o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
979
980 $ cd ..
514
981
515 $ hg --config experimental.sshpeer.advertise-v2=true --debug debugpeer ssh://user@dummy/server
982 $ hg --config experimental.sshpeer.advertise-v2=true --debug debugpeer ssh://user@dummy/server
516 running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !)
983 running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !)
517 running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !)
984 running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !)
518 sending upgrade request: * proto=exp-ssh-v2-0001 (glob)
985 sending upgrade request: * proto=exp-ssh-v2-0001 (glob)
519 devel-peer-request: hello
986 devel-peer-request: hello
520 sending hello command
987 sending hello command
521 devel-peer-request: between
988 devel-peer-request: between
522 devel-peer-request: pairs: 81 bytes
989 devel-peer-request: pairs: 81 bytes
523 sending between command
990 sending between command
524 protocol upgraded to exp-ssh-v2-0001
991 protocol upgraded to exp-ssh-v2-0001
525 remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
992 remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
526 url: ssh://user@dummy/server
993 url: ssh://user@dummy/server
527 local: no
994 local: no
528 pushable: yes
995 pushable: yes
529
996
530 Verify the peer has capabilities
997 Verify the peer has capabilities
531
998
532 $ hg --config experimental.sshpeer.advertise-v2=true --debug debugcapabilities ssh://user@dummy/server
999 $ hg --config experimental.sshpeer.advertise-v2=true --debug debugcapabilities ssh://user@dummy/server
533 running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !)
1000 running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !)
534 running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !)
1001 running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !)
535 sending upgrade request: * proto=exp-ssh-v2-0001 (glob)
1002 sending upgrade request: * proto=exp-ssh-v2-0001 (glob)
536 devel-peer-request: hello
1003 devel-peer-request: hello
537 sending hello command
1004 sending hello command
538 devel-peer-request: between
1005 devel-peer-request: between
539 devel-peer-request: pairs: 81 bytes
1006 devel-peer-request: pairs: 81 bytes
540 sending between command
1007 sending between command
541 protocol upgraded to exp-ssh-v2-0001
1008 protocol upgraded to exp-ssh-v2-0001
542 remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
1009 remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
543 Main capabilities:
1010 Main capabilities:
544 batch
1011 batch
545 branchmap
1012 branchmap
546 $USUAL_BUNDLE2_CAPS_SERVER$
1013 $USUAL_BUNDLE2_CAPS_SERVER$
547 changegroupsubset
1014 changegroupsubset
548 getbundle
1015 getbundle
549 known
1016 known
550 lookup
1017 lookup
551 pushkey
1018 pushkey
552 streamreqs=generaldelta,revlogv1
1019 streamreqs=generaldelta,revlogv1
553 unbundle=HG10GZ,HG10BZ,HG10UN
1020 unbundle=HG10GZ,HG10BZ,HG10UN
554 unbundlehash
1021 unbundlehash
555 Bundle2 capabilities:
1022 Bundle2 capabilities:
556 HG20
1023 HG20
557 bookmarks
1024 bookmarks
558 changegroup
1025 changegroup
559 01
1026 01
560 02
1027 02
561 digests
1028 digests
562 md5
1029 md5
563 sha1
1030 sha1
564 sha512
1031 sha512
565 error
1032 error
566 abort
1033 abort
567 unsupportedcontent
1034 unsupportedcontent
568 pushraced
1035 pushraced
569 pushkey
1036 pushkey
570 hgtagsfnodes
1037 hgtagsfnodes
571 listkeys
1038 listkeys
572 phases
1039 phases
573 heads
1040 heads
574 pushkey
1041 pushkey
575 remote-changegroup
1042 remote-changegroup
576 http
1043 http
577 https
1044 https
578
1045
579 Command after upgrade to version 2 is processed
1046 Command after upgrade to version 2 is processed
580
1047
581 >>> with open('payload', 'wb') as fh:
1048 $ cd server
582 ... fh.write(b'upgrade this-is-some-token proto=exp-ssh-v2-0001\n')
1049
583 ... fh.write(b'hello\n')
1050 $ hg debugwireproto --localssh --peer raw << EOF
584 ... fh.write(b'between\n')
1051 > raw
585 ... fh.write(b'pairs 81\n')
1052 > upgrade this-is-some-token proto=exp-ssh-v2-0001\n
586 ... fh.write(b'0000000000000000000000000000000000000000-0000000000000000000000000000000000000000')
1053 > hello\n
587 ... fh.write(b'hello\n')
1054 > between\n
588 $ hg -R server serve --stdio < payload
1055 > pairs 81\n
589 upgraded this-is-some-token exp-ssh-v2-0001
1056 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
590 383
1057 > readline
591 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
1058 > readline
592 384
1059 > readline
593 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
1060 > raw
1061 > hello\n
1062 > readline
1063 > readline
1064 > EOF
1065 using raw connection to peer
1066 i> write(153) -> None:
1067 i> upgrade this-is-some-token proto=exp-ssh-v2-0001\n
1068 i> hello\n
1069 i> between\n
1070 i> pairs 81\n
1071 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1072 o> readline() -> 44:
1073 o> upgraded this-is-some-token exp-ssh-v2-0001\n
1074 o> readline() -> 4:
1075 o> 383\n
1076 o> readline() -> 384:
1077 o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
1078 i> write(6) -> None:
1079 i> hello\n
1080 o> readline() -> 4:
1081 o> 384\n
1082 o> readline() -> 384:
1083 o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
594
1084
595 Multiple upgrades is not allowed
1085 Multiple upgrades is not allowed
596
1086
597 >>> with open('payload', 'wb') as fh:
1087 $ hg debugwireproto --localssh --peer raw << EOF
598 ... fh.write(b'upgrade this-is-some-token proto=exp-ssh-v2-0001\n')
1088 > raw
599 ... fh.write(b'hello\n')
1089 > upgrade this-is-some-token proto=exp-ssh-v2-0001\n
600 ... fh.write(b'between\n')
1090 > hello\n
601 ... fh.write(b'pairs 81\n')
1091 > between\n
602 ... fh.write(b'0000000000000000000000000000000000000000-0000000000000000000000000000000000000000')
1092 > pairs 81\n
603 ... fh.write(b'upgrade another-token proto=irrelevant\n')
1093 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
604 ... fh.write(b'hello\n')
1094 > readline
605 $ hg -R server serve --stdio < payload
1095 > readline
606 upgraded this-is-some-token exp-ssh-v2-0001
1096 > readline
607 383
1097 > raw
608 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
1098 > upgrade another-token proto=irrelevant\n
609 cannot upgrade protocols multiple times
1099 > hello\n
610 -
1100 > readline
611
1101 > readavailable
1102 > EOF
1103 using raw connection to peer
1104 i> write(153) -> None:
1105 i> upgrade this-is-some-token proto=exp-ssh-v2-0001\n
1106 i> hello\n
1107 i> between\n
1108 i> pairs 81\n
1109 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1110 o> readline() -> 44:
1111 o> upgraded this-is-some-token exp-ssh-v2-0001\n
1112 o> readline() -> 4:
1113 o> 383\n
1114 o> readline() -> 384:
1115 o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
1116 i> write(45) -> None:
1117 i> upgrade another-token proto=irrelevant\n
1118 i> hello\n
1119 o> readline() -> 1:
1120 o> \n
1121 e> read(-1) -> 42:
1122 e> cannot upgrade protocols multiple times\n
1123 e> -\n
612
1124
613 Malformed upgrade request line (not exactly 3 space delimited tokens)
1125 Malformed upgrade request line (not exactly 3 space delimited tokens)
614
1126
615 $ hg -R server serve --stdio << EOF
1127 $ hg debugwireproto --localssh --peer raw << EOF
616 > upgrade
1128 > raw
1129 > upgrade\n
1130 > readline
617 > EOF
1131 > EOF
618 0
1132 using raw connection to peer
1133 i> write(8) -> None:
1134 i> upgrade\n
1135 o> readline() -> 2:
1136 o> 0\n
619
1137
620 $ hg -R server serve --stdio << EOF
1138 $ hg debugwireproto --localssh --peer raw << EOF
621 > upgrade token
1139 > raw
1140 > upgrade token\n
1141 > readline
622 > EOF
1142 > EOF
623 0
1143 using raw connection to peer
1144 i> write(14) -> None:
1145 i> upgrade token\n
1146 o> readline() -> 2:
1147 o> 0\n
624
1148
625 $ hg -R server serve --stdio << EOF
1149 $ hg debugwireproto --localssh --peer raw << EOF
626 > upgrade token foo=bar extra-token
1150 > raw
1151 > upgrade token foo=bar extra-token\n
1152 > readline
627 > EOF
1153 > EOF
628 0
1154 using raw connection to peer
1155 i> write(34) -> None:
1156 i> upgrade token foo=bar extra-token\n
1157 o> readline() -> 2:
1158 o> 0\n
629
1159
630 Upgrade request to unsupported protocol is ignored
1160 Upgrade request to unsupported protocol is ignored
631
1161
632 $ hg -R server serve --stdio << EOF
1162 $ hg debugwireproto --localssh --peer raw << EOF
633 > upgrade this-is-some-token proto=unknown1,unknown2
1163 > raw
634 > hello
1164 > upgrade this-is-some-token proto=unknown1,unknown2\n
635 > between
1165 > readline
636 > pairs 81
1166 > raw
637 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1167 > hello\n
1168 > readline
1169 > readline
1170 > raw
1171 > between\n
1172 > pairs 81\n
1173 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1174 > readline
1175 > readline
638 > EOF
1176 > EOF
639 0
1177 using raw connection to peer
640 384
1178 i> write(51) -> None:
641 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
1179 i> upgrade this-is-some-token proto=unknown1,unknown2\n
642 1
1180 o> readline() -> 2:
643
1181 o> 0\n
1182 i> write(6) -> None:
1183 i> hello\n
1184 o> readline() -> 4:
1185 o> 384\n
1186 o> readline() -> 384:
1187 o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
1188 i> write(98) -> None:
1189 i> between\n
1190 i> pairs 81\n
1191 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1192 o> readline() -> 2:
1193 o> 1\n
1194 o> readline() -> 1:
1195 o> \n
644
1196
645 Upgrade request must be followed by hello + between
1197 Upgrade request must be followed by hello + between
646
1198
647 $ hg -R server serve --stdio << EOF
1199 $ hg debugwireproto --localssh --peer raw << EOF
648 > upgrade token proto=exp-ssh-v2-0001
1200 > raw
649 > invalid
1201 > upgrade token proto=exp-ssh-v2-0001\n
1202 > invalid\n
1203 > readline
1204 > readavailable
650 > EOF
1205 > EOF
651 malformed handshake protocol: missing hello
1206 using raw connection to peer
652 -
1207 i> write(44) -> None:
653
1208 i> upgrade token proto=exp-ssh-v2-0001\n
1209 i> invalid\n
1210 o> readline() -> 1:
1211 o> \n
1212 e> read(-1) -> 46:
1213 e> malformed handshake protocol: missing hello\n
1214 e> -\n
654
1215
655 $ hg -R server serve --stdio << EOF
1216 $ hg debugwireproto --localssh --peer raw << EOF
656 > upgrade token proto=exp-ssh-v2-0001
1217 > raw
657 > hello
1218 > upgrade token proto=exp-ssh-v2-0001\n
658 > invalid
1219 > hello\n
1220 > invalid\n
1221 > readline
1222 > readavailable
659 > EOF
1223 > EOF
660 malformed handshake protocol: missing between
1224 using raw connection to peer
661 -
1225 i> write(50) -> None:
662
1226 i> upgrade token proto=exp-ssh-v2-0001\n
1227 i> hello\n
1228 i> invalid\n
1229 o> readline() -> 1:
1230 o> \n
1231 e> read(-1) -> 48:
1232 e> malformed handshake protocol: missing between\n
1233 e> -\n
663
1234
664 $ hg -R server serve --stdio << EOF
1235 $ hg debugwireproto --localssh --peer raw << EOF
665 > upgrade token proto=exp-ssh-v2-0001
1236 > raw
666 > hello
1237 > upgrade token proto=exp-ssh-v2-0001\n
667 > between
1238 > hello\n
668 > invalid
1239 > between\n
1240 > invalid\n
1241 > readline
1242 > readavailable
669 > EOF
1243 > EOF
670 malformed handshake protocol: missing pairs 81
1244 using raw connection to peer
671 -
1245 i> write(58) -> None:
672
1246 i> upgrade token proto=exp-ssh-v2-0001\n
1247 i> hello\n
1248 i> between\n
1249 i> invalid\n
1250 o> readline() -> 1:
1251 o> \n
1252 e> read(-1) -> 49:
1253 e> malformed handshake protocol: missing pairs 81\n
1254 e> -\n
General Comments 0
You need to be logged in to leave comments. Login now