##// END OF EJS Templates
debugcommands: introduce debugrevlogindex (BC)...
Gregory Szorc -
r39318:828a4523 default
parent child Browse files
Show More
@@ -1,3325 +1,3361 b''
1 # debugcommands.py - command processing for debug* commands
1 # debugcommands.py - command processing for debug* commands
2 #
2 #
3 # Copyright 2005-2016 Matt Mackall <mpm@selenic.com>
3 # Copyright 2005-2016 Matt Mackall <mpm@selenic.com>
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 from __future__ import absolute_import
8 from __future__ import absolute_import
9
9
10 import codecs
10 import codecs
11 import collections
11 import collections
12 import difflib
12 import difflib
13 import errno
13 import errno
14 import operator
14 import operator
15 import os
15 import os
16 import random
16 import random
17 import re
17 import re
18 import socket
18 import socket
19 import ssl
19 import ssl
20 import stat
20 import stat
21 import string
21 import string
22 import subprocess
22 import subprocess
23 import sys
23 import sys
24 import time
24 import time
25
25
26 from .i18n import _
26 from .i18n import _
27 from .node import (
27 from .node import (
28 bin,
28 bin,
29 hex,
29 hex,
30 nullhex,
30 nullhex,
31 nullid,
31 nullid,
32 nullrev,
32 nullrev,
33 short,
33 short,
34 )
34 )
35 from .thirdparty import (
35 from .thirdparty import (
36 cbor,
36 cbor,
37 )
37 )
38 from . import (
38 from . import (
39 bundle2,
39 bundle2,
40 changegroup,
40 changegroup,
41 cmdutil,
41 cmdutil,
42 color,
42 color,
43 context,
43 context,
44 dagparser,
44 dagparser,
45 encoding,
45 encoding,
46 error,
46 error,
47 exchange,
47 exchange,
48 extensions,
48 extensions,
49 filemerge,
49 filemerge,
50 filesetlang,
50 filesetlang,
51 formatter,
51 formatter,
52 hg,
52 hg,
53 httppeer,
53 httppeer,
54 localrepo,
54 localrepo,
55 lock as lockmod,
55 lock as lockmod,
56 logcmdutil,
56 logcmdutil,
57 merge as mergemod,
57 merge as mergemod,
58 obsolete,
58 obsolete,
59 obsutil,
59 obsutil,
60 phases,
60 phases,
61 policy,
61 policy,
62 pvec,
62 pvec,
63 pycompat,
63 pycompat,
64 registrar,
64 registrar,
65 repair,
65 repair,
66 revlog,
66 revlog,
67 revset,
67 revset,
68 revsetlang,
68 revsetlang,
69 scmutil,
69 scmutil,
70 setdiscovery,
70 setdiscovery,
71 simplemerge,
71 simplemerge,
72 sshpeer,
72 sshpeer,
73 sslutil,
73 sslutil,
74 streamclone,
74 streamclone,
75 templater,
75 templater,
76 treediscovery,
76 treediscovery,
77 upgrade,
77 upgrade,
78 url as urlmod,
78 url as urlmod,
79 util,
79 util,
80 vfs as vfsmod,
80 vfs as vfsmod,
81 wireprotoframing,
81 wireprotoframing,
82 wireprotoserver,
82 wireprotoserver,
83 wireprotov2peer,
83 wireprotov2peer,
84 )
84 )
85 from .utils import (
85 from .utils import (
86 dateutil,
86 dateutil,
87 procutil,
87 procutil,
88 stringutil,
88 stringutil,
89 )
89 )
90
90
91 release = lockmod.release
91 release = lockmod.release
92
92
93 command = registrar.command()
93 command = registrar.command()
94
94
95 @command('debugancestor', [], _('[INDEX] REV1 REV2'), optionalrepo=True)
95 @command('debugancestor', [], _('[INDEX] REV1 REV2'), optionalrepo=True)
96 def debugancestor(ui, repo, *args):
96 def debugancestor(ui, repo, *args):
97 """find the ancestor revision of two revisions in a given index"""
97 """find the ancestor revision of two revisions in a given index"""
98 if len(args) == 3:
98 if len(args) == 3:
99 index, rev1, rev2 = args
99 index, rev1, rev2 = args
100 r = revlog.revlog(vfsmod.vfs(pycompat.getcwd(), audit=False), index)
100 r = revlog.revlog(vfsmod.vfs(pycompat.getcwd(), audit=False), index)
101 lookup = r.lookup
101 lookup = r.lookup
102 elif len(args) == 2:
102 elif len(args) == 2:
103 if not repo:
103 if not repo:
104 raise error.Abort(_('there is no Mercurial repository here '
104 raise error.Abort(_('there is no Mercurial repository here '
105 '(.hg not found)'))
105 '(.hg not found)'))
106 rev1, rev2 = args
106 rev1, rev2 = args
107 r = repo.changelog
107 r = repo.changelog
108 lookup = repo.lookup
108 lookup = repo.lookup
109 else:
109 else:
110 raise error.Abort(_('either two or three arguments required'))
110 raise error.Abort(_('either two or three arguments required'))
111 a = r.ancestor(lookup(rev1), lookup(rev2))
111 a = r.ancestor(lookup(rev1), lookup(rev2))
112 ui.write('%d:%s\n' % (r.rev(a), hex(a)))
112 ui.write('%d:%s\n' % (r.rev(a), hex(a)))
113
113
114 @command('debugapplystreamclonebundle', [], 'FILE')
114 @command('debugapplystreamclonebundle', [], 'FILE')
115 def debugapplystreamclonebundle(ui, repo, fname):
115 def debugapplystreamclonebundle(ui, repo, fname):
116 """apply a stream clone bundle file"""
116 """apply a stream clone bundle file"""
117 f = hg.openpath(ui, fname)
117 f = hg.openpath(ui, fname)
118 gen = exchange.readbundle(ui, f, fname)
118 gen = exchange.readbundle(ui, f, fname)
119 gen.apply(repo)
119 gen.apply(repo)
120
120
121 @command('debugbuilddag',
121 @command('debugbuilddag',
122 [('m', 'mergeable-file', None, _('add single file mergeable changes')),
122 [('m', 'mergeable-file', None, _('add single file mergeable changes')),
123 ('o', 'overwritten-file', None, _('add single file all revs overwrite')),
123 ('o', 'overwritten-file', None, _('add single file all revs overwrite')),
124 ('n', 'new-file', None, _('add new file at each rev'))],
124 ('n', 'new-file', None, _('add new file at each rev'))],
125 _('[OPTION]... [TEXT]'))
125 _('[OPTION]... [TEXT]'))
126 def debugbuilddag(ui, repo, text=None,
126 def debugbuilddag(ui, repo, text=None,
127 mergeable_file=False,
127 mergeable_file=False,
128 overwritten_file=False,
128 overwritten_file=False,
129 new_file=False):
129 new_file=False):
130 """builds a repo with a given DAG from scratch in the current empty repo
130 """builds a repo with a given DAG from scratch in the current empty repo
131
131
132 The description of the DAG is read from stdin if not given on the
132 The description of the DAG is read from stdin if not given on the
133 command line.
133 command line.
134
134
135 Elements:
135 Elements:
136
136
137 - "+n" is a linear run of n nodes based on the current default parent
137 - "+n" is a linear run of n nodes based on the current default parent
138 - "." is a single node based on the current default parent
138 - "." is a single node based on the current default parent
139 - "$" resets the default parent to null (implied at the start);
139 - "$" resets the default parent to null (implied at the start);
140 otherwise the default parent is always the last node created
140 otherwise the default parent is always the last node created
141 - "<p" sets the default parent to the backref p
141 - "<p" sets the default parent to the backref p
142 - "*p" is a fork at parent p, which is a backref
142 - "*p" is a fork at parent p, which is a backref
143 - "*p1/p2" is a merge of parents p1 and p2, which are backrefs
143 - "*p1/p2" is a merge of parents p1 and p2, which are backrefs
144 - "/p2" is a merge of the preceding node and p2
144 - "/p2" is a merge of the preceding node and p2
145 - ":tag" defines a local tag for the preceding node
145 - ":tag" defines a local tag for the preceding node
146 - "@branch" sets the named branch for subsequent nodes
146 - "@branch" sets the named branch for subsequent nodes
147 - "#...\\n" is a comment up to the end of the line
147 - "#...\\n" is a comment up to the end of the line
148
148
149 Whitespace between the above elements is ignored.
149 Whitespace between the above elements is ignored.
150
150
151 A backref is either
151 A backref is either
152
152
153 - a number n, which references the node curr-n, where curr is the current
153 - a number n, which references the node curr-n, where curr is the current
154 node, or
154 node, or
155 - the name of a local tag you placed earlier using ":tag", or
155 - the name of a local tag you placed earlier using ":tag", or
156 - empty to denote the default parent.
156 - empty to denote the default parent.
157
157
158 All string valued-elements are either strictly alphanumeric, or must
158 All string valued-elements are either strictly alphanumeric, or must
159 be enclosed in double quotes ("..."), with "\\" as escape character.
159 be enclosed in double quotes ("..."), with "\\" as escape character.
160 """
160 """
161
161
162 if text is None:
162 if text is None:
163 ui.status(_("reading DAG from stdin\n"))
163 ui.status(_("reading DAG from stdin\n"))
164 text = ui.fin.read()
164 text = ui.fin.read()
165
165
166 cl = repo.changelog
166 cl = repo.changelog
167 if len(cl) > 0:
167 if len(cl) > 0:
168 raise error.Abort(_('repository is not empty'))
168 raise error.Abort(_('repository is not empty'))
169
169
170 # determine number of revs in DAG
170 # determine number of revs in DAG
171 total = 0
171 total = 0
172 for type, data in dagparser.parsedag(text):
172 for type, data in dagparser.parsedag(text):
173 if type == 'n':
173 if type == 'n':
174 total += 1
174 total += 1
175
175
176 if mergeable_file:
176 if mergeable_file:
177 linesperrev = 2
177 linesperrev = 2
178 # make a file with k lines per rev
178 # make a file with k lines per rev
179 initialmergedlines = ['%d' % i
179 initialmergedlines = ['%d' % i
180 for i in pycompat.xrange(0, total * linesperrev)]
180 for i in pycompat.xrange(0, total * linesperrev)]
181 initialmergedlines.append("")
181 initialmergedlines.append("")
182
182
183 tags = []
183 tags = []
184 progress = ui.makeprogress(_('building'), unit=_('revisions'),
184 progress = ui.makeprogress(_('building'), unit=_('revisions'),
185 total=total)
185 total=total)
186 with progress, repo.wlock(), repo.lock(), repo.transaction("builddag"):
186 with progress, repo.wlock(), repo.lock(), repo.transaction("builddag"):
187 at = -1
187 at = -1
188 atbranch = 'default'
188 atbranch = 'default'
189 nodeids = []
189 nodeids = []
190 id = 0
190 id = 0
191 progress.update(id)
191 progress.update(id)
192 for type, data in dagparser.parsedag(text):
192 for type, data in dagparser.parsedag(text):
193 if type == 'n':
193 if type == 'n':
194 ui.note(('node %s\n' % pycompat.bytestr(data)))
194 ui.note(('node %s\n' % pycompat.bytestr(data)))
195 id, ps = data
195 id, ps = data
196
196
197 files = []
197 files = []
198 filecontent = {}
198 filecontent = {}
199
199
200 p2 = None
200 p2 = None
201 if mergeable_file:
201 if mergeable_file:
202 fn = "mf"
202 fn = "mf"
203 p1 = repo[ps[0]]
203 p1 = repo[ps[0]]
204 if len(ps) > 1:
204 if len(ps) > 1:
205 p2 = repo[ps[1]]
205 p2 = repo[ps[1]]
206 pa = p1.ancestor(p2)
206 pa = p1.ancestor(p2)
207 base, local, other = [x[fn].data() for x in (pa, p1,
207 base, local, other = [x[fn].data() for x in (pa, p1,
208 p2)]
208 p2)]
209 m3 = simplemerge.Merge3Text(base, local, other)
209 m3 = simplemerge.Merge3Text(base, local, other)
210 ml = [l.strip() for l in m3.merge_lines()]
210 ml = [l.strip() for l in m3.merge_lines()]
211 ml.append("")
211 ml.append("")
212 elif at > 0:
212 elif at > 0:
213 ml = p1[fn].data().split("\n")
213 ml = p1[fn].data().split("\n")
214 else:
214 else:
215 ml = initialmergedlines
215 ml = initialmergedlines
216 ml[id * linesperrev] += " r%i" % id
216 ml[id * linesperrev] += " r%i" % id
217 mergedtext = "\n".join(ml)
217 mergedtext = "\n".join(ml)
218 files.append(fn)
218 files.append(fn)
219 filecontent[fn] = mergedtext
219 filecontent[fn] = mergedtext
220
220
221 if overwritten_file:
221 if overwritten_file:
222 fn = "of"
222 fn = "of"
223 files.append(fn)
223 files.append(fn)
224 filecontent[fn] = "r%i\n" % id
224 filecontent[fn] = "r%i\n" % id
225
225
226 if new_file:
226 if new_file:
227 fn = "nf%i" % id
227 fn = "nf%i" % id
228 files.append(fn)
228 files.append(fn)
229 filecontent[fn] = "r%i\n" % id
229 filecontent[fn] = "r%i\n" % id
230 if len(ps) > 1:
230 if len(ps) > 1:
231 if not p2:
231 if not p2:
232 p2 = repo[ps[1]]
232 p2 = repo[ps[1]]
233 for fn in p2:
233 for fn in p2:
234 if fn.startswith("nf"):
234 if fn.startswith("nf"):
235 files.append(fn)
235 files.append(fn)
236 filecontent[fn] = p2[fn].data()
236 filecontent[fn] = p2[fn].data()
237
237
238 def fctxfn(repo, cx, path):
238 def fctxfn(repo, cx, path):
239 if path in filecontent:
239 if path in filecontent:
240 return context.memfilectx(repo, cx, path,
240 return context.memfilectx(repo, cx, path,
241 filecontent[path])
241 filecontent[path])
242 return None
242 return None
243
243
244 if len(ps) == 0 or ps[0] < 0:
244 if len(ps) == 0 or ps[0] < 0:
245 pars = [None, None]
245 pars = [None, None]
246 elif len(ps) == 1:
246 elif len(ps) == 1:
247 pars = [nodeids[ps[0]], None]
247 pars = [nodeids[ps[0]], None]
248 else:
248 else:
249 pars = [nodeids[p] for p in ps]
249 pars = [nodeids[p] for p in ps]
250 cx = context.memctx(repo, pars, "r%i" % id, files, fctxfn,
250 cx = context.memctx(repo, pars, "r%i" % id, files, fctxfn,
251 date=(id, 0),
251 date=(id, 0),
252 user="debugbuilddag",
252 user="debugbuilddag",
253 extra={'branch': atbranch})
253 extra={'branch': atbranch})
254 nodeid = repo.commitctx(cx)
254 nodeid = repo.commitctx(cx)
255 nodeids.append(nodeid)
255 nodeids.append(nodeid)
256 at = id
256 at = id
257 elif type == 'l':
257 elif type == 'l':
258 id, name = data
258 id, name = data
259 ui.note(('tag %s\n' % name))
259 ui.note(('tag %s\n' % name))
260 tags.append("%s %s\n" % (hex(repo.changelog.node(id)), name))
260 tags.append("%s %s\n" % (hex(repo.changelog.node(id)), name))
261 elif type == 'a':
261 elif type == 'a':
262 ui.note(('branch %s\n' % data))
262 ui.note(('branch %s\n' % data))
263 atbranch = data
263 atbranch = data
264 progress.update(id)
264 progress.update(id)
265
265
266 if tags:
266 if tags:
267 repo.vfs.write("localtags", "".join(tags))
267 repo.vfs.write("localtags", "".join(tags))
268
268
269 def _debugchangegroup(ui, gen, all=None, indent=0, **opts):
269 def _debugchangegroup(ui, gen, all=None, indent=0, **opts):
270 indent_string = ' ' * indent
270 indent_string = ' ' * indent
271 if all:
271 if all:
272 ui.write(("%sformat: id, p1, p2, cset, delta base, len(delta)\n")
272 ui.write(("%sformat: id, p1, p2, cset, delta base, len(delta)\n")
273 % indent_string)
273 % indent_string)
274
274
275 def showchunks(named):
275 def showchunks(named):
276 ui.write("\n%s%s\n" % (indent_string, named))
276 ui.write("\n%s%s\n" % (indent_string, named))
277 for deltadata in gen.deltaiter():
277 for deltadata in gen.deltaiter():
278 node, p1, p2, cs, deltabase, delta, flags = deltadata
278 node, p1, p2, cs, deltabase, delta, flags = deltadata
279 ui.write("%s%s %s %s %s %s %d\n" %
279 ui.write("%s%s %s %s %s %s %d\n" %
280 (indent_string, hex(node), hex(p1), hex(p2),
280 (indent_string, hex(node), hex(p1), hex(p2),
281 hex(cs), hex(deltabase), len(delta)))
281 hex(cs), hex(deltabase), len(delta)))
282
282
283 chunkdata = gen.changelogheader()
283 chunkdata = gen.changelogheader()
284 showchunks("changelog")
284 showchunks("changelog")
285 chunkdata = gen.manifestheader()
285 chunkdata = gen.manifestheader()
286 showchunks("manifest")
286 showchunks("manifest")
287 for chunkdata in iter(gen.filelogheader, {}):
287 for chunkdata in iter(gen.filelogheader, {}):
288 fname = chunkdata['filename']
288 fname = chunkdata['filename']
289 showchunks(fname)
289 showchunks(fname)
290 else:
290 else:
291 if isinstance(gen, bundle2.unbundle20):
291 if isinstance(gen, bundle2.unbundle20):
292 raise error.Abort(_('use debugbundle2 for this file'))
292 raise error.Abort(_('use debugbundle2 for this file'))
293 chunkdata = gen.changelogheader()
293 chunkdata = gen.changelogheader()
294 for deltadata in gen.deltaiter():
294 for deltadata in gen.deltaiter():
295 node, p1, p2, cs, deltabase, delta, flags = deltadata
295 node, p1, p2, cs, deltabase, delta, flags = deltadata
296 ui.write("%s%s\n" % (indent_string, hex(node)))
296 ui.write("%s%s\n" % (indent_string, hex(node)))
297
297
298 def _debugobsmarkers(ui, part, indent=0, **opts):
298 def _debugobsmarkers(ui, part, indent=0, **opts):
299 """display version and markers contained in 'data'"""
299 """display version and markers contained in 'data'"""
300 opts = pycompat.byteskwargs(opts)
300 opts = pycompat.byteskwargs(opts)
301 data = part.read()
301 data = part.read()
302 indent_string = ' ' * indent
302 indent_string = ' ' * indent
303 try:
303 try:
304 version, markers = obsolete._readmarkers(data)
304 version, markers = obsolete._readmarkers(data)
305 except error.UnknownVersion as exc:
305 except error.UnknownVersion as exc:
306 msg = "%sunsupported version: %s (%d bytes)\n"
306 msg = "%sunsupported version: %s (%d bytes)\n"
307 msg %= indent_string, exc.version, len(data)
307 msg %= indent_string, exc.version, len(data)
308 ui.write(msg)
308 ui.write(msg)
309 else:
309 else:
310 msg = "%sversion: %d (%d bytes)\n"
310 msg = "%sversion: %d (%d bytes)\n"
311 msg %= indent_string, version, len(data)
311 msg %= indent_string, version, len(data)
312 ui.write(msg)
312 ui.write(msg)
313 fm = ui.formatter('debugobsolete', opts)
313 fm = ui.formatter('debugobsolete', opts)
314 for rawmarker in sorted(markers):
314 for rawmarker in sorted(markers):
315 m = obsutil.marker(None, rawmarker)
315 m = obsutil.marker(None, rawmarker)
316 fm.startitem()
316 fm.startitem()
317 fm.plain(indent_string)
317 fm.plain(indent_string)
318 cmdutil.showmarker(fm, m)
318 cmdutil.showmarker(fm, m)
319 fm.end()
319 fm.end()
320
320
321 def _debugphaseheads(ui, data, indent=0):
321 def _debugphaseheads(ui, data, indent=0):
322 """display version and markers contained in 'data'"""
322 """display version and markers contained in 'data'"""
323 indent_string = ' ' * indent
323 indent_string = ' ' * indent
324 headsbyphase = phases.binarydecode(data)
324 headsbyphase = phases.binarydecode(data)
325 for phase in phases.allphases:
325 for phase in phases.allphases:
326 for head in headsbyphase[phase]:
326 for head in headsbyphase[phase]:
327 ui.write(indent_string)
327 ui.write(indent_string)
328 ui.write('%s %s\n' % (hex(head), phases.phasenames[phase]))
328 ui.write('%s %s\n' % (hex(head), phases.phasenames[phase]))
329
329
330 def _quasirepr(thing):
330 def _quasirepr(thing):
331 if isinstance(thing, (dict, util.sortdict, collections.OrderedDict)):
331 if isinstance(thing, (dict, util.sortdict, collections.OrderedDict)):
332 return '{%s}' % (
332 return '{%s}' % (
333 b', '.join(b'%s: %s' % (k, thing[k]) for k in sorted(thing)))
333 b', '.join(b'%s: %s' % (k, thing[k]) for k in sorted(thing)))
334 return pycompat.bytestr(repr(thing))
334 return pycompat.bytestr(repr(thing))
335
335
336 def _debugbundle2(ui, gen, all=None, **opts):
336 def _debugbundle2(ui, gen, all=None, **opts):
337 """lists the contents of a bundle2"""
337 """lists the contents of a bundle2"""
338 if not isinstance(gen, bundle2.unbundle20):
338 if not isinstance(gen, bundle2.unbundle20):
339 raise error.Abort(_('not a bundle2 file'))
339 raise error.Abort(_('not a bundle2 file'))
340 ui.write(('Stream params: %s\n' % _quasirepr(gen.params)))
340 ui.write(('Stream params: %s\n' % _quasirepr(gen.params)))
341 parttypes = opts.get(r'part_type', [])
341 parttypes = opts.get(r'part_type', [])
342 for part in gen.iterparts():
342 for part in gen.iterparts():
343 if parttypes and part.type not in parttypes:
343 if parttypes and part.type not in parttypes:
344 continue
344 continue
345 msg = '%s -- %s (mandatory: %r)\n'
345 msg = '%s -- %s (mandatory: %r)\n'
346 ui.write((msg % (part.type, _quasirepr(part.params), part.mandatory)))
346 ui.write((msg % (part.type, _quasirepr(part.params), part.mandatory)))
347 if part.type == 'changegroup':
347 if part.type == 'changegroup':
348 version = part.params.get('version', '01')
348 version = part.params.get('version', '01')
349 cg = changegroup.getunbundler(version, part, 'UN')
349 cg = changegroup.getunbundler(version, part, 'UN')
350 if not ui.quiet:
350 if not ui.quiet:
351 _debugchangegroup(ui, cg, all=all, indent=4, **opts)
351 _debugchangegroup(ui, cg, all=all, indent=4, **opts)
352 if part.type == 'obsmarkers':
352 if part.type == 'obsmarkers':
353 if not ui.quiet:
353 if not ui.quiet:
354 _debugobsmarkers(ui, part, indent=4, **opts)
354 _debugobsmarkers(ui, part, indent=4, **opts)
355 if part.type == 'phase-heads':
355 if part.type == 'phase-heads':
356 if not ui.quiet:
356 if not ui.quiet:
357 _debugphaseheads(ui, part, indent=4)
357 _debugphaseheads(ui, part, indent=4)
358
358
359 @command('debugbundle',
359 @command('debugbundle',
360 [('a', 'all', None, _('show all details')),
360 [('a', 'all', None, _('show all details')),
361 ('', 'part-type', [], _('show only the named part type')),
361 ('', 'part-type', [], _('show only the named part type')),
362 ('', 'spec', None, _('print the bundlespec of the bundle'))],
362 ('', 'spec', None, _('print the bundlespec of the bundle'))],
363 _('FILE'),
363 _('FILE'),
364 norepo=True)
364 norepo=True)
365 def debugbundle(ui, bundlepath, all=None, spec=None, **opts):
365 def debugbundle(ui, bundlepath, all=None, spec=None, **opts):
366 """lists the contents of a bundle"""
366 """lists the contents of a bundle"""
367 with hg.openpath(ui, bundlepath) as f:
367 with hg.openpath(ui, bundlepath) as f:
368 if spec:
368 if spec:
369 spec = exchange.getbundlespec(ui, f)
369 spec = exchange.getbundlespec(ui, f)
370 ui.write('%s\n' % spec)
370 ui.write('%s\n' % spec)
371 return
371 return
372
372
373 gen = exchange.readbundle(ui, f, bundlepath)
373 gen = exchange.readbundle(ui, f, bundlepath)
374 if isinstance(gen, bundle2.unbundle20):
374 if isinstance(gen, bundle2.unbundle20):
375 return _debugbundle2(ui, gen, all=all, **opts)
375 return _debugbundle2(ui, gen, all=all, **opts)
376 _debugchangegroup(ui, gen, all=all, **opts)
376 _debugchangegroup(ui, gen, all=all, **opts)
377
377
378 @command('debugcapabilities',
378 @command('debugcapabilities',
379 [], _('PATH'),
379 [], _('PATH'),
380 norepo=True)
380 norepo=True)
381 def debugcapabilities(ui, path, **opts):
381 def debugcapabilities(ui, path, **opts):
382 """lists the capabilities of a remote peer"""
382 """lists the capabilities of a remote peer"""
383 opts = pycompat.byteskwargs(opts)
383 opts = pycompat.byteskwargs(opts)
384 peer = hg.peer(ui, opts, path)
384 peer = hg.peer(ui, opts, path)
385 caps = peer.capabilities()
385 caps = peer.capabilities()
386 ui.write(('Main capabilities:\n'))
386 ui.write(('Main capabilities:\n'))
387 for c in sorted(caps):
387 for c in sorted(caps):
388 ui.write((' %s\n') % c)
388 ui.write((' %s\n') % c)
389 b2caps = bundle2.bundle2caps(peer)
389 b2caps = bundle2.bundle2caps(peer)
390 if b2caps:
390 if b2caps:
391 ui.write(('Bundle2 capabilities:\n'))
391 ui.write(('Bundle2 capabilities:\n'))
392 for key, values in sorted(b2caps.iteritems()):
392 for key, values in sorted(b2caps.iteritems()):
393 ui.write((' %s\n') % key)
393 ui.write((' %s\n') % key)
394 for v in values:
394 for v in values:
395 ui.write((' %s\n') % v)
395 ui.write((' %s\n') % v)
396
396
397 @command('debugcheckstate', [], '')
397 @command('debugcheckstate', [], '')
398 def debugcheckstate(ui, repo):
398 def debugcheckstate(ui, repo):
399 """validate the correctness of the current dirstate"""
399 """validate the correctness of the current dirstate"""
400 parent1, parent2 = repo.dirstate.parents()
400 parent1, parent2 = repo.dirstate.parents()
401 m1 = repo[parent1].manifest()
401 m1 = repo[parent1].manifest()
402 m2 = repo[parent2].manifest()
402 m2 = repo[parent2].manifest()
403 errors = 0
403 errors = 0
404 for f in repo.dirstate:
404 for f in repo.dirstate:
405 state = repo.dirstate[f]
405 state = repo.dirstate[f]
406 if state in "nr" and f not in m1:
406 if state in "nr" and f not in m1:
407 ui.warn(_("%s in state %s, but not in manifest1\n") % (f, state))
407 ui.warn(_("%s in state %s, but not in manifest1\n") % (f, state))
408 errors += 1
408 errors += 1
409 if state in "a" and f in m1:
409 if state in "a" and f in m1:
410 ui.warn(_("%s in state %s, but also in manifest1\n") % (f, state))
410 ui.warn(_("%s in state %s, but also in manifest1\n") % (f, state))
411 errors += 1
411 errors += 1
412 if state in "m" and f not in m1 and f not in m2:
412 if state in "m" and f not in m1 and f not in m2:
413 ui.warn(_("%s in state %s, but not in either manifest\n") %
413 ui.warn(_("%s in state %s, but not in either manifest\n") %
414 (f, state))
414 (f, state))
415 errors += 1
415 errors += 1
416 for f in m1:
416 for f in m1:
417 state = repo.dirstate[f]
417 state = repo.dirstate[f]
418 if state not in "nrm":
418 if state not in "nrm":
419 ui.warn(_("%s in manifest1, but listed as state %s") % (f, state))
419 ui.warn(_("%s in manifest1, but listed as state %s") % (f, state))
420 errors += 1
420 errors += 1
421 if errors:
421 if errors:
422 error = _(".hg/dirstate inconsistent with current parent's manifest")
422 error = _(".hg/dirstate inconsistent with current parent's manifest")
423 raise error.Abort(error)
423 raise error.Abort(error)
424
424
425 @command('debugcolor',
425 @command('debugcolor',
426 [('', 'style', None, _('show all configured styles'))],
426 [('', 'style', None, _('show all configured styles'))],
427 'hg debugcolor')
427 'hg debugcolor')
428 def debugcolor(ui, repo, **opts):
428 def debugcolor(ui, repo, **opts):
429 """show available color, effects or style"""
429 """show available color, effects or style"""
430 ui.write(('color mode: %s\n') % stringutil.pprint(ui._colormode))
430 ui.write(('color mode: %s\n') % stringutil.pprint(ui._colormode))
431 if opts.get(r'style'):
431 if opts.get(r'style'):
432 return _debugdisplaystyle(ui)
432 return _debugdisplaystyle(ui)
433 else:
433 else:
434 return _debugdisplaycolor(ui)
434 return _debugdisplaycolor(ui)
435
435
436 def _debugdisplaycolor(ui):
436 def _debugdisplaycolor(ui):
437 ui = ui.copy()
437 ui = ui.copy()
438 ui._styles.clear()
438 ui._styles.clear()
439 for effect in color._activeeffects(ui).keys():
439 for effect in color._activeeffects(ui).keys():
440 ui._styles[effect] = effect
440 ui._styles[effect] = effect
441 if ui._terminfoparams:
441 if ui._terminfoparams:
442 for k, v in ui.configitems('color'):
442 for k, v in ui.configitems('color'):
443 if k.startswith('color.'):
443 if k.startswith('color.'):
444 ui._styles[k] = k[6:]
444 ui._styles[k] = k[6:]
445 elif k.startswith('terminfo.'):
445 elif k.startswith('terminfo.'):
446 ui._styles[k] = k[9:]
446 ui._styles[k] = k[9:]
447 ui.write(_('available colors:\n'))
447 ui.write(_('available colors:\n'))
448 # sort label with a '_' after the other to group '_background' entry.
448 # sort label with a '_' after the other to group '_background' entry.
449 items = sorted(ui._styles.items(),
449 items = sorted(ui._styles.items(),
450 key=lambda i: ('_' in i[0], i[0], i[1]))
450 key=lambda i: ('_' in i[0], i[0], i[1]))
451 for colorname, label in items:
451 for colorname, label in items:
452 ui.write(('%s\n') % colorname, label=label)
452 ui.write(('%s\n') % colorname, label=label)
453
453
454 def _debugdisplaystyle(ui):
454 def _debugdisplaystyle(ui):
455 ui.write(_('available style:\n'))
455 ui.write(_('available style:\n'))
456 if not ui._styles:
456 if not ui._styles:
457 return
457 return
458 width = max(len(s) for s in ui._styles)
458 width = max(len(s) for s in ui._styles)
459 for label, effects in sorted(ui._styles.items()):
459 for label, effects in sorted(ui._styles.items()):
460 ui.write('%s' % label, label=label)
460 ui.write('%s' % label, label=label)
461 if effects:
461 if effects:
462 # 50
462 # 50
463 ui.write(': ')
463 ui.write(': ')
464 ui.write(' ' * (max(0, width - len(label))))
464 ui.write(' ' * (max(0, width - len(label))))
465 ui.write(', '.join(ui.label(e, e) for e in effects.split()))
465 ui.write(', '.join(ui.label(e, e) for e in effects.split()))
466 ui.write('\n')
466 ui.write('\n')
467
467
468 @command('debugcreatestreamclonebundle', [], 'FILE')
468 @command('debugcreatestreamclonebundle', [], 'FILE')
469 def debugcreatestreamclonebundle(ui, repo, fname):
469 def debugcreatestreamclonebundle(ui, repo, fname):
470 """create a stream clone bundle file
470 """create a stream clone bundle file
471
471
472 Stream bundles are special bundles that are essentially archives of
472 Stream bundles are special bundles that are essentially archives of
473 revlog files. They are commonly used for cloning very quickly.
473 revlog files. They are commonly used for cloning very quickly.
474 """
474 """
475 # TODO we may want to turn this into an abort when this functionality
475 # TODO we may want to turn this into an abort when this functionality
476 # is moved into `hg bundle`.
476 # is moved into `hg bundle`.
477 if phases.hassecret(repo):
477 if phases.hassecret(repo):
478 ui.warn(_('(warning: stream clone bundle will contain secret '
478 ui.warn(_('(warning: stream clone bundle will contain secret '
479 'revisions)\n'))
479 'revisions)\n'))
480
480
481 requirements, gen = streamclone.generatebundlev1(repo)
481 requirements, gen = streamclone.generatebundlev1(repo)
482 changegroup.writechunks(ui, gen, fname)
482 changegroup.writechunks(ui, gen, fname)
483
483
484 ui.write(_('bundle requirements: %s\n') % ', '.join(sorted(requirements)))
484 ui.write(_('bundle requirements: %s\n') % ', '.join(sorted(requirements)))
485
485
486 @command('debugdag',
486 @command('debugdag',
487 [('t', 'tags', None, _('use tags as labels')),
487 [('t', 'tags', None, _('use tags as labels')),
488 ('b', 'branches', None, _('annotate with branch names')),
488 ('b', 'branches', None, _('annotate with branch names')),
489 ('', 'dots', None, _('use dots for runs')),
489 ('', 'dots', None, _('use dots for runs')),
490 ('s', 'spaces', None, _('separate elements by spaces'))],
490 ('s', 'spaces', None, _('separate elements by spaces'))],
491 _('[OPTION]... [FILE [REV]...]'),
491 _('[OPTION]... [FILE [REV]...]'),
492 optionalrepo=True)
492 optionalrepo=True)
493 def debugdag(ui, repo, file_=None, *revs, **opts):
493 def debugdag(ui, repo, file_=None, *revs, **opts):
494 """format the changelog or an index DAG as a concise textual description
494 """format the changelog or an index DAG as a concise textual description
495
495
496 If you pass a revlog index, the revlog's DAG is emitted. If you list
496 If you pass a revlog index, the revlog's DAG is emitted. If you list
497 revision numbers, they get labeled in the output as rN.
497 revision numbers, they get labeled in the output as rN.
498
498
499 Otherwise, the changelog DAG of the current repo is emitted.
499 Otherwise, the changelog DAG of the current repo is emitted.
500 """
500 """
501 spaces = opts.get(r'spaces')
501 spaces = opts.get(r'spaces')
502 dots = opts.get(r'dots')
502 dots = opts.get(r'dots')
503 if file_:
503 if file_:
504 rlog = revlog.revlog(vfsmod.vfs(pycompat.getcwd(), audit=False),
504 rlog = revlog.revlog(vfsmod.vfs(pycompat.getcwd(), audit=False),
505 file_)
505 file_)
506 revs = set((int(r) for r in revs))
506 revs = set((int(r) for r in revs))
507 def events():
507 def events():
508 for r in rlog:
508 for r in rlog:
509 yield 'n', (r, list(p for p in rlog.parentrevs(r)
509 yield 'n', (r, list(p for p in rlog.parentrevs(r)
510 if p != -1))
510 if p != -1))
511 if r in revs:
511 if r in revs:
512 yield 'l', (r, "r%i" % r)
512 yield 'l', (r, "r%i" % r)
513 elif repo:
513 elif repo:
514 cl = repo.changelog
514 cl = repo.changelog
515 tags = opts.get(r'tags')
515 tags = opts.get(r'tags')
516 branches = opts.get(r'branches')
516 branches = opts.get(r'branches')
517 if tags:
517 if tags:
518 labels = {}
518 labels = {}
519 for l, n in repo.tags().items():
519 for l, n in repo.tags().items():
520 labels.setdefault(cl.rev(n), []).append(l)
520 labels.setdefault(cl.rev(n), []).append(l)
521 def events():
521 def events():
522 b = "default"
522 b = "default"
523 for r in cl:
523 for r in cl:
524 if branches:
524 if branches:
525 newb = cl.read(cl.node(r))[5]['branch']
525 newb = cl.read(cl.node(r))[5]['branch']
526 if newb != b:
526 if newb != b:
527 yield 'a', newb
527 yield 'a', newb
528 b = newb
528 b = newb
529 yield 'n', (r, list(p for p in cl.parentrevs(r)
529 yield 'n', (r, list(p for p in cl.parentrevs(r)
530 if p != -1))
530 if p != -1))
531 if tags:
531 if tags:
532 ls = labels.get(r)
532 ls = labels.get(r)
533 if ls:
533 if ls:
534 for l in ls:
534 for l in ls:
535 yield 'l', (r, l)
535 yield 'l', (r, l)
536 else:
536 else:
537 raise error.Abort(_('need repo for changelog dag'))
537 raise error.Abort(_('need repo for changelog dag'))
538
538
539 for line in dagparser.dagtextlines(events(),
539 for line in dagparser.dagtextlines(events(),
540 addspaces=spaces,
540 addspaces=spaces,
541 wraplabels=True,
541 wraplabels=True,
542 wrapannotations=True,
542 wrapannotations=True,
543 wrapnonlinear=dots,
543 wrapnonlinear=dots,
544 usedots=dots,
544 usedots=dots,
545 maxlinewidth=70):
545 maxlinewidth=70):
546 ui.write(line)
546 ui.write(line)
547 ui.write("\n")
547 ui.write("\n")
548
548
549 @command('debugdata', cmdutil.debugrevlogopts, _('-c|-m|FILE REV'))
549 @command('debugdata', cmdutil.debugrevlogopts, _('-c|-m|FILE REV'))
550 def debugdata(ui, repo, file_, rev=None, **opts):
550 def debugdata(ui, repo, file_, rev=None, **opts):
551 """dump the contents of a data file revision"""
551 """dump the contents of a data file revision"""
552 opts = pycompat.byteskwargs(opts)
552 opts = pycompat.byteskwargs(opts)
553 if opts.get('changelog') or opts.get('manifest') or opts.get('dir'):
553 if opts.get('changelog') or opts.get('manifest') or opts.get('dir'):
554 if rev is not None:
554 if rev is not None:
555 raise error.CommandError('debugdata', _('invalid arguments'))
555 raise error.CommandError('debugdata', _('invalid arguments'))
556 file_, rev = None, file_
556 file_, rev = None, file_
557 elif rev is None:
557 elif rev is None:
558 raise error.CommandError('debugdata', _('invalid arguments'))
558 raise error.CommandError('debugdata', _('invalid arguments'))
559 r = cmdutil.openstorage(repo, 'debugdata', file_, opts)
559 r = cmdutil.openstorage(repo, 'debugdata', file_, opts)
560 try:
560 try:
561 ui.write(r.revision(r.lookup(rev), raw=True))
561 ui.write(r.revision(r.lookup(rev), raw=True))
562 except KeyError:
562 except KeyError:
563 raise error.Abort(_('invalid revision identifier %s') % rev)
563 raise error.Abort(_('invalid revision identifier %s') % rev)
564
564
565 @command('debugdate',
565 @command('debugdate',
566 [('e', 'extended', None, _('try extended date formats'))],
566 [('e', 'extended', None, _('try extended date formats'))],
567 _('[-e] DATE [RANGE]'),
567 _('[-e] DATE [RANGE]'),
568 norepo=True, optionalrepo=True)
568 norepo=True, optionalrepo=True)
569 def debugdate(ui, date, range=None, **opts):
569 def debugdate(ui, date, range=None, **opts):
570 """parse and display a date"""
570 """parse and display a date"""
571 if opts[r"extended"]:
571 if opts[r"extended"]:
572 d = dateutil.parsedate(date, util.extendeddateformats)
572 d = dateutil.parsedate(date, util.extendeddateformats)
573 else:
573 else:
574 d = dateutil.parsedate(date)
574 d = dateutil.parsedate(date)
575 ui.write(("internal: %d %d\n") % d)
575 ui.write(("internal: %d %d\n") % d)
576 ui.write(("standard: %s\n") % dateutil.datestr(d))
576 ui.write(("standard: %s\n") % dateutil.datestr(d))
577 if range:
577 if range:
578 m = dateutil.matchdate(range)
578 m = dateutil.matchdate(range)
579 ui.write(("match: %s\n") % m(d[0]))
579 ui.write(("match: %s\n") % m(d[0]))
580
580
581 @command('debugdeltachain',
581 @command('debugdeltachain',
582 cmdutil.debugrevlogopts + cmdutil.formatteropts,
582 cmdutil.debugrevlogopts + cmdutil.formatteropts,
583 _('-c|-m|FILE'),
583 _('-c|-m|FILE'),
584 optionalrepo=True)
584 optionalrepo=True)
585 def debugdeltachain(ui, repo, file_=None, **opts):
585 def debugdeltachain(ui, repo, file_=None, **opts):
586 """dump information about delta chains in a revlog
586 """dump information about delta chains in a revlog
587
587
588 Output can be templatized. Available template keywords are:
588 Output can be templatized. Available template keywords are:
589
589
590 :``rev``: revision number
590 :``rev``: revision number
591 :``chainid``: delta chain identifier (numbered by unique base)
591 :``chainid``: delta chain identifier (numbered by unique base)
592 :``chainlen``: delta chain length to this revision
592 :``chainlen``: delta chain length to this revision
593 :``prevrev``: previous revision in delta chain
593 :``prevrev``: previous revision in delta chain
594 :``deltatype``: role of delta / how it was computed
594 :``deltatype``: role of delta / how it was computed
595 :``compsize``: compressed size of revision
595 :``compsize``: compressed size of revision
596 :``uncompsize``: uncompressed size of revision
596 :``uncompsize``: uncompressed size of revision
597 :``chainsize``: total size of compressed revisions in chain
597 :``chainsize``: total size of compressed revisions in chain
598 :``chainratio``: total chain size divided by uncompressed revision size
598 :``chainratio``: total chain size divided by uncompressed revision size
599 (new delta chains typically start at ratio 2.00)
599 (new delta chains typically start at ratio 2.00)
600 :``lindist``: linear distance from base revision in delta chain to end
600 :``lindist``: linear distance from base revision in delta chain to end
601 of this revision
601 of this revision
602 :``extradist``: total size of revisions not part of this delta chain from
602 :``extradist``: total size of revisions not part of this delta chain from
603 base of delta chain to end of this revision; a measurement
603 base of delta chain to end of this revision; a measurement
604 of how much extra data we need to read/seek across to read
604 of how much extra data we need to read/seek across to read
605 the delta chain for this revision
605 the delta chain for this revision
606 :``extraratio``: extradist divided by chainsize; another representation of
606 :``extraratio``: extradist divided by chainsize; another representation of
607 how much unrelated data is needed to load this delta chain
607 how much unrelated data is needed to load this delta chain
608
608
609 If the repository is configured to use the sparse read, additional keywords
609 If the repository is configured to use the sparse read, additional keywords
610 are available:
610 are available:
611
611
612 :``readsize``: total size of data read from the disk for a revision
612 :``readsize``: total size of data read from the disk for a revision
613 (sum of the sizes of all the blocks)
613 (sum of the sizes of all the blocks)
614 :``largestblock``: size of the largest block of data read from the disk
614 :``largestblock``: size of the largest block of data read from the disk
615 :``readdensity``: density of useful bytes in the data read from the disk
615 :``readdensity``: density of useful bytes in the data read from the disk
616 :``srchunks``: in how many data hunks the whole revision would be read
616 :``srchunks``: in how many data hunks the whole revision would be read
617
617
618 The sparse read can be enabled with experimental.sparse-read = True
618 The sparse read can be enabled with experimental.sparse-read = True
619 """
619 """
620 opts = pycompat.byteskwargs(opts)
620 opts = pycompat.byteskwargs(opts)
621 r = cmdutil.openrevlog(repo, 'debugdeltachain', file_, opts)
621 r = cmdutil.openrevlog(repo, 'debugdeltachain', file_, opts)
622 index = r.index
622 index = r.index
623 start = r.start
623 start = r.start
624 length = r.length
624 length = r.length
625 generaldelta = r.version & revlog.FLAG_GENERALDELTA
625 generaldelta = r.version & revlog.FLAG_GENERALDELTA
626 withsparseread = getattr(r, '_withsparseread', False)
626 withsparseread = getattr(r, '_withsparseread', False)
627
627
628 def revinfo(rev):
628 def revinfo(rev):
629 e = index[rev]
629 e = index[rev]
630 compsize = e[1]
630 compsize = e[1]
631 uncompsize = e[2]
631 uncompsize = e[2]
632 chainsize = 0
632 chainsize = 0
633
633
634 if generaldelta:
634 if generaldelta:
635 if e[3] == e[5]:
635 if e[3] == e[5]:
636 deltatype = 'p1'
636 deltatype = 'p1'
637 elif e[3] == e[6]:
637 elif e[3] == e[6]:
638 deltatype = 'p2'
638 deltatype = 'p2'
639 elif e[3] == rev - 1:
639 elif e[3] == rev - 1:
640 deltatype = 'prev'
640 deltatype = 'prev'
641 elif e[3] == rev:
641 elif e[3] == rev:
642 deltatype = 'base'
642 deltatype = 'base'
643 else:
643 else:
644 deltatype = 'other'
644 deltatype = 'other'
645 else:
645 else:
646 if e[3] == rev:
646 if e[3] == rev:
647 deltatype = 'base'
647 deltatype = 'base'
648 else:
648 else:
649 deltatype = 'prev'
649 deltatype = 'prev'
650
650
651 chain = r._deltachain(rev)[0]
651 chain = r._deltachain(rev)[0]
652 for iterrev in chain:
652 for iterrev in chain:
653 e = index[iterrev]
653 e = index[iterrev]
654 chainsize += e[1]
654 chainsize += e[1]
655
655
656 return compsize, uncompsize, deltatype, chain, chainsize
656 return compsize, uncompsize, deltatype, chain, chainsize
657
657
658 fm = ui.formatter('debugdeltachain', opts)
658 fm = ui.formatter('debugdeltachain', opts)
659
659
660 fm.plain(' rev chain# chainlen prev delta '
660 fm.plain(' rev chain# chainlen prev delta '
661 'size rawsize chainsize ratio lindist extradist '
661 'size rawsize chainsize ratio lindist extradist '
662 'extraratio')
662 'extraratio')
663 if withsparseread:
663 if withsparseread:
664 fm.plain(' readsize largestblk rddensity srchunks')
664 fm.plain(' readsize largestblk rddensity srchunks')
665 fm.plain('\n')
665 fm.plain('\n')
666
666
667 chainbases = {}
667 chainbases = {}
668 for rev in r:
668 for rev in r:
669 comp, uncomp, deltatype, chain, chainsize = revinfo(rev)
669 comp, uncomp, deltatype, chain, chainsize = revinfo(rev)
670 chainbase = chain[0]
670 chainbase = chain[0]
671 chainid = chainbases.setdefault(chainbase, len(chainbases) + 1)
671 chainid = chainbases.setdefault(chainbase, len(chainbases) + 1)
672 basestart = start(chainbase)
672 basestart = start(chainbase)
673 revstart = start(rev)
673 revstart = start(rev)
674 lineardist = revstart + comp - basestart
674 lineardist = revstart + comp - basestart
675 extradist = lineardist - chainsize
675 extradist = lineardist - chainsize
676 try:
676 try:
677 prevrev = chain[-2]
677 prevrev = chain[-2]
678 except IndexError:
678 except IndexError:
679 prevrev = -1
679 prevrev = -1
680
680
681 if uncomp != 0:
681 if uncomp != 0:
682 chainratio = float(chainsize) / float(uncomp)
682 chainratio = float(chainsize) / float(uncomp)
683 else:
683 else:
684 chainratio = chainsize
684 chainratio = chainsize
685
685
686 if chainsize != 0:
686 if chainsize != 0:
687 extraratio = float(extradist) / float(chainsize)
687 extraratio = float(extradist) / float(chainsize)
688 else:
688 else:
689 extraratio = extradist
689 extraratio = extradist
690
690
691 fm.startitem()
691 fm.startitem()
692 fm.write('rev chainid chainlen prevrev deltatype compsize '
692 fm.write('rev chainid chainlen prevrev deltatype compsize '
693 'uncompsize chainsize chainratio lindist extradist '
693 'uncompsize chainsize chainratio lindist extradist '
694 'extraratio',
694 'extraratio',
695 '%7d %7d %8d %8d %7s %10d %10d %10d %9.5f %9d %9d %10.5f',
695 '%7d %7d %8d %8d %7s %10d %10d %10d %9.5f %9d %9d %10.5f',
696 rev, chainid, len(chain), prevrev, deltatype, comp,
696 rev, chainid, len(chain), prevrev, deltatype, comp,
697 uncomp, chainsize, chainratio, lineardist, extradist,
697 uncomp, chainsize, chainratio, lineardist, extradist,
698 extraratio,
698 extraratio,
699 rev=rev, chainid=chainid, chainlen=len(chain),
699 rev=rev, chainid=chainid, chainlen=len(chain),
700 prevrev=prevrev, deltatype=deltatype, compsize=comp,
700 prevrev=prevrev, deltatype=deltatype, compsize=comp,
701 uncompsize=uncomp, chainsize=chainsize,
701 uncompsize=uncomp, chainsize=chainsize,
702 chainratio=chainratio, lindist=lineardist,
702 chainratio=chainratio, lindist=lineardist,
703 extradist=extradist, extraratio=extraratio)
703 extradist=extradist, extraratio=extraratio)
704 if withsparseread:
704 if withsparseread:
705 readsize = 0
705 readsize = 0
706 largestblock = 0
706 largestblock = 0
707 srchunks = 0
707 srchunks = 0
708
708
709 for revschunk in revlog._slicechunk(r, chain):
709 for revschunk in revlog._slicechunk(r, chain):
710 srchunks += 1
710 srchunks += 1
711 blkend = start(revschunk[-1]) + length(revschunk[-1])
711 blkend = start(revschunk[-1]) + length(revschunk[-1])
712 blksize = blkend - start(revschunk[0])
712 blksize = blkend - start(revschunk[0])
713
713
714 readsize += blksize
714 readsize += blksize
715 if largestblock < blksize:
715 if largestblock < blksize:
716 largestblock = blksize
716 largestblock = blksize
717
717
718 if readsize:
718 if readsize:
719 readdensity = float(chainsize) / float(readsize)
719 readdensity = float(chainsize) / float(readsize)
720 else:
720 else:
721 readdensity = 1
721 readdensity = 1
722
722
723 fm.write('readsize largestblock readdensity srchunks',
723 fm.write('readsize largestblock readdensity srchunks',
724 ' %10d %10d %9.5f %8d',
724 ' %10d %10d %9.5f %8d',
725 readsize, largestblock, readdensity, srchunks,
725 readsize, largestblock, readdensity, srchunks,
726 readsize=readsize, largestblock=largestblock,
726 readsize=readsize, largestblock=largestblock,
727 readdensity=readdensity, srchunks=srchunks)
727 readdensity=readdensity, srchunks=srchunks)
728
728
729 fm.plain('\n')
729 fm.plain('\n')
730
730
731 fm.end()
731 fm.end()
732
732
733 @command('debugdirstate|debugstate',
733 @command('debugdirstate|debugstate',
734 [('', 'nodates', None, _('do not display the saved mtime')),
734 [('', 'nodates', None, _('do not display the saved mtime')),
735 ('', 'datesort', None, _('sort by saved mtime'))],
735 ('', 'datesort', None, _('sort by saved mtime'))],
736 _('[OPTION]...'))
736 _('[OPTION]...'))
737 def debugstate(ui, repo, **opts):
737 def debugstate(ui, repo, **opts):
738 """show the contents of the current dirstate"""
738 """show the contents of the current dirstate"""
739
739
740 nodates = opts.get(r'nodates')
740 nodates = opts.get(r'nodates')
741 datesort = opts.get(r'datesort')
741 datesort = opts.get(r'datesort')
742
742
743 timestr = ""
743 timestr = ""
744 if datesort:
744 if datesort:
745 keyfunc = lambda x: (x[1][3], x[0]) # sort by mtime, then by filename
745 keyfunc = lambda x: (x[1][3], x[0]) # sort by mtime, then by filename
746 else:
746 else:
747 keyfunc = None # sort by filename
747 keyfunc = None # sort by filename
748 for file_, ent in sorted(repo.dirstate._map.iteritems(), key=keyfunc):
748 for file_, ent in sorted(repo.dirstate._map.iteritems(), key=keyfunc):
749 if ent[3] == -1:
749 if ent[3] == -1:
750 timestr = 'unset '
750 timestr = 'unset '
751 elif nodates:
751 elif nodates:
752 timestr = 'set '
752 timestr = 'set '
753 else:
753 else:
754 timestr = time.strftime(r"%Y-%m-%d %H:%M:%S ",
754 timestr = time.strftime(r"%Y-%m-%d %H:%M:%S ",
755 time.localtime(ent[3]))
755 time.localtime(ent[3]))
756 timestr = encoding.strtolocal(timestr)
756 timestr = encoding.strtolocal(timestr)
757 if ent[1] & 0o20000:
757 if ent[1] & 0o20000:
758 mode = 'lnk'
758 mode = 'lnk'
759 else:
759 else:
760 mode = '%3o' % (ent[1] & 0o777 & ~util.umask)
760 mode = '%3o' % (ent[1] & 0o777 & ~util.umask)
761 ui.write("%c %s %10d %s%s\n" % (ent[0], mode, ent[2], timestr, file_))
761 ui.write("%c %s %10d %s%s\n" % (ent[0], mode, ent[2], timestr, file_))
762 for f in repo.dirstate.copies():
762 for f in repo.dirstate.copies():
763 ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copied(f), f))
763 ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copied(f), f))
764
764
765 @command('debugdiscovery',
765 @command('debugdiscovery',
766 [('', 'old', None, _('use old-style discovery')),
766 [('', 'old', None, _('use old-style discovery')),
767 ('', 'nonheads', None,
767 ('', 'nonheads', None,
768 _('use old-style discovery with non-heads included')),
768 _('use old-style discovery with non-heads included')),
769 ('', 'rev', [], 'restrict discovery to this set of revs'),
769 ('', 'rev', [], 'restrict discovery to this set of revs'),
770 ] + cmdutil.remoteopts,
770 ] + cmdutil.remoteopts,
771 _('[--rev REV] [OTHER]'))
771 _('[--rev REV] [OTHER]'))
772 def debugdiscovery(ui, repo, remoteurl="default", **opts):
772 def debugdiscovery(ui, repo, remoteurl="default", **opts):
773 """runs the changeset discovery protocol in isolation"""
773 """runs the changeset discovery protocol in isolation"""
774 opts = pycompat.byteskwargs(opts)
774 opts = pycompat.byteskwargs(opts)
775 remoteurl, branches = hg.parseurl(ui.expandpath(remoteurl))
775 remoteurl, branches = hg.parseurl(ui.expandpath(remoteurl))
776 remote = hg.peer(repo, opts, remoteurl)
776 remote = hg.peer(repo, opts, remoteurl)
777 ui.status(_('comparing with %s\n') % util.hidepassword(remoteurl))
777 ui.status(_('comparing with %s\n') % util.hidepassword(remoteurl))
778
778
779 # make sure tests are repeatable
779 # make sure tests are repeatable
780 random.seed(12323)
780 random.seed(12323)
781
781
782 def doit(pushedrevs, remoteheads, remote=remote):
782 def doit(pushedrevs, remoteheads, remote=remote):
783 if opts.get('old'):
783 if opts.get('old'):
784 if not util.safehasattr(remote, 'branches'):
784 if not util.safehasattr(remote, 'branches'):
785 # enable in-client legacy support
785 # enable in-client legacy support
786 remote = localrepo.locallegacypeer(remote.local())
786 remote = localrepo.locallegacypeer(remote.local())
787 common, _in, hds = treediscovery.findcommonincoming(repo, remote,
787 common, _in, hds = treediscovery.findcommonincoming(repo, remote,
788 force=True)
788 force=True)
789 common = set(common)
789 common = set(common)
790 if not opts.get('nonheads'):
790 if not opts.get('nonheads'):
791 ui.write(("unpruned common: %s\n") %
791 ui.write(("unpruned common: %s\n") %
792 " ".join(sorted(short(n) for n in common)))
792 " ".join(sorted(short(n) for n in common)))
793
793
794 clnode = repo.changelog.node
794 clnode = repo.changelog.node
795 common = repo.revs('heads(::%ln)', common)
795 common = repo.revs('heads(::%ln)', common)
796 common = {clnode(r) for r in common}
796 common = {clnode(r) for r in common}
797 else:
797 else:
798 nodes = None
798 nodes = None
799 if pushedrevs:
799 if pushedrevs:
800 revs = scmutil.revrange(repo, pushedrevs)
800 revs = scmutil.revrange(repo, pushedrevs)
801 nodes = [repo[r].node() for r in revs]
801 nodes = [repo[r].node() for r in revs]
802 common, any, hds = setdiscovery.findcommonheads(ui, repo, remote,
802 common, any, hds = setdiscovery.findcommonheads(ui, repo, remote,
803 ancestorsof=nodes)
803 ancestorsof=nodes)
804 common = set(common)
804 common = set(common)
805 rheads = set(hds)
805 rheads = set(hds)
806 lheads = set(repo.heads())
806 lheads = set(repo.heads())
807 ui.write(("common heads: %s\n") %
807 ui.write(("common heads: %s\n") %
808 " ".join(sorted(short(n) for n in common)))
808 " ".join(sorted(short(n) for n in common)))
809 if lheads <= common:
809 if lheads <= common:
810 ui.write(("local is subset\n"))
810 ui.write(("local is subset\n"))
811 elif rheads <= common:
811 elif rheads <= common:
812 ui.write(("remote is subset\n"))
812 ui.write(("remote is subset\n"))
813
813
814 remoterevs, _checkout = hg.addbranchrevs(repo, remote, branches, revs=None)
814 remoterevs, _checkout = hg.addbranchrevs(repo, remote, branches, revs=None)
815 localrevs = opts['rev']
815 localrevs = opts['rev']
816 doit(localrevs, remoterevs)
816 doit(localrevs, remoterevs)
817
817
818 _chunksize = 4 << 10
818 _chunksize = 4 << 10
819
819
820 @command('debugdownload',
820 @command('debugdownload',
821 [
821 [
822 ('o', 'output', '', _('path')),
822 ('o', 'output', '', _('path')),
823 ],
823 ],
824 optionalrepo=True)
824 optionalrepo=True)
825 def debugdownload(ui, repo, url, output=None, **opts):
825 def debugdownload(ui, repo, url, output=None, **opts):
826 """download a resource using Mercurial logic and config
826 """download a resource using Mercurial logic and config
827 """
827 """
828 fh = urlmod.open(ui, url, output)
828 fh = urlmod.open(ui, url, output)
829
829
830 dest = ui
830 dest = ui
831 if output:
831 if output:
832 dest = open(output, "wb", _chunksize)
832 dest = open(output, "wb", _chunksize)
833 try:
833 try:
834 data = fh.read(_chunksize)
834 data = fh.read(_chunksize)
835 while data:
835 while data:
836 dest.write(data)
836 dest.write(data)
837 data = fh.read(_chunksize)
837 data = fh.read(_chunksize)
838 finally:
838 finally:
839 if output:
839 if output:
840 dest.close()
840 dest.close()
841
841
842 @command('debugextensions', cmdutil.formatteropts, [], optionalrepo=True)
842 @command('debugextensions', cmdutil.formatteropts, [], optionalrepo=True)
843 def debugextensions(ui, repo, **opts):
843 def debugextensions(ui, repo, **opts):
844 '''show information about active extensions'''
844 '''show information about active extensions'''
845 opts = pycompat.byteskwargs(opts)
845 opts = pycompat.byteskwargs(opts)
846 exts = extensions.extensions(ui)
846 exts = extensions.extensions(ui)
847 hgver = util.version()
847 hgver = util.version()
848 fm = ui.formatter('debugextensions', opts)
848 fm = ui.formatter('debugextensions', opts)
849 for extname, extmod in sorted(exts, key=operator.itemgetter(0)):
849 for extname, extmod in sorted(exts, key=operator.itemgetter(0)):
850 isinternal = extensions.ismoduleinternal(extmod)
850 isinternal = extensions.ismoduleinternal(extmod)
851 extsource = pycompat.fsencode(extmod.__file__)
851 extsource = pycompat.fsencode(extmod.__file__)
852 if isinternal:
852 if isinternal:
853 exttestedwith = [] # never expose magic string to users
853 exttestedwith = [] # never expose magic string to users
854 else:
854 else:
855 exttestedwith = getattr(extmod, 'testedwith', '').split()
855 exttestedwith = getattr(extmod, 'testedwith', '').split()
856 extbuglink = getattr(extmod, 'buglink', None)
856 extbuglink = getattr(extmod, 'buglink', None)
857
857
858 fm.startitem()
858 fm.startitem()
859
859
860 if ui.quiet or ui.verbose:
860 if ui.quiet or ui.verbose:
861 fm.write('name', '%s\n', extname)
861 fm.write('name', '%s\n', extname)
862 else:
862 else:
863 fm.write('name', '%s', extname)
863 fm.write('name', '%s', extname)
864 if isinternal or hgver in exttestedwith:
864 if isinternal or hgver in exttestedwith:
865 fm.plain('\n')
865 fm.plain('\n')
866 elif not exttestedwith:
866 elif not exttestedwith:
867 fm.plain(_(' (untested!)\n'))
867 fm.plain(_(' (untested!)\n'))
868 else:
868 else:
869 lasttestedversion = exttestedwith[-1]
869 lasttestedversion = exttestedwith[-1]
870 fm.plain(' (%s!)\n' % lasttestedversion)
870 fm.plain(' (%s!)\n' % lasttestedversion)
871
871
872 fm.condwrite(ui.verbose and extsource, 'source',
872 fm.condwrite(ui.verbose and extsource, 'source',
873 _(' location: %s\n'), extsource or "")
873 _(' location: %s\n'), extsource or "")
874
874
875 if ui.verbose:
875 if ui.verbose:
876 fm.plain(_(' bundled: %s\n') % ['no', 'yes'][isinternal])
876 fm.plain(_(' bundled: %s\n') % ['no', 'yes'][isinternal])
877 fm.data(bundled=isinternal)
877 fm.data(bundled=isinternal)
878
878
879 fm.condwrite(ui.verbose and exttestedwith, 'testedwith',
879 fm.condwrite(ui.verbose and exttestedwith, 'testedwith',
880 _(' tested with: %s\n'),
880 _(' tested with: %s\n'),
881 fm.formatlist(exttestedwith, name='ver'))
881 fm.formatlist(exttestedwith, name='ver'))
882
882
883 fm.condwrite(ui.verbose and extbuglink, 'buglink',
883 fm.condwrite(ui.verbose and extbuglink, 'buglink',
884 _(' bug reporting: %s\n'), extbuglink or "")
884 _(' bug reporting: %s\n'), extbuglink or "")
885
885
886 fm.end()
886 fm.end()
887
887
888 @command('debugfileset',
888 @command('debugfileset',
889 [('r', 'rev', '', _('apply the filespec on this revision'), _('REV')),
889 [('r', 'rev', '', _('apply the filespec on this revision'), _('REV')),
890 ('', 'all-files', False,
890 ('', 'all-files', False,
891 _('test files from all revisions and working directory')),
891 _('test files from all revisions and working directory')),
892 ('s', 'show-matcher', None,
892 ('s', 'show-matcher', None,
893 _('print internal representation of matcher')),
893 _('print internal representation of matcher')),
894 ('p', 'show-stage', [],
894 ('p', 'show-stage', [],
895 _('print parsed tree at the given stage'), _('NAME'))],
895 _('print parsed tree at the given stage'), _('NAME'))],
896 _('[-r REV] [--all-files] [OPTION]... FILESPEC'))
896 _('[-r REV] [--all-files] [OPTION]... FILESPEC'))
897 def debugfileset(ui, repo, expr, **opts):
897 def debugfileset(ui, repo, expr, **opts):
898 '''parse and apply a fileset specification'''
898 '''parse and apply a fileset specification'''
899 from . import fileset
899 from . import fileset
900 fileset.symbols # force import of fileset so we have predicates to optimize
900 fileset.symbols # force import of fileset so we have predicates to optimize
901 opts = pycompat.byteskwargs(opts)
901 opts = pycompat.byteskwargs(opts)
902 ctx = scmutil.revsingle(repo, opts.get('rev'), None)
902 ctx = scmutil.revsingle(repo, opts.get('rev'), None)
903
903
904 stages = [
904 stages = [
905 ('parsed', pycompat.identity),
905 ('parsed', pycompat.identity),
906 ('analyzed', filesetlang.analyze),
906 ('analyzed', filesetlang.analyze),
907 ('optimized', filesetlang.optimize),
907 ('optimized', filesetlang.optimize),
908 ]
908 ]
909 stagenames = set(n for n, f in stages)
909 stagenames = set(n for n, f in stages)
910
910
911 showalways = set()
911 showalways = set()
912 if ui.verbose and not opts['show_stage']:
912 if ui.verbose and not opts['show_stage']:
913 # show parsed tree by --verbose (deprecated)
913 # show parsed tree by --verbose (deprecated)
914 showalways.add('parsed')
914 showalways.add('parsed')
915 if opts['show_stage'] == ['all']:
915 if opts['show_stage'] == ['all']:
916 showalways.update(stagenames)
916 showalways.update(stagenames)
917 else:
917 else:
918 for n in opts['show_stage']:
918 for n in opts['show_stage']:
919 if n not in stagenames:
919 if n not in stagenames:
920 raise error.Abort(_('invalid stage name: %s') % n)
920 raise error.Abort(_('invalid stage name: %s') % n)
921 showalways.update(opts['show_stage'])
921 showalways.update(opts['show_stage'])
922
922
923 tree = filesetlang.parse(expr)
923 tree = filesetlang.parse(expr)
924 for n, f in stages:
924 for n, f in stages:
925 tree = f(tree)
925 tree = f(tree)
926 if n in showalways:
926 if n in showalways:
927 if opts['show_stage'] or n != 'parsed':
927 if opts['show_stage'] or n != 'parsed':
928 ui.write(("* %s:\n") % n)
928 ui.write(("* %s:\n") % n)
929 ui.write(filesetlang.prettyformat(tree), "\n")
929 ui.write(filesetlang.prettyformat(tree), "\n")
930
930
931 files = set()
931 files = set()
932 if opts['all_files']:
932 if opts['all_files']:
933 for r in repo:
933 for r in repo:
934 c = repo[r]
934 c = repo[r]
935 files.update(c.files())
935 files.update(c.files())
936 files.update(c.substate)
936 files.update(c.substate)
937 if opts['all_files'] or ctx.rev() is None:
937 if opts['all_files'] or ctx.rev() is None:
938 wctx = repo[None]
938 wctx = repo[None]
939 files.update(repo.dirstate.walk(scmutil.matchall(repo),
939 files.update(repo.dirstate.walk(scmutil.matchall(repo),
940 subrepos=list(wctx.substate),
940 subrepos=list(wctx.substate),
941 unknown=True, ignored=True))
941 unknown=True, ignored=True))
942 files.update(wctx.substate)
942 files.update(wctx.substate)
943 else:
943 else:
944 files.update(ctx.files())
944 files.update(ctx.files())
945 files.update(ctx.substate)
945 files.update(ctx.substate)
946
946
947 m = ctx.matchfileset(expr)
947 m = ctx.matchfileset(expr)
948 if opts['show_matcher'] or (opts['show_matcher'] is None and ui.verbose):
948 if opts['show_matcher'] or (opts['show_matcher'] is None and ui.verbose):
949 ui.write(('* matcher:\n'), stringutil.prettyrepr(m), '\n')
949 ui.write(('* matcher:\n'), stringutil.prettyrepr(m), '\n')
950 for f in sorted(files):
950 for f in sorted(files):
951 if not m(f):
951 if not m(f):
952 continue
952 continue
953 ui.write("%s\n" % f)
953 ui.write("%s\n" % f)
954
954
955 @command('debugformat',
955 @command('debugformat',
956 [] + cmdutil.formatteropts)
956 [] + cmdutil.formatteropts)
957 def debugformat(ui, repo, **opts):
957 def debugformat(ui, repo, **opts):
958 """display format information about the current repository
958 """display format information about the current repository
959
959
960 Use --verbose to get extra information about current config value and
960 Use --verbose to get extra information about current config value and
961 Mercurial default."""
961 Mercurial default."""
962 opts = pycompat.byteskwargs(opts)
962 opts = pycompat.byteskwargs(opts)
963 maxvariantlength = max(len(fv.name) for fv in upgrade.allformatvariant)
963 maxvariantlength = max(len(fv.name) for fv in upgrade.allformatvariant)
964 maxvariantlength = max(len('format-variant'), maxvariantlength)
964 maxvariantlength = max(len('format-variant'), maxvariantlength)
965
965
966 def makeformatname(name):
966 def makeformatname(name):
967 return '%s:' + (' ' * (maxvariantlength - len(name)))
967 return '%s:' + (' ' * (maxvariantlength - len(name)))
968
968
969 fm = ui.formatter('debugformat', opts)
969 fm = ui.formatter('debugformat', opts)
970 if fm.isplain():
970 if fm.isplain():
971 def formatvalue(value):
971 def formatvalue(value):
972 if util.safehasattr(value, 'startswith'):
972 if util.safehasattr(value, 'startswith'):
973 return value
973 return value
974 if value:
974 if value:
975 return 'yes'
975 return 'yes'
976 else:
976 else:
977 return 'no'
977 return 'no'
978 else:
978 else:
979 formatvalue = pycompat.identity
979 formatvalue = pycompat.identity
980
980
981 fm.plain('format-variant')
981 fm.plain('format-variant')
982 fm.plain(' ' * (maxvariantlength - len('format-variant')))
982 fm.plain(' ' * (maxvariantlength - len('format-variant')))
983 fm.plain(' repo')
983 fm.plain(' repo')
984 if ui.verbose:
984 if ui.verbose:
985 fm.plain(' config default')
985 fm.plain(' config default')
986 fm.plain('\n')
986 fm.plain('\n')
987 for fv in upgrade.allformatvariant:
987 for fv in upgrade.allformatvariant:
988 fm.startitem()
988 fm.startitem()
989 repovalue = fv.fromrepo(repo)
989 repovalue = fv.fromrepo(repo)
990 configvalue = fv.fromconfig(repo)
990 configvalue = fv.fromconfig(repo)
991
991
992 if repovalue != configvalue:
992 if repovalue != configvalue:
993 namelabel = 'formatvariant.name.mismatchconfig'
993 namelabel = 'formatvariant.name.mismatchconfig'
994 repolabel = 'formatvariant.repo.mismatchconfig'
994 repolabel = 'formatvariant.repo.mismatchconfig'
995 elif repovalue != fv.default:
995 elif repovalue != fv.default:
996 namelabel = 'formatvariant.name.mismatchdefault'
996 namelabel = 'formatvariant.name.mismatchdefault'
997 repolabel = 'formatvariant.repo.mismatchdefault'
997 repolabel = 'formatvariant.repo.mismatchdefault'
998 else:
998 else:
999 namelabel = 'formatvariant.name.uptodate'
999 namelabel = 'formatvariant.name.uptodate'
1000 repolabel = 'formatvariant.repo.uptodate'
1000 repolabel = 'formatvariant.repo.uptodate'
1001
1001
1002 fm.write('name', makeformatname(fv.name), fv.name,
1002 fm.write('name', makeformatname(fv.name), fv.name,
1003 label=namelabel)
1003 label=namelabel)
1004 fm.write('repo', ' %3s', formatvalue(repovalue),
1004 fm.write('repo', ' %3s', formatvalue(repovalue),
1005 label=repolabel)
1005 label=repolabel)
1006 if fv.default != configvalue:
1006 if fv.default != configvalue:
1007 configlabel = 'formatvariant.config.special'
1007 configlabel = 'formatvariant.config.special'
1008 else:
1008 else:
1009 configlabel = 'formatvariant.config.default'
1009 configlabel = 'formatvariant.config.default'
1010 fm.condwrite(ui.verbose, 'config', ' %6s', formatvalue(configvalue),
1010 fm.condwrite(ui.verbose, 'config', ' %6s', formatvalue(configvalue),
1011 label=configlabel)
1011 label=configlabel)
1012 fm.condwrite(ui.verbose, 'default', ' %7s', formatvalue(fv.default),
1012 fm.condwrite(ui.verbose, 'default', ' %7s', formatvalue(fv.default),
1013 label='formatvariant.default')
1013 label='formatvariant.default')
1014 fm.plain('\n')
1014 fm.plain('\n')
1015 fm.end()
1015 fm.end()
1016
1016
1017 @command('debugfsinfo', [], _('[PATH]'), norepo=True)
1017 @command('debugfsinfo', [], _('[PATH]'), norepo=True)
1018 def debugfsinfo(ui, path="."):
1018 def debugfsinfo(ui, path="."):
1019 """show information detected about current filesystem"""
1019 """show information detected about current filesystem"""
1020 ui.write(('path: %s\n') % path)
1020 ui.write(('path: %s\n') % path)
1021 ui.write(('mounted on: %s\n') % (util.getfsmountpoint(path) or '(unknown)'))
1021 ui.write(('mounted on: %s\n') % (util.getfsmountpoint(path) or '(unknown)'))
1022 ui.write(('exec: %s\n') % (util.checkexec(path) and 'yes' or 'no'))
1022 ui.write(('exec: %s\n') % (util.checkexec(path) and 'yes' or 'no'))
1023 ui.write(('fstype: %s\n') % (util.getfstype(path) or '(unknown)'))
1023 ui.write(('fstype: %s\n') % (util.getfstype(path) or '(unknown)'))
1024 ui.write(('symlink: %s\n') % (util.checklink(path) and 'yes' or 'no'))
1024 ui.write(('symlink: %s\n') % (util.checklink(path) and 'yes' or 'no'))
1025 ui.write(('hardlink: %s\n') % (util.checknlink(path) and 'yes' or 'no'))
1025 ui.write(('hardlink: %s\n') % (util.checknlink(path) and 'yes' or 'no'))
1026 casesensitive = '(unknown)'
1026 casesensitive = '(unknown)'
1027 try:
1027 try:
1028 with pycompat.namedtempfile(prefix='.debugfsinfo', dir=path) as f:
1028 with pycompat.namedtempfile(prefix='.debugfsinfo', dir=path) as f:
1029 casesensitive = util.fscasesensitive(f.name) and 'yes' or 'no'
1029 casesensitive = util.fscasesensitive(f.name) and 'yes' or 'no'
1030 except OSError:
1030 except OSError:
1031 pass
1031 pass
1032 ui.write(('case-sensitive: %s\n') % casesensitive)
1032 ui.write(('case-sensitive: %s\n') % casesensitive)
1033
1033
1034 @command('debuggetbundle',
1034 @command('debuggetbundle',
1035 [('H', 'head', [], _('id of head node'), _('ID')),
1035 [('H', 'head', [], _('id of head node'), _('ID')),
1036 ('C', 'common', [], _('id of common node'), _('ID')),
1036 ('C', 'common', [], _('id of common node'), _('ID')),
1037 ('t', 'type', 'bzip2', _('bundle compression type to use'), _('TYPE'))],
1037 ('t', 'type', 'bzip2', _('bundle compression type to use'), _('TYPE'))],
1038 _('REPO FILE [-H|-C ID]...'),
1038 _('REPO FILE [-H|-C ID]...'),
1039 norepo=True)
1039 norepo=True)
1040 def debuggetbundle(ui, repopath, bundlepath, head=None, common=None, **opts):
1040 def debuggetbundle(ui, repopath, bundlepath, head=None, common=None, **opts):
1041 """retrieves a bundle from a repo
1041 """retrieves a bundle from a repo
1042
1042
1043 Every ID must be a full-length hex node id string. Saves the bundle to the
1043 Every ID must be a full-length hex node id string. Saves the bundle to the
1044 given file.
1044 given file.
1045 """
1045 """
1046 opts = pycompat.byteskwargs(opts)
1046 opts = pycompat.byteskwargs(opts)
1047 repo = hg.peer(ui, opts, repopath)
1047 repo = hg.peer(ui, opts, repopath)
1048 if not repo.capable('getbundle'):
1048 if not repo.capable('getbundle'):
1049 raise error.Abort("getbundle() not supported by target repository")
1049 raise error.Abort("getbundle() not supported by target repository")
1050 args = {}
1050 args = {}
1051 if common:
1051 if common:
1052 args[r'common'] = [bin(s) for s in common]
1052 args[r'common'] = [bin(s) for s in common]
1053 if head:
1053 if head:
1054 args[r'heads'] = [bin(s) for s in head]
1054 args[r'heads'] = [bin(s) for s in head]
1055 # TODO: get desired bundlecaps from command line.
1055 # TODO: get desired bundlecaps from command line.
1056 args[r'bundlecaps'] = None
1056 args[r'bundlecaps'] = None
1057 bundle = repo.getbundle('debug', **args)
1057 bundle = repo.getbundle('debug', **args)
1058
1058
1059 bundletype = opts.get('type', 'bzip2').lower()
1059 bundletype = opts.get('type', 'bzip2').lower()
1060 btypes = {'none': 'HG10UN',
1060 btypes = {'none': 'HG10UN',
1061 'bzip2': 'HG10BZ',
1061 'bzip2': 'HG10BZ',
1062 'gzip': 'HG10GZ',
1062 'gzip': 'HG10GZ',
1063 'bundle2': 'HG20'}
1063 'bundle2': 'HG20'}
1064 bundletype = btypes.get(bundletype)
1064 bundletype = btypes.get(bundletype)
1065 if bundletype not in bundle2.bundletypes:
1065 if bundletype not in bundle2.bundletypes:
1066 raise error.Abort(_('unknown bundle type specified with --type'))
1066 raise error.Abort(_('unknown bundle type specified with --type'))
1067 bundle2.writebundle(ui, bundle, bundlepath, bundletype)
1067 bundle2.writebundle(ui, bundle, bundlepath, bundletype)
1068
1068
1069 @command('debugignore', [], '[FILE]')
1069 @command('debugignore', [], '[FILE]')
1070 def debugignore(ui, repo, *files, **opts):
1070 def debugignore(ui, repo, *files, **opts):
1071 """display the combined ignore pattern and information about ignored files
1071 """display the combined ignore pattern and information about ignored files
1072
1072
1073 With no argument display the combined ignore pattern.
1073 With no argument display the combined ignore pattern.
1074
1074
1075 Given space separated file names, shows if the given file is ignored and
1075 Given space separated file names, shows if the given file is ignored and
1076 if so, show the ignore rule (file and line number) that matched it.
1076 if so, show the ignore rule (file and line number) that matched it.
1077 """
1077 """
1078 ignore = repo.dirstate._ignore
1078 ignore = repo.dirstate._ignore
1079 if not files:
1079 if not files:
1080 # Show all the patterns
1080 # Show all the patterns
1081 ui.write("%s\n" % pycompat.byterepr(ignore))
1081 ui.write("%s\n" % pycompat.byterepr(ignore))
1082 else:
1082 else:
1083 m = scmutil.match(repo[None], pats=files)
1083 m = scmutil.match(repo[None], pats=files)
1084 for f in m.files():
1084 for f in m.files():
1085 nf = util.normpath(f)
1085 nf = util.normpath(f)
1086 ignored = None
1086 ignored = None
1087 ignoredata = None
1087 ignoredata = None
1088 if nf != '.':
1088 if nf != '.':
1089 if ignore(nf):
1089 if ignore(nf):
1090 ignored = nf
1090 ignored = nf
1091 ignoredata = repo.dirstate._ignorefileandline(nf)
1091 ignoredata = repo.dirstate._ignorefileandline(nf)
1092 else:
1092 else:
1093 for p in util.finddirs(nf):
1093 for p in util.finddirs(nf):
1094 if ignore(p):
1094 if ignore(p):
1095 ignored = p
1095 ignored = p
1096 ignoredata = repo.dirstate._ignorefileandline(p)
1096 ignoredata = repo.dirstate._ignorefileandline(p)
1097 break
1097 break
1098 if ignored:
1098 if ignored:
1099 if ignored == nf:
1099 if ignored == nf:
1100 ui.write(_("%s is ignored\n") % m.uipath(f))
1100 ui.write(_("%s is ignored\n") % m.uipath(f))
1101 else:
1101 else:
1102 ui.write(_("%s is ignored because of "
1102 ui.write(_("%s is ignored because of "
1103 "containing folder %s\n")
1103 "containing folder %s\n")
1104 % (m.uipath(f), ignored))
1104 % (m.uipath(f), ignored))
1105 ignorefile, lineno, line = ignoredata
1105 ignorefile, lineno, line = ignoredata
1106 ui.write(_("(ignore rule in %s, line %d: '%s')\n")
1106 ui.write(_("(ignore rule in %s, line %d: '%s')\n")
1107 % (ignorefile, lineno, line))
1107 % (ignorefile, lineno, line))
1108 else:
1108 else:
1109 ui.write(_("%s is not ignored\n") % m.uipath(f))
1109 ui.write(_("%s is not ignored\n") % m.uipath(f))
1110
1110
1111 @command('debugindex', cmdutil.debugrevlogopts +
1111 @command('debugindex', cmdutil.debugrevlogopts + cmdutil.formatteropts,
1112 [('f', 'format', 0, _('revlog format'), _('FORMAT'))],
1112 _('-c|-m|FILE'))
1113 _('[-f FORMAT] -c|-m|FILE'),
1114 optionalrepo=True)
1115 def debugindex(ui, repo, file_=None, **opts):
1113 def debugindex(ui, repo, file_=None, **opts):
1116 """dump the contents of an index file"""
1114 """dump index data for a storage primitive"""
1117 opts = pycompat.byteskwargs(opts)
1115 opts = pycompat.byteskwargs(opts)
1118 r = cmdutil.openrevlog(repo, 'debugindex', file_, opts)
1116 store = cmdutil.openstorage(repo, 'debugindex', file_, opts)
1119 format = opts.get('format', 0)
1120 if format not in (0, 1):
1121 raise error.Abort(_("unknown format %d") % format)
1122
1117
1123 if ui.debugflag:
1118 if ui.debugflag:
1124 shortfn = hex
1119 shortfn = hex
1125 else:
1120 else:
1126 shortfn = short
1121 shortfn = short
1127
1122
1128 # There might not be anything in r, so have a sane default
1129 idlen = 12
1123 idlen = 12
1130 for i in r:
1124 for i in store:
1131 idlen = len(shortfn(r.node(i)))
1125 idlen = len(shortfn(store.node(i)))
1132 break
1126 break
1133
1127
1134 if format == 0:
1128 fm = ui.formatter('debugindex', opts)
1135 if ui.verbose:
1129 fm.plain(b' rev linkrev %s %s p2\n' % (
1136 ui.write((" rev offset length linkrev"
1130 b'nodeid'.ljust(idlen),
1137 " %s %s p2\n") % ("nodeid".ljust(idlen),
1131 b'p1'.ljust(idlen)))
1138 "p1".ljust(idlen)))
1132
1139 else:
1133 for rev in store:
1140 ui.write((" rev linkrev %s %s p2\n") % (
1134 node = store.node(rev)
1141 "nodeid".ljust(idlen), "p1".ljust(idlen)))
1135 parents = store.parents(node)
1142 elif format == 1:
1136
1143 if ui.verbose:
1137 fm.startitem()
1144 ui.write((" rev flag offset length size link p1"
1138 fm.write(b'rev', b'%6d ', rev)
1145 " p2 %s\n") % "nodeid".rjust(idlen))
1139 fm.write(b'linkrev', '%7d ', store.linkrev(rev))
1146 else:
1140 fm.write(b'node', '%s ', shortfn(node))
1147 ui.write((" rev flag size link p1 p2 %s\n") %
1141 fm.write(b'p1', '%s ', shortfn(parents[0]))
1148 "nodeid".rjust(idlen))
1142 fm.write(b'p2', '%s', shortfn(parents[1]))
1149
1143 fm.plain(b'\n')
1150 for i in r:
1144
1151 node = r.node(i)
1145 fm.end()
1152 if format == 0:
1153 try:
1154 pp = r.parents(node)
1155 except Exception:
1156 pp = [nullid, nullid]
1157 if ui.verbose:
1158 ui.write("% 6d % 9d % 7d % 7d %s %s %s\n" % (
1159 i, r.start(i), r.length(i), r.linkrev(i),
1160 shortfn(node), shortfn(pp[0]), shortfn(pp[1])))
1161 else:
1162 ui.write("% 6d % 7d %s %s %s\n" % (
1163 i, r.linkrev(i), shortfn(node), shortfn(pp[0]),
1164 shortfn(pp[1])))
1165 elif format == 1:
1166 pr = r.parentrevs(i)
1167 if ui.verbose:
1168 ui.write("% 6d %04x % 8d % 8d % 8d % 6d % 6d % 6d %s\n" % (
1169 i, r.flags(i), r.start(i), r.length(i), r.rawsize(i),
1170 r.linkrev(i), pr[0], pr[1], shortfn(node)))
1171 else:
1172 ui.write("% 6d %04x % 8d % 6d % 6d % 6d %s\n" % (
1173 i, r.flags(i), r.rawsize(i), r.linkrev(i), pr[0], pr[1],
1174 shortfn(node)))
1175
1146
1176 @command('debugindexdot', cmdutil.debugrevlogopts,
1147 @command('debugindexdot', cmdutil.debugrevlogopts,
1177 _('-c|-m|FILE'), optionalrepo=True)
1148 _('-c|-m|FILE'), optionalrepo=True)
1178 def debugindexdot(ui, repo, file_=None, **opts):
1149 def debugindexdot(ui, repo, file_=None, **opts):
1179 """dump an index DAG as a graphviz dot file"""
1150 """dump an index DAG as a graphviz dot file"""
1180 opts = pycompat.byteskwargs(opts)
1151 opts = pycompat.byteskwargs(opts)
1181 r = cmdutil.openstorage(repo, 'debugindexdot', file_, opts)
1152 r = cmdutil.openstorage(repo, 'debugindexdot', file_, opts)
1182 ui.write(("digraph G {\n"))
1153 ui.write(("digraph G {\n"))
1183 for i in r:
1154 for i in r:
1184 node = r.node(i)
1155 node = r.node(i)
1185 pp = r.parents(node)
1156 pp = r.parents(node)
1186 ui.write("\t%d -> %d\n" % (r.rev(pp[0]), i))
1157 ui.write("\t%d -> %d\n" % (r.rev(pp[0]), i))
1187 if pp[1] != nullid:
1158 if pp[1] != nullid:
1188 ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i))
1159 ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i))
1189 ui.write("}\n")
1160 ui.write("}\n")
1190
1161
1191 @command('debuginstall', [] + cmdutil.formatteropts, '', norepo=True)
1162 @command('debuginstall', [] + cmdutil.formatteropts, '', norepo=True)
1192 def debuginstall(ui, **opts):
1163 def debuginstall(ui, **opts):
1193 '''test Mercurial installation
1164 '''test Mercurial installation
1194
1165
1195 Returns 0 on success.
1166 Returns 0 on success.
1196 '''
1167 '''
1197 opts = pycompat.byteskwargs(opts)
1168 opts = pycompat.byteskwargs(opts)
1198
1169
1199 def writetemp(contents):
1170 def writetemp(contents):
1200 (fd, name) = pycompat.mkstemp(prefix="hg-debuginstall-")
1171 (fd, name) = pycompat.mkstemp(prefix="hg-debuginstall-")
1201 f = os.fdopen(fd, r"wb")
1172 f = os.fdopen(fd, r"wb")
1202 f.write(contents)
1173 f.write(contents)
1203 f.close()
1174 f.close()
1204 return name
1175 return name
1205
1176
1206 problems = 0
1177 problems = 0
1207
1178
1208 fm = ui.formatter('debuginstall', opts)
1179 fm = ui.formatter('debuginstall', opts)
1209 fm.startitem()
1180 fm.startitem()
1210
1181
1211 # encoding
1182 # encoding
1212 fm.write('encoding', _("checking encoding (%s)...\n"), encoding.encoding)
1183 fm.write('encoding', _("checking encoding (%s)...\n"), encoding.encoding)
1213 err = None
1184 err = None
1214 try:
1185 try:
1215 codecs.lookup(pycompat.sysstr(encoding.encoding))
1186 codecs.lookup(pycompat.sysstr(encoding.encoding))
1216 except LookupError as inst:
1187 except LookupError as inst:
1217 err = stringutil.forcebytestr(inst)
1188 err = stringutil.forcebytestr(inst)
1218 problems += 1
1189 problems += 1
1219 fm.condwrite(err, 'encodingerror', _(" %s\n"
1190 fm.condwrite(err, 'encodingerror', _(" %s\n"
1220 " (check that your locale is properly set)\n"), err)
1191 " (check that your locale is properly set)\n"), err)
1221
1192
1222 # Python
1193 # Python
1223 fm.write('pythonexe', _("checking Python executable (%s)\n"),
1194 fm.write('pythonexe', _("checking Python executable (%s)\n"),
1224 pycompat.sysexecutable)
1195 pycompat.sysexecutable)
1225 fm.write('pythonver', _("checking Python version (%s)\n"),
1196 fm.write('pythonver', _("checking Python version (%s)\n"),
1226 ("%d.%d.%d" % sys.version_info[:3]))
1197 ("%d.%d.%d" % sys.version_info[:3]))
1227 fm.write('pythonlib', _("checking Python lib (%s)...\n"),
1198 fm.write('pythonlib', _("checking Python lib (%s)...\n"),
1228 os.path.dirname(pycompat.fsencode(os.__file__)))
1199 os.path.dirname(pycompat.fsencode(os.__file__)))
1229
1200
1230 security = set(sslutil.supportedprotocols)
1201 security = set(sslutil.supportedprotocols)
1231 if sslutil.hassni:
1202 if sslutil.hassni:
1232 security.add('sni')
1203 security.add('sni')
1233
1204
1234 fm.write('pythonsecurity', _("checking Python security support (%s)\n"),
1205 fm.write('pythonsecurity', _("checking Python security support (%s)\n"),
1235 fm.formatlist(sorted(security), name='protocol',
1206 fm.formatlist(sorted(security), name='protocol',
1236 fmt='%s', sep=','))
1207 fmt='%s', sep=','))
1237
1208
1238 # These are warnings, not errors. So don't increment problem count. This
1209 # These are warnings, not errors. So don't increment problem count. This
1239 # may change in the future.
1210 # may change in the future.
1240 if 'tls1.2' not in security:
1211 if 'tls1.2' not in security:
1241 fm.plain(_(' TLS 1.2 not supported by Python install; '
1212 fm.plain(_(' TLS 1.2 not supported by Python install; '
1242 'network connections lack modern security\n'))
1213 'network connections lack modern security\n'))
1243 if 'sni' not in security:
1214 if 'sni' not in security:
1244 fm.plain(_(' SNI not supported by Python install; may have '
1215 fm.plain(_(' SNI not supported by Python install; may have '
1245 'connectivity issues with some servers\n'))
1216 'connectivity issues with some servers\n'))
1246
1217
1247 # TODO print CA cert info
1218 # TODO print CA cert info
1248
1219
1249 # hg version
1220 # hg version
1250 hgver = util.version()
1221 hgver = util.version()
1251 fm.write('hgver', _("checking Mercurial version (%s)\n"),
1222 fm.write('hgver', _("checking Mercurial version (%s)\n"),
1252 hgver.split('+')[0])
1223 hgver.split('+')[0])
1253 fm.write('hgverextra', _("checking Mercurial custom build (%s)\n"),
1224 fm.write('hgverextra', _("checking Mercurial custom build (%s)\n"),
1254 '+'.join(hgver.split('+')[1:]))
1225 '+'.join(hgver.split('+')[1:]))
1255
1226
1256 # compiled modules
1227 # compiled modules
1257 fm.write('hgmodulepolicy', _("checking module policy (%s)\n"),
1228 fm.write('hgmodulepolicy', _("checking module policy (%s)\n"),
1258 policy.policy)
1229 policy.policy)
1259 fm.write('hgmodules', _("checking installed modules (%s)...\n"),
1230 fm.write('hgmodules', _("checking installed modules (%s)...\n"),
1260 os.path.dirname(pycompat.fsencode(__file__)))
1231 os.path.dirname(pycompat.fsencode(__file__)))
1261
1232
1262 if policy.policy in ('c', 'allow'):
1233 if policy.policy in ('c', 'allow'):
1263 err = None
1234 err = None
1264 try:
1235 try:
1265 from .cext import (
1236 from .cext import (
1266 base85,
1237 base85,
1267 bdiff,
1238 bdiff,
1268 mpatch,
1239 mpatch,
1269 osutil,
1240 osutil,
1270 )
1241 )
1271 dir(bdiff), dir(mpatch), dir(base85), dir(osutil) # quiet pyflakes
1242 dir(bdiff), dir(mpatch), dir(base85), dir(osutil) # quiet pyflakes
1272 except Exception as inst:
1243 except Exception as inst:
1273 err = stringutil.forcebytestr(inst)
1244 err = stringutil.forcebytestr(inst)
1274 problems += 1
1245 problems += 1
1275 fm.condwrite(err, 'extensionserror', " %s\n", err)
1246 fm.condwrite(err, 'extensionserror', " %s\n", err)
1276
1247
1277 compengines = util.compengines._engines.values()
1248 compengines = util.compengines._engines.values()
1278 fm.write('compengines', _('checking registered compression engines (%s)\n'),
1249 fm.write('compengines', _('checking registered compression engines (%s)\n'),
1279 fm.formatlist(sorted(e.name() for e in compengines),
1250 fm.formatlist(sorted(e.name() for e in compengines),
1280 name='compengine', fmt='%s', sep=', '))
1251 name='compengine', fmt='%s', sep=', '))
1281 fm.write('compenginesavail', _('checking available compression engines '
1252 fm.write('compenginesavail', _('checking available compression engines '
1282 '(%s)\n'),
1253 '(%s)\n'),
1283 fm.formatlist(sorted(e.name() for e in compengines
1254 fm.formatlist(sorted(e.name() for e in compengines
1284 if e.available()),
1255 if e.available()),
1285 name='compengine', fmt='%s', sep=', '))
1256 name='compengine', fmt='%s', sep=', '))
1286 wirecompengines = util.compengines.supportedwireengines(util.SERVERROLE)
1257 wirecompengines = util.compengines.supportedwireengines(util.SERVERROLE)
1287 fm.write('compenginesserver', _('checking available compression engines '
1258 fm.write('compenginesserver', _('checking available compression engines '
1288 'for wire protocol (%s)\n'),
1259 'for wire protocol (%s)\n'),
1289 fm.formatlist([e.name() for e in wirecompengines
1260 fm.formatlist([e.name() for e in wirecompengines
1290 if e.wireprotosupport()],
1261 if e.wireprotosupport()],
1291 name='compengine', fmt='%s', sep=', '))
1262 name='compengine', fmt='%s', sep=', '))
1292 re2 = 'missing'
1263 re2 = 'missing'
1293 if util._re2:
1264 if util._re2:
1294 re2 = 'available'
1265 re2 = 'available'
1295 fm.plain(_('checking "re2" regexp engine (%s)\n') % re2)
1266 fm.plain(_('checking "re2" regexp engine (%s)\n') % re2)
1296 fm.data(re2=bool(util._re2))
1267 fm.data(re2=bool(util._re2))
1297
1268
1298 # templates
1269 # templates
1299 p = templater.templatepaths()
1270 p = templater.templatepaths()
1300 fm.write('templatedirs', 'checking templates (%s)...\n', ' '.join(p))
1271 fm.write('templatedirs', 'checking templates (%s)...\n', ' '.join(p))
1301 fm.condwrite(not p, '', _(" no template directories found\n"))
1272 fm.condwrite(not p, '', _(" no template directories found\n"))
1302 if p:
1273 if p:
1303 m = templater.templatepath("map-cmdline.default")
1274 m = templater.templatepath("map-cmdline.default")
1304 if m:
1275 if m:
1305 # template found, check if it is working
1276 # template found, check if it is working
1306 err = None
1277 err = None
1307 try:
1278 try:
1308 templater.templater.frommapfile(m)
1279 templater.templater.frommapfile(m)
1309 except Exception as inst:
1280 except Exception as inst:
1310 err = stringutil.forcebytestr(inst)
1281 err = stringutil.forcebytestr(inst)
1311 p = None
1282 p = None
1312 fm.condwrite(err, 'defaulttemplateerror', " %s\n", err)
1283 fm.condwrite(err, 'defaulttemplateerror', " %s\n", err)
1313 else:
1284 else:
1314 p = None
1285 p = None
1315 fm.condwrite(p, 'defaulttemplate',
1286 fm.condwrite(p, 'defaulttemplate',
1316 _("checking default template (%s)\n"), m)
1287 _("checking default template (%s)\n"), m)
1317 fm.condwrite(not m, 'defaulttemplatenotfound',
1288 fm.condwrite(not m, 'defaulttemplatenotfound',
1318 _(" template '%s' not found\n"), "default")
1289 _(" template '%s' not found\n"), "default")
1319 if not p:
1290 if not p:
1320 problems += 1
1291 problems += 1
1321 fm.condwrite(not p, '',
1292 fm.condwrite(not p, '',
1322 _(" (templates seem to have been installed incorrectly)\n"))
1293 _(" (templates seem to have been installed incorrectly)\n"))
1323
1294
1324 # editor
1295 # editor
1325 editor = ui.geteditor()
1296 editor = ui.geteditor()
1326 editor = util.expandpath(editor)
1297 editor = util.expandpath(editor)
1327 editorbin = procutil.shellsplit(editor)[0]
1298 editorbin = procutil.shellsplit(editor)[0]
1328 fm.write('editor', _("checking commit editor... (%s)\n"), editorbin)
1299 fm.write('editor', _("checking commit editor... (%s)\n"), editorbin)
1329 cmdpath = procutil.findexe(editorbin)
1300 cmdpath = procutil.findexe(editorbin)
1330 fm.condwrite(not cmdpath and editor == 'vi', 'vinotfound',
1301 fm.condwrite(not cmdpath and editor == 'vi', 'vinotfound',
1331 _(" No commit editor set and can't find %s in PATH\n"
1302 _(" No commit editor set and can't find %s in PATH\n"
1332 " (specify a commit editor in your configuration"
1303 " (specify a commit editor in your configuration"
1333 " file)\n"), not cmdpath and editor == 'vi' and editorbin)
1304 " file)\n"), not cmdpath and editor == 'vi' and editorbin)
1334 fm.condwrite(not cmdpath and editor != 'vi', 'editornotfound',
1305 fm.condwrite(not cmdpath and editor != 'vi', 'editornotfound',
1335 _(" Can't find editor '%s' in PATH\n"
1306 _(" Can't find editor '%s' in PATH\n"
1336 " (specify a commit editor in your configuration"
1307 " (specify a commit editor in your configuration"
1337 " file)\n"), not cmdpath and editorbin)
1308 " file)\n"), not cmdpath and editorbin)
1338 if not cmdpath and editor != 'vi':
1309 if not cmdpath and editor != 'vi':
1339 problems += 1
1310 problems += 1
1340
1311
1341 # check username
1312 # check username
1342 username = None
1313 username = None
1343 err = None
1314 err = None
1344 try:
1315 try:
1345 username = ui.username()
1316 username = ui.username()
1346 except error.Abort as e:
1317 except error.Abort as e:
1347 err = stringutil.forcebytestr(e)
1318 err = stringutil.forcebytestr(e)
1348 problems += 1
1319 problems += 1
1349
1320
1350 fm.condwrite(username, 'username', _("checking username (%s)\n"), username)
1321 fm.condwrite(username, 'username', _("checking username (%s)\n"), username)
1351 fm.condwrite(err, 'usernameerror', _("checking username...\n %s\n"
1322 fm.condwrite(err, 'usernameerror', _("checking username...\n %s\n"
1352 " (specify a username in your configuration file)\n"), err)
1323 " (specify a username in your configuration file)\n"), err)
1353
1324
1354 fm.condwrite(not problems, '',
1325 fm.condwrite(not problems, '',
1355 _("no problems detected\n"))
1326 _("no problems detected\n"))
1356 if not problems:
1327 if not problems:
1357 fm.data(problems=problems)
1328 fm.data(problems=problems)
1358 fm.condwrite(problems, 'problems',
1329 fm.condwrite(problems, 'problems',
1359 _("%d problems detected,"
1330 _("%d problems detected,"
1360 " please check your install!\n"), problems)
1331 " please check your install!\n"), problems)
1361 fm.end()
1332 fm.end()
1362
1333
1363 return problems
1334 return problems
1364
1335
1365 @command('debugknown', [], _('REPO ID...'), norepo=True)
1336 @command('debugknown', [], _('REPO ID...'), norepo=True)
1366 def debugknown(ui, repopath, *ids, **opts):
1337 def debugknown(ui, repopath, *ids, **opts):
1367 """test whether node ids are known to a repo
1338 """test whether node ids are known to a repo
1368
1339
1369 Every ID must be a full-length hex node id string. Returns a list of 0s
1340 Every ID must be a full-length hex node id string. Returns a list of 0s
1370 and 1s indicating unknown/known.
1341 and 1s indicating unknown/known.
1371 """
1342 """
1372 opts = pycompat.byteskwargs(opts)
1343 opts = pycompat.byteskwargs(opts)
1373 repo = hg.peer(ui, opts, repopath)
1344 repo = hg.peer(ui, opts, repopath)
1374 if not repo.capable('known'):
1345 if not repo.capable('known'):
1375 raise error.Abort("known() not supported by target repository")
1346 raise error.Abort("known() not supported by target repository")
1376 flags = repo.known([bin(s) for s in ids])
1347 flags = repo.known([bin(s) for s in ids])
1377 ui.write("%s\n" % ("".join([f and "1" or "0" for f in flags])))
1348 ui.write("%s\n" % ("".join([f and "1" or "0" for f in flags])))
1378
1349
1379 @command('debuglabelcomplete', [], _('LABEL...'))
1350 @command('debuglabelcomplete', [], _('LABEL...'))
1380 def debuglabelcomplete(ui, repo, *args):
1351 def debuglabelcomplete(ui, repo, *args):
1381 '''backwards compatibility with old bash completion scripts (DEPRECATED)'''
1352 '''backwards compatibility with old bash completion scripts (DEPRECATED)'''
1382 debugnamecomplete(ui, repo, *args)
1353 debugnamecomplete(ui, repo, *args)
1383
1354
1384 @command('debuglocks',
1355 @command('debuglocks',
1385 [('L', 'force-lock', None, _('free the store lock (DANGEROUS)')),
1356 [('L', 'force-lock', None, _('free the store lock (DANGEROUS)')),
1386 ('W', 'force-wlock', None,
1357 ('W', 'force-wlock', None,
1387 _('free the working state lock (DANGEROUS)')),
1358 _('free the working state lock (DANGEROUS)')),
1388 ('s', 'set-lock', None, _('set the store lock until stopped')),
1359 ('s', 'set-lock', None, _('set the store lock until stopped')),
1389 ('S', 'set-wlock', None,
1360 ('S', 'set-wlock', None,
1390 _('set the working state lock until stopped'))],
1361 _('set the working state lock until stopped'))],
1391 _('[OPTION]...'))
1362 _('[OPTION]...'))
1392 def debuglocks(ui, repo, **opts):
1363 def debuglocks(ui, repo, **opts):
1393 """show or modify state of locks
1364 """show or modify state of locks
1394
1365
1395 By default, this command will show which locks are held. This
1366 By default, this command will show which locks are held. This
1396 includes the user and process holding the lock, the amount of time
1367 includes the user and process holding the lock, the amount of time
1397 the lock has been held, and the machine name where the process is
1368 the lock has been held, and the machine name where the process is
1398 running if it's not local.
1369 running if it's not local.
1399
1370
1400 Locks protect the integrity of Mercurial's data, so should be
1371 Locks protect the integrity of Mercurial's data, so should be
1401 treated with care. System crashes or other interruptions may cause
1372 treated with care. System crashes or other interruptions may cause
1402 locks to not be properly released, though Mercurial will usually
1373 locks to not be properly released, though Mercurial will usually
1403 detect and remove such stale locks automatically.
1374 detect and remove such stale locks automatically.
1404
1375
1405 However, detecting stale locks may not always be possible (for
1376 However, detecting stale locks may not always be possible (for
1406 instance, on a shared filesystem). Removing locks may also be
1377 instance, on a shared filesystem). Removing locks may also be
1407 blocked by filesystem permissions.
1378 blocked by filesystem permissions.
1408
1379
1409 Setting a lock will prevent other commands from changing the data.
1380 Setting a lock will prevent other commands from changing the data.
1410 The command will wait until an interruption (SIGINT, SIGTERM, ...) occurs.
1381 The command will wait until an interruption (SIGINT, SIGTERM, ...) occurs.
1411 The set locks are removed when the command exits.
1382 The set locks are removed when the command exits.
1412
1383
1413 Returns 0 if no locks are held.
1384 Returns 0 if no locks are held.
1414
1385
1415 """
1386 """
1416
1387
1417 if opts.get(r'force_lock'):
1388 if opts.get(r'force_lock'):
1418 repo.svfs.unlink('lock')
1389 repo.svfs.unlink('lock')
1419 if opts.get(r'force_wlock'):
1390 if opts.get(r'force_wlock'):
1420 repo.vfs.unlink('wlock')
1391 repo.vfs.unlink('wlock')
1421 if opts.get(r'force_lock') or opts.get(r'force_wlock'):
1392 if opts.get(r'force_lock') or opts.get(r'force_wlock'):
1422 return 0
1393 return 0
1423
1394
1424 locks = []
1395 locks = []
1425 try:
1396 try:
1426 if opts.get(r'set_wlock'):
1397 if opts.get(r'set_wlock'):
1427 try:
1398 try:
1428 locks.append(repo.wlock(False))
1399 locks.append(repo.wlock(False))
1429 except error.LockHeld:
1400 except error.LockHeld:
1430 raise error.Abort(_('wlock is already held'))
1401 raise error.Abort(_('wlock is already held'))
1431 if opts.get(r'set_lock'):
1402 if opts.get(r'set_lock'):
1432 try:
1403 try:
1433 locks.append(repo.lock(False))
1404 locks.append(repo.lock(False))
1434 except error.LockHeld:
1405 except error.LockHeld:
1435 raise error.Abort(_('lock is already held'))
1406 raise error.Abort(_('lock is already held'))
1436 if len(locks):
1407 if len(locks):
1437 ui.promptchoice(_("ready to release the lock (y)? $$ &Yes"))
1408 ui.promptchoice(_("ready to release the lock (y)? $$ &Yes"))
1438 return 0
1409 return 0
1439 finally:
1410 finally:
1440 release(*locks)
1411 release(*locks)
1441
1412
1442 now = time.time()
1413 now = time.time()
1443 held = 0
1414 held = 0
1444
1415
1445 def report(vfs, name, method):
1416 def report(vfs, name, method):
1446 # this causes stale locks to get reaped for more accurate reporting
1417 # this causes stale locks to get reaped for more accurate reporting
1447 try:
1418 try:
1448 l = method(False)
1419 l = method(False)
1449 except error.LockHeld:
1420 except error.LockHeld:
1450 l = None
1421 l = None
1451
1422
1452 if l:
1423 if l:
1453 l.release()
1424 l.release()
1454 else:
1425 else:
1455 try:
1426 try:
1456 st = vfs.lstat(name)
1427 st = vfs.lstat(name)
1457 age = now - st[stat.ST_MTIME]
1428 age = now - st[stat.ST_MTIME]
1458 user = util.username(st.st_uid)
1429 user = util.username(st.st_uid)
1459 locker = vfs.readlock(name)
1430 locker = vfs.readlock(name)
1460 if ":" in locker:
1431 if ":" in locker:
1461 host, pid = locker.split(':')
1432 host, pid = locker.split(':')
1462 if host == socket.gethostname():
1433 if host == socket.gethostname():
1463 locker = 'user %s, process %s' % (user, pid)
1434 locker = 'user %s, process %s' % (user, pid)
1464 else:
1435 else:
1465 locker = 'user %s, process %s, host %s' \
1436 locker = 'user %s, process %s, host %s' \
1466 % (user, pid, host)
1437 % (user, pid, host)
1467 ui.write(("%-6s %s (%ds)\n") % (name + ":", locker, age))
1438 ui.write(("%-6s %s (%ds)\n") % (name + ":", locker, age))
1468 return 1
1439 return 1
1469 except OSError as e:
1440 except OSError as e:
1470 if e.errno != errno.ENOENT:
1441 if e.errno != errno.ENOENT:
1471 raise
1442 raise
1472
1443
1473 ui.write(("%-6s free\n") % (name + ":"))
1444 ui.write(("%-6s free\n") % (name + ":"))
1474 return 0
1445 return 0
1475
1446
1476 held += report(repo.svfs, "lock", repo.lock)
1447 held += report(repo.svfs, "lock", repo.lock)
1477 held += report(repo.vfs, "wlock", repo.wlock)
1448 held += report(repo.vfs, "wlock", repo.wlock)
1478
1449
1479 return held
1450 return held
1480
1451
1481 @command('debugmanifestfulltextcache', [
1452 @command('debugmanifestfulltextcache', [
1482 ('', 'clear', False, _('clear the cache')),
1453 ('', 'clear', False, _('clear the cache')),
1483 ('a', 'add', '', _('add the given manifest node to the cache'),
1454 ('a', 'add', '', _('add the given manifest node to the cache'),
1484 _('NODE'))
1455 _('NODE'))
1485 ], '')
1456 ], '')
1486 def debugmanifestfulltextcache(ui, repo, add=None, **opts):
1457 def debugmanifestfulltextcache(ui, repo, add=None, **opts):
1487 """show, clear or amend the contents of the manifest fulltext cache"""
1458 """show, clear or amend the contents of the manifest fulltext cache"""
1488 with repo.lock():
1459 with repo.lock():
1489 r = repo.manifestlog.getstorage(b'')
1460 r = repo.manifestlog.getstorage(b'')
1490 try:
1461 try:
1491 cache = r._fulltextcache
1462 cache = r._fulltextcache
1492 except AttributeError:
1463 except AttributeError:
1493 ui.warn(_(
1464 ui.warn(_(
1494 "Current revlog implementation doesn't appear to have a "
1465 "Current revlog implementation doesn't appear to have a "
1495 'manifest fulltext cache\n'))
1466 'manifest fulltext cache\n'))
1496 return
1467 return
1497
1468
1498 if opts.get(r'clear'):
1469 if opts.get(r'clear'):
1499 cache.clear()
1470 cache.clear()
1500
1471
1501 if add:
1472 if add:
1502 try:
1473 try:
1503 manifest = repo.manifestlog[r.lookup(add)]
1474 manifest = repo.manifestlog[r.lookup(add)]
1504 except error.LookupError as e:
1475 except error.LookupError as e:
1505 raise error.Abort(e, hint="Check your manifest node id")
1476 raise error.Abort(e, hint="Check your manifest node id")
1506 manifest.read() # stores revisision in cache too
1477 manifest.read() # stores revisision in cache too
1507
1478
1508 if not len(cache):
1479 if not len(cache):
1509 ui.write(_('Cache empty'))
1480 ui.write(_('Cache empty'))
1510 else:
1481 else:
1511 ui.write(
1482 ui.write(
1512 _('Cache contains %d manifest entries, in order of most to '
1483 _('Cache contains %d manifest entries, in order of most to '
1513 'least recent:\n') % (len(cache),))
1484 'least recent:\n') % (len(cache),))
1514 totalsize = 0
1485 totalsize = 0
1515 for nodeid in cache:
1486 for nodeid in cache:
1516 # Use cache.get to not update the LRU order
1487 # Use cache.get to not update the LRU order
1517 data = cache.get(nodeid)
1488 data = cache.get(nodeid)
1518 size = len(data)
1489 size = len(data)
1519 totalsize += size + 24 # 20 bytes nodeid, 4 bytes size
1490 totalsize += size + 24 # 20 bytes nodeid, 4 bytes size
1520 ui.write(_('id: %s, size %s\n') % (
1491 ui.write(_('id: %s, size %s\n') % (
1521 hex(nodeid), util.bytecount(size)))
1492 hex(nodeid), util.bytecount(size)))
1522 ondisk = cache._opener.stat('manifestfulltextcache').st_size
1493 ondisk = cache._opener.stat('manifestfulltextcache').st_size
1523 ui.write(
1494 ui.write(
1524 _('Total cache data size %s, on-disk %s\n') % (
1495 _('Total cache data size %s, on-disk %s\n') % (
1525 util.bytecount(totalsize), util.bytecount(ondisk))
1496 util.bytecount(totalsize), util.bytecount(ondisk))
1526 )
1497 )
1527
1498
1528 @command('debugmergestate', [], '')
1499 @command('debugmergestate', [], '')
1529 def debugmergestate(ui, repo, *args):
1500 def debugmergestate(ui, repo, *args):
1530 """print merge state
1501 """print merge state
1531
1502
1532 Use --verbose to print out information about whether v1 or v2 merge state
1503 Use --verbose to print out information about whether v1 or v2 merge state
1533 was chosen."""
1504 was chosen."""
1534 def _hashornull(h):
1505 def _hashornull(h):
1535 if h == nullhex:
1506 if h == nullhex:
1536 return 'null'
1507 return 'null'
1537 else:
1508 else:
1538 return h
1509 return h
1539
1510
1540 def printrecords(version):
1511 def printrecords(version):
1541 ui.write(('* version %d records\n') % version)
1512 ui.write(('* version %d records\n') % version)
1542 if version == 1:
1513 if version == 1:
1543 records = v1records
1514 records = v1records
1544 else:
1515 else:
1545 records = v2records
1516 records = v2records
1546
1517
1547 for rtype, record in records:
1518 for rtype, record in records:
1548 # pretty print some record types
1519 # pretty print some record types
1549 if rtype == 'L':
1520 if rtype == 'L':
1550 ui.write(('local: %s\n') % record)
1521 ui.write(('local: %s\n') % record)
1551 elif rtype == 'O':
1522 elif rtype == 'O':
1552 ui.write(('other: %s\n') % record)
1523 ui.write(('other: %s\n') % record)
1553 elif rtype == 'm':
1524 elif rtype == 'm':
1554 driver, mdstate = record.split('\0', 1)
1525 driver, mdstate = record.split('\0', 1)
1555 ui.write(('merge driver: %s (state "%s")\n')
1526 ui.write(('merge driver: %s (state "%s")\n')
1556 % (driver, mdstate))
1527 % (driver, mdstate))
1557 elif rtype in 'FDC':
1528 elif rtype in 'FDC':
1558 r = record.split('\0')
1529 r = record.split('\0')
1559 f, state, hash, lfile, afile, anode, ofile = r[0:7]
1530 f, state, hash, lfile, afile, anode, ofile = r[0:7]
1560 if version == 1:
1531 if version == 1:
1561 onode = 'not stored in v1 format'
1532 onode = 'not stored in v1 format'
1562 flags = r[7]
1533 flags = r[7]
1563 else:
1534 else:
1564 onode, flags = r[7:9]
1535 onode, flags = r[7:9]
1565 ui.write(('file: %s (record type "%s", state "%s", hash %s)\n')
1536 ui.write(('file: %s (record type "%s", state "%s", hash %s)\n')
1566 % (f, rtype, state, _hashornull(hash)))
1537 % (f, rtype, state, _hashornull(hash)))
1567 ui.write((' local path: %s (flags "%s")\n') % (lfile, flags))
1538 ui.write((' local path: %s (flags "%s")\n') % (lfile, flags))
1568 ui.write((' ancestor path: %s (node %s)\n')
1539 ui.write((' ancestor path: %s (node %s)\n')
1569 % (afile, _hashornull(anode)))
1540 % (afile, _hashornull(anode)))
1570 ui.write((' other path: %s (node %s)\n')
1541 ui.write((' other path: %s (node %s)\n')
1571 % (ofile, _hashornull(onode)))
1542 % (ofile, _hashornull(onode)))
1572 elif rtype == 'f':
1543 elif rtype == 'f':
1573 filename, rawextras = record.split('\0', 1)
1544 filename, rawextras = record.split('\0', 1)
1574 extras = rawextras.split('\0')
1545 extras = rawextras.split('\0')
1575 i = 0
1546 i = 0
1576 extrastrings = []
1547 extrastrings = []
1577 while i < len(extras):
1548 while i < len(extras):
1578 extrastrings.append('%s = %s' % (extras[i], extras[i + 1]))
1549 extrastrings.append('%s = %s' % (extras[i], extras[i + 1]))
1579 i += 2
1550 i += 2
1580
1551
1581 ui.write(('file extras: %s (%s)\n')
1552 ui.write(('file extras: %s (%s)\n')
1582 % (filename, ', '.join(extrastrings)))
1553 % (filename, ', '.join(extrastrings)))
1583 elif rtype == 'l':
1554 elif rtype == 'l':
1584 labels = record.split('\0', 2)
1555 labels = record.split('\0', 2)
1585 labels = [l for l in labels if len(l) > 0]
1556 labels = [l for l in labels if len(l) > 0]
1586 ui.write(('labels:\n'))
1557 ui.write(('labels:\n'))
1587 ui.write((' local: %s\n' % labels[0]))
1558 ui.write((' local: %s\n' % labels[0]))
1588 ui.write((' other: %s\n' % labels[1]))
1559 ui.write((' other: %s\n' % labels[1]))
1589 if len(labels) > 2:
1560 if len(labels) > 2:
1590 ui.write((' base: %s\n' % labels[2]))
1561 ui.write((' base: %s\n' % labels[2]))
1591 else:
1562 else:
1592 ui.write(('unrecognized entry: %s\t%s\n')
1563 ui.write(('unrecognized entry: %s\t%s\n')
1593 % (rtype, record.replace('\0', '\t')))
1564 % (rtype, record.replace('\0', '\t')))
1594
1565
1595 # Avoid mergestate.read() since it may raise an exception for unsupported
1566 # Avoid mergestate.read() since it may raise an exception for unsupported
1596 # merge state records. We shouldn't be doing this, but this is OK since this
1567 # merge state records. We shouldn't be doing this, but this is OK since this
1597 # command is pretty low-level.
1568 # command is pretty low-level.
1598 ms = mergemod.mergestate(repo)
1569 ms = mergemod.mergestate(repo)
1599
1570
1600 # sort so that reasonable information is on top
1571 # sort so that reasonable information is on top
1601 v1records = ms._readrecordsv1()
1572 v1records = ms._readrecordsv1()
1602 v2records = ms._readrecordsv2()
1573 v2records = ms._readrecordsv2()
1603 order = 'LOml'
1574 order = 'LOml'
1604 def key(r):
1575 def key(r):
1605 idx = order.find(r[0])
1576 idx = order.find(r[0])
1606 if idx == -1:
1577 if idx == -1:
1607 return (1, r[1])
1578 return (1, r[1])
1608 else:
1579 else:
1609 return (0, idx)
1580 return (0, idx)
1610 v1records.sort(key=key)
1581 v1records.sort(key=key)
1611 v2records.sort(key=key)
1582 v2records.sort(key=key)
1612
1583
1613 if not v1records and not v2records:
1584 if not v1records and not v2records:
1614 ui.write(('no merge state found\n'))
1585 ui.write(('no merge state found\n'))
1615 elif not v2records:
1586 elif not v2records:
1616 ui.note(('no version 2 merge state\n'))
1587 ui.note(('no version 2 merge state\n'))
1617 printrecords(1)
1588 printrecords(1)
1618 elif ms._v1v2match(v1records, v2records):
1589 elif ms._v1v2match(v1records, v2records):
1619 ui.note(('v1 and v2 states match: using v2\n'))
1590 ui.note(('v1 and v2 states match: using v2\n'))
1620 printrecords(2)
1591 printrecords(2)
1621 else:
1592 else:
1622 ui.note(('v1 and v2 states mismatch: using v1\n'))
1593 ui.note(('v1 and v2 states mismatch: using v1\n'))
1623 printrecords(1)
1594 printrecords(1)
1624 if ui.verbose:
1595 if ui.verbose:
1625 printrecords(2)
1596 printrecords(2)
1626
1597
1627 @command('debugnamecomplete', [], _('NAME...'))
1598 @command('debugnamecomplete', [], _('NAME...'))
1628 def debugnamecomplete(ui, repo, *args):
1599 def debugnamecomplete(ui, repo, *args):
1629 '''complete "names" - tags, open branch names, bookmark names'''
1600 '''complete "names" - tags, open branch names, bookmark names'''
1630
1601
1631 names = set()
1602 names = set()
1632 # since we previously only listed open branches, we will handle that
1603 # since we previously only listed open branches, we will handle that
1633 # specially (after this for loop)
1604 # specially (after this for loop)
1634 for name, ns in repo.names.iteritems():
1605 for name, ns in repo.names.iteritems():
1635 if name != 'branches':
1606 if name != 'branches':
1636 names.update(ns.listnames(repo))
1607 names.update(ns.listnames(repo))
1637 names.update(tag for (tag, heads, tip, closed)
1608 names.update(tag for (tag, heads, tip, closed)
1638 in repo.branchmap().iterbranches() if not closed)
1609 in repo.branchmap().iterbranches() if not closed)
1639 completions = set()
1610 completions = set()
1640 if not args:
1611 if not args:
1641 args = ['']
1612 args = ['']
1642 for a in args:
1613 for a in args:
1643 completions.update(n for n in names if n.startswith(a))
1614 completions.update(n for n in names if n.startswith(a))
1644 ui.write('\n'.join(sorted(completions)))
1615 ui.write('\n'.join(sorted(completions)))
1645 ui.write('\n')
1616 ui.write('\n')
1646
1617
1647 @command('debugobsolete',
1618 @command('debugobsolete',
1648 [('', 'flags', 0, _('markers flag')),
1619 [('', 'flags', 0, _('markers flag')),
1649 ('', 'record-parents', False,
1620 ('', 'record-parents', False,
1650 _('record parent information for the precursor')),
1621 _('record parent information for the precursor')),
1651 ('r', 'rev', [], _('display markers relevant to REV')),
1622 ('r', 'rev', [], _('display markers relevant to REV')),
1652 ('', 'exclusive', False, _('restrict display to markers only '
1623 ('', 'exclusive', False, _('restrict display to markers only '
1653 'relevant to REV')),
1624 'relevant to REV')),
1654 ('', 'index', False, _('display index of the marker')),
1625 ('', 'index', False, _('display index of the marker')),
1655 ('', 'delete', [], _('delete markers specified by indices')),
1626 ('', 'delete', [], _('delete markers specified by indices')),
1656 ] + cmdutil.commitopts2 + cmdutil.formatteropts,
1627 ] + cmdutil.commitopts2 + cmdutil.formatteropts,
1657 _('[OBSOLETED [REPLACEMENT ...]]'))
1628 _('[OBSOLETED [REPLACEMENT ...]]'))
1658 def debugobsolete(ui, repo, precursor=None, *successors, **opts):
1629 def debugobsolete(ui, repo, precursor=None, *successors, **opts):
1659 """create arbitrary obsolete marker
1630 """create arbitrary obsolete marker
1660
1631
1661 With no arguments, displays the list of obsolescence markers."""
1632 With no arguments, displays the list of obsolescence markers."""
1662
1633
1663 opts = pycompat.byteskwargs(opts)
1634 opts = pycompat.byteskwargs(opts)
1664
1635
1665 def parsenodeid(s):
1636 def parsenodeid(s):
1666 try:
1637 try:
1667 # We do not use revsingle/revrange functions here to accept
1638 # We do not use revsingle/revrange functions here to accept
1668 # arbitrary node identifiers, possibly not present in the
1639 # arbitrary node identifiers, possibly not present in the
1669 # local repository.
1640 # local repository.
1670 n = bin(s)
1641 n = bin(s)
1671 if len(n) != len(nullid):
1642 if len(n) != len(nullid):
1672 raise TypeError()
1643 raise TypeError()
1673 return n
1644 return n
1674 except TypeError:
1645 except TypeError:
1675 raise error.Abort('changeset references must be full hexadecimal '
1646 raise error.Abort('changeset references must be full hexadecimal '
1676 'node identifiers')
1647 'node identifiers')
1677
1648
1678 if opts.get('delete'):
1649 if opts.get('delete'):
1679 indices = []
1650 indices = []
1680 for v in opts.get('delete'):
1651 for v in opts.get('delete'):
1681 try:
1652 try:
1682 indices.append(int(v))
1653 indices.append(int(v))
1683 except ValueError:
1654 except ValueError:
1684 raise error.Abort(_('invalid index value: %r') % v,
1655 raise error.Abort(_('invalid index value: %r') % v,
1685 hint=_('use integers for indices'))
1656 hint=_('use integers for indices'))
1686
1657
1687 if repo.currenttransaction():
1658 if repo.currenttransaction():
1688 raise error.Abort(_('cannot delete obsmarkers in the middle '
1659 raise error.Abort(_('cannot delete obsmarkers in the middle '
1689 'of transaction.'))
1660 'of transaction.'))
1690
1661
1691 with repo.lock():
1662 with repo.lock():
1692 n = repair.deleteobsmarkers(repo.obsstore, indices)
1663 n = repair.deleteobsmarkers(repo.obsstore, indices)
1693 ui.write(_('deleted %i obsolescence markers\n') % n)
1664 ui.write(_('deleted %i obsolescence markers\n') % n)
1694
1665
1695 return
1666 return
1696
1667
1697 if precursor is not None:
1668 if precursor is not None:
1698 if opts['rev']:
1669 if opts['rev']:
1699 raise error.Abort('cannot select revision when creating marker')
1670 raise error.Abort('cannot select revision when creating marker')
1700 metadata = {}
1671 metadata = {}
1701 metadata['user'] = encoding.fromlocal(opts['user'] or ui.username())
1672 metadata['user'] = encoding.fromlocal(opts['user'] or ui.username())
1702 succs = tuple(parsenodeid(succ) for succ in successors)
1673 succs = tuple(parsenodeid(succ) for succ in successors)
1703 l = repo.lock()
1674 l = repo.lock()
1704 try:
1675 try:
1705 tr = repo.transaction('debugobsolete')
1676 tr = repo.transaction('debugobsolete')
1706 try:
1677 try:
1707 date = opts.get('date')
1678 date = opts.get('date')
1708 if date:
1679 if date:
1709 date = dateutil.parsedate(date)
1680 date = dateutil.parsedate(date)
1710 else:
1681 else:
1711 date = None
1682 date = None
1712 prec = parsenodeid(precursor)
1683 prec = parsenodeid(precursor)
1713 parents = None
1684 parents = None
1714 if opts['record_parents']:
1685 if opts['record_parents']:
1715 if prec not in repo.unfiltered():
1686 if prec not in repo.unfiltered():
1716 raise error.Abort('cannot used --record-parents on '
1687 raise error.Abort('cannot used --record-parents on '
1717 'unknown changesets')
1688 'unknown changesets')
1718 parents = repo.unfiltered()[prec].parents()
1689 parents = repo.unfiltered()[prec].parents()
1719 parents = tuple(p.node() for p in parents)
1690 parents = tuple(p.node() for p in parents)
1720 repo.obsstore.create(tr, prec, succs, opts['flags'],
1691 repo.obsstore.create(tr, prec, succs, opts['flags'],
1721 parents=parents, date=date,
1692 parents=parents, date=date,
1722 metadata=metadata, ui=ui)
1693 metadata=metadata, ui=ui)
1723 tr.close()
1694 tr.close()
1724 except ValueError as exc:
1695 except ValueError as exc:
1725 raise error.Abort(_('bad obsmarker input: %s') %
1696 raise error.Abort(_('bad obsmarker input: %s') %
1726 pycompat.bytestr(exc))
1697 pycompat.bytestr(exc))
1727 finally:
1698 finally:
1728 tr.release()
1699 tr.release()
1729 finally:
1700 finally:
1730 l.release()
1701 l.release()
1731 else:
1702 else:
1732 if opts['rev']:
1703 if opts['rev']:
1733 revs = scmutil.revrange(repo, opts['rev'])
1704 revs = scmutil.revrange(repo, opts['rev'])
1734 nodes = [repo[r].node() for r in revs]
1705 nodes = [repo[r].node() for r in revs]
1735 markers = list(obsutil.getmarkers(repo, nodes=nodes,
1706 markers = list(obsutil.getmarkers(repo, nodes=nodes,
1736 exclusive=opts['exclusive']))
1707 exclusive=opts['exclusive']))
1737 markers.sort(key=lambda x: x._data)
1708 markers.sort(key=lambda x: x._data)
1738 else:
1709 else:
1739 markers = obsutil.getmarkers(repo)
1710 markers = obsutil.getmarkers(repo)
1740
1711
1741 markerstoiter = markers
1712 markerstoiter = markers
1742 isrelevant = lambda m: True
1713 isrelevant = lambda m: True
1743 if opts.get('rev') and opts.get('index'):
1714 if opts.get('rev') and opts.get('index'):
1744 markerstoiter = obsutil.getmarkers(repo)
1715 markerstoiter = obsutil.getmarkers(repo)
1745 markerset = set(markers)
1716 markerset = set(markers)
1746 isrelevant = lambda m: m in markerset
1717 isrelevant = lambda m: m in markerset
1747
1718
1748 fm = ui.formatter('debugobsolete', opts)
1719 fm = ui.formatter('debugobsolete', opts)
1749 for i, m in enumerate(markerstoiter):
1720 for i, m in enumerate(markerstoiter):
1750 if not isrelevant(m):
1721 if not isrelevant(m):
1751 # marker can be irrelevant when we're iterating over a set
1722 # marker can be irrelevant when we're iterating over a set
1752 # of markers (markerstoiter) which is bigger than the set
1723 # of markers (markerstoiter) which is bigger than the set
1753 # of markers we want to display (markers)
1724 # of markers we want to display (markers)
1754 # this can happen if both --index and --rev options are
1725 # this can happen if both --index and --rev options are
1755 # provided and thus we need to iterate over all of the markers
1726 # provided and thus we need to iterate over all of the markers
1756 # to get the correct indices, but only display the ones that
1727 # to get the correct indices, but only display the ones that
1757 # are relevant to --rev value
1728 # are relevant to --rev value
1758 continue
1729 continue
1759 fm.startitem()
1730 fm.startitem()
1760 ind = i if opts.get('index') else None
1731 ind = i if opts.get('index') else None
1761 cmdutil.showmarker(fm, m, index=ind)
1732 cmdutil.showmarker(fm, m, index=ind)
1762 fm.end()
1733 fm.end()
1763
1734
1764 @command('debugpathcomplete',
1735 @command('debugpathcomplete',
1765 [('f', 'full', None, _('complete an entire path')),
1736 [('f', 'full', None, _('complete an entire path')),
1766 ('n', 'normal', None, _('show only normal files')),
1737 ('n', 'normal', None, _('show only normal files')),
1767 ('a', 'added', None, _('show only added files')),
1738 ('a', 'added', None, _('show only added files')),
1768 ('r', 'removed', None, _('show only removed files'))],
1739 ('r', 'removed', None, _('show only removed files'))],
1769 _('FILESPEC...'))
1740 _('FILESPEC...'))
1770 def debugpathcomplete(ui, repo, *specs, **opts):
1741 def debugpathcomplete(ui, repo, *specs, **opts):
1771 '''complete part or all of a tracked path
1742 '''complete part or all of a tracked path
1772
1743
1773 This command supports shells that offer path name completion. It
1744 This command supports shells that offer path name completion. It
1774 currently completes only files already known to the dirstate.
1745 currently completes only files already known to the dirstate.
1775
1746
1776 Completion extends only to the next path segment unless
1747 Completion extends only to the next path segment unless
1777 --full is specified, in which case entire paths are used.'''
1748 --full is specified, in which case entire paths are used.'''
1778
1749
1779 def complete(path, acceptable):
1750 def complete(path, acceptable):
1780 dirstate = repo.dirstate
1751 dirstate = repo.dirstate
1781 spec = os.path.normpath(os.path.join(pycompat.getcwd(), path))
1752 spec = os.path.normpath(os.path.join(pycompat.getcwd(), path))
1782 rootdir = repo.root + pycompat.ossep
1753 rootdir = repo.root + pycompat.ossep
1783 if spec != repo.root and not spec.startswith(rootdir):
1754 if spec != repo.root and not spec.startswith(rootdir):
1784 return [], []
1755 return [], []
1785 if os.path.isdir(spec):
1756 if os.path.isdir(spec):
1786 spec += '/'
1757 spec += '/'
1787 spec = spec[len(rootdir):]
1758 spec = spec[len(rootdir):]
1788 fixpaths = pycompat.ossep != '/'
1759 fixpaths = pycompat.ossep != '/'
1789 if fixpaths:
1760 if fixpaths:
1790 spec = spec.replace(pycompat.ossep, '/')
1761 spec = spec.replace(pycompat.ossep, '/')
1791 speclen = len(spec)
1762 speclen = len(spec)
1792 fullpaths = opts[r'full']
1763 fullpaths = opts[r'full']
1793 files, dirs = set(), set()
1764 files, dirs = set(), set()
1794 adddir, addfile = dirs.add, files.add
1765 adddir, addfile = dirs.add, files.add
1795 for f, st in dirstate.iteritems():
1766 for f, st in dirstate.iteritems():
1796 if f.startswith(spec) and st[0] in acceptable:
1767 if f.startswith(spec) and st[0] in acceptable:
1797 if fixpaths:
1768 if fixpaths:
1798 f = f.replace('/', pycompat.ossep)
1769 f = f.replace('/', pycompat.ossep)
1799 if fullpaths:
1770 if fullpaths:
1800 addfile(f)
1771 addfile(f)
1801 continue
1772 continue
1802 s = f.find(pycompat.ossep, speclen)
1773 s = f.find(pycompat.ossep, speclen)
1803 if s >= 0:
1774 if s >= 0:
1804 adddir(f[:s])
1775 adddir(f[:s])
1805 else:
1776 else:
1806 addfile(f)
1777 addfile(f)
1807 return files, dirs
1778 return files, dirs
1808
1779
1809 acceptable = ''
1780 acceptable = ''
1810 if opts[r'normal']:
1781 if opts[r'normal']:
1811 acceptable += 'nm'
1782 acceptable += 'nm'
1812 if opts[r'added']:
1783 if opts[r'added']:
1813 acceptable += 'a'
1784 acceptable += 'a'
1814 if opts[r'removed']:
1785 if opts[r'removed']:
1815 acceptable += 'r'
1786 acceptable += 'r'
1816 cwd = repo.getcwd()
1787 cwd = repo.getcwd()
1817 if not specs:
1788 if not specs:
1818 specs = ['.']
1789 specs = ['.']
1819
1790
1820 files, dirs = set(), set()
1791 files, dirs = set(), set()
1821 for spec in specs:
1792 for spec in specs:
1822 f, d = complete(spec, acceptable or 'nmar')
1793 f, d = complete(spec, acceptable or 'nmar')
1823 files.update(f)
1794 files.update(f)
1824 dirs.update(d)
1795 dirs.update(d)
1825 files.update(dirs)
1796 files.update(dirs)
1826 ui.write('\n'.join(repo.pathto(p, cwd) for p in sorted(files)))
1797 ui.write('\n'.join(repo.pathto(p, cwd) for p in sorted(files)))
1827 ui.write('\n')
1798 ui.write('\n')
1828
1799
1829 @command('debugpeer', [], _('PATH'), norepo=True)
1800 @command('debugpeer', [], _('PATH'), norepo=True)
1830 def debugpeer(ui, path):
1801 def debugpeer(ui, path):
1831 """establish a connection to a peer repository"""
1802 """establish a connection to a peer repository"""
1832 # Always enable peer request logging. Requires --debug to display
1803 # Always enable peer request logging. Requires --debug to display
1833 # though.
1804 # though.
1834 overrides = {
1805 overrides = {
1835 ('devel', 'debug.peer-request'): True,
1806 ('devel', 'debug.peer-request'): True,
1836 }
1807 }
1837
1808
1838 with ui.configoverride(overrides):
1809 with ui.configoverride(overrides):
1839 peer = hg.peer(ui, {}, path)
1810 peer = hg.peer(ui, {}, path)
1840
1811
1841 local = peer.local() is not None
1812 local = peer.local() is not None
1842 canpush = peer.canpush()
1813 canpush = peer.canpush()
1843
1814
1844 ui.write(_('url: %s\n') % peer.url())
1815 ui.write(_('url: %s\n') % peer.url())
1845 ui.write(_('local: %s\n') % (_('yes') if local else _('no')))
1816 ui.write(_('local: %s\n') % (_('yes') if local else _('no')))
1846 ui.write(_('pushable: %s\n') % (_('yes') if canpush else _('no')))
1817 ui.write(_('pushable: %s\n') % (_('yes') if canpush else _('no')))
1847
1818
1848 @command('debugpickmergetool',
1819 @command('debugpickmergetool',
1849 [('r', 'rev', '', _('check for files in this revision'), _('REV')),
1820 [('r', 'rev', '', _('check for files in this revision'), _('REV')),
1850 ('', 'changedelete', None, _('emulate merging change and delete')),
1821 ('', 'changedelete', None, _('emulate merging change and delete')),
1851 ] + cmdutil.walkopts + cmdutil.mergetoolopts,
1822 ] + cmdutil.walkopts + cmdutil.mergetoolopts,
1852 _('[PATTERN]...'),
1823 _('[PATTERN]...'),
1853 inferrepo=True)
1824 inferrepo=True)
1854 def debugpickmergetool(ui, repo, *pats, **opts):
1825 def debugpickmergetool(ui, repo, *pats, **opts):
1855 """examine which merge tool is chosen for specified file
1826 """examine which merge tool is chosen for specified file
1856
1827
1857 As described in :hg:`help merge-tools`, Mercurial examines
1828 As described in :hg:`help merge-tools`, Mercurial examines
1858 configurations below in this order to decide which merge tool is
1829 configurations below in this order to decide which merge tool is
1859 chosen for specified file.
1830 chosen for specified file.
1860
1831
1861 1. ``--tool`` option
1832 1. ``--tool`` option
1862 2. ``HGMERGE`` environment variable
1833 2. ``HGMERGE`` environment variable
1863 3. configurations in ``merge-patterns`` section
1834 3. configurations in ``merge-patterns`` section
1864 4. configuration of ``ui.merge``
1835 4. configuration of ``ui.merge``
1865 5. configurations in ``merge-tools`` section
1836 5. configurations in ``merge-tools`` section
1866 6. ``hgmerge`` tool (for historical reason only)
1837 6. ``hgmerge`` tool (for historical reason only)
1867 7. default tool for fallback (``:merge`` or ``:prompt``)
1838 7. default tool for fallback (``:merge`` or ``:prompt``)
1868
1839
1869 This command writes out examination result in the style below::
1840 This command writes out examination result in the style below::
1870
1841
1871 FILE = MERGETOOL
1842 FILE = MERGETOOL
1872
1843
1873 By default, all files known in the first parent context of the
1844 By default, all files known in the first parent context of the
1874 working directory are examined. Use file patterns and/or -I/-X
1845 working directory are examined. Use file patterns and/or -I/-X
1875 options to limit target files. -r/--rev is also useful to examine
1846 options to limit target files. -r/--rev is also useful to examine
1876 files in another context without actual updating to it.
1847 files in another context without actual updating to it.
1877
1848
1878 With --debug, this command shows warning messages while matching
1849 With --debug, this command shows warning messages while matching
1879 against ``merge-patterns`` and so on, too. It is recommended to
1850 against ``merge-patterns`` and so on, too. It is recommended to
1880 use this option with explicit file patterns and/or -I/-X options,
1851 use this option with explicit file patterns and/or -I/-X options,
1881 because this option increases amount of output per file according
1852 because this option increases amount of output per file according
1882 to configurations in hgrc.
1853 to configurations in hgrc.
1883
1854
1884 With -v/--verbose, this command shows configurations below at
1855 With -v/--verbose, this command shows configurations below at
1885 first (only if specified).
1856 first (only if specified).
1886
1857
1887 - ``--tool`` option
1858 - ``--tool`` option
1888 - ``HGMERGE`` environment variable
1859 - ``HGMERGE`` environment variable
1889 - configuration of ``ui.merge``
1860 - configuration of ``ui.merge``
1890
1861
1891 If merge tool is chosen before matching against
1862 If merge tool is chosen before matching against
1892 ``merge-patterns``, this command can't show any helpful
1863 ``merge-patterns``, this command can't show any helpful
1893 information, even with --debug. In such case, information above is
1864 information, even with --debug. In such case, information above is
1894 useful to know why a merge tool is chosen.
1865 useful to know why a merge tool is chosen.
1895 """
1866 """
1896 opts = pycompat.byteskwargs(opts)
1867 opts = pycompat.byteskwargs(opts)
1897 overrides = {}
1868 overrides = {}
1898 if opts['tool']:
1869 if opts['tool']:
1899 overrides[('ui', 'forcemerge')] = opts['tool']
1870 overrides[('ui', 'forcemerge')] = opts['tool']
1900 ui.note(('with --tool %r\n') % (pycompat.bytestr(opts['tool'])))
1871 ui.note(('with --tool %r\n') % (pycompat.bytestr(opts['tool'])))
1901
1872
1902 with ui.configoverride(overrides, 'debugmergepatterns'):
1873 with ui.configoverride(overrides, 'debugmergepatterns'):
1903 hgmerge = encoding.environ.get("HGMERGE")
1874 hgmerge = encoding.environ.get("HGMERGE")
1904 if hgmerge is not None:
1875 if hgmerge is not None:
1905 ui.note(('with HGMERGE=%r\n') % (pycompat.bytestr(hgmerge)))
1876 ui.note(('with HGMERGE=%r\n') % (pycompat.bytestr(hgmerge)))
1906 uimerge = ui.config("ui", "merge")
1877 uimerge = ui.config("ui", "merge")
1907 if uimerge:
1878 if uimerge:
1908 ui.note(('with ui.merge=%r\n') % (pycompat.bytestr(uimerge)))
1879 ui.note(('with ui.merge=%r\n') % (pycompat.bytestr(uimerge)))
1909
1880
1910 ctx = scmutil.revsingle(repo, opts.get('rev'))
1881 ctx = scmutil.revsingle(repo, opts.get('rev'))
1911 m = scmutil.match(ctx, pats, opts)
1882 m = scmutil.match(ctx, pats, opts)
1912 changedelete = opts['changedelete']
1883 changedelete = opts['changedelete']
1913 for path in ctx.walk(m):
1884 for path in ctx.walk(m):
1914 fctx = ctx[path]
1885 fctx = ctx[path]
1915 try:
1886 try:
1916 if not ui.debugflag:
1887 if not ui.debugflag:
1917 ui.pushbuffer(error=True)
1888 ui.pushbuffer(error=True)
1918 tool, toolpath = filemerge._picktool(repo, ui, path,
1889 tool, toolpath = filemerge._picktool(repo, ui, path,
1919 fctx.isbinary(),
1890 fctx.isbinary(),
1920 'l' in fctx.flags(),
1891 'l' in fctx.flags(),
1921 changedelete)
1892 changedelete)
1922 finally:
1893 finally:
1923 if not ui.debugflag:
1894 if not ui.debugflag:
1924 ui.popbuffer()
1895 ui.popbuffer()
1925 ui.write(('%s = %s\n') % (path, tool))
1896 ui.write(('%s = %s\n') % (path, tool))
1926
1897
1927 @command('debugpushkey', [], _('REPO NAMESPACE [KEY OLD NEW]'), norepo=True)
1898 @command('debugpushkey', [], _('REPO NAMESPACE [KEY OLD NEW]'), norepo=True)
1928 def debugpushkey(ui, repopath, namespace, *keyinfo, **opts):
1899 def debugpushkey(ui, repopath, namespace, *keyinfo, **opts):
1929 '''access the pushkey key/value protocol
1900 '''access the pushkey key/value protocol
1930
1901
1931 With two args, list the keys in the given namespace.
1902 With two args, list the keys in the given namespace.
1932
1903
1933 With five args, set a key to new if it currently is set to old.
1904 With five args, set a key to new if it currently is set to old.
1934 Reports success or failure.
1905 Reports success or failure.
1935 '''
1906 '''
1936
1907
1937 target = hg.peer(ui, {}, repopath)
1908 target = hg.peer(ui, {}, repopath)
1938 if keyinfo:
1909 if keyinfo:
1939 key, old, new = keyinfo
1910 key, old, new = keyinfo
1940 with target.commandexecutor() as e:
1911 with target.commandexecutor() as e:
1941 r = e.callcommand('pushkey', {
1912 r = e.callcommand('pushkey', {
1942 'namespace': namespace,
1913 'namespace': namespace,
1943 'key': key,
1914 'key': key,
1944 'old': old,
1915 'old': old,
1945 'new': new,
1916 'new': new,
1946 }).result()
1917 }).result()
1947
1918
1948 ui.status(pycompat.bytestr(r) + '\n')
1919 ui.status(pycompat.bytestr(r) + '\n')
1949 return not r
1920 return not r
1950 else:
1921 else:
1951 for k, v in sorted(target.listkeys(namespace).iteritems()):
1922 for k, v in sorted(target.listkeys(namespace).iteritems()):
1952 ui.write("%s\t%s\n" % (stringutil.escapestr(k),
1923 ui.write("%s\t%s\n" % (stringutil.escapestr(k),
1953 stringutil.escapestr(v)))
1924 stringutil.escapestr(v)))
1954
1925
1955 @command('debugpvec', [], _('A B'))
1926 @command('debugpvec', [], _('A B'))
1956 def debugpvec(ui, repo, a, b=None):
1927 def debugpvec(ui, repo, a, b=None):
1957 ca = scmutil.revsingle(repo, a)
1928 ca = scmutil.revsingle(repo, a)
1958 cb = scmutil.revsingle(repo, b)
1929 cb = scmutil.revsingle(repo, b)
1959 pa = pvec.ctxpvec(ca)
1930 pa = pvec.ctxpvec(ca)
1960 pb = pvec.ctxpvec(cb)
1931 pb = pvec.ctxpvec(cb)
1961 if pa == pb:
1932 if pa == pb:
1962 rel = "="
1933 rel = "="
1963 elif pa > pb:
1934 elif pa > pb:
1964 rel = ">"
1935 rel = ">"
1965 elif pa < pb:
1936 elif pa < pb:
1966 rel = "<"
1937 rel = "<"
1967 elif pa | pb:
1938 elif pa | pb:
1968 rel = "|"
1939 rel = "|"
1969 ui.write(_("a: %s\n") % pa)
1940 ui.write(_("a: %s\n") % pa)
1970 ui.write(_("b: %s\n") % pb)
1941 ui.write(_("b: %s\n") % pb)
1971 ui.write(_("depth(a): %d depth(b): %d\n") % (pa._depth, pb._depth))
1942 ui.write(_("depth(a): %d depth(b): %d\n") % (pa._depth, pb._depth))
1972 ui.write(_("delta: %d hdist: %d distance: %d relation: %s\n") %
1943 ui.write(_("delta: %d hdist: %d distance: %d relation: %s\n") %
1973 (abs(pa._depth - pb._depth), pvec._hamming(pa._vec, pb._vec),
1944 (abs(pa._depth - pb._depth), pvec._hamming(pa._vec, pb._vec),
1974 pa.distance(pb), rel))
1945 pa.distance(pb), rel))
1975
1946
1976 @command('debugrebuilddirstate|debugrebuildstate',
1947 @command('debugrebuilddirstate|debugrebuildstate',
1977 [('r', 'rev', '', _('revision to rebuild to'), _('REV')),
1948 [('r', 'rev', '', _('revision to rebuild to'), _('REV')),
1978 ('', 'minimal', None, _('only rebuild files that are inconsistent with '
1949 ('', 'minimal', None, _('only rebuild files that are inconsistent with '
1979 'the working copy parent')),
1950 'the working copy parent')),
1980 ],
1951 ],
1981 _('[-r REV]'))
1952 _('[-r REV]'))
1982 def debugrebuilddirstate(ui, repo, rev, **opts):
1953 def debugrebuilddirstate(ui, repo, rev, **opts):
1983 """rebuild the dirstate as it would look like for the given revision
1954 """rebuild the dirstate as it would look like for the given revision
1984
1955
1985 If no revision is specified the first current parent will be used.
1956 If no revision is specified the first current parent will be used.
1986
1957
1987 The dirstate will be set to the files of the given revision.
1958 The dirstate will be set to the files of the given revision.
1988 The actual working directory content or existing dirstate
1959 The actual working directory content or existing dirstate
1989 information such as adds or removes is not considered.
1960 information such as adds or removes is not considered.
1990
1961
1991 ``minimal`` will only rebuild the dirstate status for files that claim to be
1962 ``minimal`` will only rebuild the dirstate status for files that claim to be
1992 tracked but are not in the parent manifest, or that exist in the parent
1963 tracked but are not in the parent manifest, or that exist in the parent
1993 manifest but are not in the dirstate. It will not change adds, removes, or
1964 manifest but are not in the dirstate. It will not change adds, removes, or
1994 modified files that are in the working copy parent.
1965 modified files that are in the working copy parent.
1995
1966
1996 One use of this command is to make the next :hg:`status` invocation
1967 One use of this command is to make the next :hg:`status` invocation
1997 check the actual file content.
1968 check the actual file content.
1998 """
1969 """
1999 ctx = scmutil.revsingle(repo, rev)
1970 ctx = scmutil.revsingle(repo, rev)
2000 with repo.wlock():
1971 with repo.wlock():
2001 dirstate = repo.dirstate
1972 dirstate = repo.dirstate
2002 changedfiles = None
1973 changedfiles = None
2003 # See command doc for what minimal does.
1974 # See command doc for what minimal does.
2004 if opts.get(r'minimal'):
1975 if opts.get(r'minimal'):
2005 manifestfiles = set(ctx.manifest().keys())
1976 manifestfiles = set(ctx.manifest().keys())
2006 dirstatefiles = set(dirstate)
1977 dirstatefiles = set(dirstate)
2007 manifestonly = manifestfiles - dirstatefiles
1978 manifestonly = manifestfiles - dirstatefiles
2008 dsonly = dirstatefiles - manifestfiles
1979 dsonly = dirstatefiles - manifestfiles
2009 dsnotadded = set(f for f in dsonly if dirstate[f] != 'a')
1980 dsnotadded = set(f for f in dsonly if dirstate[f] != 'a')
2010 changedfiles = manifestonly | dsnotadded
1981 changedfiles = manifestonly | dsnotadded
2011
1982
2012 dirstate.rebuild(ctx.node(), ctx.manifest(), changedfiles)
1983 dirstate.rebuild(ctx.node(), ctx.manifest(), changedfiles)
2013
1984
2014 @command('debugrebuildfncache', [], '')
1985 @command('debugrebuildfncache', [], '')
2015 def debugrebuildfncache(ui, repo):
1986 def debugrebuildfncache(ui, repo):
2016 """rebuild the fncache file"""
1987 """rebuild the fncache file"""
2017 repair.rebuildfncache(ui, repo)
1988 repair.rebuildfncache(ui, repo)
2018
1989
2019 @command('debugrename',
1990 @command('debugrename',
2020 [('r', 'rev', '', _('revision to debug'), _('REV'))],
1991 [('r', 'rev', '', _('revision to debug'), _('REV'))],
2021 _('[-r REV] FILE'))
1992 _('[-r REV] FILE'))
2022 def debugrename(ui, repo, file1, *pats, **opts):
1993 def debugrename(ui, repo, file1, *pats, **opts):
2023 """dump rename information"""
1994 """dump rename information"""
2024
1995
2025 opts = pycompat.byteskwargs(opts)
1996 opts = pycompat.byteskwargs(opts)
2026 ctx = scmutil.revsingle(repo, opts.get('rev'))
1997 ctx = scmutil.revsingle(repo, opts.get('rev'))
2027 m = scmutil.match(ctx, (file1,) + pats, opts)
1998 m = scmutil.match(ctx, (file1,) + pats, opts)
2028 for abs in ctx.walk(m):
1999 for abs in ctx.walk(m):
2029 fctx = ctx[abs]
2000 fctx = ctx[abs]
2030 o = fctx.filelog().renamed(fctx.filenode())
2001 o = fctx.filelog().renamed(fctx.filenode())
2031 rel = m.rel(abs)
2002 rel = m.rel(abs)
2032 if o:
2003 if o:
2033 ui.write(_("%s renamed from %s:%s\n") % (rel, o[0], hex(o[1])))
2004 ui.write(_("%s renamed from %s:%s\n") % (rel, o[0], hex(o[1])))
2034 else:
2005 else:
2035 ui.write(_("%s not renamed\n") % rel)
2006 ui.write(_("%s not renamed\n") % rel)
2036
2007
2037 @command('debugrevlog', cmdutil.debugrevlogopts +
2008 @command('debugrevlog', cmdutil.debugrevlogopts +
2038 [('d', 'dump', False, _('dump index data'))],
2009 [('d', 'dump', False, _('dump index data'))],
2039 _('-c|-m|FILE'),
2010 _('-c|-m|FILE'),
2040 optionalrepo=True)
2011 optionalrepo=True)
2041 def debugrevlog(ui, repo, file_=None, **opts):
2012 def debugrevlog(ui, repo, file_=None, **opts):
2042 """show data and statistics about a revlog"""
2013 """show data and statistics about a revlog"""
2043 opts = pycompat.byteskwargs(opts)
2014 opts = pycompat.byteskwargs(opts)
2044 r = cmdutil.openrevlog(repo, 'debugrevlog', file_, opts)
2015 r = cmdutil.openrevlog(repo, 'debugrevlog', file_, opts)
2045
2016
2046 if opts.get("dump"):
2017 if opts.get("dump"):
2047 numrevs = len(r)
2018 numrevs = len(r)
2048 ui.write(("# rev p1rev p2rev start end deltastart base p1 p2"
2019 ui.write(("# rev p1rev p2rev start end deltastart base p1 p2"
2049 " rawsize totalsize compression heads chainlen\n"))
2020 " rawsize totalsize compression heads chainlen\n"))
2050 ts = 0
2021 ts = 0
2051 heads = set()
2022 heads = set()
2052
2023
2053 for rev in pycompat.xrange(numrevs):
2024 for rev in pycompat.xrange(numrevs):
2054 dbase = r.deltaparent(rev)
2025 dbase = r.deltaparent(rev)
2055 if dbase == -1:
2026 if dbase == -1:
2056 dbase = rev
2027 dbase = rev
2057 cbase = r.chainbase(rev)
2028 cbase = r.chainbase(rev)
2058 clen = r.chainlen(rev)
2029 clen = r.chainlen(rev)
2059 p1, p2 = r.parentrevs(rev)
2030 p1, p2 = r.parentrevs(rev)
2060 rs = r.rawsize(rev)
2031 rs = r.rawsize(rev)
2061 ts = ts + rs
2032 ts = ts + rs
2062 heads -= set(r.parentrevs(rev))
2033 heads -= set(r.parentrevs(rev))
2063 heads.add(rev)
2034 heads.add(rev)
2064 try:
2035 try:
2065 compression = ts / r.end(rev)
2036 compression = ts / r.end(rev)
2066 except ZeroDivisionError:
2037 except ZeroDivisionError:
2067 compression = 0
2038 compression = 0
2068 ui.write("%5d %5d %5d %5d %5d %10d %4d %4d %4d %7d %9d "
2039 ui.write("%5d %5d %5d %5d %5d %10d %4d %4d %4d %7d %9d "
2069 "%11d %5d %8d\n" %
2040 "%11d %5d %8d\n" %
2070 (rev, p1, p2, r.start(rev), r.end(rev),
2041 (rev, p1, p2, r.start(rev), r.end(rev),
2071 r.start(dbase), r.start(cbase),
2042 r.start(dbase), r.start(cbase),
2072 r.start(p1), r.start(p2),
2043 r.start(p1), r.start(p2),
2073 rs, ts, compression, len(heads), clen))
2044 rs, ts, compression, len(heads), clen))
2074 return 0
2045 return 0
2075
2046
2076 v = r.version
2047 v = r.version
2077 format = v & 0xFFFF
2048 format = v & 0xFFFF
2078 flags = []
2049 flags = []
2079 gdelta = False
2050 gdelta = False
2080 if v & revlog.FLAG_INLINE_DATA:
2051 if v & revlog.FLAG_INLINE_DATA:
2081 flags.append('inline')
2052 flags.append('inline')
2082 if v & revlog.FLAG_GENERALDELTA:
2053 if v & revlog.FLAG_GENERALDELTA:
2083 gdelta = True
2054 gdelta = True
2084 flags.append('generaldelta')
2055 flags.append('generaldelta')
2085 if not flags:
2056 if not flags:
2086 flags = ['(none)']
2057 flags = ['(none)']
2087
2058
2088 ### tracks merge vs single parent
2059 ### tracks merge vs single parent
2089 nummerges = 0
2060 nummerges = 0
2090
2061
2091 ### tracks ways the "delta" are build
2062 ### tracks ways the "delta" are build
2092 # nodelta
2063 # nodelta
2093 numempty = 0
2064 numempty = 0
2094 numemptytext = 0
2065 numemptytext = 0
2095 numemptydelta = 0
2066 numemptydelta = 0
2096 # full file content
2067 # full file content
2097 numfull = 0
2068 numfull = 0
2098 # intermediate snapshot against a prior snapshot
2069 # intermediate snapshot against a prior snapshot
2099 numsemi = 0
2070 numsemi = 0
2100 # snapshot count per depth
2071 # snapshot count per depth
2101 numsnapdepth = collections.defaultdict(lambda: 0)
2072 numsnapdepth = collections.defaultdict(lambda: 0)
2102 # delta against previous revision
2073 # delta against previous revision
2103 numprev = 0
2074 numprev = 0
2104 # delta against first or second parent (not prev)
2075 # delta against first or second parent (not prev)
2105 nump1 = 0
2076 nump1 = 0
2106 nump2 = 0
2077 nump2 = 0
2107 # delta against neither prev nor parents
2078 # delta against neither prev nor parents
2108 numother = 0
2079 numother = 0
2109 # delta against prev that are also first or second parent
2080 # delta against prev that are also first or second parent
2110 # (details of `numprev`)
2081 # (details of `numprev`)
2111 nump1prev = 0
2082 nump1prev = 0
2112 nump2prev = 0
2083 nump2prev = 0
2113
2084
2114 # data about delta chain of each revs
2085 # data about delta chain of each revs
2115 chainlengths = []
2086 chainlengths = []
2116 chainbases = []
2087 chainbases = []
2117 chainspans = []
2088 chainspans = []
2118
2089
2119 # data about each revision
2090 # data about each revision
2120 datasize = [None, 0, 0]
2091 datasize = [None, 0, 0]
2121 fullsize = [None, 0, 0]
2092 fullsize = [None, 0, 0]
2122 semisize = [None, 0, 0]
2093 semisize = [None, 0, 0]
2123 # snapshot count per depth
2094 # snapshot count per depth
2124 snapsizedepth = collections.defaultdict(lambda: [None, 0, 0])
2095 snapsizedepth = collections.defaultdict(lambda: [None, 0, 0])
2125 deltasize = [None, 0, 0]
2096 deltasize = [None, 0, 0]
2126 chunktypecounts = {}
2097 chunktypecounts = {}
2127 chunktypesizes = {}
2098 chunktypesizes = {}
2128
2099
2129 def addsize(size, l):
2100 def addsize(size, l):
2130 if l[0] is None or size < l[0]:
2101 if l[0] is None or size < l[0]:
2131 l[0] = size
2102 l[0] = size
2132 if size > l[1]:
2103 if size > l[1]:
2133 l[1] = size
2104 l[1] = size
2134 l[2] += size
2105 l[2] += size
2135
2106
2136 numrevs = len(r)
2107 numrevs = len(r)
2137 for rev in pycompat.xrange(numrevs):
2108 for rev in pycompat.xrange(numrevs):
2138 p1, p2 = r.parentrevs(rev)
2109 p1, p2 = r.parentrevs(rev)
2139 delta = r.deltaparent(rev)
2110 delta = r.deltaparent(rev)
2140 if format > 0:
2111 if format > 0:
2141 addsize(r.rawsize(rev), datasize)
2112 addsize(r.rawsize(rev), datasize)
2142 if p2 != nullrev:
2113 if p2 != nullrev:
2143 nummerges += 1
2114 nummerges += 1
2144 size = r.length(rev)
2115 size = r.length(rev)
2145 if delta == nullrev:
2116 if delta == nullrev:
2146 chainlengths.append(0)
2117 chainlengths.append(0)
2147 chainbases.append(r.start(rev))
2118 chainbases.append(r.start(rev))
2148 chainspans.append(size)
2119 chainspans.append(size)
2149 if size == 0:
2120 if size == 0:
2150 numempty += 1
2121 numempty += 1
2151 numemptytext += 1
2122 numemptytext += 1
2152 else:
2123 else:
2153 numfull += 1
2124 numfull += 1
2154 numsnapdepth[0] += 1
2125 numsnapdepth[0] += 1
2155 addsize(size, fullsize)
2126 addsize(size, fullsize)
2156 addsize(size, snapsizedepth[0])
2127 addsize(size, snapsizedepth[0])
2157 else:
2128 else:
2158 chainlengths.append(chainlengths[delta] + 1)
2129 chainlengths.append(chainlengths[delta] + 1)
2159 baseaddr = chainbases[delta]
2130 baseaddr = chainbases[delta]
2160 revaddr = r.start(rev)
2131 revaddr = r.start(rev)
2161 chainbases.append(baseaddr)
2132 chainbases.append(baseaddr)
2162 chainspans.append((revaddr - baseaddr) + size)
2133 chainspans.append((revaddr - baseaddr) + size)
2163 if size == 0:
2134 if size == 0:
2164 numempty += 1
2135 numempty += 1
2165 numemptydelta += 1
2136 numemptydelta += 1
2166 elif r.issnapshot(rev):
2137 elif r.issnapshot(rev):
2167 addsize(size, semisize)
2138 addsize(size, semisize)
2168 numsemi += 1
2139 numsemi += 1
2169 depth = r.snapshotdepth(rev)
2140 depth = r.snapshotdepth(rev)
2170 numsnapdepth[depth] += 1
2141 numsnapdepth[depth] += 1
2171 addsize(size, snapsizedepth[depth])
2142 addsize(size, snapsizedepth[depth])
2172 else:
2143 else:
2173 addsize(size, deltasize)
2144 addsize(size, deltasize)
2174 if delta == rev - 1:
2145 if delta == rev - 1:
2175 numprev += 1
2146 numprev += 1
2176 if delta == p1:
2147 if delta == p1:
2177 nump1prev += 1
2148 nump1prev += 1
2178 elif delta == p2:
2149 elif delta == p2:
2179 nump2prev += 1
2150 nump2prev += 1
2180 elif delta == p1:
2151 elif delta == p1:
2181 nump1 += 1
2152 nump1 += 1
2182 elif delta == p2:
2153 elif delta == p2:
2183 nump2 += 1
2154 nump2 += 1
2184 elif delta != nullrev:
2155 elif delta != nullrev:
2185 numother += 1
2156 numother += 1
2186
2157
2187 # Obtain data on the raw chunks in the revlog.
2158 # Obtain data on the raw chunks in the revlog.
2188 if util.safehasattr(r, '_getsegmentforrevs'):
2159 if util.safehasattr(r, '_getsegmentforrevs'):
2189 segment = r._getsegmentforrevs(rev, rev)[1]
2160 segment = r._getsegmentforrevs(rev, rev)[1]
2190 else:
2161 else:
2191 segment = r._revlog._getsegmentforrevs(rev, rev)[1]
2162 segment = r._revlog._getsegmentforrevs(rev, rev)[1]
2192 if segment:
2163 if segment:
2193 chunktype = bytes(segment[0:1])
2164 chunktype = bytes(segment[0:1])
2194 else:
2165 else:
2195 chunktype = 'empty'
2166 chunktype = 'empty'
2196
2167
2197 if chunktype not in chunktypecounts:
2168 if chunktype not in chunktypecounts:
2198 chunktypecounts[chunktype] = 0
2169 chunktypecounts[chunktype] = 0
2199 chunktypesizes[chunktype] = 0
2170 chunktypesizes[chunktype] = 0
2200
2171
2201 chunktypecounts[chunktype] += 1
2172 chunktypecounts[chunktype] += 1
2202 chunktypesizes[chunktype] += size
2173 chunktypesizes[chunktype] += size
2203
2174
2204 # Adjust size min value for empty cases
2175 # Adjust size min value for empty cases
2205 for size in (datasize, fullsize, semisize, deltasize):
2176 for size in (datasize, fullsize, semisize, deltasize):
2206 if size[0] is None:
2177 if size[0] is None:
2207 size[0] = 0
2178 size[0] = 0
2208
2179
2209 numdeltas = numrevs - numfull - numempty - numsemi
2180 numdeltas = numrevs - numfull - numempty - numsemi
2210 numoprev = numprev - nump1prev - nump2prev
2181 numoprev = numprev - nump1prev - nump2prev
2211 totalrawsize = datasize[2]
2182 totalrawsize = datasize[2]
2212 datasize[2] /= numrevs
2183 datasize[2] /= numrevs
2213 fulltotal = fullsize[2]
2184 fulltotal = fullsize[2]
2214 fullsize[2] /= numfull
2185 fullsize[2] /= numfull
2215 semitotal = semisize[2]
2186 semitotal = semisize[2]
2216 snaptotal = {}
2187 snaptotal = {}
2217 if 0 < numsemi:
2188 if 0 < numsemi:
2218 semisize[2] /= numsemi
2189 semisize[2] /= numsemi
2219 for depth in snapsizedepth:
2190 for depth in snapsizedepth:
2220 snaptotal[depth] = snapsizedepth[depth][2]
2191 snaptotal[depth] = snapsizedepth[depth][2]
2221 snapsizedepth[depth][2] /= numsnapdepth[depth]
2192 snapsizedepth[depth][2] /= numsnapdepth[depth]
2222
2193
2223 deltatotal = deltasize[2]
2194 deltatotal = deltasize[2]
2224 if numdeltas > 0:
2195 if numdeltas > 0:
2225 deltasize[2] /= numdeltas
2196 deltasize[2] /= numdeltas
2226 totalsize = fulltotal + semitotal + deltatotal
2197 totalsize = fulltotal + semitotal + deltatotal
2227 avgchainlen = sum(chainlengths) / numrevs
2198 avgchainlen = sum(chainlengths) / numrevs
2228 maxchainlen = max(chainlengths)
2199 maxchainlen = max(chainlengths)
2229 maxchainspan = max(chainspans)
2200 maxchainspan = max(chainspans)
2230 compratio = 1
2201 compratio = 1
2231 if totalsize:
2202 if totalsize:
2232 compratio = totalrawsize / totalsize
2203 compratio = totalrawsize / totalsize
2233
2204
2234 basedfmtstr = '%%%dd\n'
2205 basedfmtstr = '%%%dd\n'
2235 basepcfmtstr = '%%%dd %s(%%5.2f%%%%)\n'
2206 basepcfmtstr = '%%%dd %s(%%5.2f%%%%)\n'
2236
2207
2237 def dfmtstr(max):
2208 def dfmtstr(max):
2238 return basedfmtstr % len(str(max))
2209 return basedfmtstr % len(str(max))
2239 def pcfmtstr(max, padding=0):
2210 def pcfmtstr(max, padding=0):
2240 return basepcfmtstr % (len(str(max)), ' ' * padding)
2211 return basepcfmtstr % (len(str(max)), ' ' * padding)
2241
2212
2242 def pcfmt(value, total):
2213 def pcfmt(value, total):
2243 if total:
2214 if total:
2244 return (value, 100 * float(value) / total)
2215 return (value, 100 * float(value) / total)
2245 else:
2216 else:
2246 return value, 100.0
2217 return value, 100.0
2247
2218
2248 ui.write(('format : %d\n') % format)
2219 ui.write(('format : %d\n') % format)
2249 ui.write(('flags : %s\n') % ', '.join(flags))
2220 ui.write(('flags : %s\n') % ', '.join(flags))
2250
2221
2251 ui.write('\n')
2222 ui.write('\n')
2252 fmt = pcfmtstr(totalsize)
2223 fmt = pcfmtstr(totalsize)
2253 fmt2 = dfmtstr(totalsize)
2224 fmt2 = dfmtstr(totalsize)
2254 ui.write(('revisions : ') + fmt2 % numrevs)
2225 ui.write(('revisions : ') + fmt2 % numrevs)
2255 ui.write((' merges : ') + fmt % pcfmt(nummerges, numrevs))
2226 ui.write((' merges : ') + fmt % pcfmt(nummerges, numrevs))
2256 ui.write((' normal : ') + fmt % pcfmt(numrevs - nummerges, numrevs))
2227 ui.write((' normal : ') + fmt % pcfmt(numrevs - nummerges, numrevs))
2257 ui.write(('revisions : ') + fmt2 % numrevs)
2228 ui.write(('revisions : ') + fmt2 % numrevs)
2258 ui.write((' empty : ') + fmt % pcfmt(numempty, numrevs))
2229 ui.write((' empty : ') + fmt % pcfmt(numempty, numrevs))
2259 ui.write((' text : ')
2230 ui.write((' text : ')
2260 + fmt % pcfmt(numemptytext, numemptytext + numemptydelta))
2231 + fmt % pcfmt(numemptytext, numemptytext + numemptydelta))
2261 ui.write((' delta : ')
2232 ui.write((' delta : ')
2262 + fmt % pcfmt(numemptydelta, numemptytext + numemptydelta))
2233 + fmt % pcfmt(numemptydelta, numemptytext + numemptydelta))
2263 ui.write((' snapshot : ') + fmt % pcfmt(numfull + numsemi, numrevs))
2234 ui.write((' snapshot : ') + fmt % pcfmt(numfull + numsemi, numrevs))
2264 for depth in sorted(numsnapdepth):
2235 for depth in sorted(numsnapdepth):
2265 ui.write((' lvl-%-3d : ' % depth)
2236 ui.write((' lvl-%-3d : ' % depth)
2266 + fmt % pcfmt(numsnapdepth[depth], numrevs))
2237 + fmt % pcfmt(numsnapdepth[depth], numrevs))
2267 ui.write((' deltas : ') + fmt % pcfmt(numdeltas, numrevs))
2238 ui.write((' deltas : ') + fmt % pcfmt(numdeltas, numrevs))
2268 ui.write(('revision size : ') + fmt2 % totalsize)
2239 ui.write(('revision size : ') + fmt2 % totalsize)
2269 ui.write((' snapshot : ')
2240 ui.write((' snapshot : ')
2270 + fmt % pcfmt(fulltotal + semitotal, totalsize))
2241 + fmt % pcfmt(fulltotal + semitotal, totalsize))
2271 for depth in sorted(numsnapdepth):
2242 for depth in sorted(numsnapdepth):
2272 ui.write((' lvl-%-3d : ' % depth)
2243 ui.write((' lvl-%-3d : ' % depth)
2273 + fmt % pcfmt(snaptotal[depth], totalsize))
2244 + fmt % pcfmt(snaptotal[depth], totalsize))
2274 ui.write((' deltas : ') + fmt % pcfmt(deltatotal, totalsize))
2245 ui.write((' deltas : ') + fmt % pcfmt(deltatotal, totalsize))
2275
2246
2276 def fmtchunktype(chunktype):
2247 def fmtchunktype(chunktype):
2277 if chunktype == 'empty':
2248 if chunktype == 'empty':
2278 return ' %s : ' % chunktype
2249 return ' %s : ' % chunktype
2279 elif chunktype in pycompat.bytestr(string.ascii_letters):
2250 elif chunktype in pycompat.bytestr(string.ascii_letters):
2280 return ' 0x%s (%s) : ' % (hex(chunktype), chunktype)
2251 return ' 0x%s (%s) : ' % (hex(chunktype), chunktype)
2281 else:
2252 else:
2282 return ' 0x%s : ' % hex(chunktype)
2253 return ' 0x%s : ' % hex(chunktype)
2283
2254
2284 ui.write('\n')
2255 ui.write('\n')
2285 ui.write(('chunks : ') + fmt2 % numrevs)
2256 ui.write(('chunks : ') + fmt2 % numrevs)
2286 for chunktype in sorted(chunktypecounts):
2257 for chunktype in sorted(chunktypecounts):
2287 ui.write(fmtchunktype(chunktype))
2258 ui.write(fmtchunktype(chunktype))
2288 ui.write(fmt % pcfmt(chunktypecounts[chunktype], numrevs))
2259 ui.write(fmt % pcfmt(chunktypecounts[chunktype], numrevs))
2289 ui.write(('chunks size : ') + fmt2 % totalsize)
2260 ui.write(('chunks size : ') + fmt2 % totalsize)
2290 for chunktype in sorted(chunktypecounts):
2261 for chunktype in sorted(chunktypecounts):
2291 ui.write(fmtchunktype(chunktype))
2262 ui.write(fmtchunktype(chunktype))
2292 ui.write(fmt % pcfmt(chunktypesizes[chunktype], totalsize))
2263 ui.write(fmt % pcfmt(chunktypesizes[chunktype], totalsize))
2293
2264
2294 ui.write('\n')
2265 ui.write('\n')
2295 fmt = dfmtstr(max(avgchainlen, maxchainlen, maxchainspan, compratio))
2266 fmt = dfmtstr(max(avgchainlen, maxchainlen, maxchainspan, compratio))
2296 ui.write(('avg chain length : ') + fmt % avgchainlen)
2267 ui.write(('avg chain length : ') + fmt % avgchainlen)
2297 ui.write(('max chain length : ') + fmt % maxchainlen)
2268 ui.write(('max chain length : ') + fmt % maxchainlen)
2298 ui.write(('max chain reach : ') + fmt % maxchainspan)
2269 ui.write(('max chain reach : ') + fmt % maxchainspan)
2299 ui.write(('compression ratio : ') + fmt % compratio)
2270 ui.write(('compression ratio : ') + fmt % compratio)
2300
2271
2301 if format > 0:
2272 if format > 0:
2302 ui.write('\n')
2273 ui.write('\n')
2303 ui.write(('uncompressed data size (min/max/avg) : %d / %d / %d\n')
2274 ui.write(('uncompressed data size (min/max/avg) : %d / %d / %d\n')
2304 % tuple(datasize))
2275 % tuple(datasize))
2305 ui.write(('full revision size (min/max/avg) : %d / %d / %d\n')
2276 ui.write(('full revision size (min/max/avg) : %d / %d / %d\n')
2306 % tuple(fullsize))
2277 % tuple(fullsize))
2307 ui.write(('inter-snapshot size (min/max/avg) : %d / %d / %d\n')
2278 ui.write(('inter-snapshot size (min/max/avg) : %d / %d / %d\n')
2308 % tuple(semisize))
2279 % tuple(semisize))
2309 for depth in sorted(snapsizedepth):
2280 for depth in sorted(snapsizedepth):
2310 if depth == 0:
2281 if depth == 0:
2311 continue
2282 continue
2312 ui.write((' level-%-3d (min/max/avg) : %d / %d / %d\n')
2283 ui.write((' level-%-3d (min/max/avg) : %d / %d / %d\n')
2313 % ((depth,) + tuple(snapsizedepth[depth])))
2284 % ((depth,) + tuple(snapsizedepth[depth])))
2314 ui.write(('delta size (min/max/avg) : %d / %d / %d\n')
2285 ui.write(('delta size (min/max/avg) : %d / %d / %d\n')
2315 % tuple(deltasize))
2286 % tuple(deltasize))
2316
2287
2317 if numdeltas > 0:
2288 if numdeltas > 0:
2318 ui.write('\n')
2289 ui.write('\n')
2319 fmt = pcfmtstr(numdeltas)
2290 fmt = pcfmtstr(numdeltas)
2320 fmt2 = pcfmtstr(numdeltas, 4)
2291 fmt2 = pcfmtstr(numdeltas, 4)
2321 ui.write(('deltas against prev : ') + fmt % pcfmt(numprev, numdeltas))
2292 ui.write(('deltas against prev : ') + fmt % pcfmt(numprev, numdeltas))
2322 if numprev > 0:
2293 if numprev > 0:
2323 ui.write((' where prev = p1 : ') + fmt2 % pcfmt(nump1prev,
2294 ui.write((' where prev = p1 : ') + fmt2 % pcfmt(nump1prev,
2324 numprev))
2295 numprev))
2325 ui.write((' where prev = p2 : ') + fmt2 % pcfmt(nump2prev,
2296 ui.write((' where prev = p2 : ') + fmt2 % pcfmt(nump2prev,
2326 numprev))
2297 numprev))
2327 ui.write((' other : ') + fmt2 % pcfmt(numoprev,
2298 ui.write((' other : ') + fmt2 % pcfmt(numoprev,
2328 numprev))
2299 numprev))
2329 if gdelta:
2300 if gdelta:
2330 ui.write(('deltas against p1 : ')
2301 ui.write(('deltas against p1 : ')
2331 + fmt % pcfmt(nump1, numdeltas))
2302 + fmt % pcfmt(nump1, numdeltas))
2332 ui.write(('deltas against p2 : ')
2303 ui.write(('deltas against p2 : ')
2333 + fmt % pcfmt(nump2, numdeltas))
2304 + fmt % pcfmt(nump2, numdeltas))
2334 ui.write(('deltas against other : ') + fmt % pcfmt(numother,
2305 ui.write(('deltas against other : ') + fmt % pcfmt(numother,
2335 numdeltas))
2306 numdeltas))
2336
2307
2308 @command('debugrevlogindex', cmdutil.debugrevlogopts +
2309 [('f', 'format', 0, _('revlog format'), _('FORMAT'))],
2310 _('[-f FORMAT] -c|-m|FILE'),
2311 optionalrepo=True)
2312 def debugrevlogindex(ui, repo, file_=None, **opts):
2313 """dump the contents of a revlog index"""
2314 opts = pycompat.byteskwargs(opts)
2315 r = cmdutil.openrevlog(repo, 'debugrevlogindex', file_, opts)
2316 format = opts.get('format', 0)
2317 if format not in (0, 1):
2318 raise error.Abort(_("unknown format %d") % format)
2319
2320 if ui.debugflag:
2321 shortfn = hex
2322 else:
2323 shortfn = short
2324
2325 # There might not be anything in r, so have a sane default
2326 idlen = 12
2327 for i in r:
2328 idlen = len(shortfn(r.node(i)))
2329 break
2330
2331 if format == 0:
2332 if ui.verbose:
2333 ui.write((" rev offset length linkrev"
2334 " %s %s p2\n") % ("nodeid".ljust(idlen),
2335 "p1".ljust(idlen)))
2336 else:
2337 ui.write((" rev linkrev %s %s p2\n") % (
2338 "nodeid".ljust(idlen), "p1".ljust(idlen)))
2339 elif format == 1:
2340 if ui.verbose:
2341 ui.write((" rev flag offset length size link p1"
2342 " p2 %s\n") % "nodeid".rjust(idlen))
2343 else:
2344 ui.write((" rev flag size link p1 p2 %s\n") %
2345 "nodeid".rjust(idlen))
2346
2347 for i in r:
2348 node = r.node(i)
2349 if format == 0:
2350 try:
2351 pp = r.parents(node)
2352 except Exception:
2353 pp = [nullid, nullid]
2354 if ui.verbose:
2355 ui.write("% 6d % 9d % 7d % 7d %s %s %s\n" % (
2356 i, r.start(i), r.length(i), r.linkrev(i),
2357 shortfn(node), shortfn(pp[0]), shortfn(pp[1])))
2358 else:
2359 ui.write("% 6d % 7d %s %s %s\n" % (
2360 i, r.linkrev(i), shortfn(node), shortfn(pp[0]),
2361 shortfn(pp[1])))
2362 elif format == 1:
2363 pr = r.parentrevs(i)
2364 if ui.verbose:
2365 ui.write("% 6d %04x % 8d % 8d % 8d % 6d % 6d % 6d %s\n" % (
2366 i, r.flags(i), r.start(i), r.length(i), r.rawsize(i),
2367 r.linkrev(i), pr[0], pr[1], shortfn(node)))
2368 else:
2369 ui.write("% 6d %04x % 8d % 6d % 6d % 6d %s\n" % (
2370 i, r.flags(i), r.rawsize(i), r.linkrev(i), pr[0], pr[1],
2371 shortfn(node)))
2372
2337 @command('debugrevspec',
2373 @command('debugrevspec',
2338 [('', 'optimize', None,
2374 [('', 'optimize', None,
2339 _('print parsed tree after optimizing (DEPRECATED)')),
2375 _('print parsed tree after optimizing (DEPRECATED)')),
2340 ('', 'show-revs', True, _('print list of result revisions (default)')),
2376 ('', 'show-revs', True, _('print list of result revisions (default)')),
2341 ('s', 'show-set', None, _('print internal representation of result set')),
2377 ('s', 'show-set', None, _('print internal representation of result set')),
2342 ('p', 'show-stage', [],
2378 ('p', 'show-stage', [],
2343 _('print parsed tree at the given stage'), _('NAME')),
2379 _('print parsed tree at the given stage'), _('NAME')),
2344 ('', 'no-optimized', False, _('evaluate tree without optimization')),
2380 ('', 'no-optimized', False, _('evaluate tree without optimization')),
2345 ('', 'verify-optimized', False, _('verify optimized result')),
2381 ('', 'verify-optimized', False, _('verify optimized result')),
2346 ],
2382 ],
2347 ('REVSPEC'))
2383 ('REVSPEC'))
2348 def debugrevspec(ui, repo, expr, **opts):
2384 def debugrevspec(ui, repo, expr, **opts):
2349 """parse and apply a revision specification
2385 """parse and apply a revision specification
2350
2386
2351 Use -p/--show-stage option to print the parsed tree at the given stages.
2387 Use -p/--show-stage option to print the parsed tree at the given stages.
2352 Use -p all to print tree at every stage.
2388 Use -p all to print tree at every stage.
2353
2389
2354 Use --no-show-revs option with -s or -p to print only the set
2390 Use --no-show-revs option with -s or -p to print only the set
2355 representation or the parsed tree respectively.
2391 representation or the parsed tree respectively.
2356
2392
2357 Use --verify-optimized to compare the optimized result with the unoptimized
2393 Use --verify-optimized to compare the optimized result with the unoptimized
2358 one. Returns 1 if the optimized result differs.
2394 one. Returns 1 if the optimized result differs.
2359 """
2395 """
2360 opts = pycompat.byteskwargs(opts)
2396 opts = pycompat.byteskwargs(opts)
2361 aliases = ui.configitems('revsetalias')
2397 aliases = ui.configitems('revsetalias')
2362 stages = [
2398 stages = [
2363 ('parsed', lambda tree: tree),
2399 ('parsed', lambda tree: tree),
2364 ('expanded', lambda tree: revsetlang.expandaliases(tree, aliases,
2400 ('expanded', lambda tree: revsetlang.expandaliases(tree, aliases,
2365 ui.warn)),
2401 ui.warn)),
2366 ('concatenated', revsetlang.foldconcat),
2402 ('concatenated', revsetlang.foldconcat),
2367 ('analyzed', revsetlang.analyze),
2403 ('analyzed', revsetlang.analyze),
2368 ('optimized', revsetlang.optimize),
2404 ('optimized', revsetlang.optimize),
2369 ]
2405 ]
2370 if opts['no_optimized']:
2406 if opts['no_optimized']:
2371 stages = stages[:-1]
2407 stages = stages[:-1]
2372 if opts['verify_optimized'] and opts['no_optimized']:
2408 if opts['verify_optimized'] and opts['no_optimized']:
2373 raise error.Abort(_('cannot use --verify-optimized with '
2409 raise error.Abort(_('cannot use --verify-optimized with '
2374 '--no-optimized'))
2410 '--no-optimized'))
2375 stagenames = set(n for n, f in stages)
2411 stagenames = set(n for n, f in stages)
2376
2412
2377 showalways = set()
2413 showalways = set()
2378 showchanged = set()
2414 showchanged = set()
2379 if ui.verbose and not opts['show_stage']:
2415 if ui.verbose and not opts['show_stage']:
2380 # show parsed tree by --verbose (deprecated)
2416 # show parsed tree by --verbose (deprecated)
2381 showalways.add('parsed')
2417 showalways.add('parsed')
2382 showchanged.update(['expanded', 'concatenated'])
2418 showchanged.update(['expanded', 'concatenated'])
2383 if opts['optimize']:
2419 if opts['optimize']:
2384 showalways.add('optimized')
2420 showalways.add('optimized')
2385 if opts['show_stage'] and opts['optimize']:
2421 if opts['show_stage'] and opts['optimize']:
2386 raise error.Abort(_('cannot use --optimize with --show-stage'))
2422 raise error.Abort(_('cannot use --optimize with --show-stage'))
2387 if opts['show_stage'] == ['all']:
2423 if opts['show_stage'] == ['all']:
2388 showalways.update(stagenames)
2424 showalways.update(stagenames)
2389 else:
2425 else:
2390 for n in opts['show_stage']:
2426 for n in opts['show_stage']:
2391 if n not in stagenames:
2427 if n not in stagenames:
2392 raise error.Abort(_('invalid stage name: %s') % n)
2428 raise error.Abort(_('invalid stage name: %s') % n)
2393 showalways.update(opts['show_stage'])
2429 showalways.update(opts['show_stage'])
2394
2430
2395 treebystage = {}
2431 treebystage = {}
2396 printedtree = None
2432 printedtree = None
2397 tree = revsetlang.parse(expr, lookup=revset.lookupfn(repo))
2433 tree = revsetlang.parse(expr, lookup=revset.lookupfn(repo))
2398 for n, f in stages:
2434 for n, f in stages:
2399 treebystage[n] = tree = f(tree)
2435 treebystage[n] = tree = f(tree)
2400 if n in showalways or (n in showchanged and tree != printedtree):
2436 if n in showalways or (n in showchanged and tree != printedtree):
2401 if opts['show_stage'] or n != 'parsed':
2437 if opts['show_stage'] or n != 'parsed':
2402 ui.write(("* %s:\n") % n)
2438 ui.write(("* %s:\n") % n)
2403 ui.write(revsetlang.prettyformat(tree), "\n")
2439 ui.write(revsetlang.prettyformat(tree), "\n")
2404 printedtree = tree
2440 printedtree = tree
2405
2441
2406 if opts['verify_optimized']:
2442 if opts['verify_optimized']:
2407 arevs = revset.makematcher(treebystage['analyzed'])(repo)
2443 arevs = revset.makematcher(treebystage['analyzed'])(repo)
2408 brevs = revset.makematcher(treebystage['optimized'])(repo)
2444 brevs = revset.makematcher(treebystage['optimized'])(repo)
2409 if opts['show_set'] or (opts['show_set'] is None and ui.verbose):
2445 if opts['show_set'] or (opts['show_set'] is None and ui.verbose):
2410 ui.write(("* analyzed set:\n"), stringutil.prettyrepr(arevs), "\n")
2446 ui.write(("* analyzed set:\n"), stringutil.prettyrepr(arevs), "\n")
2411 ui.write(("* optimized set:\n"), stringutil.prettyrepr(brevs), "\n")
2447 ui.write(("* optimized set:\n"), stringutil.prettyrepr(brevs), "\n")
2412 arevs = list(arevs)
2448 arevs = list(arevs)
2413 brevs = list(brevs)
2449 brevs = list(brevs)
2414 if arevs == brevs:
2450 if arevs == brevs:
2415 return 0
2451 return 0
2416 ui.write(('--- analyzed\n'), label='diff.file_a')
2452 ui.write(('--- analyzed\n'), label='diff.file_a')
2417 ui.write(('+++ optimized\n'), label='diff.file_b')
2453 ui.write(('+++ optimized\n'), label='diff.file_b')
2418 sm = difflib.SequenceMatcher(None, arevs, brevs)
2454 sm = difflib.SequenceMatcher(None, arevs, brevs)
2419 for tag, alo, ahi, blo, bhi in sm.get_opcodes():
2455 for tag, alo, ahi, blo, bhi in sm.get_opcodes():
2420 if tag in ('delete', 'replace'):
2456 if tag in ('delete', 'replace'):
2421 for c in arevs[alo:ahi]:
2457 for c in arevs[alo:ahi]:
2422 ui.write('-%s\n' % c, label='diff.deleted')
2458 ui.write('-%s\n' % c, label='diff.deleted')
2423 if tag in ('insert', 'replace'):
2459 if tag in ('insert', 'replace'):
2424 for c in brevs[blo:bhi]:
2460 for c in brevs[blo:bhi]:
2425 ui.write('+%s\n' % c, label='diff.inserted')
2461 ui.write('+%s\n' % c, label='diff.inserted')
2426 if tag == 'equal':
2462 if tag == 'equal':
2427 for c in arevs[alo:ahi]:
2463 for c in arevs[alo:ahi]:
2428 ui.write(' %s\n' % c)
2464 ui.write(' %s\n' % c)
2429 return 1
2465 return 1
2430
2466
2431 func = revset.makematcher(tree)
2467 func = revset.makematcher(tree)
2432 revs = func(repo)
2468 revs = func(repo)
2433 if opts['show_set'] or (opts['show_set'] is None and ui.verbose):
2469 if opts['show_set'] or (opts['show_set'] is None and ui.verbose):
2434 ui.write(("* set:\n"), stringutil.prettyrepr(revs), "\n")
2470 ui.write(("* set:\n"), stringutil.prettyrepr(revs), "\n")
2435 if not opts['show_revs']:
2471 if not opts['show_revs']:
2436 return
2472 return
2437 for c in revs:
2473 for c in revs:
2438 ui.write("%d\n" % c)
2474 ui.write("%d\n" % c)
2439
2475
2440 @command('debugserve', [
2476 @command('debugserve', [
2441 ('', 'sshstdio', False, _('run an SSH server bound to process handles')),
2477 ('', 'sshstdio', False, _('run an SSH server bound to process handles')),
2442 ('', 'logiofd', '', _('file descriptor to log server I/O to')),
2478 ('', 'logiofd', '', _('file descriptor to log server I/O to')),
2443 ('', 'logiofile', '', _('file to log server I/O to')),
2479 ('', 'logiofile', '', _('file to log server I/O to')),
2444 ], '')
2480 ], '')
2445 def debugserve(ui, repo, **opts):
2481 def debugserve(ui, repo, **opts):
2446 """run a server with advanced settings
2482 """run a server with advanced settings
2447
2483
2448 This command is similar to :hg:`serve`. It exists partially as a
2484 This command is similar to :hg:`serve`. It exists partially as a
2449 workaround to the fact that ``hg serve --stdio`` must have specific
2485 workaround to the fact that ``hg serve --stdio`` must have specific
2450 arguments for security reasons.
2486 arguments for security reasons.
2451 """
2487 """
2452 opts = pycompat.byteskwargs(opts)
2488 opts = pycompat.byteskwargs(opts)
2453
2489
2454 if not opts['sshstdio']:
2490 if not opts['sshstdio']:
2455 raise error.Abort(_('only --sshstdio is currently supported'))
2491 raise error.Abort(_('only --sshstdio is currently supported'))
2456
2492
2457 logfh = None
2493 logfh = None
2458
2494
2459 if opts['logiofd'] and opts['logiofile']:
2495 if opts['logiofd'] and opts['logiofile']:
2460 raise error.Abort(_('cannot use both --logiofd and --logiofile'))
2496 raise error.Abort(_('cannot use both --logiofd and --logiofile'))
2461
2497
2462 if opts['logiofd']:
2498 if opts['logiofd']:
2463 # Line buffered because output is line based.
2499 # Line buffered because output is line based.
2464 try:
2500 try:
2465 logfh = os.fdopen(int(opts['logiofd']), r'ab', 1)
2501 logfh = os.fdopen(int(opts['logiofd']), r'ab', 1)
2466 except OSError as e:
2502 except OSError as e:
2467 if e.errno != errno.ESPIPE:
2503 if e.errno != errno.ESPIPE:
2468 raise
2504 raise
2469 # can't seek a pipe, so `ab` mode fails on py3
2505 # can't seek a pipe, so `ab` mode fails on py3
2470 logfh = os.fdopen(int(opts['logiofd']), r'wb', 1)
2506 logfh = os.fdopen(int(opts['logiofd']), r'wb', 1)
2471 elif opts['logiofile']:
2507 elif opts['logiofile']:
2472 logfh = open(opts['logiofile'], 'ab', 1)
2508 logfh = open(opts['logiofile'], 'ab', 1)
2473
2509
2474 s = wireprotoserver.sshserver(ui, repo, logfh=logfh)
2510 s = wireprotoserver.sshserver(ui, repo, logfh=logfh)
2475 s.serve_forever()
2511 s.serve_forever()
2476
2512
2477 @command('debugsetparents', [], _('REV1 [REV2]'))
2513 @command('debugsetparents', [], _('REV1 [REV2]'))
2478 def debugsetparents(ui, repo, rev1, rev2=None):
2514 def debugsetparents(ui, repo, rev1, rev2=None):
2479 """manually set the parents of the current working directory
2515 """manually set the parents of the current working directory
2480
2516
2481 This is useful for writing repository conversion tools, but should
2517 This is useful for writing repository conversion tools, but should
2482 be used with care. For example, neither the working directory nor the
2518 be used with care. For example, neither the working directory nor the
2483 dirstate is updated, so file status may be incorrect after running this
2519 dirstate is updated, so file status may be incorrect after running this
2484 command.
2520 command.
2485
2521
2486 Returns 0 on success.
2522 Returns 0 on success.
2487 """
2523 """
2488
2524
2489 node1 = scmutil.revsingle(repo, rev1).node()
2525 node1 = scmutil.revsingle(repo, rev1).node()
2490 node2 = scmutil.revsingle(repo, rev2, 'null').node()
2526 node2 = scmutil.revsingle(repo, rev2, 'null').node()
2491
2527
2492 with repo.wlock():
2528 with repo.wlock():
2493 repo.setparents(node1, node2)
2529 repo.setparents(node1, node2)
2494
2530
2495 @command('debugssl', [], '[SOURCE]', optionalrepo=True)
2531 @command('debugssl', [], '[SOURCE]', optionalrepo=True)
2496 def debugssl(ui, repo, source=None, **opts):
2532 def debugssl(ui, repo, source=None, **opts):
2497 '''test a secure connection to a server
2533 '''test a secure connection to a server
2498
2534
2499 This builds the certificate chain for the server on Windows, installing the
2535 This builds the certificate chain for the server on Windows, installing the
2500 missing intermediates and trusted root via Windows Update if necessary. It
2536 missing intermediates and trusted root via Windows Update if necessary. It
2501 does nothing on other platforms.
2537 does nothing on other platforms.
2502
2538
2503 If SOURCE is omitted, the 'default' path will be used. If a URL is given,
2539 If SOURCE is omitted, the 'default' path will be used. If a URL is given,
2504 that server is used. See :hg:`help urls` for more information.
2540 that server is used. See :hg:`help urls` for more information.
2505
2541
2506 If the update succeeds, retry the original operation. Otherwise, the cause
2542 If the update succeeds, retry the original operation. Otherwise, the cause
2507 of the SSL error is likely another issue.
2543 of the SSL error is likely another issue.
2508 '''
2544 '''
2509 if not pycompat.iswindows:
2545 if not pycompat.iswindows:
2510 raise error.Abort(_('certificate chain building is only possible on '
2546 raise error.Abort(_('certificate chain building is only possible on '
2511 'Windows'))
2547 'Windows'))
2512
2548
2513 if not source:
2549 if not source:
2514 if not repo:
2550 if not repo:
2515 raise error.Abort(_("there is no Mercurial repository here, and no "
2551 raise error.Abort(_("there is no Mercurial repository here, and no "
2516 "server specified"))
2552 "server specified"))
2517 source = "default"
2553 source = "default"
2518
2554
2519 source, branches = hg.parseurl(ui.expandpath(source))
2555 source, branches = hg.parseurl(ui.expandpath(source))
2520 url = util.url(source)
2556 url = util.url(source)
2521 addr = None
2557 addr = None
2522
2558
2523 defaultport = {'https': 443, 'ssh': 22}
2559 defaultport = {'https': 443, 'ssh': 22}
2524 if url.scheme in defaultport:
2560 if url.scheme in defaultport:
2525 try:
2561 try:
2526 addr = (url.host, int(url.port or defaultport[url.scheme]))
2562 addr = (url.host, int(url.port or defaultport[url.scheme]))
2527 except ValueError:
2563 except ValueError:
2528 raise error.Abort(_("malformed port number in URL"))
2564 raise error.Abort(_("malformed port number in URL"))
2529 else:
2565 else:
2530 raise error.Abort(_("only https and ssh connections are supported"))
2566 raise error.Abort(_("only https and ssh connections are supported"))
2531
2567
2532 from . import win32
2568 from . import win32
2533
2569
2534 s = ssl.wrap_socket(socket.socket(), ssl_version=ssl.PROTOCOL_TLS,
2570 s = ssl.wrap_socket(socket.socket(), ssl_version=ssl.PROTOCOL_TLS,
2535 cert_reqs=ssl.CERT_NONE, ca_certs=None)
2571 cert_reqs=ssl.CERT_NONE, ca_certs=None)
2536
2572
2537 try:
2573 try:
2538 s.connect(addr)
2574 s.connect(addr)
2539 cert = s.getpeercert(True)
2575 cert = s.getpeercert(True)
2540
2576
2541 ui.status(_('checking the certificate chain for %s\n') % url.host)
2577 ui.status(_('checking the certificate chain for %s\n') % url.host)
2542
2578
2543 complete = win32.checkcertificatechain(cert, build=False)
2579 complete = win32.checkcertificatechain(cert, build=False)
2544
2580
2545 if not complete:
2581 if not complete:
2546 ui.status(_('certificate chain is incomplete, updating... '))
2582 ui.status(_('certificate chain is incomplete, updating... '))
2547
2583
2548 if not win32.checkcertificatechain(cert):
2584 if not win32.checkcertificatechain(cert):
2549 ui.status(_('failed.\n'))
2585 ui.status(_('failed.\n'))
2550 else:
2586 else:
2551 ui.status(_('done.\n'))
2587 ui.status(_('done.\n'))
2552 else:
2588 else:
2553 ui.status(_('full certificate chain is available\n'))
2589 ui.status(_('full certificate chain is available\n'))
2554 finally:
2590 finally:
2555 s.close()
2591 s.close()
2556
2592
2557 @command('debugsub',
2593 @command('debugsub',
2558 [('r', 'rev', '',
2594 [('r', 'rev', '',
2559 _('revision to check'), _('REV'))],
2595 _('revision to check'), _('REV'))],
2560 _('[-r REV] [REV]'))
2596 _('[-r REV] [REV]'))
2561 def debugsub(ui, repo, rev=None):
2597 def debugsub(ui, repo, rev=None):
2562 ctx = scmutil.revsingle(repo, rev, None)
2598 ctx = scmutil.revsingle(repo, rev, None)
2563 for k, v in sorted(ctx.substate.items()):
2599 for k, v in sorted(ctx.substate.items()):
2564 ui.write(('path %s\n') % k)
2600 ui.write(('path %s\n') % k)
2565 ui.write((' source %s\n') % v[0])
2601 ui.write((' source %s\n') % v[0])
2566 ui.write((' revision %s\n') % v[1])
2602 ui.write((' revision %s\n') % v[1])
2567
2603
2568 @command('debugsuccessorssets',
2604 @command('debugsuccessorssets',
2569 [('', 'closest', False, _('return closest successors sets only'))],
2605 [('', 'closest', False, _('return closest successors sets only'))],
2570 _('[REV]'))
2606 _('[REV]'))
2571 def debugsuccessorssets(ui, repo, *revs, **opts):
2607 def debugsuccessorssets(ui, repo, *revs, **opts):
2572 """show set of successors for revision
2608 """show set of successors for revision
2573
2609
2574 A successors set of changeset A is a consistent group of revisions that
2610 A successors set of changeset A is a consistent group of revisions that
2575 succeed A. It contains non-obsolete changesets only unless closests
2611 succeed A. It contains non-obsolete changesets only unless closests
2576 successors set is set.
2612 successors set is set.
2577
2613
2578 In most cases a changeset A has a single successors set containing a single
2614 In most cases a changeset A has a single successors set containing a single
2579 successor (changeset A replaced by A').
2615 successor (changeset A replaced by A').
2580
2616
2581 A changeset that is made obsolete with no successors are called "pruned".
2617 A changeset that is made obsolete with no successors are called "pruned".
2582 Such changesets have no successors sets at all.
2618 Such changesets have no successors sets at all.
2583
2619
2584 A changeset that has been "split" will have a successors set containing
2620 A changeset that has been "split" will have a successors set containing
2585 more than one successor.
2621 more than one successor.
2586
2622
2587 A changeset that has been rewritten in multiple different ways is called
2623 A changeset that has been rewritten in multiple different ways is called
2588 "divergent". Such changesets have multiple successor sets (each of which
2624 "divergent". Such changesets have multiple successor sets (each of which
2589 may also be split, i.e. have multiple successors).
2625 may also be split, i.e. have multiple successors).
2590
2626
2591 Results are displayed as follows::
2627 Results are displayed as follows::
2592
2628
2593 <rev1>
2629 <rev1>
2594 <successors-1A>
2630 <successors-1A>
2595 <rev2>
2631 <rev2>
2596 <successors-2A>
2632 <successors-2A>
2597 <successors-2B1> <successors-2B2> <successors-2B3>
2633 <successors-2B1> <successors-2B2> <successors-2B3>
2598
2634
2599 Here rev2 has two possible (i.e. divergent) successors sets. The first
2635 Here rev2 has two possible (i.e. divergent) successors sets. The first
2600 holds one element, whereas the second holds three (i.e. the changeset has
2636 holds one element, whereas the second holds three (i.e. the changeset has
2601 been split).
2637 been split).
2602 """
2638 """
2603 # passed to successorssets caching computation from one call to another
2639 # passed to successorssets caching computation from one call to another
2604 cache = {}
2640 cache = {}
2605 ctx2str = bytes
2641 ctx2str = bytes
2606 node2str = short
2642 node2str = short
2607 for rev in scmutil.revrange(repo, revs):
2643 for rev in scmutil.revrange(repo, revs):
2608 ctx = repo[rev]
2644 ctx = repo[rev]
2609 ui.write('%s\n'% ctx2str(ctx))
2645 ui.write('%s\n'% ctx2str(ctx))
2610 for succsset in obsutil.successorssets(repo, ctx.node(),
2646 for succsset in obsutil.successorssets(repo, ctx.node(),
2611 closest=opts[r'closest'],
2647 closest=opts[r'closest'],
2612 cache=cache):
2648 cache=cache):
2613 if succsset:
2649 if succsset:
2614 ui.write(' ')
2650 ui.write(' ')
2615 ui.write(node2str(succsset[0]))
2651 ui.write(node2str(succsset[0]))
2616 for node in succsset[1:]:
2652 for node in succsset[1:]:
2617 ui.write(' ')
2653 ui.write(' ')
2618 ui.write(node2str(node))
2654 ui.write(node2str(node))
2619 ui.write('\n')
2655 ui.write('\n')
2620
2656
2621 @command('debugtemplate',
2657 @command('debugtemplate',
2622 [('r', 'rev', [], _('apply template on changesets'), _('REV')),
2658 [('r', 'rev', [], _('apply template on changesets'), _('REV')),
2623 ('D', 'define', [], _('define template keyword'), _('KEY=VALUE'))],
2659 ('D', 'define', [], _('define template keyword'), _('KEY=VALUE'))],
2624 _('[-r REV]... [-D KEY=VALUE]... TEMPLATE'),
2660 _('[-r REV]... [-D KEY=VALUE]... TEMPLATE'),
2625 optionalrepo=True)
2661 optionalrepo=True)
2626 def debugtemplate(ui, repo, tmpl, **opts):
2662 def debugtemplate(ui, repo, tmpl, **opts):
2627 """parse and apply a template
2663 """parse and apply a template
2628
2664
2629 If -r/--rev is given, the template is processed as a log template and
2665 If -r/--rev is given, the template is processed as a log template and
2630 applied to the given changesets. Otherwise, it is processed as a generic
2666 applied to the given changesets. Otherwise, it is processed as a generic
2631 template.
2667 template.
2632
2668
2633 Use --verbose to print the parsed tree.
2669 Use --verbose to print the parsed tree.
2634 """
2670 """
2635 revs = None
2671 revs = None
2636 if opts[r'rev']:
2672 if opts[r'rev']:
2637 if repo is None:
2673 if repo is None:
2638 raise error.RepoError(_('there is no Mercurial repository here '
2674 raise error.RepoError(_('there is no Mercurial repository here '
2639 '(.hg not found)'))
2675 '(.hg not found)'))
2640 revs = scmutil.revrange(repo, opts[r'rev'])
2676 revs = scmutil.revrange(repo, opts[r'rev'])
2641
2677
2642 props = {}
2678 props = {}
2643 for d in opts[r'define']:
2679 for d in opts[r'define']:
2644 try:
2680 try:
2645 k, v = (e.strip() for e in d.split('=', 1))
2681 k, v = (e.strip() for e in d.split('=', 1))
2646 if not k or k == 'ui':
2682 if not k or k == 'ui':
2647 raise ValueError
2683 raise ValueError
2648 props[k] = v
2684 props[k] = v
2649 except ValueError:
2685 except ValueError:
2650 raise error.Abort(_('malformed keyword definition: %s') % d)
2686 raise error.Abort(_('malformed keyword definition: %s') % d)
2651
2687
2652 if ui.verbose:
2688 if ui.verbose:
2653 aliases = ui.configitems('templatealias')
2689 aliases = ui.configitems('templatealias')
2654 tree = templater.parse(tmpl)
2690 tree = templater.parse(tmpl)
2655 ui.note(templater.prettyformat(tree), '\n')
2691 ui.note(templater.prettyformat(tree), '\n')
2656 newtree = templater.expandaliases(tree, aliases)
2692 newtree = templater.expandaliases(tree, aliases)
2657 if newtree != tree:
2693 if newtree != tree:
2658 ui.note(("* expanded:\n"), templater.prettyformat(newtree), '\n')
2694 ui.note(("* expanded:\n"), templater.prettyformat(newtree), '\n')
2659
2695
2660 if revs is None:
2696 if revs is None:
2661 tres = formatter.templateresources(ui, repo)
2697 tres = formatter.templateresources(ui, repo)
2662 t = formatter.maketemplater(ui, tmpl, resources=tres)
2698 t = formatter.maketemplater(ui, tmpl, resources=tres)
2663 if ui.verbose:
2699 if ui.verbose:
2664 kwds, funcs = t.symbolsuseddefault()
2700 kwds, funcs = t.symbolsuseddefault()
2665 ui.write(("* keywords: %s\n") % ', '.join(sorted(kwds)))
2701 ui.write(("* keywords: %s\n") % ', '.join(sorted(kwds)))
2666 ui.write(("* functions: %s\n") % ', '.join(sorted(funcs)))
2702 ui.write(("* functions: %s\n") % ', '.join(sorted(funcs)))
2667 ui.write(t.renderdefault(props))
2703 ui.write(t.renderdefault(props))
2668 else:
2704 else:
2669 displayer = logcmdutil.maketemplater(ui, repo, tmpl)
2705 displayer = logcmdutil.maketemplater(ui, repo, tmpl)
2670 if ui.verbose:
2706 if ui.verbose:
2671 kwds, funcs = displayer.t.symbolsuseddefault()
2707 kwds, funcs = displayer.t.symbolsuseddefault()
2672 ui.write(("* keywords: %s\n") % ', '.join(sorted(kwds)))
2708 ui.write(("* keywords: %s\n") % ', '.join(sorted(kwds)))
2673 ui.write(("* functions: %s\n") % ', '.join(sorted(funcs)))
2709 ui.write(("* functions: %s\n") % ', '.join(sorted(funcs)))
2674 for r in revs:
2710 for r in revs:
2675 displayer.show(repo[r], **pycompat.strkwargs(props))
2711 displayer.show(repo[r], **pycompat.strkwargs(props))
2676 displayer.close()
2712 displayer.close()
2677
2713
2678 @command('debuguigetpass', [
2714 @command('debuguigetpass', [
2679 ('p', 'prompt', '', _('prompt text'), _('TEXT')),
2715 ('p', 'prompt', '', _('prompt text'), _('TEXT')),
2680 ], _('[-p TEXT]'), norepo=True)
2716 ], _('[-p TEXT]'), norepo=True)
2681 def debuguigetpass(ui, prompt=''):
2717 def debuguigetpass(ui, prompt=''):
2682 """show prompt to type password"""
2718 """show prompt to type password"""
2683 r = ui.getpass(prompt)
2719 r = ui.getpass(prompt)
2684 ui.write(('respose: %s\n') % r)
2720 ui.write(('respose: %s\n') % r)
2685
2721
2686 @command('debuguiprompt', [
2722 @command('debuguiprompt', [
2687 ('p', 'prompt', '', _('prompt text'), _('TEXT')),
2723 ('p', 'prompt', '', _('prompt text'), _('TEXT')),
2688 ], _('[-p TEXT]'), norepo=True)
2724 ], _('[-p TEXT]'), norepo=True)
2689 def debuguiprompt(ui, prompt=''):
2725 def debuguiprompt(ui, prompt=''):
2690 """show plain prompt"""
2726 """show plain prompt"""
2691 r = ui.prompt(prompt)
2727 r = ui.prompt(prompt)
2692 ui.write(('response: %s\n') % r)
2728 ui.write(('response: %s\n') % r)
2693
2729
2694 @command('debugupdatecaches', [])
2730 @command('debugupdatecaches', [])
2695 def debugupdatecaches(ui, repo, *pats, **opts):
2731 def debugupdatecaches(ui, repo, *pats, **opts):
2696 """warm all known caches in the repository"""
2732 """warm all known caches in the repository"""
2697 with repo.wlock(), repo.lock():
2733 with repo.wlock(), repo.lock():
2698 repo.updatecaches(full=True)
2734 repo.updatecaches(full=True)
2699
2735
2700 @command('debugupgraderepo', [
2736 @command('debugupgraderepo', [
2701 ('o', 'optimize', [], _('extra optimization to perform'), _('NAME')),
2737 ('o', 'optimize', [], _('extra optimization to perform'), _('NAME')),
2702 ('', 'run', False, _('performs an upgrade')),
2738 ('', 'run', False, _('performs an upgrade')),
2703 ])
2739 ])
2704 def debugupgraderepo(ui, repo, run=False, optimize=None):
2740 def debugupgraderepo(ui, repo, run=False, optimize=None):
2705 """upgrade a repository to use different features
2741 """upgrade a repository to use different features
2706
2742
2707 If no arguments are specified, the repository is evaluated for upgrade
2743 If no arguments are specified, the repository is evaluated for upgrade
2708 and a list of problems and potential optimizations is printed.
2744 and a list of problems and potential optimizations is printed.
2709
2745
2710 With ``--run``, a repository upgrade is performed. Behavior of the upgrade
2746 With ``--run``, a repository upgrade is performed. Behavior of the upgrade
2711 can be influenced via additional arguments. More details will be provided
2747 can be influenced via additional arguments. More details will be provided
2712 by the command output when run without ``--run``.
2748 by the command output when run without ``--run``.
2713
2749
2714 During the upgrade, the repository will be locked and no writes will be
2750 During the upgrade, the repository will be locked and no writes will be
2715 allowed.
2751 allowed.
2716
2752
2717 At the end of the upgrade, the repository may not be readable while new
2753 At the end of the upgrade, the repository may not be readable while new
2718 repository data is swapped in. This window will be as long as it takes to
2754 repository data is swapped in. This window will be as long as it takes to
2719 rename some directories inside the ``.hg`` directory. On most machines, this
2755 rename some directories inside the ``.hg`` directory. On most machines, this
2720 should complete almost instantaneously and the chances of a consumer being
2756 should complete almost instantaneously and the chances of a consumer being
2721 unable to access the repository should be low.
2757 unable to access the repository should be low.
2722 """
2758 """
2723 return upgrade.upgraderepo(ui, repo, run=run, optimize=optimize)
2759 return upgrade.upgraderepo(ui, repo, run=run, optimize=optimize)
2724
2760
2725 @command('debugwalk', cmdutil.walkopts, _('[OPTION]... [FILE]...'),
2761 @command('debugwalk', cmdutil.walkopts, _('[OPTION]... [FILE]...'),
2726 inferrepo=True)
2762 inferrepo=True)
2727 def debugwalk(ui, repo, *pats, **opts):
2763 def debugwalk(ui, repo, *pats, **opts):
2728 """show how files match on given patterns"""
2764 """show how files match on given patterns"""
2729 opts = pycompat.byteskwargs(opts)
2765 opts = pycompat.byteskwargs(opts)
2730 m = scmutil.match(repo[None], pats, opts)
2766 m = scmutil.match(repo[None], pats, opts)
2731 if ui.verbose:
2767 if ui.verbose:
2732 ui.write(('* matcher:\n'), stringutil.prettyrepr(m), '\n')
2768 ui.write(('* matcher:\n'), stringutil.prettyrepr(m), '\n')
2733 items = list(repo[None].walk(m))
2769 items = list(repo[None].walk(m))
2734 if not items:
2770 if not items:
2735 return
2771 return
2736 f = lambda fn: fn
2772 f = lambda fn: fn
2737 if ui.configbool('ui', 'slash') and pycompat.ossep != '/':
2773 if ui.configbool('ui', 'slash') and pycompat.ossep != '/':
2738 f = lambda fn: util.normpath(fn)
2774 f = lambda fn: util.normpath(fn)
2739 fmt = 'f %%-%ds %%-%ds %%s' % (
2775 fmt = 'f %%-%ds %%-%ds %%s' % (
2740 max([len(abs) for abs in items]),
2776 max([len(abs) for abs in items]),
2741 max([len(m.rel(abs)) for abs in items]))
2777 max([len(m.rel(abs)) for abs in items]))
2742 for abs in items:
2778 for abs in items:
2743 line = fmt % (abs, f(m.rel(abs)), m.exact(abs) and 'exact' or '')
2779 line = fmt % (abs, f(m.rel(abs)), m.exact(abs) and 'exact' or '')
2744 ui.write("%s\n" % line.rstrip())
2780 ui.write("%s\n" % line.rstrip())
2745
2781
2746 @command('debugwhyunstable', [], _('REV'))
2782 @command('debugwhyunstable', [], _('REV'))
2747 def debugwhyunstable(ui, repo, rev):
2783 def debugwhyunstable(ui, repo, rev):
2748 """explain instabilities of a changeset"""
2784 """explain instabilities of a changeset"""
2749 for entry in obsutil.whyunstable(repo, scmutil.revsingle(repo, rev)):
2785 for entry in obsutil.whyunstable(repo, scmutil.revsingle(repo, rev)):
2750 dnodes = ''
2786 dnodes = ''
2751 if entry.get('divergentnodes'):
2787 if entry.get('divergentnodes'):
2752 dnodes = ' '.join('%s (%s)' % (ctx.hex(), ctx.phasestr())
2788 dnodes = ' '.join('%s (%s)' % (ctx.hex(), ctx.phasestr())
2753 for ctx in entry['divergentnodes']) + ' '
2789 for ctx in entry['divergentnodes']) + ' '
2754 ui.write('%s: %s%s %s\n' % (entry['instability'], dnodes,
2790 ui.write('%s: %s%s %s\n' % (entry['instability'], dnodes,
2755 entry['reason'], entry['node']))
2791 entry['reason'], entry['node']))
2756
2792
2757 @command('debugwireargs',
2793 @command('debugwireargs',
2758 [('', 'three', '', 'three'),
2794 [('', 'three', '', 'three'),
2759 ('', 'four', '', 'four'),
2795 ('', 'four', '', 'four'),
2760 ('', 'five', '', 'five'),
2796 ('', 'five', '', 'five'),
2761 ] + cmdutil.remoteopts,
2797 ] + cmdutil.remoteopts,
2762 _('REPO [OPTIONS]... [ONE [TWO]]'),
2798 _('REPO [OPTIONS]... [ONE [TWO]]'),
2763 norepo=True)
2799 norepo=True)
2764 def debugwireargs(ui, repopath, *vals, **opts):
2800 def debugwireargs(ui, repopath, *vals, **opts):
2765 opts = pycompat.byteskwargs(opts)
2801 opts = pycompat.byteskwargs(opts)
2766 repo = hg.peer(ui, opts, repopath)
2802 repo = hg.peer(ui, opts, repopath)
2767 for opt in cmdutil.remoteopts:
2803 for opt in cmdutil.remoteopts:
2768 del opts[opt[1]]
2804 del opts[opt[1]]
2769 args = {}
2805 args = {}
2770 for k, v in opts.iteritems():
2806 for k, v in opts.iteritems():
2771 if v:
2807 if v:
2772 args[k] = v
2808 args[k] = v
2773 args = pycompat.strkwargs(args)
2809 args = pycompat.strkwargs(args)
2774 # run twice to check that we don't mess up the stream for the next command
2810 # run twice to check that we don't mess up the stream for the next command
2775 res1 = repo.debugwireargs(*vals, **args)
2811 res1 = repo.debugwireargs(*vals, **args)
2776 res2 = repo.debugwireargs(*vals, **args)
2812 res2 = repo.debugwireargs(*vals, **args)
2777 ui.write("%s\n" % res1)
2813 ui.write("%s\n" % res1)
2778 if res1 != res2:
2814 if res1 != res2:
2779 ui.warn("%s\n" % res2)
2815 ui.warn("%s\n" % res2)
2780
2816
2781 def _parsewirelangblocks(fh):
2817 def _parsewirelangblocks(fh):
2782 activeaction = None
2818 activeaction = None
2783 blocklines = []
2819 blocklines = []
2784
2820
2785 for line in fh:
2821 for line in fh:
2786 line = line.rstrip()
2822 line = line.rstrip()
2787 if not line:
2823 if not line:
2788 continue
2824 continue
2789
2825
2790 if line.startswith(b'#'):
2826 if line.startswith(b'#'):
2791 continue
2827 continue
2792
2828
2793 if not line.startswith(b' '):
2829 if not line.startswith(b' '):
2794 # New block. Flush previous one.
2830 # New block. Flush previous one.
2795 if activeaction:
2831 if activeaction:
2796 yield activeaction, blocklines
2832 yield activeaction, blocklines
2797
2833
2798 activeaction = line
2834 activeaction = line
2799 blocklines = []
2835 blocklines = []
2800 continue
2836 continue
2801
2837
2802 # Else we start with an indent.
2838 # Else we start with an indent.
2803
2839
2804 if not activeaction:
2840 if not activeaction:
2805 raise error.Abort(_('indented line outside of block'))
2841 raise error.Abort(_('indented line outside of block'))
2806
2842
2807 blocklines.append(line)
2843 blocklines.append(line)
2808
2844
2809 # Flush last block.
2845 # Flush last block.
2810 if activeaction:
2846 if activeaction:
2811 yield activeaction, blocklines
2847 yield activeaction, blocklines
2812
2848
2813 @command('debugwireproto',
2849 @command('debugwireproto',
2814 [
2850 [
2815 ('', 'localssh', False, _('start an SSH server for this repo')),
2851 ('', 'localssh', False, _('start an SSH server for this repo')),
2816 ('', 'peer', '', _('construct a specific version of the peer')),
2852 ('', 'peer', '', _('construct a specific version of the peer')),
2817 ('', 'noreadstderr', False, _('do not read from stderr of the remote')),
2853 ('', 'noreadstderr', False, _('do not read from stderr of the remote')),
2818 ('', 'nologhandshake', False,
2854 ('', 'nologhandshake', False,
2819 _('do not log I/O related to the peer handshake')),
2855 _('do not log I/O related to the peer handshake')),
2820 ] + cmdutil.remoteopts,
2856 ] + cmdutil.remoteopts,
2821 _('[PATH]'),
2857 _('[PATH]'),
2822 optionalrepo=True)
2858 optionalrepo=True)
2823 def debugwireproto(ui, repo, path=None, **opts):
2859 def debugwireproto(ui, repo, path=None, **opts):
2824 """send wire protocol commands to a server
2860 """send wire protocol commands to a server
2825
2861
2826 This command can be used to issue wire protocol commands to remote
2862 This command can be used to issue wire protocol commands to remote
2827 peers and to debug the raw data being exchanged.
2863 peers and to debug the raw data being exchanged.
2828
2864
2829 ``--localssh`` will start an SSH server against the current repository
2865 ``--localssh`` will start an SSH server against the current repository
2830 and connect to that. By default, the connection will perform a handshake
2866 and connect to that. By default, the connection will perform a handshake
2831 and establish an appropriate peer instance.
2867 and establish an appropriate peer instance.
2832
2868
2833 ``--peer`` can be used to bypass the handshake protocol and construct a
2869 ``--peer`` can be used to bypass the handshake protocol and construct a
2834 peer instance using the specified class type. Valid values are ``raw``,
2870 peer instance using the specified class type. Valid values are ``raw``,
2835 ``http2``, ``ssh1``, and ``ssh2``. ``raw`` instances only allow sending
2871 ``http2``, ``ssh1``, and ``ssh2``. ``raw`` instances only allow sending
2836 raw data payloads and don't support higher-level command actions.
2872 raw data payloads and don't support higher-level command actions.
2837
2873
2838 ``--noreadstderr`` can be used to disable automatic reading from stderr
2874 ``--noreadstderr`` can be used to disable automatic reading from stderr
2839 of the peer (for SSH connections only). Disabling automatic reading of
2875 of the peer (for SSH connections only). Disabling automatic reading of
2840 stderr is useful for making output more deterministic.
2876 stderr is useful for making output more deterministic.
2841
2877
2842 Commands are issued via a mini language which is specified via stdin.
2878 Commands are issued via a mini language which is specified via stdin.
2843 The language consists of individual actions to perform. An action is
2879 The language consists of individual actions to perform. An action is
2844 defined by a block. A block is defined as a line with no leading
2880 defined by a block. A block is defined as a line with no leading
2845 space followed by 0 or more lines with leading space. Blocks are
2881 space followed by 0 or more lines with leading space. Blocks are
2846 effectively a high-level command with additional metadata.
2882 effectively a high-level command with additional metadata.
2847
2883
2848 Lines beginning with ``#`` are ignored.
2884 Lines beginning with ``#`` are ignored.
2849
2885
2850 The following sections denote available actions.
2886 The following sections denote available actions.
2851
2887
2852 raw
2888 raw
2853 ---
2889 ---
2854
2890
2855 Send raw data to the server.
2891 Send raw data to the server.
2856
2892
2857 The block payload contains the raw data to send as one atomic send
2893 The block payload contains the raw data to send as one atomic send
2858 operation. The data may not actually be delivered in a single system
2894 operation. The data may not actually be delivered in a single system
2859 call: it depends on the abilities of the transport being used.
2895 call: it depends on the abilities of the transport being used.
2860
2896
2861 Each line in the block is de-indented and concatenated. Then, that
2897 Each line in the block is de-indented and concatenated. Then, that
2862 value is evaluated as a Python b'' literal. This allows the use of
2898 value is evaluated as a Python b'' literal. This allows the use of
2863 backslash escaping, etc.
2899 backslash escaping, etc.
2864
2900
2865 raw+
2901 raw+
2866 ----
2902 ----
2867
2903
2868 Behaves like ``raw`` except flushes output afterwards.
2904 Behaves like ``raw`` except flushes output afterwards.
2869
2905
2870 command <X>
2906 command <X>
2871 -----------
2907 -----------
2872
2908
2873 Send a request to run a named command, whose name follows the ``command``
2909 Send a request to run a named command, whose name follows the ``command``
2874 string.
2910 string.
2875
2911
2876 Arguments to the command are defined as lines in this block. The format of
2912 Arguments to the command are defined as lines in this block. The format of
2877 each line is ``<key> <value>``. e.g.::
2913 each line is ``<key> <value>``. e.g.::
2878
2914
2879 command listkeys
2915 command listkeys
2880 namespace bookmarks
2916 namespace bookmarks
2881
2917
2882 If the value begins with ``eval:``, it will be interpreted as a Python
2918 If the value begins with ``eval:``, it will be interpreted as a Python
2883 literal expression. Otherwise values are interpreted as Python b'' literals.
2919 literal expression. Otherwise values are interpreted as Python b'' literals.
2884 This allows sending complex types and encoding special byte sequences via
2920 This allows sending complex types and encoding special byte sequences via
2885 backslash escaping.
2921 backslash escaping.
2886
2922
2887 The following arguments have special meaning:
2923 The following arguments have special meaning:
2888
2924
2889 ``PUSHFILE``
2925 ``PUSHFILE``
2890 When defined, the *push* mechanism of the peer will be used instead
2926 When defined, the *push* mechanism of the peer will be used instead
2891 of the static request-response mechanism and the content of the
2927 of the static request-response mechanism and the content of the
2892 file specified in the value of this argument will be sent as the
2928 file specified in the value of this argument will be sent as the
2893 command payload.
2929 command payload.
2894
2930
2895 This can be used to submit a local bundle file to the remote.
2931 This can be used to submit a local bundle file to the remote.
2896
2932
2897 batchbegin
2933 batchbegin
2898 ----------
2934 ----------
2899
2935
2900 Instruct the peer to begin a batched send.
2936 Instruct the peer to begin a batched send.
2901
2937
2902 All ``command`` blocks are queued for execution until the next
2938 All ``command`` blocks are queued for execution until the next
2903 ``batchsubmit`` block.
2939 ``batchsubmit`` block.
2904
2940
2905 batchsubmit
2941 batchsubmit
2906 -----------
2942 -----------
2907
2943
2908 Submit previously queued ``command`` blocks as a batch request.
2944 Submit previously queued ``command`` blocks as a batch request.
2909
2945
2910 This action MUST be paired with a ``batchbegin`` action.
2946 This action MUST be paired with a ``batchbegin`` action.
2911
2947
2912 httprequest <method> <path>
2948 httprequest <method> <path>
2913 ---------------------------
2949 ---------------------------
2914
2950
2915 (HTTP peer only)
2951 (HTTP peer only)
2916
2952
2917 Send an HTTP request to the peer.
2953 Send an HTTP request to the peer.
2918
2954
2919 The HTTP request line follows the ``httprequest`` action. e.g. ``GET /foo``.
2955 The HTTP request line follows the ``httprequest`` action. e.g. ``GET /foo``.
2920
2956
2921 Arguments of the form ``<key>: <value>`` are interpreted as HTTP request
2957 Arguments of the form ``<key>: <value>`` are interpreted as HTTP request
2922 headers to add to the request. e.g. ``Accept: foo``.
2958 headers to add to the request. e.g. ``Accept: foo``.
2923
2959
2924 The following arguments are special:
2960 The following arguments are special:
2925
2961
2926 ``BODYFILE``
2962 ``BODYFILE``
2927 The content of the file defined as the value to this argument will be
2963 The content of the file defined as the value to this argument will be
2928 transferred verbatim as the HTTP request body.
2964 transferred verbatim as the HTTP request body.
2929
2965
2930 ``frame <type> <flags> <payload>``
2966 ``frame <type> <flags> <payload>``
2931 Send a unified protocol frame as part of the request body.
2967 Send a unified protocol frame as part of the request body.
2932
2968
2933 All frames will be collected and sent as the body to the HTTP
2969 All frames will be collected and sent as the body to the HTTP
2934 request.
2970 request.
2935
2971
2936 close
2972 close
2937 -----
2973 -----
2938
2974
2939 Close the connection to the server.
2975 Close the connection to the server.
2940
2976
2941 flush
2977 flush
2942 -----
2978 -----
2943
2979
2944 Flush data written to the server.
2980 Flush data written to the server.
2945
2981
2946 readavailable
2982 readavailable
2947 -------------
2983 -------------
2948
2984
2949 Close the write end of the connection and read all available data from
2985 Close the write end of the connection and read all available data from
2950 the server.
2986 the server.
2951
2987
2952 If the connection to the server encompasses multiple pipes, we poll both
2988 If the connection to the server encompasses multiple pipes, we poll both
2953 pipes and read available data.
2989 pipes and read available data.
2954
2990
2955 readline
2991 readline
2956 --------
2992 --------
2957
2993
2958 Read a line of output from the server. If there are multiple output
2994 Read a line of output from the server. If there are multiple output
2959 pipes, reads only the main pipe.
2995 pipes, reads only the main pipe.
2960
2996
2961 ereadline
2997 ereadline
2962 ---------
2998 ---------
2963
2999
2964 Like ``readline``, but read from the stderr pipe, if available.
3000 Like ``readline``, but read from the stderr pipe, if available.
2965
3001
2966 read <X>
3002 read <X>
2967 --------
3003 --------
2968
3004
2969 ``read()`` N bytes from the server's main output pipe.
3005 ``read()`` N bytes from the server's main output pipe.
2970
3006
2971 eread <X>
3007 eread <X>
2972 ---------
3008 ---------
2973
3009
2974 ``read()`` N bytes from the server's stderr pipe, if available.
3010 ``read()`` N bytes from the server's stderr pipe, if available.
2975
3011
2976 Specifying Unified Frame-Based Protocol Frames
3012 Specifying Unified Frame-Based Protocol Frames
2977 ----------------------------------------------
3013 ----------------------------------------------
2978
3014
2979 It is possible to emit a *Unified Frame-Based Protocol* by using special
3015 It is possible to emit a *Unified Frame-Based Protocol* by using special
2980 syntax.
3016 syntax.
2981
3017
2982 A frame is composed as a type, flags, and payload. These can be parsed
3018 A frame is composed as a type, flags, and payload. These can be parsed
2983 from a string of the form:
3019 from a string of the form:
2984
3020
2985 <request-id> <stream-id> <stream-flags> <type> <flags> <payload>
3021 <request-id> <stream-id> <stream-flags> <type> <flags> <payload>
2986
3022
2987 ``request-id`` and ``stream-id`` are integers defining the request and
3023 ``request-id`` and ``stream-id`` are integers defining the request and
2988 stream identifiers.
3024 stream identifiers.
2989
3025
2990 ``type`` can be an integer value for the frame type or the string name
3026 ``type`` can be an integer value for the frame type or the string name
2991 of the type. The strings are defined in ``wireprotoframing.py``. e.g.
3027 of the type. The strings are defined in ``wireprotoframing.py``. e.g.
2992 ``command-name``.
3028 ``command-name``.
2993
3029
2994 ``stream-flags`` and ``flags`` are a ``|`` delimited list of flag
3030 ``stream-flags`` and ``flags`` are a ``|`` delimited list of flag
2995 components. Each component (and there can be just one) can be an integer
3031 components. Each component (and there can be just one) can be an integer
2996 or a flag name for stream flags or frame flags, respectively. Values are
3032 or a flag name for stream flags or frame flags, respectively. Values are
2997 resolved to integers and then bitwise OR'd together.
3033 resolved to integers and then bitwise OR'd together.
2998
3034
2999 ``payload`` represents the raw frame payload. If it begins with
3035 ``payload`` represents the raw frame payload. If it begins with
3000 ``cbor:``, the following string is evaluated as Python code and the
3036 ``cbor:``, the following string is evaluated as Python code and the
3001 resulting object is fed into a CBOR encoder. Otherwise it is interpreted
3037 resulting object is fed into a CBOR encoder. Otherwise it is interpreted
3002 as a Python byte string literal.
3038 as a Python byte string literal.
3003 """
3039 """
3004 opts = pycompat.byteskwargs(opts)
3040 opts = pycompat.byteskwargs(opts)
3005
3041
3006 if opts['localssh'] and not repo:
3042 if opts['localssh'] and not repo:
3007 raise error.Abort(_('--localssh requires a repository'))
3043 raise error.Abort(_('--localssh requires a repository'))
3008
3044
3009 if opts['peer'] and opts['peer'] not in ('raw', 'http2', 'ssh1', 'ssh2'):
3045 if opts['peer'] and opts['peer'] not in ('raw', 'http2', 'ssh1', 'ssh2'):
3010 raise error.Abort(_('invalid value for --peer'),
3046 raise error.Abort(_('invalid value for --peer'),
3011 hint=_('valid values are "raw", "ssh1", and "ssh2"'))
3047 hint=_('valid values are "raw", "ssh1", and "ssh2"'))
3012
3048
3013 if path and opts['localssh']:
3049 if path and opts['localssh']:
3014 raise error.Abort(_('cannot specify --localssh with an explicit '
3050 raise error.Abort(_('cannot specify --localssh with an explicit '
3015 'path'))
3051 'path'))
3016
3052
3017 if ui.interactive():
3053 if ui.interactive():
3018 ui.write(_('(waiting for commands on stdin)\n'))
3054 ui.write(_('(waiting for commands on stdin)\n'))
3019
3055
3020 blocks = list(_parsewirelangblocks(ui.fin))
3056 blocks = list(_parsewirelangblocks(ui.fin))
3021
3057
3022 proc = None
3058 proc = None
3023 stdin = None
3059 stdin = None
3024 stdout = None
3060 stdout = None
3025 stderr = None
3061 stderr = None
3026 opener = None
3062 opener = None
3027
3063
3028 if opts['localssh']:
3064 if opts['localssh']:
3029 # We start the SSH server in its own process so there is process
3065 # We start the SSH server in its own process so there is process
3030 # separation. This prevents a whole class of potential bugs around
3066 # separation. This prevents a whole class of potential bugs around
3031 # shared state from interfering with server operation.
3067 # shared state from interfering with server operation.
3032 args = procutil.hgcmd() + [
3068 args = procutil.hgcmd() + [
3033 '-R', repo.root,
3069 '-R', repo.root,
3034 'debugserve', '--sshstdio',
3070 'debugserve', '--sshstdio',
3035 ]
3071 ]
3036 proc = subprocess.Popen(args, stdin=subprocess.PIPE,
3072 proc = subprocess.Popen(args, stdin=subprocess.PIPE,
3037 stdout=subprocess.PIPE, stderr=subprocess.PIPE,
3073 stdout=subprocess.PIPE, stderr=subprocess.PIPE,
3038 bufsize=0)
3074 bufsize=0)
3039
3075
3040 stdin = proc.stdin
3076 stdin = proc.stdin
3041 stdout = proc.stdout
3077 stdout = proc.stdout
3042 stderr = proc.stderr
3078 stderr = proc.stderr
3043
3079
3044 # We turn the pipes into observers so we can log I/O.
3080 # We turn the pipes into observers so we can log I/O.
3045 if ui.verbose or opts['peer'] == 'raw':
3081 if ui.verbose or opts['peer'] == 'raw':
3046 stdin = util.makeloggingfileobject(ui, proc.stdin, b'i',
3082 stdin = util.makeloggingfileobject(ui, proc.stdin, b'i',
3047 logdata=True)
3083 logdata=True)
3048 stdout = util.makeloggingfileobject(ui, proc.stdout, b'o',
3084 stdout = util.makeloggingfileobject(ui, proc.stdout, b'o',
3049 logdata=True)
3085 logdata=True)
3050 stderr = util.makeloggingfileobject(ui, proc.stderr, b'e',
3086 stderr = util.makeloggingfileobject(ui, proc.stderr, b'e',
3051 logdata=True)
3087 logdata=True)
3052
3088
3053 # --localssh also implies the peer connection settings.
3089 # --localssh also implies the peer connection settings.
3054
3090
3055 url = 'ssh://localserver'
3091 url = 'ssh://localserver'
3056 autoreadstderr = not opts['noreadstderr']
3092 autoreadstderr = not opts['noreadstderr']
3057
3093
3058 if opts['peer'] == 'ssh1':
3094 if opts['peer'] == 'ssh1':
3059 ui.write(_('creating ssh peer for wire protocol version 1\n'))
3095 ui.write(_('creating ssh peer for wire protocol version 1\n'))
3060 peer = sshpeer.sshv1peer(ui, url, proc, stdin, stdout, stderr,
3096 peer = sshpeer.sshv1peer(ui, url, proc, stdin, stdout, stderr,
3061 None, autoreadstderr=autoreadstderr)
3097 None, autoreadstderr=autoreadstderr)
3062 elif opts['peer'] == 'ssh2':
3098 elif opts['peer'] == 'ssh2':
3063 ui.write(_('creating ssh peer for wire protocol version 2\n'))
3099 ui.write(_('creating ssh peer for wire protocol version 2\n'))
3064 peer = sshpeer.sshv2peer(ui, url, proc, stdin, stdout, stderr,
3100 peer = sshpeer.sshv2peer(ui, url, proc, stdin, stdout, stderr,
3065 None, autoreadstderr=autoreadstderr)
3101 None, autoreadstderr=autoreadstderr)
3066 elif opts['peer'] == 'raw':
3102 elif opts['peer'] == 'raw':
3067 ui.write(_('using raw connection to peer\n'))
3103 ui.write(_('using raw connection to peer\n'))
3068 peer = None
3104 peer = None
3069 else:
3105 else:
3070 ui.write(_('creating ssh peer from handshake results\n'))
3106 ui.write(_('creating ssh peer from handshake results\n'))
3071 peer = sshpeer.makepeer(ui, url, proc, stdin, stdout, stderr,
3107 peer = sshpeer.makepeer(ui, url, proc, stdin, stdout, stderr,
3072 autoreadstderr=autoreadstderr)
3108 autoreadstderr=autoreadstderr)
3073
3109
3074 elif path:
3110 elif path:
3075 # We bypass hg.peer() so we can proxy the sockets.
3111 # We bypass hg.peer() so we can proxy the sockets.
3076 # TODO consider not doing this because we skip
3112 # TODO consider not doing this because we skip
3077 # ``hg.wirepeersetupfuncs`` and potentially other useful functionality.
3113 # ``hg.wirepeersetupfuncs`` and potentially other useful functionality.
3078 u = util.url(path)
3114 u = util.url(path)
3079 if u.scheme != 'http':
3115 if u.scheme != 'http':
3080 raise error.Abort(_('only http:// paths are currently supported'))
3116 raise error.Abort(_('only http:// paths are currently supported'))
3081
3117
3082 url, authinfo = u.authinfo()
3118 url, authinfo = u.authinfo()
3083 openerargs = {
3119 openerargs = {
3084 r'useragent': b'Mercurial debugwireproto',
3120 r'useragent': b'Mercurial debugwireproto',
3085 }
3121 }
3086
3122
3087 # Turn pipes/sockets into observers so we can log I/O.
3123 # Turn pipes/sockets into observers so we can log I/O.
3088 if ui.verbose:
3124 if ui.verbose:
3089 openerargs.update({
3125 openerargs.update({
3090 r'loggingfh': ui,
3126 r'loggingfh': ui,
3091 r'loggingname': b's',
3127 r'loggingname': b's',
3092 r'loggingopts': {
3128 r'loggingopts': {
3093 r'logdata': True,
3129 r'logdata': True,
3094 r'logdataapis': False,
3130 r'logdataapis': False,
3095 },
3131 },
3096 })
3132 })
3097
3133
3098 if ui.debugflag:
3134 if ui.debugflag:
3099 openerargs[r'loggingopts'][r'logdataapis'] = True
3135 openerargs[r'loggingopts'][r'logdataapis'] = True
3100
3136
3101 # Don't send default headers when in raw mode. This allows us to
3137 # Don't send default headers when in raw mode. This allows us to
3102 # bypass most of the behavior of our URL handling code so we can
3138 # bypass most of the behavior of our URL handling code so we can
3103 # have near complete control over what's sent on the wire.
3139 # have near complete control over what's sent on the wire.
3104 if opts['peer'] == 'raw':
3140 if opts['peer'] == 'raw':
3105 openerargs[r'sendaccept'] = False
3141 openerargs[r'sendaccept'] = False
3106
3142
3107 opener = urlmod.opener(ui, authinfo, **openerargs)
3143 opener = urlmod.opener(ui, authinfo, **openerargs)
3108
3144
3109 if opts['peer'] == 'http2':
3145 if opts['peer'] == 'http2':
3110 ui.write(_('creating http peer for wire protocol version 2\n'))
3146 ui.write(_('creating http peer for wire protocol version 2\n'))
3111 # We go through makepeer() because we need an API descriptor for
3147 # We go through makepeer() because we need an API descriptor for
3112 # the peer instance to be useful.
3148 # the peer instance to be useful.
3113 with ui.configoverride({
3149 with ui.configoverride({
3114 ('experimental', 'httppeer.advertise-v2'): True}):
3150 ('experimental', 'httppeer.advertise-v2'): True}):
3115 if opts['nologhandshake']:
3151 if opts['nologhandshake']:
3116 ui.pushbuffer()
3152 ui.pushbuffer()
3117
3153
3118 peer = httppeer.makepeer(ui, path, opener=opener)
3154 peer = httppeer.makepeer(ui, path, opener=opener)
3119
3155
3120 if opts['nologhandshake']:
3156 if opts['nologhandshake']:
3121 ui.popbuffer()
3157 ui.popbuffer()
3122
3158
3123 if not isinstance(peer, httppeer.httpv2peer):
3159 if not isinstance(peer, httppeer.httpv2peer):
3124 raise error.Abort(_('could not instantiate HTTP peer for '
3160 raise error.Abort(_('could not instantiate HTTP peer for '
3125 'wire protocol version 2'),
3161 'wire protocol version 2'),
3126 hint=_('the server may not have the feature '
3162 hint=_('the server may not have the feature '
3127 'enabled or is not allowing this '
3163 'enabled or is not allowing this '
3128 'client version'))
3164 'client version'))
3129
3165
3130 elif opts['peer'] == 'raw':
3166 elif opts['peer'] == 'raw':
3131 ui.write(_('using raw connection to peer\n'))
3167 ui.write(_('using raw connection to peer\n'))
3132 peer = None
3168 peer = None
3133 elif opts['peer']:
3169 elif opts['peer']:
3134 raise error.Abort(_('--peer %s not supported with HTTP peers') %
3170 raise error.Abort(_('--peer %s not supported with HTTP peers') %
3135 opts['peer'])
3171 opts['peer'])
3136 else:
3172 else:
3137 peer = httppeer.makepeer(ui, path, opener=opener)
3173 peer = httppeer.makepeer(ui, path, opener=opener)
3138
3174
3139 # We /could/ populate stdin/stdout with sock.makefile()...
3175 # We /could/ populate stdin/stdout with sock.makefile()...
3140 else:
3176 else:
3141 raise error.Abort(_('unsupported connection configuration'))
3177 raise error.Abort(_('unsupported connection configuration'))
3142
3178
3143 batchedcommands = None
3179 batchedcommands = None
3144
3180
3145 # Now perform actions based on the parsed wire language instructions.
3181 # Now perform actions based on the parsed wire language instructions.
3146 for action, lines in blocks:
3182 for action, lines in blocks:
3147 if action in ('raw', 'raw+'):
3183 if action in ('raw', 'raw+'):
3148 if not stdin:
3184 if not stdin:
3149 raise error.Abort(_('cannot call raw/raw+ on this peer'))
3185 raise error.Abort(_('cannot call raw/raw+ on this peer'))
3150
3186
3151 # Concatenate the data together.
3187 # Concatenate the data together.
3152 data = ''.join(l.lstrip() for l in lines)
3188 data = ''.join(l.lstrip() for l in lines)
3153 data = stringutil.unescapestr(data)
3189 data = stringutil.unescapestr(data)
3154 stdin.write(data)
3190 stdin.write(data)
3155
3191
3156 if action == 'raw+':
3192 if action == 'raw+':
3157 stdin.flush()
3193 stdin.flush()
3158 elif action == 'flush':
3194 elif action == 'flush':
3159 if not stdin:
3195 if not stdin:
3160 raise error.Abort(_('cannot call flush on this peer'))
3196 raise error.Abort(_('cannot call flush on this peer'))
3161 stdin.flush()
3197 stdin.flush()
3162 elif action.startswith('command'):
3198 elif action.startswith('command'):
3163 if not peer:
3199 if not peer:
3164 raise error.Abort(_('cannot send commands unless peer instance '
3200 raise error.Abort(_('cannot send commands unless peer instance '
3165 'is available'))
3201 'is available'))
3166
3202
3167 command = action.split(' ', 1)[1]
3203 command = action.split(' ', 1)[1]
3168
3204
3169 args = {}
3205 args = {}
3170 for line in lines:
3206 for line in lines:
3171 # We need to allow empty values.
3207 # We need to allow empty values.
3172 fields = line.lstrip().split(' ', 1)
3208 fields = line.lstrip().split(' ', 1)
3173 if len(fields) == 1:
3209 if len(fields) == 1:
3174 key = fields[0]
3210 key = fields[0]
3175 value = ''
3211 value = ''
3176 else:
3212 else:
3177 key, value = fields
3213 key, value = fields
3178
3214
3179 if value.startswith('eval:'):
3215 if value.startswith('eval:'):
3180 value = stringutil.evalpythonliteral(value[5:])
3216 value = stringutil.evalpythonliteral(value[5:])
3181 else:
3217 else:
3182 value = stringutil.unescapestr(value)
3218 value = stringutil.unescapestr(value)
3183
3219
3184 args[key] = value
3220 args[key] = value
3185
3221
3186 if batchedcommands is not None:
3222 if batchedcommands is not None:
3187 batchedcommands.append((command, args))
3223 batchedcommands.append((command, args))
3188 continue
3224 continue
3189
3225
3190 ui.status(_('sending %s command\n') % command)
3226 ui.status(_('sending %s command\n') % command)
3191
3227
3192 if 'PUSHFILE' in args:
3228 if 'PUSHFILE' in args:
3193 with open(args['PUSHFILE'], r'rb') as fh:
3229 with open(args['PUSHFILE'], r'rb') as fh:
3194 del args['PUSHFILE']
3230 del args['PUSHFILE']
3195 res, output = peer._callpush(command, fh,
3231 res, output = peer._callpush(command, fh,
3196 **pycompat.strkwargs(args))
3232 **pycompat.strkwargs(args))
3197 ui.status(_('result: %s\n') % stringutil.escapestr(res))
3233 ui.status(_('result: %s\n') % stringutil.escapestr(res))
3198 ui.status(_('remote output: %s\n') %
3234 ui.status(_('remote output: %s\n') %
3199 stringutil.escapestr(output))
3235 stringutil.escapestr(output))
3200 else:
3236 else:
3201 with peer.commandexecutor() as e:
3237 with peer.commandexecutor() as e:
3202 res = e.callcommand(command, args).result()
3238 res = e.callcommand(command, args).result()
3203
3239
3204 if isinstance(res, wireprotov2peer.commandresponse):
3240 if isinstance(res, wireprotov2peer.commandresponse):
3205 val = list(res.cborobjects())
3241 val = list(res.cborobjects())
3206 ui.status(_('response: %s\n') %
3242 ui.status(_('response: %s\n') %
3207 stringutil.pprint(val, bprefix=True))
3243 stringutil.pprint(val, bprefix=True))
3208
3244
3209 else:
3245 else:
3210 ui.status(_('response: %s\n') %
3246 ui.status(_('response: %s\n') %
3211 stringutil.pprint(res, bprefix=True))
3247 stringutil.pprint(res, bprefix=True))
3212
3248
3213 elif action == 'batchbegin':
3249 elif action == 'batchbegin':
3214 if batchedcommands is not None:
3250 if batchedcommands is not None:
3215 raise error.Abort(_('nested batchbegin not allowed'))
3251 raise error.Abort(_('nested batchbegin not allowed'))
3216
3252
3217 batchedcommands = []
3253 batchedcommands = []
3218 elif action == 'batchsubmit':
3254 elif action == 'batchsubmit':
3219 # There is a batching API we could go through. But it would be
3255 # There is a batching API we could go through. But it would be
3220 # difficult to normalize requests into function calls. It is easier
3256 # difficult to normalize requests into function calls. It is easier
3221 # to bypass this layer and normalize to commands + args.
3257 # to bypass this layer and normalize to commands + args.
3222 ui.status(_('sending batch with %d sub-commands\n') %
3258 ui.status(_('sending batch with %d sub-commands\n') %
3223 len(batchedcommands))
3259 len(batchedcommands))
3224 for i, chunk in enumerate(peer._submitbatch(batchedcommands)):
3260 for i, chunk in enumerate(peer._submitbatch(batchedcommands)):
3225 ui.status(_('response #%d: %s\n') %
3261 ui.status(_('response #%d: %s\n') %
3226 (i, stringutil.escapestr(chunk)))
3262 (i, stringutil.escapestr(chunk)))
3227
3263
3228 batchedcommands = None
3264 batchedcommands = None
3229
3265
3230 elif action.startswith('httprequest '):
3266 elif action.startswith('httprequest '):
3231 if not opener:
3267 if not opener:
3232 raise error.Abort(_('cannot use httprequest without an HTTP '
3268 raise error.Abort(_('cannot use httprequest without an HTTP '
3233 'peer'))
3269 'peer'))
3234
3270
3235 request = action.split(' ', 2)
3271 request = action.split(' ', 2)
3236 if len(request) != 3:
3272 if len(request) != 3:
3237 raise error.Abort(_('invalid httprequest: expected format is '
3273 raise error.Abort(_('invalid httprequest: expected format is '
3238 '"httprequest <method> <path>'))
3274 '"httprequest <method> <path>'))
3239
3275
3240 method, httppath = request[1:]
3276 method, httppath = request[1:]
3241 headers = {}
3277 headers = {}
3242 body = None
3278 body = None
3243 frames = []
3279 frames = []
3244 for line in lines:
3280 for line in lines:
3245 line = line.lstrip()
3281 line = line.lstrip()
3246 m = re.match(b'^([a-zA-Z0-9_-]+): (.*)$', line)
3282 m = re.match(b'^([a-zA-Z0-9_-]+): (.*)$', line)
3247 if m:
3283 if m:
3248 headers[m.group(1)] = m.group(2)
3284 headers[m.group(1)] = m.group(2)
3249 continue
3285 continue
3250
3286
3251 if line.startswith(b'BODYFILE '):
3287 if line.startswith(b'BODYFILE '):
3252 with open(line.split(b' ', 1), 'rb') as fh:
3288 with open(line.split(b' ', 1), 'rb') as fh:
3253 body = fh.read()
3289 body = fh.read()
3254 elif line.startswith(b'frame '):
3290 elif line.startswith(b'frame '):
3255 frame = wireprotoframing.makeframefromhumanstring(
3291 frame = wireprotoframing.makeframefromhumanstring(
3256 line[len(b'frame '):])
3292 line[len(b'frame '):])
3257
3293
3258 frames.append(frame)
3294 frames.append(frame)
3259 else:
3295 else:
3260 raise error.Abort(_('unknown argument to httprequest: %s') %
3296 raise error.Abort(_('unknown argument to httprequest: %s') %
3261 line)
3297 line)
3262
3298
3263 url = path + httppath
3299 url = path + httppath
3264
3300
3265 if frames:
3301 if frames:
3266 body = b''.join(bytes(f) for f in frames)
3302 body = b''.join(bytes(f) for f in frames)
3267
3303
3268 req = urlmod.urlreq.request(pycompat.strurl(url), body, headers)
3304 req = urlmod.urlreq.request(pycompat.strurl(url), body, headers)
3269
3305
3270 # urllib.Request insists on using has_data() as a proxy for
3306 # urllib.Request insists on using has_data() as a proxy for
3271 # determining the request method. Override that to use our
3307 # determining the request method. Override that to use our
3272 # explicitly requested method.
3308 # explicitly requested method.
3273 req.get_method = lambda: pycompat.sysstr(method)
3309 req.get_method = lambda: pycompat.sysstr(method)
3274
3310
3275 try:
3311 try:
3276 res = opener.open(req)
3312 res = opener.open(req)
3277 body = res.read()
3313 body = res.read()
3278 except util.urlerr.urlerror as e:
3314 except util.urlerr.urlerror as e:
3279 # read() method must be called, but only exists in Python 2
3315 # read() method must be called, but only exists in Python 2
3280 getattr(e, 'read', lambda: None)()
3316 getattr(e, 'read', lambda: None)()
3281 continue
3317 continue
3282
3318
3283 if res.headers.get('Content-Type') == 'application/mercurial-cbor':
3319 if res.headers.get('Content-Type') == 'application/mercurial-cbor':
3284 ui.write(_('cbor> %s\n') %
3320 ui.write(_('cbor> %s\n') %
3285 stringutil.pprint(cbor.loads(body), bprefix=True))
3321 stringutil.pprint(cbor.loads(body), bprefix=True))
3286
3322
3287 elif action == 'close':
3323 elif action == 'close':
3288 peer.close()
3324 peer.close()
3289 elif action == 'readavailable':
3325 elif action == 'readavailable':
3290 if not stdout or not stderr:
3326 if not stdout or not stderr:
3291 raise error.Abort(_('readavailable not available on this peer'))
3327 raise error.Abort(_('readavailable not available on this peer'))
3292
3328
3293 stdin.close()
3329 stdin.close()
3294 stdout.read()
3330 stdout.read()
3295 stderr.read()
3331 stderr.read()
3296
3332
3297 elif action == 'readline':
3333 elif action == 'readline':
3298 if not stdout:
3334 if not stdout:
3299 raise error.Abort(_('readline not available on this peer'))
3335 raise error.Abort(_('readline not available on this peer'))
3300 stdout.readline()
3336 stdout.readline()
3301 elif action == 'ereadline':
3337 elif action == 'ereadline':
3302 if not stderr:
3338 if not stderr:
3303 raise error.Abort(_('ereadline not available on this peer'))
3339 raise error.Abort(_('ereadline not available on this peer'))
3304 stderr.readline()
3340 stderr.readline()
3305 elif action.startswith('read '):
3341 elif action.startswith('read '):
3306 count = int(action.split(' ', 1)[1])
3342 count = int(action.split(' ', 1)[1])
3307 if not stdout:
3343 if not stdout:
3308 raise error.Abort(_('read not available on this peer'))
3344 raise error.Abort(_('read not available on this peer'))
3309 stdout.read(count)
3345 stdout.read(count)
3310 elif action.startswith('eread '):
3346 elif action.startswith('eread '):
3311 count = int(action.split(' ', 1)[1])
3347 count = int(action.split(' ', 1)[1])
3312 if not stderr:
3348 if not stderr:
3313 raise error.Abort(_('eread not available on this peer'))
3349 raise error.Abort(_('eread not available on this peer'))
3314 stderr.read(count)
3350 stderr.read(count)
3315 else:
3351 else:
3316 raise error.Abort(_('unknown action: %s') % action)
3352 raise error.Abort(_('unknown action: %s') % action)
3317
3353
3318 if batchedcommands is not None:
3354 if batchedcommands is not None:
3319 raise error.Abort(_('unclosed "batchbegin" request'))
3355 raise error.Abort(_('unclosed "batchbegin" request'))
3320
3356
3321 if peer:
3357 if peer:
3322 peer.close()
3358 peer.close()
3323
3359
3324 if proc:
3360 if proc:
3325 proc.kill()
3361 proc.kill()
@@ -1,254 +1,254 b''
1 $ hg init test
1 $ hg init test
2 $ cd test
2 $ cd test
3
3
4 $ echo 0 >> afile
4 $ echo 0 >> afile
5 $ hg add afile
5 $ hg add afile
6 $ hg commit -m "0.0"
6 $ hg commit -m "0.0"
7
7
8 $ echo 1 >> afile
8 $ echo 1 >> afile
9 $ hg commit -m "0.1"
9 $ hg commit -m "0.1"
10
10
11 $ echo 2 >> afile
11 $ echo 2 >> afile
12 $ hg commit -m "0.2"
12 $ hg commit -m "0.2"
13
13
14 $ echo 3 >> afile
14 $ echo 3 >> afile
15 $ hg commit -m "0.3"
15 $ hg commit -m "0.3"
16
16
17 $ hg update -C 0
17 $ hg update -C 0
18 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
18 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
19
19
20 $ echo 1 >> afile
20 $ echo 1 >> afile
21 $ hg commit -m "1.1"
21 $ hg commit -m "1.1"
22 created new head
22 created new head
23
23
24 $ echo 2 >> afile
24 $ echo 2 >> afile
25 $ hg commit -m "1.2"
25 $ hg commit -m "1.2"
26
26
27 $ echo a line > fred
27 $ echo a line > fred
28 $ echo 3 >> afile
28 $ echo 3 >> afile
29 $ hg add fred
29 $ hg add fred
30 $ hg commit -m "1.3"
30 $ hg commit -m "1.3"
31 $ hg mv afile adifferentfile
31 $ hg mv afile adifferentfile
32 $ hg commit -m "1.3m"
32 $ hg commit -m "1.3m"
33
33
34 $ hg update -C 3
34 $ hg update -C 3
35 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
35 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
36
36
37 $ hg mv afile anotherfile
37 $ hg mv afile anotherfile
38 $ hg commit -m "0.3m"
38 $ hg commit -m "0.3m"
39
39
40 $ hg debugindex -f 1 afile
40 $ hg debugrevlogindex -f 1 afile
41 rev flag size link p1 p2 nodeid
41 rev flag size link p1 p2 nodeid
42 0 0000 2 0 -1 -1 362fef284ce2
42 0 0000 2 0 -1 -1 362fef284ce2
43 1 0000 4 1 0 -1 125144f7e028
43 1 0000 4 1 0 -1 125144f7e028
44 2 0000 6 2 1 -1 4c982badb186
44 2 0000 6 2 1 -1 4c982badb186
45 3 0000 8 3 2 -1 19b1fc555737
45 3 0000 8 3 2 -1 19b1fc555737
46
46
47 $ hg debugindex adifferentfile
47 $ hg debugindex adifferentfile
48 rev linkrev nodeid p1 p2
48 rev linkrev nodeid p1 p2
49 0 7 2565f3199a74 000000000000 000000000000
49 0 7 2565f3199a74 000000000000 000000000000
50
50
51 $ hg debugindex anotherfile
51 $ hg debugindex anotherfile
52 rev linkrev nodeid p1 p2
52 rev linkrev nodeid p1 p2
53 0 8 2565f3199a74 000000000000 000000000000
53 0 8 2565f3199a74 000000000000 000000000000
54
54
55 $ hg debugindex fred
55 $ hg debugindex fred
56 rev linkrev nodeid p1 p2
56 rev linkrev nodeid p1 p2
57 0 6 12ab3bcc5ea4 000000000000 000000000000
57 0 6 12ab3bcc5ea4 000000000000 000000000000
58
58
59 $ hg debugindex --manifest
59 $ hg debugindex --manifest
60 rev linkrev nodeid p1 p2
60 rev linkrev nodeid p1 p2
61 0 0 43eadb1d2d06 000000000000 000000000000
61 0 0 43eadb1d2d06 000000000000 000000000000
62 1 1 8b89697eba2c 43eadb1d2d06 000000000000
62 1 1 8b89697eba2c 43eadb1d2d06 000000000000
63 2 2 626a32663c2f 8b89697eba2c 000000000000
63 2 2 626a32663c2f 8b89697eba2c 000000000000
64 3 3 f54c32f13478 626a32663c2f 000000000000
64 3 3 f54c32f13478 626a32663c2f 000000000000
65 4 6 de68e904d169 626a32663c2f 000000000000
65 4 6 de68e904d169 626a32663c2f 000000000000
66 5 7 09bb521d218d de68e904d169 000000000000
66 5 7 09bb521d218d de68e904d169 000000000000
67 6 8 1fde233dfb0f f54c32f13478 000000000000
67 6 8 1fde233dfb0f f54c32f13478 000000000000
68
68
69 $ hg verify
69 $ hg verify
70 checking changesets
70 checking changesets
71 checking manifests
71 checking manifests
72 crosschecking files in changesets and manifests
72 crosschecking files in changesets and manifests
73 checking files
73 checking files
74 4 files, 9 changesets, 7 total revisions
74 4 files, 9 changesets, 7 total revisions
75
75
76 $ cd ..
76 $ cd ..
77
77
78 $ for i in 0 1 2 3 4 5 6 7 8; do
78 $ for i in 0 1 2 3 4 5 6 7 8; do
79 > echo
79 > echo
80 > echo ---- hg clone -r "$i" test test-"$i"
80 > echo ---- hg clone -r "$i" test test-"$i"
81 > hg clone -r "$i" test test-"$i"
81 > hg clone -r "$i" test test-"$i"
82 > cd test-"$i"
82 > cd test-"$i"
83 > hg verify
83 > hg verify
84 > cd ..
84 > cd ..
85 > done
85 > done
86
86
87 ---- hg clone -r 0 test test-0
87 ---- hg clone -r 0 test test-0
88 adding changesets
88 adding changesets
89 adding manifests
89 adding manifests
90 adding file changes
90 adding file changes
91 added 1 changesets with 1 changes to 1 files
91 added 1 changesets with 1 changes to 1 files
92 new changesets f9ee2f85a263
92 new changesets f9ee2f85a263
93 updating to branch default
93 updating to branch default
94 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
94 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
95 checking changesets
95 checking changesets
96 checking manifests
96 checking manifests
97 crosschecking files in changesets and manifests
97 crosschecking files in changesets and manifests
98 checking files
98 checking files
99 1 files, 1 changesets, 1 total revisions
99 1 files, 1 changesets, 1 total revisions
100
100
101 ---- hg clone -r 1 test test-1
101 ---- hg clone -r 1 test test-1
102 adding changesets
102 adding changesets
103 adding manifests
103 adding manifests
104 adding file changes
104 adding file changes
105 added 2 changesets with 2 changes to 1 files
105 added 2 changesets with 2 changes to 1 files
106 new changesets f9ee2f85a263:34c2bf6b0626
106 new changesets f9ee2f85a263:34c2bf6b0626
107 updating to branch default
107 updating to branch default
108 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
108 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
109 checking changesets
109 checking changesets
110 checking manifests
110 checking manifests
111 crosschecking files in changesets and manifests
111 crosschecking files in changesets and manifests
112 checking files
112 checking files
113 1 files, 2 changesets, 2 total revisions
113 1 files, 2 changesets, 2 total revisions
114
114
115 ---- hg clone -r 2 test test-2
115 ---- hg clone -r 2 test test-2
116 adding changesets
116 adding changesets
117 adding manifests
117 adding manifests
118 adding file changes
118 adding file changes
119 added 3 changesets with 3 changes to 1 files
119 added 3 changesets with 3 changes to 1 files
120 new changesets f9ee2f85a263:e38ba6f5b7e0
120 new changesets f9ee2f85a263:e38ba6f5b7e0
121 updating to branch default
121 updating to branch default
122 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
122 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
123 checking changesets
123 checking changesets
124 checking manifests
124 checking manifests
125 crosschecking files in changesets and manifests
125 crosschecking files in changesets and manifests
126 checking files
126 checking files
127 1 files, 3 changesets, 3 total revisions
127 1 files, 3 changesets, 3 total revisions
128
128
129 ---- hg clone -r 3 test test-3
129 ---- hg clone -r 3 test test-3
130 adding changesets
130 adding changesets
131 adding manifests
131 adding manifests
132 adding file changes
132 adding file changes
133 added 4 changesets with 4 changes to 1 files
133 added 4 changesets with 4 changes to 1 files
134 new changesets f9ee2f85a263:eebf5a27f8ca
134 new changesets f9ee2f85a263:eebf5a27f8ca
135 updating to branch default
135 updating to branch default
136 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
136 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
137 checking changesets
137 checking changesets
138 checking manifests
138 checking manifests
139 crosschecking files in changesets and manifests
139 crosschecking files in changesets and manifests
140 checking files
140 checking files
141 1 files, 4 changesets, 4 total revisions
141 1 files, 4 changesets, 4 total revisions
142
142
143 ---- hg clone -r 4 test test-4
143 ---- hg clone -r 4 test test-4
144 adding changesets
144 adding changesets
145 adding manifests
145 adding manifests
146 adding file changes
146 adding file changes
147 added 2 changesets with 2 changes to 1 files
147 added 2 changesets with 2 changes to 1 files
148 new changesets f9ee2f85a263:095197eb4973
148 new changesets f9ee2f85a263:095197eb4973
149 updating to branch default
149 updating to branch default
150 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
150 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
151 checking changesets
151 checking changesets
152 checking manifests
152 checking manifests
153 crosschecking files in changesets and manifests
153 crosschecking files in changesets and manifests
154 checking files
154 checking files
155 1 files, 2 changesets, 2 total revisions
155 1 files, 2 changesets, 2 total revisions
156
156
157 ---- hg clone -r 5 test test-5
157 ---- hg clone -r 5 test test-5
158 adding changesets
158 adding changesets
159 adding manifests
159 adding manifests
160 adding file changes
160 adding file changes
161 added 3 changesets with 3 changes to 1 files
161 added 3 changesets with 3 changes to 1 files
162 new changesets f9ee2f85a263:1bb50a9436a7
162 new changesets f9ee2f85a263:1bb50a9436a7
163 updating to branch default
163 updating to branch default
164 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
164 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
165 checking changesets
165 checking changesets
166 checking manifests
166 checking manifests
167 crosschecking files in changesets and manifests
167 crosschecking files in changesets and manifests
168 checking files
168 checking files
169 1 files, 3 changesets, 3 total revisions
169 1 files, 3 changesets, 3 total revisions
170
170
171 ---- hg clone -r 6 test test-6
171 ---- hg clone -r 6 test test-6
172 adding changesets
172 adding changesets
173 adding manifests
173 adding manifests
174 adding file changes
174 adding file changes
175 added 4 changesets with 5 changes to 2 files
175 added 4 changesets with 5 changes to 2 files
176 new changesets f9ee2f85a263:7373c1169842
176 new changesets f9ee2f85a263:7373c1169842
177 updating to branch default
177 updating to branch default
178 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
178 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
179 checking changesets
179 checking changesets
180 checking manifests
180 checking manifests
181 crosschecking files in changesets and manifests
181 crosschecking files in changesets and manifests
182 checking files
182 checking files
183 2 files, 4 changesets, 5 total revisions
183 2 files, 4 changesets, 5 total revisions
184
184
185 ---- hg clone -r 7 test test-7
185 ---- hg clone -r 7 test test-7
186 adding changesets
186 adding changesets
187 adding manifests
187 adding manifests
188 adding file changes
188 adding file changes
189 added 5 changesets with 6 changes to 3 files
189 added 5 changesets with 6 changes to 3 files
190 new changesets f9ee2f85a263:a6a34bfa0076
190 new changesets f9ee2f85a263:a6a34bfa0076
191 updating to branch default
191 updating to branch default
192 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
192 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
193 checking changesets
193 checking changesets
194 checking manifests
194 checking manifests
195 crosschecking files in changesets and manifests
195 crosschecking files in changesets and manifests
196 checking files
196 checking files
197 3 files, 5 changesets, 6 total revisions
197 3 files, 5 changesets, 6 total revisions
198
198
199 ---- hg clone -r 8 test test-8
199 ---- hg clone -r 8 test test-8
200 adding changesets
200 adding changesets
201 adding manifests
201 adding manifests
202 adding file changes
202 adding file changes
203 added 5 changesets with 5 changes to 2 files
203 added 5 changesets with 5 changes to 2 files
204 new changesets f9ee2f85a263:aa35859c02ea
204 new changesets f9ee2f85a263:aa35859c02ea
205 updating to branch default
205 updating to branch default
206 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
206 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
207 checking changesets
207 checking changesets
208 checking manifests
208 checking manifests
209 crosschecking files in changesets and manifests
209 crosschecking files in changesets and manifests
210 checking files
210 checking files
211 2 files, 5 changesets, 5 total revisions
211 2 files, 5 changesets, 5 total revisions
212
212
213 $ cd test-8
213 $ cd test-8
214 $ hg pull ../test-7
214 $ hg pull ../test-7
215 pulling from ../test-7
215 pulling from ../test-7
216 searching for changes
216 searching for changes
217 adding changesets
217 adding changesets
218 adding manifests
218 adding manifests
219 adding file changes
219 adding file changes
220 added 4 changesets with 2 changes to 3 files (+1 heads)
220 added 4 changesets with 2 changes to 3 files (+1 heads)
221 new changesets 095197eb4973:a6a34bfa0076
221 new changesets 095197eb4973:a6a34bfa0076
222 (run 'hg heads' to see heads, 'hg merge' to merge)
222 (run 'hg heads' to see heads, 'hg merge' to merge)
223 $ hg verify
223 $ hg verify
224 checking changesets
224 checking changesets
225 checking manifests
225 checking manifests
226 crosschecking files in changesets and manifests
226 crosschecking files in changesets and manifests
227 checking files
227 checking files
228 4 files, 9 changesets, 7 total revisions
228 4 files, 9 changesets, 7 total revisions
229 $ cd ..
229 $ cd ..
230
230
231 $ hg clone test test-9
231 $ hg clone test test-9
232 updating to branch default
232 updating to branch default
233 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
233 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
234 $ cd test-9
234 $ cd test-9
235 $ hg branch foobar
235 $ hg branch foobar
236 marked working directory as branch foobar
236 marked working directory as branch foobar
237 (branches are permanent and global, did you want a bookmark?)
237 (branches are permanent and global, did you want a bookmark?)
238 $ echo file2 >> file2
238 $ echo file2 >> file2
239 $ hg add file2
239 $ hg add file2
240 $ hg commit -m "changeset9"
240 $ hg commit -m "changeset9"
241 $ echo file3 >> file3
241 $ echo file3 >> file3
242 $ hg add file3
242 $ hg add file3
243 $ hg commit -m "changeset10"
243 $ hg commit -m "changeset10"
244 $ cd ..
244 $ cd ..
245 $ hg clone -r 9 -u foobar test-9 test-10
245 $ hg clone -r 9 -u foobar test-9 test-10
246 adding changesets
246 adding changesets
247 adding manifests
247 adding manifests
248 adding file changes
248 adding file changes
249 added 6 changesets with 6 changes to 3 files
249 added 6 changesets with 6 changes to 3 files
250 new changesets f9ee2f85a263:7100abb79635
250 new changesets f9ee2f85a263:7100abb79635
251 updating to branch foobar
251 updating to branch foobar
252 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
252 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
253
253
254
254
@@ -1,404 +1,406 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 debugmanifestfulltextcache
101 debugmanifestfulltextcache
102 debugmergestate
102 debugmergestate
103 debugnamecomplete
103 debugnamecomplete
104 debugobsolete
104 debugobsolete
105 debugpathcomplete
105 debugpathcomplete
106 debugpeer
106 debugpeer
107 debugpickmergetool
107 debugpickmergetool
108 debugpushkey
108 debugpushkey
109 debugpvec
109 debugpvec
110 debugrebuilddirstate
110 debugrebuilddirstate
111 debugrebuildfncache
111 debugrebuildfncache
112 debugrename
112 debugrename
113 debugrevlog
113 debugrevlog
114 debugrevlogindex
114 debugrevspec
115 debugrevspec
115 debugserve
116 debugserve
116 debugsetparents
117 debugsetparents
117 debugssl
118 debugssl
118 debugsub
119 debugsub
119 debugsuccessorssets
120 debugsuccessorssets
120 debugtemplate
121 debugtemplate
121 debuguigetpass
122 debuguigetpass
122 debuguiprompt
123 debuguiprompt
123 debugupdatecaches
124 debugupdatecaches
124 debugupgraderepo
125 debugupgraderepo
125 debugwalk
126 debugwalk
126 debugwhyunstable
127 debugwhyunstable
127 debugwireargs
128 debugwireargs
128 debugwireproto
129 debugwireproto
129
130
130 Do not show the alias of a debug command if there are other candidates
131 Do not show the alias of a debug command if there are other candidates
131 (this should hide rawcommit)
132 (this should hide rawcommit)
132 $ hg debugcomplete r
133 $ hg debugcomplete r
133 recover
134 recover
134 remove
135 remove
135 rename
136 rename
136 resolve
137 resolve
137 revert
138 revert
138 rollback
139 rollback
139 root
140 root
140 Show the alias of a debug command if there are no other candidates
141 Show the alias of a debug command if there are no other candidates
141 $ hg debugcomplete rawc
142 $ hg debugcomplete rawc
142
143
143
144
144 Show the global options
145 Show the global options
145 $ hg debugcomplete --options | sort
146 $ hg debugcomplete --options | sort
146 --color
147 --color
147 --config
148 --config
148 --cwd
149 --cwd
149 --debug
150 --debug
150 --debugger
151 --debugger
151 --encoding
152 --encoding
152 --encodingmode
153 --encodingmode
153 --help
154 --help
154 --hidden
155 --hidden
155 --noninteractive
156 --noninteractive
156 --pager
157 --pager
157 --profile
158 --profile
158 --quiet
159 --quiet
159 --repository
160 --repository
160 --time
161 --time
161 --traceback
162 --traceback
162 --verbose
163 --verbose
163 --version
164 --version
164 -R
165 -R
165 -h
166 -h
166 -q
167 -q
167 -v
168 -v
168 -y
169 -y
169
170
170 Show the options for the "serve" command
171 Show the options for the "serve" command
171 $ hg debugcomplete --options serve | sort
172 $ hg debugcomplete --options serve | sort
172 --accesslog
173 --accesslog
173 --address
174 --address
174 --certificate
175 --certificate
175 --cmdserver
176 --cmdserver
176 --color
177 --color
177 --config
178 --config
178 --cwd
179 --cwd
179 --daemon
180 --daemon
180 --daemon-postexec
181 --daemon-postexec
181 --debug
182 --debug
182 --debugger
183 --debugger
183 --encoding
184 --encoding
184 --encodingmode
185 --encodingmode
185 --errorlog
186 --errorlog
186 --help
187 --help
187 --hidden
188 --hidden
188 --ipv6
189 --ipv6
189 --name
190 --name
190 --noninteractive
191 --noninteractive
191 --pager
192 --pager
192 --pid-file
193 --pid-file
193 --port
194 --port
194 --prefix
195 --prefix
195 --print-url
196 --print-url
196 --profile
197 --profile
197 --quiet
198 --quiet
198 --repository
199 --repository
199 --stdio
200 --stdio
200 --style
201 --style
201 --subrepos
202 --subrepos
202 --templates
203 --templates
203 --time
204 --time
204 --traceback
205 --traceback
205 --verbose
206 --verbose
206 --version
207 --version
207 --web-conf
208 --web-conf
208 -6
209 -6
209 -A
210 -A
210 -E
211 -E
211 -R
212 -R
212 -S
213 -S
213 -a
214 -a
214 -d
215 -d
215 -h
216 -h
216 -n
217 -n
217 -p
218 -p
218 -q
219 -q
219 -t
220 -t
220 -v
221 -v
221 -y
222 -y
222
223
223 Show an error if we use --options with an ambiguous abbreviation
224 Show an error if we use --options with an ambiguous abbreviation
224 $ hg debugcomplete --options s
225 $ hg debugcomplete --options s
225 hg: command 's' is ambiguous:
226 hg: command 's' is ambiguous:
226 serve showconfig status summary
227 serve showconfig status summary
227 [255]
228 [255]
228
229
229 Show all commands + options
230 Show all commands + options
230 $ hg debugcommands
231 $ hg debugcommands
231 add: include, exclude, subrepos, dry-run
232 add: include, exclude, subrepos, dry-run
232 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
233 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
233 clone: noupdate, updaterev, rev, branch, pull, uncompressed, stream, ssh, remotecmd, insecure
234 clone: noupdate, updaterev, rev, branch, pull, uncompressed, stream, ssh, remotecmd, insecure
234 commit: addremove, close-branch, amend, secret, edit, interactive, include, exclude, message, logfile, date, user, subrepos
235 commit: addremove, close-branch, amend, secret, edit, interactive, include, exclude, message, logfile, date, user, subrepos
235 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
236 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
236 export: bookmark, output, switch-parent, rev, text, git, binary, nodates, template
237 export: bookmark, output, switch-parent, rev, text, git, binary, nodates, template
237 forget: interactive, include, exclude, dry-run
238 forget: interactive, include, exclude, dry-run
238 init: ssh, remotecmd, insecure
239 init: ssh, remotecmd, insecure
239 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
240 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
240 merge: force, rev, preview, abort, tool
241 merge: force, rev, preview, abort, tool
241 pull: update, force, rev, bookmark, branch, ssh, remotecmd, insecure
242 pull: update, force, rev, bookmark, branch, ssh, remotecmd, insecure
242 push: force, rev, bookmark, branch, new-branch, pushvars, ssh, remotecmd, insecure
243 push: force, rev, bookmark, branch, new-branch, pushvars, ssh, remotecmd, insecure
243 remove: after, force, subrepos, include, exclude, dry-run
244 remove: after, force, subrepos, include, exclude, dry-run
244 serve: accesslog, daemon, daemon-postexec, errorlog, port, address, prefix, name, web-conf, webdir-conf, pid-file, stdio, cmdserver, templates, style, ipv6, certificate, print-url, subrepos
245 serve: accesslog, daemon, daemon-postexec, errorlog, port, address, prefix, name, web-conf, webdir-conf, pid-file, stdio, cmdserver, templates, style, ipv6, certificate, print-url, subrepos
245 status: all, modified, added, removed, deleted, clean, unknown, ignored, no-status, terse, copies, print0, rev, change, include, exclude, subrepos, template
246 status: all, modified, added, removed, deleted, clean, unknown, ignored, no-status, terse, copies, print0, rev, change, include, exclude, subrepos, template
246 summary: remote
247 summary: remote
247 update: clean, check, merge, date, rev, tool
248 update: clean, check, merge, date, rev, tool
248 addremove: similarity, subrepos, include, exclude, dry-run
249 addremove: similarity, subrepos, include, exclude, dry-run
249 archive: no-decode, prefix, rev, type, subrepos, include, exclude
250 archive: no-decode, prefix, rev, type, subrepos, include, exclude
250 backout: merge, commit, no-commit, parent, rev, edit, tool, include, exclude, message, logfile, date, user
251 backout: merge, commit, no-commit, parent, rev, edit, tool, include, exclude, message, logfile, date, user
251 bisect: reset, good, bad, skip, extend, command, noupdate
252 bisect: reset, good, bad, skip, extend, command, noupdate
252 bookmarks: force, rev, delete, rename, inactive, active, template
253 bookmarks: force, rev, delete, rename, inactive, active, template
253 branch: force, clean, rev
254 branch: force, clean, rev
254 branches: active, closed, template
255 branches: active, closed, template
255 bundle: force, rev, branch, base, all, type, ssh, remotecmd, insecure
256 bundle: force, rev, branch, base, all, type, ssh, remotecmd, insecure
256 cat: output, rev, decode, include, exclude, template
257 cat: output, rev, decode, include, exclude, template
257 config: untrusted, edit, local, global, template
258 config: untrusted, edit, local, global, template
258 copy: after, force, include, exclude, dry-run
259 copy: after, force, include, exclude, dry-run
259 debugancestor:
260 debugancestor:
260 debugapplystreamclonebundle:
261 debugapplystreamclonebundle:
261 debugbuilddag: mergeable-file, overwritten-file, new-file
262 debugbuilddag: mergeable-file, overwritten-file, new-file
262 debugbundle: all, part-type, spec
263 debugbundle: all, part-type, spec
263 debugcapabilities:
264 debugcapabilities:
264 debugcheckstate:
265 debugcheckstate:
265 debugcolor: style
266 debugcolor: style
266 debugcommands:
267 debugcommands:
267 debugcomplete: options
268 debugcomplete: options
268 debugcreatestreamclonebundle:
269 debugcreatestreamclonebundle:
269 debugdag: tags, branches, dots, spaces
270 debugdag: tags, branches, dots, spaces
270 debugdata: changelog, manifest, dir
271 debugdata: changelog, manifest, dir
271 debugdate: extended
272 debugdate: extended
272 debugdeltachain: changelog, manifest, dir, template
273 debugdeltachain: changelog, manifest, dir, template
273 debugdirstate: nodates, datesort
274 debugdirstate: nodates, datesort
274 debugdiscovery: old, nonheads, rev, ssh, remotecmd, insecure
275 debugdiscovery: old, nonheads, rev, ssh, remotecmd, insecure
275 debugdownload: output
276 debugdownload: output
276 debugextensions: template
277 debugextensions: template
277 debugfileset: rev, all-files, show-matcher, show-stage
278 debugfileset: rev, all-files, show-matcher, show-stage
278 debugformat: template
279 debugformat: template
279 debugfsinfo:
280 debugfsinfo:
280 debuggetbundle: head, common, type
281 debuggetbundle: head, common, type
281 debugignore:
282 debugignore:
282 debugindex: changelog, manifest, dir, format
283 debugindex: changelog, manifest, dir, template
283 debugindexdot: changelog, manifest, dir
284 debugindexdot: changelog, manifest, dir
284 debuginstall: template
285 debuginstall: template
285 debugknown:
286 debugknown:
286 debuglabelcomplete:
287 debuglabelcomplete:
287 debuglocks: force-lock, force-wlock, set-lock, set-wlock
288 debuglocks: force-lock, force-wlock, set-lock, set-wlock
288 debugmanifestfulltextcache: clear, add
289 debugmanifestfulltextcache: clear, add
289 debugmergestate:
290 debugmergestate:
290 debugnamecomplete:
291 debugnamecomplete:
291 debugobsolete: flags, record-parents, rev, exclusive, index, delete, date, user, template
292 debugobsolete: flags, record-parents, rev, exclusive, index, delete, date, user, template
292 debugpathcomplete: full, normal, added, removed
293 debugpathcomplete: full, normal, added, removed
293 debugpeer:
294 debugpeer:
294 debugpickmergetool: rev, changedelete, include, exclude, tool
295 debugpickmergetool: rev, changedelete, include, exclude, tool
295 debugpushkey:
296 debugpushkey:
296 debugpvec:
297 debugpvec:
297 debugrebuilddirstate: rev, minimal
298 debugrebuilddirstate: rev, minimal
298 debugrebuildfncache:
299 debugrebuildfncache:
299 debugrename: rev
300 debugrename: rev
300 debugrevlog: changelog, manifest, dir, dump
301 debugrevlog: changelog, manifest, dir, dump
302 debugrevlogindex: changelog, manifest, dir, format
301 debugrevspec: optimize, show-revs, show-set, show-stage, no-optimized, verify-optimized
303 debugrevspec: optimize, show-revs, show-set, show-stage, no-optimized, verify-optimized
302 debugserve: sshstdio, logiofd, logiofile
304 debugserve: sshstdio, logiofd, logiofile
303 debugsetparents:
305 debugsetparents:
304 debugssl:
306 debugssl:
305 debugsub: rev
307 debugsub: rev
306 debugsuccessorssets: closest
308 debugsuccessorssets: closest
307 debugtemplate: rev, define
309 debugtemplate: rev, define
308 debuguigetpass: prompt
310 debuguigetpass: prompt
309 debuguiprompt: prompt
311 debuguiprompt: prompt
310 debugupdatecaches:
312 debugupdatecaches:
311 debugupgraderepo: optimize, run
313 debugupgraderepo: optimize, run
312 debugwalk: include, exclude
314 debugwalk: include, exclude
313 debugwhyunstable:
315 debugwhyunstable:
314 debugwireargs: three, four, five, ssh, remotecmd, insecure
316 debugwireargs: three, four, five, ssh, remotecmd, insecure
315 debugwireproto: localssh, peer, noreadstderr, nologhandshake, ssh, remotecmd, insecure
317 debugwireproto: localssh, peer, noreadstderr, nologhandshake, ssh, remotecmd, insecure
316 files: rev, print0, include, exclude, template, subrepos
318 files: rev, print0, include, exclude, template, subrepos
317 graft: rev, continue, stop, abort, edit, log, no-commit, force, currentdate, currentuser, date, user, tool, dry-run
319 graft: rev, continue, stop, abort, edit, log, no-commit, force, currentdate, currentuser, date, user, tool, dry-run
318 grep: print0, all, diff, text, follow, ignore-case, files-with-matches, line-number, rev, all-files, user, date, template, include, exclude
320 grep: print0, all, diff, text, follow, ignore-case, files-with-matches, line-number, rev, all-files, user, date, template, include, exclude
319 heads: rev, topo, active, closed, style, template
321 heads: rev, topo, active, closed, style, template
320 help: extension, command, keyword, system
322 help: extension, command, keyword, system
321 identify: rev, num, id, branch, tags, bookmarks, ssh, remotecmd, insecure, template
323 identify: rev, num, id, branch, tags, bookmarks, ssh, remotecmd, insecure, template
322 import: strip, base, edit, force, no-commit, bypass, partial, exact, prefix, import-branch, message, logfile, date, user, similarity
324 import: strip, base, edit, force, no-commit, bypass, partial, exact, prefix, import-branch, message, logfile, date, user, similarity
323 incoming: force, newest-first, bundle, rev, bookmarks, branch, patch, git, limit, no-merges, stat, graph, style, template, ssh, remotecmd, insecure, subrepos
325 incoming: force, newest-first, bundle, rev, bookmarks, branch, patch, git, limit, no-merges, stat, graph, style, template, ssh, remotecmd, insecure, subrepos
324 locate: rev, print0, fullpath, include, exclude
326 locate: rev, print0, fullpath, include, exclude
325 manifest: rev, all, template
327 manifest: rev, all, template
326 outgoing: force, rev, newest-first, bookmarks, branch, patch, git, limit, no-merges, stat, graph, style, template, ssh, remotecmd, insecure, subrepos
328 outgoing: force, rev, newest-first, bookmarks, branch, patch, git, limit, no-merges, stat, graph, style, template, ssh, remotecmd, insecure, subrepos
327 parents: rev, style, template
329 parents: rev, style, template
328 paths: template
330 paths: template
329 phase: public, draft, secret, force, rev
331 phase: public, draft, secret, force, rev
330 recover:
332 recover:
331 rename: after, force, include, exclude, dry-run
333 rename: after, force, include, exclude, dry-run
332 resolve: all, list, mark, unmark, no-status, tool, include, exclude, template
334 resolve: all, list, mark, unmark, no-status, tool, include, exclude, template
333 revert: all, date, rev, no-backup, interactive, include, exclude, dry-run
335 revert: all, date, rev, no-backup, interactive, include, exclude, dry-run
334 rollback: dry-run, force
336 rollback: dry-run, force
335 root:
337 root:
336 tag: force, local, rev, remove, edit, message, date, user
338 tag: force, local, rev, remove, edit, message, date, user
337 tags: template
339 tags: template
338 tip: patch, git, style, template
340 tip: patch, git, style, template
339 unbundle: update
341 unbundle: update
340 verify:
342 verify:
341 version: template
343 version: template
342
344
343 $ hg init a
345 $ hg init a
344 $ cd a
346 $ cd a
345 $ echo fee > fee
347 $ echo fee > fee
346 $ hg ci -q -Amfee
348 $ hg ci -q -Amfee
347 $ hg tag fee
349 $ hg tag fee
348 $ mkdir fie
350 $ mkdir fie
349 $ echo dead > fie/dead
351 $ echo dead > fie/dead
350 $ echo live > fie/live
352 $ echo live > fie/live
351 $ hg bookmark fo
353 $ hg bookmark fo
352 $ hg branch -q fie
354 $ hg branch -q fie
353 $ hg ci -q -Amfie
355 $ hg ci -q -Amfie
354 $ echo fo > fo
356 $ echo fo > fo
355 $ hg branch -qf default
357 $ hg branch -qf default
356 $ hg ci -q -Amfo
358 $ hg ci -q -Amfo
357 $ echo Fum > Fum
359 $ echo Fum > Fum
358 $ hg ci -q -AmFum
360 $ hg ci -q -AmFum
359 $ hg bookmark Fum
361 $ hg bookmark Fum
360
362
361 Test debugpathcomplete
363 Test debugpathcomplete
362
364
363 $ hg debugpathcomplete f
365 $ hg debugpathcomplete f
364 fee
366 fee
365 fie
367 fie
366 fo
368 fo
367 $ hg debugpathcomplete -f f
369 $ hg debugpathcomplete -f f
368 fee
370 fee
369 fie/dead
371 fie/dead
370 fie/live
372 fie/live
371 fo
373 fo
372
374
373 $ hg rm Fum
375 $ hg rm Fum
374 $ hg debugpathcomplete -r F
376 $ hg debugpathcomplete -r F
375 Fum
377 Fum
376
378
377 Test debugnamecomplete
379 Test debugnamecomplete
378
380
379 $ hg debugnamecomplete
381 $ hg debugnamecomplete
380 Fum
382 Fum
381 default
383 default
382 fee
384 fee
383 fie
385 fie
384 fo
386 fo
385 tip
387 tip
386 $ hg debugnamecomplete f
388 $ hg debugnamecomplete f
387 fee
389 fee
388 fie
390 fie
389 fo
391 fo
390
392
391 Test debuglabelcomplete, a deprecated name for debugnamecomplete that is still
393 Test debuglabelcomplete, a deprecated name for debugnamecomplete that is still
392 used for completions in some shells.
394 used for completions in some shells.
393
395
394 $ hg debuglabelcomplete
396 $ hg debuglabelcomplete
395 Fum
397 Fum
396 default
398 default
397 fee
399 fee
398 fie
400 fie
399 fo
401 fo
400 tip
402 tip
401 $ hg debuglabelcomplete f
403 $ hg debuglabelcomplete f
402 fee
404 fee
403 fie
405 fie
404 fo
406 fo
@@ -1,592 +1,619 b''
1 $ cat << EOF >> $HGRCPATH
1 $ cat << EOF >> $HGRCPATH
2 > [ui]
2 > [ui]
3 > interactive=yes
3 > interactive=yes
4 > EOF
4 > EOF
5
5
6 $ hg init debugrevlog
6 $ hg init debugrevlog
7 $ cd debugrevlog
7 $ cd debugrevlog
8 $ echo a > a
8 $ echo a > a
9 $ hg ci -Am adda
9 $ hg ci -Am adda
10 adding a
10 adding a
11 $ hg rm .
11 $ hg rm .
12 removing a
12 removing a
13 $ hg ci -Am make-it-empty
13 $ hg ci -Am make-it-empty
14 $ hg revert --all -r 0
14 $ hg revert --all -r 0
15 adding a
15 adding a
16 $ hg ci -Am make-it-full
16 $ hg ci -Am make-it-full
17 #if reporevlogstore
17 #if reporevlogstore
18 $ hg debugrevlog -c
18 $ hg debugrevlog -c
19 format : 1
19 format : 1
20 flags : inline
20 flags : inline
21
21
22 revisions : 3
22 revisions : 3
23 merges : 0 ( 0.00%)
23 merges : 0 ( 0.00%)
24 normal : 3 (100.00%)
24 normal : 3 (100.00%)
25 revisions : 3
25 revisions : 3
26 empty : 0 ( 0.00%)
26 empty : 0 ( 0.00%)
27 text : 0 (100.00%)
27 text : 0 (100.00%)
28 delta : 0 (100.00%)
28 delta : 0 (100.00%)
29 snapshot : 3 (100.00%)
29 snapshot : 3 (100.00%)
30 lvl-0 : 3 (100.00%)
30 lvl-0 : 3 (100.00%)
31 deltas : 0 ( 0.00%)
31 deltas : 0 ( 0.00%)
32 revision size : 191
32 revision size : 191
33 snapshot : 191 (100.00%)
33 snapshot : 191 (100.00%)
34 lvl-0 : 191 (100.00%)
34 lvl-0 : 191 (100.00%)
35 deltas : 0 ( 0.00%)
35 deltas : 0 ( 0.00%)
36
36
37 chunks : 3
37 chunks : 3
38 0x75 (u) : 3 (100.00%)
38 0x75 (u) : 3 (100.00%)
39 chunks size : 191
39 chunks size : 191
40 0x75 (u) : 191 (100.00%)
40 0x75 (u) : 191 (100.00%)
41
41
42 avg chain length : 0
42 avg chain length : 0
43 max chain length : 0
43 max chain length : 0
44 max chain reach : 67
44 max chain reach : 67
45 compression ratio : 0
45 compression ratio : 0
46
46
47 uncompressed data size (min/max/avg) : 57 / 66 / 62
47 uncompressed data size (min/max/avg) : 57 / 66 / 62
48 full revision size (min/max/avg) : 58 / 67 / 63
48 full revision size (min/max/avg) : 58 / 67 / 63
49 inter-snapshot size (min/max/avg) : 0 / 0 / 0
49 inter-snapshot size (min/max/avg) : 0 / 0 / 0
50 delta size (min/max/avg) : 0 / 0 / 0
50 delta size (min/max/avg) : 0 / 0 / 0
51 $ hg debugrevlog -m
51 $ hg debugrevlog -m
52 format : 1
52 format : 1
53 flags : inline, generaldelta
53 flags : inline, generaldelta
54
54
55 revisions : 3
55 revisions : 3
56 merges : 0 ( 0.00%)
56 merges : 0 ( 0.00%)
57 normal : 3 (100.00%)
57 normal : 3 (100.00%)
58 revisions : 3
58 revisions : 3
59 empty : 1 (33.33%)
59 empty : 1 (33.33%)
60 text : 1 (100.00%)
60 text : 1 (100.00%)
61 delta : 0 ( 0.00%)
61 delta : 0 ( 0.00%)
62 snapshot : 2 (66.67%)
62 snapshot : 2 (66.67%)
63 lvl-0 : 2 (66.67%)
63 lvl-0 : 2 (66.67%)
64 deltas : 0 ( 0.00%)
64 deltas : 0 ( 0.00%)
65 revision size : 88
65 revision size : 88
66 snapshot : 88 (100.00%)
66 snapshot : 88 (100.00%)
67 lvl-0 : 88 (100.00%)
67 lvl-0 : 88 (100.00%)
68 deltas : 0 ( 0.00%)
68 deltas : 0 ( 0.00%)
69
69
70 chunks : 3
70 chunks : 3
71 empty : 1 (33.33%)
71 empty : 1 (33.33%)
72 0x75 (u) : 2 (66.67%)
72 0x75 (u) : 2 (66.67%)
73 chunks size : 88
73 chunks size : 88
74 empty : 0 ( 0.00%)
74 empty : 0 ( 0.00%)
75 0x75 (u) : 88 (100.00%)
75 0x75 (u) : 88 (100.00%)
76
76
77 avg chain length : 0
77 avg chain length : 0
78 max chain length : 0
78 max chain length : 0
79 max chain reach : 44
79 max chain reach : 44
80 compression ratio : 0
80 compression ratio : 0
81
81
82 uncompressed data size (min/max/avg) : 0 / 43 / 28
82 uncompressed data size (min/max/avg) : 0 / 43 / 28
83 full revision size (min/max/avg) : 44 / 44 / 44
83 full revision size (min/max/avg) : 44 / 44 / 44
84 inter-snapshot size (min/max/avg) : 0 / 0 / 0
84 inter-snapshot size (min/max/avg) : 0 / 0 / 0
85 delta size (min/max/avg) : 0 / 0 / 0
85 delta size (min/max/avg) : 0 / 0 / 0
86 $ hg debugrevlog a
86 $ hg debugrevlog a
87 format : 1
87 format : 1
88 flags : inline, generaldelta
88 flags : inline, generaldelta
89
89
90 revisions : 1
90 revisions : 1
91 merges : 0 ( 0.00%)
91 merges : 0 ( 0.00%)
92 normal : 1 (100.00%)
92 normal : 1 (100.00%)
93 revisions : 1
93 revisions : 1
94 empty : 0 ( 0.00%)
94 empty : 0 ( 0.00%)
95 text : 0 (100.00%)
95 text : 0 (100.00%)
96 delta : 0 (100.00%)
96 delta : 0 (100.00%)
97 snapshot : 1 (100.00%)
97 snapshot : 1 (100.00%)
98 lvl-0 : 1 (100.00%)
98 lvl-0 : 1 (100.00%)
99 deltas : 0 ( 0.00%)
99 deltas : 0 ( 0.00%)
100 revision size : 3
100 revision size : 3
101 snapshot : 3 (100.00%)
101 snapshot : 3 (100.00%)
102 lvl-0 : 3 (100.00%)
102 lvl-0 : 3 (100.00%)
103 deltas : 0 ( 0.00%)
103 deltas : 0 ( 0.00%)
104
104
105 chunks : 1
105 chunks : 1
106 0x75 (u) : 1 (100.00%)
106 0x75 (u) : 1 (100.00%)
107 chunks size : 3
107 chunks size : 3
108 0x75 (u) : 3 (100.00%)
108 0x75 (u) : 3 (100.00%)
109
109
110 avg chain length : 0
110 avg chain length : 0
111 max chain length : 0
111 max chain length : 0
112 max chain reach : 3
112 max chain reach : 3
113 compression ratio : 0
113 compression ratio : 0
114
114
115 uncompressed data size (min/max/avg) : 2 / 2 / 2
115 uncompressed data size (min/max/avg) : 2 / 2 / 2
116 full revision size (min/max/avg) : 3 / 3 / 3
116 full revision size (min/max/avg) : 3 / 3 / 3
117 inter-snapshot size (min/max/avg) : 0 / 0 / 0
117 inter-snapshot size (min/max/avg) : 0 / 0 / 0
118 delta size (min/max/avg) : 0 / 0 / 0
118 delta size (min/max/avg) : 0 / 0 / 0
119 #endif
119 #endif
120
120
121 Test debugindex, with and without the --verbose/--debug flag
121 Test debugindex, with and without the --verbose/--debug flag
122 $ hg debugindex a
122 $ hg debugrevlogindex a
123 rev linkrev nodeid p1 p2
123 rev linkrev nodeid p1 p2
124 0 0 b789fdd96dc2 000000000000 000000000000
124 0 0 b789fdd96dc2 000000000000 000000000000
125
125
126 #if no-reposimplestore
126 #if no-reposimplestore
127 $ hg --verbose debugindex a
127 $ hg --verbose debugrevlogindex a
128 rev offset length linkrev nodeid p1 p2
128 rev offset length linkrev nodeid p1 p2
129 0 0 3 0 b789fdd96dc2 000000000000 000000000000
129 0 0 3 0 b789fdd96dc2 000000000000 000000000000
130
130
131 $ hg --debug debugindex a
131 $ hg --debug debugrevlogindex a
132 rev offset length linkrev nodeid p1 p2
132 rev offset length linkrev nodeid p1 p2
133 0 0 3 0 b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000
133 0 0 3 0 b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000
134 #endif
134 #endif
135
135
136 $ hg debugindex -f 1 a
136 $ hg debugrevlogindex -f 1 a
137 rev flag size link p1 p2 nodeid
137 rev flag size link p1 p2 nodeid
138 0 0000 2 0 -1 -1 b789fdd96dc2
138 0 0000 2 0 -1 -1 b789fdd96dc2
139
139
140 #if no-reposimplestore
140 #if no-reposimplestore
141 $ hg --verbose debugindex -f 1 a
141 $ hg --verbose debugrevlogindex -f 1 a
142 rev flag offset length size link p1 p2 nodeid
142 rev flag offset length size link p1 p2 nodeid
143 0 0000 0 3 2 0 -1 -1 b789fdd96dc2
143 0 0000 0 3 2 0 -1 -1 b789fdd96dc2
144
144
145 $ hg --debug debugindex -f 1 a
145 $ hg --debug debugrevlogindex -f 1 a
146 rev flag offset length size link p1 p2 nodeid
146 rev flag offset length size link p1 p2 nodeid
147 0 0000 0 3 2 0 -1 -1 b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3
147 0 0000 0 3 2 0 -1 -1 b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3
148 #endif
148 #endif
149
149
150 $ hg debugindex -c
151 rev linkrev nodeid p1 p2
152 0 0 07f494440405 000000000000 000000000000
153 1 1 8cccb4b5fec2 07f494440405 000000000000
154 2 2 b1e228c512c5 8cccb4b5fec2 000000000000
155 $ hg debugindex -c --debug
156 rev linkrev nodeid p1 p2
157 0 0 07f4944404050f47db2e5c5071e0e84e7a27bba9 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000
158 1 1 8cccb4b5fec20cafeb99dd01c26d4dee8ea4388a 07f4944404050f47db2e5c5071e0e84e7a27bba9 0000000000000000000000000000000000000000
159 2 2 b1e228c512c5d7066d70562ed839c3323a62d6d2 8cccb4b5fec20cafeb99dd01c26d4dee8ea4388a 0000000000000000000000000000000000000000
160 $ hg debugindex -m
161 rev linkrev nodeid p1 p2
162 0 0 a0c8bcbbb45c 000000000000 000000000000
163 1 1 57faf8a737ae a0c8bcbbb45c 000000000000
164 2 2 a35b10320954 57faf8a737ae 000000000000
165 $ hg debugindex -m --debug
166 rev linkrev nodeid p1 p2
167 0 0 a0c8bcbbb45c63b90b70ad007bf38961f64f2af0 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000
168 1 1 57faf8a737ae7faf490582941a82319ba6529dca a0c8bcbbb45c63b90b70ad007bf38961f64f2af0 0000000000000000000000000000000000000000
169 2 2 a35b103209548032201c16c7688cb2657f037a38 57faf8a737ae7faf490582941a82319ba6529dca 0000000000000000000000000000000000000000
170 $ hg debugindex a
171 rev linkrev nodeid p1 p2
172 0 0 b789fdd96dc2 000000000000 000000000000
173 $ hg debugindex --debug a
174 rev linkrev nodeid p1 p2
175 0 0 b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000
176
150 debugdelta chain basic output
177 debugdelta chain basic output
151
178
152 #if reporevlogstore
179 #if reporevlogstore
153 $ hg debugdeltachain -m
180 $ hg debugdeltachain -m
154 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio
181 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio
155 0 1 1 -1 base 44 43 44 1.02326 44 0 0.00000
182 0 1 1 -1 base 44 43 44 1.02326 44 0 0.00000
156 1 2 1 -1 base 0 0 0 0.00000 0 0 0.00000
183 1 2 1 -1 base 0 0 0 0.00000 0 0 0.00000
157 2 3 1 -1 base 44 43 44 1.02326 44 0 0.00000
184 2 3 1 -1 base 44 43 44 1.02326 44 0 0.00000
158
185
159 $ hg debugdeltachain -m -T '{rev} {chainid} {chainlen}\n'
186 $ hg debugdeltachain -m -T '{rev} {chainid} {chainlen}\n'
160 0 1 1
187 0 1 1
161 1 2 1
188 1 2 1
162 2 3 1
189 2 3 1
163
190
164 $ hg debugdeltachain -m -Tjson
191 $ hg debugdeltachain -m -Tjson
165 [
192 [
166 {
193 {
167 "chainid": 1,
194 "chainid": 1,
168 "chainlen": 1,
195 "chainlen": 1,
169 "chainratio": 1.02325581395,
196 "chainratio": 1.02325581395,
170 "chainsize": 44,
197 "chainsize": 44,
171 "compsize": 44,
198 "compsize": 44,
172 "deltatype": "base",
199 "deltatype": "base",
173 "extradist": 0,
200 "extradist": 0,
174 "extraratio": 0.0,
201 "extraratio": 0.0,
175 "lindist": 44,
202 "lindist": 44,
176 "prevrev": -1,
203 "prevrev": -1,
177 "rev": 0,
204 "rev": 0,
178 "uncompsize": 43
205 "uncompsize": 43
179 },
206 },
180 {
207 {
181 "chainid": 2,
208 "chainid": 2,
182 "chainlen": 1,
209 "chainlen": 1,
183 "chainratio": 0,
210 "chainratio": 0,
184 "chainsize": 0,
211 "chainsize": 0,
185 "compsize": 0,
212 "compsize": 0,
186 "deltatype": "base",
213 "deltatype": "base",
187 "extradist": 0,
214 "extradist": 0,
188 "extraratio": 0,
215 "extraratio": 0,
189 "lindist": 0,
216 "lindist": 0,
190 "prevrev": -1,
217 "prevrev": -1,
191 "rev": 1,
218 "rev": 1,
192 "uncompsize": 0
219 "uncompsize": 0
193 },
220 },
194 {
221 {
195 "chainid": 3,
222 "chainid": 3,
196 "chainlen": 1,
223 "chainlen": 1,
197 "chainratio": 1.02325581395,
224 "chainratio": 1.02325581395,
198 "chainsize": 44,
225 "chainsize": 44,
199 "compsize": 44,
226 "compsize": 44,
200 "deltatype": "base",
227 "deltatype": "base",
201 "extradist": 0,
228 "extradist": 0,
202 "extraratio": 0.0,
229 "extraratio": 0.0,
203 "lindist": 44,
230 "lindist": 44,
204 "prevrev": -1,
231 "prevrev": -1,
205 "rev": 2,
232 "rev": 2,
206 "uncompsize": 43
233 "uncompsize": 43
207 }
234 }
208 ]
235 ]
209
236
210 debugdelta chain with sparse read enabled
237 debugdelta chain with sparse read enabled
211
238
212 $ cat >> $HGRCPATH <<EOF
239 $ cat >> $HGRCPATH <<EOF
213 > [experimental]
240 > [experimental]
214 > sparse-read = True
241 > sparse-read = True
215 > EOF
242 > EOF
216 $ hg debugdeltachain -m
243 $ hg debugdeltachain -m
217 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio readsize largestblk rddensity srchunks
244 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio readsize largestblk rddensity srchunks
218 0 1 1 -1 base 44 43 44 1.02326 44 0 0.00000 44 44 1.00000 1
245 0 1 1 -1 base 44 43 44 1.02326 44 0 0.00000 44 44 1.00000 1
219 1 2 1 -1 base 0 0 0 0.00000 0 0 0.00000 0 0 1.00000 1
246 1 2 1 -1 base 0 0 0 0.00000 0 0 0.00000 0 0 1.00000 1
220 2 3 1 -1 base 44 43 44 1.02326 44 0 0.00000 44 44 1.00000 1
247 2 3 1 -1 base 44 43 44 1.02326 44 0 0.00000 44 44 1.00000 1
221
248
222 $ hg debugdeltachain -m -T '{rev} {chainid} {chainlen} {readsize} {largestblock} {readdensity}\n'
249 $ hg debugdeltachain -m -T '{rev} {chainid} {chainlen} {readsize} {largestblock} {readdensity}\n'
223 0 1 1 44 44 1.0
250 0 1 1 44 44 1.0
224 1 2 1 0 0 1
251 1 2 1 0 0 1
225 2 3 1 44 44 1.0
252 2 3 1 44 44 1.0
226
253
227 $ hg debugdeltachain -m -Tjson
254 $ hg debugdeltachain -m -Tjson
228 [
255 [
229 {
256 {
230 "chainid": 1,
257 "chainid": 1,
231 "chainlen": 1,
258 "chainlen": 1,
232 "chainratio": 1.02325581395,
259 "chainratio": 1.02325581395,
233 "chainsize": 44,
260 "chainsize": 44,
234 "compsize": 44,
261 "compsize": 44,
235 "deltatype": "base",
262 "deltatype": "base",
236 "extradist": 0,
263 "extradist": 0,
237 "extraratio": 0.0,
264 "extraratio": 0.0,
238 "largestblock": 44,
265 "largestblock": 44,
239 "lindist": 44,
266 "lindist": 44,
240 "prevrev": -1,
267 "prevrev": -1,
241 "readdensity": 1.0,
268 "readdensity": 1.0,
242 "readsize": 44,
269 "readsize": 44,
243 "rev": 0,
270 "rev": 0,
244 "srchunks": 1,
271 "srchunks": 1,
245 "uncompsize": 43
272 "uncompsize": 43
246 },
273 },
247 {
274 {
248 "chainid": 2,
275 "chainid": 2,
249 "chainlen": 1,
276 "chainlen": 1,
250 "chainratio": 0,
277 "chainratio": 0,
251 "chainsize": 0,
278 "chainsize": 0,
252 "compsize": 0,
279 "compsize": 0,
253 "deltatype": "base",
280 "deltatype": "base",
254 "extradist": 0,
281 "extradist": 0,
255 "extraratio": 0,
282 "extraratio": 0,
256 "largestblock": 0,
283 "largestblock": 0,
257 "lindist": 0,
284 "lindist": 0,
258 "prevrev": -1,
285 "prevrev": -1,
259 "readdensity": 1,
286 "readdensity": 1,
260 "readsize": 0,
287 "readsize": 0,
261 "rev": 1,
288 "rev": 1,
262 "srchunks": 1,
289 "srchunks": 1,
263 "uncompsize": 0
290 "uncompsize": 0
264 },
291 },
265 {
292 {
266 "chainid": 3,
293 "chainid": 3,
267 "chainlen": 1,
294 "chainlen": 1,
268 "chainratio": 1.02325581395,
295 "chainratio": 1.02325581395,
269 "chainsize": 44,
296 "chainsize": 44,
270 "compsize": 44,
297 "compsize": 44,
271 "deltatype": "base",
298 "deltatype": "base",
272 "extradist": 0,
299 "extradist": 0,
273 "extraratio": 0.0,
300 "extraratio": 0.0,
274 "largestblock": 44,
301 "largestblock": 44,
275 "lindist": 44,
302 "lindist": 44,
276 "prevrev": -1,
303 "prevrev": -1,
277 "readdensity": 1.0,
304 "readdensity": 1.0,
278 "readsize": 44,
305 "readsize": 44,
279 "rev": 2,
306 "rev": 2,
280 "srchunks": 1,
307 "srchunks": 1,
281 "uncompsize": 43
308 "uncompsize": 43
282 }
309 }
283 ]
310 ]
284
311
285 $ printf "This test checks things.\n" >> a
312 $ printf "This test checks things.\n" >> a
286 $ hg ci -m a
313 $ hg ci -m a
287 $ hg branch other
314 $ hg branch other
288 marked working directory as branch other
315 marked working directory as branch other
289 (branches are permanent and global, did you want a bookmark?)
316 (branches are permanent and global, did you want a bookmark?)
290 $ for i in `$TESTDIR/seq.py 5`; do
317 $ for i in `$TESTDIR/seq.py 5`; do
291 > printf "shorter ${i}" >> a
318 > printf "shorter ${i}" >> a
292 > hg ci -m "a other:$i"
319 > hg ci -m "a other:$i"
293 > hg up -q default
320 > hg up -q default
294 > printf "for the branch default we want longer chains: ${i}" >> a
321 > printf "for the branch default we want longer chains: ${i}" >> a
295 > hg ci -m "a default:$i"
322 > hg ci -m "a default:$i"
296 > hg up -q other
323 > hg up -q other
297 > done
324 > done
298 $ hg debugdeltachain a -T '{rev} {srchunks}\n' \
325 $ hg debugdeltachain a -T '{rev} {srchunks}\n' \
299 > --config experimental.sparse-read.density-threshold=0.50 \
326 > --config experimental.sparse-read.density-threshold=0.50 \
300 > --config experimental.sparse-read.min-gap-size=0
327 > --config experimental.sparse-read.min-gap-size=0
301 0 1
328 0 1
302 1 1
329 1 1
303 2 1
330 2 1
304 3 1
331 3 1
305 4 1
332 4 1
306 5 1
333 5 1
307 6 1
334 6 1
308 7 1
335 7 1
309 8 1
336 8 1
310 9 1
337 9 1
311 10 2
338 10 2
312 11 1
339 11 1
313 $ hg --config extensions.strip= strip --no-backup -r 1
340 $ hg --config extensions.strip= strip --no-backup -r 1
314 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
341 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
315
342
316 Test max chain len
343 Test max chain len
317 $ cat >> $HGRCPATH << EOF
344 $ cat >> $HGRCPATH << EOF
318 > [format]
345 > [format]
319 > maxchainlen=4
346 > maxchainlen=4
320 > EOF
347 > EOF
321
348
322 $ printf "This test checks if maxchainlen config value is respected also it can serve as basic test for debugrevlog -d <file>.\n" >> a
349 $ printf "This test checks if maxchainlen config value is respected also it can serve as basic test for debugrevlog -d <file>.\n" >> a
323 $ hg ci -m a
350 $ hg ci -m a
324 $ printf "b\n" >> a
351 $ printf "b\n" >> a
325 $ hg ci -m a
352 $ hg ci -m a
326 $ printf "c\n" >> a
353 $ printf "c\n" >> a
327 $ hg ci -m a
354 $ hg ci -m a
328 $ printf "d\n" >> a
355 $ printf "d\n" >> a
329 $ hg ci -m a
356 $ hg ci -m a
330 $ printf "e\n" >> a
357 $ printf "e\n" >> a
331 $ hg ci -m a
358 $ hg ci -m a
332 $ printf "f\n" >> a
359 $ printf "f\n" >> a
333 $ hg ci -m a
360 $ hg ci -m a
334 $ printf 'g\n' >> a
361 $ printf 'g\n' >> a
335 $ hg ci -m a
362 $ hg ci -m a
336 $ printf 'h\n' >> a
363 $ printf 'h\n' >> a
337 $ hg ci -m a
364 $ hg ci -m a
338
365
339 $ hg debugrevlog -d a
366 $ hg debugrevlog -d a
340 # rev p1rev p2rev start end deltastart base p1 p2 rawsize totalsize compression heads chainlen
367 # rev p1rev p2rev start end deltastart base p1 p2 rawsize totalsize compression heads chainlen
341 0 -1 -1 0 ??? 0 0 0 0 ??? ???? ? 1 0 (glob)
368 0 -1 -1 0 ??? 0 0 0 0 ??? ???? ? 1 0 (glob)
342 1 0 -1 ??? ??? 0 0 0 0 ??? ???? ? 1 1 (glob)
369 1 0 -1 ??? ??? 0 0 0 0 ??? ???? ? 1 1 (glob)
343 2 1 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 2 (glob)
370 2 1 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 2 (glob)
344 3 2 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 3 (glob)
371 3 2 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 3 (glob)
345 4 3 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 4 (glob)
372 4 3 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 4 (glob)
346 5 4 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 0 (glob)
373 5 4 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 0 (glob)
347 6 5 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 1 (glob)
374 6 5 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 1 (glob)
348 7 6 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 2 (glob)
375 7 6 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 2 (glob)
349 8 7 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 3 (glob)
376 8 7 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 3 (glob)
350 #endif
377 #endif
351
378
352 Test debuglocks command:
379 Test debuglocks command:
353
380
354 $ hg debuglocks
381 $ hg debuglocks
355 lock: free
382 lock: free
356 wlock: free
383 wlock: free
357
384
358 * Test setting the lock
385 * Test setting the lock
359
386
360 waitlock <file> will wait for file to be created. If it isn't in a reasonable
387 waitlock <file> will wait for file to be created. If it isn't in a reasonable
361 amount of time, displays error message and returns 1
388 amount of time, displays error message and returns 1
362 $ waitlock() {
389 $ waitlock() {
363 > start=`date +%s`
390 > start=`date +%s`
364 > timeout=5
391 > timeout=5
365 > while [ \( ! -f $1 \) -a \( ! -L $1 \) ]; do
392 > while [ \( ! -f $1 \) -a \( ! -L $1 \) ]; do
366 > now=`date +%s`
393 > now=`date +%s`
367 > if [ "`expr $now - $start`" -gt $timeout ]; then
394 > if [ "`expr $now - $start`" -gt $timeout ]; then
368 > echo "timeout: $1 was not created in $timeout seconds"
395 > echo "timeout: $1 was not created in $timeout seconds"
369 > return 1
396 > return 1
370 > fi
397 > fi
371 > sleep 0.1
398 > sleep 0.1
372 > done
399 > done
373 > }
400 > }
374 $ dolock() {
401 $ dolock() {
375 > {
402 > {
376 > waitlock .hg/unlock
403 > waitlock .hg/unlock
377 > rm -f .hg/unlock
404 > rm -f .hg/unlock
378 > echo y
405 > echo y
379 > } | hg debuglocks "$@" > /dev/null
406 > } | hg debuglocks "$@" > /dev/null
380 > }
407 > }
381 $ dolock -s &
408 $ dolock -s &
382 $ waitlock .hg/store/lock
409 $ waitlock .hg/store/lock
383
410
384 $ hg debuglocks
411 $ hg debuglocks
385 lock: user *, process * (*s) (glob)
412 lock: user *, process * (*s) (glob)
386 wlock: free
413 wlock: free
387 [1]
414 [1]
388 $ touch .hg/unlock
415 $ touch .hg/unlock
389 $ wait
416 $ wait
390 $ [ -f .hg/store/lock ] || echo "There is no lock"
417 $ [ -f .hg/store/lock ] || echo "There is no lock"
391 There is no lock
418 There is no lock
392
419
393 * Test setting the wlock
420 * Test setting the wlock
394
421
395 $ dolock -S &
422 $ dolock -S &
396 $ waitlock .hg/wlock
423 $ waitlock .hg/wlock
397
424
398 $ hg debuglocks
425 $ hg debuglocks
399 lock: free
426 lock: free
400 wlock: user *, process * (*s) (glob)
427 wlock: user *, process * (*s) (glob)
401 [1]
428 [1]
402 $ touch .hg/unlock
429 $ touch .hg/unlock
403 $ wait
430 $ wait
404 $ [ -f .hg/wlock ] || echo "There is no wlock"
431 $ [ -f .hg/wlock ] || echo "There is no wlock"
405 There is no wlock
432 There is no wlock
406
433
407 * Test setting both locks
434 * Test setting both locks
408
435
409 $ dolock -Ss &
436 $ dolock -Ss &
410 $ waitlock .hg/wlock && waitlock .hg/store/lock
437 $ waitlock .hg/wlock && waitlock .hg/store/lock
411
438
412 $ hg debuglocks
439 $ hg debuglocks
413 lock: user *, process * (*s) (glob)
440 lock: user *, process * (*s) (glob)
414 wlock: user *, process * (*s) (glob)
441 wlock: user *, process * (*s) (glob)
415 [2]
442 [2]
416
443
417 * Test failing to set a lock
444 * Test failing to set a lock
418
445
419 $ hg debuglocks -s
446 $ hg debuglocks -s
420 abort: lock is already held
447 abort: lock is already held
421 [255]
448 [255]
422
449
423 $ hg debuglocks -S
450 $ hg debuglocks -S
424 abort: wlock is already held
451 abort: wlock is already held
425 [255]
452 [255]
426
453
427 $ touch .hg/unlock
454 $ touch .hg/unlock
428 $ wait
455 $ wait
429
456
430 $ hg debuglocks
457 $ hg debuglocks
431 lock: free
458 lock: free
432 wlock: free
459 wlock: free
433
460
434 * Test forcing the lock
461 * Test forcing the lock
435
462
436 $ dolock -s &
463 $ dolock -s &
437 $ waitlock .hg/store/lock
464 $ waitlock .hg/store/lock
438
465
439 $ hg debuglocks
466 $ hg debuglocks
440 lock: user *, process * (*s) (glob)
467 lock: user *, process * (*s) (glob)
441 wlock: free
468 wlock: free
442 [1]
469 [1]
443
470
444 $ hg debuglocks -L
471 $ hg debuglocks -L
445
472
446 $ hg debuglocks
473 $ hg debuglocks
447 lock: free
474 lock: free
448 wlock: free
475 wlock: free
449
476
450 $ touch .hg/unlock
477 $ touch .hg/unlock
451 $ wait
478 $ wait
452
479
453 * Test forcing the wlock
480 * Test forcing the wlock
454
481
455 $ dolock -S &
482 $ dolock -S &
456 $ waitlock .hg/wlock
483 $ waitlock .hg/wlock
457
484
458 $ hg debuglocks
485 $ hg debuglocks
459 lock: free
486 lock: free
460 wlock: user *, process * (*s) (glob)
487 wlock: user *, process * (*s) (glob)
461 [1]
488 [1]
462
489
463 $ hg debuglocks -W
490 $ hg debuglocks -W
464
491
465 $ hg debuglocks
492 $ hg debuglocks
466 lock: free
493 lock: free
467 wlock: free
494 wlock: free
468
495
469 $ touch .hg/unlock
496 $ touch .hg/unlock
470 $ wait
497 $ wait
471
498
472 Test WdirUnsupported exception
499 Test WdirUnsupported exception
473
500
474 $ hg debugdata -c ffffffffffffffffffffffffffffffffffffffff
501 $ hg debugdata -c ffffffffffffffffffffffffffffffffffffffff
475 abort: working directory revision cannot be specified
502 abort: working directory revision cannot be specified
476 [255]
503 [255]
477
504
478 Test cache warming command
505 Test cache warming command
479
506
480 $ rm -rf .hg/cache/
507 $ rm -rf .hg/cache/
481 $ hg debugupdatecaches --debug
508 $ hg debugupdatecaches --debug
482 updating the branch cache
509 updating the branch cache
483 $ ls -r .hg/cache/*
510 $ ls -r .hg/cache/*
484 .hg/cache/rbc-revs-v1
511 .hg/cache/rbc-revs-v1
485 .hg/cache/rbc-names-v1
512 .hg/cache/rbc-names-v1
486 .hg/cache/manifestfulltextcache
513 .hg/cache/manifestfulltextcache
487 .hg/cache/branch2-served
514 .hg/cache/branch2-served
488
515
489 Test debugcolor
516 Test debugcolor
490
517
491 #if no-windows
518 #if no-windows
492 $ hg debugcolor --style --color always | egrep 'mode|style|log\.'
519 $ hg debugcolor --style --color always | egrep 'mode|style|log\.'
493 color mode: 'ansi'
520 color mode: 'ansi'
494 available style:
521 available style:
495 \x1b[0;33mlog.changeset\x1b[0m: \x1b[0;33myellow\x1b[0m (esc)
522 \x1b[0;33mlog.changeset\x1b[0m: \x1b[0;33myellow\x1b[0m (esc)
496 #endif
523 #endif
497
524
498 $ hg debugcolor --style --color never
525 $ hg debugcolor --style --color never
499 color mode: None
526 color mode: None
500 available style:
527 available style:
501
528
502 $ cd ..
529 $ cd ..
503
530
504 Test internal debugstacktrace command
531 Test internal debugstacktrace command
505
532
506 $ cat > debugstacktrace.py << EOF
533 $ cat > debugstacktrace.py << EOF
507 > from __future__ import absolute_import
534 > from __future__ import absolute_import
508 > import sys
535 > import sys
509 > from mercurial import util
536 > from mercurial import util
510 > def f():
537 > def f():
511 > util.debugstacktrace(f=sys.stdout)
538 > util.debugstacktrace(f=sys.stdout)
512 > g()
539 > g()
513 > def g():
540 > def g():
514 > util.dst('hello from g\\n', skip=1)
541 > util.dst('hello from g\\n', skip=1)
515 > h()
542 > h()
516 > def h():
543 > def h():
517 > util.dst('hi ...\\nfrom h hidden in g', 1, depth=2)
544 > util.dst('hi ...\\nfrom h hidden in g', 1, depth=2)
518 > f()
545 > f()
519 > EOF
546 > EOF
520 $ $PYTHON debugstacktrace.py
547 $ $PYTHON debugstacktrace.py
521 stacktrace at:
548 stacktrace at:
522 debugstacktrace.py:12 in * (glob)
549 debugstacktrace.py:12 in * (glob)
523 debugstacktrace.py:5 in f
550 debugstacktrace.py:5 in f
524 hello from g at:
551 hello from g at:
525 debugstacktrace.py:12 in * (glob)
552 debugstacktrace.py:12 in * (glob)
526 debugstacktrace.py:6 in f
553 debugstacktrace.py:6 in f
527 hi ...
554 hi ...
528 from h hidden in g at:
555 from h hidden in g at:
529 debugstacktrace.py:6 in f
556 debugstacktrace.py:6 in f
530 debugstacktrace.py:9 in g
557 debugstacktrace.py:9 in g
531
558
532 Test debugcapabilities command:
559 Test debugcapabilities command:
533
560
534 $ hg debugcapabilities ./debugrevlog/
561 $ hg debugcapabilities ./debugrevlog/
535 Main capabilities:
562 Main capabilities:
536 branchmap
563 branchmap
537 $USUAL_BUNDLE2_CAPS$
564 $USUAL_BUNDLE2_CAPS$
538 getbundle
565 getbundle
539 known
566 known
540 lookup
567 lookup
541 pushkey
568 pushkey
542 unbundle
569 unbundle
543 Bundle2 capabilities:
570 Bundle2 capabilities:
544 HG20
571 HG20
545 bookmarks
572 bookmarks
546 changegroup
573 changegroup
547 01
574 01
548 02
575 02
549 digests
576 digests
550 md5
577 md5
551 sha1
578 sha1
552 sha512
579 sha512
553 error
580 error
554 abort
581 abort
555 unsupportedcontent
582 unsupportedcontent
556 pushraced
583 pushraced
557 pushkey
584 pushkey
558 hgtagsfnodes
585 hgtagsfnodes
559 listkeys
586 listkeys
560 phases
587 phases
561 heads
588 heads
562 pushkey
589 pushkey
563 remote-changegroup
590 remote-changegroup
564 http
591 http
565 https
592 https
566 rev-branch-cache
593 rev-branch-cache
567 stream
594 stream
568 v2
595 v2
569
596
570 Test debugpeer
597 Test debugpeer
571
598
572 $ hg --config ui.ssh="\"$PYTHON\" \"$TESTDIR/dummyssh\"" debugpeer ssh://user@dummy/debugrevlog
599 $ hg --config ui.ssh="\"$PYTHON\" \"$TESTDIR/dummyssh\"" debugpeer ssh://user@dummy/debugrevlog
573 url: ssh://user@dummy/debugrevlog
600 url: ssh://user@dummy/debugrevlog
574 local: no
601 local: no
575 pushable: yes
602 pushable: yes
576
603
577 $ hg --config ui.ssh="\"$PYTHON\" \"$TESTDIR/dummyssh\"" --debug debugpeer ssh://user@dummy/debugrevlog
604 $ hg --config ui.ssh="\"$PYTHON\" \"$TESTDIR/dummyssh\"" --debug debugpeer ssh://user@dummy/debugrevlog
578 running "*" "*/tests/dummyssh" 'user@dummy' 'hg -R debugrevlog serve --stdio' (glob) (no-windows !)
605 running "*" "*/tests/dummyssh" 'user@dummy' 'hg -R debugrevlog serve --stdio' (glob) (no-windows !)
579 running "*" "*\tests/dummyssh" "user@dummy" "hg -R debugrevlog serve --stdio" (glob) (windows !)
606 running "*" "*\tests/dummyssh" "user@dummy" "hg -R debugrevlog serve --stdio" (glob) (windows !)
580 devel-peer-request: hello+between
607 devel-peer-request: hello+between
581 devel-peer-request: pairs: 81 bytes
608 devel-peer-request: pairs: 81 bytes
582 sending hello command
609 sending hello command
583 sending between command
610 sending between command
584 remote: 413
611 remote: 413
585 remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
612 remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
586 remote: 1
613 remote: 1
587 devel-peer-request: protocaps
614 devel-peer-request: protocaps
588 devel-peer-request: caps: * bytes (glob)
615 devel-peer-request: caps: * bytes (glob)
589 sending protocaps command
616 sending protocaps command
590 url: ssh://user@dummy/debugrevlog
617 url: ssh://user@dummy/debugrevlog
591 local: no
618 local: no
592 pushable: yes
619 pushable: yes
@@ -1,3634 +1,3636 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 Extra extensions will be printed in help output in a non-reliable order since
47 Extra extensions will be printed in help output in a non-reliable order since
48 the extension is unknown.
48 the extension is unknown.
49 #if no-extraextensions
49 #if no-extraextensions
50
50
51 $ hg help
51 $ hg help
52 Mercurial Distributed SCM
52 Mercurial Distributed SCM
53
53
54 list of commands:
54 list of commands:
55
55
56 add add the specified files on the next commit
56 add add the specified files on the next commit
57 addremove add all new files, delete all missing files
57 addremove add all new files, delete all missing files
58 annotate show changeset information by line for each file
58 annotate show changeset information by line for each file
59 archive create an unversioned archive of a repository revision
59 archive create an unversioned archive of a repository revision
60 backout reverse effect of earlier changeset
60 backout reverse effect of earlier changeset
61 bisect subdivision search of changesets
61 bisect subdivision search of changesets
62 bookmarks create a new bookmark or list existing bookmarks
62 bookmarks create a new bookmark or list existing bookmarks
63 branch set or show the current branch name
63 branch set or show the current branch name
64 branches list repository named branches
64 branches list repository named branches
65 bundle create a bundle file
65 bundle create a bundle file
66 cat output the current or given revision of files
66 cat output the current or given revision of files
67 clone make a copy of an existing repository
67 clone make a copy of an existing repository
68 commit commit the specified files or all outstanding changes
68 commit commit the specified files or all outstanding changes
69 config show combined config settings from all hgrc files
69 config show combined config settings from all hgrc files
70 copy mark files as copied for the next commit
70 copy mark files as copied for the next commit
71 diff diff repository (or selected files)
71 diff diff repository (or selected files)
72 export dump the header and diffs for one or more changesets
72 export dump the header and diffs for one or more changesets
73 files list tracked files
73 files list tracked files
74 forget forget the specified files on the next commit
74 forget forget the specified files on the next commit
75 graft copy changes from other branches onto the current branch
75 graft copy changes from other branches onto the current branch
76 grep search revision history for a pattern in specified files
76 grep search revision history for a pattern in specified files
77 heads show branch heads
77 heads show branch heads
78 help show help for a given topic or a help overview
78 help show help for a given topic or a help overview
79 identify identify the working directory or specified revision
79 identify identify the working directory or specified revision
80 import import an ordered set of patches
80 import import an ordered set of patches
81 incoming show new changesets found in source
81 incoming show new changesets found in source
82 init create a new repository in the given directory
82 init create a new repository in the given directory
83 log show revision history of entire repository or files
83 log show revision history of entire repository or files
84 manifest output the current or given revision of the project manifest
84 manifest output the current or given revision of the project manifest
85 merge merge another revision into working directory
85 merge merge another revision into working directory
86 outgoing show changesets not found in the destination
86 outgoing show changesets not found in the destination
87 paths show aliases for remote repositories
87 paths show aliases for remote repositories
88 phase set or show the current phase name
88 phase set or show the current phase name
89 pull pull changes from the specified source
89 pull pull changes from the specified source
90 push push changes to the specified destination
90 push push changes to the specified destination
91 recover roll back an interrupted transaction
91 recover roll back an interrupted transaction
92 remove remove the specified files on the next commit
92 remove remove the specified files on the next commit
93 rename rename files; equivalent of copy + remove
93 rename rename files; equivalent of copy + remove
94 resolve redo merges or set/view the merge status of files
94 resolve redo merges or set/view the merge status of files
95 revert restore files to their checkout state
95 revert restore files to their checkout state
96 root print the root (top) of the current working directory
96 root print the root (top) of the current working directory
97 serve start stand-alone webserver
97 serve start stand-alone webserver
98 status show changed files in the working directory
98 status show changed files in the working directory
99 summary summarize working directory state
99 summary summarize working directory state
100 tag add one or more tags for the current or given revision
100 tag add one or more tags for the current or given revision
101 tags list repository tags
101 tags list repository tags
102 unbundle apply one or more bundle files
102 unbundle apply one or more bundle files
103 update update working directory (or switch revisions)
103 update update working directory (or switch revisions)
104 verify verify the integrity of the repository
104 verify verify the integrity of the repository
105 version output version and copyright information
105 version output version and copyright information
106
106
107 additional help topics:
107 additional help topics:
108
108
109 bundlespec Bundle File Formats
109 bundlespec Bundle File Formats
110 color Colorizing Outputs
110 color Colorizing Outputs
111 config Configuration Files
111 config Configuration Files
112 dates Date Formats
112 dates Date Formats
113 deprecated Deprecated Features
113 deprecated Deprecated Features
114 diffs Diff Formats
114 diffs Diff Formats
115 environment Environment Variables
115 environment Environment Variables
116 extensions Using Additional Features
116 extensions Using Additional Features
117 filesets Specifying File Sets
117 filesets Specifying File Sets
118 flags Command-line flags
118 flags Command-line flags
119 glossary Glossary
119 glossary Glossary
120 hgignore Syntax for Mercurial Ignore Files
120 hgignore Syntax for Mercurial Ignore Files
121 hgweb Configuring hgweb
121 hgweb Configuring hgweb
122 internals Technical implementation topics
122 internals Technical implementation topics
123 merge-tools Merge Tools
123 merge-tools Merge Tools
124 pager Pager Support
124 pager Pager Support
125 patterns File Name Patterns
125 patterns File Name Patterns
126 phases Working with Phases
126 phases Working with Phases
127 revisions Specifying Revisions
127 revisions Specifying Revisions
128 scripting Using Mercurial from scripts and automation
128 scripting Using Mercurial from scripts and automation
129 subrepos Subrepositories
129 subrepos Subrepositories
130 templating Template Usage
130 templating Template Usage
131 urls URL Paths
131 urls URL Paths
132
132
133 (use 'hg help -v' to show built-in aliases and global options)
133 (use 'hg help -v' to show built-in aliases and global options)
134
134
135 $ hg -q help
135 $ hg -q help
136 add add the specified files on the next commit
136 add add the specified files on the next commit
137 addremove add all new files, delete all missing files
137 addremove add all new files, delete all missing files
138 annotate show changeset information by line for each file
138 annotate show changeset information by line for each file
139 archive create an unversioned archive of a repository revision
139 archive create an unversioned archive of a repository revision
140 backout reverse effect of earlier changeset
140 backout reverse effect of earlier changeset
141 bisect subdivision search of changesets
141 bisect subdivision search of changesets
142 bookmarks create a new bookmark or list existing bookmarks
142 bookmarks create a new bookmark or list existing bookmarks
143 branch set or show the current branch name
143 branch set or show the current branch name
144 branches list repository named branches
144 branches list repository named branches
145 bundle create a bundle file
145 bundle create a bundle file
146 cat output the current or given revision of files
146 cat output the current or given revision of files
147 clone make a copy of an existing repository
147 clone make a copy of an existing repository
148 commit commit the specified files or all outstanding changes
148 commit commit the specified files or all outstanding changes
149 config show combined config settings from all hgrc files
149 config show combined config settings from all hgrc files
150 copy mark files as copied for the next commit
150 copy mark files as copied for the next commit
151 diff diff repository (or selected files)
151 diff diff repository (or selected files)
152 export dump the header and diffs for one or more changesets
152 export dump the header and diffs for one or more changesets
153 files list tracked files
153 files list tracked files
154 forget forget the specified files on the next commit
154 forget forget the specified files on the next commit
155 graft copy changes from other branches onto the current branch
155 graft copy changes from other branches onto the current branch
156 grep search revision history for a pattern in specified files
156 grep search revision history for a pattern in specified files
157 heads show branch heads
157 heads show branch heads
158 help show help for a given topic or a help overview
158 help show help for a given topic or a help overview
159 identify identify the working directory or specified revision
159 identify identify the working directory or specified revision
160 import import an ordered set of patches
160 import import an ordered set of patches
161 incoming show new changesets found in source
161 incoming show new changesets found in source
162 init create a new repository in the given directory
162 init create a new repository in the given directory
163 log show revision history of entire repository or files
163 log show revision history of entire repository or files
164 manifest output the current or given revision of the project manifest
164 manifest output the current or given revision of the project manifest
165 merge merge another revision into working directory
165 merge merge another revision into working directory
166 outgoing show changesets not found in the destination
166 outgoing show changesets not found in the destination
167 paths show aliases for remote repositories
167 paths show aliases for remote repositories
168 phase set or show the current phase name
168 phase set or show the current phase name
169 pull pull changes from the specified source
169 pull pull changes from the specified source
170 push push changes to the specified destination
170 push push changes to the specified destination
171 recover roll back an interrupted transaction
171 recover roll back an interrupted transaction
172 remove remove the specified files on the next commit
172 remove remove the specified files on the next commit
173 rename rename files; equivalent of copy + remove
173 rename rename files; equivalent of copy + remove
174 resolve redo merges or set/view the merge status of files
174 resolve redo merges or set/view the merge status of files
175 revert restore files to their checkout state
175 revert restore files to their checkout state
176 root print the root (top) of the current working directory
176 root print the root (top) of the current working directory
177 serve start stand-alone webserver
177 serve start stand-alone webserver
178 status show changed files in the working directory
178 status show changed files in the working directory
179 summary summarize working directory state
179 summary summarize working directory state
180 tag add one or more tags for the current or given revision
180 tag add one or more tags for the current or given revision
181 tags list repository tags
181 tags list repository tags
182 unbundle apply one or more bundle files
182 unbundle apply one or more bundle files
183 update update working directory (or switch revisions)
183 update update working directory (or switch revisions)
184 verify verify the integrity of the repository
184 verify verify the integrity of the repository
185 version output version and copyright information
185 version output version and copyright information
186
186
187 additional help topics:
187 additional help topics:
188
188
189 bundlespec Bundle File Formats
189 bundlespec Bundle File Formats
190 color Colorizing Outputs
190 color Colorizing Outputs
191 config Configuration Files
191 config Configuration Files
192 dates Date Formats
192 dates Date Formats
193 deprecated Deprecated Features
193 deprecated Deprecated Features
194 diffs Diff Formats
194 diffs Diff Formats
195 environment Environment Variables
195 environment Environment Variables
196 extensions Using Additional Features
196 extensions Using Additional Features
197 filesets Specifying File Sets
197 filesets Specifying File Sets
198 flags Command-line flags
198 flags Command-line flags
199 glossary Glossary
199 glossary Glossary
200 hgignore Syntax for Mercurial Ignore Files
200 hgignore Syntax for Mercurial Ignore Files
201 hgweb Configuring hgweb
201 hgweb Configuring hgweb
202 internals Technical implementation topics
202 internals Technical implementation topics
203 merge-tools Merge Tools
203 merge-tools Merge Tools
204 pager Pager Support
204 pager Pager Support
205 patterns File Name Patterns
205 patterns File Name Patterns
206 phases Working with Phases
206 phases Working with Phases
207 revisions Specifying Revisions
207 revisions Specifying Revisions
208 scripting Using Mercurial from scripts and automation
208 scripting Using Mercurial from scripts and automation
209 subrepos Subrepositories
209 subrepos Subrepositories
210 templating Template Usage
210 templating Template Usage
211 urls URL Paths
211 urls URL Paths
212
212
213 Test extension help:
213 Test extension help:
214 $ hg help extensions --config extensions.rebase= --config extensions.children=
214 $ hg help extensions --config extensions.rebase= --config extensions.children=
215 Using Additional Features
215 Using Additional Features
216 """""""""""""""""""""""""
216 """""""""""""""""""""""""
217
217
218 Mercurial has the ability to add new features through the use of
218 Mercurial has the ability to add new features through the use of
219 extensions. Extensions may add new commands, add options to existing
219 extensions. Extensions may add new commands, add options to existing
220 commands, change the default behavior of commands, or implement hooks.
220 commands, change the default behavior of commands, or implement hooks.
221
221
222 To enable the "foo" extension, either shipped with Mercurial or in the
222 To enable the "foo" extension, either shipped with Mercurial or in the
223 Python search path, create an entry for it in your configuration file,
223 Python search path, create an entry for it in your configuration file,
224 like this:
224 like this:
225
225
226 [extensions]
226 [extensions]
227 foo =
227 foo =
228
228
229 You may also specify the full path to an extension:
229 You may also specify the full path to an extension:
230
230
231 [extensions]
231 [extensions]
232 myfeature = ~/.hgext/myfeature.py
232 myfeature = ~/.hgext/myfeature.py
233
233
234 See 'hg help config' for more information on configuration files.
234 See 'hg help config' for more information on configuration files.
235
235
236 Extensions are not loaded by default for a variety of reasons: they can
236 Extensions are not loaded by default for a variety of reasons: they can
237 increase startup overhead; they may be meant for advanced usage only; they
237 increase startup overhead; they may be meant for advanced usage only; they
238 may provide potentially dangerous abilities (such as letting you destroy
238 may provide potentially dangerous abilities (such as letting you destroy
239 or modify history); they might not be ready for prime time; or they may
239 or modify history); they might not be ready for prime time; or they may
240 alter some usual behaviors of stock Mercurial. It is thus up to the user
240 alter some usual behaviors of stock Mercurial. It is thus up to the user
241 to activate extensions as needed.
241 to activate extensions as needed.
242
242
243 To explicitly disable an extension enabled in a configuration file of
243 To explicitly disable an extension enabled in a configuration file of
244 broader scope, prepend its path with !:
244 broader scope, prepend its path with !:
245
245
246 [extensions]
246 [extensions]
247 # disabling extension bar residing in /path/to/extension/bar.py
247 # disabling extension bar residing in /path/to/extension/bar.py
248 bar = !/path/to/extension/bar.py
248 bar = !/path/to/extension/bar.py
249 # ditto, but no path was supplied for extension baz
249 # ditto, but no path was supplied for extension baz
250 baz = !
250 baz = !
251
251
252 enabled extensions:
252 enabled extensions:
253
253
254 children command to display child changesets (DEPRECATED)
254 children command to display child changesets (DEPRECATED)
255 rebase command to move sets of revisions to a different ancestor
255 rebase command to move sets of revisions to a different ancestor
256
256
257 disabled extensions:
257 disabled extensions:
258
258
259 acl hooks for controlling repository access
259 acl hooks for controlling repository access
260 blackbox log repository events to a blackbox for debugging
260 blackbox log repository events to a blackbox for debugging
261 bugzilla hooks for integrating with the Bugzilla bug tracker
261 bugzilla hooks for integrating with the Bugzilla bug tracker
262 censor erase file content at a given revision
262 censor erase file content at a given revision
263 churn command to display statistics about repository history
263 churn command to display statistics about repository history
264 clonebundles advertise pre-generated bundles to seed clones
264 clonebundles advertise pre-generated bundles to seed clones
265 convert import revisions from foreign VCS repositories into
265 convert import revisions from foreign VCS repositories into
266 Mercurial
266 Mercurial
267 eol automatically manage newlines in repository files
267 eol automatically manage newlines in repository files
268 extdiff command to allow external programs to compare revisions
268 extdiff command to allow external programs to compare revisions
269 factotum http authentication with factotum
269 factotum http authentication with factotum
270 githelp try mapping git commands to Mercurial commands
270 githelp try mapping git commands to Mercurial commands
271 gpg commands to sign and verify changesets
271 gpg commands to sign and verify changesets
272 hgk browse the repository in a graphical way
272 hgk browse the repository in a graphical way
273 highlight syntax highlighting for hgweb (requires Pygments)
273 highlight syntax highlighting for hgweb (requires Pygments)
274 histedit interactive history editing
274 histedit interactive history editing
275 keyword expand keywords in tracked files
275 keyword expand keywords in tracked files
276 largefiles track large binary files
276 largefiles track large binary files
277 mq manage a stack of patches
277 mq manage a stack of patches
278 notify hooks for sending email push notifications
278 notify hooks for sending email push notifications
279 patchbomb command to send changesets as (a series of) patch emails
279 patchbomb command to send changesets as (a series of) patch emails
280 purge command to delete untracked files from the working
280 purge command to delete untracked files from the working
281 directory
281 directory
282 relink recreates hardlinks between repository clones
282 relink recreates hardlinks between repository clones
283 schemes extend schemes with shortcuts to repository swarms
283 schemes extend schemes with shortcuts to repository swarms
284 share share a common history between several working directories
284 share share a common history between several working directories
285 shelve save and restore changes to the working directory
285 shelve save and restore changes to the working directory
286 strip strip changesets and their descendants from history
286 strip strip changesets and their descendants from history
287 transplant command to transplant changesets from another branch
287 transplant command to transplant changesets from another branch
288 win32mbcs allow the use of MBCS paths with problematic encodings
288 win32mbcs allow the use of MBCS paths with problematic encodings
289 zeroconf discover and advertise repositories on the local network
289 zeroconf discover and advertise repositories on the local network
290
290
291 #endif
291 #endif
292
292
293 Verify that deprecated extensions are included if --verbose:
293 Verify that deprecated extensions are included if --verbose:
294
294
295 $ hg -v help extensions | grep children
295 $ hg -v help extensions | grep children
296 children command to display child changesets (DEPRECATED)
296 children command to display child changesets (DEPRECATED)
297
297
298 Verify that extension keywords appear in help templates
298 Verify that extension keywords appear in help templates
299
299
300 $ hg help --config extensions.transplant= templating|grep transplant > /dev/null
300 $ hg help --config extensions.transplant= templating|grep transplant > /dev/null
301
301
302 Test short command list with verbose option
302 Test short command list with verbose option
303
303
304 $ hg -v help shortlist
304 $ hg -v help shortlist
305 Mercurial Distributed SCM
305 Mercurial Distributed SCM
306
306
307 basic commands:
307 basic commands:
308
308
309 add add the specified files on the next commit
309 add add the specified files on the next commit
310 annotate, blame
310 annotate, blame
311 show changeset information by line for each file
311 show changeset information by line for each file
312 clone make a copy of an existing repository
312 clone make a copy of an existing repository
313 commit, ci commit the specified files or all outstanding changes
313 commit, ci commit the specified files or all outstanding changes
314 diff diff repository (or selected files)
314 diff diff repository (or selected files)
315 export dump the header and diffs for one or more changesets
315 export dump the header and diffs for one or more changesets
316 forget forget the specified files on the next commit
316 forget forget the specified files on the next commit
317 init create a new repository in the given directory
317 init create a new repository in the given directory
318 log, history show revision history of entire repository or files
318 log, history show revision history of entire repository or files
319 merge merge another revision into working directory
319 merge merge another revision into working directory
320 pull pull changes from the specified source
320 pull pull changes from the specified source
321 push push changes to the specified destination
321 push push changes to the specified destination
322 remove, rm remove the specified files on the next commit
322 remove, rm remove the specified files on the next commit
323 serve start stand-alone webserver
323 serve start stand-alone webserver
324 status, st show changed files in the working directory
324 status, st show changed files in the working directory
325 summary, sum summarize working directory state
325 summary, sum summarize working directory state
326 update, up, checkout, co
326 update, up, checkout, co
327 update working directory (or switch revisions)
327 update working directory (or switch revisions)
328
328
329 global options ([+] can be repeated):
329 global options ([+] can be repeated):
330
330
331 -R --repository REPO repository root directory or name of overlay bundle
331 -R --repository REPO repository root directory or name of overlay bundle
332 file
332 file
333 --cwd DIR change working directory
333 --cwd DIR change working directory
334 -y --noninteractive do not prompt, automatically pick the first choice for
334 -y --noninteractive do not prompt, automatically pick the first choice for
335 all prompts
335 all prompts
336 -q --quiet suppress output
336 -q --quiet suppress output
337 -v --verbose enable additional output
337 -v --verbose enable additional output
338 --color TYPE when to colorize (boolean, always, auto, never, or
338 --color TYPE when to colorize (boolean, always, auto, never, or
339 debug)
339 debug)
340 --config CONFIG [+] set/override config option (use 'section.name=value')
340 --config CONFIG [+] set/override config option (use 'section.name=value')
341 --debug enable debugging output
341 --debug enable debugging output
342 --debugger start debugger
342 --debugger start debugger
343 --encoding ENCODE set the charset encoding (default: ascii)
343 --encoding ENCODE set the charset encoding (default: ascii)
344 --encodingmode MODE set the charset encoding mode (default: strict)
344 --encodingmode MODE set the charset encoding mode (default: strict)
345 --traceback always print a traceback on exception
345 --traceback always print a traceback on exception
346 --time time how long the command takes
346 --time time how long the command takes
347 --profile print command execution profile
347 --profile print command execution profile
348 --version output version information and exit
348 --version output version information and exit
349 -h --help display help and exit
349 -h --help display help and exit
350 --hidden consider hidden changesets
350 --hidden consider hidden changesets
351 --pager TYPE when to paginate (boolean, always, auto, or never)
351 --pager TYPE when to paginate (boolean, always, auto, or never)
352 (default: auto)
352 (default: auto)
353
353
354 (use 'hg help' for the full list of commands)
354 (use 'hg help' for the full list of commands)
355
355
356 $ hg add -h
356 $ hg add -h
357 hg add [OPTION]... [FILE]...
357 hg add [OPTION]... [FILE]...
358
358
359 add the specified files on the next commit
359 add the specified files on the next commit
360
360
361 Schedule files to be version controlled and added to the repository.
361 Schedule files to be version controlled and added to the repository.
362
362
363 The files will be added to the repository at the next commit. To undo an
363 The files will be added to the repository at the next commit. To undo an
364 add before that, see 'hg forget'.
364 add before that, see 'hg forget'.
365
365
366 If no names are given, add all files to the repository (except files
366 If no names are given, add all files to the repository (except files
367 matching ".hgignore").
367 matching ".hgignore").
368
368
369 Returns 0 if all files are successfully added.
369 Returns 0 if all files are successfully added.
370
370
371 options ([+] can be repeated):
371 options ([+] can be repeated):
372
372
373 -I --include PATTERN [+] include names matching the given patterns
373 -I --include PATTERN [+] include names matching the given patterns
374 -X --exclude PATTERN [+] exclude names matching the given patterns
374 -X --exclude PATTERN [+] exclude names matching the given patterns
375 -S --subrepos recurse into subrepositories
375 -S --subrepos recurse into subrepositories
376 -n --dry-run do not perform actions, just print output
376 -n --dry-run do not perform actions, just print output
377
377
378 (some details hidden, use --verbose to show complete help)
378 (some details hidden, use --verbose to show complete help)
379
379
380 Verbose help for add
380 Verbose help for add
381
381
382 $ hg add -hv
382 $ hg add -hv
383 hg add [OPTION]... [FILE]...
383 hg add [OPTION]... [FILE]...
384
384
385 add the specified files on the next commit
385 add the specified files on the next commit
386
386
387 Schedule files to be version controlled and added to the repository.
387 Schedule files to be version controlled and added to the repository.
388
388
389 The files will be added to the repository at the next commit. To undo an
389 The files will be added to the repository at the next commit. To undo an
390 add before that, see 'hg forget'.
390 add before that, see 'hg forget'.
391
391
392 If no names are given, add all files to the repository (except files
392 If no names are given, add all files to the repository (except files
393 matching ".hgignore").
393 matching ".hgignore").
394
394
395 Examples:
395 Examples:
396
396
397 - New (unknown) files are added automatically by 'hg add':
397 - New (unknown) files are added automatically by 'hg add':
398
398
399 $ ls
399 $ ls
400 foo.c
400 foo.c
401 $ hg status
401 $ hg status
402 ? foo.c
402 ? foo.c
403 $ hg add
403 $ hg add
404 adding foo.c
404 adding foo.c
405 $ hg status
405 $ hg status
406 A foo.c
406 A foo.c
407
407
408 - Specific files to be added can be specified:
408 - Specific files to be added can be specified:
409
409
410 $ ls
410 $ ls
411 bar.c foo.c
411 bar.c foo.c
412 $ hg status
412 $ hg status
413 ? bar.c
413 ? bar.c
414 ? foo.c
414 ? foo.c
415 $ hg add bar.c
415 $ hg add bar.c
416 $ hg status
416 $ hg status
417 A bar.c
417 A bar.c
418 ? foo.c
418 ? foo.c
419
419
420 Returns 0 if all files are successfully added.
420 Returns 0 if all files are successfully added.
421
421
422 options ([+] can be repeated):
422 options ([+] can be repeated):
423
423
424 -I --include PATTERN [+] include names matching the given patterns
424 -I --include PATTERN [+] include names matching the given patterns
425 -X --exclude PATTERN [+] exclude names matching the given patterns
425 -X --exclude PATTERN [+] exclude names matching the given patterns
426 -S --subrepos recurse into subrepositories
426 -S --subrepos recurse into subrepositories
427 -n --dry-run do not perform actions, just print output
427 -n --dry-run do not perform actions, just print output
428
428
429 global options ([+] can be repeated):
429 global options ([+] can be repeated):
430
430
431 -R --repository REPO repository root directory or name of overlay bundle
431 -R --repository REPO repository root directory or name of overlay bundle
432 file
432 file
433 --cwd DIR change working directory
433 --cwd DIR change working directory
434 -y --noninteractive do not prompt, automatically pick the first choice for
434 -y --noninteractive do not prompt, automatically pick the first choice for
435 all prompts
435 all prompts
436 -q --quiet suppress output
436 -q --quiet suppress output
437 -v --verbose enable additional output
437 -v --verbose enable additional output
438 --color TYPE when to colorize (boolean, always, auto, never, or
438 --color TYPE when to colorize (boolean, always, auto, never, or
439 debug)
439 debug)
440 --config CONFIG [+] set/override config option (use 'section.name=value')
440 --config CONFIG [+] set/override config option (use 'section.name=value')
441 --debug enable debugging output
441 --debug enable debugging output
442 --debugger start debugger
442 --debugger start debugger
443 --encoding ENCODE set the charset encoding (default: ascii)
443 --encoding ENCODE set the charset encoding (default: ascii)
444 --encodingmode MODE set the charset encoding mode (default: strict)
444 --encodingmode MODE set the charset encoding mode (default: strict)
445 --traceback always print a traceback on exception
445 --traceback always print a traceback on exception
446 --time time how long the command takes
446 --time time how long the command takes
447 --profile print command execution profile
447 --profile print command execution profile
448 --version output version information and exit
448 --version output version information and exit
449 -h --help display help and exit
449 -h --help display help and exit
450 --hidden consider hidden changesets
450 --hidden consider hidden changesets
451 --pager TYPE when to paginate (boolean, always, auto, or never)
451 --pager TYPE when to paginate (boolean, always, auto, or never)
452 (default: auto)
452 (default: auto)
453
453
454 Test the textwidth config option
454 Test the textwidth config option
455
455
456 $ hg root -h --config ui.textwidth=50
456 $ hg root -h --config ui.textwidth=50
457 hg root
457 hg root
458
458
459 print the root (top) of the current working
459 print the root (top) of the current working
460 directory
460 directory
461
461
462 Print the root directory of the current
462 Print the root directory of the current
463 repository.
463 repository.
464
464
465 Returns 0 on success.
465 Returns 0 on success.
466
466
467 (some details hidden, use --verbose to show
467 (some details hidden, use --verbose to show
468 complete help)
468 complete help)
469
469
470 Test help option with version option
470 Test help option with version option
471
471
472 $ hg add -h --version
472 $ hg add -h --version
473 Mercurial Distributed SCM (version *) (glob)
473 Mercurial Distributed SCM (version *) (glob)
474 (see https://mercurial-scm.org for more information)
474 (see https://mercurial-scm.org for more information)
475
475
476 Copyright (C) 2005-* Matt Mackall and others (glob)
476 Copyright (C) 2005-* Matt Mackall and others (glob)
477 This is free software; see the source for copying conditions. There is NO
477 This is free software; see the source for copying conditions. There is NO
478 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
478 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
479
479
480 $ hg add --skjdfks
480 $ hg add --skjdfks
481 hg add: option --skjdfks not recognized
481 hg add: option --skjdfks not recognized
482 hg add [OPTION]... [FILE]...
482 hg add [OPTION]... [FILE]...
483
483
484 add the specified files on the next commit
484 add the specified files on the next commit
485
485
486 options ([+] can be repeated):
486 options ([+] can be repeated):
487
487
488 -I --include PATTERN [+] include names matching the given patterns
488 -I --include PATTERN [+] include names matching the given patterns
489 -X --exclude PATTERN [+] exclude names matching the given patterns
489 -X --exclude PATTERN [+] exclude names matching the given patterns
490 -S --subrepos recurse into subrepositories
490 -S --subrepos recurse into subrepositories
491 -n --dry-run do not perform actions, just print output
491 -n --dry-run do not perform actions, just print output
492
492
493 (use 'hg add -h' to show more help)
493 (use 'hg add -h' to show more help)
494 [255]
494 [255]
495
495
496 Test ambiguous command help
496 Test ambiguous command help
497
497
498 $ hg help ad
498 $ hg help ad
499 list of commands:
499 list of commands:
500
500
501 add add the specified files on the next commit
501 add add the specified files on the next commit
502 addremove add all new files, delete all missing files
502 addremove add all new files, delete all missing files
503
503
504 (use 'hg help -v ad' to show built-in aliases and global options)
504 (use 'hg help -v ad' to show built-in aliases and global options)
505
505
506 Test command without options
506 Test command without options
507
507
508 $ hg help verify
508 $ hg help verify
509 hg verify
509 hg verify
510
510
511 verify the integrity of the repository
511 verify the integrity of the repository
512
512
513 Verify the integrity of the current repository.
513 Verify the integrity of the current repository.
514
514
515 This will perform an extensive check of the repository's integrity,
515 This will perform an extensive check of the repository's integrity,
516 validating the hashes and checksums of each entry in the changelog,
516 validating the hashes and checksums of each entry in the changelog,
517 manifest, and tracked files, as well as the integrity of their crosslinks
517 manifest, and tracked files, as well as the integrity of their crosslinks
518 and indices.
518 and indices.
519
519
520 Please see https://mercurial-scm.org/wiki/RepositoryCorruption for more
520 Please see https://mercurial-scm.org/wiki/RepositoryCorruption for more
521 information about recovery from corruption of the repository.
521 information about recovery from corruption of the repository.
522
522
523 Returns 0 on success, 1 if errors are encountered.
523 Returns 0 on success, 1 if errors are encountered.
524
524
525 (some details hidden, use --verbose to show complete help)
525 (some details hidden, use --verbose to show complete help)
526
526
527 $ hg help diff
527 $ hg help diff
528 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
528 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
529
529
530 diff repository (or selected files)
530 diff repository (or selected files)
531
531
532 Show differences between revisions for the specified files.
532 Show differences between revisions for the specified files.
533
533
534 Differences between files are shown using the unified diff format.
534 Differences between files are shown using the unified diff format.
535
535
536 Note:
536 Note:
537 'hg diff' may generate unexpected results for merges, as it will
537 'hg diff' may generate unexpected results for merges, as it will
538 default to comparing against the working directory's first parent
538 default to comparing against the working directory's first parent
539 changeset if no revisions are specified.
539 changeset if no revisions are specified.
540
540
541 When two revision arguments are given, then changes are shown between
541 When two revision arguments are given, then changes are shown between
542 those revisions. If only one revision is specified then that revision is
542 those revisions. If only one revision is specified then that revision is
543 compared to the working directory, and, when no revisions are specified,
543 compared to the working directory, and, when no revisions are specified,
544 the working directory files are compared to its first parent.
544 the working directory files are compared to its first parent.
545
545
546 Alternatively you can specify -c/--change with a revision to see the
546 Alternatively you can specify -c/--change with a revision to see the
547 changes in that changeset relative to its first parent.
547 changes in that changeset relative to its first parent.
548
548
549 Without the -a/--text option, diff will avoid generating diffs of files it
549 Without the -a/--text option, diff will avoid generating diffs of files it
550 detects as binary. With -a, diff will generate a diff anyway, probably
550 detects as binary. With -a, diff will generate a diff anyway, probably
551 with undesirable results.
551 with undesirable results.
552
552
553 Use the -g/--git option to generate diffs in the git extended diff format.
553 Use the -g/--git option to generate diffs in the git extended diff format.
554 For more information, read 'hg help diffs'.
554 For more information, read 'hg help diffs'.
555
555
556 Returns 0 on success.
556 Returns 0 on success.
557
557
558 options ([+] can be repeated):
558 options ([+] can be repeated):
559
559
560 -r --rev REV [+] revision
560 -r --rev REV [+] revision
561 -c --change REV change made by revision
561 -c --change REV change made by revision
562 -a --text treat all files as text
562 -a --text treat all files as text
563 -g --git use git extended diff format
563 -g --git use git extended diff format
564 --binary generate binary diffs in git mode (default)
564 --binary generate binary diffs in git mode (default)
565 --nodates omit dates from diff headers
565 --nodates omit dates from diff headers
566 --noprefix omit a/ and b/ prefixes from filenames
566 --noprefix omit a/ and b/ prefixes from filenames
567 -p --show-function show which function each change is in
567 -p --show-function show which function each change is in
568 --reverse produce a diff that undoes the changes
568 --reverse produce a diff that undoes the changes
569 -w --ignore-all-space ignore white space when comparing lines
569 -w --ignore-all-space ignore white space when comparing lines
570 -b --ignore-space-change ignore changes in the amount of white space
570 -b --ignore-space-change ignore changes in the amount of white space
571 -B --ignore-blank-lines ignore changes whose lines are all blank
571 -B --ignore-blank-lines ignore changes whose lines are all blank
572 -Z --ignore-space-at-eol ignore changes in whitespace at EOL
572 -Z --ignore-space-at-eol ignore changes in whitespace at EOL
573 -U --unified NUM number of lines of context to show
573 -U --unified NUM number of lines of context to show
574 --stat output diffstat-style summary of changes
574 --stat output diffstat-style summary of changes
575 --root DIR produce diffs relative to subdirectory
575 --root DIR produce diffs relative to subdirectory
576 -I --include PATTERN [+] include names matching the given patterns
576 -I --include PATTERN [+] include names matching the given patterns
577 -X --exclude PATTERN [+] exclude names matching the given patterns
577 -X --exclude PATTERN [+] exclude names matching the given patterns
578 -S --subrepos recurse into subrepositories
578 -S --subrepos recurse into subrepositories
579
579
580 (some details hidden, use --verbose to show complete help)
580 (some details hidden, use --verbose to show complete help)
581
581
582 $ hg help status
582 $ hg help status
583 hg status [OPTION]... [FILE]...
583 hg status [OPTION]... [FILE]...
584
584
585 aliases: st
585 aliases: st
586
586
587 show changed files in the working directory
587 show changed files in the working directory
588
588
589 Show status of files in the repository. If names are given, only files
589 Show status of files in the repository. If names are given, only files
590 that match are shown. Files that are clean or ignored or the source of a
590 that match are shown. Files that are clean or ignored or the source of a
591 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
591 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
592 -C/--copies or -A/--all are given. Unless options described with "show
592 -C/--copies or -A/--all are given. Unless options described with "show
593 only ..." are given, the options -mardu are used.
593 only ..." are given, the options -mardu are used.
594
594
595 Option -q/--quiet hides untracked (unknown and ignored) files unless
595 Option -q/--quiet hides untracked (unknown and ignored) files unless
596 explicitly requested with -u/--unknown or -i/--ignored.
596 explicitly requested with -u/--unknown or -i/--ignored.
597
597
598 Note:
598 Note:
599 'hg status' may appear to disagree with diff if permissions have
599 'hg status' may appear to disagree with diff if permissions have
600 changed or a merge has occurred. The standard diff format does not
600 changed or a merge has occurred. The standard diff format does not
601 report permission changes and diff only reports changes relative to one
601 report permission changes and diff only reports changes relative to one
602 merge parent.
602 merge parent.
603
603
604 If one revision is given, it is used as the base revision. If two
604 If one revision is given, it is used as the base revision. If two
605 revisions are given, the differences between them are shown. The --change
605 revisions are given, the differences between them are shown. The --change
606 option can also be used as a shortcut to list the changed files of a
606 option can also be used as a shortcut to list the changed files of a
607 revision from its first parent.
607 revision from its first parent.
608
608
609 The codes used to show the status of files are:
609 The codes used to show the status of files are:
610
610
611 M = modified
611 M = modified
612 A = added
612 A = added
613 R = removed
613 R = removed
614 C = clean
614 C = clean
615 ! = missing (deleted by non-hg command, but still tracked)
615 ! = missing (deleted by non-hg command, but still tracked)
616 ? = not tracked
616 ? = not tracked
617 I = ignored
617 I = ignored
618 = origin of the previous file (with --copies)
618 = origin of the previous file (with --copies)
619
619
620 Returns 0 on success.
620 Returns 0 on success.
621
621
622 options ([+] can be repeated):
622 options ([+] can be repeated):
623
623
624 -A --all show status of all files
624 -A --all show status of all files
625 -m --modified show only modified files
625 -m --modified show only modified files
626 -a --added show only added files
626 -a --added show only added files
627 -r --removed show only removed files
627 -r --removed show only removed files
628 -d --deleted show only deleted (but tracked) files
628 -d --deleted show only deleted (but tracked) files
629 -c --clean show only files without changes
629 -c --clean show only files without changes
630 -u --unknown show only unknown (not tracked) files
630 -u --unknown show only unknown (not tracked) files
631 -i --ignored show only ignored files
631 -i --ignored show only ignored files
632 -n --no-status hide status prefix
632 -n --no-status hide status prefix
633 -C --copies show source of copied files
633 -C --copies show source of copied files
634 -0 --print0 end filenames with NUL, for use with xargs
634 -0 --print0 end filenames with NUL, for use with xargs
635 --rev REV [+] show difference from revision
635 --rev REV [+] show difference from revision
636 --change REV list the changed files of a revision
636 --change REV list the changed files of a revision
637 -I --include PATTERN [+] include names matching the given patterns
637 -I --include PATTERN [+] include names matching the given patterns
638 -X --exclude PATTERN [+] exclude names matching the given patterns
638 -X --exclude PATTERN [+] exclude names matching the given patterns
639 -S --subrepos recurse into subrepositories
639 -S --subrepos recurse into subrepositories
640
640
641 (some details hidden, use --verbose to show complete help)
641 (some details hidden, use --verbose to show complete help)
642
642
643 $ hg -q help status
643 $ hg -q help status
644 hg status [OPTION]... [FILE]...
644 hg status [OPTION]... [FILE]...
645
645
646 show changed files in the working directory
646 show changed files in the working directory
647
647
648 $ hg help foo
648 $ hg help foo
649 abort: no such help topic: foo
649 abort: no such help topic: foo
650 (try 'hg help --keyword foo')
650 (try 'hg help --keyword foo')
651 [255]
651 [255]
652
652
653 $ hg skjdfks
653 $ hg skjdfks
654 hg: unknown command 'skjdfks'
654 hg: unknown command 'skjdfks'
655 (use 'hg help' for a list of commands)
655 (use 'hg help' for a list of commands)
656 [255]
656 [255]
657
657
658 Typoed command gives suggestion
658 Typoed command gives suggestion
659 $ hg puls
659 $ hg puls
660 hg: unknown command 'puls'
660 hg: unknown command 'puls'
661 (did you mean one of pull, push?)
661 (did you mean one of pull, push?)
662 [255]
662 [255]
663
663
664 Not enabled extension gets suggested
664 Not enabled extension gets suggested
665
665
666 $ hg rebase
666 $ hg rebase
667 hg: unknown command 'rebase'
667 hg: unknown command 'rebase'
668 'rebase' is provided by the following extension:
668 'rebase' is provided by the following extension:
669
669
670 rebase command to move sets of revisions to a different ancestor
670 rebase command to move sets of revisions to a different ancestor
671
671
672 (use 'hg help extensions' for information on enabling extensions)
672 (use 'hg help extensions' for information on enabling extensions)
673 [255]
673 [255]
674
674
675 Disabled extension gets suggested
675 Disabled extension gets suggested
676 $ hg --config extensions.rebase=! rebase
676 $ hg --config extensions.rebase=! rebase
677 hg: unknown command 'rebase'
677 hg: unknown command 'rebase'
678 'rebase' is provided by the following extension:
678 'rebase' is provided by the following extension:
679
679
680 rebase command to move sets of revisions to a different ancestor
680 rebase command to move sets of revisions to a different ancestor
681
681
682 (use 'hg help extensions' for information on enabling extensions)
682 (use 'hg help extensions' for information on enabling extensions)
683 [255]
683 [255]
684
684
685 Make sure that we don't run afoul of the help system thinking that
685 Make sure that we don't run afoul of the help system thinking that
686 this is a section and erroring out weirdly.
686 this is a section and erroring out weirdly.
687
687
688 $ hg .log
688 $ hg .log
689 hg: unknown command '.log'
689 hg: unknown command '.log'
690 (did you mean log?)
690 (did you mean log?)
691 [255]
691 [255]
692
692
693 $ hg log.
693 $ hg log.
694 hg: unknown command 'log.'
694 hg: unknown command 'log.'
695 (did you mean log?)
695 (did you mean log?)
696 [255]
696 [255]
697 $ hg pu.lh
697 $ hg pu.lh
698 hg: unknown command 'pu.lh'
698 hg: unknown command 'pu.lh'
699 (did you mean one of pull, push?)
699 (did you mean one of pull, push?)
700 [255]
700 [255]
701
701
702 $ cat > helpext.py <<EOF
702 $ cat > helpext.py <<EOF
703 > import os
703 > import os
704 > from mercurial import commands, fancyopts, registrar
704 > from mercurial import commands, fancyopts, registrar
705 >
705 >
706 > def func(arg):
706 > def func(arg):
707 > return '%sfoo' % arg
707 > return '%sfoo' % arg
708 > class customopt(fancyopts.customopt):
708 > class customopt(fancyopts.customopt):
709 > def newstate(self, oldstate, newparam, abort):
709 > def newstate(self, oldstate, newparam, abort):
710 > return '%sbar' % oldstate
710 > return '%sbar' % oldstate
711 > cmdtable = {}
711 > cmdtable = {}
712 > command = registrar.command(cmdtable)
712 > command = registrar.command(cmdtable)
713 >
713 >
714 > @command(b'nohelp',
714 > @command(b'nohelp',
715 > [(b'', b'longdesc', 3, b'x'*67),
715 > [(b'', b'longdesc', 3, b'x'*67),
716 > (b'n', b'', None, b'normal desc'),
716 > (b'n', b'', None, b'normal desc'),
717 > (b'', b'newline', b'', b'line1\nline2'),
717 > (b'', b'newline', b'', b'line1\nline2'),
718 > (b'', b'callableopt', func, b'adds foo'),
718 > (b'', b'callableopt', func, b'adds foo'),
719 > (b'', b'customopt', customopt(''), b'adds bar'),
719 > (b'', b'customopt', customopt(''), b'adds bar'),
720 > (b'', b'customopt-withdefault', customopt('foo'), b'adds bar')],
720 > (b'', b'customopt-withdefault', customopt('foo'), b'adds bar')],
721 > b'hg nohelp',
721 > b'hg nohelp',
722 > norepo=True)
722 > norepo=True)
723 > @command(b'debugoptADV', [(b'', b'aopt', None, b'option is (ADVANCED)')])
723 > @command(b'debugoptADV', [(b'', b'aopt', None, b'option is (ADVANCED)')])
724 > @command(b'debugoptDEP', [(b'', b'dopt', None, b'option is (DEPRECATED)')])
724 > @command(b'debugoptDEP', [(b'', b'dopt', None, b'option is (DEPRECATED)')])
725 > @command(b'debugoptEXP', [(b'', b'eopt', None, b'option is (EXPERIMENTAL)')])
725 > @command(b'debugoptEXP', [(b'', b'eopt', None, b'option is (EXPERIMENTAL)')])
726 > def nohelp(ui, *args, **kwargs):
726 > def nohelp(ui, *args, **kwargs):
727 > pass
727 > pass
728 >
728 >
729 > def uisetup(ui):
729 > def uisetup(ui):
730 > ui.setconfig(b'alias', b'shellalias', b'!echo hi', b'helpext')
730 > ui.setconfig(b'alias', b'shellalias', b'!echo hi', b'helpext')
731 > ui.setconfig(b'alias', b'hgalias', b'summary', b'helpext')
731 > ui.setconfig(b'alias', b'hgalias', b'summary', b'helpext')
732 >
732 >
733 > EOF
733 > EOF
734 $ echo '[extensions]' >> $HGRCPATH
734 $ echo '[extensions]' >> $HGRCPATH
735 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
735 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
736
736
737 Test for aliases
737 Test for aliases
738
738
739 $ hg help hgalias
739 $ hg help hgalias
740 hg hgalias [--remote]
740 hg hgalias [--remote]
741
741
742 alias for: hg summary
742 alias for: hg summary
743
743
744 summarize working directory state
744 summarize working directory state
745
745
746 This generates a brief summary of the working directory state, including
746 This generates a brief summary of the working directory state, including
747 parents, branch, commit status, phase and available updates.
747 parents, branch, commit status, phase and available updates.
748
748
749 With the --remote option, this will check the default paths for incoming
749 With the --remote option, this will check the default paths for incoming
750 and outgoing changes. This can be time-consuming.
750 and outgoing changes. This can be time-consuming.
751
751
752 Returns 0 on success.
752 Returns 0 on success.
753
753
754 defined by: helpext
754 defined by: helpext
755
755
756 options:
756 options:
757
757
758 --remote check for push and pull
758 --remote check for push and pull
759
759
760 (some details hidden, use --verbose to show complete help)
760 (some details hidden, use --verbose to show complete help)
761
761
762 $ hg help shellalias
762 $ hg help shellalias
763 hg shellalias
763 hg shellalias
764
764
765 shell alias for: echo hi
765 shell alias for: echo hi
766
766
767 (no help text available)
767 (no help text available)
768
768
769 defined by: helpext
769 defined by: helpext
770
770
771 (some details hidden, use --verbose to show complete help)
771 (some details hidden, use --verbose to show complete help)
772
772
773 Test command with no help text
773 Test command with no help text
774
774
775 $ hg help nohelp
775 $ hg help nohelp
776 hg nohelp
776 hg nohelp
777
777
778 (no help text available)
778 (no help text available)
779
779
780 options:
780 options:
781
781
782 --longdesc VALUE
782 --longdesc VALUE
783 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
783 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
784 xxxxxxxxxxxxxxxxxxxxxxx (default: 3)
784 xxxxxxxxxxxxxxxxxxxxxxx (default: 3)
785 -n -- normal desc
785 -n -- normal desc
786 --newline VALUE line1 line2
786 --newline VALUE line1 line2
787 --callableopt VALUE adds foo
787 --callableopt VALUE adds foo
788 --customopt VALUE adds bar
788 --customopt VALUE adds bar
789 --customopt-withdefault VALUE adds bar (default: foo)
789 --customopt-withdefault VALUE adds bar (default: foo)
790
790
791 (some details hidden, use --verbose to show complete help)
791 (some details hidden, use --verbose to show complete help)
792
792
793 $ hg help -k nohelp
793 $ hg help -k nohelp
794 Commands:
794 Commands:
795
795
796 nohelp hg nohelp
796 nohelp hg nohelp
797
797
798 Extension Commands:
798 Extension Commands:
799
799
800 nohelp (no help text available)
800 nohelp (no help text available)
801
801
802 Test that default list of commands omits extension commands
802 Test that default list of commands omits extension commands
803
803
804 #if no-extraextensions
804 #if no-extraextensions
805
805
806 $ hg help
806 $ hg help
807 Mercurial Distributed SCM
807 Mercurial Distributed SCM
808
808
809 list of commands:
809 list of commands:
810
810
811 add add the specified files on the next commit
811 add add the specified files on the next commit
812 addremove add all new files, delete all missing files
812 addremove add all new files, delete all missing files
813 annotate show changeset information by line for each file
813 annotate show changeset information by line for each file
814 archive create an unversioned archive of a repository revision
814 archive create an unversioned archive of a repository revision
815 backout reverse effect of earlier changeset
815 backout reverse effect of earlier changeset
816 bisect subdivision search of changesets
816 bisect subdivision search of changesets
817 bookmarks create a new bookmark or list existing bookmarks
817 bookmarks create a new bookmark or list existing bookmarks
818 branch set or show the current branch name
818 branch set or show the current branch name
819 branches list repository named branches
819 branches list repository named branches
820 bundle create a bundle file
820 bundle create a bundle file
821 cat output the current or given revision of files
821 cat output the current or given revision of files
822 clone make a copy of an existing repository
822 clone make a copy of an existing repository
823 commit commit the specified files or all outstanding changes
823 commit commit the specified files or all outstanding changes
824 config show combined config settings from all hgrc files
824 config show combined config settings from all hgrc files
825 copy mark files as copied for the next commit
825 copy mark files as copied for the next commit
826 diff diff repository (or selected files)
826 diff diff repository (or selected files)
827 export dump the header and diffs for one or more changesets
827 export dump the header and diffs for one or more changesets
828 files list tracked files
828 files list tracked files
829 forget forget the specified files on the next commit
829 forget forget the specified files on the next commit
830 graft copy changes from other branches onto the current branch
830 graft copy changes from other branches onto the current branch
831 grep search revision history for a pattern in specified files
831 grep search revision history for a pattern in specified files
832 heads show branch heads
832 heads show branch heads
833 help show help for a given topic or a help overview
833 help show help for a given topic or a help overview
834 identify identify the working directory or specified revision
834 identify identify the working directory or specified revision
835 import import an ordered set of patches
835 import import an ordered set of patches
836 incoming show new changesets found in source
836 incoming show new changesets found in source
837 init create a new repository in the given directory
837 init create a new repository in the given directory
838 log show revision history of entire repository or files
838 log show revision history of entire repository or files
839 manifest output the current or given revision of the project manifest
839 manifest output the current or given revision of the project manifest
840 merge merge another revision into working directory
840 merge merge another revision into working directory
841 outgoing show changesets not found in the destination
841 outgoing show changesets not found in the destination
842 paths show aliases for remote repositories
842 paths show aliases for remote repositories
843 phase set or show the current phase name
843 phase set or show the current phase name
844 pull pull changes from the specified source
844 pull pull changes from the specified source
845 push push changes to the specified destination
845 push push changes to the specified destination
846 recover roll back an interrupted transaction
846 recover roll back an interrupted transaction
847 remove remove the specified files on the next commit
847 remove remove the specified files on the next commit
848 rename rename files; equivalent of copy + remove
848 rename rename files; equivalent of copy + remove
849 resolve redo merges or set/view the merge status of files
849 resolve redo merges or set/view the merge status of files
850 revert restore files to their checkout state
850 revert restore files to their checkout state
851 root print the root (top) of the current working directory
851 root print the root (top) of the current working directory
852 serve start stand-alone webserver
852 serve start stand-alone webserver
853 status show changed files in the working directory
853 status show changed files in the working directory
854 summary summarize working directory state
854 summary summarize working directory state
855 tag add one or more tags for the current or given revision
855 tag add one or more tags for the current or given revision
856 tags list repository tags
856 tags list repository tags
857 unbundle apply one or more bundle files
857 unbundle apply one or more bundle files
858 update update working directory (or switch revisions)
858 update update working directory (or switch revisions)
859 verify verify the integrity of the repository
859 verify verify the integrity of the repository
860 version output version and copyright information
860 version output version and copyright information
861
861
862 enabled extensions:
862 enabled extensions:
863
863
864 helpext (no help text available)
864 helpext (no help text available)
865
865
866 additional help topics:
866 additional help topics:
867
867
868 bundlespec Bundle File Formats
868 bundlespec Bundle File Formats
869 color Colorizing Outputs
869 color Colorizing Outputs
870 config Configuration Files
870 config Configuration Files
871 dates Date Formats
871 dates Date Formats
872 deprecated Deprecated Features
872 deprecated Deprecated Features
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 #endif
894 #endif
895
895
896 Test list of internal help commands
896 Test list of internal help commands
897
897
898 $ hg help debug
898 $ hg help debug
899 debug commands (internal and unsupported):
899 debug commands (internal and unsupported):
900
900
901 debugancestor
901 debugancestor
902 find the ancestor revision of two revisions in a given index
902 find the ancestor revision of two revisions in a given index
903 debugapplystreamclonebundle
903 debugapplystreamclonebundle
904 apply a stream clone bundle file
904 apply a stream clone bundle file
905 debugbuilddag
905 debugbuilddag
906 builds a repo with a given DAG from scratch in the current
906 builds a repo with a given DAG from scratch in the current
907 empty repo
907 empty repo
908 debugbundle lists the contents of a bundle
908 debugbundle lists the contents of a bundle
909 debugcapabilities
909 debugcapabilities
910 lists the capabilities of a remote peer
910 lists the capabilities of a remote peer
911 debugcheckstate
911 debugcheckstate
912 validate the correctness of the current dirstate
912 validate the correctness of the current dirstate
913 debugcolor show available color, effects or style
913 debugcolor show available color, effects or style
914 debugcommands
914 debugcommands
915 list all available commands and options
915 list all available commands and options
916 debugcomplete
916 debugcomplete
917 returns the completion list associated with the given command
917 returns the completion list associated with the given command
918 debugcreatestreamclonebundle
918 debugcreatestreamclonebundle
919 create a stream clone bundle file
919 create a stream clone bundle file
920 debugdag format the changelog or an index DAG as a concise textual
920 debugdag format the changelog or an index DAG as a concise textual
921 description
921 description
922 debugdata dump the contents of a data file revision
922 debugdata dump the contents of a data file revision
923 debugdate parse and display a date
923 debugdate parse and display a date
924 debugdeltachain
924 debugdeltachain
925 dump information about delta chains in a revlog
925 dump information about delta chains in a revlog
926 debugdirstate
926 debugdirstate
927 show the contents of the current dirstate
927 show the contents of the current dirstate
928 debugdiscovery
928 debugdiscovery
929 runs the changeset discovery protocol in isolation
929 runs the changeset discovery protocol in isolation
930 debugdownload
930 debugdownload
931 download a resource using Mercurial logic and config
931 download a resource using Mercurial logic and config
932 debugextensions
932 debugextensions
933 show information about active extensions
933 show information about active extensions
934 debugfileset parse and apply a fileset specification
934 debugfileset parse and apply a fileset specification
935 debugformat display format information about the current repository
935 debugformat display format information about the current repository
936 debugfsinfo show information detected about current filesystem
936 debugfsinfo show information detected about current filesystem
937 debuggetbundle
937 debuggetbundle
938 retrieves a bundle from a repo
938 retrieves a bundle from a repo
939 debugignore display the combined ignore pattern and information about
939 debugignore display the combined ignore pattern and information about
940 ignored files
940 ignored files
941 debugindex dump the contents of an index file
941 debugindex dump index data for a storage primitive
942 debugindexdot
942 debugindexdot
943 dump an index DAG as a graphviz dot file
943 dump an index DAG as a graphviz dot file
944 debuginstall test Mercurial installation
944 debuginstall test Mercurial installation
945 debugknown test whether node ids are known to a repo
945 debugknown test whether node ids are known to a repo
946 debuglocks show or modify state of locks
946 debuglocks show or modify state of locks
947 debugmanifestfulltextcache
947 debugmanifestfulltextcache
948 show, clear or amend the contents of the manifest fulltext
948 show, clear or amend the contents of the manifest fulltext
949 cache
949 cache
950 debugmergestate
950 debugmergestate
951 print merge state
951 print merge state
952 debugnamecomplete
952 debugnamecomplete
953 complete "names" - tags, open branch names, bookmark names
953 complete "names" - tags, open branch names, bookmark names
954 debugobsolete
954 debugobsolete
955 create arbitrary obsolete marker
955 create arbitrary obsolete marker
956 debugoptADV (no help text available)
956 debugoptADV (no help text available)
957 debugoptDEP (no help text available)
957 debugoptDEP (no help text available)
958 debugoptEXP (no help text available)
958 debugoptEXP (no help text available)
959 debugpathcomplete
959 debugpathcomplete
960 complete part or all of a tracked path
960 complete part or all of a tracked path
961 debugpeer establish a connection to a peer repository
961 debugpeer establish a connection to a peer repository
962 debugpickmergetool
962 debugpickmergetool
963 examine which merge tool is chosen for specified file
963 examine which merge tool is chosen for specified file
964 debugpushkey access the pushkey key/value protocol
964 debugpushkey access the pushkey key/value protocol
965 debugpvec (no help text available)
965 debugpvec (no help text available)
966 debugrebuilddirstate
966 debugrebuilddirstate
967 rebuild the dirstate as it would look like for the given
967 rebuild the dirstate as it would look like for the given
968 revision
968 revision
969 debugrebuildfncache
969 debugrebuildfncache
970 rebuild the fncache file
970 rebuild the fncache file
971 debugrename dump rename information
971 debugrename dump rename information
972 debugrevlog show data and statistics about a revlog
972 debugrevlog show data and statistics about a revlog
973 debugrevlogindex
974 dump the contents of a revlog index
973 debugrevspec parse and apply a revision specification
975 debugrevspec parse and apply a revision specification
974 debugserve run a server with advanced settings
976 debugserve run a server with advanced settings
975 debugsetparents
977 debugsetparents
976 manually set the parents of the current working directory
978 manually set the parents of the current working directory
977 debugssl test a secure connection to a server
979 debugssl test a secure connection to a server
978 debugsub (no help text available)
980 debugsub (no help text available)
979 debugsuccessorssets
981 debugsuccessorssets
980 show set of successors for revision
982 show set of successors for revision
981 debugtemplate
983 debugtemplate
982 parse and apply a template
984 parse and apply a template
983 debuguigetpass
985 debuguigetpass
984 show prompt to type password
986 show prompt to type password
985 debuguiprompt
987 debuguiprompt
986 show plain prompt
988 show plain prompt
987 debugupdatecaches
989 debugupdatecaches
988 warm all known caches in the repository
990 warm all known caches in the repository
989 debugupgraderepo
991 debugupgraderepo
990 upgrade a repository to use different features
992 upgrade a repository to use different features
991 debugwalk show how files match on given patterns
993 debugwalk show how files match on given patterns
992 debugwhyunstable
994 debugwhyunstable
993 explain instabilities of a changeset
995 explain instabilities of a changeset
994 debugwireargs
996 debugwireargs
995 (no help text available)
997 (no help text available)
996 debugwireproto
998 debugwireproto
997 send wire protocol commands to a server
999 send wire protocol commands to a server
998
1000
999 (use 'hg help -v debug' to show built-in aliases and global options)
1001 (use 'hg help -v debug' to show built-in aliases and global options)
1000
1002
1001 internals topic renders index of available sub-topics
1003 internals topic renders index of available sub-topics
1002
1004
1003 $ hg help internals
1005 $ hg help internals
1004 Technical implementation topics
1006 Technical implementation topics
1005 """""""""""""""""""""""""""""""
1007 """""""""""""""""""""""""""""""
1006
1008
1007 To access a subtopic, use "hg help internals.{subtopic-name}"
1009 To access a subtopic, use "hg help internals.{subtopic-name}"
1008
1010
1009 bundle2 Bundle2
1011 bundle2 Bundle2
1010 bundles Bundles
1012 bundles Bundles
1011 censor Censor
1013 censor Censor
1012 changegroups Changegroups
1014 changegroups Changegroups
1013 config Config Registrar
1015 config Config Registrar
1014 requirements Repository Requirements
1016 requirements Repository Requirements
1015 revlogs Revision Logs
1017 revlogs Revision Logs
1016 wireprotocol Wire Protocol
1018 wireprotocol Wire Protocol
1017
1019
1018 sub-topics can be accessed
1020 sub-topics can be accessed
1019
1021
1020 $ hg help internals.changegroups
1022 $ hg help internals.changegroups
1021 Changegroups
1023 Changegroups
1022 """"""""""""
1024 """"""""""""
1023
1025
1024 Changegroups are representations of repository revlog data, specifically
1026 Changegroups are representations of repository revlog data, specifically
1025 the changelog data, root/flat manifest data, treemanifest data, and
1027 the changelog data, root/flat manifest data, treemanifest data, and
1026 filelogs.
1028 filelogs.
1027
1029
1028 There are 3 versions of changegroups: "1", "2", and "3". From a high-
1030 There are 3 versions of changegroups: "1", "2", and "3". From a high-
1029 level, versions "1" and "2" are almost exactly the same, with the only
1031 level, versions "1" and "2" are almost exactly the same, with the only
1030 difference being an additional item in the *delta header*. Version "3"
1032 difference being an additional item in the *delta header*. Version "3"
1031 adds support for revlog flags in the *delta header* and optionally
1033 adds support for revlog flags in the *delta header* and optionally
1032 exchanging treemanifests (enabled by setting an option on the
1034 exchanging treemanifests (enabled by setting an option on the
1033 "changegroup" part in the bundle2).
1035 "changegroup" part in the bundle2).
1034
1036
1035 Changegroups when not exchanging treemanifests consist of 3 logical
1037 Changegroups when not exchanging treemanifests consist of 3 logical
1036 segments:
1038 segments:
1037
1039
1038 +---------------------------------+
1040 +---------------------------------+
1039 | | | |
1041 | | | |
1040 | changeset | manifest | filelogs |
1042 | changeset | manifest | filelogs |
1041 | | | |
1043 | | | |
1042 | | | |
1044 | | | |
1043 +---------------------------------+
1045 +---------------------------------+
1044
1046
1045 When exchanging treemanifests, there are 4 logical segments:
1047 When exchanging treemanifests, there are 4 logical segments:
1046
1048
1047 +-------------------------------------------------+
1049 +-------------------------------------------------+
1048 | | | | |
1050 | | | | |
1049 | changeset | root | treemanifests | filelogs |
1051 | changeset | root | treemanifests | filelogs |
1050 | | manifest | | |
1052 | | manifest | | |
1051 | | | | |
1053 | | | | |
1052 +-------------------------------------------------+
1054 +-------------------------------------------------+
1053
1055
1054 The principle building block of each segment is a *chunk*. A *chunk* is a
1056 The principle building block of each segment is a *chunk*. A *chunk* is a
1055 framed piece of data:
1057 framed piece of data:
1056
1058
1057 +---------------------------------------+
1059 +---------------------------------------+
1058 | | |
1060 | | |
1059 | length | data |
1061 | length | data |
1060 | (4 bytes) | (<length - 4> bytes) |
1062 | (4 bytes) | (<length - 4> bytes) |
1061 | | |
1063 | | |
1062 +---------------------------------------+
1064 +---------------------------------------+
1063
1065
1064 All integers are big-endian signed integers. Each chunk starts with a
1066 All integers are big-endian signed integers. Each chunk starts with a
1065 32-bit integer indicating the length of the entire chunk (including the
1067 32-bit integer indicating the length of the entire chunk (including the
1066 length field itself).
1068 length field itself).
1067
1069
1068 There is a special case chunk that has a value of 0 for the length
1070 There is a special case chunk that has a value of 0 for the length
1069 ("0x00000000"). We call this an *empty chunk*.
1071 ("0x00000000"). We call this an *empty chunk*.
1070
1072
1071 Delta Groups
1073 Delta Groups
1072 ============
1074 ============
1073
1075
1074 A *delta group* expresses the content of a revlog as a series of deltas,
1076 A *delta group* expresses the content of a revlog as a series of deltas,
1075 or patches against previous revisions.
1077 or patches against previous revisions.
1076
1078
1077 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
1079 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
1078 to signal the end of the delta group:
1080 to signal the end of the delta group:
1079
1081
1080 +------------------------------------------------------------------------+
1082 +------------------------------------------------------------------------+
1081 | | | | | |
1083 | | | | | |
1082 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
1084 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
1083 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
1085 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
1084 | | | | | |
1086 | | | | | |
1085 +------------------------------------------------------------------------+
1087 +------------------------------------------------------------------------+
1086
1088
1087 Each *chunk*'s data consists of the following:
1089 Each *chunk*'s data consists of the following:
1088
1090
1089 +---------------------------------------+
1091 +---------------------------------------+
1090 | | |
1092 | | |
1091 | delta header | delta data |
1093 | delta header | delta data |
1092 | (various by version) | (various) |
1094 | (various by version) | (various) |
1093 | | |
1095 | | |
1094 +---------------------------------------+
1096 +---------------------------------------+
1095
1097
1096 The *delta data* is a series of *delta*s that describe a diff from an
1098 The *delta data* is a series of *delta*s that describe a diff from an
1097 existing entry (either that the recipient already has, or previously
1099 existing entry (either that the recipient already has, or previously
1098 specified in the bundle/changegroup).
1100 specified in the bundle/changegroup).
1099
1101
1100 The *delta header* is different between versions "1", "2", and "3" of the
1102 The *delta header* is different between versions "1", "2", and "3" of the
1101 changegroup format.
1103 changegroup format.
1102
1104
1103 Version 1 (headerlen=80):
1105 Version 1 (headerlen=80):
1104
1106
1105 +------------------------------------------------------+
1107 +------------------------------------------------------+
1106 | | | | |
1108 | | | | |
1107 | node | p1 node | p2 node | link node |
1109 | node | p1 node | p2 node | link node |
1108 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1110 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1109 | | | | |
1111 | | | | |
1110 +------------------------------------------------------+
1112 +------------------------------------------------------+
1111
1113
1112 Version 2 (headerlen=100):
1114 Version 2 (headerlen=100):
1113
1115
1114 +------------------------------------------------------------------+
1116 +------------------------------------------------------------------+
1115 | | | | | |
1117 | | | | | |
1116 | node | p1 node | p2 node | base node | link node |
1118 | node | p1 node | p2 node | base node | link node |
1117 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1119 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1118 | | | | | |
1120 | | | | | |
1119 +------------------------------------------------------------------+
1121 +------------------------------------------------------------------+
1120
1122
1121 Version 3 (headerlen=102):
1123 Version 3 (headerlen=102):
1122
1124
1123 +------------------------------------------------------------------------------+
1125 +------------------------------------------------------------------------------+
1124 | | | | | | |
1126 | | | | | | |
1125 | node | p1 node | p2 node | base node | link node | flags |
1127 | node | p1 node | p2 node | base node | link node | flags |
1126 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
1128 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
1127 | | | | | | |
1129 | | | | | | |
1128 +------------------------------------------------------------------------------+
1130 +------------------------------------------------------------------------------+
1129
1131
1130 The *delta data* consists of "chunklen - 4 - headerlen" bytes, which
1132 The *delta data* consists of "chunklen - 4 - headerlen" bytes, which
1131 contain a series of *delta*s, densely packed (no separators). These deltas
1133 contain a series of *delta*s, densely packed (no separators). These deltas
1132 describe a diff from an existing entry (either that the recipient already
1134 describe a diff from an existing entry (either that the recipient already
1133 has, or previously specified in the bundle/changegroup). The format is
1135 has, or previously specified in the bundle/changegroup). The format is
1134 described more fully in "hg help internals.bdiff", but briefly:
1136 described more fully in "hg help internals.bdiff", but briefly:
1135
1137
1136 +---------------------------------------------------------------+
1138 +---------------------------------------------------------------+
1137 | | | | |
1139 | | | | |
1138 | start offset | end offset | new length | content |
1140 | start offset | end offset | new length | content |
1139 | (4 bytes) | (4 bytes) | (4 bytes) | (<new length> bytes) |
1141 | (4 bytes) | (4 bytes) | (4 bytes) | (<new length> bytes) |
1140 | | | | |
1142 | | | | |
1141 +---------------------------------------------------------------+
1143 +---------------------------------------------------------------+
1142
1144
1143 Please note that the length field in the delta data does *not* include
1145 Please note that the length field in the delta data does *not* include
1144 itself.
1146 itself.
1145
1147
1146 In version 1, the delta is always applied against the previous node from
1148 In version 1, the delta is always applied against the previous node from
1147 the changegroup or the first parent if this is the first entry in the
1149 the changegroup or the first parent if this is the first entry in the
1148 changegroup.
1150 changegroup.
1149
1151
1150 In version 2 and up, the delta base node is encoded in the entry in the
1152 In version 2 and up, the delta base node is encoded in the entry in the
1151 changegroup. This allows the delta to be expressed against any parent,
1153 changegroup. This allows the delta to be expressed against any parent,
1152 which can result in smaller deltas and more efficient encoding of data.
1154 which can result in smaller deltas and more efficient encoding of data.
1153
1155
1154 Changeset Segment
1156 Changeset Segment
1155 =================
1157 =================
1156
1158
1157 The *changeset segment* consists of a single *delta group* holding
1159 The *changeset segment* consists of a single *delta group* holding
1158 changelog data. The *empty chunk* at the end of the *delta group* denotes
1160 changelog data. The *empty chunk* at the end of the *delta group* denotes
1159 the boundary to the *manifest segment*.
1161 the boundary to the *manifest segment*.
1160
1162
1161 Manifest Segment
1163 Manifest Segment
1162 ================
1164 ================
1163
1165
1164 The *manifest segment* consists of a single *delta group* holding manifest
1166 The *manifest segment* consists of a single *delta group* holding manifest
1165 data. If treemanifests are in use, it contains only the manifest for the
1167 data. If treemanifests are in use, it contains only the manifest for the
1166 root directory of the repository. Otherwise, it contains the entire
1168 root directory of the repository. Otherwise, it contains the entire
1167 manifest data. The *empty chunk* at the end of the *delta group* denotes
1169 manifest data. The *empty chunk* at the end of the *delta group* denotes
1168 the boundary to the next segment (either the *treemanifests segment* or
1170 the boundary to the next segment (either the *treemanifests segment* or
1169 the *filelogs segment*, depending on version and the request options).
1171 the *filelogs segment*, depending on version and the request options).
1170
1172
1171 Treemanifests Segment
1173 Treemanifests Segment
1172 ---------------------
1174 ---------------------
1173
1175
1174 The *treemanifests segment* only exists in changegroup version "3", and
1176 The *treemanifests segment* only exists in changegroup version "3", and
1175 only if the 'treemanifest' param is part of the bundle2 changegroup part
1177 only if the 'treemanifest' param is part of the bundle2 changegroup part
1176 (it is not possible to use changegroup version 3 outside of bundle2).
1178 (it is not possible to use changegroup version 3 outside of bundle2).
1177 Aside from the filenames in the *treemanifests segment* containing a
1179 Aside from the filenames in the *treemanifests segment* containing a
1178 trailing "/" character, it behaves identically to the *filelogs segment*
1180 trailing "/" character, it behaves identically to the *filelogs segment*
1179 (see below). The final sub-segment is followed by an *empty chunk*
1181 (see below). The final sub-segment is followed by an *empty chunk*
1180 (logically, a sub-segment with filename size 0). This denotes the boundary
1182 (logically, a sub-segment with filename size 0). This denotes the boundary
1181 to the *filelogs segment*.
1183 to the *filelogs segment*.
1182
1184
1183 Filelogs Segment
1185 Filelogs Segment
1184 ================
1186 ================
1185
1187
1186 The *filelogs segment* consists of multiple sub-segments, each
1188 The *filelogs segment* consists of multiple sub-segments, each
1187 corresponding to an individual file whose data is being described:
1189 corresponding to an individual file whose data is being described:
1188
1190
1189 +--------------------------------------------------+
1191 +--------------------------------------------------+
1190 | | | | | |
1192 | | | | | |
1191 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
1193 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
1192 | | | | | (4 bytes) |
1194 | | | | | (4 bytes) |
1193 | | | | | |
1195 | | | | | |
1194 +--------------------------------------------------+
1196 +--------------------------------------------------+
1195
1197
1196 The final filelog sub-segment is followed by an *empty chunk* (logically,
1198 The final filelog sub-segment is followed by an *empty chunk* (logically,
1197 a sub-segment with filename size 0). This denotes the end of the segment
1199 a sub-segment with filename size 0). This denotes the end of the segment
1198 and of the overall changegroup.
1200 and of the overall changegroup.
1199
1201
1200 Each filelog sub-segment consists of the following:
1202 Each filelog sub-segment consists of the following:
1201
1203
1202 +------------------------------------------------------+
1204 +------------------------------------------------------+
1203 | | | |
1205 | | | |
1204 | filename length | filename | delta group |
1206 | filename length | filename | delta group |
1205 | (4 bytes) | (<length - 4> bytes) | (various) |
1207 | (4 bytes) | (<length - 4> bytes) | (various) |
1206 | | | |
1208 | | | |
1207 +------------------------------------------------------+
1209 +------------------------------------------------------+
1208
1210
1209 That is, a *chunk* consisting of the filename (not terminated or padded)
1211 That is, a *chunk* consisting of the filename (not terminated or padded)
1210 followed by N chunks constituting the *delta group* for this file. The
1212 followed by N chunks constituting the *delta group* for this file. The
1211 *empty chunk* at the end of each *delta group* denotes the boundary to the
1213 *empty chunk* at the end of each *delta group* denotes the boundary to the
1212 next filelog sub-segment.
1214 next filelog sub-segment.
1213
1215
1214 Test list of commands with command with no help text
1216 Test list of commands with command with no help text
1215
1217
1216 $ hg help helpext
1218 $ hg help helpext
1217 helpext extension - no help text available
1219 helpext extension - no help text available
1218
1220
1219 list of commands:
1221 list of commands:
1220
1222
1221 nohelp (no help text available)
1223 nohelp (no help text available)
1222
1224
1223 (use 'hg help -v helpext' to show built-in aliases and global options)
1225 (use 'hg help -v helpext' to show built-in aliases and global options)
1224
1226
1225
1227
1226 test advanced, deprecated and experimental options are hidden in command help
1228 test advanced, deprecated and experimental options are hidden in command help
1227 $ hg help debugoptADV
1229 $ hg help debugoptADV
1228 hg debugoptADV
1230 hg debugoptADV
1229
1231
1230 (no help text available)
1232 (no help text available)
1231
1233
1232 options:
1234 options:
1233
1235
1234 (some details hidden, use --verbose to show complete help)
1236 (some details hidden, use --verbose to show complete help)
1235 $ hg help debugoptDEP
1237 $ hg help debugoptDEP
1236 hg debugoptDEP
1238 hg debugoptDEP
1237
1239
1238 (no help text available)
1240 (no help text available)
1239
1241
1240 options:
1242 options:
1241
1243
1242 (some details hidden, use --verbose to show complete help)
1244 (some details hidden, use --verbose to show complete help)
1243
1245
1244 $ hg help debugoptEXP
1246 $ hg help debugoptEXP
1245 hg debugoptEXP
1247 hg debugoptEXP
1246
1248
1247 (no help text available)
1249 (no help text available)
1248
1250
1249 options:
1251 options:
1250
1252
1251 (some details hidden, use --verbose to show complete help)
1253 (some details hidden, use --verbose to show complete help)
1252
1254
1253 test advanced, deprecated and experimental options are shown with -v
1255 test advanced, deprecated and experimental options are shown with -v
1254 $ hg help -v debugoptADV | grep aopt
1256 $ hg help -v debugoptADV | grep aopt
1255 --aopt option is (ADVANCED)
1257 --aopt option is (ADVANCED)
1256 $ hg help -v debugoptDEP | grep dopt
1258 $ hg help -v debugoptDEP | grep dopt
1257 --dopt option is (DEPRECATED)
1259 --dopt option is (DEPRECATED)
1258 $ hg help -v debugoptEXP | grep eopt
1260 $ hg help -v debugoptEXP | grep eopt
1259 --eopt option is (EXPERIMENTAL)
1261 --eopt option is (EXPERIMENTAL)
1260
1262
1261 #if gettext
1263 #if gettext
1262 test deprecated option is hidden with translation with untranslated description
1264 test deprecated option is hidden with translation with untranslated description
1263 (use many globy for not failing on changed transaction)
1265 (use many globy for not failing on changed transaction)
1264 $ LANGUAGE=sv hg help debugoptDEP
1266 $ LANGUAGE=sv hg help debugoptDEP
1265 hg debugoptDEP
1267 hg debugoptDEP
1266
1268
1267 (*) (glob)
1269 (*) (glob)
1268
1270
1269 options:
1271 options:
1270
1272
1271 (some details hidden, use --verbose to show complete help)
1273 (some details hidden, use --verbose to show complete help)
1272 #endif
1274 #endif
1273
1275
1274 Test commands that collide with topics (issue4240)
1276 Test commands that collide with topics (issue4240)
1275
1277
1276 $ hg config -hq
1278 $ hg config -hq
1277 hg config [-u] [NAME]...
1279 hg config [-u] [NAME]...
1278
1280
1279 show combined config settings from all hgrc files
1281 show combined config settings from all hgrc files
1280 $ hg showconfig -hq
1282 $ hg showconfig -hq
1281 hg config [-u] [NAME]...
1283 hg config [-u] [NAME]...
1282
1284
1283 show combined config settings from all hgrc files
1285 show combined config settings from all hgrc files
1284
1286
1285 Test a help topic
1287 Test a help topic
1286
1288
1287 $ hg help dates
1289 $ hg help dates
1288 Date Formats
1290 Date Formats
1289 """"""""""""
1291 """"""""""""
1290
1292
1291 Some commands allow the user to specify a date, e.g.:
1293 Some commands allow the user to specify a date, e.g.:
1292
1294
1293 - backout, commit, import, tag: Specify the commit date.
1295 - backout, commit, import, tag: Specify the commit date.
1294 - log, revert, update: Select revision(s) by date.
1296 - log, revert, update: Select revision(s) by date.
1295
1297
1296 Many date formats are valid. Here are some examples:
1298 Many date formats are valid. Here are some examples:
1297
1299
1298 - "Wed Dec 6 13:18:29 2006" (local timezone assumed)
1300 - "Wed Dec 6 13:18:29 2006" (local timezone assumed)
1299 - "Dec 6 13:18 -0600" (year assumed, time offset provided)
1301 - "Dec 6 13:18 -0600" (year assumed, time offset provided)
1300 - "Dec 6 13:18 UTC" (UTC and GMT are aliases for +0000)
1302 - "Dec 6 13:18 UTC" (UTC and GMT are aliases for +0000)
1301 - "Dec 6" (midnight)
1303 - "Dec 6" (midnight)
1302 - "13:18" (today assumed)
1304 - "13:18" (today assumed)
1303 - "3:39" (3:39AM assumed)
1305 - "3:39" (3:39AM assumed)
1304 - "3:39pm" (15:39)
1306 - "3:39pm" (15:39)
1305 - "2006-12-06 13:18:29" (ISO 8601 format)
1307 - "2006-12-06 13:18:29" (ISO 8601 format)
1306 - "2006-12-6 13:18"
1308 - "2006-12-6 13:18"
1307 - "2006-12-6"
1309 - "2006-12-6"
1308 - "12-6"
1310 - "12-6"
1309 - "12/6"
1311 - "12/6"
1310 - "12/6/6" (Dec 6 2006)
1312 - "12/6/6" (Dec 6 2006)
1311 - "today" (midnight)
1313 - "today" (midnight)
1312 - "yesterday" (midnight)
1314 - "yesterday" (midnight)
1313 - "now" - right now
1315 - "now" - right now
1314
1316
1315 Lastly, there is Mercurial's internal format:
1317 Lastly, there is Mercurial's internal format:
1316
1318
1317 - "1165411109 0" (Wed Dec 6 13:18:29 2006 UTC)
1319 - "1165411109 0" (Wed Dec 6 13:18:29 2006 UTC)
1318
1320
1319 This is the internal representation format for dates. The first number is
1321 This is the internal representation format for dates. The first number is
1320 the number of seconds since the epoch (1970-01-01 00:00 UTC). The second
1322 the number of seconds since the epoch (1970-01-01 00:00 UTC). The second
1321 is the offset of the local timezone, in seconds west of UTC (negative if
1323 is the offset of the local timezone, in seconds west of UTC (negative if
1322 the timezone is east of UTC).
1324 the timezone is east of UTC).
1323
1325
1324 The log command also accepts date ranges:
1326 The log command also accepts date ranges:
1325
1327
1326 - "<DATE" - at or before a given date/time
1328 - "<DATE" - at or before a given date/time
1327 - ">DATE" - on or after a given date/time
1329 - ">DATE" - on or after a given date/time
1328 - "DATE to DATE" - a date range, inclusive
1330 - "DATE to DATE" - a date range, inclusive
1329 - "-DAYS" - within a given number of days of today
1331 - "-DAYS" - within a given number of days of today
1330
1332
1331 Test repeated config section name
1333 Test repeated config section name
1332
1334
1333 $ hg help config.host
1335 $ hg help config.host
1334 "http_proxy.host"
1336 "http_proxy.host"
1335 Host name and (optional) port of the proxy server, for example
1337 Host name and (optional) port of the proxy server, for example
1336 "myproxy:8000".
1338 "myproxy:8000".
1337
1339
1338 "smtp.host"
1340 "smtp.host"
1339 Host name of mail server, e.g. "mail.example.com".
1341 Host name of mail server, e.g. "mail.example.com".
1340
1342
1341 Unrelated trailing paragraphs shouldn't be included
1343 Unrelated trailing paragraphs shouldn't be included
1342
1344
1343 $ hg help config.extramsg | grep '^$'
1345 $ hg help config.extramsg | grep '^$'
1344
1346
1345
1347
1346 Test capitalized section name
1348 Test capitalized section name
1347
1349
1348 $ hg help scripting.HGPLAIN > /dev/null
1350 $ hg help scripting.HGPLAIN > /dev/null
1349
1351
1350 Help subsection:
1352 Help subsection:
1351
1353
1352 $ hg help config.charsets |grep "Email example:" > /dev/null
1354 $ hg help config.charsets |grep "Email example:" > /dev/null
1353 [1]
1355 [1]
1354
1356
1355 Show nested definitions
1357 Show nested definitions
1356 ("profiling.type"[break]"ls"[break]"stat"[break])
1358 ("profiling.type"[break]"ls"[break]"stat"[break])
1357
1359
1358 $ hg help config.type | egrep '^$'|wc -l
1360 $ hg help config.type | egrep '^$'|wc -l
1359 \s*3 (re)
1361 \s*3 (re)
1360
1362
1361 Separate sections from subsections
1363 Separate sections from subsections
1362
1364
1363 $ hg help config.format | egrep '^ ("|-)|^\s*$' | uniq
1365 $ hg help config.format | egrep '^ ("|-)|^\s*$' | uniq
1364 "format"
1366 "format"
1365 --------
1367 --------
1366
1368
1367 "usegeneraldelta"
1369 "usegeneraldelta"
1368
1370
1369 "dotencode"
1371 "dotencode"
1370
1372
1371 "usefncache"
1373 "usefncache"
1372
1374
1373 "usestore"
1375 "usestore"
1374
1376
1375 "profiling"
1377 "profiling"
1376 -----------
1378 -----------
1377
1379
1378 "format"
1380 "format"
1379
1381
1380 "progress"
1382 "progress"
1381 ----------
1383 ----------
1382
1384
1383 "format"
1385 "format"
1384
1386
1385
1387
1386 Last item in help config.*:
1388 Last item in help config.*:
1387
1389
1388 $ hg help config.`hg help config|grep '^ "'| \
1390 $ hg help config.`hg help config|grep '^ "'| \
1389 > tail -1|sed 's![ "]*!!g'`| \
1391 > tail -1|sed 's![ "]*!!g'`| \
1390 > grep 'hg help -c config' > /dev/null
1392 > grep 'hg help -c config' > /dev/null
1391 [1]
1393 [1]
1392
1394
1393 note to use help -c for general hg help config:
1395 note to use help -c for general hg help config:
1394
1396
1395 $ hg help config |grep 'hg help -c config' > /dev/null
1397 $ hg help config |grep 'hg help -c config' > /dev/null
1396
1398
1397 Test templating help
1399 Test templating help
1398
1400
1399 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
1401 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
1400 desc String. The text of the changeset description.
1402 desc String. The text of the changeset description.
1401 diffstat String. Statistics of changes with the following format:
1403 diffstat String. Statistics of changes with the following format:
1402 firstline Any text. Returns the first line of text.
1404 firstline Any text. Returns the first line of text.
1403 nonempty Any text. Returns '(none)' if the string is empty.
1405 nonempty Any text. Returns '(none)' if the string is empty.
1404
1406
1405 Test deprecated items
1407 Test deprecated items
1406
1408
1407 $ hg help -v templating | grep currentbookmark
1409 $ hg help -v templating | grep currentbookmark
1408 currentbookmark
1410 currentbookmark
1409 $ hg help templating | (grep currentbookmark || true)
1411 $ hg help templating | (grep currentbookmark || true)
1410
1412
1411 Test help hooks
1413 Test help hooks
1412
1414
1413 $ cat > helphook1.py <<EOF
1415 $ cat > helphook1.py <<EOF
1414 > from mercurial import help
1416 > from mercurial import help
1415 >
1417 >
1416 > def rewrite(ui, topic, doc):
1418 > def rewrite(ui, topic, doc):
1417 > return doc + '\nhelphook1\n'
1419 > return doc + '\nhelphook1\n'
1418 >
1420 >
1419 > def extsetup(ui):
1421 > def extsetup(ui):
1420 > help.addtopichook('revisions', rewrite)
1422 > help.addtopichook('revisions', rewrite)
1421 > EOF
1423 > EOF
1422 $ cat > helphook2.py <<EOF
1424 $ cat > helphook2.py <<EOF
1423 > from mercurial import help
1425 > from mercurial import help
1424 >
1426 >
1425 > def rewrite(ui, topic, doc):
1427 > def rewrite(ui, topic, doc):
1426 > return doc + '\nhelphook2\n'
1428 > return doc + '\nhelphook2\n'
1427 >
1429 >
1428 > def extsetup(ui):
1430 > def extsetup(ui):
1429 > help.addtopichook('revisions', rewrite)
1431 > help.addtopichook('revisions', rewrite)
1430 > EOF
1432 > EOF
1431 $ echo '[extensions]' >> $HGRCPATH
1433 $ echo '[extensions]' >> $HGRCPATH
1432 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
1434 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
1433 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
1435 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
1434 $ hg help revsets | grep helphook
1436 $ hg help revsets | grep helphook
1435 helphook1
1437 helphook1
1436 helphook2
1438 helphook2
1437
1439
1438 help -c should only show debug --debug
1440 help -c should only show debug --debug
1439
1441
1440 $ hg help -c --debug|egrep debug|wc -l|egrep '^\s*0\s*$'
1442 $ hg help -c --debug|egrep debug|wc -l|egrep '^\s*0\s*$'
1441 [1]
1443 [1]
1442
1444
1443 help -c should only show deprecated for -v
1445 help -c should only show deprecated for -v
1444
1446
1445 $ hg help -c -v|egrep DEPRECATED|wc -l|egrep '^\s*0\s*$'
1447 $ hg help -c -v|egrep DEPRECATED|wc -l|egrep '^\s*0\s*$'
1446 [1]
1448 [1]
1447
1449
1448 Test -s / --system
1450 Test -s / --system
1449
1451
1450 $ hg help config.files -s windows |grep 'etc/mercurial' | \
1452 $ hg help config.files -s windows |grep 'etc/mercurial' | \
1451 > wc -l | sed -e 's/ //g'
1453 > wc -l | sed -e 's/ //g'
1452 0
1454 0
1453 $ hg help config.files --system unix | grep 'USER' | \
1455 $ hg help config.files --system unix | grep 'USER' | \
1454 > wc -l | sed -e 's/ //g'
1456 > wc -l | sed -e 's/ //g'
1455 0
1457 0
1456
1458
1457 Test -e / -c / -k combinations
1459 Test -e / -c / -k combinations
1458
1460
1459 $ hg help -c|egrep '^[A-Z].*:|^ debug'
1461 $ hg help -c|egrep '^[A-Z].*:|^ debug'
1460 Commands:
1462 Commands:
1461 $ hg help -e|egrep '^[A-Z].*:|^ debug'
1463 $ hg help -e|egrep '^[A-Z].*:|^ debug'
1462 Extensions:
1464 Extensions:
1463 $ hg help -k|egrep '^[A-Z].*:|^ debug'
1465 $ hg help -k|egrep '^[A-Z].*:|^ debug'
1464 Topics:
1466 Topics:
1465 Commands:
1467 Commands:
1466 Extensions:
1468 Extensions:
1467 Extension Commands:
1469 Extension Commands:
1468 $ hg help -c schemes
1470 $ hg help -c schemes
1469 abort: no such help topic: schemes
1471 abort: no such help topic: schemes
1470 (try 'hg help --keyword schemes')
1472 (try 'hg help --keyword schemes')
1471 [255]
1473 [255]
1472 $ hg help -e schemes |head -1
1474 $ hg help -e schemes |head -1
1473 schemes extension - extend schemes with shortcuts to repository swarms
1475 schemes extension - extend schemes with shortcuts to repository swarms
1474 $ hg help -c -k dates |egrep '^(Topics|Extensions|Commands):'
1476 $ hg help -c -k dates |egrep '^(Topics|Extensions|Commands):'
1475 Commands:
1477 Commands:
1476 $ hg help -e -k a |egrep '^(Topics|Extensions|Commands):'
1478 $ hg help -e -k a |egrep '^(Topics|Extensions|Commands):'
1477 Extensions:
1479 Extensions:
1478 $ hg help -e -c -k date |egrep '^(Topics|Extensions|Commands):'
1480 $ hg help -e -c -k date |egrep '^(Topics|Extensions|Commands):'
1479 Extensions:
1481 Extensions:
1480 Commands:
1482 Commands:
1481 $ hg help -c commit > /dev/null
1483 $ hg help -c commit > /dev/null
1482 $ hg help -e -c commit > /dev/null
1484 $ hg help -e -c commit > /dev/null
1483 $ hg help -e commit
1485 $ hg help -e commit
1484 abort: no such help topic: commit
1486 abort: no such help topic: commit
1485 (try 'hg help --keyword commit')
1487 (try 'hg help --keyword commit')
1486 [255]
1488 [255]
1487
1489
1488 Test keyword search help
1490 Test keyword search help
1489
1491
1490 $ cat > prefixedname.py <<EOF
1492 $ cat > prefixedname.py <<EOF
1491 > '''matched against word "clone"
1493 > '''matched against word "clone"
1492 > '''
1494 > '''
1493 > EOF
1495 > EOF
1494 $ echo '[extensions]' >> $HGRCPATH
1496 $ echo '[extensions]' >> $HGRCPATH
1495 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
1497 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
1496 $ hg help -k clone
1498 $ hg help -k clone
1497 Topics:
1499 Topics:
1498
1500
1499 config Configuration Files
1501 config Configuration Files
1500 extensions Using Additional Features
1502 extensions Using Additional Features
1501 glossary Glossary
1503 glossary Glossary
1502 phases Working with Phases
1504 phases Working with Phases
1503 subrepos Subrepositories
1505 subrepos Subrepositories
1504 urls URL Paths
1506 urls URL Paths
1505
1507
1506 Commands:
1508 Commands:
1507
1509
1508 bookmarks create a new bookmark or list existing bookmarks
1510 bookmarks create a new bookmark or list existing bookmarks
1509 clone make a copy of an existing repository
1511 clone make a copy of an existing repository
1510 paths show aliases for remote repositories
1512 paths show aliases for remote repositories
1511 pull pull changes from the specified source
1513 pull pull changes from the specified source
1512 update update working directory (or switch revisions)
1514 update update working directory (or switch revisions)
1513
1515
1514 Extensions:
1516 Extensions:
1515
1517
1516 clonebundles advertise pre-generated bundles to seed clones
1518 clonebundles advertise pre-generated bundles to seed clones
1517 narrow create clones which fetch history data for subset of files
1519 narrow create clones which fetch history data for subset of files
1518 (EXPERIMENTAL)
1520 (EXPERIMENTAL)
1519 prefixedname matched against word "clone"
1521 prefixedname matched against word "clone"
1520 relink recreates hardlinks between repository clones
1522 relink recreates hardlinks between repository clones
1521
1523
1522 Extension Commands:
1524 Extension Commands:
1523
1525
1524 qclone clone main and patch repository at same time
1526 qclone clone main and patch repository at same time
1525
1527
1526 Test unfound topic
1528 Test unfound topic
1527
1529
1528 $ hg help nonexistingtopicthatwillneverexisteverever
1530 $ hg help nonexistingtopicthatwillneverexisteverever
1529 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
1531 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
1530 (try 'hg help --keyword nonexistingtopicthatwillneverexisteverever')
1532 (try 'hg help --keyword nonexistingtopicthatwillneverexisteverever')
1531 [255]
1533 [255]
1532
1534
1533 Test unfound keyword
1535 Test unfound keyword
1534
1536
1535 $ hg help --keyword nonexistingwordthatwillneverexisteverever
1537 $ hg help --keyword nonexistingwordthatwillneverexisteverever
1536 abort: no matches
1538 abort: no matches
1537 (try 'hg help' for a list of topics)
1539 (try 'hg help' for a list of topics)
1538 [255]
1540 [255]
1539
1541
1540 Test omit indicating for help
1542 Test omit indicating for help
1541
1543
1542 $ cat > addverboseitems.py <<EOF
1544 $ cat > addverboseitems.py <<EOF
1543 > '''extension to test omit indicating.
1545 > '''extension to test omit indicating.
1544 >
1546 >
1545 > This paragraph is never omitted (for extension)
1547 > This paragraph is never omitted (for extension)
1546 >
1548 >
1547 > .. container:: verbose
1549 > .. container:: verbose
1548 >
1550 >
1549 > This paragraph is omitted,
1551 > This paragraph is omitted,
1550 > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension)
1552 > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension)
1551 >
1553 >
1552 > This paragraph is never omitted, too (for extension)
1554 > This paragraph is never omitted, too (for extension)
1553 > '''
1555 > '''
1554 > from __future__ import absolute_import
1556 > from __future__ import absolute_import
1555 > from mercurial import commands, help
1557 > from mercurial import commands, help
1556 > testtopic = """This paragraph is never omitted (for topic).
1558 > testtopic = """This paragraph is never omitted (for topic).
1557 >
1559 >
1558 > .. container:: verbose
1560 > .. container:: verbose
1559 >
1561 >
1560 > This paragraph is omitted,
1562 > This paragraph is omitted,
1561 > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic)
1563 > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic)
1562 >
1564 >
1563 > This paragraph is never omitted, too (for topic)
1565 > This paragraph is never omitted, too (for topic)
1564 > """
1566 > """
1565 > def extsetup(ui):
1567 > def extsetup(ui):
1566 > help.helptable.append((["topic-containing-verbose"],
1568 > help.helptable.append((["topic-containing-verbose"],
1567 > "This is the topic to test omit indicating.",
1569 > "This is the topic to test omit indicating.",
1568 > lambda ui: testtopic))
1570 > lambda ui: testtopic))
1569 > EOF
1571 > EOF
1570 $ echo '[extensions]' >> $HGRCPATH
1572 $ echo '[extensions]' >> $HGRCPATH
1571 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1573 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1572 $ hg help addverboseitems
1574 $ hg help addverboseitems
1573 addverboseitems extension - extension to test omit indicating.
1575 addverboseitems extension - extension to test omit indicating.
1574
1576
1575 This paragraph is never omitted (for extension)
1577 This paragraph is never omitted (for extension)
1576
1578
1577 This paragraph is never omitted, too (for extension)
1579 This paragraph is never omitted, too (for extension)
1578
1580
1579 (some details hidden, use --verbose to show complete help)
1581 (some details hidden, use --verbose to show complete help)
1580
1582
1581 no commands defined
1583 no commands defined
1582 $ hg help -v addverboseitems
1584 $ hg help -v addverboseitems
1583 addverboseitems extension - extension to test omit indicating.
1585 addverboseitems extension - extension to test omit indicating.
1584
1586
1585 This paragraph is never omitted (for extension)
1587 This paragraph is never omitted (for extension)
1586
1588
1587 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1589 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1588 extension)
1590 extension)
1589
1591
1590 This paragraph is never omitted, too (for extension)
1592 This paragraph is never omitted, too (for extension)
1591
1593
1592 no commands defined
1594 no commands defined
1593 $ hg help topic-containing-verbose
1595 $ hg help topic-containing-verbose
1594 This is the topic to test omit indicating.
1596 This is the topic to test omit indicating.
1595 """"""""""""""""""""""""""""""""""""""""""
1597 """"""""""""""""""""""""""""""""""""""""""
1596
1598
1597 This paragraph is never omitted (for topic).
1599 This paragraph is never omitted (for topic).
1598
1600
1599 This paragraph is never omitted, too (for topic)
1601 This paragraph is never omitted, too (for topic)
1600
1602
1601 (some details hidden, use --verbose to show complete help)
1603 (some details hidden, use --verbose to show complete help)
1602 $ hg help -v topic-containing-verbose
1604 $ hg help -v topic-containing-verbose
1603 This is the topic to test omit indicating.
1605 This is the topic to test omit indicating.
1604 """"""""""""""""""""""""""""""""""""""""""
1606 """"""""""""""""""""""""""""""""""""""""""
1605
1607
1606 This paragraph is never omitted (for topic).
1608 This paragraph is never omitted (for topic).
1607
1609
1608 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1610 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1609 topic)
1611 topic)
1610
1612
1611 This paragraph is never omitted, too (for topic)
1613 This paragraph is never omitted, too (for topic)
1612
1614
1613 Test section lookup
1615 Test section lookup
1614
1616
1615 $ hg help revset.merge
1617 $ hg help revset.merge
1616 "merge()"
1618 "merge()"
1617 Changeset is a merge changeset.
1619 Changeset is a merge changeset.
1618
1620
1619 $ hg help glossary.dag
1621 $ hg help glossary.dag
1620 DAG
1622 DAG
1621 The repository of changesets of a distributed version control system
1623 The repository of changesets of a distributed version control system
1622 (DVCS) can be described as a directed acyclic graph (DAG), consisting
1624 (DVCS) can be described as a directed acyclic graph (DAG), consisting
1623 of nodes and edges, where nodes correspond to changesets and edges
1625 of nodes and edges, where nodes correspond to changesets and edges
1624 imply a parent -> child relation. This graph can be visualized by
1626 imply a parent -> child relation. This graph can be visualized by
1625 graphical tools such as 'hg log --graph'. In Mercurial, the DAG is
1627 graphical tools such as 'hg log --graph'. In Mercurial, the DAG is
1626 limited by the requirement for children to have at most two parents.
1628 limited by the requirement for children to have at most two parents.
1627
1629
1628
1630
1629 $ hg help hgrc.paths
1631 $ hg help hgrc.paths
1630 "paths"
1632 "paths"
1631 -------
1633 -------
1632
1634
1633 Assigns symbolic names and behavior to repositories.
1635 Assigns symbolic names and behavior to repositories.
1634
1636
1635 Options are symbolic names defining the URL or directory that is the
1637 Options are symbolic names defining the URL or directory that is the
1636 location of the repository. Example:
1638 location of the repository. Example:
1637
1639
1638 [paths]
1640 [paths]
1639 my_server = https://example.com/my_repo
1641 my_server = https://example.com/my_repo
1640 local_path = /home/me/repo
1642 local_path = /home/me/repo
1641
1643
1642 These symbolic names can be used from the command line. To pull from
1644 These symbolic names can be used from the command line. To pull from
1643 "my_server": 'hg pull my_server'. To push to "local_path": 'hg push
1645 "my_server": 'hg pull my_server'. To push to "local_path": 'hg push
1644 local_path'.
1646 local_path'.
1645
1647
1646 Options containing colons (":") denote sub-options that can influence
1648 Options containing colons (":") denote sub-options that can influence
1647 behavior for that specific path. Example:
1649 behavior for that specific path. Example:
1648
1650
1649 [paths]
1651 [paths]
1650 my_server = https://example.com/my_path
1652 my_server = https://example.com/my_path
1651 my_server:pushurl = ssh://example.com/my_path
1653 my_server:pushurl = ssh://example.com/my_path
1652
1654
1653 The following sub-options can be defined:
1655 The following sub-options can be defined:
1654
1656
1655 "pushurl"
1657 "pushurl"
1656 The URL to use for push operations. If not defined, the location
1658 The URL to use for push operations. If not defined, the location
1657 defined by the path's main entry is used.
1659 defined by the path's main entry is used.
1658
1660
1659 "pushrev"
1661 "pushrev"
1660 A revset defining which revisions to push by default.
1662 A revset defining which revisions to push by default.
1661
1663
1662 When 'hg push' is executed without a "-r" argument, the revset defined
1664 When 'hg push' is executed without a "-r" argument, the revset defined
1663 by this sub-option is evaluated to determine what to push.
1665 by this sub-option is evaluated to determine what to push.
1664
1666
1665 For example, a value of "." will push the working directory's revision
1667 For example, a value of "." will push the working directory's revision
1666 by default.
1668 by default.
1667
1669
1668 Revsets specifying bookmarks will not result in the bookmark being
1670 Revsets specifying bookmarks will not result in the bookmark being
1669 pushed.
1671 pushed.
1670
1672
1671 The following special named paths exist:
1673 The following special named paths exist:
1672
1674
1673 "default"
1675 "default"
1674 The URL or directory to use when no source or remote is specified.
1676 The URL or directory to use when no source or remote is specified.
1675
1677
1676 'hg clone' will automatically define this path to the location the
1678 'hg clone' will automatically define this path to the location the
1677 repository was cloned from.
1679 repository was cloned from.
1678
1680
1679 "default-push"
1681 "default-push"
1680 (deprecated) The URL or directory for the default 'hg push' location.
1682 (deprecated) The URL or directory for the default 'hg push' location.
1681 "default:pushurl" should be used instead.
1683 "default:pushurl" should be used instead.
1682
1684
1683 $ hg help glossary.mcguffin
1685 $ hg help glossary.mcguffin
1684 abort: help section not found: glossary.mcguffin
1686 abort: help section not found: glossary.mcguffin
1685 [255]
1687 [255]
1686
1688
1687 $ hg help glossary.mc.guffin
1689 $ hg help glossary.mc.guffin
1688 abort: help section not found: glossary.mc.guffin
1690 abort: help section not found: glossary.mc.guffin
1689 [255]
1691 [255]
1690
1692
1691 $ hg help template.files
1693 $ hg help template.files
1692 files List of strings. All files modified, added, or removed by
1694 files List of strings. All files modified, added, or removed by
1693 this changeset.
1695 this changeset.
1694 files(pattern)
1696 files(pattern)
1695 All files of the current changeset matching the pattern. See
1697 All files of the current changeset matching the pattern. See
1696 'hg help patterns'.
1698 'hg help patterns'.
1697
1699
1698 Test section lookup by translated message
1700 Test section lookup by translated message
1699
1701
1700 str.lower() instead of encoding.lower(str) on translated message might
1702 str.lower() instead of encoding.lower(str) on translated message might
1701 make message meaningless, because some encoding uses 0x41(A) - 0x5a(Z)
1703 make message meaningless, because some encoding uses 0x41(A) - 0x5a(Z)
1702 as the second or later byte of multi-byte character.
1704 as the second or later byte of multi-byte character.
1703
1705
1704 For example, "\x8bL\x98^" (translation of "record" in ja_JP.cp932)
1706 For example, "\x8bL\x98^" (translation of "record" in ja_JP.cp932)
1705 contains 0x4c (L). str.lower() replaces 0x4c(L) by 0x6c(l) and this
1707 contains 0x4c (L). str.lower() replaces 0x4c(L) by 0x6c(l) and this
1706 replacement makes message meaningless.
1708 replacement makes message meaningless.
1707
1709
1708 This tests that section lookup by translated string isn't broken by
1710 This tests that section lookup by translated string isn't broken by
1709 such str.lower().
1711 such str.lower().
1710
1712
1711 $ $PYTHON <<EOF
1713 $ $PYTHON <<EOF
1712 > def escape(s):
1714 > def escape(s):
1713 > return ''.join('\u%x' % ord(uc) for uc in s.decode('cp932'))
1715 > return ''.join('\u%x' % ord(uc) for uc in s.decode('cp932'))
1714 > # translation of "record" in ja_JP.cp932
1716 > # translation of "record" in ja_JP.cp932
1715 > upper = "\x8bL\x98^"
1717 > upper = "\x8bL\x98^"
1716 > # str.lower()-ed section name should be treated as different one
1718 > # str.lower()-ed section name should be treated as different one
1717 > lower = "\x8bl\x98^"
1719 > lower = "\x8bl\x98^"
1718 > with open('ambiguous.py', 'w') as fp:
1720 > with open('ambiguous.py', 'w') as fp:
1719 > fp.write("""# ambiguous section names in ja_JP.cp932
1721 > fp.write("""# ambiguous section names in ja_JP.cp932
1720 > u'''summary of extension
1722 > u'''summary of extension
1721 >
1723 >
1722 > %s
1724 > %s
1723 > ----
1725 > ----
1724 >
1726 >
1725 > Upper name should show only this message
1727 > Upper name should show only this message
1726 >
1728 >
1727 > %s
1729 > %s
1728 > ----
1730 > ----
1729 >
1731 >
1730 > Lower name should show only this message
1732 > Lower name should show only this message
1731 >
1733 >
1732 > subsequent section
1734 > subsequent section
1733 > ------------------
1735 > ------------------
1734 >
1736 >
1735 > This should be hidden at 'hg help ambiguous' with section name.
1737 > This should be hidden at 'hg help ambiguous' with section name.
1736 > '''
1738 > '''
1737 > """ % (escape(upper), escape(lower)))
1739 > """ % (escape(upper), escape(lower)))
1738 > EOF
1740 > EOF
1739
1741
1740 $ cat >> $HGRCPATH <<EOF
1742 $ cat >> $HGRCPATH <<EOF
1741 > [extensions]
1743 > [extensions]
1742 > ambiguous = ./ambiguous.py
1744 > ambiguous = ./ambiguous.py
1743 > EOF
1745 > EOF
1744
1746
1745 $ $PYTHON <<EOF | sh
1747 $ $PYTHON <<EOF | sh
1746 > upper = "\x8bL\x98^"
1748 > upper = "\x8bL\x98^"
1747 > print("hg --encoding cp932 help -e ambiguous.%s" % upper)
1749 > print("hg --encoding cp932 help -e ambiguous.%s" % upper)
1748 > EOF
1750 > EOF
1749 \x8bL\x98^ (esc)
1751 \x8bL\x98^ (esc)
1750 ----
1752 ----
1751
1753
1752 Upper name should show only this message
1754 Upper name should show only this message
1753
1755
1754
1756
1755 $ $PYTHON <<EOF | sh
1757 $ $PYTHON <<EOF | sh
1756 > lower = "\x8bl\x98^"
1758 > lower = "\x8bl\x98^"
1757 > print("hg --encoding cp932 help -e ambiguous.%s" % lower)
1759 > print("hg --encoding cp932 help -e ambiguous.%s" % lower)
1758 > EOF
1760 > EOF
1759 \x8bl\x98^ (esc)
1761 \x8bl\x98^ (esc)
1760 ----
1762 ----
1761
1763
1762 Lower name should show only this message
1764 Lower name should show only this message
1763
1765
1764
1766
1765 $ cat >> $HGRCPATH <<EOF
1767 $ cat >> $HGRCPATH <<EOF
1766 > [extensions]
1768 > [extensions]
1767 > ambiguous = !
1769 > ambiguous = !
1768 > EOF
1770 > EOF
1769
1771
1770 Show help content of disabled extensions
1772 Show help content of disabled extensions
1771
1773
1772 $ cat >> $HGRCPATH <<EOF
1774 $ cat >> $HGRCPATH <<EOF
1773 > [extensions]
1775 > [extensions]
1774 > ambiguous = !./ambiguous.py
1776 > ambiguous = !./ambiguous.py
1775 > EOF
1777 > EOF
1776 $ hg help -e ambiguous
1778 $ hg help -e ambiguous
1777 ambiguous extension - (no help text available)
1779 ambiguous extension - (no help text available)
1778
1780
1779 (use 'hg help extensions' for information on enabling extensions)
1781 (use 'hg help extensions' for information on enabling extensions)
1780
1782
1781 Test dynamic list of merge tools only shows up once
1783 Test dynamic list of merge tools only shows up once
1782 $ hg help merge-tools
1784 $ hg help merge-tools
1783 Merge Tools
1785 Merge Tools
1784 """""""""""
1786 """""""""""
1785
1787
1786 To merge files Mercurial uses merge tools.
1788 To merge files Mercurial uses merge tools.
1787
1789
1788 A merge tool combines two different versions of a file into a merged file.
1790 A merge tool combines two different versions of a file into a merged file.
1789 Merge tools are given the two files and the greatest common ancestor of
1791 Merge tools are given the two files and the greatest common ancestor of
1790 the two file versions, so they can determine the changes made on both
1792 the two file versions, so they can determine the changes made on both
1791 branches.
1793 branches.
1792
1794
1793 Merge tools are used both for 'hg resolve', 'hg merge', 'hg update', 'hg
1795 Merge tools are used both for 'hg resolve', 'hg merge', 'hg update', 'hg
1794 backout' and in several extensions.
1796 backout' and in several extensions.
1795
1797
1796 Usually, the merge tool tries to automatically reconcile the files by
1798 Usually, the merge tool tries to automatically reconcile the files by
1797 combining all non-overlapping changes that occurred separately in the two
1799 combining all non-overlapping changes that occurred separately in the two
1798 different evolutions of the same initial base file. Furthermore, some
1800 different evolutions of the same initial base file. Furthermore, some
1799 interactive merge programs make it easier to manually resolve conflicting
1801 interactive merge programs make it easier to manually resolve conflicting
1800 merges, either in a graphical way, or by inserting some conflict markers.
1802 merges, either in a graphical way, or by inserting some conflict markers.
1801 Mercurial does not include any interactive merge programs but relies on
1803 Mercurial does not include any interactive merge programs but relies on
1802 external tools for that.
1804 external tools for that.
1803
1805
1804 Available merge tools
1806 Available merge tools
1805 =====================
1807 =====================
1806
1808
1807 External merge tools and their properties are configured in the merge-
1809 External merge tools and their properties are configured in the merge-
1808 tools configuration section - see hgrc(5) - but they can often just be
1810 tools configuration section - see hgrc(5) - but they can often just be
1809 named by their executable.
1811 named by their executable.
1810
1812
1811 A merge tool is generally usable if its executable can be found on the
1813 A merge tool is generally usable if its executable can be found on the
1812 system and if it can handle the merge. The executable is found if it is an
1814 system and if it can handle the merge. The executable is found if it is an
1813 absolute or relative executable path or the name of an application in the
1815 absolute or relative executable path or the name of an application in the
1814 executable search path. The tool is assumed to be able to handle the merge
1816 executable search path. The tool is assumed to be able to handle the merge
1815 if it can handle symlinks if the file is a symlink, if it can handle
1817 if it can handle symlinks if the file is a symlink, if it can handle
1816 binary files if the file is binary, and if a GUI is available if the tool
1818 binary files if the file is binary, and if a GUI is available if the tool
1817 requires a GUI.
1819 requires a GUI.
1818
1820
1819 There are some internal merge tools which can be used. The internal merge
1821 There are some internal merge tools which can be used. The internal merge
1820 tools are:
1822 tools are:
1821
1823
1822 ":dump"
1824 ":dump"
1823 Creates three versions of the files to merge, containing the contents of
1825 Creates three versions of the files to merge, containing the contents of
1824 local, other and base. These files can then be used to perform a merge
1826 local, other and base. These files can then be used to perform a merge
1825 manually. If the file to be merged is named "a.txt", these files will
1827 manually. If the file to be merged is named "a.txt", these files will
1826 accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and
1828 accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and
1827 they will be placed in the same directory as "a.txt".
1829 they will be placed in the same directory as "a.txt".
1828
1830
1829 This implies premerge. Therefore, files aren't dumped, if premerge runs
1831 This implies premerge. Therefore, files aren't dumped, if premerge runs
1830 successfully. Use :forcedump to forcibly write files out.
1832 successfully. Use :forcedump to forcibly write files out.
1831
1833
1832 (actual capabilities: binary, symlink)
1834 (actual capabilities: binary, symlink)
1833
1835
1834 ":fail"
1836 ":fail"
1835 Rather than attempting to merge files that were modified on both
1837 Rather than attempting to merge files that were modified on both
1836 branches, it marks them as unresolved. The resolve command must be used
1838 branches, it marks them as unresolved. The resolve command must be used
1837 to resolve these conflicts.
1839 to resolve these conflicts.
1838
1840
1839 (actual capabilities: binary, symlink)
1841 (actual capabilities: binary, symlink)
1840
1842
1841 ":forcedump"
1843 ":forcedump"
1842 Creates three versions of the files as same as :dump, but omits
1844 Creates three versions of the files as same as :dump, but omits
1843 premerge.
1845 premerge.
1844
1846
1845 (actual capabilities: binary, symlink)
1847 (actual capabilities: binary, symlink)
1846
1848
1847 ":local"
1849 ":local"
1848 Uses the local 'p1()' version of files as the merged version.
1850 Uses the local 'p1()' version of files as the merged version.
1849
1851
1850 (actual capabilities: binary, symlink)
1852 (actual capabilities: binary, symlink)
1851
1853
1852 ":merge"
1854 ":merge"
1853 Uses the internal non-interactive simple merge algorithm for merging
1855 Uses the internal non-interactive simple merge algorithm for merging
1854 files. It will fail if there are any conflicts and leave markers in the
1856 files. It will fail if there are any conflicts and leave markers in the
1855 partially merged file. Markers will have two sections, one for each side
1857 partially merged file. Markers will have two sections, one for each side
1856 of merge.
1858 of merge.
1857
1859
1858 ":merge-local"
1860 ":merge-local"
1859 Like :merge, but resolve all conflicts non-interactively in favor of the
1861 Like :merge, but resolve all conflicts non-interactively in favor of the
1860 local 'p1()' changes.
1862 local 'p1()' changes.
1861
1863
1862 ":merge-other"
1864 ":merge-other"
1863 Like :merge, but resolve all conflicts non-interactively in favor of the
1865 Like :merge, but resolve all conflicts non-interactively in favor of the
1864 other 'p2()' changes.
1866 other 'p2()' changes.
1865
1867
1866 ":merge3"
1868 ":merge3"
1867 Uses the internal non-interactive simple merge algorithm for merging
1869 Uses the internal non-interactive simple merge algorithm for merging
1868 files. It will fail if there are any conflicts and leave markers in the
1870 files. It will fail if there are any conflicts and leave markers in the
1869 partially merged file. Marker will have three sections, one from each
1871 partially merged file. Marker will have three sections, one from each
1870 side of the merge and one for the base content.
1872 side of the merge and one for the base content.
1871
1873
1872 ":other"
1874 ":other"
1873 Uses the other 'p2()' version of files as the merged version.
1875 Uses the other 'p2()' version of files as the merged version.
1874
1876
1875 (actual capabilities: binary, symlink)
1877 (actual capabilities: binary, symlink)
1876
1878
1877 ":prompt"
1879 ":prompt"
1878 Asks the user which of the local 'p1()' or the other 'p2()' version to
1880 Asks the user which of the local 'p1()' or the other 'p2()' version to
1879 keep as the merged version.
1881 keep as the merged version.
1880
1882
1881 (actual capabilities: binary, symlink)
1883 (actual capabilities: binary, symlink)
1882
1884
1883 ":tagmerge"
1885 ":tagmerge"
1884 Uses the internal tag merge algorithm (experimental).
1886 Uses the internal tag merge algorithm (experimental).
1885
1887
1886 ":union"
1888 ":union"
1887 Uses the internal non-interactive simple merge algorithm for merging
1889 Uses the internal non-interactive simple merge algorithm for merging
1888 files. It will use both left and right sides for conflict regions. No
1890 files. It will use both left and right sides for conflict regions. No
1889 markers are inserted.
1891 markers are inserted.
1890
1892
1891 Internal tools are always available and do not require a GUI but will by
1893 Internal tools are always available and do not require a GUI but will by
1892 default not handle symlinks or binary files. See next section for detail
1894 default not handle symlinks or binary files. See next section for detail
1893 about "actual capabilities" described above.
1895 about "actual capabilities" described above.
1894
1896
1895 Choosing a merge tool
1897 Choosing a merge tool
1896 =====================
1898 =====================
1897
1899
1898 Mercurial uses these rules when deciding which merge tool to use:
1900 Mercurial uses these rules when deciding which merge tool to use:
1899
1901
1900 1. If a tool has been specified with the --tool option to merge or
1902 1. If a tool has been specified with the --tool option to merge or
1901 resolve, it is used. If it is the name of a tool in the merge-tools
1903 resolve, it is used. If it is the name of a tool in the merge-tools
1902 configuration, its configuration is used. Otherwise the specified tool
1904 configuration, its configuration is used. Otherwise the specified tool
1903 must be executable by the shell.
1905 must be executable by the shell.
1904 2. If the "HGMERGE" environment variable is present, its value is used and
1906 2. If the "HGMERGE" environment variable is present, its value is used and
1905 must be executable by the shell.
1907 must be executable by the shell.
1906 3. If the filename of the file to be merged matches any of the patterns in
1908 3. If the filename of the file to be merged matches any of the patterns in
1907 the merge-patterns configuration section, the first usable merge tool
1909 the merge-patterns configuration section, the first usable merge tool
1908 corresponding to a matching pattern is used.
1910 corresponding to a matching pattern is used.
1909 4. If ui.merge is set it will be considered next. If the value is not the
1911 4. If ui.merge is set it will be considered next. If the value is not the
1910 name of a configured tool, the specified value is used and must be
1912 name of a configured tool, the specified value is used and must be
1911 executable by the shell. Otherwise the named tool is used if it is
1913 executable by the shell. Otherwise the named tool is used if it is
1912 usable.
1914 usable.
1913 5. If any usable merge tools are present in the merge-tools configuration
1915 5. If any usable merge tools are present in the merge-tools configuration
1914 section, the one with the highest priority is used.
1916 section, the one with the highest priority is used.
1915 6. If a program named "hgmerge" can be found on the system, it is used -
1917 6. If a program named "hgmerge" can be found on the system, it is used -
1916 but it will by default not be used for symlinks and binary files.
1918 but it will by default not be used for symlinks and binary files.
1917 7. If the file to be merged is not binary and is not a symlink, then
1919 7. If the file to be merged is not binary and is not a symlink, then
1918 internal ":merge" is used.
1920 internal ":merge" is used.
1919 8. Otherwise, ":prompt" is used.
1921 8. Otherwise, ":prompt" is used.
1920
1922
1921 For historical reason, Mercurial treats merge tools as below while
1923 For historical reason, Mercurial treats merge tools as below while
1922 examining rules above.
1924 examining rules above.
1923
1925
1924 step specified via binary symlink
1926 step specified via binary symlink
1925 ----------------------------------
1927 ----------------------------------
1926 1. --tool o/o o/o
1928 1. --tool o/o o/o
1927 2. HGMERGE o/o o/o
1929 2. HGMERGE o/o o/o
1928 3. merge-patterns o/o(*) x/?(*)
1930 3. merge-patterns o/o(*) x/?(*)
1929 4. ui.merge x/?(*) x/?(*)
1931 4. ui.merge x/?(*) x/?(*)
1930
1932
1931 Each capability column indicates Mercurial behavior for internal/external
1933 Each capability column indicates Mercurial behavior for internal/external
1932 merge tools at examining each rule.
1934 merge tools at examining each rule.
1933
1935
1934 - "o": "assume that a tool has capability"
1936 - "o": "assume that a tool has capability"
1935 - "x": "assume that a tool does not have capability"
1937 - "x": "assume that a tool does not have capability"
1936 - "?": "check actual capability of a tool"
1938 - "?": "check actual capability of a tool"
1937
1939
1938 If "merge.strict-capability-check" configuration is true, Mercurial checks
1940 If "merge.strict-capability-check" configuration is true, Mercurial checks
1939 capabilities of merge tools strictly in (*) cases above (= each capability
1941 capabilities of merge tools strictly in (*) cases above (= each capability
1940 column becomes "?/?"). It is false by default for backward compatibility.
1942 column becomes "?/?"). It is false by default for backward compatibility.
1941
1943
1942 Note:
1944 Note:
1943 After selecting a merge program, Mercurial will by default attempt to
1945 After selecting a merge program, Mercurial will by default attempt to
1944 merge the files using a simple merge algorithm first. Only if it
1946 merge the files using a simple merge algorithm first. Only if it
1945 doesn't succeed because of conflicting changes will Mercurial actually
1947 doesn't succeed because of conflicting changes will Mercurial actually
1946 execute the merge program. Whether to use the simple merge algorithm
1948 execute the merge program. Whether to use the simple merge algorithm
1947 first can be controlled by the premerge setting of the merge tool.
1949 first can be controlled by the premerge setting of the merge tool.
1948 Premerge is enabled by default unless the file is binary or a symlink.
1950 Premerge is enabled by default unless the file is binary or a symlink.
1949
1951
1950 See the merge-tools and ui sections of hgrc(5) for details on the
1952 See the merge-tools and ui sections of hgrc(5) for details on the
1951 configuration of merge tools.
1953 configuration of merge tools.
1952
1954
1953 Compression engines listed in `hg help bundlespec`
1955 Compression engines listed in `hg help bundlespec`
1954
1956
1955 $ hg help bundlespec | grep gzip
1957 $ hg help bundlespec | grep gzip
1956 "v1" bundles can only use the "gzip", "bzip2", and "none" compression
1958 "v1" bundles can only use the "gzip", "bzip2", and "none" compression
1957 An algorithm that produces smaller bundles than "gzip".
1959 An algorithm that produces smaller bundles than "gzip".
1958 This engine will likely produce smaller bundles than "gzip" but will be
1960 This engine will likely produce smaller bundles than "gzip" but will be
1959 "gzip"
1961 "gzip"
1960 better compression than "gzip". It also frequently yields better (?)
1962 better compression than "gzip". It also frequently yields better (?)
1961
1963
1962 Test usage of section marks in help documents
1964 Test usage of section marks in help documents
1963
1965
1964 $ cd "$TESTDIR"/../doc
1966 $ cd "$TESTDIR"/../doc
1965 $ $PYTHON check-seclevel.py
1967 $ $PYTHON check-seclevel.py
1966 $ cd $TESTTMP
1968 $ cd $TESTTMP
1967
1969
1968 #if serve
1970 #if serve
1969
1971
1970 Test the help pages in hgweb.
1972 Test the help pages in hgweb.
1971
1973
1972 Dish up an empty repo; serve it cold.
1974 Dish up an empty repo; serve it cold.
1973
1975
1974 $ hg init "$TESTTMP/test"
1976 $ hg init "$TESTTMP/test"
1975 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
1977 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
1976 $ cat hg.pid >> $DAEMON_PIDS
1978 $ cat hg.pid >> $DAEMON_PIDS
1977
1979
1978 $ get-with-headers.py $LOCALIP:$HGPORT "help"
1980 $ get-with-headers.py $LOCALIP:$HGPORT "help"
1979 200 Script output follows
1981 200 Script output follows
1980
1982
1981 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1983 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1982 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1984 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1983 <head>
1985 <head>
1984 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1986 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1985 <meta name="robots" content="index, nofollow" />
1987 <meta name="robots" content="index, nofollow" />
1986 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1988 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1987 <script type="text/javascript" src="/static/mercurial.js"></script>
1989 <script type="text/javascript" src="/static/mercurial.js"></script>
1988
1990
1989 <title>Help: Index</title>
1991 <title>Help: Index</title>
1990 </head>
1992 </head>
1991 <body>
1993 <body>
1992
1994
1993 <div class="container">
1995 <div class="container">
1994 <div class="menu">
1996 <div class="menu">
1995 <div class="logo">
1997 <div class="logo">
1996 <a href="https://mercurial-scm.org/">
1998 <a href="https://mercurial-scm.org/">
1997 <img src="/static/hglogo.png" alt="mercurial" /></a>
1999 <img src="/static/hglogo.png" alt="mercurial" /></a>
1998 </div>
2000 </div>
1999 <ul>
2001 <ul>
2000 <li><a href="/shortlog">log</a></li>
2002 <li><a href="/shortlog">log</a></li>
2001 <li><a href="/graph">graph</a></li>
2003 <li><a href="/graph">graph</a></li>
2002 <li><a href="/tags">tags</a></li>
2004 <li><a href="/tags">tags</a></li>
2003 <li><a href="/bookmarks">bookmarks</a></li>
2005 <li><a href="/bookmarks">bookmarks</a></li>
2004 <li><a href="/branches">branches</a></li>
2006 <li><a href="/branches">branches</a></li>
2005 </ul>
2007 </ul>
2006 <ul>
2008 <ul>
2007 <li class="active">help</li>
2009 <li class="active">help</li>
2008 </ul>
2010 </ul>
2009 </div>
2011 </div>
2010
2012
2011 <div class="main">
2013 <div class="main">
2012 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2014 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2013
2015
2014 <form class="search" action="/log">
2016 <form class="search" action="/log">
2015
2017
2016 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2018 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2017 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2019 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2018 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2020 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2019 </form>
2021 </form>
2020 <table class="bigtable">
2022 <table class="bigtable">
2021 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
2023 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
2022
2024
2023 <tr><td>
2025 <tr><td>
2024 <a href="/help/bundlespec">
2026 <a href="/help/bundlespec">
2025 bundlespec
2027 bundlespec
2026 </a>
2028 </a>
2027 </td><td>
2029 </td><td>
2028 Bundle File Formats
2030 Bundle File Formats
2029 </td></tr>
2031 </td></tr>
2030 <tr><td>
2032 <tr><td>
2031 <a href="/help/color">
2033 <a href="/help/color">
2032 color
2034 color
2033 </a>
2035 </a>
2034 </td><td>
2036 </td><td>
2035 Colorizing Outputs
2037 Colorizing Outputs
2036 </td></tr>
2038 </td></tr>
2037 <tr><td>
2039 <tr><td>
2038 <a href="/help/config">
2040 <a href="/help/config">
2039 config
2041 config
2040 </a>
2042 </a>
2041 </td><td>
2043 </td><td>
2042 Configuration Files
2044 Configuration Files
2043 </td></tr>
2045 </td></tr>
2044 <tr><td>
2046 <tr><td>
2045 <a href="/help/dates">
2047 <a href="/help/dates">
2046 dates
2048 dates
2047 </a>
2049 </a>
2048 </td><td>
2050 </td><td>
2049 Date Formats
2051 Date Formats
2050 </td></tr>
2052 </td></tr>
2051 <tr><td>
2053 <tr><td>
2052 <a href="/help/deprecated">
2054 <a href="/help/deprecated">
2053 deprecated
2055 deprecated
2054 </a>
2056 </a>
2055 </td><td>
2057 </td><td>
2056 Deprecated Features
2058 Deprecated Features
2057 </td></tr>
2059 </td></tr>
2058 <tr><td>
2060 <tr><td>
2059 <a href="/help/diffs">
2061 <a href="/help/diffs">
2060 diffs
2062 diffs
2061 </a>
2063 </a>
2062 </td><td>
2064 </td><td>
2063 Diff Formats
2065 Diff Formats
2064 </td></tr>
2066 </td></tr>
2065 <tr><td>
2067 <tr><td>
2066 <a href="/help/environment">
2068 <a href="/help/environment">
2067 environment
2069 environment
2068 </a>
2070 </a>
2069 </td><td>
2071 </td><td>
2070 Environment Variables
2072 Environment Variables
2071 </td></tr>
2073 </td></tr>
2072 <tr><td>
2074 <tr><td>
2073 <a href="/help/extensions">
2075 <a href="/help/extensions">
2074 extensions
2076 extensions
2075 </a>
2077 </a>
2076 </td><td>
2078 </td><td>
2077 Using Additional Features
2079 Using Additional Features
2078 </td></tr>
2080 </td></tr>
2079 <tr><td>
2081 <tr><td>
2080 <a href="/help/filesets">
2082 <a href="/help/filesets">
2081 filesets
2083 filesets
2082 </a>
2084 </a>
2083 </td><td>
2085 </td><td>
2084 Specifying File Sets
2086 Specifying File Sets
2085 </td></tr>
2087 </td></tr>
2086 <tr><td>
2088 <tr><td>
2087 <a href="/help/flags">
2089 <a href="/help/flags">
2088 flags
2090 flags
2089 </a>
2091 </a>
2090 </td><td>
2092 </td><td>
2091 Command-line flags
2093 Command-line flags
2092 </td></tr>
2094 </td></tr>
2093 <tr><td>
2095 <tr><td>
2094 <a href="/help/glossary">
2096 <a href="/help/glossary">
2095 glossary
2097 glossary
2096 </a>
2098 </a>
2097 </td><td>
2099 </td><td>
2098 Glossary
2100 Glossary
2099 </td></tr>
2101 </td></tr>
2100 <tr><td>
2102 <tr><td>
2101 <a href="/help/hgignore">
2103 <a href="/help/hgignore">
2102 hgignore
2104 hgignore
2103 </a>
2105 </a>
2104 </td><td>
2106 </td><td>
2105 Syntax for Mercurial Ignore Files
2107 Syntax for Mercurial Ignore Files
2106 </td></tr>
2108 </td></tr>
2107 <tr><td>
2109 <tr><td>
2108 <a href="/help/hgweb">
2110 <a href="/help/hgweb">
2109 hgweb
2111 hgweb
2110 </a>
2112 </a>
2111 </td><td>
2113 </td><td>
2112 Configuring hgweb
2114 Configuring hgweb
2113 </td></tr>
2115 </td></tr>
2114 <tr><td>
2116 <tr><td>
2115 <a href="/help/internals">
2117 <a href="/help/internals">
2116 internals
2118 internals
2117 </a>
2119 </a>
2118 </td><td>
2120 </td><td>
2119 Technical implementation topics
2121 Technical implementation topics
2120 </td></tr>
2122 </td></tr>
2121 <tr><td>
2123 <tr><td>
2122 <a href="/help/merge-tools">
2124 <a href="/help/merge-tools">
2123 merge-tools
2125 merge-tools
2124 </a>
2126 </a>
2125 </td><td>
2127 </td><td>
2126 Merge Tools
2128 Merge Tools
2127 </td></tr>
2129 </td></tr>
2128 <tr><td>
2130 <tr><td>
2129 <a href="/help/pager">
2131 <a href="/help/pager">
2130 pager
2132 pager
2131 </a>
2133 </a>
2132 </td><td>
2134 </td><td>
2133 Pager Support
2135 Pager Support
2134 </td></tr>
2136 </td></tr>
2135 <tr><td>
2137 <tr><td>
2136 <a href="/help/patterns">
2138 <a href="/help/patterns">
2137 patterns
2139 patterns
2138 </a>
2140 </a>
2139 </td><td>
2141 </td><td>
2140 File Name Patterns
2142 File Name Patterns
2141 </td></tr>
2143 </td></tr>
2142 <tr><td>
2144 <tr><td>
2143 <a href="/help/phases">
2145 <a href="/help/phases">
2144 phases
2146 phases
2145 </a>
2147 </a>
2146 </td><td>
2148 </td><td>
2147 Working with Phases
2149 Working with Phases
2148 </td></tr>
2150 </td></tr>
2149 <tr><td>
2151 <tr><td>
2150 <a href="/help/revisions">
2152 <a href="/help/revisions">
2151 revisions
2153 revisions
2152 </a>
2154 </a>
2153 </td><td>
2155 </td><td>
2154 Specifying Revisions
2156 Specifying Revisions
2155 </td></tr>
2157 </td></tr>
2156 <tr><td>
2158 <tr><td>
2157 <a href="/help/scripting">
2159 <a href="/help/scripting">
2158 scripting
2160 scripting
2159 </a>
2161 </a>
2160 </td><td>
2162 </td><td>
2161 Using Mercurial from scripts and automation
2163 Using Mercurial from scripts and automation
2162 </td></tr>
2164 </td></tr>
2163 <tr><td>
2165 <tr><td>
2164 <a href="/help/subrepos">
2166 <a href="/help/subrepos">
2165 subrepos
2167 subrepos
2166 </a>
2168 </a>
2167 </td><td>
2169 </td><td>
2168 Subrepositories
2170 Subrepositories
2169 </td></tr>
2171 </td></tr>
2170 <tr><td>
2172 <tr><td>
2171 <a href="/help/templating">
2173 <a href="/help/templating">
2172 templating
2174 templating
2173 </a>
2175 </a>
2174 </td><td>
2176 </td><td>
2175 Template Usage
2177 Template Usage
2176 </td></tr>
2178 </td></tr>
2177 <tr><td>
2179 <tr><td>
2178 <a href="/help/urls">
2180 <a href="/help/urls">
2179 urls
2181 urls
2180 </a>
2182 </a>
2181 </td><td>
2183 </td><td>
2182 URL Paths
2184 URL Paths
2183 </td></tr>
2185 </td></tr>
2184 <tr><td>
2186 <tr><td>
2185 <a href="/help/topic-containing-verbose">
2187 <a href="/help/topic-containing-verbose">
2186 topic-containing-verbose
2188 topic-containing-verbose
2187 </a>
2189 </a>
2188 </td><td>
2190 </td><td>
2189 This is the topic to test omit indicating.
2191 This is the topic to test omit indicating.
2190 </td></tr>
2192 </td></tr>
2191
2193
2192
2194
2193 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
2195 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
2194
2196
2195 <tr><td>
2197 <tr><td>
2196 <a href="/help/add">
2198 <a href="/help/add">
2197 add
2199 add
2198 </a>
2200 </a>
2199 </td><td>
2201 </td><td>
2200 add the specified files on the next commit
2202 add the specified files on the next commit
2201 </td></tr>
2203 </td></tr>
2202 <tr><td>
2204 <tr><td>
2203 <a href="/help/annotate">
2205 <a href="/help/annotate">
2204 annotate
2206 annotate
2205 </a>
2207 </a>
2206 </td><td>
2208 </td><td>
2207 show changeset information by line for each file
2209 show changeset information by line for each file
2208 </td></tr>
2210 </td></tr>
2209 <tr><td>
2211 <tr><td>
2210 <a href="/help/clone">
2212 <a href="/help/clone">
2211 clone
2213 clone
2212 </a>
2214 </a>
2213 </td><td>
2215 </td><td>
2214 make a copy of an existing repository
2216 make a copy of an existing repository
2215 </td></tr>
2217 </td></tr>
2216 <tr><td>
2218 <tr><td>
2217 <a href="/help/commit">
2219 <a href="/help/commit">
2218 commit
2220 commit
2219 </a>
2221 </a>
2220 </td><td>
2222 </td><td>
2221 commit the specified files or all outstanding changes
2223 commit the specified files or all outstanding changes
2222 </td></tr>
2224 </td></tr>
2223 <tr><td>
2225 <tr><td>
2224 <a href="/help/diff">
2226 <a href="/help/diff">
2225 diff
2227 diff
2226 </a>
2228 </a>
2227 </td><td>
2229 </td><td>
2228 diff repository (or selected files)
2230 diff repository (or selected files)
2229 </td></tr>
2231 </td></tr>
2230 <tr><td>
2232 <tr><td>
2231 <a href="/help/export">
2233 <a href="/help/export">
2232 export
2234 export
2233 </a>
2235 </a>
2234 </td><td>
2236 </td><td>
2235 dump the header and diffs for one or more changesets
2237 dump the header and diffs for one or more changesets
2236 </td></tr>
2238 </td></tr>
2237 <tr><td>
2239 <tr><td>
2238 <a href="/help/forget">
2240 <a href="/help/forget">
2239 forget
2241 forget
2240 </a>
2242 </a>
2241 </td><td>
2243 </td><td>
2242 forget the specified files on the next commit
2244 forget the specified files on the next commit
2243 </td></tr>
2245 </td></tr>
2244 <tr><td>
2246 <tr><td>
2245 <a href="/help/init">
2247 <a href="/help/init">
2246 init
2248 init
2247 </a>
2249 </a>
2248 </td><td>
2250 </td><td>
2249 create a new repository in the given directory
2251 create a new repository in the given directory
2250 </td></tr>
2252 </td></tr>
2251 <tr><td>
2253 <tr><td>
2252 <a href="/help/log">
2254 <a href="/help/log">
2253 log
2255 log
2254 </a>
2256 </a>
2255 </td><td>
2257 </td><td>
2256 show revision history of entire repository or files
2258 show revision history of entire repository or files
2257 </td></tr>
2259 </td></tr>
2258 <tr><td>
2260 <tr><td>
2259 <a href="/help/merge">
2261 <a href="/help/merge">
2260 merge
2262 merge
2261 </a>
2263 </a>
2262 </td><td>
2264 </td><td>
2263 merge another revision into working directory
2265 merge another revision into working directory
2264 </td></tr>
2266 </td></tr>
2265 <tr><td>
2267 <tr><td>
2266 <a href="/help/pull">
2268 <a href="/help/pull">
2267 pull
2269 pull
2268 </a>
2270 </a>
2269 </td><td>
2271 </td><td>
2270 pull changes from the specified source
2272 pull changes from the specified source
2271 </td></tr>
2273 </td></tr>
2272 <tr><td>
2274 <tr><td>
2273 <a href="/help/push">
2275 <a href="/help/push">
2274 push
2276 push
2275 </a>
2277 </a>
2276 </td><td>
2278 </td><td>
2277 push changes to the specified destination
2279 push changes to the specified destination
2278 </td></tr>
2280 </td></tr>
2279 <tr><td>
2281 <tr><td>
2280 <a href="/help/remove">
2282 <a href="/help/remove">
2281 remove
2283 remove
2282 </a>
2284 </a>
2283 </td><td>
2285 </td><td>
2284 remove the specified files on the next commit
2286 remove the specified files on the next commit
2285 </td></tr>
2287 </td></tr>
2286 <tr><td>
2288 <tr><td>
2287 <a href="/help/serve">
2289 <a href="/help/serve">
2288 serve
2290 serve
2289 </a>
2291 </a>
2290 </td><td>
2292 </td><td>
2291 start stand-alone webserver
2293 start stand-alone webserver
2292 </td></tr>
2294 </td></tr>
2293 <tr><td>
2295 <tr><td>
2294 <a href="/help/status">
2296 <a href="/help/status">
2295 status
2297 status
2296 </a>
2298 </a>
2297 </td><td>
2299 </td><td>
2298 show changed files in the working directory
2300 show changed files in the working directory
2299 </td></tr>
2301 </td></tr>
2300 <tr><td>
2302 <tr><td>
2301 <a href="/help/summary">
2303 <a href="/help/summary">
2302 summary
2304 summary
2303 </a>
2305 </a>
2304 </td><td>
2306 </td><td>
2305 summarize working directory state
2307 summarize working directory state
2306 </td></tr>
2308 </td></tr>
2307 <tr><td>
2309 <tr><td>
2308 <a href="/help/update">
2310 <a href="/help/update">
2309 update
2311 update
2310 </a>
2312 </a>
2311 </td><td>
2313 </td><td>
2312 update working directory (or switch revisions)
2314 update working directory (or switch revisions)
2313 </td></tr>
2315 </td></tr>
2314
2316
2315
2317
2316
2318
2317 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
2319 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
2318
2320
2319 <tr><td>
2321 <tr><td>
2320 <a href="/help/addremove">
2322 <a href="/help/addremove">
2321 addremove
2323 addremove
2322 </a>
2324 </a>
2323 </td><td>
2325 </td><td>
2324 add all new files, delete all missing files
2326 add all new files, delete all missing files
2325 </td></tr>
2327 </td></tr>
2326 <tr><td>
2328 <tr><td>
2327 <a href="/help/archive">
2329 <a href="/help/archive">
2328 archive
2330 archive
2329 </a>
2331 </a>
2330 </td><td>
2332 </td><td>
2331 create an unversioned archive of a repository revision
2333 create an unversioned archive of a repository revision
2332 </td></tr>
2334 </td></tr>
2333 <tr><td>
2335 <tr><td>
2334 <a href="/help/backout">
2336 <a href="/help/backout">
2335 backout
2337 backout
2336 </a>
2338 </a>
2337 </td><td>
2339 </td><td>
2338 reverse effect of earlier changeset
2340 reverse effect of earlier changeset
2339 </td></tr>
2341 </td></tr>
2340 <tr><td>
2342 <tr><td>
2341 <a href="/help/bisect">
2343 <a href="/help/bisect">
2342 bisect
2344 bisect
2343 </a>
2345 </a>
2344 </td><td>
2346 </td><td>
2345 subdivision search of changesets
2347 subdivision search of changesets
2346 </td></tr>
2348 </td></tr>
2347 <tr><td>
2349 <tr><td>
2348 <a href="/help/bookmarks">
2350 <a href="/help/bookmarks">
2349 bookmarks
2351 bookmarks
2350 </a>
2352 </a>
2351 </td><td>
2353 </td><td>
2352 create a new bookmark or list existing bookmarks
2354 create a new bookmark or list existing bookmarks
2353 </td></tr>
2355 </td></tr>
2354 <tr><td>
2356 <tr><td>
2355 <a href="/help/branch">
2357 <a href="/help/branch">
2356 branch
2358 branch
2357 </a>
2359 </a>
2358 </td><td>
2360 </td><td>
2359 set or show the current branch name
2361 set or show the current branch name
2360 </td></tr>
2362 </td></tr>
2361 <tr><td>
2363 <tr><td>
2362 <a href="/help/branches">
2364 <a href="/help/branches">
2363 branches
2365 branches
2364 </a>
2366 </a>
2365 </td><td>
2367 </td><td>
2366 list repository named branches
2368 list repository named branches
2367 </td></tr>
2369 </td></tr>
2368 <tr><td>
2370 <tr><td>
2369 <a href="/help/bundle">
2371 <a href="/help/bundle">
2370 bundle
2372 bundle
2371 </a>
2373 </a>
2372 </td><td>
2374 </td><td>
2373 create a bundle file
2375 create a bundle file
2374 </td></tr>
2376 </td></tr>
2375 <tr><td>
2377 <tr><td>
2376 <a href="/help/cat">
2378 <a href="/help/cat">
2377 cat
2379 cat
2378 </a>
2380 </a>
2379 </td><td>
2381 </td><td>
2380 output the current or given revision of files
2382 output the current or given revision of files
2381 </td></tr>
2383 </td></tr>
2382 <tr><td>
2384 <tr><td>
2383 <a href="/help/config">
2385 <a href="/help/config">
2384 config
2386 config
2385 </a>
2387 </a>
2386 </td><td>
2388 </td><td>
2387 show combined config settings from all hgrc files
2389 show combined config settings from all hgrc files
2388 </td></tr>
2390 </td></tr>
2389 <tr><td>
2391 <tr><td>
2390 <a href="/help/copy">
2392 <a href="/help/copy">
2391 copy
2393 copy
2392 </a>
2394 </a>
2393 </td><td>
2395 </td><td>
2394 mark files as copied for the next commit
2396 mark files as copied for the next commit
2395 </td></tr>
2397 </td></tr>
2396 <tr><td>
2398 <tr><td>
2397 <a href="/help/files">
2399 <a href="/help/files">
2398 files
2400 files
2399 </a>
2401 </a>
2400 </td><td>
2402 </td><td>
2401 list tracked files
2403 list tracked files
2402 </td></tr>
2404 </td></tr>
2403 <tr><td>
2405 <tr><td>
2404 <a href="/help/graft">
2406 <a href="/help/graft">
2405 graft
2407 graft
2406 </a>
2408 </a>
2407 </td><td>
2409 </td><td>
2408 copy changes from other branches onto the current branch
2410 copy changes from other branches onto the current branch
2409 </td></tr>
2411 </td></tr>
2410 <tr><td>
2412 <tr><td>
2411 <a href="/help/grep">
2413 <a href="/help/grep">
2412 grep
2414 grep
2413 </a>
2415 </a>
2414 </td><td>
2416 </td><td>
2415 search revision history for a pattern in specified files
2417 search revision history for a pattern in specified files
2416 </td></tr>
2418 </td></tr>
2417 <tr><td>
2419 <tr><td>
2418 <a href="/help/heads">
2420 <a href="/help/heads">
2419 heads
2421 heads
2420 </a>
2422 </a>
2421 </td><td>
2423 </td><td>
2422 show branch heads
2424 show branch heads
2423 </td></tr>
2425 </td></tr>
2424 <tr><td>
2426 <tr><td>
2425 <a href="/help/help">
2427 <a href="/help/help">
2426 help
2428 help
2427 </a>
2429 </a>
2428 </td><td>
2430 </td><td>
2429 show help for a given topic or a help overview
2431 show help for a given topic or a help overview
2430 </td></tr>
2432 </td></tr>
2431 <tr><td>
2433 <tr><td>
2432 <a href="/help/hgalias">
2434 <a href="/help/hgalias">
2433 hgalias
2435 hgalias
2434 </a>
2436 </a>
2435 </td><td>
2437 </td><td>
2436 summarize working directory state
2438 summarize working directory state
2437 </td></tr>
2439 </td></tr>
2438 <tr><td>
2440 <tr><td>
2439 <a href="/help/identify">
2441 <a href="/help/identify">
2440 identify
2442 identify
2441 </a>
2443 </a>
2442 </td><td>
2444 </td><td>
2443 identify the working directory or specified revision
2445 identify the working directory or specified revision
2444 </td></tr>
2446 </td></tr>
2445 <tr><td>
2447 <tr><td>
2446 <a href="/help/import">
2448 <a href="/help/import">
2447 import
2449 import
2448 </a>
2450 </a>
2449 </td><td>
2451 </td><td>
2450 import an ordered set of patches
2452 import an ordered set of patches
2451 </td></tr>
2453 </td></tr>
2452 <tr><td>
2454 <tr><td>
2453 <a href="/help/incoming">
2455 <a href="/help/incoming">
2454 incoming
2456 incoming
2455 </a>
2457 </a>
2456 </td><td>
2458 </td><td>
2457 show new changesets found in source
2459 show new changesets found in source
2458 </td></tr>
2460 </td></tr>
2459 <tr><td>
2461 <tr><td>
2460 <a href="/help/manifest">
2462 <a href="/help/manifest">
2461 manifest
2463 manifest
2462 </a>
2464 </a>
2463 </td><td>
2465 </td><td>
2464 output the current or given revision of the project manifest
2466 output the current or given revision of the project manifest
2465 </td></tr>
2467 </td></tr>
2466 <tr><td>
2468 <tr><td>
2467 <a href="/help/nohelp">
2469 <a href="/help/nohelp">
2468 nohelp
2470 nohelp
2469 </a>
2471 </a>
2470 </td><td>
2472 </td><td>
2471 (no help text available)
2473 (no help text available)
2472 </td></tr>
2474 </td></tr>
2473 <tr><td>
2475 <tr><td>
2474 <a href="/help/outgoing">
2476 <a href="/help/outgoing">
2475 outgoing
2477 outgoing
2476 </a>
2478 </a>
2477 </td><td>
2479 </td><td>
2478 show changesets not found in the destination
2480 show changesets not found in the destination
2479 </td></tr>
2481 </td></tr>
2480 <tr><td>
2482 <tr><td>
2481 <a href="/help/paths">
2483 <a href="/help/paths">
2482 paths
2484 paths
2483 </a>
2485 </a>
2484 </td><td>
2486 </td><td>
2485 show aliases for remote repositories
2487 show aliases for remote repositories
2486 </td></tr>
2488 </td></tr>
2487 <tr><td>
2489 <tr><td>
2488 <a href="/help/phase">
2490 <a href="/help/phase">
2489 phase
2491 phase
2490 </a>
2492 </a>
2491 </td><td>
2493 </td><td>
2492 set or show the current phase name
2494 set or show the current phase name
2493 </td></tr>
2495 </td></tr>
2494 <tr><td>
2496 <tr><td>
2495 <a href="/help/recover">
2497 <a href="/help/recover">
2496 recover
2498 recover
2497 </a>
2499 </a>
2498 </td><td>
2500 </td><td>
2499 roll back an interrupted transaction
2501 roll back an interrupted transaction
2500 </td></tr>
2502 </td></tr>
2501 <tr><td>
2503 <tr><td>
2502 <a href="/help/rename">
2504 <a href="/help/rename">
2503 rename
2505 rename
2504 </a>
2506 </a>
2505 </td><td>
2507 </td><td>
2506 rename files; equivalent of copy + remove
2508 rename files; equivalent of copy + remove
2507 </td></tr>
2509 </td></tr>
2508 <tr><td>
2510 <tr><td>
2509 <a href="/help/resolve">
2511 <a href="/help/resolve">
2510 resolve
2512 resolve
2511 </a>
2513 </a>
2512 </td><td>
2514 </td><td>
2513 redo merges or set/view the merge status of files
2515 redo merges or set/view the merge status of files
2514 </td></tr>
2516 </td></tr>
2515 <tr><td>
2517 <tr><td>
2516 <a href="/help/revert">
2518 <a href="/help/revert">
2517 revert
2519 revert
2518 </a>
2520 </a>
2519 </td><td>
2521 </td><td>
2520 restore files to their checkout state
2522 restore files to their checkout state
2521 </td></tr>
2523 </td></tr>
2522 <tr><td>
2524 <tr><td>
2523 <a href="/help/root">
2525 <a href="/help/root">
2524 root
2526 root
2525 </a>
2527 </a>
2526 </td><td>
2528 </td><td>
2527 print the root (top) of the current working directory
2529 print the root (top) of the current working directory
2528 </td></tr>
2530 </td></tr>
2529 <tr><td>
2531 <tr><td>
2530 <a href="/help/shellalias">
2532 <a href="/help/shellalias">
2531 shellalias
2533 shellalias
2532 </a>
2534 </a>
2533 </td><td>
2535 </td><td>
2534 (no help text available)
2536 (no help text available)
2535 </td></tr>
2537 </td></tr>
2536 <tr><td>
2538 <tr><td>
2537 <a href="/help/tag">
2539 <a href="/help/tag">
2538 tag
2540 tag
2539 </a>
2541 </a>
2540 </td><td>
2542 </td><td>
2541 add one or more tags for the current or given revision
2543 add one or more tags for the current or given revision
2542 </td></tr>
2544 </td></tr>
2543 <tr><td>
2545 <tr><td>
2544 <a href="/help/tags">
2546 <a href="/help/tags">
2545 tags
2547 tags
2546 </a>
2548 </a>
2547 </td><td>
2549 </td><td>
2548 list repository tags
2550 list repository tags
2549 </td></tr>
2551 </td></tr>
2550 <tr><td>
2552 <tr><td>
2551 <a href="/help/unbundle">
2553 <a href="/help/unbundle">
2552 unbundle
2554 unbundle
2553 </a>
2555 </a>
2554 </td><td>
2556 </td><td>
2555 apply one or more bundle files
2557 apply one or more bundle files
2556 </td></tr>
2558 </td></tr>
2557 <tr><td>
2559 <tr><td>
2558 <a href="/help/verify">
2560 <a href="/help/verify">
2559 verify
2561 verify
2560 </a>
2562 </a>
2561 </td><td>
2563 </td><td>
2562 verify the integrity of the repository
2564 verify the integrity of the repository
2563 </td></tr>
2565 </td></tr>
2564 <tr><td>
2566 <tr><td>
2565 <a href="/help/version">
2567 <a href="/help/version">
2566 version
2568 version
2567 </a>
2569 </a>
2568 </td><td>
2570 </td><td>
2569 output version and copyright information
2571 output version and copyright information
2570 </td></tr>
2572 </td></tr>
2571
2573
2572
2574
2573 </table>
2575 </table>
2574 </div>
2576 </div>
2575 </div>
2577 </div>
2576
2578
2577
2579
2578
2580
2579 </body>
2581 </body>
2580 </html>
2582 </html>
2581
2583
2582
2584
2583 $ get-with-headers.py $LOCALIP:$HGPORT "help/add"
2585 $ get-with-headers.py $LOCALIP:$HGPORT "help/add"
2584 200 Script output follows
2586 200 Script output follows
2585
2587
2586 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2588 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2587 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2589 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2588 <head>
2590 <head>
2589 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2591 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2590 <meta name="robots" content="index, nofollow" />
2592 <meta name="robots" content="index, nofollow" />
2591 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2593 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2592 <script type="text/javascript" src="/static/mercurial.js"></script>
2594 <script type="text/javascript" src="/static/mercurial.js"></script>
2593
2595
2594 <title>Help: add</title>
2596 <title>Help: add</title>
2595 </head>
2597 </head>
2596 <body>
2598 <body>
2597
2599
2598 <div class="container">
2600 <div class="container">
2599 <div class="menu">
2601 <div class="menu">
2600 <div class="logo">
2602 <div class="logo">
2601 <a href="https://mercurial-scm.org/">
2603 <a href="https://mercurial-scm.org/">
2602 <img src="/static/hglogo.png" alt="mercurial" /></a>
2604 <img src="/static/hglogo.png" alt="mercurial" /></a>
2603 </div>
2605 </div>
2604 <ul>
2606 <ul>
2605 <li><a href="/shortlog">log</a></li>
2607 <li><a href="/shortlog">log</a></li>
2606 <li><a href="/graph">graph</a></li>
2608 <li><a href="/graph">graph</a></li>
2607 <li><a href="/tags">tags</a></li>
2609 <li><a href="/tags">tags</a></li>
2608 <li><a href="/bookmarks">bookmarks</a></li>
2610 <li><a href="/bookmarks">bookmarks</a></li>
2609 <li><a href="/branches">branches</a></li>
2611 <li><a href="/branches">branches</a></li>
2610 </ul>
2612 </ul>
2611 <ul>
2613 <ul>
2612 <li class="active"><a href="/help">help</a></li>
2614 <li class="active"><a href="/help">help</a></li>
2613 </ul>
2615 </ul>
2614 </div>
2616 </div>
2615
2617
2616 <div class="main">
2618 <div class="main">
2617 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2619 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2618 <h3>Help: add</h3>
2620 <h3>Help: add</h3>
2619
2621
2620 <form class="search" action="/log">
2622 <form class="search" action="/log">
2621
2623
2622 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2624 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2623 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2625 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2624 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2626 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2625 </form>
2627 </form>
2626 <div id="doc">
2628 <div id="doc">
2627 <p>
2629 <p>
2628 hg add [OPTION]... [FILE]...
2630 hg add [OPTION]... [FILE]...
2629 </p>
2631 </p>
2630 <p>
2632 <p>
2631 add the specified files on the next commit
2633 add the specified files on the next commit
2632 </p>
2634 </p>
2633 <p>
2635 <p>
2634 Schedule files to be version controlled and added to the
2636 Schedule files to be version controlled and added to the
2635 repository.
2637 repository.
2636 </p>
2638 </p>
2637 <p>
2639 <p>
2638 The files will be added to the repository at the next commit. To
2640 The files will be added to the repository at the next commit. To
2639 undo an add before that, see 'hg forget'.
2641 undo an add before that, see 'hg forget'.
2640 </p>
2642 </p>
2641 <p>
2643 <p>
2642 If no names are given, add all files to the repository (except
2644 If no names are given, add all files to the repository (except
2643 files matching &quot;.hgignore&quot;).
2645 files matching &quot;.hgignore&quot;).
2644 </p>
2646 </p>
2645 <p>
2647 <p>
2646 Examples:
2648 Examples:
2647 </p>
2649 </p>
2648 <ul>
2650 <ul>
2649 <li> New (unknown) files are added automatically by 'hg add':
2651 <li> New (unknown) files are added automatically by 'hg add':
2650 <pre>
2652 <pre>
2651 \$ ls (re)
2653 \$ ls (re)
2652 foo.c
2654 foo.c
2653 \$ hg status (re)
2655 \$ hg status (re)
2654 ? foo.c
2656 ? foo.c
2655 \$ hg add (re)
2657 \$ hg add (re)
2656 adding foo.c
2658 adding foo.c
2657 \$ hg status (re)
2659 \$ hg status (re)
2658 A foo.c
2660 A foo.c
2659 </pre>
2661 </pre>
2660 <li> Specific files to be added can be specified:
2662 <li> Specific files to be added can be specified:
2661 <pre>
2663 <pre>
2662 \$ ls (re)
2664 \$ ls (re)
2663 bar.c foo.c
2665 bar.c foo.c
2664 \$ hg status (re)
2666 \$ hg status (re)
2665 ? bar.c
2667 ? bar.c
2666 ? foo.c
2668 ? foo.c
2667 \$ hg add bar.c (re)
2669 \$ hg add bar.c (re)
2668 \$ hg status (re)
2670 \$ hg status (re)
2669 A bar.c
2671 A bar.c
2670 ? foo.c
2672 ? foo.c
2671 </pre>
2673 </pre>
2672 </ul>
2674 </ul>
2673 <p>
2675 <p>
2674 Returns 0 if all files are successfully added.
2676 Returns 0 if all files are successfully added.
2675 </p>
2677 </p>
2676 <p>
2678 <p>
2677 options ([+] can be repeated):
2679 options ([+] can be repeated):
2678 </p>
2680 </p>
2679 <table>
2681 <table>
2680 <tr><td>-I</td>
2682 <tr><td>-I</td>
2681 <td>--include PATTERN [+]</td>
2683 <td>--include PATTERN [+]</td>
2682 <td>include names matching the given patterns</td></tr>
2684 <td>include names matching the given patterns</td></tr>
2683 <tr><td>-X</td>
2685 <tr><td>-X</td>
2684 <td>--exclude PATTERN [+]</td>
2686 <td>--exclude PATTERN [+]</td>
2685 <td>exclude names matching the given patterns</td></tr>
2687 <td>exclude names matching the given patterns</td></tr>
2686 <tr><td>-S</td>
2688 <tr><td>-S</td>
2687 <td>--subrepos</td>
2689 <td>--subrepos</td>
2688 <td>recurse into subrepositories</td></tr>
2690 <td>recurse into subrepositories</td></tr>
2689 <tr><td>-n</td>
2691 <tr><td>-n</td>
2690 <td>--dry-run</td>
2692 <td>--dry-run</td>
2691 <td>do not perform actions, just print output</td></tr>
2693 <td>do not perform actions, just print output</td></tr>
2692 </table>
2694 </table>
2693 <p>
2695 <p>
2694 global options ([+] can be repeated):
2696 global options ([+] can be repeated):
2695 </p>
2697 </p>
2696 <table>
2698 <table>
2697 <tr><td>-R</td>
2699 <tr><td>-R</td>
2698 <td>--repository REPO</td>
2700 <td>--repository REPO</td>
2699 <td>repository root directory or name of overlay bundle file</td></tr>
2701 <td>repository root directory or name of overlay bundle file</td></tr>
2700 <tr><td></td>
2702 <tr><td></td>
2701 <td>--cwd DIR</td>
2703 <td>--cwd DIR</td>
2702 <td>change working directory</td></tr>
2704 <td>change working directory</td></tr>
2703 <tr><td>-y</td>
2705 <tr><td>-y</td>
2704 <td>--noninteractive</td>
2706 <td>--noninteractive</td>
2705 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2707 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2706 <tr><td>-q</td>
2708 <tr><td>-q</td>
2707 <td>--quiet</td>
2709 <td>--quiet</td>
2708 <td>suppress output</td></tr>
2710 <td>suppress output</td></tr>
2709 <tr><td>-v</td>
2711 <tr><td>-v</td>
2710 <td>--verbose</td>
2712 <td>--verbose</td>
2711 <td>enable additional output</td></tr>
2713 <td>enable additional output</td></tr>
2712 <tr><td></td>
2714 <tr><td></td>
2713 <td>--color TYPE</td>
2715 <td>--color TYPE</td>
2714 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2716 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2715 <tr><td></td>
2717 <tr><td></td>
2716 <td>--config CONFIG [+]</td>
2718 <td>--config CONFIG [+]</td>
2717 <td>set/override config option (use 'section.name=value')</td></tr>
2719 <td>set/override config option (use 'section.name=value')</td></tr>
2718 <tr><td></td>
2720 <tr><td></td>
2719 <td>--debug</td>
2721 <td>--debug</td>
2720 <td>enable debugging output</td></tr>
2722 <td>enable debugging output</td></tr>
2721 <tr><td></td>
2723 <tr><td></td>
2722 <td>--debugger</td>
2724 <td>--debugger</td>
2723 <td>start debugger</td></tr>
2725 <td>start debugger</td></tr>
2724 <tr><td></td>
2726 <tr><td></td>
2725 <td>--encoding ENCODE</td>
2727 <td>--encoding ENCODE</td>
2726 <td>set the charset encoding (default: ascii)</td></tr>
2728 <td>set the charset encoding (default: ascii)</td></tr>
2727 <tr><td></td>
2729 <tr><td></td>
2728 <td>--encodingmode MODE</td>
2730 <td>--encodingmode MODE</td>
2729 <td>set the charset encoding mode (default: strict)</td></tr>
2731 <td>set the charset encoding mode (default: strict)</td></tr>
2730 <tr><td></td>
2732 <tr><td></td>
2731 <td>--traceback</td>
2733 <td>--traceback</td>
2732 <td>always print a traceback on exception</td></tr>
2734 <td>always print a traceback on exception</td></tr>
2733 <tr><td></td>
2735 <tr><td></td>
2734 <td>--time</td>
2736 <td>--time</td>
2735 <td>time how long the command takes</td></tr>
2737 <td>time how long the command takes</td></tr>
2736 <tr><td></td>
2738 <tr><td></td>
2737 <td>--profile</td>
2739 <td>--profile</td>
2738 <td>print command execution profile</td></tr>
2740 <td>print command execution profile</td></tr>
2739 <tr><td></td>
2741 <tr><td></td>
2740 <td>--version</td>
2742 <td>--version</td>
2741 <td>output version information and exit</td></tr>
2743 <td>output version information and exit</td></tr>
2742 <tr><td>-h</td>
2744 <tr><td>-h</td>
2743 <td>--help</td>
2745 <td>--help</td>
2744 <td>display help and exit</td></tr>
2746 <td>display help and exit</td></tr>
2745 <tr><td></td>
2747 <tr><td></td>
2746 <td>--hidden</td>
2748 <td>--hidden</td>
2747 <td>consider hidden changesets</td></tr>
2749 <td>consider hidden changesets</td></tr>
2748 <tr><td></td>
2750 <tr><td></td>
2749 <td>--pager TYPE</td>
2751 <td>--pager TYPE</td>
2750 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2752 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2751 </table>
2753 </table>
2752
2754
2753 </div>
2755 </div>
2754 </div>
2756 </div>
2755 </div>
2757 </div>
2756
2758
2757
2759
2758
2760
2759 </body>
2761 </body>
2760 </html>
2762 </html>
2761
2763
2762
2764
2763 $ get-with-headers.py $LOCALIP:$HGPORT "help/remove"
2765 $ get-with-headers.py $LOCALIP:$HGPORT "help/remove"
2764 200 Script output follows
2766 200 Script output follows
2765
2767
2766 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2768 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2767 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2769 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2768 <head>
2770 <head>
2769 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2771 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2770 <meta name="robots" content="index, nofollow" />
2772 <meta name="robots" content="index, nofollow" />
2771 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2773 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2772 <script type="text/javascript" src="/static/mercurial.js"></script>
2774 <script type="text/javascript" src="/static/mercurial.js"></script>
2773
2775
2774 <title>Help: remove</title>
2776 <title>Help: remove</title>
2775 </head>
2777 </head>
2776 <body>
2778 <body>
2777
2779
2778 <div class="container">
2780 <div class="container">
2779 <div class="menu">
2781 <div class="menu">
2780 <div class="logo">
2782 <div class="logo">
2781 <a href="https://mercurial-scm.org/">
2783 <a href="https://mercurial-scm.org/">
2782 <img src="/static/hglogo.png" alt="mercurial" /></a>
2784 <img src="/static/hglogo.png" alt="mercurial" /></a>
2783 </div>
2785 </div>
2784 <ul>
2786 <ul>
2785 <li><a href="/shortlog">log</a></li>
2787 <li><a href="/shortlog">log</a></li>
2786 <li><a href="/graph">graph</a></li>
2788 <li><a href="/graph">graph</a></li>
2787 <li><a href="/tags">tags</a></li>
2789 <li><a href="/tags">tags</a></li>
2788 <li><a href="/bookmarks">bookmarks</a></li>
2790 <li><a href="/bookmarks">bookmarks</a></li>
2789 <li><a href="/branches">branches</a></li>
2791 <li><a href="/branches">branches</a></li>
2790 </ul>
2792 </ul>
2791 <ul>
2793 <ul>
2792 <li class="active"><a href="/help">help</a></li>
2794 <li class="active"><a href="/help">help</a></li>
2793 </ul>
2795 </ul>
2794 </div>
2796 </div>
2795
2797
2796 <div class="main">
2798 <div class="main">
2797 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2799 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2798 <h3>Help: remove</h3>
2800 <h3>Help: remove</h3>
2799
2801
2800 <form class="search" action="/log">
2802 <form class="search" action="/log">
2801
2803
2802 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2804 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2803 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2805 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2804 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2806 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2805 </form>
2807 </form>
2806 <div id="doc">
2808 <div id="doc">
2807 <p>
2809 <p>
2808 hg remove [OPTION]... FILE...
2810 hg remove [OPTION]... FILE...
2809 </p>
2811 </p>
2810 <p>
2812 <p>
2811 aliases: rm
2813 aliases: rm
2812 </p>
2814 </p>
2813 <p>
2815 <p>
2814 remove the specified files on the next commit
2816 remove the specified files on the next commit
2815 </p>
2817 </p>
2816 <p>
2818 <p>
2817 Schedule the indicated files for removal from the current branch.
2819 Schedule the indicated files for removal from the current branch.
2818 </p>
2820 </p>
2819 <p>
2821 <p>
2820 This command schedules the files to be removed at the next commit.
2822 This command schedules the files to be removed at the next commit.
2821 To undo a remove before that, see 'hg revert'. To undo added
2823 To undo a remove before that, see 'hg revert'. To undo added
2822 files, see 'hg forget'.
2824 files, see 'hg forget'.
2823 </p>
2825 </p>
2824 <p>
2826 <p>
2825 -A/--after can be used to remove only files that have already
2827 -A/--after can be used to remove only files that have already
2826 been deleted, -f/--force can be used to force deletion, and -Af
2828 been deleted, -f/--force can be used to force deletion, and -Af
2827 can be used to remove files from the next revision without
2829 can be used to remove files from the next revision without
2828 deleting them from the working directory.
2830 deleting them from the working directory.
2829 </p>
2831 </p>
2830 <p>
2832 <p>
2831 The following table details the behavior of remove for different
2833 The following table details the behavior of remove for different
2832 file states (columns) and option combinations (rows). The file
2834 file states (columns) and option combinations (rows). The file
2833 states are Added [A], Clean [C], Modified [M] and Missing [!]
2835 states are Added [A], Clean [C], Modified [M] and Missing [!]
2834 (as reported by 'hg status'). The actions are Warn, Remove
2836 (as reported by 'hg status'). The actions are Warn, Remove
2835 (from branch) and Delete (from disk):
2837 (from branch) and Delete (from disk):
2836 </p>
2838 </p>
2837 <table>
2839 <table>
2838 <tr><td>opt/state</td>
2840 <tr><td>opt/state</td>
2839 <td>A</td>
2841 <td>A</td>
2840 <td>C</td>
2842 <td>C</td>
2841 <td>M</td>
2843 <td>M</td>
2842 <td>!</td></tr>
2844 <td>!</td></tr>
2843 <tr><td>none</td>
2845 <tr><td>none</td>
2844 <td>W</td>
2846 <td>W</td>
2845 <td>RD</td>
2847 <td>RD</td>
2846 <td>W</td>
2848 <td>W</td>
2847 <td>R</td></tr>
2849 <td>R</td></tr>
2848 <tr><td>-f</td>
2850 <tr><td>-f</td>
2849 <td>R</td>
2851 <td>R</td>
2850 <td>RD</td>
2852 <td>RD</td>
2851 <td>RD</td>
2853 <td>RD</td>
2852 <td>R</td></tr>
2854 <td>R</td></tr>
2853 <tr><td>-A</td>
2855 <tr><td>-A</td>
2854 <td>W</td>
2856 <td>W</td>
2855 <td>W</td>
2857 <td>W</td>
2856 <td>W</td>
2858 <td>W</td>
2857 <td>R</td></tr>
2859 <td>R</td></tr>
2858 <tr><td>-Af</td>
2860 <tr><td>-Af</td>
2859 <td>R</td>
2861 <td>R</td>
2860 <td>R</td>
2862 <td>R</td>
2861 <td>R</td>
2863 <td>R</td>
2862 <td>R</td></tr>
2864 <td>R</td></tr>
2863 </table>
2865 </table>
2864 <p>
2866 <p>
2865 <b>Note:</b>
2867 <b>Note:</b>
2866 </p>
2868 </p>
2867 <p>
2869 <p>
2868 'hg remove' never deletes files in Added [A] state from the
2870 'hg remove' never deletes files in Added [A] state from the
2869 working directory, not even if &quot;--force&quot; is specified.
2871 working directory, not even if &quot;--force&quot; is specified.
2870 </p>
2872 </p>
2871 <p>
2873 <p>
2872 Returns 0 on success, 1 if any warnings encountered.
2874 Returns 0 on success, 1 if any warnings encountered.
2873 </p>
2875 </p>
2874 <p>
2876 <p>
2875 options ([+] can be repeated):
2877 options ([+] can be repeated):
2876 </p>
2878 </p>
2877 <table>
2879 <table>
2878 <tr><td>-A</td>
2880 <tr><td>-A</td>
2879 <td>--after</td>
2881 <td>--after</td>
2880 <td>record delete for missing files</td></tr>
2882 <td>record delete for missing files</td></tr>
2881 <tr><td>-f</td>
2883 <tr><td>-f</td>
2882 <td>--force</td>
2884 <td>--force</td>
2883 <td>forget added files, delete modified files</td></tr>
2885 <td>forget added files, delete modified files</td></tr>
2884 <tr><td>-S</td>
2886 <tr><td>-S</td>
2885 <td>--subrepos</td>
2887 <td>--subrepos</td>
2886 <td>recurse into subrepositories</td></tr>
2888 <td>recurse into subrepositories</td></tr>
2887 <tr><td>-I</td>
2889 <tr><td>-I</td>
2888 <td>--include PATTERN [+]</td>
2890 <td>--include PATTERN [+]</td>
2889 <td>include names matching the given patterns</td></tr>
2891 <td>include names matching the given patterns</td></tr>
2890 <tr><td>-X</td>
2892 <tr><td>-X</td>
2891 <td>--exclude PATTERN [+]</td>
2893 <td>--exclude PATTERN [+]</td>
2892 <td>exclude names matching the given patterns</td></tr>
2894 <td>exclude names matching the given patterns</td></tr>
2893 <tr><td>-n</td>
2895 <tr><td>-n</td>
2894 <td>--dry-run</td>
2896 <td>--dry-run</td>
2895 <td>do not perform actions, just print output</td></tr>
2897 <td>do not perform actions, just print output</td></tr>
2896 </table>
2898 </table>
2897 <p>
2899 <p>
2898 global options ([+] can be repeated):
2900 global options ([+] can be repeated):
2899 </p>
2901 </p>
2900 <table>
2902 <table>
2901 <tr><td>-R</td>
2903 <tr><td>-R</td>
2902 <td>--repository REPO</td>
2904 <td>--repository REPO</td>
2903 <td>repository root directory or name of overlay bundle file</td></tr>
2905 <td>repository root directory or name of overlay bundle file</td></tr>
2904 <tr><td></td>
2906 <tr><td></td>
2905 <td>--cwd DIR</td>
2907 <td>--cwd DIR</td>
2906 <td>change working directory</td></tr>
2908 <td>change working directory</td></tr>
2907 <tr><td>-y</td>
2909 <tr><td>-y</td>
2908 <td>--noninteractive</td>
2910 <td>--noninteractive</td>
2909 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2911 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2910 <tr><td>-q</td>
2912 <tr><td>-q</td>
2911 <td>--quiet</td>
2913 <td>--quiet</td>
2912 <td>suppress output</td></tr>
2914 <td>suppress output</td></tr>
2913 <tr><td>-v</td>
2915 <tr><td>-v</td>
2914 <td>--verbose</td>
2916 <td>--verbose</td>
2915 <td>enable additional output</td></tr>
2917 <td>enable additional output</td></tr>
2916 <tr><td></td>
2918 <tr><td></td>
2917 <td>--color TYPE</td>
2919 <td>--color TYPE</td>
2918 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2920 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2919 <tr><td></td>
2921 <tr><td></td>
2920 <td>--config CONFIG [+]</td>
2922 <td>--config CONFIG [+]</td>
2921 <td>set/override config option (use 'section.name=value')</td></tr>
2923 <td>set/override config option (use 'section.name=value')</td></tr>
2922 <tr><td></td>
2924 <tr><td></td>
2923 <td>--debug</td>
2925 <td>--debug</td>
2924 <td>enable debugging output</td></tr>
2926 <td>enable debugging output</td></tr>
2925 <tr><td></td>
2927 <tr><td></td>
2926 <td>--debugger</td>
2928 <td>--debugger</td>
2927 <td>start debugger</td></tr>
2929 <td>start debugger</td></tr>
2928 <tr><td></td>
2930 <tr><td></td>
2929 <td>--encoding ENCODE</td>
2931 <td>--encoding ENCODE</td>
2930 <td>set the charset encoding (default: ascii)</td></tr>
2932 <td>set the charset encoding (default: ascii)</td></tr>
2931 <tr><td></td>
2933 <tr><td></td>
2932 <td>--encodingmode MODE</td>
2934 <td>--encodingmode MODE</td>
2933 <td>set the charset encoding mode (default: strict)</td></tr>
2935 <td>set the charset encoding mode (default: strict)</td></tr>
2934 <tr><td></td>
2936 <tr><td></td>
2935 <td>--traceback</td>
2937 <td>--traceback</td>
2936 <td>always print a traceback on exception</td></tr>
2938 <td>always print a traceback on exception</td></tr>
2937 <tr><td></td>
2939 <tr><td></td>
2938 <td>--time</td>
2940 <td>--time</td>
2939 <td>time how long the command takes</td></tr>
2941 <td>time how long the command takes</td></tr>
2940 <tr><td></td>
2942 <tr><td></td>
2941 <td>--profile</td>
2943 <td>--profile</td>
2942 <td>print command execution profile</td></tr>
2944 <td>print command execution profile</td></tr>
2943 <tr><td></td>
2945 <tr><td></td>
2944 <td>--version</td>
2946 <td>--version</td>
2945 <td>output version information and exit</td></tr>
2947 <td>output version information and exit</td></tr>
2946 <tr><td>-h</td>
2948 <tr><td>-h</td>
2947 <td>--help</td>
2949 <td>--help</td>
2948 <td>display help and exit</td></tr>
2950 <td>display help and exit</td></tr>
2949 <tr><td></td>
2951 <tr><td></td>
2950 <td>--hidden</td>
2952 <td>--hidden</td>
2951 <td>consider hidden changesets</td></tr>
2953 <td>consider hidden changesets</td></tr>
2952 <tr><td></td>
2954 <tr><td></td>
2953 <td>--pager TYPE</td>
2955 <td>--pager TYPE</td>
2954 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2956 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2955 </table>
2957 </table>
2956
2958
2957 </div>
2959 </div>
2958 </div>
2960 </div>
2959 </div>
2961 </div>
2960
2962
2961
2963
2962
2964
2963 </body>
2965 </body>
2964 </html>
2966 </html>
2965
2967
2966
2968
2967 $ get-with-headers.py $LOCALIP:$HGPORT "help/dates"
2969 $ get-with-headers.py $LOCALIP:$HGPORT "help/dates"
2968 200 Script output follows
2970 200 Script output follows
2969
2971
2970 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2972 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2971 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2973 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2972 <head>
2974 <head>
2973 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2975 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2974 <meta name="robots" content="index, nofollow" />
2976 <meta name="robots" content="index, nofollow" />
2975 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2977 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2976 <script type="text/javascript" src="/static/mercurial.js"></script>
2978 <script type="text/javascript" src="/static/mercurial.js"></script>
2977
2979
2978 <title>Help: dates</title>
2980 <title>Help: dates</title>
2979 </head>
2981 </head>
2980 <body>
2982 <body>
2981
2983
2982 <div class="container">
2984 <div class="container">
2983 <div class="menu">
2985 <div class="menu">
2984 <div class="logo">
2986 <div class="logo">
2985 <a href="https://mercurial-scm.org/">
2987 <a href="https://mercurial-scm.org/">
2986 <img src="/static/hglogo.png" alt="mercurial" /></a>
2988 <img src="/static/hglogo.png" alt="mercurial" /></a>
2987 </div>
2989 </div>
2988 <ul>
2990 <ul>
2989 <li><a href="/shortlog">log</a></li>
2991 <li><a href="/shortlog">log</a></li>
2990 <li><a href="/graph">graph</a></li>
2992 <li><a href="/graph">graph</a></li>
2991 <li><a href="/tags">tags</a></li>
2993 <li><a href="/tags">tags</a></li>
2992 <li><a href="/bookmarks">bookmarks</a></li>
2994 <li><a href="/bookmarks">bookmarks</a></li>
2993 <li><a href="/branches">branches</a></li>
2995 <li><a href="/branches">branches</a></li>
2994 </ul>
2996 </ul>
2995 <ul>
2997 <ul>
2996 <li class="active"><a href="/help">help</a></li>
2998 <li class="active"><a href="/help">help</a></li>
2997 </ul>
2999 </ul>
2998 </div>
3000 </div>
2999
3001
3000 <div class="main">
3002 <div class="main">
3001 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3003 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3002 <h3>Help: dates</h3>
3004 <h3>Help: dates</h3>
3003
3005
3004 <form class="search" action="/log">
3006 <form class="search" action="/log">
3005
3007
3006 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3008 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3007 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3009 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3008 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3010 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3009 </form>
3011 </form>
3010 <div id="doc">
3012 <div id="doc">
3011 <h1>Date Formats</h1>
3013 <h1>Date Formats</h1>
3012 <p>
3014 <p>
3013 Some commands allow the user to specify a date, e.g.:
3015 Some commands allow the user to specify a date, e.g.:
3014 </p>
3016 </p>
3015 <ul>
3017 <ul>
3016 <li> backout, commit, import, tag: Specify the commit date.
3018 <li> backout, commit, import, tag: Specify the commit date.
3017 <li> log, revert, update: Select revision(s) by date.
3019 <li> log, revert, update: Select revision(s) by date.
3018 </ul>
3020 </ul>
3019 <p>
3021 <p>
3020 Many date formats are valid. Here are some examples:
3022 Many date formats are valid. Here are some examples:
3021 </p>
3023 </p>
3022 <ul>
3024 <ul>
3023 <li> &quot;Wed Dec 6 13:18:29 2006&quot; (local timezone assumed)
3025 <li> &quot;Wed Dec 6 13:18:29 2006&quot; (local timezone assumed)
3024 <li> &quot;Dec 6 13:18 -0600&quot; (year assumed, time offset provided)
3026 <li> &quot;Dec 6 13:18 -0600&quot; (year assumed, time offset provided)
3025 <li> &quot;Dec 6 13:18 UTC&quot; (UTC and GMT are aliases for +0000)
3027 <li> &quot;Dec 6 13:18 UTC&quot; (UTC and GMT are aliases for +0000)
3026 <li> &quot;Dec 6&quot; (midnight)
3028 <li> &quot;Dec 6&quot; (midnight)
3027 <li> &quot;13:18&quot; (today assumed)
3029 <li> &quot;13:18&quot; (today assumed)
3028 <li> &quot;3:39&quot; (3:39AM assumed)
3030 <li> &quot;3:39&quot; (3:39AM assumed)
3029 <li> &quot;3:39pm&quot; (15:39)
3031 <li> &quot;3:39pm&quot; (15:39)
3030 <li> &quot;2006-12-06 13:18:29&quot; (ISO 8601 format)
3032 <li> &quot;2006-12-06 13:18:29&quot; (ISO 8601 format)
3031 <li> &quot;2006-12-6 13:18&quot;
3033 <li> &quot;2006-12-6 13:18&quot;
3032 <li> &quot;2006-12-6&quot;
3034 <li> &quot;2006-12-6&quot;
3033 <li> &quot;12-6&quot;
3035 <li> &quot;12-6&quot;
3034 <li> &quot;12/6&quot;
3036 <li> &quot;12/6&quot;
3035 <li> &quot;12/6/6&quot; (Dec 6 2006)
3037 <li> &quot;12/6/6&quot; (Dec 6 2006)
3036 <li> &quot;today&quot; (midnight)
3038 <li> &quot;today&quot; (midnight)
3037 <li> &quot;yesterday&quot; (midnight)
3039 <li> &quot;yesterday&quot; (midnight)
3038 <li> &quot;now&quot; - right now
3040 <li> &quot;now&quot; - right now
3039 </ul>
3041 </ul>
3040 <p>
3042 <p>
3041 Lastly, there is Mercurial's internal format:
3043 Lastly, there is Mercurial's internal format:
3042 </p>
3044 </p>
3043 <ul>
3045 <ul>
3044 <li> &quot;1165411109 0&quot; (Wed Dec 6 13:18:29 2006 UTC)
3046 <li> &quot;1165411109 0&quot; (Wed Dec 6 13:18:29 2006 UTC)
3045 </ul>
3047 </ul>
3046 <p>
3048 <p>
3047 This is the internal representation format for dates. The first number
3049 This is the internal representation format for dates. The first number
3048 is the number of seconds since the epoch (1970-01-01 00:00 UTC). The
3050 is the number of seconds since the epoch (1970-01-01 00:00 UTC). The
3049 second is the offset of the local timezone, in seconds west of UTC
3051 second is the offset of the local timezone, in seconds west of UTC
3050 (negative if the timezone is east of UTC).
3052 (negative if the timezone is east of UTC).
3051 </p>
3053 </p>
3052 <p>
3054 <p>
3053 The log command also accepts date ranges:
3055 The log command also accepts date ranges:
3054 </p>
3056 </p>
3055 <ul>
3057 <ul>
3056 <li> &quot;&lt;DATE&quot; - at or before a given date/time
3058 <li> &quot;&lt;DATE&quot; - at or before a given date/time
3057 <li> &quot;&gt;DATE&quot; - on or after a given date/time
3059 <li> &quot;&gt;DATE&quot; - on or after a given date/time
3058 <li> &quot;DATE to DATE&quot; - a date range, inclusive
3060 <li> &quot;DATE to DATE&quot; - a date range, inclusive
3059 <li> &quot;-DAYS&quot; - within a given number of days of today
3061 <li> &quot;-DAYS&quot; - within a given number of days of today
3060 </ul>
3062 </ul>
3061
3063
3062 </div>
3064 </div>
3063 </div>
3065 </div>
3064 </div>
3066 </div>
3065
3067
3066
3068
3067
3069
3068 </body>
3070 </body>
3069 </html>
3071 </html>
3070
3072
3071
3073
3072 $ get-with-headers.py $LOCALIP:$HGPORT "help/pager"
3074 $ get-with-headers.py $LOCALIP:$HGPORT "help/pager"
3073 200 Script output follows
3075 200 Script output follows
3074
3076
3075 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3077 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3076 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3078 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3077 <head>
3079 <head>
3078 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3080 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3079 <meta name="robots" content="index, nofollow" />
3081 <meta name="robots" content="index, nofollow" />
3080 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3082 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3081 <script type="text/javascript" src="/static/mercurial.js"></script>
3083 <script type="text/javascript" src="/static/mercurial.js"></script>
3082
3084
3083 <title>Help: pager</title>
3085 <title>Help: pager</title>
3084 </head>
3086 </head>
3085 <body>
3087 <body>
3086
3088
3087 <div class="container">
3089 <div class="container">
3088 <div class="menu">
3090 <div class="menu">
3089 <div class="logo">
3091 <div class="logo">
3090 <a href="https://mercurial-scm.org/">
3092 <a href="https://mercurial-scm.org/">
3091 <img src="/static/hglogo.png" alt="mercurial" /></a>
3093 <img src="/static/hglogo.png" alt="mercurial" /></a>
3092 </div>
3094 </div>
3093 <ul>
3095 <ul>
3094 <li><a href="/shortlog">log</a></li>
3096 <li><a href="/shortlog">log</a></li>
3095 <li><a href="/graph">graph</a></li>
3097 <li><a href="/graph">graph</a></li>
3096 <li><a href="/tags">tags</a></li>
3098 <li><a href="/tags">tags</a></li>
3097 <li><a href="/bookmarks">bookmarks</a></li>
3099 <li><a href="/bookmarks">bookmarks</a></li>
3098 <li><a href="/branches">branches</a></li>
3100 <li><a href="/branches">branches</a></li>
3099 </ul>
3101 </ul>
3100 <ul>
3102 <ul>
3101 <li class="active"><a href="/help">help</a></li>
3103 <li class="active"><a href="/help">help</a></li>
3102 </ul>
3104 </ul>
3103 </div>
3105 </div>
3104
3106
3105 <div class="main">
3107 <div class="main">
3106 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3108 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3107 <h3>Help: pager</h3>
3109 <h3>Help: pager</h3>
3108
3110
3109 <form class="search" action="/log">
3111 <form class="search" action="/log">
3110
3112
3111 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3113 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3112 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3114 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3113 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3115 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3114 </form>
3116 </form>
3115 <div id="doc">
3117 <div id="doc">
3116 <h1>Pager Support</h1>
3118 <h1>Pager Support</h1>
3117 <p>
3119 <p>
3118 Some Mercurial commands can produce a lot of output, and Mercurial will
3120 Some Mercurial commands can produce a lot of output, and Mercurial will
3119 attempt to use a pager to make those commands more pleasant.
3121 attempt to use a pager to make those commands more pleasant.
3120 </p>
3122 </p>
3121 <p>
3123 <p>
3122 To set the pager that should be used, set the application variable:
3124 To set the pager that should be used, set the application variable:
3123 </p>
3125 </p>
3124 <pre>
3126 <pre>
3125 [pager]
3127 [pager]
3126 pager = less -FRX
3128 pager = less -FRX
3127 </pre>
3129 </pre>
3128 <p>
3130 <p>
3129 If no pager is set in the user or repository configuration, Mercurial uses the
3131 If no pager is set in the user or repository configuration, Mercurial uses the
3130 environment variable $PAGER. If $PAGER is not set, pager.pager from the default
3132 environment variable $PAGER. If $PAGER is not set, pager.pager from the default
3131 or system configuration is used. If none of these are set, a default pager will
3133 or system configuration is used. If none of these are set, a default pager will
3132 be used, typically 'less' on Unix and 'more' on Windows.
3134 be used, typically 'less' on Unix and 'more' on Windows.
3133 </p>
3135 </p>
3134 <p>
3136 <p>
3135 You can disable the pager for certain commands by adding them to the
3137 You can disable the pager for certain commands by adding them to the
3136 pager.ignore list:
3138 pager.ignore list:
3137 </p>
3139 </p>
3138 <pre>
3140 <pre>
3139 [pager]
3141 [pager]
3140 ignore = version, help, update
3142 ignore = version, help, update
3141 </pre>
3143 </pre>
3142 <p>
3144 <p>
3143 To ignore global commands like 'hg version' or 'hg help', you have
3145 To ignore global commands like 'hg version' or 'hg help', you have
3144 to specify them in your user configuration file.
3146 to specify them in your user configuration file.
3145 </p>
3147 </p>
3146 <p>
3148 <p>
3147 To control whether the pager is used at all for an individual command,
3149 To control whether the pager is used at all for an individual command,
3148 you can use --pager=&lt;value&gt;:
3150 you can use --pager=&lt;value&gt;:
3149 </p>
3151 </p>
3150 <ul>
3152 <ul>
3151 <li> use as needed: 'auto'.
3153 <li> use as needed: 'auto'.
3152 <li> require the pager: 'yes' or 'on'.
3154 <li> require the pager: 'yes' or 'on'.
3153 <li> suppress the pager: 'no' or 'off' (any unrecognized value will also work).
3155 <li> suppress the pager: 'no' or 'off' (any unrecognized value will also work).
3154 </ul>
3156 </ul>
3155 <p>
3157 <p>
3156 To globally turn off all attempts to use a pager, set:
3158 To globally turn off all attempts to use a pager, set:
3157 </p>
3159 </p>
3158 <pre>
3160 <pre>
3159 [ui]
3161 [ui]
3160 paginate = never
3162 paginate = never
3161 </pre>
3163 </pre>
3162 <p>
3164 <p>
3163 which will prevent the pager from running.
3165 which will prevent the pager from running.
3164 </p>
3166 </p>
3165
3167
3166 </div>
3168 </div>
3167 </div>
3169 </div>
3168 </div>
3170 </div>
3169
3171
3170
3172
3171
3173
3172 </body>
3174 </body>
3173 </html>
3175 </html>
3174
3176
3175
3177
3176 Sub-topic indexes rendered properly
3178 Sub-topic indexes rendered properly
3177
3179
3178 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals"
3180 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals"
3179 200 Script output follows
3181 200 Script output follows
3180
3182
3181 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3183 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3182 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3184 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3183 <head>
3185 <head>
3184 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3186 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3185 <meta name="robots" content="index, nofollow" />
3187 <meta name="robots" content="index, nofollow" />
3186 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3188 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3187 <script type="text/javascript" src="/static/mercurial.js"></script>
3189 <script type="text/javascript" src="/static/mercurial.js"></script>
3188
3190
3189 <title>Help: internals</title>
3191 <title>Help: internals</title>
3190 </head>
3192 </head>
3191 <body>
3193 <body>
3192
3194
3193 <div class="container">
3195 <div class="container">
3194 <div class="menu">
3196 <div class="menu">
3195 <div class="logo">
3197 <div class="logo">
3196 <a href="https://mercurial-scm.org/">
3198 <a href="https://mercurial-scm.org/">
3197 <img src="/static/hglogo.png" alt="mercurial" /></a>
3199 <img src="/static/hglogo.png" alt="mercurial" /></a>
3198 </div>
3200 </div>
3199 <ul>
3201 <ul>
3200 <li><a href="/shortlog">log</a></li>
3202 <li><a href="/shortlog">log</a></li>
3201 <li><a href="/graph">graph</a></li>
3203 <li><a href="/graph">graph</a></li>
3202 <li><a href="/tags">tags</a></li>
3204 <li><a href="/tags">tags</a></li>
3203 <li><a href="/bookmarks">bookmarks</a></li>
3205 <li><a href="/bookmarks">bookmarks</a></li>
3204 <li><a href="/branches">branches</a></li>
3206 <li><a href="/branches">branches</a></li>
3205 </ul>
3207 </ul>
3206 <ul>
3208 <ul>
3207 <li><a href="/help">help</a></li>
3209 <li><a href="/help">help</a></li>
3208 </ul>
3210 </ul>
3209 </div>
3211 </div>
3210
3212
3211 <div class="main">
3213 <div class="main">
3212 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3214 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3213
3215
3214 <form class="search" action="/log">
3216 <form class="search" action="/log">
3215
3217
3216 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3218 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3217 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3219 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3218 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3220 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3219 </form>
3221 </form>
3220 <table class="bigtable">
3222 <table class="bigtable">
3221 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
3223 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
3222
3224
3223 <tr><td>
3225 <tr><td>
3224 <a href="/help/internals.bundle2">
3226 <a href="/help/internals.bundle2">
3225 bundle2
3227 bundle2
3226 </a>
3228 </a>
3227 </td><td>
3229 </td><td>
3228 Bundle2
3230 Bundle2
3229 </td></tr>
3231 </td></tr>
3230 <tr><td>
3232 <tr><td>
3231 <a href="/help/internals.bundles">
3233 <a href="/help/internals.bundles">
3232 bundles
3234 bundles
3233 </a>
3235 </a>
3234 </td><td>
3236 </td><td>
3235 Bundles
3237 Bundles
3236 </td></tr>
3238 </td></tr>
3237 <tr><td>
3239 <tr><td>
3238 <a href="/help/internals.censor">
3240 <a href="/help/internals.censor">
3239 censor
3241 censor
3240 </a>
3242 </a>
3241 </td><td>
3243 </td><td>
3242 Censor
3244 Censor
3243 </td></tr>
3245 </td></tr>
3244 <tr><td>
3246 <tr><td>
3245 <a href="/help/internals.changegroups">
3247 <a href="/help/internals.changegroups">
3246 changegroups
3248 changegroups
3247 </a>
3249 </a>
3248 </td><td>
3250 </td><td>
3249 Changegroups
3251 Changegroups
3250 </td></tr>
3252 </td></tr>
3251 <tr><td>
3253 <tr><td>
3252 <a href="/help/internals.config">
3254 <a href="/help/internals.config">
3253 config
3255 config
3254 </a>
3256 </a>
3255 </td><td>
3257 </td><td>
3256 Config Registrar
3258 Config Registrar
3257 </td></tr>
3259 </td></tr>
3258 <tr><td>
3260 <tr><td>
3259 <a href="/help/internals.requirements">
3261 <a href="/help/internals.requirements">
3260 requirements
3262 requirements
3261 </a>
3263 </a>
3262 </td><td>
3264 </td><td>
3263 Repository Requirements
3265 Repository Requirements
3264 </td></tr>
3266 </td></tr>
3265 <tr><td>
3267 <tr><td>
3266 <a href="/help/internals.revlogs">
3268 <a href="/help/internals.revlogs">
3267 revlogs
3269 revlogs
3268 </a>
3270 </a>
3269 </td><td>
3271 </td><td>
3270 Revision Logs
3272 Revision Logs
3271 </td></tr>
3273 </td></tr>
3272 <tr><td>
3274 <tr><td>
3273 <a href="/help/internals.wireprotocol">
3275 <a href="/help/internals.wireprotocol">
3274 wireprotocol
3276 wireprotocol
3275 </a>
3277 </a>
3276 </td><td>
3278 </td><td>
3277 Wire Protocol
3279 Wire Protocol
3278 </td></tr>
3280 </td></tr>
3279
3281
3280
3282
3281
3283
3282
3284
3283
3285
3284 </table>
3286 </table>
3285 </div>
3287 </div>
3286 </div>
3288 </div>
3287
3289
3288
3290
3289
3291
3290 </body>
3292 </body>
3291 </html>
3293 </html>
3292
3294
3293
3295
3294 Sub-topic topics rendered properly
3296 Sub-topic topics rendered properly
3295
3297
3296 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals.changegroups"
3298 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals.changegroups"
3297 200 Script output follows
3299 200 Script output follows
3298
3300
3299 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3301 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3300 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3302 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3301 <head>
3303 <head>
3302 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3304 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3303 <meta name="robots" content="index, nofollow" />
3305 <meta name="robots" content="index, nofollow" />
3304 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3306 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3305 <script type="text/javascript" src="/static/mercurial.js"></script>
3307 <script type="text/javascript" src="/static/mercurial.js"></script>
3306
3308
3307 <title>Help: internals.changegroups</title>
3309 <title>Help: internals.changegroups</title>
3308 </head>
3310 </head>
3309 <body>
3311 <body>
3310
3312
3311 <div class="container">
3313 <div class="container">
3312 <div class="menu">
3314 <div class="menu">
3313 <div class="logo">
3315 <div class="logo">
3314 <a href="https://mercurial-scm.org/">
3316 <a href="https://mercurial-scm.org/">
3315 <img src="/static/hglogo.png" alt="mercurial" /></a>
3317 <img src="/static/hglogo.png" alt="mercurial" /></a>
3316 </div>
3318 </div>
3317 <ul>
3319 <ul>
3318 <li><a href="/shortlog">log</a></li>
3320 <li><a href="/shortlog">log</a></li>
3319 <li><a href="/graph">graph</a></li>
3321 <li><a href="/graph">graph</a></li>
3320 <li><a href="/tags">tags</a></li>
3322 <li><a href="/tags">tags</a></li>
3321 <li><a href="/bookmarks">bookmarks</a></li>
3323 <li><a href="/bookmarks">bookmarks</a></li>
3322 <li><a href="/branches">branches</a></li>
3324 <li><a href="/branches">branches</a></li>
3323 </ul>
3325 </ul>
3324 <ul>
3326 <ul>
3325 <li class="active"><a href="/help">help</a></li>
3327 <li class="active"><a href="/help">help</a></li>
3326 </ul>
3328 </ul>
3327 </div>
3329 </div>
3328
3330
3329 <div class="main">
3331 <div class="main">
3330 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3332 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3331 <h3>Help: internals.changegroups</h3>
3333 <h3>Help: internals.changegroups</h3>
3332
3334
3333 <form class="search" action="/log">
3335 <form class="search" action="/log">
3334
3336
3335 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3337 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3336 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3338 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3337 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3339 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3338 </form>
3340 </form>
3339 <div id="doc">
3341 <div id="doc">
3340 <h1>Changegroups</h1>
3342 <h1>Changegroups</h1>
3341 <p>
3343 <p>
3342 Changegroups are representations of repository revlog data, specifically
3344 Changegroups are representations of repository revlog data, specifically
3343 the changelog data, root/flat manifest data, treemanifest data, and
3345 the changelog data, root/flat manifest data, treemanifest data, and
3344 filelogs.
3346 filelogs.
3345 </p>
3347 </p>
3346 <p>
3348 <p>
3347 There are 3 versions of changegroups: &quot;1&quot;, &quot;2&quot;, and &quot;3&quot;. From a
3349 There are 3 versions of changegroups: &quot;1&quot;, &quot;2&quot;, and &quot;3&quot;. From a
3348 high-level, versions &quot;1&quot; and &quot;2&quot; are almost exactly the same, with the
3350 high-level, versions &quot;1&quot; and &quot;2&quot; are almost exactly the same, with the
3349 only difference being an additional item in the *delta header*. Version
3351 only difference being an additional item in the *delta header*. Version
3350 &quot;3&quot; adds support for revlog flags in the *delta header* and optionally
3352 &quot;3&quot; adds support for revlog flags in the *delta header* and optionally
3351 exchanging treemanifests (enabled by setting an option on the
3353 exchanging treemanifests (enabled by setting an option on the
3352 &quot;changegroup&quot; part in the bundle2).
3354 &quot;changegroup&quot; part in the bundle2).
3353 </p>
3355 </p>
3354 <p>
3356 <p>
3355 Changegroups when not exchanging treemanifests consist of 3 logical
3357 Changegroups when not exchanging treemanifests consist of 3 logical
3356 segments:
3358 segments:
3357 </p>
3359 </p>
3358 <pre>
3360 <pre>
3359 +---------------------------------+
3361 +---------------------------------+
3360 | | | |
3362 | | | |
3361 | changeset | manifest | filelogs |
3363 | changeset | manifest | filelogs |
3362 | | | |
3364 | | | |
3363 | | | |
3365 | | | |
3364 +---------------------------------+
3366 +---------------------------------+
3365 </pre>
3367 </pre>
3366 <p>
3368 <p>
3367 When exchanging treemanifests, there are 4 logical segments:
3369 When exchanging treemanifests, there are 4 logical segments:
3368 </p>
3370 </p>
3369 <pre>
3371 <pre>
3370 +-------------------------------------------------+
3372 +-------------------------------------------------+
3371 | | | | |
3373 | | | | |
3372 | changeset | root | treemanifests | filelogs |
3374 | changeset | root | treemanifests | filelogs |
3373 | | manifest | | |
3375 | | manifest | | |
3374 | | | | |
3376 | | | | |
3375 +-------------------------------------------------+
3377 +-------------------------------------------------+
3376 </pre>
3378 </pre>
3377 <p>
3379 <p>
3378 The principle building block of each segment is a *chunk*. A *chunk*
3380 The principle building block of each segment is a *chunk*. A *chunk*
3379 is a framed piece of data:
3381 is a framed piece of data:
3380 </p>
3382 </p>
3381 <pre>
3383 <pre>
3382 +---------------------------------------+
3384 +---------------------------------------+
3383 | | |
3385 | | |
3384 | length | data |
3386 | length | data |
3385 | (4 bytes) | (&lt;length - 4&gt; bytes) |
3387 | (4 bytes) | (&lt;length - 4&gt; bytes) |
3386 | | |
3388 | | |
3387 +---------------------------------------+
3389 +---------------------------------------+
3388 </pre>
3390 </pre>
3389 <p>
3391 <p>
3390 All integers are big-endian signed integers. Each chunk starts with a 32-bit
3392 All integers are big-endian signed integers. Each chunk starts with a 32-bit
3391 integer indicating the length of the entire chunk (including the length field
3393 integer indicating the length of the entire chunk (including the length field
3392 itself).
3394 itself).
3393 </p>
3395 </p>
3394 <p>
3396 <p>
3395 There is a special case chunk that has a value of 0 for the length
3397 There is a special case chunk that has a value of 0 for the length
3396 (&quot;0x00000000&quot;). We call this an *empty chunk*.
3398 (&quot;0x00000000&quot;). We call this an *empty chunk*.
3397 </p>
3399 </p>
3398 <h2>Delta Groups</h2>
3400 <h2>Delta Groups</h2>
3399 <p>
3401 <p>
3400 A *delta group* expresses the content of a revlog as a series of deltas,
3402 A *delta group* expresses the content of a revlog as a series of deltas,
3401 or patches against previous revisions.
3403 or patches against previous revisions.
3402 </p>
3404 </p>
3403 <p>
3405 <p>
3404 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
3406 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
3405 to signal the end of the delta group:
3407 to signal the end of the delta group:
3406 </p>
3408 </p>
3407 <pre>
3409 <pre>
3408 +------------------------------------------------------------------------+
3410 +------------------------------------------------------------------------+
3409 | | | | | |
3411 | | | | | |
3410 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
3412 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
3411 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
3413 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
3412 | | | | | |
3414 | | | | | |
3413 +------------------------------------------------------------------------+
3415 +------------------------------------------------------------------------+
3414 </pre>
3416 </pre>
3415 <p>
3417 <p>
3416 Each *chunk*'s data consists of the following:
3418 Each *chunk*'s data consists of the following:
3417 </p>
3419 </p>
3418 <pre>
3420 <pre>
3419 +---------------------------------------+
3421 +---------------------------------------+
3420 | | |
3422 | | |
3421 | delta header | delta data |
3423 | delta header | delta data |
3422 | (various by version) | (various) |
3424 | (various by version) | (various) |
3423 | | |
3425 | | |
3424 +---------------------------------------+
3426 +---------------------------------------+
3425 </pre>
3427 </pre>
3426 <p>
3428 <p>
3427 The *delta data* is a series of *delta*s that describe a diff from an existing
3429 The *delta data* is a series of *delta*s that describe a diff from an existing
3428 entry (either that the recipient already has, or previously specified in the
3430 entry (either that the recipient already has, or previously specified in the
3429 bundle/changegroup).
3431 bundle/changegroup).
3430 </p>
3432 </p>
3431 <p>
3433 <p>
3432 The *delta header* is different between versions &quot;1&quot;, &quot;2&quot;, and
3434 The *delta header* is different between versions &quot;1&quot;, &quot;2&quot;, and
3433 &quot;3&quot; of the changegroup format.
3435 &quot;3&quot; of the changegroup format.
3434 </p>
3436 </p>
3435 <p>
3437 <p>
3436 Version 1 (headerlen=80):
3438 Version 1 (headerlen=80):
3437 </p>
3439 </p>
3438 <pre>
3440 <pre>
3439 +------------------------------------------------------+
3441 +------------------------------------------------------+
3440 | | | | |
3442 | | | | |
3441 | node | p1 node | p2 node | link node |
3443 | node | p1 node | p2 node | link node |
3442 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3444 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3443 | | | | |
3445 | | | | |
3444 +------------------------------------------------------+
3446 +------------------------------------------------------+
3445 </pre>
3447 </pre>
3446 <p>
3448 <p>
3447 Version 2 (headerlen=100):
3449 Version 2 (headerlen=100):
3448 </p>
3450 </p>
3449 <pre>
3451 <pre>
3450 +------------------------------------------------------------------+
3452 +------------------------------------------------------------------+
3451 | | | | | |
3453 | | | | | |
3452 | node | p1 node | p2 node | base node | link node |
3454 | node | p1 node | p2 node | base node | link node |
3453 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3455 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3454 | | | | | |
3456 | | | | | |
3455 +------------------------------------------------------------------+
3457 +------------------------------------------------------------------+
3456 </pre>
3458 </pre>
3457 <p>
3459 <p>
3458 Version 3 (headerlen=102):
3460 Version 3 (headerlen=102):
3459 </p>
3461 </p>
3460 <pre>
3462 <pre>
3461 +------------------------------------------------------------------------------+
3463 +------------------------------------------------------------------------------+
3462 | | | | | | |
3464 | | | | | | |
3463 | node | p1 node | p2 node | base node | link node | flags |
3465 | node | p1 node | p2 node | base node | link node | flags |
3464 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
3466 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
3465 | | | | | | |
3467 | | | | | | |
3466 +------------------------------------------------------------------------------+
3468 +------------------------------------------------------------------------------+
3467 </pre>
3469 </pre>
3468 <p>
3470 <p>
3469 The *delta data* consists of &quot;chunklen - 4 - headerlen&quot; bytes, which contain a
3471 The *delta data* consists of &quot;chunklen - 4 - headerlen&quot; bytes, which contain a
3470 series of *delta*s, densely packed (no separators). These deltas describe a diff
3472 series of *delta*s, densely packed (no separators). These deltas describe a diff
3471 from an existing entry (either that the recipient already has, or previously
3473 from an existing entry (either that the recipient already has, or previously
3472 specified in the bundle/changegroup). The format is described more fully in
3474 specified in the bundle/changegroup). The format is described more fully in
3473 &quot;hg help internals.bdiff&quot;, but briefly:
3475 &quot;hg help internals.bdiff&quot;, but briefly:
3474 </p>
3476 </p>
3475 <pre>
3477 <pre>
3476 +---------------------------------------------------------------+
3478 +---------------------------------------------------------------+
3477 | | | | |
3479 | | | | |
3478 | start offset | end offset | new length | content |
3480 | start offset | end offset | new length | content |
3479 | (4 bytes) | (4 bytes) | (4 bytes) | (&lt;new length&gt; bytes) |
3481 | (4 bytes) | (4 bytes) | (4 bytes) | (&lt;new length&gt; bytes) |
3480 | | | | |
3482 | | | | |
3481 +---------------------------------------------------------------+
3483 +---------------------------------------------------------------+
3482 </pre>
3484 </pre>
3483 <p>
3485 <p>
3484 Please note that the length field in the delta data does *not* include itself.
3486 Please note that the length field in the delta data does *not* include itself.
3485 </p>
3487 </p>
3486 <p>
3488 <p>
3487 In version 1, the delta is always applied against the previous node from
3489 In version 1, the delta is always applied against the previous node from
3488 the changegroup or the first parent if this is the first entry in the
3490 the changegroup or the first parent if this is the first entry in the
3489 changegroup.
3491 changegroup.
3490 </p>
3492 </p>
3491 <p>
3493 <p>
3492 In version 2 and up, the delta base node is encoded in the entry in the
3494 In version 2 and up, the delta base node is encoded in the entry in the
3493 changegroup. This allows the delta to be expressed against any parent,
3495 changegroup. This allows the delta to be expressed against any parent,
3494 which can result in smaller deltas and more efficient encoding of data.
3496 which can result in smaller deltas and more efficient encoding of data.
3495 </p>
3497 </p>
3496 <h2>Changeset Segment</h2>
3498 <h2>Changeset Segment</h2>
3497 <p>
3499 <p>
3498 The *changeset segment* consists of a single *delta group* holding
3500 The *changeset segment* consists of a single *delta group* holding
3499 changelog data. The *empty chunk* at the end of the *delta group* denotes
3501 changelog data. The *empty chunk* at the end of the *delta group* denotes
3500 the boundary to the *manifest segment*.
3502 the boundary to the *manifest segment*.
3501 </p>
3503 </p>
3502 <h2>Manifest Segment</h2>
3504 <h2>Manifest Segment</h2>
3503 <p>
3505 <p>
3504 The *manifest segment* consists of a single *delta group* holding manifest
3506 The *manifest segment* consists of a single *delta group* holding manifest
3505 data. If treemanifests are in use, it contains only the manifest for the
3507 data. If treemanifests are in use, it contains only the manifest for the
3506 root directory of the repository. Otherwise, it contains the entire
3508 root directory of the repository. Otherwise, it contains the entire
3507 manifest data. The *empty chunk* at the end of the *delta group* denotes
3509 manifest data. The *empty chunk* at the end of the *delta group* denotes
3508 the boundary to the next segment (either the *treemanifests segment* or the
3510 the boundary to the next segment (either the *treemanifests segment* or the
3509 *filelogs segment*, depending on version and the request options).
3511 *filelogs segment*, depending on version and the request options).
3510 </p>
3512 </p>
3511 <h3>Treemanifests Segment</h3>
3513 <h3>Treemanifests Segment</h3>
3512 <p>
3514 <p>
3513 The *treemanifests segment* only exists in changegroup version &quot;3&quot;, and
3515 The *treemanifests segment* only exists in changegroup version &quot;3&quot;, and
3514 only if the 'treemanifest' param is part of the bundle2 changegroup part
3516 only if the 'treemanifest' param is part of the bundle2 changegroup part
3515 (it is not possible to use changegroup version 3 outside of bundle2).
3517 (it is not possible to use changegroup version 3 outside of bundle2).
3516 Aside from the filenames in the *treemanifests segment* containing a
3518 Aside from the filenames in the *treemanifests segment* containing a
3517 trailing &quot;/&quot; character, it behaves identically to the *filelogs segment*
3519 trailing &quot;/&quot; character, it behaves identically to the *filelogs segment*
3518 (see below). The final sub-segment is followed by an *empty chunk* (logically,
3520 (see below). The final sub-segment is followed by an *empty chunk* (logically,
3519 a sub-segment with filename size 0). This denotes the boundary to the
3521 a sub-segment with filename size 0). This denotes the boundary to the
3520 *filelogs segment*.
3522 *filelogs segment*.
3521 </p>
3523 </p>
3522 <h2>Filelogs Segment</h2>
3524 <h2>Filelogs Segment</h2>
3523 <p>
3525 <p>
3524 The *filelogs segment* consists of multiple sub-segments, each
3526 The *filelogs segment* consists of multiple sub-segments, each
3525 corresponding to an individual file whose data is being described:
3527 corresponding to an individual file whose data is being described:
3526 </p>
3528 </p>
3527 <pre>
3529 <pre>
3528 +--------------------------------------------------+
3530 +--------------------------------------------------+
3529 | | | | | |
3531 | | | | | |
3530 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
3532 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
3531 | | | | | (4 bytes) |
3533 | | | | | (4 bytes) |
3532 | | | | | |
3534 | | | | | |
3533 +--------------------------------------------------+
3535 +--------------------------------------------------+
3534 </pre>
3536 </pre>
3535 <p>
3537 <p>
3536 The final filelog sub-segment is followed by an *empty chunk* (logically,
3538 The final filelog sub-segment is followed by an *empty chunk* (logically,
3537 a sub-segment with filename size 0). This denotes the end of the segment
3539 a sub-segment with filename size 0). This denotes the end of the segment
3538 and of the overall changegroup.
3540 and of the overall changegroup.
3539 </p>
3541 </p>
3540 <p>
3542 <p>
3541 Each filelog sub-segment consists of the following:
3543 Each filelog sub-segment consists of the following:
3542 </p>
3544 </p>
3543 <pre>
3545 <pre>
3544 +------------------------------------------------------+
3546 +------------------------------------------------------+
3545 | | | |
3547 | | | |
3546 | filename length | filename | delta group |
3548 | filename length | filename | delta group |
3547 | (4 bytes) | (&lt;length - 4&gt; bytes) | (various) |
3549 | (4 bytes) | (&lt;length - 4&gt; bytes) | (various) |
3548 | | | |
3550 | | | |
3549 +------------------------------------------------------+
3551 +------------------------------------------------------+
3550 </pre>
3552 </pre>
3551 <p>
3553 <p>
3552 That is, a *chunk* consisting of the filename (not terminated or padded)
3554 That is, a *chunk* consisting of the filename (not terminated or padded)
3553 followed by N chunks constituting the *delta group* for this file. The
3555 followed by N chunks constituting the *delta group* for this file. The
3554 *empty chunk* at the end of each *delta group* denotes the boundary to the
3556 *empty chunk* at the end of each *delta group* denotes the boundary to the
3555 next filelog sub-segment.
3557 next filelog sub-segment.
3556 </p>
3558 </p>
3557
3559
3558 </div>
3560 </div>
3559 </div>
3561 </div>
3560 </div>
3562 </div>
3561
3563
3562
3564
3563
3565
3564 </body>
3566 </body>
3565 </html>
3567 </html>
3566
3568
3567
3569
3568 $ get-with-headers.py 127.0.0.1:$HGPORT "help/unknowntopic"
3570 $ get-with-headers.py 127.0.0.1:$HGPORT "help/unknowntopic"
3569 404 Not Found
3571 404 Not Found
3570
3572
3571 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3573 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3572 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3574 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3573 <head>
3575 <head>
3574 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3576 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3575 <meta name="robots" content="index, nofollow" />
3577 <meta name="robots" content="index, nofollow" />
3576 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3578 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3577 <script type="text/javascript" src="/static/mercurial.js"></script>
3579 <script type="text/javascript" src="/static/mercurial.js"></script>
3578
3580
3579 <title>test: error</title>
3581 <title>test: error</title>
3580 </head>
3582 </head>
3581 <body>
3583 <body>
3582
3584
3583 <div class="container">
3585 <div class="container">
3584 <div class="menu">
3586 <div class="menu">
3585 <div class="logo">
3587 <div class="logo">
3586 <a href="https://mercurial-scm.org/">
3588 <a href="https://mercurial-scm.org/">
3587 <img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial" /></a>
3589 <img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial" /></a>
3588 </div>
3590 </div>
3589 <ul>
3591 <ul>
3590 <li><a href="/shortlog">log</a></li>
3592 <li><a href="/shortlog">log</a></li>
3591 <li><a href="/graph">graph</a></li>
3593 <li><a href="/graph">graph</a></li>
3592 <li><a href="/tags">tags</a></li>
3594 <li><a href="/tags">tags</a></li>
3593 <li><a href="/bookmarks">bookmarks</a></li>
3595 <li><a href="/bookmarks">bookmarks</a></li>
3594 <li><a href="/branches">branches</a></li>
3596 <li><a href="/branches">branches</a></li>
3595 </ul>
3597 </ul>
3596 <ul>
3598 <ul>
3597 <li><a href="/help">help</a></li>
3599 <li><a href="/help">help</a></li>
3598 </ul>
3600 </ul>
3599 </div>
3601 </div>
3600
3602
3601 <div class="main">
3603 <div class="main">
3602
3604
3603 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3605 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3604 <h3>error</h3>
3606 <h3>error</h3>
3605
3607
3606
3608
3607 <form class="search" action="/log">
3609 <form class="search" action="/log">
3608
3610
3609 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3611 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3610 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3612 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3611 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3613 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3612 </form>
3614 </form>
3613
3615
3614 <div class="description">
3616 <div class="description">
3615 <p>
3617 <p>
3616 An error occurred while processing your request:
3618 An error occurred while processing your request:
3617 </p>
3619 </p>
3618 <p>
3620 <p>
3619 Not Found
3621 Not Found
3620 </p>
3622 </p>
3621 </div>
3623 </div>
3622 </div>
3624 </div>
3623 </div>
3625 </div>
3624
3626
3625
3627
3626
3628
3627 </body>
3629 </body>
3628 </html>
3630 </html>
3629
3631
3630 [1]
3632 [1]
3631
3633
3632 $ killdaemons.py
3634 $ killdaemons.py
3633
3635
3634 #endif
3636 #endif
@@ -1,206 +1,206 b''
1 revlog.parseindex must be able to parse the index file even if
1 revlog.parseindex must be able to parse the index file even if
2 an index entry is split between two 64k blocks. The ideal test
2 an index entry is split between two 64k blocks. The ideal test
3 would be to create an index file with inline data where
3 would be to create an index file with inline data where
4 64k < size < 64k + 64 (64k is the size of the read buffer, 64 is
4 64k < size < 64k + 64 (64k is the size of the read buffer, 64 is
5 the size of an index entry) and with an index entry starting right
5 the size of an index entry) and with an index entry starting right
6 before the 64k block boundary, and try to read it.
6 before the 64k block boundary, and try to read it.
7 We approximate that by reducing the read buffer to 1 byte.
7 We approximate that by reducing the read buffer to 1 byte.
8
8
9 $ hg init a
9 $ hg init a
10 $ cd a
10 $ cd a
11 $ echo abc > foo
11 $ echo abc > foo
12 $ hg add foo
12 $ hg add foo
13 $ hg commit -m 'add foo'
13 $ hg commit -m 'add foo'
14 $ echo >> foo
14 $ echo >> foo
15 $ hg commit -m 'change foo'
15 $ hg commit -m 'change foo'
16 $ hg log -r 0:
16 $ hg log -r 0:
17 changeset: 0:7c31755bf9b5
17 changeset: 0:7c31755bf9b5
18 user: test
18 user: test
19 date: Thu Jan 01 00:00:00 1970 +0000
19 date: Thu Jan 01 00:00:00 1970 +0000
20 summary: add foo
20 summary: add foo
21
21
22 changeset: 1:26333235a41c
22 changeset: 1:26333235a41c
23 tag: tip
23 tag: tip
24 user: test
24 user: test
25 date: Thu Jan 01 00:00:00 1970 +0000
25 date: Thu Jan 01 00:00:00 1970 +0000
26 summary: change foo
26 summary: change foo
27
27
28 $ cat >> test.py << EOF
28 $ cat >> test.py << EOF
29 > from __future__ import print_function
29 > from __future__ import print_function
30 > from mercurial import changelog, vfs
30 > from mercurial import changelog, vfs
31 > from mercurial.node import *
31 > from mercurial.node import *
32 >
32 >
33 > class singlebyteread(object):
33 > class singlebyteread(object):
34 > def __init__(self, real):
34 > def __init__(self, real):
35 > self.real = real
35 > self.real = real
36 >
36 >
37 > def read(self, size=-1):
37 > def read(self, size=-1):
38 > if size == 65536:
38 > if size == 65536:
39 > size = 1
39 > size = 1
40 > return self.real.read(size)
40 > return self.real.read(size)
41 >
41 >
42 > def __getattr__(self, key):
42 > def __getattr__(self, key):
43 > return getattr(self.real, key)
43 > return getattr(self.real, key)
44 >
44 >
45 > def __enter__(self):
45 > def __enter__(self):
46 > self.real.__enter__()
46 > self.real.__enter__()
47 > return self
47 > return self
48 >
48 >
49 > def __exit__(self, *args, **kwargs):
49 > def __exit__(self, *args, **kwargs):
50 > return self.real.__exit__(*args, **kwargs)
50 > return self.real.__exit__(*args, **kwargs)
51 >
51 >
52 > def opener(*args):
52 > def opener(*args):
53 > o = vfs.vfs(*args)
53 > o = vfs.vfs(*args)
54 > def wrapper(*a, **kwargs):
54 > def wrapper(*a, **kwargs):
55 > f = o(*a, **kwargs)
55 > f = o(*a, **kwargs)
56 > return singlebyteread(f)
56 > return singlebyteread(f)
57 > return wrapper
57 > return wrapper
58 >
58 >
59 > cl = changelog.changelog(opener('.hg/store'))
59 > cl = changelog.changelog(opener('.hg/store'))
60 > print(len(cl), 'revisions:')
60 > print(len(cl), 'revisions:')
61 > for r in cl:
61 > for r in cl:
62 > print(short(cl.node(r)))
62 > print(short(cl.node(r)))
63 > EOF
63 > EOF
64 $ $PYTHON test.py
64 $ $PYTHON test.py
65 2 revisions:
65 2 revisions:
66 7c31755bf9b5
66 7c31755bf9b5
67 26333235a41c
67 26333235a41c
68
68
69 $ cd ..
69 $ cd ..
70
70
71 #if no-pure
71 #if no-pure
72
72
73 Test SEGV caused by bad revision passed to reachableroots() (issue4775):
73 Test SEGV caused by bad revision passed to reachableroots() (issue4775):
74
74
75 $ cd a
75 $ cd a
76
76
77 $ $PYTHON <<EOF
77 $ $PYTHON <<EOF
78 > from __future__ import print_function
78 > from __future__ import print_function
79 > from mercurial import changelog, vfs
79 > from mercurial import changelog, vfs
80 > cl = changelog.changelog(vfs.vfs('.hg/store'))
80 > cl = changelog.changelog(vfs.vfs('.hg/store'))
81 > print('good heads:')
81 > print('good heads:')
82 > for head in [0, len(cl) - 1, -1]:
82 > for head in [0, len(cl) - 1, -1]:
83 > print('%s: %r' % (head, cl.reachableroots(0, [head], [0])))
83 > print('%s: %r' % (head, cl.reachableroots(0, [head], [0])))
84 > print('bad heads:')
84 > print('bad heads:')
85 > for head in [len(cl), 10000, -2, -10000, None]:
85 > for head in [len(cl), 10000, -2, -10000, None]:
86 > print('%s:' % head, end=' ')
86 > print('%s:' % head, end=' ')
87 > try:
87 > try:
88 > cl.reachableroots(0, [head], [0])
88 > cl.reachableroots(0, [head], [0])
89 > print('uncaught buffer overflow?')
89 > print('uncaught buffer overflow?')
90 > except (IndexError, TypeError) as inst:
90 > except (IndexError, TypeError) as inst:
91 > print(inst)
91 > print(inst)
92 > print('good roots:')
92 > print('good roots:')
93 > for root in [0, len(cl) - 1, -1]:
93 > for root in [0, len(cl) - 1, -1]:
94 > print('%s: %r' % (root, cl.reachableroots(root, [len(cl) - 1], [root])))
94 > print('%s: %r' % (root, cl.reachableroots(root, [len(cl) - 1], [root])))
95 > print('out-of-range roots are ignored:')
95 > print('out-of-range roots are ignored:')
96 > for root in [len(cl), 10000, -2, -10000]:
96 > for root in [len(cl), 10000, -2, -10000]:
97 > print('%s: %r' % (root, cl.reachableroots(root, [len(cl) - 1], [root])))
97 > print('%s: %r' % (root, cl.reachableroots(root, [len(cl) - 1], [root])))
98 > print('bad roots:')
98 > print('bad roots:')
99 > for root in [None]:
99 > for root in [None]:
100 > print('%s:' % root, end=' ')
100 > print('%s:' % root, end=' ')
101 > try:
101 > try:
102 > cl.reachableroots(root, [len(cl) - 1], [root])
102 > cl.reachableroots(root, [len(cl) - 1], [root])
103 > print('uncaught error?')
103 > print('uncaught error?')
104 > except TypeError as inst:
104 > except TypeError as inst:
105 > print(inst)
105 > print(inst)
106 > EOF
106 > EOF
107 good heads:
107 good heads:
108 0: [0]
108 0: [0]
109 1: [0]
109 1: [0]
110 -1: []
110 -1: []
111 bad heads:
111 bad heads:
112 2: head out of range
112 2: head out of range
113 10000: head out of range
113 10000: head out of range
114 -2: head out of range
114 -2: head out of range
115 -10000: head out of range
115 -10000: head out of range
116 None: an integer is required
116 None: an integer is required
117 good roots:
117 good roots:
118 0: [0]
118 0: [0]
119 1: [1]
119 1: [1]
120 -1: [-1]
120 -1: [-1]
121 out-of-range roots are ignored:
121 out-of-range roots are ignored:
122 2: []
122 2: []
123 10000: []
123 10000: []
124 -2: []
124 -2: []
125 -10000: []
125 -10000: []
126 bad roots:
126 bad roots:
127 None: an integer is required
127 None: an integer is required
128
128
129 $ cd ..
129 $ cd ..
130
130
131 Test corrupted p1/p2 fields that could cause SEGV at parsers.c:
131 Test corrupted p1/p2 fields that could cause SEGV at parsers.c:
132
132
133 $ mkdir invalidparent
133 $ mkdir invalidparent
134 $ cd invalidparent
134 $ cd invalidparent
135
135
136 $ hg clone --pull -q --config phases.publish=False ../a limit
136 $ hg clone --pull -q --config phases.publish=False ../a limit
137 $ hg clone --pull -q --config phases.publish=False ../a segv
137 $ hg clone --pull -q --config phases.publish=False ../a segv
138 $ rm -R limit/.hg/cache segv/.hg/cache
138 $ rm -R limit/.hg/cache segv/.hg/cache
139
139
140 $ $PYTHON <<EOF
140 $ $PYTHON <<EOF
141 > data = open("limit/.hg/store/00changelog.i", "rb").read()
141 > data = open("limit/.hg/store/00changelog.i", "rb").read()
142 > for n, p in [(b'limit', b'\0\0\0\x02'), (b'segv', b'\0\x01\0\0')]:
142 > for n, p in [(b'limit', b'\0\0\0\x02'), (b'segv', b'\0\x01\0\0')]:
143 > # corrupt p1 at rev0 and p2 at rev1
143 > # corrupt p1 at rev0 and p2 at rev1
144 > d = data[:24] + p + data[28:127 + 28] + p + data[127 + 32:]
144 > d = data[:24] + p + data[28:127 + 28] + p + data[127 + 32:]
145 > open(n + b"/.hg/store/00changelog.i", "wb").write(d)
145 > open(n + b"/.hg/store/00changelog.i", "wb").write(d)
146 > EOF
146 > EOF
147
147
148 $ hg -R limit debugindex -f1 -c
148 $ hg -R limit debugrevlogindex -f1 -c
149 rev flag size link p1 p2 nodeid
149 rev flag size link p1 p2 nodeid
150 0 0000 62 0 2 -1 7c31755bf9b5
150 0 0000 62 0 2 -1 7c31755bf9b5
151 1 0000 65 1 0 2 26333235a41c
151 1 0000 65 1 0 2 26333235a41c
152
152
153 $ hg -R limit debugdeltachain -c
153 $ hg -R limit debugdeltachain -c
154 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio
154 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio
155 0 1 1 -1 base 63 62 63 1.01613 63 0 0.00000
155 0 1 1 -1 base 63 62 63 1.01613 63 0 0.00000
156 1 2 1 -1 base 66 65 66 1.01538 66 0 0.00000
156 1 2 1 -1 base 66 65 66 1.01538 66 0 0.00000
157
157
158 $ hg -R segv debugindex -f1 -c
158 $ hg -R segv debugrevlogindex -f1 -c
159 rev flag size link p1 p2 nodeid
159 rev flag size link p1 p2 nodeid
160 0 0000 62 0 65536 -1 7c31755bf9b5
160 0 0000 62 0 65536 -1 7c31755bf9b5
161 1 0000 65 1 0 65536 26333235a41c
161 1 0000 65 1 0 65536 26333235a41c
162
162
163 $ hg -R segv debugdeltachain -c
163 $ hg -R segv debugdeltachain -c
164 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio
164 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio
165 0 1 1 -1 base 63 62 63 1.01613 63 0 0.00000
165 0 1 1 -1 base 63 62 63 1.01613 63 0 0.00000
166 1 2 1 -1 base 66 65 66 1.01538 66 0 0.00000
166 1 2 1 -1 base 66 65 66 1.01538 66 0 0.00000
167
167
168 $ cat <<EOF > test.py
168 $ cat <<EOF > test.py
169 > from __future__ import print_function
169 > from __future__ import print_function
170 > import sys
170 > import sys
171 > from mercurial import changelog, vfs
171 > from mercurial import changelog, vfs
172 > cl = changelog.changelog(vfs.vfs(sys.argv[1]))
172 > cl = changelog.changelog(vfs.vfs(sys.argv[1]))
173 > n0, n1 = cl.node(0), cl.node(1)
173 > n0, n1 = cl.node(0), cl.node(1)
174 > ops = [
174 > ops = [
175 > ('reachableroots',
175 > ('reachableroots',
176 > lambda: cl.index.reachableroots2(0, [1], [0], False)),
176 > lambda: cl.index.reachableroots2(0, [1], [0], False)),
177 > ('compute_phases_map_sets', lambda: cl.computephases([[0], []])),
177 > ('compute_phases_map_sets', lambda: cl.computephases([[0], []])),
178 > ('index_headrevs', lambda: cl.headrevs()),
178 > ('index_headrevs', lambda: cl.headrevs()),
179 > ('find_gca_candidates', lambda: cl.commonancestorsheads(n0, n1)),
179 > ('find_gca_candidates', lambda: cl.commonancestorsheads(n0, n1)),
180 > ('find_deepest', lambda: cl.ancestor(n0, n1)),
180 > ('find_deepest', lambda: cl.ancestor(n0, n1)),
181 > ]
181 > ]
182 > for l, f in ops:
182 > for l, f in ops:
183 > print(l + ':', end=' ')
183 > print(l + ':', end=' ')
184 > try:
184 > try:
185 > f()
185 > f()
186 > print('uncaught buffer overflow?')
186 > print('uncaught buffer overflow?')
187 > except ValueError as inst:
187 > except ValueError as inst:
188 > print(inst)
188 > print(inst)
189 > EOF
189 > EOF
190
190
191 $ $PYTHON test.py limit/.hg/store
191 $ $PYTHON test.py limit/.hg/store
192 reachableroots: parent out of range
192 reachableroots: parent out of range
193 compute_phases_map_sets: parent out of range
193 compute_phases_map_sets: parent out of range
194 index_headrevs: parent out of range
194 index_headrevs: parent out of range
195 find_gca_candidates: parent out of range
195 find_gca_candidates: parent out of range
196 find_deepest: parent out of range
196 find_deepest: parent out of range
197 $ $PYTHON test.py segv/.hg/store
197 $ $PYTHON test.py segv/.hg/store
198 reachableroots: parent out of range
198 reachableroots: parent out of range
199 compute_phases_map_sets: parent out of range
199 compute_phases_map_sets: parent out of range
200 index_headrevs: parent out of range
200 index_headrevs: parent out of range
201 find_gca_candidates: parent out of range
201 find_gca_candidates: parent out of range
202 find_deepest: parent out of range
202 find_deepest: parent out of range
203
203
204 $ cd ..
204 $ cd ..
205
205
206 #endif
206 #endif
@@ -1,52 +1,52 b''
1 $ hg init empty-repo
1 $ hg init empty-repo
2 $ cd empty-repo
2 $ cd empty-repo
3
3
4 Flags on revlog version 0 are rejected
4 Flags on revlog version 0 are rejected
5
5
6 >>> with open('.hg/store/00changelog.i', 'wb') as fh:
6 >>> with open('.hg/store/00changelog.i', 'wb') as fh:
7 ... fh.write(b'\x00\x01\x00\x00') and None
7 ... fh.write(b'\x00\x01\x00\x00') and None
8
8
9 $ hg log
9 $ hg log
10 abort: unknown flags (0x01) in version 0 revlog 00changelog.i!
10 abort: unknown flags (0x01) in version 0 revlog 00changelog.i!
11 [255]
11 [255]
12
12
13 Unknown flags on revlog version 1 are rejected
13 Unknown flags on revlog version 1 are rejected
14
14
15 >>> with open('.hg/store/00changelog.i', 'wb') as fh:
15 >>> with open('.hg/store/00changelog.i', 'wb') as fh:
16 ... fh.write(b'\x00\x04\x00\x01') and None
16 ... fh.write(b'\x00\x04\x00\x01') and None
17
17
18 $ hg log
18 $ hg log
19 abort: unknown flags (0x04) in version 1 revlog 00changelog.i!
19 abort: unknown flags (0x04) in version 1 revlog 00changelog.i!
20 [255]
20 [255]
21
21
22 Unknown version is rejected
22 Unknown version is rejected
23
23
24 >>> with open('.hg/store/00changelog.i', 'wb') as fh:
24 >>> with open('.hg/store/00changelog.i', 'wb') as fh:
25 ... fh.write(b'\x00\x00\x00\x02') and None
25 ... fh.write(b'\x00\x00\x00\x02') and None
26
26
27 $ hg log
27 $ hg log
28 abort: unknown version (2) in revlog 00changelog.i!
28 abort: unknown version (2) in revlog 00changelog.i!
29 [255]
29 [255]
30
30
31 $ cd ..
31 $ cd ..
32
32
33 Test for CVE-2016-3630
33 Test for CVE-2016-3630
34
34
35 $ hg init
35 $ hg init
36
36
37 >>> open("a.i", "wb").write(
37 >>> open("a.i", "wb").write(
38 ... b"""eJxjYGZgZIAAYQYGxhgom+k/FMx8YKx9ZUaKSOyqo4cnuKb8mbqHV5cBCVTMWb1Cwqkhe4Gsg9AD
38 ... b"""eJxjYGZgZIAAYQYGxhgom+k/FMx8YKx9ZUaKSOyqo4cnuKb8mbqHV5cBCVTMWb1Cwqkhe4Gsg9AD
39 ... Joa3dYtcYYYBAQ8Qr4OqZAYRICPTSr5WKd/42rV36d+8/VmrNpv7NP1jQAXrQE4BqQUARngwVA=="""
39 ... Joa3dYtcYYYBAQ8Qr4OqZAYRICPTSr5WKd/42rV36d+8/VmrNpv7NP1jQAXrQE4BqQUARngwVA=="""
40 ... .decode("base64").decode("zlib"))
40 ... .decode("base64").decode("zlib"))
41
41
42 $ hg debugindex a.i
42 $ hg debugrevlogindex a.i
43 rev linkrev nodeid p1 p2
43 rev linkrev nodeid p1 p2
44 0 2 99e0332bd498 000000000000 000000000000
44 0 2 99e0332bd498 000000000000 000000000000
45 1 3 6674f57a23d8 99e0332bd498 000000000000
45 1 3 6674f57a23d8 99e0332bd498 000000000000
46
46
47 >>> from mercurial import revlog, vfs
47 >>> from mercurial import revlog, vfs
48 >>> tvfs = vfs.vfs(b'.')
48 >>> tvfs = vfs.vfs(b'.')
49 >>> tvfs.options = {b'revlogv1': True}
49 >>> tvfs.options = {b'revlogv1': True}
50 >>> rl = revlog.revlog(tvfs, b'a.i')
50 >>> rl = revlog.revlog(tvfs, b'a.i')
51 >>> rl.revision(1)
51 >>> rl.revision(1)
52 mpatchError('patch cannot be decoded',)
52 mpatchError('patch cannot be decoded',)
General Comments 0
You need to be logged in to leave comments. Login now