##// END OF EJS Templates
debugcommands: introduce debugpeer command...
Gregory Szorc -
r35947:5f029d03 default
parent child Browse files
Show More
@@ -1,2478 +1,2497 b''
1 # debugcommands.py - command processing for debug* commands
1 # debugcommands.py - command processing for debug* commands
2 #
2 #
3 # Copyright 2005-2016 Matt Mackall <mpm@selenic.com>
3 # Copyright 2005-2016 Matt Mackall <mpm@selenic.com>
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 from __future__ import absolute_import
8 from __future__ import absolute_import
9
9
10 import codecs
10 import codecs
11 import collections
11 import collections
12 import difflib
12 import difflib
13 import errno
13 import errno
14 import operator
14 import operator
15 import os
15 import os
16 import random
16 import random
17 import socket
17 import socket
18 import ssl
18 import ssl
19 import string
19 import string
20 import sys
20 import sys
21 import tempfile
21 import tempfile
22 import time
22 import time
23
23
24 from .i18n import _
24 from .i18n import _
25 from .node import (
25 from .node import (
26 bin,
26 bin,
27 hex,
27 hex,
28 nullhex,
28 nullhex,
29 nullid,
29 nullid,
30 nullrev,
30 nullrev,
31 short,
31 short,
32 )
32 )
33 from . import (
33 from . import (
34 bundle2,
34 bundle2,
35 changegroup,
35 changegroup,
36 cmdutil,
36 cmdutil,
37 color,
37 color,
38 context,
38 context,
39 dagparser,
39 dagparser,
40 dagutil,
40 dagutil,
41 encoding,
41 encoding,
42 error,
42 error,
43 exchange,
43 exchange,
44 extensions,
44 extensions,
45 filemerge,
45 filemerge,
46 fileset,
46 fileset,
47 formatter,
47 formatter,
48 hg,
48 hg,
49 localrepo,
49 localrepo,
50 lock as lockmod,
50 lock as lockmod,
51 logcmdutil,
51 logcmdutil,
52 merge as mergemod,
52 merge as mergemod,
53 obsolete,
53 obsolete,
54 obsutil,
54 obsutil,
55 phases,
55 phases,
56 policy,
56 policy,
57 pvec,
57 pvec,
58 pycompat,
58 pycompat,
59 registrar,
59 registrar,
60 repair,
60 repair,
61 revlog,
61 revlog,
62 revset,
62 revset,
63 revsetlang,
63 revsetlang,
64 scmutil,
64 scmutil,
65 setdiscovery,
65 setdiscovery,
66 simplemerge,
66 simplemerge,
67 smartset,
67 smartset,
68 sslutil,
68 sslutil,
69 streamclone,
69 streamclone,
70 templater,
70 templater,
71 treediscovery,
71 treediscovery,
72 upgrade,
72 upgrade,
73 url as urlmod,
73 url as urlmod,
74 util,
74 util,
75 vfs as vfsmod,
75 vfs as vfsmod,
76 )
76 )
77
77
78 release = lockmod.release
78 release = lockmod.release
79
79
80 command = registrar.command()
80 command = registrar.command()
81
81
82 @command('debugancestor', [], _('[INDEX] REV1 REV2'), optionalrepo=True)
82 @command('debugancestor', [], _('[INDEX] REV1 REV2'), optionalrepo=True)
83 def debugancestor(ui, repo, *args):
83 def debugancestor(ui, repo, *args):
84 """find the ancestor revision of two revisions in a given index"""
84 """find the ancestor revision of two revisions in a given index"""
85 if len(args) == 3:
85 if len(args) == 3:
86 index, rev1, rev2 = args
86 index, rev1, rev2 = args
87 r = revlog.revlog(vfsmod.vfs(pycompat.getcwd(), audit=False), index)
87 r = revlog.revlog(vfsmod.vfs(pycompat.getcwd(), audit=False), index)
88 lookup = r.lookup
88 lookup = r.lookup
89 elif len(args) == 2:
89 elif len(args) == 2:
90 if not repo:
90 if not repo:
91 raise error.Abort(_('there is no Mercurial repository here '
91 raise error.Abort(_('there is no Mercurial repository here '
92 '(.hg not found)'))
92 '(.hg not found)'))
93 rev1, rev2 = args
93 rev1, rev2 = args
94 r = repo.changelog
94 r = repo.changelog
95 lookup = repo.lookup
95 lookup = repo.lookup
96 else:
96 else:
97 raise error.Abort(_('either two or three arguments required'))
97 raise error.Abort(_('either two or three arguments required'))
98 a = r.ancestor(lookup(rev1), lookup(rev2))
98 a = r.ancestor(lookup(rev1), lookup(rev2))
99 ui.write('%d:%s\n' % (r.rev(a), hex(a)))
99 ui.write('%d:%s\n' % (r.rev(a), hex(a)))
100
100
101 @command('debugapplystreamclonebundle', [], 'FILE')
101 @command('debugapplystreamclonebundle', [], 'FILE')
102 def debugapplystreamclonebundle(ui, repo, fname):
102 def debugapplystreamclonebundle(ui, repo, fname):
103 """apply a stream clone bundle file"""
103 """apply a stream clone bundle file"""
104 f = hg.openpath(ui, fname)
104 f = hg.openpath(ui, fname)
105 gen = exchange.readbundle(ui, f, fname)
105 gen = exchange.readbundle(ui, f, fname)
106 gen.apply(repo)
106 gen.apply(repo)
107
107
108 @command('debugbuilddag',
108 @command('debugbuilddag',
109 [('m', 'mergeable-file', None, _('add single file mergeable changes')),
109 [('m', 'mergeable-file', None, _('add single file mergeable changes')),
110 ('o', 'overwritten-file', None, _('add single file all revs overwrite')),
110 ('o', 'overwritten-file', None, _('add single file all revs overwrite')),
111 ('n', 'new-file', None, _('add new file at each rev'))],
111 ('n', 'new-file', None, _('add new file at each rev'))],
112 _('[OPTION]... [TEXT]'))
112 _('[OPTION]... [TEXT]'))
113 def debugbuilddag(ui, repo, text=None,
113 def debugbuilddag(ui, repo, text=None,
114 mergeable_file=False,
114 mergeable_file=False,
115 overwritten_file=False,
115 overwritten_file=False,
116 new_file=False):
116 new_file=False):
117 """builds a repo with a given DAG from scratch in the current empty repo
117 """builds a repo with a given DAG from scratch in the current empty repo
118
118
119 The description of the DAG is read from stdin if not given on the
119 The description of the DAG is read from stdin if not given on the
120 command line.
120 command line.
121
121
122 Elements:
122 Elements:
123
123
124 - "+n" is a linear run of n nodes based on the current default parent
124 - "+n" is a linear run of n nodes based on the current default parent
125 - "." is a single node based on the current default parent
125 - "." is a single node based on the current default parent
126 - "$" resets the default parent to null (implied at the start);
126 - "$" resets the default parent to null (implied at the start);
127 otherwise the default parent is always the last node created
127 otherwise the default parent is always the last node created
128 - "<p" sets the default parent to the backref p
128 - "<p" sets the default parent to the backref p
129 - "*p" is a fork at parent p, which is a backref
129 - "*p" is a fork at parent p, which is a backref
130 - "*p1/p2" is a merge of parents p1 and p2, which are backrefs
130 - "*p1/p2" is a merge of parents p1 and p2, which are backrefs
131 - "/p2" is a merge of the preceding node and p2
131 - "/p2" is a merge of the preceding node and p2
132 - ":tag" defines a local tag for the preceding node
132 - ":tag" defines a local tag for the preceding node
133 - "@branch" sets the named branch for subsequent nodes
133 - "@branch" sets the named branch for subsequent nodes
134 - "#...\\n" is a comment up to the end of the line
134 - "#...\\n" is a comment up to the end of the line
135
135
136 Whitespace between the above elements is ignored.
136 Whitespace between the above elements is ignored.
137
137
138 A backref is either
138 A backref is either
139
139
140 - a number n, which references the node curr-n, where curr is the current
140 - a number n, which references the node curr-n, where curr is the current
141 node, or
141 node, or
142 - the name of a local tag you placed earlier using ":tag", or
142 - the name of a local tag you placed earlier using ":tag", or
143 - empty to denote the default parent.
143 - empty to denote the default parent.
144
144
145 All string valued-elements are either strictly alphanumeric, or must
145 All string valued-elements are either strictly alphanumeric, or must
146 be enclosed in double quotes ("..."), with "\\" as escape character.
146 be enclosed in double quotes ("..."), with "\\" as escape character.
147 """
147 """
148
148
149 if text is None:
149 if text is None:
150 ui.status(_("reading DAG from stdin\n"))
150 ui.status(_("reading DAG from stdin\n"))
151 text = ui.fin.read()
151 text = ui.fin.read()
152
152
153 cl = repo.changelog
153 cl = repo.changelog
154 if len(cl) > 0:
154 if len(cl) > 0:
155 raise error.Abort(_('repository is not empty'))
155 raise error.Abort(_('repository is not empty'))
156
156
157 # determine number of revs in DAG
157 # determine number of revs in DAG
158 total = 0
158 total = 0
159 for type, data in dagparser.parsedag(text):
159 for type, data in dagparser.parsedag(text):
160 if type == 'n':
160 if type == 'n':
161 total += 1
161 total += 1
162
162
163 if mergeable_file:
163 if mergeable_file:
164 linesperrev = 2
164 linesperrev = 2
165 # make a file with k lines per rev
165 # make a file with k lines per rev
166 initialmergedlines = [str(i) for i in xrange(0, total * linesperrev)]
166 initialmergedlines = [str(i) for i in xrange(0, total * linesperrev)]
167 initialmergedlines.append("")
167 initialmergedlines.append("")
168
168
169 tags = []
169 tags = []
170
170
171 wlock = lock = tr = None
171 wlock = lock = tr = None
172 try:
172 try:
173 wlock = repo.wlock()
173 wlock = repo.wlock()
174 lock = repo.lock()
174 lock = repo.lock()
175 tr = repo.transaction("builddag")
175 tr = repo.transaction("builddag")
176
176
177 at = -1
177 at = -1
178 atbranch = 'default'
178 atbranch = 'default'
179 nodeids = []
179 nodeids = []
180 id = 0
180 id = 0
181 ui.progress(_('building'), id, unit=_('revisions'), total=total)
181 ui.progress(_('building'), id, unit=_('revisions'), total=total)
182 for type, data in dagparser.parsedag(text):
182 for type, data in dagparser.parsedag(text):
183 if type == 'n':
183 if type == 'n':
184 ui.note(('node %s\n' % pycompat.bytestr(data)))
184 ui.note(('node %s\n' % pycompat.bytestr(data)))
185 id, ps = data
185 id, ps = data
186
186
187 files = []
187 files = []
188 filecontent = {}
188 filecontent = {}
189
189
190 p2 = None
190 p2 = None
191 if mergeable_file:
191 if mergeable_file:
192 fn = "mf"
192 fn = "mf"
193 p1 = repo[ps[0]]
193 p1 = repo[ps[0]]
194 if len(ps) > 1:
194 if len(ps) > 1:
195 p2 = repo[ps[1]]
195 p2 = repo[ps[1]]
196 pa = p1.ancestor(p2)
196 pa = p1.ancestor(p2)
197 base, local, other = [x[fn].data() for x in (pa, p1,
197 base, local, other = [x[fn].data() for x in (pa, p1,
198 p2)]
198 p2)]
199 m3 = simplemerge.Merge3Text(base, local, other)
199 m3 = simplemerge.Merge3Text(base, local, other)
200 ml = [l.strip() for l in m3.merge_lines()]
200 ml = [l.strip() for l in m3.merge_lines()]
201 ml.append("")
201 ml.append("")
202 elif at > 0:
202 elif at > 0:
203 ml = p1[fn].data().split("\n")
203 ml = p1[fn].data().split("\n")
204 else:
204 else:
205 ml = initialmergedlines
205 ml = initialmergedlines
206 ml[id * linesperrev] += " r%i" % id
206 ml[id * linesperrev] += " r%i" % id
207 mergedtext = "\n".join(ml)
207 mergedtext = "\n".join(ml)
208 files.append(fn)
208 files.append(fn)
209 filecontent[fn] = mergedtext
209 filecontent[fn] = mergedtext
210
210
211 if overwritten_file:
211 if overwritten_file:
212 fn = "of"
212 fn = "of"
213 files.append(fn)
213 files.append(fn)
214 filecontent[fn] = "r%i\n" % id
214 filecontent[fn] = "r%i\n" % id
215
215
216 if new_file:
216 if new_file:
217 fn = "nf%i" % id
217 fn = "nf%i" % id
218 files.append(fn)
218 files.append(fn)
219 filecontent[fn] = "r%i\n" % id
219 filecontent[fn] = "r%i\n" % id
220 if len(ps) > 1:
220 if len(ps) > 1:
221 if not p2:
221 if not p2:
222 p2 = repo[ps[1]]
222 p2 = repo[ps[1]]
223 for fn in p2:
223 for fn in p2:
224 if fn.startswith("nf"):
224 if fn.startswith("nf"):
225 files.append(fn)
225 files.append(fn)
226 filecontent[fn] = p2[fn].data()
226 filecontent[fn] = p2[fn].data()
227
227
228 def fctxfn(repo, cx, path):
228 def fctxfn(repo, cx, path):
229 if path in filecontent:
229 if path in filecontent:
230 return context.memfilectx(repo, cx, path,
230 return context.memfilectx(repo, cx, path,
231 filecontent[path])
231 filecontent[path])
232 return None
232 return None
233
233
234 if len(ps) == 0 or ps[0] < 0:
234 if len(ps) == 0 or ps[0] < 0:
235 pars = [None, None]
235 pars = [None, None]
236 elif len(ps) == 1:
236 elif len(ps) == 1:
237 pars = [nodeids[ps[0]], None]
237 pars = [nodeids[ps[0]], None]
238 else:
238 else:
239 pars = [nodeids[p] for p in ps]
239 pars = [nodeids[p] for p in ps]
240 cx = context.memctx(repo, pars, "r%i" % id, files, fctxfn,
240 cx = context.memctx(repo, pars, "r%i" % id, files, fctxfn,
241 date=(id, 0),
241 date=(id, 0),
242 user="debugbuilddag",
242 user="debugbuilddag",
243 extra={'branch': atbranch})
243 extra={'branch': atbranch})
244 nodeid = repo.commitctx(cx)
244 nodeid = repo.commitctx(cx)
245 nodeids.append(nodeid)
245 nodeids.append(nodeid)
246 at = id
246 at = id
247 elif type == 'l':
247 elif type == 'l':
248 id, name = data
248 id, name = data
249 ui.note(('tag %s\n' % name))
249 ui.note(('tag %s\n' % name))
250 tags.append("%s %s\n" % (hex(repo.changelog.node(id)), name))
250 tags.append("%s %s\n" % (hex(repo.changelog.node(id)), name))
251 elif type == 'a':
251 elif type == 'a':
252 ui.note(('branch %s\n' % data))
252 ui.note(('branch %s\n' % data))
253 atbranch = data
253 atbranch = data
254 ui.progress(_('building'), id, unit=_('revisions'), total=total)
254 ui.progress(_('building'), id, unit=_('revisions'), total=total)
255 tr.close()
255 tr.close()
256
256
257 if tags:
257 if tags:
258 repo.vfs.write("localtags", "".join(tags))
258 repo.vfs.write("localtags", "".join(tags))
259 finally:
259 finally:
260 ui.progress(_('building'), None)
260 ui.progress(_('building'), None)
261 release(tr, lock, wlock)
261 release(tr, lock, wlock)
262
262
263 def _debugchangegroup(ui, gen, all=None, indent=0, **opts):
263 def _debugchangegroup(ui, gen, all=None, indent=0, **opts):
264 indent_string = ' ' * indent
264 indent_string = ' ' * indent
265 if all:
265 if all:
266 ui.write(("%sformat: id, p1, p2, cset, delta base, len(delta)\n")
266 ui.write(("%sformat: id, p1, p2, cset, delta base, len(delta)\n")
267 % indent_string)
267 % indent_string)
268
268
269 def showchunks(named):
269 def showchunks(named):
270 ui.write("\n%s%s\n" % (indent_string, named))
270 ui.write("\n%s%s\n" % (indent_string, named))
271 for deltadata in gen.deltaiter():
271 for deltadata in gen.deltaiter():
272 node, p1, p2, cs, deltabase, delta, flags = deltadata
272 node, p1, p2, cs, deltabase, delta, flags = deltadata
273 ui.write("%s%s %s %s %s %s %s\n" %
273 ui.write("%s%s %s %s %s %s %s\n" %
274 (indent_string, hex(node), hex(p1), hex(p2),
274 (indent_string, hex(node), hex(p1), hex(p2),
275 hex(cs), hex(deltabase), len(delta)))
275 hex(cs), hex(deltabase), len(delta)))
276
276
277 chunkdata = gen.changelogheader()
277 chunkdata = gen.changelogheader()
278 showchunks("changelog")
278 showchunks("changelog")
279 chunkdata = gen.manifestheader()
279 chunkdata = gen.manifestheader()
280 showchunks("manifest")
280 showchunks("manifest")
281 for chunkdata in iter(gen.filelogheader, {}):
281 for chunkdata in iter(gen.filelogheader, {}):
282 fname = chunkdata['filename']
282 fname = chunkdata['filename']
283 showchunks(fname)
283 showchunks(fname)
284 else:
284 else:
285 if isinstance(gen, bundle2.unbundle20):
285 if isinstance(gen, bundle2.unbundle20):
286 raise error.Abort(_('use debugbundle2 for this file'))
286 raise error.Abort(_('use debugbundle2 for this file'))
287 chunkdata = gen.changelogheader()
287 chunkdata = gen.changelogheader()
288 for deltadata in gen.deltaiter():
288 for deltadata in gen.deltaiter():
289 node, p1, p2, cs, deltabase, delta, flags = deltadata
289 node, p1, p2, cs, deltabase, delta, flags = deltadata
290 ui.write("%s%s\n" % (indent_string, hex(node)))
290 ui.write("%s%s\n" % (indent_string, hex(node)))
291
291
292 def _debugobsmarkers(ui, part, indent=0, **opts):
292 def _debugobsmarkers(ui, part, indent=0, **opts):
293 """display version and markers contained in 'data'"""
293 """display version and markers contained in 'data'"""
294 opts = pycompat.byteskwargs(opts)
294 opts = pycompat.byteskwargs(opts)
295 data = part.read()
295 data = part.read()
296 indent_string = ' ' * indent
296 indent_string = ' ' * indent
297 try:
297 try:
298 version, markers = obsolete._readmarkers(data)
298 version, markers = obsolete._readmarkers(data)
299 except error.UnknownVersion as exc:
299 except error.UnknownVersion as exc:
300 msg = "%sunsupported version: %s (%d bytes)\n"
300 msg = "%sunsupported version: %s (%d bytes)\n"
301 msg %= indent_string, exc.version, len(data)
301 msg %= indent_string, exc.version, len(data)
302 ui.write(msg)
302 ui.write(msg)
303 else:
303 else:
304 msg = "%sversion: %d (%d bytes)\n"
304 msg = "%sversion: %d (%d bytes)\n"
305 msg %= indent_string, version, len(data)
305 msg %= indent_string, version, len(data)
306 ui.write(msg)
306 ui.write(msg)
307 fm = ui.formatter('debugobsolete', opts)
307 fm = ui.formatter('debugobsolete', opts)
308 for rawmarker in sorted(markers):
308 for rawmarker in sorted(markers):
309 m = obsutil.marker(None, rawmarker)
309 m = obsutil.marker(None, rawmarker)
310 fm.startitem()
310 fm.startitem()
311 fm.plain(indent_string)
311 fm.plain(indent_string)
312 cmdutil.showmarker(fm, m)
312 cmdutil.showmarker(fm, m)
313 fm.end()
313 fm.end()
314
314
315 def _debugphaseheads(ui, data, indent=0):
315 def _debugphaseheads(ui, data, indent=0):
316 """display version and markers contained in 'data'"""
316 """display version and markers contained in 'data'"""
317 indent_string = ' ' * indent
317 indent_string = ' ' * indent
318 headsbyphase = phases.binarydecode(data)
318 headsbyphase = phases.binarydecode(data)
319 for phase in phases.allphases:
319 for phase in phases.allphases:
320 for head in headsbyphase[phase]:
320 for head in headsbyphase[phase]:
321 ui.write(indent_string)
321 ui.write(indent_string)
322 ui.write('%s %s\n' % (hex(head), phases.phasenames[phase]))
322 ui.write('%s %s\n' % (hex(head), phases.phasenames[phase]))
323
323
324 def _quasirepr(thing):
324 def _quasirepr(thing):
325 if isinstance(thing, (dict, util.sortdict, collections.OrderedDict)):
325 if isinstance(thing, (dict, util.sortdict, collections.OrderedDict)):
326 return '{%s}' % (
326 return '{%s}' % (
327 b', '.join(b'%s: %s' % (k, thing[k]) for k in sorted(thing)))
327 b', '.join(b'%s: %s' % (k, thing[k]) for k in sorted(thing)))
328 return pycompat.bytestr(repr(thing))
328 return pycompat.bytestr(repr(thing))
329
329
330 def _debugbundle2(ui, gen, all=None, **opts):
330 def _debugbundle2(ui, gen, all=None, **opts):
331 """lists the contents of a bundle2"""
331 """lists the contents of a bundle2"""
332 if not isinstance(gen, bundle2.unbundle20):
332 if not isinstance(gen, bundle2.unbundle20):
333 raise error.Abort(_('not a bundle2 file'))
333 raise error.Abort(_('not a bundle2 file'))
334 ui.write(('Stream params: %s\n' % _quasirepr(gen.params)))
334 ui.write(('Stream params: %s\n' % _quasirepr(gen.params)))
335 parttypes = opts.get(r'part_type', [])
335 parttypes = opts.get(r'part_type', [])
336 for part in gen.iterparts():
336 for part in gen.iterparts():
337 if parttypes and part.type not in parttypes:
337 if parttypes and part.type not in parttypes:
338 continue
338 continue
339 ui.write('%s -- %s\n' % (part.type, _quasirepr(part.params)))
339 ui.write('%s -- %s\n' % (part.type, _quasirepr(part.params)))
340 if part.type == 'changegroup':
340 if part.type == 'changegroup':
341 version = part.params.get('version', '01')
341 version = part.params.get('version', '01')
342 cg = changegroup.getunbundler(version, part, 'UN')
342 cg = changegroup.getunbundler(version, part, 'UN')
343 _debugchangegroup(ui, cg, all=all, indent=4, **opts)
343 _debugchangegroup(ui, cg, all=all, indent=4, **opts)
344 if part.type == 'obsmarkers':
344 if part.type == 'obsmarkers':
345 _debugobsmarkers(ui, part, indent=4, **opts)
345 _debugobsmarkers(ui, part, indent=4, **opts)
346 if part.type == 'phase-heads':
346 if part.type == 'phase-heads':
347 _debugphaseheads(ui, part, indent=4)
347 _debugphaseheads(ui, part, indent=4)
348
348
349 @command('debugbundle',
349 @command('debugbundle',
350 [('a', 'all', None, _('show all details')),
350 [('a', 'all', None, _('show all details')),
351 ('', 'part-type', [], _('show only the named part type')),
351 ('', 'part-type', [], _('show only the named part type')),
352 ('', 'spec', None, _('print the bundlespec of the bundle'))],
352 ('', 'spec', None, _('print the bundlespec of the bundle'))],
353 _('FILE'),
353 _('FILE'),
354 norepo=True)
354 norepo=True)
355 def debugbundle(ui, bundlepath, all=None, spec=None, **opts):
355 def debugbundle(ui, bundlepath, all=None, spec=None, **opts):
356 """lists the contents of a bundle"""
356 """lists the contents of a bundle"""
357 with hg.openpath(ui, bundlepath) as f:
357 with hg.openpath(ui, bundlepath) as f:
358 if spec:
358 if spec:
359 spec = exchange.getbundlespec(ui, f)
359 spec = exchange.getbundlespec(ui, f)
360 ui.write('%s\n' % spec)
360 ui.write('%s\n' % spec)
361 return
361 return
362
362
363 gen = exchange.readbundle(ui, f, bundlepath)
363 gen = exchange.readbundle(ui, f, bundlepath)
364 if isinstance(gen, bundle2.unbundle20):
364 if isinstance(gen, bundle2.unbundle20):
365 return _debugbundle2(ui, gen, all=all, **opts)
365 return _debugbundle2(ui, gen, all=all, **opts)
366 _debugchangegroup(ui, gen, all=all, **opts)
366 _debugchangegroup(ui, gen, all=all, **opts)
367
367
368 @command('debugcapabilities',
368 @command('debugcapabilities',
369 [], _('PATH'),
369 [], _('PATH'),
370 norepo=True)
370 norepo=True)
371 def debugcapabilities(ui, path, **opts):
371 def debugcapabilities(ui, path, **opts):
372 """lists the capabilities of a remote peer"""
372 """lists the capabilities of a remote peer"""
373 opts = pycompat.byteskwargs(opts)
373 opts = pycompat.byteskwargs(opts)
374 peer = hg.peer(ui, opts, path)
374 peer = hg.peer(ui, opts, path)
375 caps = peer.capabilities()
375 caps = peer.capabilities()
376 ui.write(('Main capabilities:\n'))
376 ui.write(('Main capabilities:\n'))
377 for c in sorted(caps):
377 for c in sorted(caps):
378 ui.write((' %s\n') % c)
378 ui.write((' %s\n') % c)
379 b2caps = bundle2.bundle2caps(peer)
379 b2caps = bundle2.bundle2caps(peer)
380 if b2caps:
380 if b2caps:
381 ui.write(('Bundle2 capabilities:\n'))
381 ui.write(('Bundle2 capabilities:\n'))
382 for key, values in sorted(b2caps.iteritems()):
382 for key, values in sorted(b2caps.iteritems()):
383 ui.write((' %s\n') % key)
383 ui.write((' %s\n') % key)
384 for v in values:
384 for v in values:
385 ui.write((' %s\n') % v)
385 ui.write((' %s\n') % v)
386
386
387 @command('debugcheckstate', [], '')
387 @command('debugcheckstate', [], '')
388 def debugcheckstate(ui, repo):
388 def debugcheckstate(ui, repo):
389 """validate the correctness of the current dirstate"""
389 """validate the correctness of the current dirstate"""
390 parent1, parent2 = repo.dirstate.parents()
390 parent1, parent2 = repo.dirstate.parents()
391 m1 = repo[parent1].manifest()
391 m1 = repo[parent1].manifest()
392 m2 = repo[parent2].manifest()
392 m2 = repo[parent2].manifest()
393 errors = 0
393 errors = 0
394 for f in repo.dirstate:
394 for f in repo.dirstate:
395 state = repo.dirstate[f]
395 state = repo.dirstate[f]
396 if state in "nr" and f not in m1:
396 if state in "nr" and f not in m1:
397 ui.warn(_("%s in state %s, but not in manifest1\n") % (f, state))
397 ui.warn(_("%s in state %s, but not in manifest1\n") % (f, state))
398 errors += 1
398 errors += 1
399 if state in "a" and f in m1:
399 if state in "a" and f in m1:
400 ui.warn(_("%s in state %s, but also in manifest1\n") % (f, state))
400 ui.warn(_("%s in state %s, but also in manifest1\n") % (f, state))
401 errors += 1
401 errors += 1
402 if state in "m" and f not in m1 and f not in m2:
402 if state in "m" and f not in m1 and f not in m2:
403 ui.warn(_("%s in state %s, but not in either manifest\n") %
403 ui.warn(_("%s in state %s, but not in either manifest\n") %
404 (f, state))
404 (f, state))
405 errors += 1
405 errors += 1
406 for f in m1:
406 for f in m1:
407 state = repo.dirstate[f]
407 state = repo.dirstate[f]
408 if state not in "nrm":
408 if state not in "nrm":
409 ui.warn(_("%s in manifest1, but listed as state %s") % (f, state))
409 ui.warn(_("%s in manifest1, but listed as state %s") % (f, state))
410 errors += 1
410 errors += 1
411 if errors:
411 if errors:
412 error = _(".hg/dirstate inconsistent with current parent's manifest")
412 error = _(".hg/dirstate inconsistent with current parent's manifest")
413 raise error.Abort(error)
413 raise error.Abort(error)
414
414
415 @command('debugcolor',
415 @command('debugcolor',
416 [('', 'style', None, _('show all configured styles'))],
416 [('', 'style', None, _('show all configured styles'))],
417 'hg debugcolor')
417 'hg debugcolor')
418 def debugcolor(ui, repo, **opts):
418 def debugcolor(ui, repo, **opts):
419 """show available color, effects or style"""
419 """show available color, effects or style"""
420 ui.write(('color mode: %s\n') % ui._colormode)
420 ui.write(('color mode: %s\n') % ui._colormode)
421 if opts.get(r'style'):
421 if opts.get(r'style'):
422 return _debugdisplaystyle(ui)
422 return _debugdisplaystyle(ui)
423 else:
423 else:
424 return _debugdisplaycolor(ui)
424 return _debugdisplaycolor(ui)
425
425
426 def _debugdisplaycolor(ui):
426 def _debugdisplaycolor(ui):
427 ui = ui.copy()
427 ui = ui.copy()
428 ui._styles.clear()
428 ui._styles.clear()
429 for effect in color._activeeffects(ui).keys():
429 for effect in color._activeeffects(ui).keys():
430 ui._styles[effect] = effect
430 ui._styles[effect] = effect
431 if ui._terminfoparams:
431 if ui._terminfoparams:
432 for k, v in ui.configitems('color'):
432 for k, v in ui.configitems('color'):
433 if k.startswith('color.'):
433 if k.startswith('color.'):
434 ui._styles[k] = k[6:]
434 ui._styles[k] = k[6:]
435 elif k.startswith('terminfo.'):
435 elif k.startswith('terminfo.'):
436 ui._styles[k] = k[9:]
436 ui._styles[k] = k[9:]
437 ui.write(_('available colors:\n'))
437 ui.write(_('available colors:\n'))
438 # sort label with a '_' after the other to group '_background' entry.
438 # sort label with a '_' after the other to group '_background' entry.
439 items = sorted(ui._styles.items(),
439 items = sorted(ui._styles.items(),
440 key=lambda i: ('_' in i[0], i[0], i[1]))
440 key=lambda i: ('_' in i[0], i[0], i[1]))
441 for colorname, label in items:
441 for colorname, label in items:
442 ui.write(('%s\n') % colorname, label=label)
442 ui.write(('%s\n') % colorname, label=label)
443
443
444 def _debugdisplaystyle(ui):
444 def _debugdisplaystyle(ui):
445 ui.write(_('available style:\n'))
445 ui.write(_('available style:\n'))
446 width = max(len(s) for s in ui._styles)
446 width = max(len(s) for s in ui._styles)
447 for label, effects in sorted(ui._styles.items()):
447 for label, effects in sorted(ui._styles.items()):
448 ui.write('%s' % label, label=label)
448 ui.write('%s' % label, label=label)
449 if effects:
449 if effects:
450 # 50
450 # 50
451 ui.write(': ')
451 ui.write(': ')
452 ui.write(' ' * (max(0, width - len(label))))
452 ui.write(' ' * (max(0, width - len(label))))
453 ui.write(', '.join(ui.label(e, e) for e in effects.split()))
453 ui.write(', '.join(ui.label(e, e) for e in effects.split()))
454 ui.write('\n')
454 ui.write('\n')
455
455
456 @command('debugcreatestreamclonebundle', [], 'FILE')
456 @command('debugcreatestreamclonebundle', [], 'FILE')
457 def debugcreatestreamclonebundle(ui, repo, fname):
457 def debugcreatestreamclonebundle(ui, repo, fname):
458 """create a stream clone bundle file
458 """create a stream clone bundle file
459
459
460 Stream bundles are special bundles that are essentially archives of
460 Stream bundles are special bundles that are essentially archives of
461 revlog files. They are commonly used for cloning very quickly.
461 revlog files. They are commonly used for cloning very quickly.
462 """
462 """
463 # TODO we may want to turn this into an abort when this functionality
463 # TODO we may want to turn this into an abort when this functionality
464 # is moved into `hg bundle`.
464 # is moved into `hg bundle`.
465 if phases.hassecret(repo):
465 if phases.hassecret(repo):
466 ui.warn(_('(warning: stream clone bundle will contain secret '
466 ui.warn(_('(warning: stream clone bundle will contain secret '
467 'revisions)\n'))
467 'revisions)\n'))
468
468
469 requirements, gen = streamclone.generatebundlev1(repo)
469 requirements, gen = streamclone.generatebundlev1(repo)
470 changegroup.writechunks(ui, gen, fname)
470 changegroup.writechunks(ui, gen, fname)
471
471
472 ui.write(_('bundle requirements: %s\n') % ', '.join(sorted(requirements)))
472 ui.write(_('bundle requirements: %s\n') % ', '.join(sorted(requirements)))
473
473
474 @command('debugdag',
474 @command('debugdag',
475 [('t', 'tags', None, _('use tags as labels')),
475 [('t', 'tags', None, _('use tags as labels')),
476 ('b', 'branches', None, _('annotate with branch names')),
476 ('b', 'branches', None, _('annotate with branch names')),
477 ('', 'dots', None, _('use dots for runs')),
477 ('', 'dots', None, _('use dots for runs')),
478 ('s', 'spaces', None, _('separate elements by spaces'))],
478 ('s', 'spaces', None, _('separate elements by spaces'))],
479 _('[OPTION]... [FILE [REV]...]'),
479 _('[OPTION]... [FILE [REV]...]'),
480 optionalrepo=True)
480 optionalrepo=True)
481 def debugdag(ui, repo, file_=None, *revs, **opts):
481 def debugdag(ui, repo, file_=None, *revs, **opts):
482 """format the changelog or an index DAG as a concise textual description
482 """format the changelog or an index DAG as a concise textual description
483
483
484 If you pass a revlog index, the revlog's DAG is emitted. If you list
484 If you pass a revlog index, the revlog's DAG is emitted. If you list
485 revision numbers, they get labeled in the output as rN.
485 revision numbers, they get labeled in the output as rN.
486
486
487 Otherwise, the changelog DAG of the current repo is emitted.
487 Otherwise, the changelog DAG of the current repo is emitted.
488 """
488 """
489 spaces = opts.get(r'spaces')
489 spaces = opts.get(r'spaces')
490 dots = opts.get(r'dots')
490 dots = opts.get(r'dots')
491 if file_:
491 if file_:
492 rlog = revlog.revlog(vfsmod.vfs(pycompat.getcwd(), audit=False),
492 rlog = revlog.revlog(vfsmod.vfs(pycompat.getcwd(), audit=False),
493 file_)
493 file_)
494 revs = set((int(r) for r in revs))
494 revs = set((int(r) for r in revs))
495 def events():
495 def events():
496 for r in rlog:
496 for r in rlog:
497 yield 'n', (r, list(p for p in rlog.parentrevs(r)
497 yield 'n', (r, list(p for p in rlog.parentrevs(r)
498 if p != -1))
498 if p != -1))
499 if r in revs:
499 if r in revs:
500 yield 'l', (r, "r%i" % r)
500 yield 'l', (r, "r%i" % r)
501 elif repo:
501 elif repo:
502 cl = repo.changelog
502 cl = repo.changelog
503 tags = opts.get(r'tags')
503 tags = opts.get(r'tags')
504 branches = opts.get(r'branches')
504 branches = opts.get(r'branches')
505 if tags:
505 if tags:
506 labels = {}
506 labels = {}
507 for l, n in repo.tags().items():
507 for l, n in repo.tags().items():
508 labels.setdefault(cl.rev(n), []).append(l)
508 labels.setdefault(cl.rev(n), []).append(l)
509 def events():
509 def events():
510 b = "default"
510 b = "default"
511 for r in cl:
511 for r in cl:
512 if branches:
512 if branches:
513 newb = cl.read(cl.node(r))[5]['branch']
513 newb = cl.read(cl.node(r))[5]['branch']
514 if newb != b:
514 if newb != b:
515 yield 'a', newb
515 yield 'a', newb
516 b = newb
516 b = newb
517 yield 'n', (r, list(p for p in cl.parentrevs(r)
517 yield 'n', (r, list(p for p in cl.parentrevs(r)
518 if p != -1))
518 if p != -1))
519 if tags:
519 if tags:
520 ls = labels.get(r)
520 ls = labels.get(r)
521 if ls:
521 if ls:
522 for l in ls:
522 for l in ls:
523 yield 'l', (r, l)
523 yield 'l', (r, l)
524 else:
524 else:
525 raise error.Abort(_('need repo for changelog dag'))
525 raise error.Abort(_('need repo for changelog dag'))
526
526
527 for line in dagparser.dagtextlines(events(),
527 for line in dagparser.dagtextlines(events(),
528 addspaces=spaces,
528 addspaces=spaces,
529 wraplabels=True,
529 wraplabels=True,
530 wrapannotations=True,
530 wrapannotations=True,
531 wrapnonlinear=dots,
531 wrapnonlinear=dots,
532 usedots=dots,
532 usedots=dots,
533 maxlinewidth=70):
533 maxlinewidth=70):
534 ui.write(line)
534 ui.write(line)
535 ui.write("\n")
535 ui.write("\n")
536
536
537 @command('debugdata', cmdutil.debugrevlogopts, _('-c|-m|FILE REV'))
537 @command('debugdata', cmdutil.debugrevlogopts, _('-c|-m|FILE REV'))
538 def debugdata(ui, repo, file_, rev=None, **opts):
538 def debugdata(ui, repo, file_, rev=None, **opts):
539 """dump the contents of a data file revision"""
539 """dump the contents of a data file revision"""
540 opts = pycompat.byteskwargs(opts)
540 opts = pycompat.byteskwargs(opts)
541 if opts.get('changelog') or opts.get('manifest') or opts.get('dir'):
541 if opts.get('changelog') or opts.get('manifest') or opts.get('dir'):
542 if rev is not None:
542 if rev is not None:
543 raise error.CommandError('debugdata', _('invalid arguments'))
543 raise error.CommandError('debugdata', _('invalid arguments'))
544 file_, rev = None, file_
544 file_, rev = None, file_
545 elif rev is None:
545 elif rev is None:
546 raise error.CommandError('debugdata', _('invalid arguments'))
546 raise error.CommandError('debugdata', _('invalid arguments'))
547 r = cmdutil.openrevlog(repo, 'debugdata', file_, opts)
547 r = cmdutil.openrevlog(repo, 'debugdata', file_, opts)
548 try:
548 try:
549 ui.write(r.revision(r.lookup(rev), raw=True))
549 ui.write(r.revision(r.lookup(rev), raw=True))
550 except KeyError:
550 except KeyError:
551 raise error.Abort(_('invalid revision identifier %s') % rev)
551 raise error.Abort(_('invalid revision identifier %s') % rev)
552
552
553 @command('debugdate',
553 @command('debugdate',
554 [('e', 'extended', None, _('try extended date formats'))],
554 [('e', 'extended', None, _('try extended date formats'))],
555 _('[-e] DATE [RANGE]'),
555 _('[-e] DATE [RANGE]'),
556 norepo=True, optionalrepo=True)
556 norepo=True, optionalrepo=True)
557 def debugdate(ui, date, range=None, **opts):
557 def debugdate(ui, date, range=None, **opts):
558 """parse and display a date"""
558 """parse and display a date"""
559 if opts[r"extended"]:
559 if opts[r"extended"]:
560 d = util.parsedate(date, util.extendeddateformats)
560 d = util.parsedate(date, util.extendeddateformats)
561 else:
561 else:
562 d = util.parsedate(date)
562 d = util.parsedate(date)
563 ui.write(("internal: %s %s\n") % d)
563 ui.write(("internal: %s %s\n") % d)
564 ui.write(("standard: %s\n") % util.datestr(d))
564 ui.write(("standard: %s\n") % util.datestr(d))
565 if range:
565 if range:
566 m = util.matchdate(range)
566 m = util.matchdate(range)
567 ui.write(("match: %s\n") % m(d[0]))
567 ui.write(("match: %s\n") % m(d[0]))
568
568
569 @command('debugdeltachain',
569 @command('debugdeltachain',
570 cmdutil.debugrevlogopts + cmdutil.formatteropts,
570 cmdutil.debugrevlogopts + cmdutil.formatteropts,
571 _('-c|-m|FILE'),
571 _('-c|-m|FILE'),
572 optionalrepo=True)
572 optionalrepo=True)
573 def debugdeltachain(ui, repo, file_=None, **opts):
573 def debugdeltachain(ui, repo, file_=None, **opts):
574 """dump information about delta chains in a revlog
574 """dump information about delta chains in a revlog
575
575
576 Output can be templatized. Available template keywords are:
576 Output can be templatized. Available template keywords are:
577
577
578 :``rev``: revision number
578 :``rev``: revision number
579 :``chainid``: delta chain identifier (numbered by unique base)
579 :``chainid``: delta chain identifier (numbered by unique base)
580 :``chainlen``: delta chain length to this revision
580 :``chainlen``: delta chain length to this revision
581 :``prevrev``: previous revision in delta chain
581 :``prevrev``: previous revision in delta chain
582 :``deltatype``: role of delta / how it was computed
582 :``deltatype``: role of delta / how it was computed
583 :``compsize``: compressed size of revision
583 :``compsize``: compressed size of revision
584 :``uncompsize``: uncompressed size of revision
584 :``uncompsize``: uncompressed size of revision
585 :``chainsize``: total size of compressed revisions in chain
585 :``chainsize``: total size of compressed revisions in chain
586 :``chainratio``: total chain size divided by uncompressed revision size
586 :``chainratio``: total chain size divided by uncompressed revision size
587 (new delta chains typically start at ratio 2.00)
587 (new delta chains typically start at ratio 2.00)
588 :``lindist``: linear distance from base revision in delta chain to end
588 :``lindist``: linear distance from base revision in delta chain to end
589 of this revision
589 of this revision
590 :``extradist``: total size of revisions not part of this delta chain from
590 :``extradist``: total size of revisions not part of this delta chain from
591 base of delta chain to end of this revision; a measurement
591 base of delta chain to end of this revision; a measurement
592 of how much extra data we need to read/seek across to read
592 of how much extra data we need to read/seek across to read
593 the delta chain for this revision
593 the delta chain for this revision
594 :``extraratio``: extradist divided by chainsize; another representation of
594 :``extraratio``: extradist divided by chainsize; another representation of
595 how much unrelated data is needed to load this delta chain
595 how much unrelated data is needed to load this delta chain
596
596
597 If the repository is configured to use the sparse read, additional keywords
597 If the repository is configured to use the sparse read, additional keywords
598 are available:
598 are available:
599
599
600 :``readsize``: total size of data read from the disk for a revision
600 :``readsize``: total size of data read from the disk for a revision
601 (sum of the sizes of all the blocks)
601 (sum of the sizes of all the blocks)
602 :``largestblock``: size of the largest block of data read from the disk
602 :``largestblock``: size of the largest block of data read from the disk
603 :``readdensity``: density of useful bytes in the data read from the disk
603 :``readdensity``: density of useful bytes in the data read from the disk
604 :``srchunks``: in how many data hunks the whole revision would be read
604 :``srchunks``: in how many data hunks the whole revision would be read
605
605
606 The sparse read can be enabled with experimental.sparse-read = True
606 The sparse read can be enabled with experimental.sparse-read = True
607 """
607 """
608 opts = pycompat.byteskwargs(opts)
608 opts = pycompat.byteskwargs(opts)
609 r = cmdutil.openrevlog(repo, 'debugdeltachain', file_, opts)
609 r = cmdutil.openrevlog(repo, 'debugdeltachain', file_, opts)
610 index = r.index
610 index = r.index
611 generaldelta = r.version & revlog.FLAG_GENERALDELTA
611 generaldelta = r.version & revlog.FLAG_GENERALDELTA
612 withsparseread = getattr(r, '_withsparseread', False)
612 withsparseread = getattr(r, '_withsparseread', False)
613
613
614 def revinfo(rev):
614 def revinfo(rev):
615 e = index[rev]
615 e = index[rev]
616 compsize = e[1]
616 compsize = e[1]
617 uncompsize = e[2]
617 uncompsize = e[2]
618 chainsize = 0
618 chainsize = 0
619
619
620 if generaldelta:
620 if generaldelta:
621 if e[3] == e[5]:
621 if e[3] == e[5]:
622 deltatype = 'p1'
622 deltatype = 'p1'
623 elif e[3] == e[6]:
623 elif e[3] == e[6]:
624 deltatype = 'p2'
624 deltatype = 'p2'
625 elif e[3] == rev - 1:
625 elif e[3] == rev - 1:
626 deltatype = 'prev'
626 deltatype = 'prev'
627 elif e[3] == rev:
627 elif e[3] == rev:
628 deltatype = 'base'
628 deltatype = 'base'
629 else:
629 else:
630 deltatype = 'other'
630 deltatype = 'other'
631 else:
631 else:
632 if e[3] == rev:
632 if e[3] == rev:
633 deltatype = 'base'
633 deltatype = 'base'
634 else:
634 else:
635 deltatype = 'prev'
635 deltatype = 'prev'
636
636
637 chain = r._deltachain(rev)[0]
637 chain = r._deltachain(rev)[0]
638 for iterrev in chain:
638 for iterrev in chain:
639 e = index[iterrev]
639 e = index[iterrev]
640 chainsize += e[1]
640 chainsize += e[1]
641
641
642 return compsize, uncompsize, deltatype, chain, chainsize
642 return compsize, uncompsize, deltatype, chain, chainsize
643
643
644 fm = ui.formatter('debugdeltachain', opts)
644 fm = ui.formatter('debugdeltachain', opts)
645
645
646 fm.plain(' rev chain# chainlen prev delta '
646 fm.plain(' rev chain# chainlen prev delta '
647 'size rawsize chainsize ratio lindist extradist '
647 'size rawsize chainsize ratio lindist extradist '
648 'extraratio')
648 'extraratio')
649 if withsparseread:
649 if withsparseread:
650 fm.plain(' readsize largestblk rddensity srchunks')
650 fm.plain(' readsize largestblk rddensity srchunks')
651 fm.plain('\n')
651 fm.plain('\n')
652
652
653 chainbases = {}
653 chainbases = {}
654 for rev in r:
654 for rev in r:
655 comp, uncomp, deltatype, chain, chainsize = revinfo(rev)
655 comp, uncomp, deltatype, chain, chainsize = revinfo(rev)
656 chainbase = chain[0]
656 chainbase = chain[0]
657 chainid = chainbases.setdefault(chainbase, len(chainbases) + 1)
657 chainid = chainbases.setdefault(chainbase, len(chainbases) + 1)
658 start = r.start
658 start = r.start
659 length = r.length
659 length = r.length
660 basestart = start(chainbase)
660 basestart = start(chainbase)
661 revstart = start(rev)
661 revstart = start(rev)
662 lineardist = revstart + comp - basestart
662 lineardist = revstart + comp - basestart
663 extradist = lineardist - chainsize
663 extradist = lineardist - chainsize
664 try:
664 try:
665 prevrev = chain[-2]
665 prevrev = chain[-2]
666 except IndexError:
666 except IndexError:
667 prevrev = -1
667 prevrev = -1
668
668
669 chainratio = float(chainsize) / float(uncomp)
669 chainratio = float(chainsize) / float(uncomp)
670 extraratio = float(extradist) / float(chainsize)
670 extraratio = float(extradist) / float(chainsize)
671
671
672 fm.startitem()
672 fm.startitem()
673 fm.write('rev chainid chainlen prevrev deltatype compsize '
673 fm.write('rev chainid chainlen prevrev deltatype compsize '
674 'uncompsize chainsize chainratio lindist extradist '
674 'uncompsize chainsize chainratio lindist extradist '
675 'extraratio',
675 'extraratio',
676 '%7d %7d %8d %8d %7s %10d %10d %10d %9.5f %9d %9d %10.5f',
676 '%7d %7d %8d %8d %7s %10d %10d %10d %9.5f %9d %9d %10.5f',
677 rev, chainid, len(chain), prevrev, deltatype, comp,
677 rev, chainid, len(chain), prevrev, deltatype, comp,
678 uncomp, chainsize, chainratio, lineardist, extradist,
678 uncomp, chainsize, chainratio, lineardist, extradist,
679 extraratio,
679 extraratio,
680 rev=rev, chainid=chainid, chainlen=len(chain),
680 rev=rev, chainid=chainid, chainlen=len(chain),
681 prevrev=prevrev, deltatype=deltatype, compsize=comp,
681 prevrev=prevrev, deltatype=deltatype, compsize=comp,
682 uncompsize=uncomp, chainsize=chainsize,
682 uncompsize=uncomp, chainsize=chainsize,
683 chainratio=chainratio, lindist=lineardist,
683 chainratio=chainratio, lindist=lineardist,
684 extradist=extradist, extraratio=extraratio)
684 extradist=extradist, extraratio=extraratio)
685 if withsparseread:
685 if withsparseread:
686 readsize = 0
686 readsize = 0
687 largestblock = 0
687 largestblock = 0
688 srchunks = 0
688 srchunks = 0
689
689
690 for revschunk in revlog._slicechunk(r, chain):
690 for revschunk in revlog._slicechunk(r, chain):
691 srchunks += 1
691 srchunks += 1
692 blkend = start(revschunk[-1]) + length(revschunk[-1])
692 blkend = start(revschunk[-1]) + length(revschunk[-1])
693 blksize = blkend - start(revschunk[0])
693 blksize = blkend - start(revschunk[0])
694
694
695 readsize += blksize
695 readsize += blksize
696 if largestblock < blksize:
696 if largestblock < blksize:
697 largestblock = blksize
697 largestblock = blksize
698
698
699 readdensity = float(chainsize) / float(readsize)
699 readdensity = float(chainsize) / float(readsize)
700
700
701 fm.write('readsize largestblock readdensity srchunks',
701 fm.write('readsize largestblock readdensity srchunks',
702 ' %10d %10d %9.5f %8d',
702 ' %10d %10d %9.5f %8d',
703 readsize, largestblock, readdensity, srchunks,
703 readsize, largestblock, readdensity, srchunks,
704 readsize=readsize, largestblock=largestblock,
704 readsize=readsize, largestblock=largestblock,
705 readdensity=readdensity, srchunks=srchunks)
705 readdensity=readdensity, srchunks=srchunks)
706
706
707 fm.plain('\n')
707 fm.plain('\n')
708
708
709 fm.end()
709 fm.end()
710
710
711 @command('debugdirstate|debugstate',
711 @command('debugdirstate|debugstate',
712 [('', 'nodates', None, _('do not display the saved mtime')),
712 [('', 'nodates', None, _('do not display the saved mtime')),
713 ('', 'datesort', None, _('sort by saved mtime'))],
713 ('', 'datesort', None, _('sort by saved mtime'))],
714 _('[OPTION]...'))
714 _('[OPTION]...'))
715 def debugstate(ui, repo, **opts):
715 def debugstate(ui, repo, **opts):
716 """show the contents of the current dirstate"""
716 """show the contents of the current dirstate"""
717
717
718 nodates = opts.get(r'nodates')
718 nodates = opts.get(r'nodates')
719 datesort = opts.get(r'datesort')
719 datesort = opts.get(r'datesort')
720
720
721 timestr = ""
721 timestr = ""
722 if datesort:
722 if datesort:
723 keyfunc = lambda x: (x[1][3], x[0]) # sort by mtime, then by filename
723 keyfunc = lambda x: (x[1][3], x[0]) # sort by mtime, then by filename
724 else:
724 else:
725 keyfunc = None # sort by filename
725 keyfunc = None # sort by filename
726 for file_, ent in sorted(repo.dirstate._map.iteritems(), key=keyfunc):
726 for file_, ent in sorted(repo.dirstate._map.iteritems(), key=keyfunc):
727 if ent[3] == -1:
727 if ent[3] == -1:
728 timestr = 'unset '
728 timestr = 'unset '
729 elif nodates:
729 elif nodates:
730 timestr = 'set '
730 timestr = 'set '
731 else:
731 else:
732 timestr = time.strftime(r"%Y-%m-%d %H:%M:%S ",
732 timestr = time.strftime(r"%Y-%m-%d %H:%M:%S ",
733 time.localtime(ent[3]))
733 time.localtime(ent[3]))
734 timestr = encoding.strtolocal(timestr)
734 timestr = encoding.strtolocal(timestr)
735 if ent[1] & 0o20000:
735 if ent[1] & 0o20000:
736 mode = 'lnk'
736 mode = 'lnk'
737 else:
737 else:
738 mode = '%3o' % (ent[1] & 0o777 & ~util.umask)
738 mode = '%3o' % (ent[1] & 0o777 & ~util.umask)
739 ui.write("%c %s %10d %s%s\n" % (ent[0], mode, ent[2], timestr, file_))
739 ui.write("%c %s %10d %s%s\n" % (ent[0], mode, ent[2], timestr, file_))
740 for f in repo.dirstate.copies():
740 for f in repo.dirstate.copies():
741 ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copied(f), f))
741 ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copied(f), f))
742
742
743 @command('debugdiscovery',
743 @command('debugdiscovery',
744 [('', 'old', None, _('use old-style discovery')),
744 [('', 'old', None, _('use old-style discovery')),
745 ('', 'nonheads', None,
745 ('', 'nonheads', None,
746 _('use old-style discovery with non-heads included')),
746 _('use old-style discovery with non-heads included')),
747 ('', 'rev', [], 'restrict discovery to this set of revs'),
747 ('', 'rev', [], 'restrict discovery to this set of revs'),
748 ] + cmdutil.remoteopts,
748 ] + cmdutil.remoteopts,
749 _('[--rev REV] [OTHER]'))
749 _('[--rev REV] [OTHER]'))
750 def debugdiscovery(ui, repo, remoteurl="default", **opts):
750 def debugdiscovery(ui, repo, remoteurl="default", **opts):
751 """runs the changeset discovery protocol in isolation"""
751 """runs the changeset discovery protocol in isolation"""
752 opts = pycompat.byteskwargs(opts)
752 opts = pycompat.byteskwargs(opts)
753 remoteurl, branches = hg.parseurl(ui.expandpath(remoteurl))
753 remoteurl, branches = hg.parseurl(ui.expandpath(remoteurl))
754 remote = hg.peer(repo, opts, remoteurl)
754 remote = hg.peer(repo, opts, remoteurl)
755 ui.status(_('comparing with %s\n') % util.hidepassword(remoteurl))
755 ui.status(_('comparing with %s\n') % util.hidepassword(remoteurl))
756
756
757 # make sure tests are repeatable
757 # make sure tests are repeatable
758 random.seed(12323)
758 random.seed(12323)
759
759
760 def doit(pushedrevs, remoteheads, remote=remote):
760 def doit(pushedrevs, remoteheads, remote=remote):
761 if opts.get('old'):
761 if opts.get('old'):
762 if not util.safehasattr(remote, 'branches'):
762 if not util.safehasattr(remote, 'branches'):
763 # enable in-client legacy support
763 # enable in-client legacy support
764 remote = localrepo.locallegacypeer(remote.local())
764 remote = localrepo.locallegacypeer(remote.local())
765 common, _in, hds = treediscovery.findcommonincoming(repo, remote,
765 common, _in, hds = treediscovery.findcommonincoming(repo, remote,
766 force=True)
766 force=True)
767 common = set(common)
767 common = set(common)
768 if not opts.get('nonheads'):
768 if not opts.get('nonheads'):
769 ui.write(("unpruned common: %s\n") %
769 ui.write(("unpruned common: %s\n") %
770 " ".join(sorted(short(n) for n in common)))
770 " ".join(sorted(short(n) for n in common)))
771 dag = dagutil.revlogdag(repo.changelog)
771 dag = dagutil.revlogdag(repo.changelog)
772 all = dag.ancestorset(dag.internalizeall(common))
772 all = dag.ancestorset(dag.internalizeall(common))
773 common = dag.externalizeall(dag.headsetofconnecteds(all))
773 common = dag.externalizeall(dag.headsetofconnecteds(all))
774 else:
774 else:
775 nodes = None
775 nodes = None
776 if pushedrevs:
776 if pushedrevs:
777 revs = scmutil.revrange(repo, pushedrevs)
777 revs = scmutil.revrange(repo, pushedrevs)
778 nodes = [repo[r].node() for r in revs]
778 nodes = [repo[r].node() for r in revs]
779 common, any, hds = setdiscovery.findcommonheads(ui, repo, remote,
779 common, any, hds = setdiscovery.findcommonheads(ui, repo, remote,
780 ancestorsof=nodes)
780 ancestorsof=nodes)
781 common = set(common)
781 common = set(common)
782 rheads = set(hds)
782 rheads = set(hds)
783 lheads = set(repo.heads())
783 lheads = set(repo.heads())
784 ui.write(("common heads: %s\n") %
784 ui.write(("common heads: %s\n") %
785 " ".join(sorted(short(n) for n in common)))
785 " ".join(sorted(short(n) for n in common)))
786 if lheads <= common:
786 if lheads <= common:
787 ui.write(("local is subset\n"))
787 ui.write(("local is subset\n"))
788 elif rheads <= common:
788 elif rheads <= common:
789 ui.write(("remote is subset\n"))
789 ui.write(("remote is subset\n"))
790
790
791 remoterevs, _checkout = hg.addbranchrevs(repo, remote, branches, revs=None)
791 remoterevs, _checkout = hg.addbranchrevs(repo, remote, branches, revs=None)
792 localrevs = opts['rev']
792 localrevs = opts['rev']
793 doit(localrevs, remoterevs)
793 doit(localrevs, remoterevs)
794
794
795 _chunksize = 4 << 10
795 _chunksize = 4 << 10
796
796
797 @command('debugdownload',
797 @command('debugdownload',
798 [
798 [
799 ('o', 'output', '', _('path')),
799 ('o', 'output', '', _('path')),
800 ],
800 ],
801 optionalrepo=True)
801 optionalrepo=True)
802 def debugdownload(ui, repo, url, output=None, **opts):
802 def debugdownload(ui, repo, url, output=None, **opts):
803 """download a resource using Mercurial logic and config
803 """download a resource using Mercurial logic and config
804 """
804 """
805 fh = urlmod.open(ui, url, output)
805 fh = urlmod.open(ui, url, output)
806
806
807 dest = ui
807 dest = ui
808 if output:
808 if output:
809 dest = open(output, "wb", _chunksize)
809 dest = open(output, "wb", _chunksize)
810 try:
810 try:
811 data = fh.read(_chunksize)
811 data = fh.read(_chunksize)
812 while data:
812 while data:
813 dest.write(data)
813 dest.write(data)
814 data = fh.read(_chunksize)
814 data = fh.read(_chunksize)
815 finally:
815 finally:
816 if output:
816 if output:
817 dest.close()
817 dest.close()
818
818
819 @command('debugextensions', cmdutil.formatteropts, [], norepo=True)
819 @command('debugextensions', cmdutil.formatteropts, [], norepo=True)
820 def debugextensions(ui, **opts):
820 def debugextensions(ui, **opts):
821 '''show information about active extensions'''
821 '''show information about active extensions'''
822 opts = pycompat.byteskwargs(opts)
822 opts = pycompat.byteskwargs(opts)
823 exts = extensions.extensions(ui)
823 exts = extensions.extensions(ui)
824 hgver = util.version()
824 hgver = util.version()
825 fm = ui.formatter('debugextensions', opts)
825 fm = ui.formatter('debugextensions', opts)
826 for extname, extmod in sorted(exts, key=operator.itemgetter(0)):
826 for extname, extmod in sorted(exts, key=operator.itemgetter(0)):
827 isinternal = extensions.ismoduleinternal(extmod)
827 isinternal = extensions.ismoduleinternal(extmod)
828 extsource = pycompat.fsencode(extmod.__file__)
828 extsource = pycompat.fsencode(extmod.__file__)
829 if isinternal:
829 if isinternal:
830 exttestedwith = [] # never expose magic string to users
830 exttestedwith = [] # never expose magic string to users
831 else:
831 else:
832 exttestedwith = getattr(extmod, 'testedwith', '').split()
832 exttestedwith = getattr(extmod, 'testedwith', '').split()
833 extbuglink = getattr(extmod, 'buglink', None)
833 extbuglink = getattr(extmod, 'buglink', None)
834
834
835 fm.startitem()
835 fm.startitem()
836
836
837 if ui.quiet or ui.verbose:
837 if ui.quiet or ui.verbose:
838 fm.write('name', '%s\n', extname)
838 fm.write('name', '%s\n', extname)
839 else:
839 else:
840 fm.write('name', '%s', extname)
840 fm.write('name', '%s', extname)
841 if isinternal or hgver in exttestedwith:
841 if isinternal or hgver in exttestedwith:
842 fm.plain('\n')
842 fm.plain('\n')
843 elif not exttestedwith:
843 elif not exttestedwith:
844 fm.plain(_(' (untested!)\n'))
844 fm.plain(_(' (untested!)\n'))
845 else:
845 else:
846 lasttestedversion = exttestedwith[-1]
846 lasttestedversion = exttestedwith[-1]
847 fm.plain(' (%s!)\n' % lasttestedversion)
847 fm.plain(' (%s!)\n' % lasttestedversion)
848
848
849 fm.condwrite(ui.verbose and extsource, 'source',
849 fm.condwrite(ui.verbose and extsource, 'source',
850 _(' location: %s\n'), extsource or "")
850 _(' location: %s\n'), extsource or "")
851
851
852 if ui.verbose:
852 if ui.verbose:
853 fm.plain(_(' bundled: %s\n') % ['no', 'yes'][isinternal])
853 fm.plain(_(' bundled: %s\n') % ['no', 'yes'][isinternal])
854 fm.data(bundled=isinternal)
854 fm.data(bundled=isinternal)
855
855
856 fm.condwrite(ui.verbose and exttestedwith, 'testedwith',
856 fm.condwrite(ui.verbose and exttestedwith, 'testedwith',
857 _(' tested with: %s\n'),
857 _(' tested with: %s\n'),
858 fm.formatlist(exttestedwith, name='ver'))
858 fm.formatlist(exttestedwith, name='ver'))
859
859
860 fm.condwrite(ui.verbose and extbuglink, 'buglink',
860 fm.condwrite(ui.verbose and extbuglink, 'buglink',
861 _(' bug reporting: %s\n'), extbuglink or "")
861 _(' bug reporting: %s\n'), extbuglink or "")
862
862
863 fm.end()
863 fm.end()
864
864
865 @command('debugfileset',
865 @command('debugfileset',
866 [('r', 'rev', '', _('apply the filespec on this revision'), _('REV'))],
866 [('r', 'rev', '', _('apply the filespec on this revision'), _('REV'))],
867 _('[-r REV] FILESPEC'))
867 _('[-r REV] FILESPEC'))
868 def debugfileset(ui, repo, expr, **opts):
868 def debugfileset(ui, repo, expr, **opts):
869 '''parse and apply a fileset specification'''
869 '''parse and apply a fileset specification'''
870 ctx = scmutil.revsingle(repo, opts.get(r'rev'), None)
870 ctx = scmutil.revsingle(repo, opts.get(r'rev'), None)
871 if ui.verbose:
871 if ui.verbose:
872 tree = fileset.parse(expr)
872 tree = fileset.parse(expr)
873 ui.note(fileset.prettyformat(tree), "\n")
873 ui.note(fileset.prettyformat(tree), "\n")
874
874
875 for f in ctx.getfileset(expr):
875 for f in ctx.getfileset(expr):
876 ui.write("%s\n" % f)
876 ui.write("%s\n" % f)
877
877
878 @command('debugformat',
878 @command('debugformat',
879 [] + cmdutil.formatteropts,
879 [] + cmdutil.formatteropts,
880 _(''))
880 _(''))
881 def debugformat(ui, repo, **opts):
881 def debugformat(ui, repo, **opts):
882 """display format information about the current repository
882 """display format information about the current repository
883
883
884 Use --verbose to get extra information about current config value and
884 Use --verbose to get extra information about current config value and
885 Mercurial default."""
885 Mercurial default."""
886 opts = pycompat.byteskwargs(opts)
886 opts = pycompat.byteskwargs(opts)
887 maxvariantlength = max(len(fv.name) for fv in upgrade.allformatvariant)
887 maxvariantlength = max(len(fv.name) for fv in upgrade.allformatvariant)
888 maxvariantlength = max(len('format-variant'), maxvariantlength)
888 maxvariantlength = max(len('format-variant'), maxvariantlength)
889
889
890 def makeformatname(name):
890 def makeformatname(name):
891 return '%s:' + (' ' * (maxvariantlength - len(name)))
891 return '%s:' + (' ' * (maxvariantlength - len(name)))
892
892
893 fm = ui.formatter('debugformat', opts)
893 fm = ui.formatter('debugformat', opts)
894 if fm.isplain():
894 if fm.isplain():
895 def formatvalue(value):
895 def formatvalue(value):
896 if util.safehasattr(value, 'startswith'):
896 if util.safehasattr(value, 'startswith'):
897 return value
897 return value
898 if value:
898 if value:
899 return 'yes'
899 return 'yes'
900 else:
900 else:
901 return 'no'
901 return 'no'
902 else:
902 else:
903 formatvalue = pycompat.identity
903 formatvalue = pycompat.identity
904
904
905 fm.plain('format-variant')
905 fm.plain('format-variant')
906 fm.plain(' ' * (maxvariantlength - len('format-variant')))
906 fm.plain(' ' * (maxvariantlength - len('format-variant')))
907 fm.plain(' repo')
907 fm.plain(' repo')
908 if ui.verbose:
908 if ui.verbose:
909 fm.plain(' config default')
909 fm.plain(' config default')
910 fm.plain('\n')
910 fm.plain('\n')
911 for fv in upgrade.allformatvariant:
911 for fv in upgrade.allformatvariant:
912 fm.startitem()
912 fm.startitem()
913 repovalue = fv.fromrepo(repo)
913 repovalue = fv.fromrepo(repo)
914 configvalue = fv.fromconfig(repo)
914 configvalue = fv.fromconfig(repo)
915
915
916 if repovalue != configvalue:
916 if repovalue != configvalue:
917 namelabel = 'formatvariant.name.mismatchconfig'
917 namelabel = 'formatvariant.name.mismatchconfig'
918 repolabel = 'formatvariant.repo.mismatchconfig'
918 repolabel = 'formatvariant.repo.mismatchconfig'
919 elif repovalue != fv.default:
919 elif repovalue != fv.default:
920 namelabel = 'formatvariant.name.mismatchdefault'
920 namelabel = 'formatvariant.name.mismatchdefault'
921 repolabel = 'formatvariant.repo.mismatchdefault'
921 repolabel = 'formatvariant.repo.mismatchdefault'
922 else:
922 else:
923 namelabel = 'formatvariant.name.uptodate'
923 namelabel = 'formatvariant.name.uptodate'
924 repolabel = 'formatvariant.repo.uptodate'
924 repolabel = 'formatvariant.repo.uptodate'
925
925
926 fm.write('name', makeformatname(fv.name), fv.name,
926 fm.write('name', makeformatname(fv.name), fv.name,
927 label=namelabel)
927 label=namelabel)
928 fm.write('repo', ' %3s', formatvalue(repovalue),
928 fm.write('repo', ' %3s', formatvalue(repovalue),
929 label=repolabel)
929 label=repolabel)
930 if fv.default != configvalue:
930 if fv.default != configvalue:
931 configlabel = 'formatvariant.config.special'
931 configlabel = 'formatvariant.config.special'
932 else:
932 else:
933 configlabel = 'formatvariant.config.default'
933 configlabel = 'formatvariant.config.default'
934 fm.condwrite(ui.verbose, 'config', ' %6s', formatvalue(configvalue),
934 fm.condwrite(ui.verbose, 'config', ' %6s', formatvalue(configvalue),
935 label=configlabel)
935 label=configlabel)
936 fm.condwrite(ui.verbose, 'default', ' %7s', formatvalue(fv.default),
936 fm.condwrite(ui.verbose, 'default', ' %7s', formatvalue(fv.default),
937 label='formatvariant.default')
937 label='formatvariant.default')
938 fm.plain('\n')
938 fm.plain('\n')
939 fm.end()
939 fm.end()
940
940
941 @command('debugfsinfo', [], _('[PATH]'), norepo=True)
941 @command('debugfsinfo', [], _('[PATH]'), norepo=True)
942 def debugfsinfo(ui, path="."):
942 def debugfsinfo(ui, path="."):
943 """show information detected about current filesystem"""
943 """show information detected about current filesystem"""
944 ui.write(('path: %s\n') % path)
944 ui.write(('path: %s\n') % path)
945 ui.write(('mounted on: %s\n') % (util.getfsmountpoint(path) or '(unknown)'))
945 ui.write(('mounted on: %s\n') % (util.getfsmountpoint(path) or '(unknown)'))
946 ui.write(('exec: %s\n') % (util.checkexec(path) and 'yes' or 'no'))
946 ui.write(('exec: %s\n') % (util.checkexec(path) and 'yes' or 'no'))
947 ui.write(('fstype: %s\n') % (util.getfstype(path) or '(unknown)'))
947 ui.write(('fstype: %s\n') % (util.getfstype(path) or '(unknown)'))
948 ui.write(('symlink: %s\n') % (util.checklink(path) and 'yes' or 'no'))
948 ui.write(('symlink: %s\n') % (util.checklink(path) and 'yes' or 'no'))
949 ui.write(('hardlink: %s\n') % (util.checknlink(path) and 'yes' or 'no'))
949 ui.write(('hardlink: %s\n') % (util.checknlink(path) and 'yes' or 'no'))
950 casesensitive = '(unknown)'
950 casesensitive = '(unknown)'
951 try:
951 try:
952 with tempfile.NamedTemporaryFile(prefix='.debugfsinfo', dir=path) as f:
952 with tempfile.NamedTemporaryFile(prefix='.debugfsinfo', dir=path) as f:
953 casesensitive = util.fscasesensitive(f.name) and 'yes' or 'no'
953 casesensitive = util.fscasesensitive(f.name) and 'yes' or 'no'
954 except OSError:
954 except OSError:
955 pass
955 pass
956 ui.write(('case-sensitive: %s\n') % casesensitive)
956 ui.write(('case-sensitive: %s\n') % casesensitive)
957
957
958 @command('debuggetbundle',
958 @command('debuggetbundle',
959 [('H', 'head', [], _('id of head node'), _('ID')),
959 [('H', 'head', [], _('id of head node'), _('ID')),
960 ('C', 'common', [], _('id of common node'), _('ID')),
960 ('C', 'common', [], _('id of common node'), _('ID')),
961 ('t', 'type', 'bzip2', _('bundle compression type to use'), _('TYPE'))],
961 ('t', 'type', 'bzip2', _('bundle compression type to use'), _('TYPE'))],
962 _('REPO FILE [-H|-C ID]...'),
962 _('REPO FILE [-H|-C ID]...'),
963 norepo=True)
963 norepo=True)
964 def debuggetbundle(ui, repopath, bundlepath, head=None, common=None, **opts):
964 def debuggetbundle(ui, repopath, bundlepath, head=None, common=None, **opts):
965 """retrieves a bundle from a repo
965 """retrieves a bundle from a repo
966
966
967 Every ID must be a full-length hex node id string. Saves the bundle to the
967 Every ID must be a full-length hex node id string. Saves the bundle to the
968 given file.
968 given file.
969 """
969 """
970 opts = pycompat.byteskwargs(opts)
970 opts = pycompat.byteskwargs(opts)
971 repo = hg.peer(ui, opts, repopath)
971 repo = hg.peer(ui, opts, repopath)
972 if not repo.capable('getbundle'):
972 if not repo.capable('getbundle'):
973 raise error.Abort("getbundle() not supported by target repository")
973 raise error.Abort("getbundle() not supported by target repository")
974 args = {}
974 args = {}
975 if common:
975 if common:
976 args[r'common'] = [bin(s) for s in common]
976 args[r'common'] = [bin(s) for s in common]
977 if head:
977 if head:
978 args[r'heads'] = [bin(s) for s in head]
978 args[r'heads'] = [bin(s) for s in head]
979 # TODO: get desired bundlecaps from command line.
979 # TODO: get desired bundlecaps from command line.
980 args[r'bundlecaps'] = None
980 args[r'bundlecaps'] = None
981 bundle = repo.getbundle('debug', **args)
981 bundle = repo.getbundle('debug', **args)
982
982
983 bundletype = opts.get('type', 'bzip2').lower()
983 bundletype = opts.get('type', 'bzip2').lower()
984 btypes = {'none': 'HG10UN',
984 btypes = {'none': 'HG10UN',
985 'bzip2': 'HG10BZ',
985 'bzip2': 'HG10BZ',
986 'gzip': 'HG10GZ',
986 'gzip': 'HG10GZ',
987 'bundle2': 'HG20'}
987 'bundle2': 'HG20'}
988 bundletype = btypes.get(bundletype)
988 bundletype = btypes.get(bundletype)
989 if bundletype not in bundle2.bundletypes:
989 if bundletype not in bundle2.bundletypes:
990 raise error.Abort(_('unknown bundle type specified with --type'))
990 raise error.Abort(_('unknown bundle type specified with --type'))
991 bundle2.writebundle(ui, bundle, bundlepath, bundletype)
991 bundle2.writebundle(ui, bundle, bundlepath, bundletype)
992
992
993 @command('debugignore', [], '[FILE]')
993 @command('debugignore', [], '[FILE]')
994 def debugignore(ui, repo, *files, **opts):
994 def debugignore(ui, repo, *files, **opts):
995 """display the combined ignore pattern and information about ignored files
995 """display the combined ignore pattern and information about ignored files
996
996
997 With no argument display the combined ignore pattern.
997 With no argument display the combined ignore pattern.
998
998
999 Given space separated file names, shows if the given file is ignored and
999 Given space separated file names, shows if the given file is ignored and
1000 if so, show the ignore rule (file and line number) that matched it.
1000 if so, show the ignore rule (file and line number) that matched it.
1001 """
1001 """
1002 ignore = repo.dirstate._ignore
1002 ignore = repo.dirstate._ignore
1003 if not files:
1003 if not files:
1004 # Show all the patterns
1004 # Show all the patterns
1005 ui.write("%s\n" % repr(ignore))
1005 ui.write("%s\n" % repr(ignore))
1006 else:
1006 else:
1007 m = scmutil.match(repo[None], pats=files)
1007 m = scmutil.match(repo[None], pats=files)
1008 for f in m.files():
1008 for f in m.files():
1009 nf = util.normpath(f)
1009 nf = util.normpath(f)
1010 ignored = None
1010 ignored = None
1011 ignoredata = None
1011 ignoredata = None
1012 if nf != '.':
1012 if nf != '.':
1013 if ignore(nf):
1013 if ignore(nf):
1014 ignored = nf
1014 ignored = nf
1015 ignoredata = repo.dirstate._ignorefileandline(nf)
1015 ignoredata = repo.dirstate._ignorefileandline(nf)
1016 else:
1016 else:
1017 for p in util.finddirs(nf):
1017 for p in util.finddirs(nf):
1018 if ignore(p):
1018 if ignore(p):
1019 ignored = p
1019 ignored = p
1020 ignoredata = repo.dirstate._ignorefileandline(p)
1020 ignoredata = repo.dirstate._ignorefileandline(p)
1021 break
1021 break
1022 if ignored:
1022 if ignored:
1023 if ignored == nf:
1023 if ignored == nf:
1024 ui.write(_("%s is ignored\n") % m.uipath(f))
1024 ui.write(_("%s is ignored\n") % m.uipath(f))
1025 else:
1025 else:
1026 ui.write(_("%s is ignored because of "
1026 ui.write(_("%s is ignored because of "
1027 "containing folder %s\n")
1027 "containing folder %s\n")
1028 % (m.uipath(f), ignored))
1028 % (m.uipath(f), ignored))
1029 ignorefile, lineno, line = ignoredata
1029 ignorefile, lineno, line = ignoredata
1030 ui.write(_("(ignore rule in %s, line %d: '%s')\n")
1030 ui.write(_("(ignore rule in %s, line %d: '%s')\n")
1031 % (ignorefile, lineno, line))
1031 % (ignorefile, lineno, line))
1032 else:
1032 else:
1033 ui.write(_("%s is not ignored\n") % m.uipath(f))
1033 ui.write(_("%s is not ignored\n") % m.uipath(f))
1034
1034
1035 @command('debugindex', cmdutil.debugrevlogopts +
1035 @command('debugindex', cmdutil.debugrevlogopts +
1036 [('f', 'format', 0, _('revlog format'), _('FORMAT'))],
1036 [('f', 'format', 0, _('revlog format'), _('FORMAT'))],
1037 _('[-f FORMAT] -c|-m|FILE'),
1037 _('[-f FORMAT] -c|-m|FILE'),
1038 optionalrepo=True)
1038 optionalrepo=True)
1039 def debugindex(ui, repo, file_=None, **opts):
1039 def debugindex(ui, repo, file_=None, **opts):
1040 """dump the contents of an index file"""
1040 """dump the contents of an index file"""
1041 opts = pycompat.byteskwargs(opts)
1041 opts = pycompat.byteskwargs(opts)
1042 r = cmdutil.openrevlog(repo, 'debugindex', file_, opts)
1042 r = cmdutil.openrevlog(repo, 'debugindex', file_, opts)
1043 format = opts.get('format', 0)
1043 format = opts.get('format', 0)
1044 if format not in (0, 1):
1044 if format not in (0, 1):
1045 raise error.Abort(_("unknown format %d") % format)
1045 raise error.Abort(_("unknown format %d") % format)
1046
1046
1047 generaldelta = r.version & revlog.FLAG_GENERALDELTA
1047 generaldelta = r.version & revlog.FLAG_GENERALDELTA
1048 if generaldelta:
1048 if generaldelta:
1049 basehdr = ' delta'
1049 basehdr = ' delta'
1050 else:
1050 else:
1051 basehdr = ' base'
1051 basehdr = ' base'
1052
1052
1053 if ui.debugflag:
1053 if ui.debugflag:
1054 shortfn = hex
1054 shortfn = hex
1055 else:
1055 else:
1056 shortfn = short
1056 shortfn = short
1057
1057
1058 # There might not be anything in r, so have a sane default
1058 # There might not be anything in r, so have a sane default
1059 idlen = 12
1059 idlen = 12
1060 for i in r:
1060 for i in r:
1061 idlen = len(shortfn(r.node(i)))
1061 idlen = len(shortfn(r.node(i)))
1062 break
1062 break
1063
1063
1064 if format == 0:
1064 if format == 0:
1065 ui.write((" rev offset length " + basehdr + " linkrev"
1065 ui.write((" rev offset length " + basehdr + " linkrev"
1066 " %s %s p2\n") % ("nodeid".ljust(idlen), "p1".ljust(idlen)))
1066 " %s %s p2\n") % ("nodeid".ljust(idlen), "p1".ljust(idlen)))
1067 elif format == 1:
1067 elif format == 1:
1068 ui.write((" rev flag offset length"
1068 ui.write((" rev flag offset length"
1069 " size " + basehdr + " link p1 p2"
1069 " size " + basehdr + " link p1 p2"
1070 " %s\n") % "nodeid".rjust(idlen))
1070 " %s\n") % "nodeid".rjust(idlen))
1071
1071
1072 for i in r:
1072 for i in r:
1073 node = r.node(i)
1073 node = r.node(i)
1074 if generaldelta:
1074 if generaldelta:
1075 base = r.deltaparent(i)
1075 base = r.deltaparent(i)
1076 else:
1076 else:
1077 base = r.chainbase(i)
1077 base = r.chainbase(i)
1078 if format == 0:
1078 if format == 0:
1079 try:
1079 try:
1080 pp = r.parents(node)
1080 pp = r.parents(node)
1081 except Exception:
1081 except Exception:
1082 pp = [nullid, nullid]
1082 pp = [nullid, nullid]
1083 ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % (
1083 ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % (
1084 i, r.start(i), r.length(i), base, r.linkrev(i),
1084 i, r.start(i), r.length(i), base, r.linkrev(i),
1085 shortfn(node), shortfn(pp[0]), shortfn(pp[1])))
1085 shortfn(node), shortfn(pp[0]), shortfn(pp[1])))
1086 elif format == 1:
1086 elif format == 1:
1087 pr = r.parentrevs(i)
1087 pr = r.parentrevs(i)
1088 ui.write("% 6d %04x % 8d % 8d % 8d % 6d % 6d % 6d % 6d %s\n" % (
1088 ui.write("% 6d %04x % 8d % 8d % 8d % 6d % 6d % 6d % 6d %s\n" % (
1089 i, r.flags(i), r.start(i), r.length(i), r.rawsize(i),
1089 i, r.flags(i), r.start(i), r.length(i), r.rawsize(i),
1090 base, r.linkrev(i), pr[0], pr[1], shortfn(node)))
1090 base, r.linkrev(i), pr[0], pr[1], shortfn(node)))
1091
1091
1092 @command('debugindexdot', cmdutil.debugrevlogopts,
1092 @command('debugindexdot', cmdutil.debugrevlogopts,
1093 _('-c|-m|FILE'), optionalrepo=True)
1093 _('-c|-m|FILE'), optionalrepo=True)
1094 def debugindexdot(ui, repo, file_=None, **opts):
1094 def debugindexdot(ui, repo, file_=None, **opts):
1095 """dump an index DAG as a graphviz dot file"""
1095 """dump an index DAG as a graphviz dot file"""
1096 opts = pycompat.byteskwargs(opts)
1096 opts = pycompat.byteskwargs(opts)
1097 r = cmdutil.openrevlog(repo, 'debugindexdot', file_, opts)
1097 r = cmdutil.openrevlog(repo, 'debugindexdot', file_, opts)
1098 ui.write(("digraph G {\n"))
1098 ui.write(("digraph G {\n"))
1099 for i in r:
1099 for i in r:
1100 node = r.node(i)
1100 node = r.node(i)
1101 pp = r.parents(node)
1101 pp = r.parents(node)
1102 ui.write("\t%d -> %d\n" % (r.rev(pp[0]), i))
1102 ui.write("\t%d -> %d\n" % (r.rev(pp[0]), i))
1103 if pp[1] != nullid:
1103 if pp[1] != nullid:
1104 ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i))
1104 ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i))
1105 ui.write("}\n")
1105 ui.write("}\n")
1106
1106
1107 @command('debuginstall', [] + cmdutil.formatteropts, '', norepo=True)
1107 @command('debuginstall', [] + cmdutil.formatteropts, '', norepo=True)
1108 def debuginstall(ui, **opts):
1108 def debuginstall(ui, **opts):
1109 '''test Mercurial installation
1109 '''test Mercurial installation
1110
1110
1111 Returns 0 on success.
1111 Returns 0 on success.
1112 '''
1112 '''
1113 opts = pycompat.byteskwargs(opts)
1113 opts = pycompat.byteskwargs(opts)
1114
1114
1115 def writetemp(contents):
1115 def writetemp(contents):
1116 (fd, name) = tempfile.mkstemp(prefix="hg-debuginstall-")
1116 (fd, name) = tempfile.mkstemp(prefix="hg-debuginstall-")
1117 f = os.fdopen(fd, pycompat.sysstr("wb"))
1117 f = os.fdopen(fd, pycompat.sysstr("wb"))
1118 f.write(contents)
1118 f.write(contents)
1119 f.close()
1119 f.close()
1120 return name
1120 return name
1121
1121
1122 problems = 0
1122 problems = 0
1123
1123
1124 fm = ui.formatter('debuginstall', opts)
1124 fm = ui.formatter('debuginstall', opts)
1125 fm.startitem()
1125 fm.startitem()
1126
1126
1127 # encoding
1127 # encoding
1128 fm.write('encoding', _("checking encoding (%s)...\n"), encoding.encoding)
1128 fm.write('encoding', _("checking encoding (%s)...\n"), encoding.encoding)
1129 err = None
1129 err = None
1130 try:
1130 try:
1131 codecs.lookup(pycompat.sysstr(encoding.encoding))
1131 codecs.lookup(pycompat.sysstr(encoding.encoding))
1132 except LookupError as inst:
1132 except LookupError as inst:
1133 err = util.forcebytestr(inst)
1133 err = util.forcebytestr(inst)
1134 problems += 1
1134 problems += 1
1135 fm.condwrite(err, 'encodingerror', _(" %s\n"
1135 fm.condwrite(err, 'encodingerror', _(" %s\n"
1136 " (check that your locale is properly set)\n"), err)
1136 " (check that your locale is properly set)\n"), err)
1137
1137
1138 # Python
1138 # Python
1139 fm.write('pythonexe', _("checking Python executable (%s)\n"),
1139 fm.write('pythonexe', _("checking Python executable (%s)\n"),
1140 pycompat.sysexecutable)
1140 pycompat.sysexecutable)
1141 fm.write('pythonver', _("checking Python version (%s)\n"),
1141 fm.write('pythonver', _("checking Python version (%s)\n"),
1142 ("%d.%d.%d" % sys.version_info[:3]))
1142 ("%d.%d.%d" % sys.version_info[:3]))
1143 fm.write('pythonlib', _("checking Python lib (%s)...\n"),
1143 fm.write('pythonlib', _("checking Python lib (%s)...\n"),
1144 os.path.dirname(pycompat.fsencode(os.__file__)))
1144 os.path.dirname(pycompat.fsencode(os.__file__)))
1145
1145
1146 security = set(sslutil.supportedprotocols)
1146 security = set(sslutil.supportedprotocols)
1147 if sslutil.hassni:
1147 if sslutil.hassni:
1148 security.add('sni')
1148 security.add('sni')
1149
1149
1150 fm.write('pythonsecurity', _("checking Python security support (%s)\n"),
1150 fm.write('pythonsecurity', _("checking Python security support (%s)\n"),
1151 fm.formatlist(sorted(security), name='protocol',
1151 fm.formatlist(sorted(security), name='protocol',
1152 fmt='%s', sep=','))
1152 fmt='%s', sep=','))
1153
1153
1154 # These are warnings, not errors. So don't increment problem count. This
1154 # These are warnings, not errors. So don't increment problem count. This
1155 # may change in the future.
1155 # may change in the future.
1156 if 'tls1.2' not in security:
1156 if 'tls1.2' not in security:
1157 fm.plain(_(' TLS 1.2 not supported by Python install; '
1157 fm.plain(_(' TLS 1.2 not supported by Python install; '
1158 'network connections lack modern security\n'))
1158 'network connections lack modern security\n'))
1159 if 'sni' not in security:
1159 if 'sni' not in security:
1160 fm.plain(_(' SNI not supported by Python install; may have '
1160 fm.plain(_(' SNI not supported by Python install; may have '
1161 'connectivity issues with some servers\n'))
1161 'connectivity issues with some servers\n'))
1162
1162
1163 # TODO print CA cert info
1163 # TODO print CA cert info
1164
1164
1165 # hg version
1165 # hg version
1166 hgver = util.version()
1166 hgver = util.version()
1167 fm.write('hgver', _("checking Mercurial version (%s)\n"),
1167 fm.write('hgver', _("checking Mercurial version (%s)\n"),
1168 hgver.split('+')[0])
1168 hgver.split('+')[0])
1169 fm.write('hgverextra', _("checking Mercurial custom build (%s)\n"),
1169 fm.write('hgverextra', _("checking Mercurial custom build (%s)\n"),
1170 '+'.join(hgver.split('+')[1:]))
1170 '+'.join(hgver.split('+')[1:]))
1171
1171
1172 # compiled modules
1172 # compiled modules
1173 fm.write('hgmodulepolicy', _("checking module policy (%s)\n"),
1173 fm.write('hgmodulepolicy', _("checking module policy (%s)\n"),
1174 policy.policy)
1174 policy.policy)
1175 fm.write('hgmodules', _("checking installed modules (%s)...\n"),
1175 fm.write('hgmodules', _("checking installed modules (%s)...\n"),
1176 os.path.dirname(pycompat.fsencode(__file__)))
1176 os.path.dirname(pycompat.fsencode(__file__)))
1177
1177
1178 if policy.policy in ('c', 'allow'):
1178 if policy.policy in ('c', 'allow'):
1179 err = None
1179 err = None
1180 try:
1180 try:
1181 from .cext import (
1181 from .cext import (
1182 base85,
1182 base85,
1183 bdiff,
1183 bdiff,
1184 mpatch,
1184 mpatch,
1185 osutil,
1185 osutil,
1186 )
1186 )
1187 dir(bdiff), dir(mpatch), dir(base85), dir(osutil) # quiet pyflakes
1187 dir(bdiff), dir(mpatch), dir(base85), dir(osutil) # quiet pyflakes
1188 except Exception as inst:
1188 except Exception as inst:
1189 err = util.forcebytestr(inst)
1189 err = util.forcebytestr(inst)
1190 problems += 1
1190 problems += 1
1191 fm.condwrite(err, 'extensionserror', " %s\n", err)
1191 fm.condwrite(err, 'extensionserror', " %s\n", err)
1192
1192
1193 compengines = util.compengines._engines.values()
1193 compengines = util.compengines._engines.values()
1194 fm.write('compengines', _('checking registered compression engines (%s)\n'),
1194 fm.write('compengines', _('checking registered compression engines (%s)\n'),
1195 fm.formatlist(sorted(e.name() for e in compengines),
1195 fm.formatlist(sorted(e.name() for e in compengines),
1196 name='compengine', fmt='%s', sep=', '))
1196 name='compengine', fmt='%s', sep=', '))
1197 fm.write('compenginesavail', _('checking available compression engines '
1197 fm.write('compenginesavail', _('checking available compression engines '
1198 '(%s)\n'),
1198 '(%s)\n'),
1199 fm.formatlist(sorted(e.name() for e in compengines
1199 fm.formatlist(sorted(e.name() for e in compengines
1200 if e.available()),
1200 if e.available()),
1201 name='compengine', fmt='%s', sep=', '))
1201 name='compengine', fmt='%s', sep=', '))
1202 wirecompengines = util.compengines.supportedwireengines(util.SERVERROLE)
1202 wirecompengines = util.compengines.supportedwireengines(util.SERVERROLE)
1203 fm.write('compenginesserver', _('checking available compression engines '
1203 fm.write('compenginesserver', _('checking available compression engines '
1204 'for wire protocol (%s)\n'),
1204 'for wire protocol (%s)\n'),
1205 fm.formatlist([e.name() for e in wirecompengines
1205 fm.formatlist([e.name() for e in wirecompengines
1206 if e.wireprotosupport()],
1206 if e.wireprotosupport()],
1207 name='compengine', fmt='%s', sep=', '))
1207 name='compengine', fmt='%s', sep=', '))
1208 re2 = 'missing'
1208 re2 = 'missing'
1209 if util._re2:
1209 if util._re2:
1210 re2 = 'available'
1210 re2 = 'available'
1211 fm.plain(_('checking "re2" regexp engine (%s)\n') % re2)
1211 fm.plain(_('checking "re2" regexp engine (%s)\n') % re2)
1212 fm.data(re2=bool(util._re2))
1212 fm.data(re2=bool(util._re2))
1213
1213
1214 # templates
1214 # templates
1215 p = templater.templatepaths()
1215 p = templater.templatepaths()
1216 fm.write('templatedirs', 'checking templates (%s)...\n', ' '.join(p))
1216 fm.write('templatedirs', 'checking templates (%s)...\n', ' '.join(p))
1217 fm.condwrite(not p, '', _(" no template directories found\n"))
1217 fm.condwrite(not p, '', _(" no template directories found\n"))
1218 if p:
1218 if p:
1219 m = templater.templatepath("map-cmdline.default")
1219 m = templater.templatepath("map-cmdline.default")
1220 if m:
1220 if m:
1221 # template found, check if it is working
1221 # template found, check if it is working
1222 err = None
1222 err = None
1223 try:
1223 try:
1224 templater.templater.frommapfile(m)
1224 templater.templater.frommapfile(m)
1225 except Exception as inst:
1225 except Exception as inst:
1226 err = util.forcebytestr(inst)
1226 err = util.forcebytestr(inst)
1227 p = None
1227 p = None
1228 fm.condwrite(err, 'defaulttemplateerror', " %s\n", err)
1228 fm.condwrite(err, 'defaulttemplateerror', " %s\n", err)
1229 else:
1229 else:
1230 p = None
1230 p = None
1231 fm.condwrite(p, 'defaulttemplate',
1231 fm.condwrite(p, 'defaulttemplate',
1232 _("checking default template (%s)\n"), m)
1232 _("checking default template (%s)\n"), m)
1233 fm.condwrite(not m, 'defaulttemplatenotfound',
1233 fm.condwrite(not m, 'defaulttemplatenotfound',
1234 _(" template '%s' not found\n"), "default")
1234 _(" template '%s' not found\n"), "default")
1235 if not p:
1235 if not p:
1236 problems += 1
1236 problems += 1
1237 fm.condwrite(not p, '',
1237 fm.condwrite(not p, '',
1238 _(" (templates seem to have been installed incorrectly)\n"))
1238 _(" (templates seem to have been installed incorrectly)\n"))
1239
1239
1240 # editor
1240 # editor
1241 editor = ui.geteditor()
1241 editor = ui.geteditor()
1242 editor = util.expandpath(editor)
1242 editor = util.expandpath(editor)
1243 fm.write('editor', _("checking commit editor... (%s)\n"), editor)
1243 fm.write('editor', _("checking commit editor... (%s)\n"), editor)
1244 cmdpath = util.findexe(pycompat.shlexsplit(editor)[0])
1244 cmdpath = util.findexe(pycompat.shlexsplit(editor)[0])
1245 fm.condwrite(not cmdpath and editor == 'vi', 'vinotfound',
1245 fm.condwrite(not cmdpath and editor == 'vi', 'vinotfound',
1246 _(" No commit editor set and can't find %s in PATH\n"
1246 _(" No commit editor set and can't find %s in PATH\n"
1247 " (specify a commit editor in your configuration"
1247 " (specify a commit editor in your configuration"
1248 " file)\n"), not cmdpath and editor == 'vi' and editor)
1248 " file)\n"), not cmdpath and editor == 'vi' and editor)
1249 fm.condwrite(not cmdpath and editor != 'vi', 'editornotfound',
1249 fm.condwrite(not cmdpath and editor != 'vi', 'editornotfound',
1250 _(" Can't find editor '%s' in PATH\n"
1250 _(" Can't find editor '%s' in PATH\n"
1251 " (specify a commit editor in your configuration"
1251 " (specify a commit editor in your configuration"
1252 " file)\n"), not cmdpath and editor)
1252 " file)\n"), not cmdpath and editor)
1253 if not cmdpath and editor != 'vi':
1253 if not cmdpath and editor != 'vi':
1254 problems += 1
1254 problems += 1
1255
1255
1256 # check username
1256 # check username
1257 username = None
1257 username = None
1258 err = None
1258 err = None
1259 try:
1259 try:
1260 username = ui.username()
1260 username = ui.username()
1261 except error.Abort as e:
1261 except error.Abort as e:
1262 err = util.forcebytestr(e)
1262 err = util.forcebytestr(e)
1263 problems += 1
1263 problems += 1
1264
1264
1265 fm.condwrite(username, 'username', _("checking username (%s)\n"), username)
1265 fm.condwrite(username, 'username', _("checking username (%s)\n"), username)
1266 fm.condwrite(err, 'usernameerror', _("checking username...\n %s\n"
1266 fm.condwrite(err, 'usernameerror', _("checking username...\n %s\n"
1267 " (specify a username in your configuration file)\n"), err)
1267 " (specify a username in your configuration file)\n"), err)
1268
1268
1269 fm.condwrite(not problems, '',
1269 fm.condwrite(not problems, '',
1270 _("no problems detected\n"))
1270 _("no problems detected\n"))
1271 if not problems:
1271 if not problems:
1272 fm.data(problems=problems)
1272 fm.data(problems=problems)
1273 fm.condwrite(problems, 'problems',
1273 fm.condwrite(problems, 'problems',
1274 _("%d problems detected,"
1274 _("%d problems detected,"
1275 " please check your install!\n"), problems)
1275 " please check your install!\n"), problems)
1276 fm.end()
1276 fm.end()
1277
1277
1278 return problems
1278 return problems
1279
1279
1280 @command('debugknown', [], _('REPO ID...'), norepo=True)
1280 @command('debugknown', [], _('REPO ID...'), norepo=True)
1281 def debugknown(ui, repopath, *ids, **opts):
1281 def debugknown(ui, repopath, *ids, **opts):
1282 """test whether node ids are known to a repo
1282 """test whether node ids are known to a repo
1283
1283
1284 Every ID must be a full-length hex node id string. Returns a list of 0s
1284 Every ID must be a full-length hex node id string. Returns a list of 0s
1285 and 1s indicating unknown/known.
1285 and 1s indicating unknown/known.
1286 """
1286 """
1287 opts = pycompat.byteskwargs(opts)
1287 opts = pycompat.byteskwargs(opts)
1288 repo = hg.peer(ui, opts, repopath)
1288 repo = hg.peer(ui, opts, repopath)
1289 if not repo.capable('known'):
1289 if not repo.capable('known'):
1290 raise error.Abort("known() not supported by target repository")
1290 raise error.Abort("known() not supported by target repository")
1291 flags = repo.known([bin(s) for s in ids])
1291 flags = repo.known([bin(s) for s in ids])
1292 ui.write("%s\n" % ("".join([f and "1" or "0" for f in flags])))
1292 ui.write("%s\n" % ("".join([f and "1" or "0" for f in flags])))
1293
1293
1294 @command('debuglabelcomplete', [], _('LABEL...'))
1294 @command('debuglabelcomplete', [], _('LABEL...'))
1295 def debuglabelcomplete(ui, repo, *args):
1295 def debuglabelcomplete(ui, repo, *args):
1296 '''backwards compatibility with old bash completion scripts (DEPRECATED)'''
1296 '''backwards compatibility with old bash completion scripts (DEPRECATED)'''
1297 debugnamecomplete(ui, repo, *args)
1297 debugnamecomplete(ui, repo, *args)
1298
1298
1299 @command('debuglocks',
1299 @command('debuglocks',
1300 [('L', 'force-lock', None, _('free the store lock (DANGEROUS)')),
1300 [('L', 'force-lock', None, _('free the store lock (DANGEROUS)')),
1301 ('W', 'force-wlock', None,
1301 ('W', 'force-wlock', None,
1302 _('free the working state lock (DANGEROUS)')),
1302 _('free the working state lock (DANGEROUS)')),
1303 ('s', 'set-lock', None, _('set the store lock until stopped')),
1303 ('s', 'set-lock', None, _('set the store lock until stopped')),
1304 ('S', 'set-wlock', None,
1304 ('S', 'set-wlock', None,
1305 _('set the working state lock until stopped'))],
1305 _('set the working state lock until stopped'))],
1306 _('[OPTION]...'))
1306 _('[OPTION]...'))
1307 def debuglocks(ui, repo, **opts):
1307 def debuglocks(ui, repo, **opts):
1308 """show or modify state of locks
1308 """show or modify state of locks
1309
1309
1310 By default, this command will show which locks are held. This
1310 By default, this command will show which locks are held. This
1311 includes the user and process holding the lock, the amount of time
1311 includes the user and process holding the lock, the amount of time
1312 the lock has been held, and the machine name where the process is
1312 the lock has been held, and the machine name where the process is
1313 running if it's not local.
1313 running if it's not local.
1314
1314
1315 Locks protect the integrity of Mercurial's data, so should be
1315 Locks protect the integrity of Mercurial's data, so should be
1316 treated with care. System crashes or other interruptions may cause
1316 treated with care. System crashes or other interruptions may cause
1317 locks to not be properly released, though Mercurial will usually
1317 locks to not be properly released, though Mercurial will usually
1318 detect and remove such stale locks automatically.
1318 detect and remove such stale locks automatically.
1319
1319
1320 However, detecting stale locks may not always be possible (for
1320 However, detecting stale locks may not always be possible (for
1321 instance, on a shared filesystem). Removing locks may also be
1321 instance, on a shared filesystem). Removing locks may also be
1322 blocked by filesystem permissions.
1322 blocked by filesystem permissions.
1323
1323
1324 Setting a lock will prevent other commands from changing the data.
1324 Setting a lock will prevent other commands from changing the data.
1325 The command will wait until an interruption (SIGINT, SIGTERM, ...) occurs.
1325 The command will wait until an interruption (SIGINT, SIGTERM, ...) occurs.
1326 The set locks are removed when the command exits.
1326 The set locks are removed when the command exits.
1327
1327
1328 Returns 0 if no locks are held.
1328 Returns 0 if no locks are held.
1329
1329
1330 """
1330 """
1331
1331
1332 if opts.get(r'force_lock'):
1332 if opts.get(r'force_lock'):
1333 repo.svfs.unlink('lock')
1333 repo.svfs.unlink('lock')
1334 if opts.get(r'force_wlock'):
1334 if opts.get(r'force_wlock'):
1335 repo.vfs.unlink('wlock')
1335 repo.vfs.unlink('wlock')
1336 if opts.get(r'force_lock') or opts.get(r'force_wlock'):
1336 if opts.get(r'force_lock') or opts.get(r'force_wlock'):
1337 return 0
1337 return 0
1338
1338
1339 locks = []
1339 locks = []
1340 try:
1340 try:
1341 if opts.get(r'set_wlock'):
1341 if opts.get(r'set_wlock'):
1342 try:
1342 try:
1343 locks.append(repo.wlock(False))
1343 locks.append(repo.wlock(False))
1344 except error.LockHeld:
1344 except error.LockHeld:
1345 raise error.Abort(_('wlock is already held'))
1345 raise error.Abort(_('wlock is already held'))
1346 if opts.get(r'set_lock'):
1346 if opts.get(r'set_lock'):
1347 try:
1347 try:
1348 locks.append(repo.lock(False))
1348 locks.append(repo.lock(False))
1349 except error.LockHeld:
1349 except error.LockHeld:
1350 raise error.Abort(_('lock is already held'))
1350 raise error.Abort(_('lock is already held'))
1351 if len(locks):
1351 if len(locks):
1352 ui.promptchoice(_("ready to release the lock (y)? $$ &Yes"))
1352 ui.promptchoice(_("ready to release the lock (y)? $$ &Yes"))
1353 return 0
1353 return 0
1354 finally:
1354 finally:
1355 release(*locks)
1355 release(*locks)
1356
1356
1357 now = time.time()
1357 now = time.time()
1358 held = 0
1358 held = 0
1359
1359
1360 def report(vfs, name, method):
1360 def report(vfs, name, method):
1361 # this causes stale locks to get reaped for more accurate reporting
1361 # this causes stale locks to get reaped for more accurate reporting
1362 try:
1362 try:
1363 l = method(False)
1363 l = method(False)
1364 except error.LockHeld:
1364 except error.LockHeld:
1365 l = None
1365 l = None
1366
1366
1367 if l:
1367 if l:
1368 l.release()
1368 l.release()
1369 else:
1369 else:
1370 try:
1370 try:
1371 stat = vfs.lstat(name)
1371 stat = vfs.lstat(name)
1372 age = now - stat.st_mtime
1372 age = now - stat.st_mtime
1373 user = util.username(stat.st_uid)
1373 user = util.username(stat.st_uid)
1374 locker = vfs.readlock(name)
1374 locker = vfs.readlock(name)
1375 if ":" in locker:
1375 if ":" in locker:
1376 host, pid = locker.split(':')
1376 host, pid = locker.split(':')
1377 if host == socket.gethostname():
1377 if host == socket.gethostname():
1378 locker = 'user %s, process %s' % (user, pid)
1378 locker = 'user %s, process %s' % (user, pid)
1379 else:
1379 else:
1380 locker = 'user %s, process %s, host %s' \
1380 locker = 'user %s, process %s, host %s' \
1381 % (user, pid, host)
1381 % (user, pid, host)
1382 ui.write(("%-6s %s (%ds)\n") % (name + ":", locker, age))
1382 ui.write(("%-6s %s (%ds)\n") % (name + ":", locker, age))
1383 return 1
1383 return 1
1384 except OSError as e:
1384 except OSError as e:
1385 if e.errno != errno.ENOENT:
1385 if e.errno != errno.ENOENT:
1386 raise
1386 raise
1387
1387
1388 ui.write(("%-6s free\n") % (name + ":"))
1388 ui.write(("%-6s free\n") % (name + ":"))
1389 return 0
1389 return 0
1390
1390
1391 held += report(repo.svfs, "lock", repo.lock)
1391 held += report(repo.svfs, "lock", repo.lock)
1392 held += report(repo.vfs, "wlock", repo.wlock)
1392 held += report(repo.vfs, "wlock", repo.wlock)
1393
1393
1394 return held
1394 return held
1395
1395
1396 @command('debugmergestate', [], '')
1396 @command('debugmergestate', [], '')
1397 def debugmergestate(ui, repo, *args):
1397 def debugmergestate(ui, repo, *args):
1398 """print merge state
1398 """print merge state
1399
1399
1400 Use --verbose to print out information about whether v1 or v2 merge state
1400 Use --verbose to print out information about whether v1 or v2 merge state
1401 was chosen."""
1401 was chosen."""
1402 def _hashornull(h):
1402 def _hashornull(h):
1403 if h == nullhex:
1403 if h == nullhex:
1404 return 'null'
1404 return 'null'
1405 else:
1405 else:
1406 return h
1406 return h
1407
1407
1408 def printrecords(version):
1408 def printrecords(version):
1409 ui.write(('* version %s records\n') % version)
1409 ui.write(('* version %s records\n') % version)
1410 if version == 1:
1410 if version == 1:
1411 records = v1records
1411 records = v1records
1412 else:
1412 else:
1413 records = v2records
1413 records = v2records
1414
1414
1415 for rtype, record in records:
1415 for rtype, record in records:
1416 # pretty print some record types
1416 # pretty print some record types
1417 if rtype == 'L':
1417 if rtype == 'L':
1418 ui.write(('local: %s\n') % record)
1418 ui.write(('local: %s\n') % record)
1419 elif rtype == 'O':
1419 elif rtype == 'O':
1420 ui.write(('other: %s\n') % record)
1420 ui.write(('other: %s\n') % record)
1421 elif rtype == 'm':
1421 elif rtype == 'm':
1422 driver, mdstate = record.split('\0', 1)
1422 driver, mdstate = record.split('\0', 1)
1423 ui.write(('merge driver: %s (state "%s")\n')
1423 ui.write(('merge driver: %s (state "%s")\n')
1424 % (driver, mdstate))
1424 % (driver, mdstate))
1425 elif rtype in 'FDC':
1425 elif rtype in 'FDC':
1426 r = record.split('\0')
1426 r = record.split('\0')
1427 f, state, hash, lfile, afile, anode, ofile = r[0:7]
1427 f, state, hash, lfile, afile, anode, ofile = r[0:7]
1428 if version == 1:
1428 if version == 1:
1429 onode = 'not stored in v1 format'
1429 onode = 'not stored in v1 format'
1430 flags = r[7]
1430 flags = r[7]
1431 else:
1431 else:
1432 onode, flags = r[7:9]
1432 onode, flags = r[7:9]
1433 ui.write(('file: %s (record type "%s", state "%s", hash %s)\n')
1433 ui.write(('file: %s (record type "%s", state "%s", hash %s)\n')
1434 % (f, rtype, state, _hashornull(hash)))
1434 % (f, rtype, state, _hashornull(hash)))
1435 ui.write((' local path: %s (flags "%s")\n') % (lfile, flags))
1435 ui.write((' local path: %s (flags "%s")\n') % (lfile, flags))
1436 ui.write((' ancestor path: %s (node %s)\n')
1436 ui.write((' ancestor path: %s (node %s)\n')
1437 % (afile, _hashornull(anode)))
1437 % (afile, _hashornull(anode)))
1438 ui.write((' other path: %s (node %s)\n')
1438 ui.write((' other path: %s (node %s)\n')
1439 % (ofile, _hashornull(onode)))
1439 % (ofile, _hashornull(onode)))
1440 elif rtype == 'f':
1440 elif rtype == 'f':
1441 filename, rawextras = record.split('\0', 1)
1441 filename, rawextras = record.split('\0', 1)
1442 extras = rawextras.split('\0')
1442 extras = rawextras.split('\0')
1443 i = 0
1443 i = 0
1444 extrastrings = []
1444 extrastrings = []
1445 while i < len(extras):
1445 while i < len(extras):
1446 extrastrings.append('%s = %s' % (extras[i], extras[i + 1]))
1446 extrastrings.append('%s = %s' % (extras[i], extras[i + 1]))
1447 i += 2
1447 i += 2
1448
1448
1449 ui.write(('file extras: %s (%s)\n')
1449 ui.write(('file extras: %s (%s)\n')
1450 % (filename, ', '.join(extrastrings)))
1450 % (filename, ', '.join(extrastrings)))
1451 elif rtype == 'l':
1451 elif rtype == 'l':
1452 labels = record.split('\0', 2)
1452 labels = record.split('\0', 2)
1453 labels = [l for l in labels if len(l) > 0]
1453 labels = [l for l in labels if len(l) > 0]
1454 ui.write(('labels:\n'))
1454 ui.write(('labels:\n'))
1455 ui.write((' local: %s\n' % labels[0]))
1455 ui.write((' local: %s\n' % labels[0]))
1456 ui.write((' other: %s\n' % labels[1]))
1456 ui.write((' other: %s\n' % labels[1]))
1457 if len(labels) > 2:
1457 if len(labels) > 2:
1458 ui.write((' base: %s\n' % labels[2]))
1458 ui.write((' base: %s\n' % labels[2]))
1459 else:
1459 else:
1460 ui.write(('unrecognized entry: %s\t%s\n')
1460 ui.write(('unrecognized entry: %s\t%s\n')
1461 % (rtype, record.replace('\0', '\t')))
1461 % (rtype, record.replace('\0', '\t')))
1462
1462
1463 # Avoid mergestate.read() since it may raise an exception for unsupported
1463 # Avoid mergestate.read() since it may raise an exception for unsupported
1464 # merge state records. We shouldn't be doing this, but this is OK since this
1464 # merge state records. We shouldn't be doing this, but this is OK since this
1465 # command is pretty low-level.
1465 # command is pretty low-level.
1466 ms = mergemod.mergestate(repo)
1466 ms = mergemod.mergestate(repo)
1467
1467
1468 # sort so that reasonable information is on top
1468 # sort so that reasonable information is on top
1469 v1records = ms._readrecordsv1()
1469 v1records = ms._readrecordsv1()
1470 v2records = ms._readrecordsv2()
1470 v2records = ms._readrecordsv2()
1471 order = 'LOml'
1471 order = 'LOml'
1472 def key(r):
1472 def key(r):
1473 idx = order.find(r[0])
1473 idx = order.find(r[0])
1474 if idx == -1:
1474 if idx == -1:
1475 return (1, r[1])
1475 return (1, r[1])
1476 else:
1476 else:
1477 return (0, idx)
1477 return (0, idx)
1478 v1records.sort(key=key)
1478 v1records.sort(key=key)
1479 v2records.sort(key=key)
1479 v2records.sort(key=key)
1480
1480
1481 if not v1records and not v2records:
1481 if not v1records and not v2records:
1482 ui.write(('no merge state found\n'))
1482 ui.write(('no merge state found\n'))
1483 elif not v2records:
1483 elif not v2records:
1484 ui.note(('no version 2 merge state\n'))
1484 ui.note(('no version 2 merge state\n'))
1485 printrecords(1)
1485 printrecords(1)
1486 elif ms._v1v2match(v1records, v2records):
1486 elif ms._v1v2match(v1records, v2records):
1487 ui.note(('v1 and v2 states match: using v2\n'))
1487 ui.note(('v1 and v2 states match: using v2\n'))
1488 printrecords(2)
1488 printrecords(2)
1489 else:
1489 else:
1490 ui.note(('v1 and v2 states mismatch: using v1\n'))
1490 ui.note(('v1 and v2 states mismatch: using v1\n'))
1491 printrecords(1)
1491 printrecords(1)
1492 if ui.verbose:
1492 if ui.verbose:
1493 printrecords(2)
1493 printrecords(2)
1494
1494
1495 @command('debugnamecomplete', [], _('NAME...'))
1495 @command('debugnamecomplete', [], _('NAME...'))
1496 def debugnamecomplete(ui, repo, *args):
1496 def debugnamecomplete(ui, repo, *args):
1497 '''complete "names" - tags, open branch names, bookmark names'''
1497 '''complete "names" - tags, open branch names, bookmark names'''
1498
1498
1499 names = set()
1499 names = set()
1500 # since we previously only listed open branches, we will handle that
1500 # since we previously only listed open branches, we will handle that
1501 # specially (after this for loop)
1501 # specially (after this for loop)
1502 for name, ns in repo.names.iteritems():
1502 for name, ns in repo.names.iteritems():
1503 if name != 'branches':
1503 if name != 'branches':
1504 names.update(ns.listnames(repo))
1504 names.update(ns.listnames(repo))
1505 names.update(tag for (tag, heads, tip, closed)
1505 names.update(tag for (tag, heads, tip, closed)
1506 in repo.branchmap().iterbranches() if not closed)
1506 in repo.branchmap().iterbranches() if not closed)
1507 completions = set()
1507 completions = set()
1508 if not args:
1508 if not args:
1509 args = ['']
1509 args = ['']
1510 for a in args:
1510 for a in args:
1511 completions.update(n for n in names if n.startswith(a))
1511 completions.update(n for n in names if n.startswith(a))
1512 ui.write('\n'.join(sorted(completions)))
1512 ui.write('\n'.join(sorted(completions)))
1513 ui.write('\n')
1513 ui.write('\n')
1514
1514
1515 @command('debugobsolete',
1515 @command('debugobsolete',
1516 [('', 'flags', 0, _('markers flag')),
1516 [('', 'flags', 0, _('markers flag')),
1517 ('', 'record-parents', False,
1517 ('', 'record-parents', False,
1518 _('record parent information for the precursor')),
1518 _('record parent information for the precursor')),
1519 ('r', 'rev', [], _('display markers relevant to REV')),
1519 ('r', 'rev', [], _('display markers relevant to REV')),
1520 ('', 'exclusive', False, _('restrict display to markers only '
1520 ('', 'exclusive', False, _('restrict display to markers only '
1521 'relevant to REV')),
1521 'relevant to REV')),
1522 ('', 'index', False, _('display index of the marker')),
1522 ('', 'index', False, _('display index of the marker')),
1523 ('', 'delete', [], _('delete markers specified by indices')),
1523 ('', 'delete', [], _('delete markers specified by indices')),
1524 ] + cmdutil.commitopts2 + cmdutil.formatteropts,
1524 ] + cmdutil.commitopts2 + cmdutil.formatteropts,
1525 _('[OBSOLETED [REPLACEMENT ...]]'))
1525 _('[OBSOLETED [REPLACEMENT ...]]'))
1526 def debugobsolete(ui, repo, precursor=None, *successors, **opts):
1526 def debugobsolete(ui, repo, precursor=None, *successors, **opts):
1527 """create arbitrary obsolete marker
1527 """create arbitrary obsolete marker
1528
1528
1529 With no arguments, displays the list of obsolescence markers."""
1529 With no arguments, displays the list of obsolescence markers."""
1530
1530
1531 opts = pycompat.byteskwargs(opts)
1531 opts = pycompat.byteskwargs(opts)
1532
1532
1533 def parsenodeid(s):
1533 def parsenodeid(s):
1534 try:
1534 try:
1535 # We do not use revsingle/revrange functions here to accept
1535 # We do not use revsingle/revrange functions here to accept
1536 # arbitrary node identifiers, possibly not present in the
1536 # arbitrary node identifiers, possibly not present in the
1537 # local repository.
1537 # local repository.
1538 n = bin(s)
1538 n = bin(s)
1539 if len(n) != len(nullid):
1539 if len(n) != len(nullid):
1540 raise TypeError()
1540 raise TypeError()
1541 return n
1541 return n
1542 except TypeError:
1542 except TypeError:
1543 raise error.Abort('changeset references must be full hexadecimal '
1543 raise error.Abort('changeset references must be full hexadecimal '
1544 'node identifiers')
1544 'node identifiers')
1545
1545
1546 if opts.get('delete'):
1546 if opts.get('delete'):
1547 indices = []
1547 indices = []
1548 for v in opts.get('delete'):
1548 for v in opts.get('delete'):
1549 try:
1549 try:
1550 indices.append(int(v))
1550 indices.append(int(v))
1551 except ValueError:
1551 except ValueError:
1552 raise error.Abort(_('invalid index value: %r') % v,
1552 raise error.Abort(_('invalid index value: %r') % v,
1553 hint=_('use integers for indices'))
1553 hint=_('use integers for indices'))
1554
1554
1555 if repo.currenttransaction():
1555 if repo.currenttransaction():
1556 raise error.Abort(_('cannot delete obsmarkers in the middle '
1556 raise error.Abort(_('cannot delete obsmarkers in the middle '
1557 'of transaction.'))
1557 'of transaction.'))
1558
1558
1559 with repo.lock():
1559 with repo.lock():
1560 n = repair.deleteobsmarkers(repo.obsstore, indices)
1560 n = repair.deleteobsmarkers(repo.obsstore, indices)
1561 ui.write(_('deleted %i obsolescence markers\n') % n)
1561 ui.write(_('deleted %i obsolescence markers\n') % n)
1562
1562
1563 return
1563 return
1564
1564
1565 if precursor is not None:
1565 if precursor is not None:
1566 if opts['rev']:
1566 if opts['rev']:
1567 raise error.Abort('cannot select revision when creating marker')
1567 raise error.Abort('cannot select revision when creating marker')
1568 metadata = {}
1568 metadata = {}
1569 metadata['user'] = opts['user'] or ui.username()
1569 metadata['user'] = opts['user'] or ui.username()
1570 succs = tuple(parsenodeid(succ) for succ in successors)
1570 succs = tuple(parsenodeid(succ) for succ in successors)
1571 l = repo.lock()
1571 l = repo.lock()
1572 try:
1572 try:
1573 tr = repo.transaction('debugobsolete')
1573 tr = repo.transaction('debugobsolete')
1574 try:
1574 try:
1575 date = opts.get('date')
1575 date = opts.get('date')
1576 if date:
1576 if date:
1577 date = util.parsedate(date)
1577 date = util.parsedate(date)
1578 else:
1578 else:
1579 date = None
1579 date = None
1580 prec = parsenodeid(precursor)
1580 prec = parsenodeid(precursor)
1581 parents = None
1581 parents = None
1582 if opts['record_parents']:
1582 if opts['record_parents']:
1583 if prec not in repo.unfiltered():
1583 if prec not in repo.unfiltered():
1584 raise error.Abort('cannot used --record-parents on '
1584 raise error.Abort('cannot used --record-parents on '
1585 'unknown changesets')
1585 'unknown changesets')
1586 parents = repo.unfiltered()[prec].parents()
1586 parents = repo.unfiltered()[prec].parents()
1587 parents = tuple(p.node() for p in parents)
1587 parents = tuple(p.node() for p in parents)
1588 repo.obsstore.create(tr, prec, succs, opts['flags'],
1588 repo.obsstore.create(tr, prec, succs, opts['flags'],
1589 parents=parents, date=date,
1589 parents=parents, date=date,
1590 metadata=metadata, ui=ui)
1590 metadata=metadata, ui=ui)
1591 tr.close()
1591 tr.close()
1592 except ValueError as exc:
1592 except ValueError as exc:
1593 raise error.Abort(_('bad obsmarker input: %s') % exc)
1593 raise error.Abort(_('bad obsmarker input: %s') % exc)
1594 finally:
1594 finally:
1595 tr.release()
1595 tr.release()
1596 finally:
1596 finally:
1597 l.release()
1597 l.release()
1598 else:
1598 else:
1599 if opts['rev']:
1599 if opts['rev']:
1600 revs = scmutil.revrange(repo, opts['rev'])
1600 revs = scmutil.revrange(repo, opts['rev'])
1601 nodes = [repo[r].node() for r in revs]
1601 nodes = [repo[r].node() for r in revs]
1602 markers = list(obsutil.getmarkers(repo, nodes=nodes,
1602 markers = list(obsutil.getmarkers(repo, nodes=nodes,
1603 exclusive=opts['exclusive']))
1603 exclusive=opts['exclusive']))
1604 markers.sort(key=lambda x: x._data)
1604 markers.sort(key=lambda x: x._data)
1605 else:
1605 else:
1606 markers = obsutil.getmarkers(repo)
1606 markers = obsutil.getmarkers(repo)
1607
1607
1608 markerstoiter = markers
1608 markerstoiter = markers
1609 isrelevant = lambda m: True
1609 isrelevant = lambda m: True
1610 if opts.get('rev') and opts.get('index'):
1610 if opts.get('rev') and opts.get('index'):
1611 markerstoiter = obsutil.getmarkers(repo)
1611 markerstoiter = obsutil.getmarkers(repo)
1612 markerset = set(markers)
1612 markerset = set(markers)
1613 isrelevant = lambda m: m in markerset
1613 isrelevant = lambda m: m in markerset
1614
1614
1615 fm = ui.formatter('debugobsolete', opts)
1615 fm = ui.formatter('debugobsolete', opts)
1616 for i, m in enumerate(markerstoiter):
1616 for i, m in enumerate(markerstoiter):
1617 if not isrelevant(m):
1617 if not isrelevant(m):
1618 # marker can be irrelevant when we're iterating over a set
1618 # marker can be irrelevant when we're iterating over a set
1619 # of markers (markerstoiter) which is bigger than the set
1619 # of markers (markerstoiter) which is bigger than the set
1620 # of markers we want to display (markers)
1620 # of markers we want to display (markers)
1621 # this can happen if both --index and --rev options are
1621 # this can happen if both --index and --rev options are
1622 # provided and thus we need to iterate over all of the markers
1622 # provided and thus we need to iterate over all of the markers
1623 # to get the correct indices, but only display the ones that
1623 # to get the correct indices, but only display the ones that
1624 # are relevant to --rev value
1624 # are relevant to --rev value
1625 continue
1625 continue
1626 fm.startitem()
1626 fm.startitem()
1627 ind = i if opts.get('index') else None
1627 ind = i if opts.get('index') else None
1628 cmdutil.showmarker(fm, m, index=ind)
1628 cmdutil.showmarker(fm, m, index=ind)
1629 fm.end()
1629 fm.end()
1630
1630
1631 @command('debugpathcomplete',
1631 @command('debugpathcomplete',
1632 [('f', 'full', None, _('complete an entire path')),
1632 [('f', 'full', None, _('complete an entire path')),
1633 ('n', 'normal', None, _('show only normal files')),
1633 ('n', 'normal', None, _('show only normal files')),
1634 ('a', 'added', None, _('show only added files')),
1634 ('a', 'added', None, _('show only added files')),
1635 ('r', 'removed', None, _('show only removed files'))],
1635 ('r', 'removed', None, _('show only removed files'))],
1636 _('FILESPEC...'))
1636 _('FILESPEC...'))
1637 def debugpathcomplete(ui, repo, *specs, **opts):
1637 def debugpathcomplete(ui, repo, *specs, **opts):
1638 '''complete part or all of a tracked path
1638 '''complete part or all of a tracked path
1639
1639
1640 This command supports shells that offer path name completion. It
1640 This command supports shells that offer path name completion. It
1641 currently completes only files already known to the dirstate.
1641 currently completes only files already known to the dirstate.
1642
1642
1643 Completion extends only to the next path segment unless
1643 Completion extends only to the next path segment unless
1644 --full is specified, in which case entire paths are used.'''
1644 --full is specified, in which case entire paths are used.'''
1645
1645
1646 def complete(path, acceptable):
1646 def complete(path, acceptable):
1647 dirstate = repo.dirstate
1647 dirstate = repo.dirstate
1648 spec = os.path.normpath(os.path.join(pycompat.getcwd(), path))
1648 spec = os.path.normpath(os.path.join(pycompat.getcwd(), path))
1649 rootdir = repo.root + pycompat.ossep
1649 rootdir = repo.root + pycompat.ossep
1650 if spec != repo.root and not spec.startswith(rootdir):
1650 if spec != repo.root and not spec.startswith(rootdir):
1651 return [], []
1651 return [], []
1652 if os.path.isdir(spec):
1652 if os.path.isdir(spec):
1653 spec += '/'
1653 spec += '/'
1654 spec = spec[len(rootdir):]
1654 spec = spec[len(rootdir):]
1655 fixpaths = pycompat.ossep != '/'
1655 fixpaths = pycompat.ossep != '/'
1656 if fixpaths:
1656 if fixpaths:
1657 spec = spec.replace(pycompat.ossep, '/')
1657 spec = spec.replace(pycompat.ossep, '/')
1658 speclen = len(spec)
1658 speclen = len(spec)
1659 fullpaths = opts[r'full']
1659 fullpaths = opts[r'full']
1660 files, dirs = set(), set()
1660 files, dirs = set(), set()
1661 adddir, addfile = dirs.add, files.add
1661 adddir, addfile = dirs.add, files.add
1662 for f, st in dirstate.iteritems():
1662 for f, st in dirstate.iteritems():
1663 if f.startswith(spec) and st[0] in acceptable:
1663 if f.startswith(spec) and st[0] in acceptable:
1664 if fixpaths:
1664 if fixpaths:
1665 f = f.replace('/', pycompat.ossep)
1665 f = f.replace('/', pycompat.ossep)
1666 if fullpaths:
1666 if fullpaths:
1667 addfile(f)
1667 addfile(f)
1668 continue
1668 continue
1669 s = f.find(pycompat.ossep, speclen)
1669 s = f.find(pycompat.ossep, speclen)
1670 if s >= 0:
1670 if s >= 0:
1671 adddir(f[:s])
1671 adddir(f[:s])
1672 else:
1672 else:
1673 addfile(f)
1673 addfile(f)
1674 return files, dirs
1674 return files, dirs
1675
1675
1676 acceptable = ''
1676 acceptable = ''
1677 if opts[r'normal']:
1677 if opts[r'normal']:
1678 acceptable += 'nm'
1678 acceptable += 'nm'
1679 if opts[r'added']:
1679 if opts[r'added']:
1680 acceptable += 'a'
1680 acceptable += 'a'
1681 if opts[r'removed']:
1681 if opts[r'removed']:
1682 acceptable += 'r'
1682 acceptable += 'r'
1683 cwd = repo.getcwd()
1683 cwd = repo.getcwd()
1684 if not specs:
1684 if not specs:
1685 specs = ['.']
1685 specs = ['.']
1686
1686
1687 files, dirs = set(), set()
1687 files, dirs = set(), set()
1688 for spec in specs:
1688 for spec in specs:
1689 f, d = complete(spec, acceptable or 'nmar')
1689 f, d = complete(spec, acceptable or 'nmar')
1690 files.update(f)
1690 files.update(f)
1691 dirs.update(d)
1691 dirs.update(d)
1692 files.update(dirs)
1692 files.update(dirs)
1693 ui.write('\n'.join(repo.pathto(p, cwd) for p in sorted(files)))
1693 ui.write('\n'.join(repo.pathto(p, cwd) for p in sorted(files)))
1694 ui.write('\n')
1694 ui.write('\n')
1695
1695
1696 @command('debugpeer', [], _('PATH'), norepo=True)
1697 def debugpeer(ui, path):
1698 """establish a connection to a peer repository"""
1699 # Always enable peer request logging. Requires --debug to display
1700 # though.
1701 overrides = {
1702 ('devel', 'debug.peer-request'): True,
1703 }
1704
1705 with ui.configoverride(overrides):
1706 peer = hg.peer(ui, {}, path)
1707
1708 local = peer.local() is not None
1709 canpush = peer.canpush()
1710
1711 ui.write(_('url: %s\n') % peer.url())
1712 ui.write(_('local: %s\n') % (_('yes') if local else _('no')))
1713 ui.write(_('pushable: %s\n') % (_('yes') if canpush else _('no')))
1714
1696 @command('debugpickmergetool',
1715 @command('debugpickmergetool',
1697 [('r', 'rev', '', _('check for files in this revision'), _('REV')),
1716 [('r', 'rev', '', _('check for files in this revision'), _('REV')),
1698 ('', 'changedelete', None, _('emulate merging change and delete')),
1717 ('', 'changedelete', None, _('emulate merging change and delete')),
1699 ] + cmdutil.walkopts + cmdutil.mergetoolopts,
1718 ] + cmdutil.walkopts + cmdutil.mergetoolopts,
1700 _('[PATTERN]...'),
1719 _('[PATTERN]...'),
1701 inferrepo=True)
1720 inferrepo=True)
1702 def debugpickmergetool(ui, repo, *pats, **opts):
1721 def debugpickmergetool(ui, repo, *pats, **opts):
1703 """examine which merge tool is chosen for specified file
1722 """examine which merge tool is chosen for specified file
1704
1723
1705 As described in :hg:`help merge-tools`, Mercurial examines
1724 As described in :hg:`help merge-tools`, Mercurial examines
1706 configurations below in this order to decide which merge tool is
1725 configurations below in this order to decide which merge tool is
1707 chosen for specified file.
1726 chosen for specified file.
1708
1727
1709 1. ``--tool`` option
1728 1. ``--tool`` option
1710 2. ``HGMERGE`` environment variable
1729 2. ``HGMERGE`` environment variable
1711 3. configurations in ``merge-patterns`` section
1730 3. configurations in ``merge-patterns`` section
1712 4. configuration of ``ui.merge``
1731 4. configuration of ``ui.merge``
1713 5. configurations in ``merge-tools`` section
1732 5. configurations in ``merge-tools`` section
1714 6. ``hgmerge`` tool (for historical reason only)
1733 6. ``hgmerge`` tool (for historical reason only)
1715 7. default tool for fallback (``:merge`` or ``:prompt``)
1734 7. default tool for fallback (``:merge`` or ``:prompt``)
1716
1735
1717 This command writes out examination result in the style below::
1736 This command writes out examination result in the style below::
1718
1737
1719 FILE = MERGETOOL
1738 FILE = MERGETOOL
1720
1739
1721 By default, all files known in the first parent context of the
1740 By default, all files known in the first parent context of the
1722 working directory are examined. Use file patterns and/or -I/-X
1741 working directory are examined. Use file patterns and/or -I/-X
1723 options to limit target files. -r/--rev is also useful to examine
1742 options to limit target files. -r/--rev is also useful to examine
1724 files in another context without actual updating to it.
1743 files in another context without actual updating to it.
1725
1744
1726 With --debug, this command shows warning messages while matching
1745 With --debug, this command shows warning messages while matching
1727 against ``merge-patterns`` and so on, too. It is recommended to
1746 against ``merge-patterns`` and so on, too. It is recommended to
1728 use this option with explicit file patterns and/or -I/-X options,
1747 use this option with explicit file patterns and/or -I/-X options,
1729 because this option increases amount of output per file according
1748 because this option increases amount of output per file according
1730 to configurations in hgrc.
1749 to configurations in hgrc.
1731
1750
1732 With -v/--verbose, this command shows configurations below at
1751 With -v/--verbose, this command shows configurations below at
1733 first (only if specified).
1752 first (only if specified).
1734
1753
1735 - ``--tool`` option
1754 - ``--tool`` option
1736 - ``HGMERGE`` environment variable
1755 - ``HGMERGE`` environment variable
1737 - configuration of ``ui.merge``
1756 - configuration of ``ui.merge``
1738
1757
1739 If merge tool is chosen before matching against
1758 If merge tool is chosen before matching against
1740 ``merge-patterns``, this command can't show any helpful
1759 ``merge-patterns``, this command can't show any helpful
1741 information, even with --debug. In such case, information above is
1760 information, even with --debug. In such case, information above is
1742 useful to know why a merge tool is chosen.
1761 useful to know why a merge tool is chosen.
1743 """
1762 """
1744 opts = pycompat.byteskwargs(opts)
1763 opts = pycompat.byteskwargs(opts)
1745 overrides = {}
1764 overrides = {}
1746 if opts['tool']:
1765 if opts['tool']:
1747 overrides[('ui', 'forcemerge')] = opts['tool']
1766 overrides[('ui', 'forcemerge')] = opts['tool']
1748 ui.note(('with --tool %r\n') % (opts['tool']))
1767 ui.note(('with --tool %r\n') % (opts['tool']))
1749
1768
1750 with ui.configoverride(overrides, 'debugmergepatterns'):
1769 with ui.configoverride(overrides, 'debugmergepatterns'):
1751 hgmerge = encoding.environ.get("HGMERGE")
1770 hgmerge = encoding.environ.get("HGMERGE")
1752 if hgmerge is not None:
1771 if hgmerge is not None:
1753 ui.note(('with HGMERGE=%r\n') % (hgmerge))
1772 ui.note(('with HGMERGE=%r\n') % (hgmerge))
1754 uimerge = ui.config("ui", "merge")
1773 uimerge = ui.config("ui", "merge")
1755 if uimerge:
1774 if uimerge:
1756 ui.note(('with ui.merge=%r\n') % (uimerge))
1775 ui.note(('with ui.merge=%r\n') % (uimerge))
1757
1776
1758 ctx = scmutil.revsingle(repo, opts.get('rev'))
1777 ctx = scmutil.revsingle(repo, opts.get('rev'))
1759 m = scmutil.match(ctx, pats, opts)
1778 m = scmutil.match(ctx, pats, opts)
1760 changedelete = opts['changedelete']
1779 changedelete = opts['changedelete']
1761 for path in ctx.walk(m):
1780 for path in ctx.walk(m):
1762 fctx = ctx[path]
1781 fctx = ctx[path]
1763 try:
1782 try:
1764 if not ui.debugflag:
1783 if not ui.debugflag:
1765 ui.pushbuffer(error=True)
1784 ui.pushbuffer(error=True)
1766 tool, toolpath = filemerge._picktool(repo, ui, path,
1785 tool, toolpath = filemerge._picktool(repo, ui, path,
1767 fctx.isbinary(),
1786 fctx.isbinary(),
1768 'l' in fctx.flags(),
1787 'l' in fctx.flags(),
1769 changedelete)
1788 changedelete)
1770 finally:
1789 finally:
1771 if not ui.debugflag:
1790 if not ui.debugflag:
1772 ui.popbuffer()
1791 ui.popbuffer()
1773 ui.write(('%s = %s\n') % (path, tool))
1792 ui.write(('%s = %s\n') % (path, tool))
1774
1793
1775 @command('debugpushkey', [], _('REPO NAMESPACE [KEY OLD NEW]'), norepo=True)
1794 @command('debugpushkey', [], _('REPO NAMESPACE [KEY OLD NEW]'), norepo=True)
1776 def debugpushkey(ui, repopath, namespace, *keyinfo, **opts):
1795 def debugpushkey(ui, repopath, namespace, *keyinfo, **opts):
1777 '''access the pushkey key/value protocol
1796 '''access the pushkey key/value protocol
1778
1797
1779 With two args, list the keys in the given namespace.
1798 With two args, list the keys in the given namespace.
1780
1799
1781 With five args, set a key to new if it currently is set to old.
1800 With five args, set a key to new if it currently is set to old.
1782 Reports success or failure.
1801 Reports success or failure.
1783 '''
1802 '''
1784
1803
1785 target = hg.peer(ui, {}, repopath)
1804 target = hg.peer(ui, {}, repopath)
1786 if keyinfo:
1805 if keyinfo:
1787 key, old, new = keyinfo
1806 key, old, new = keyinfo
1788 r = target.pushkey(namespace, key, old, new)
1807 r = target.pushkey(namespace, key, old, new)
1789 ui.status(str(r) + '\n')
1808 ui.status(str(r) + '\n')
1790 return not r
1809 return not r
1791 else:
1810 else:
1792 for k, v in sorted(target.listkeys(namespace).iteritems()):
1811 for k, v in sorted(target.listkeys(namespace).iteritems()):
1793 ui.write("%s\t%s\n" % (util.escapestr(k),
1812 ui.write("%s\t%s\n" % (util.escapestr(k),
1794 util.escapestr(v)))
1813 util.escapestr(v)))
1795
1814
1796 @command('debugpvec', [], _('A B'))
1815 @command('debugpvec', [], _('A B'))
1797 def debugpvec(ui, repo, a, b=None):
1816 def debugpvec(ui, repo, a, b=None):
1798 ca = scmutil.revsingle(repo, a)
1817 ca = scmutil.revsingle(repo, a)
1799 cb = scmutil.revsingle(repo, b)
1818 cb = scmutil.revsingle(repo, b)
1800 pa = pvec.ctxpvec(ca)
1819 pa = pvec.ctxpvec(ca)
1801 pb = pvec.ctxpvec(cb)
1820 pb = pvec.ctxpvec(cb)
1802 if pa == pb:
1821 if pa == pb:
1803 rel = "="
1822 rel = "="
1804 elif pa > pb:
1823 elif pa > pb:
1805 rel = ">"
1824 rel = ">"
1806 elif pa < pb:
1825 elif pa < pb:
1807 rel = "<"
1826 rel = "<"
1808 elif pa | pb:
1827 elif pa | pb:
1809 rel = "|"
1828 rel = "|"
1810 ui.write(_("a: %s\n") % pa)
1829 ui.write(_("a: %s\n") % pa)
1811 ui.write(_("b: %s\n") % pb)
1830 ui.write(_("b: %s\n") % pb)
1812 ui.write(_("depth(a): %d depth(b): %d\n") % (pa._depth, pb._depth))
1831 ui.write(_("depth(a): %d depth(b): %d\n") % (pa._depth, pb._depth))
1813 ui.write(_("delta: %d hdist: %d distance: %d relation: %s\n") %
1832 ui.write(_("delta: %d hdist: %d distance: %d relation: %s\n") %
1814 (abs(pa._depth - pb._depth), pvec._hamming(pa._vec, pb._vec),
1833 (abs(pa._depth - pb._depth), pvec._hamming(pa._vec, pb._vec),
1815 pa.distance(pb), rel))
1834 pa.distance(pb), rel))
1816
1835
1817 @command('debugrebuilddirstate|debugrebuildstate',
1836 @command('debugrebuilddirstate|debugrebuildstate',
1818 [('r', 'rev', '', _('revision to rebuild to'), _('REV')),
1837 [('r', 'rev', '', _('revision to rebuild to'), _('REV')),
1819 ('', 'minimal', None, _('only rebuild files that are inconsistent with '
1838 ('', 'minimal', None, _('only rebuild files that are inconsistent with '
1820 'the working copy parent')),
1839 'the working copy parent')),
1821 ],
1840 ],
1822 _('[-r REV]'))
1841 _('[-r REV]'))
1823 def debugrebuilddirstate(ui, repo, rev, **opts):
1842 def debugrebuilddirstate(ui, repo, rev, **opts):
1824 """rebuild the dirstate as it would look like for the given revision
1843 """rebuild the dirstate as it would look like for the given revision
1825
1844
1826 If no revision is specified the first current parent will be used.
1845 If no revision is specified the first current parent will be used.
1827
1846
1828 The dirstate will be set to the files of the given revision.
1847 The dirstate will be set to the files of the given revision.
1829 The actual working directory content or existing dirstate
1848 The actual working directory content or existing dirstate
1830 information such as adds or removes is not considered.
1849 information such as adds or removes is not considered.
1831
1850
1832 ``minimal`` will only rebuild the dirstate status for files that claim to be
1851 ``minimal`` will only rebuild the dirstate status for files that claim to be
1833 tracked but are not in the parent manifest, or that exist in the parent
1852 tracked but are not in the parent manifest, or that exist in the parent
1834 manifest but are not in the dirstate. It will not change adds, removes, or
1853 manifest but are not in the dirstate. It will not change adds, removes, or
1835 modified files that are in the working copy parent.
1854 modified files that are in the working copy parent.
1836
1855
1837 One use of this command is to make the next :hg:`status` invocation
1856 One use of this command is to make the next :hg:`status` invocation
1838 check the actual file content.
1857 check the actual file content.
1839 """
1858 """
1840 ctx = scmutil.revsingle(repo, rev)
1859 ctx = scmutil.revsingle(repo, rev)
1841 with repo.wlock():
1860 with repo.wlock():
1842 dirstate = repo.dirstate
1861 dirstate = repo.dirstate
1843 changedfiles = None
1862 changedfiles = None
1844 # See command doc for what minimal does.
1863 # See command doc for what minimal does.
1845 if opts.get(r'minimal'):
1864 if opts.get(r'minimal'):
1846 manifestfiles = set(ctx.manifest().keys())
1865 manifestfiles = set(ctx.manifest().keys())
1847 dirstatefiles = set(dirstate)
1866 dirstatefiles = set(dirstate)
1848 manifestonly = manifestfiles - dirstatefiles
1867 manifestonly = manifestfiles - dirstatefiles
1849 dsonly = dirstatefiles - manifestfiles
1868 dsonly = dirstatefiles - manifestfiles
1850 dsnotadded = set(f for f in dsonly if dirstate[f] != 'a')
1869 dsnotadded = set(f for f in dsonly if dirstate[f] != 'a')
1851 changedfiles = manifestonly | dsnotadded
1870 changedfiles = manifestonly | dsnotadded
1852
1871
1853 dirstate.rebuild(ctx.node(), ctx.manifest(), changedfiles)
1872 dirstate.rebuild(ctx.node(), ctx.manifest(), changedfiles)
1854
1873
1855 @command('debugrebuildfncache', [], '')
1874 @command('debugrebuildfncache', [], '')
1856 def debugrebuildfncache(ui, repo):
1875 def debugrebuildfncache(ui, repo):
1857 """rebuild the fncache file"""
1876 """rebuild the fncache file"""
1858 repair.rebuildfncache(ui, repo)
1877 repair.rebuildfncache(ui, repo)
1859
1878
1860 @command('debugrename',
1879 @command('debugrename',
1861 [('r', 'rev', '', _('revision to debug'), _('REV'))],
1880 [('r', 'rev', '', _('revision to debug'), _('REV'))],
1862 _('[-r REV] FILE'))
1881 _('[-r REV] FILE'))
1863 def debugrename(ui, repo, file1, *pats, **opts):
1882 def debugrename(ui, repo, file1, *pats, **opts):
1864 """dump rename information"""
1883 """dump rename information"""
1865
1884
1866 opts = pycompat.byteskwargs(opts)
1885 opts = pycompat.byteskwargs(opts)
1867 ctx = scmutil.revsingle(repo, opts.get('rev'))
1886 ctx = scmutil.revsingle(repo, opts.get('rev'))
1868 m = scmutil.match(ctx, (file1,) + pats, opts)
1887 m = scmutil.match(ctx, (file1,) + pats, opts)
1869 for abs in ctx.walk(m):
1888 for abs in ctx.walk(m):
1870 fctx = ctx[abs]
1889 fctx = ctx[abs]
1871 o = fctx.filelog().renamed(fctx.filenode())
1890 o = fctx.filelog().renamed(fctx.filenode())
1872 rel = m.rel(abs)
1891 rel = m.rel(abs)
1873 if o:
1892 if o:
1874 ui.write(_("%s renamed from %s:%s\n") % (rel, o[0], hex(o[1])))
1893 ui.write(_("%s renamed from %s:%s\n") % (rel, o[0], hex(o[1])))
1875 else:
1894 else:
1876 ui.write(_("%s not renamed\n") % rel)
1895 ui.write(_("%s not renamed\n") % rel)
1877
1896
1878 @command('debugrevlog', cmdutil.debugrevlogopts +
1897 @command('debugrevlog', cmdutil.debugrevlogopts +
1879 [('d', 'dump', False, _('dump index data'))],
1898 [('d', 'dump', False, _('dump index data'))],
1880 _('-c|-m|FILE'),
1899 _('-c|-m|FILE'),
1881 optionalrepo=True)
1900 optionalrepo=True)
1882 def debugrevlog(ui, repo, file_=None, **opts):
1901 def debugrevlog(ui, repo, file_=None, **opts):
1883 """show data and statistics about a revlog"""
1902 """show data and statistics about a revlog"""
1884 opts = pycompat.byteskwargs(opts)
1903 opts = pycompat.byteskwargs(opts)
1885 r = cmdutil.openrevlog(repo, 'debugrevlog', file_, opts)
1904 r = cmdutil.openrevlog(repo, 'debugrevlog', file_, opts)
1886
1905
1887 if opts.get("dump"):
1906 if opts.get("dump"):
1888 numrevs = len(r)
1907 numrevs = len(r)
1889 ui.write(("# rev p1rev p2rev start end deltastart base p1 p2"
1908 ui.write(("# rev p1rev p2rev start end deltastart base p1 p2"
1890 " rawsize totalsize compression heads chainlen\n"))
1909 " rawsize totalsize compression heads chainlen\n"))
1891 ts = 0
1910 ts = 0
1892 heads = set()
1911 heads = set()
1893
1912
1894 for rev in xrange(numrevs):
1913 for rev in xrange(numrevs):
1895 dbase = r.deltaparent(rev)
1914 dbase = r.deltaparent(rev)
1896 if dbase == -1:
1915 if dbase == -1:
1897 dbase = rev
1916 dbase = rev
1898 cbase = r.chainbase(rev)
1917 cbase = r.chainbase(rev)
1899 clen = r.chainlen(rev)
1918 clen = r.chainlen(rev)
1900 p1, p2 = r.parentrevs(rev)
1919 p1, p2 = r.parentrevs(rev)
1901 rs = r.rawsize(rev)
1920 rs = r.rawsize(rev)
1902 ts = ts + rs
1921 ts = ts + rs
1903 heads -= set(r.parentrevs(rev))
1922 heads -= set(r.parentrevs(rev))
1904 heads.add(rev)
1923 heads.add(rev)
1905 try:
1924 try:
1906 compression = ts / r.end(rev)
1925 compression = ts / r.end(rev)
1907 except ZeroDivisionError:
1926 except ZeroDivisionError:
1908 compression = 0
1927 compression = 0
1909 ui.write("%5d %5d %5d %5d %5d %10d %4d %4d %4d %7d %9d "
1928 ui.write("%5d %5d %5d %5d %5d %10d %4d %4d %4d %7d %9d "
1910 "%11d %5d %8d\n" %
1929 "%11d %5d %8d\n" %
1911 (rev, p1, p2, r.start(rev), r.end(rev),
1930 (rev, p1, p2, r.start(rev), r.end(rev),
1912 r.start(dbase), r.start(cbase),
1931 r.start(dbase), r.start(cbase),
1913 r.start(p1), r.start(p2),
1932 r.start(p1), r.start(p2),
1914 rs, ts, compression, len(heads), clen))
1933 rs, ts, compression, len(heads), clen))
1915 return 0
1934 return 0
1916
1935
1917 v = r.version
1936 v = r.version
1918 format = v & 0xFFFF
1937 format = v & 0xFFFF
1919 flags = []
1938 flags = []
1920 gdelta = False
1939 gdelta = False
1921 if v & revlog.FLAG_INLINE_DATA:
1940 if v & revlog.FLAG_INLINE_DATA:
1922 flags.append('inline')
1941 flags.append('inline')
1923 if v & revlog.FLAG_GENERALDELTA:
1942 if v & revlog.FLAG_GENERALDELTA:
1924 gdelta = True
1943 gdelta = True
1925 flags.append('generaldelta')
1944 flags.append('generaldelta')
1926 if not flags:
1945 if not flags:
1927 flags = ['(none)']
1946 flags = ['(none)']
1928
1947
1929 nummerges = 0
1948 nummerges = 0
1930 numfull = 0
1949 numfull = 0
1931 numprev = 0
1950 numprev = 0
1932 nump1 = 0
1951 nump1 = 0
1933 nump2 = 0
1952 nump2 = 0
1934 numother = 0
1953 numother = 0
1935 nump1prev = 0
1954 nump1prev = 0
1936 nump2prev = 0
1955 nump2prev = 0
1937 chainlengths = []
1956 chainlengths = []
1938 chainbases = []
1957 chainbases = []
1939 chainspans = []
1958 chainspans = []
1940
1959
1941 datasize = [None, 0, 0]
1960 datasize = [None, 0, 0]
1942 fullsize = [None, 0, 0]
1961 fullsize = [None, 0, 0]
1943 deltasize = [None, 0, 0]
1962 deltasize = [None, 0, 0]
1944 chunktypecounts = {}
1963 chunktypecounts = {}
1945 chunktypesizes = {}
1964 chunktypesizes = {}
1946
1965
1947 def addsize(size, l):
1966 def addsize(size, l):
1948 if l[0] is None or size < l[0]:
1967 if l[0] is None or size < l[0]:
1949 l[0] = size
1968 l[0] = size
1950 if size > l[1]:
1969 if size > l[1]:
1951 l[1] = size
1970 l[1] = size
1952 l[2] += size
1971 l[2] += size
1953
1972
1954 numrevs = len(r)
1973 numrevs = len(r)
1955 for rev in xrange(numrevs):
1974 for rev in xrange(numrevs):
1956 p1, p2 = r.parentrevs(rev)
1975 p1, p2 = r.parentrevs(rev)
1957 delta = r.deltaparent(rev)
1976 delta = r.deltaparent(rev)
1958 if format > 0:
1977 if format > 0:
1959 addsize(r.rawsize(rev), datasize)
1978 addsize(r.rawsize(rev), datasize)
1960 if p2 != nullrev:
1979 if p2 != nullrev:
1961 nummerges += 1
1980 nummerges += 1
1962 size = r.length(rev)
1981 size = r.length(rev)
1963 if delta == nullrev:
1982 if delta == nullrev:
1964 chainlengths.append(0)
1983 chainlengths.append(0)
1965 chainbases.append(r.start(rev))
1984 chainbases.append(r.start(rev))
1966 chainspans.append(size)
1985 chainspans.append(size)
1967 numfull += 1
1986 numfull += 1
1968 addsize(size, fullsize)
1987 addsize(size, fullsize)
1969 else:
1988 else:
1970 chainlengths.append(chainlengths[delta] + 1)
1989 chainlengths.append(chainlengths[delta] + 1)
1971 baseaddr = chainbases[delta]
1990 baseaddr = chainbases[delta]
1972 revaddr = r.start(rev)
1991 revaddr = r.start(rev)
1973 chainbases.append(baseaddr)
1992 chainbases.append(baseaddr)
1974 chainspans.append((revaddr - baseaddr) + size)
1993 chainspans.append((revaddr - baseaddr) + size)
1975 addsize(size, deltasize)
1994 addsize(size, deltasize)
1976 if delta == rev - 1:
1995 if delta == rev - 1:
1977 numprev += 1
1996 numprev += 1
1978 if delta == p1:
1997 if delta == p1:
1979 nump1prev += 1
1998 nump1prev += 1
1980 elif delta == p2:
1999 elif delta == p2:
1981 nump2prev += 1
2000 nump2prev += 1
1982 elif delta == p1:
2001 elif delta == p1:
1983 nump1 += 1
2002 nump1 += 1
1984 elif delta == p2:
2003 elif delta == p2:
1985 nump2 += 1
2004 nump2 += 1
1986 elif delta != nullrev:
2005 elif delta != nullrev:
1987 numother += 1
2006 numother += 1
1988
2007
1989 # Obtain data on the raw chunks in the revlog.
2008 # Obtain data on the raw chunks in the revlog.
1990 segment = r._getsegmentforrevs(rev, rev)[1]
2009 segment = r._getsegmentforrevs(rev, rev)[1]
1991 if segment:
2010 if segment:
1992 chunktype = bytes(segment[0:1])
2011 chunktype = bytes(segment[0:1])
1993 else:
2012 else:
1994 chunktype = 'empty'
2013 chunktype = 'empty'
1995
2014
1996 if chunktype not in chunktypecounts:
2015 if chunktype not in chunktypecounts:
1997 chunktypecounts[chunktype] = 0
2016 chunktypecounts[chunktype] = 0
1998 chunktypesizes[chunktype] = 0
2017 chunktypesizes[chunktype] = 0
1999
2018
2000 chunktypecounts[chunktype] += 1
2019 chunktypecounts[chunktype] += 1
2001 chunktypesizes[chunktype] += size
2020 chunktypesizes[chunktype] += size
2002
2021
2003 # Adjust size min value for empty cases
2022 # Adjust size min value for empty cases
2004 for size in (datasize, fullsize, deltasize):
2023 for size in (datasize, fullsize, deltasize):
2005 if size[0] is None:
2024 if size[0] is None:
2006 size[0] = 0
2025 size[0] = 0
2007
2026
2008 numdeltas = numrevs - numfull
2027 numdeltas = numrevs - numfull
2009 numoprev = numprev - nump1prev - nump2prev
2028 numoprev = numprev - nump1prev - nump2prev
2010 totalrawsize = datasize[2]
2029 totalrawsize = datasize[2]
2011 datasize[2] /= numrevs
2030 datasize[2] /= numrevs
2012 fulltotal = fullsize[2]
2031 fulltotal = fullsize[2]
2013 fullsize[2] /= numfull
2032 fullsize[2] /= numfull
2014 deltatotal = deltasize[2]
2033 deltatotal = deltasize[2]
2015 if numrevs - numfull > 0:
2034 if numrevs - numfull > 0:
2016 deltasize[2] /= numrevs - numfull
2035 deltasize[2] /= numrevs - numfull
2017 totalsize = fulltotal + deltatotal
2036 totalsize = fulltotal + deltatotal
2018 avgchainlen = sum(chainlengths) / numrevs
2037 avgchainlen = sum(chainlengths) / numrevs
2019 maxchainlen = max(chainlengths)
2038 maxchainlen = max(chainlengths)
2020 maxchainspan = max(chainspans)
2039 maxchainspan = max(chainspans)
2021 compratio = 1
2040 compratio = 1
2022 if totalsize:
2041 if totalsize:
2023 compratio = totalrawsize / totalsize
2042 compratio = totalrawsize / totalsize
2024
2043
2025 basedfmtstr = '%%%dd\n'
2044 basedfmtstr = '%%%dd\n'
2026 basepcfmtstr = '%%%dd %s(%%5.2f%%%%)\n'
2045 basepcfmtstr = '%%%dd %s(%%5.2f%%%%)\n'
2027
2046
2028 def dfmtstr(max):
2047 def dfmtstr(max):
2029 return basedfmtstr % len(str(max))
2048 return basedfmtstr % len(str(max))
2030 def pcfmtstr(max, padding=0):
2049 def pcfmtstr(max, padding=0):
2031 return basepcfmtstr % (len(str(max)), ' ' * padding)
2050 return basepcfmtstr % (len(str(max)), ' ' * padding)
2032
2051
2033 def pcfmt(value, total):
2052 def pcfmt(value, total):
2034 if total:
2053 if total:
2035 return (value, 100 * float(value) / total)
2054 return (value, 100 * float(value) / total)
2036 else:
2055 else:
2037 return value, 100.0
2056 return value, 100.0
2038
2057
2039 ui.write(('format : %d\n') % format)
2058 ui.write(('format : %d\n') % format)
2040 ui.write(('flags : %s\n') % ', '.join(flags))
2059 ui.write(('flags : %s\n') % ', '.join(flags))
2041
2060
2042 ui.write('\n')
2061 ui.write('\n')
2043 fmt = pcfmtstr(totalsize)
2062 fmt = pcfmtstr(totalsize)
2044 fmt2 = dfmtstr(totalsize)
2063 fmt2 = dfmtstr(totalsize)
2045 ui.write(('revisions : ') + fmt2 % numrevs)
2064 ui.write(('revisions : ') + fmt2 % numrevs)
2046 ui.write((' merges : ') + fmt % pcfmt(nummerges, numrevs))
2065 ui.write((' merges : ') + fmt % pcfmt(nummerges, numrevs))
2047 ui.write((' normal : ') + fmt % pcfmt(numrevs - nummerges, numrevs))
2066 ui.write((' normal : ') + fmt % pcfmt(numrevs - nummerges, numrevs))
2048 ui.write(('revisions : ') + fmt2 % numrevs)
2067 ui.write(('revisions : ') + fmt2 % numrevs)
2049 ui.write((' full : ') + fmt % pcfmt(numfull, numrevs))
2068 ui.write((' full : ') + fmt % pcfmt(numfull, numrevs))
2050 ui.write((' deltas : ') + fmt % pcfmt(numdeltas, numrevs))
2069 ui.write((' deltas : ') + fmt % pcfmt(numdeltas, numrevs))
2051 ui.write(('revision size : ') + fmt2 % totalsize)
2070 ui.write(('revision size : ') + fmt2 % totalsize)
2052 ui.write((' full : ') + fmt % pcfmt(fulltotal, totalsize))
2071 ui.write((' full : ') + fmt % pcfmt(fulltotal, totalsize))
2053 ui.write((' deltas : ') + fmt % pcfmt(deltatotal, totalsize))
2072 ui.write((' deltas : ') + fmt % pcfmt(deltatotal, totalsize))
2054
2073
2055 def fmtchunktype(chunktype):
2074 def fmtchunktype(chunktype):
2056 if chunktype == 'empty':
2075 if chunktype == 'empty':
2057 return ' %s : ' % chunktype
2076 return ' %s : ' % chunktype
2058 elif chunktype in pycompat.bytestr(string.ascii_letters):
2077 elif chunktype in pycompat.bytestr(string.ascii_letters):
2059 return ' 0x%s (%s) : ' % (hex(chunktype), chunktype)
2078 return ' 0x%s (%s) : ' % (hex(chunktype), chunktype)
2060 else:
2079 else:
2061 return ' 0x%s : ' % hex(chunktype)
2080 return ' 0x%s : ' % hex(chunktype)
2062
2081
2063 ui.write('\n')
2082 ui.write('\n')
2064 ui.write(('chunks : ') + fmt2 % numrevs)
2083 ui.write(('chunks : ') + fmt2 % numrevs)
2065 for chunktype in sorted(chunktypecounts):
2084 for chunktype in sorted(chunktypecounts):
2066 ui.write(fmtchunktype(chunktype))
2085 ui.write(fmtchunktype(chunktype))
2067 ui.write(fmt % pcfmt(chunktypecounts[chunktype], numrevs))
2086 ui.write(fmt % pcfmt(chunktypecounts[chunktype], numrevs))
2068 ui.write(('chunks size : ') + fmt2 % totalsize)
2087 ui.write(('chunks size : ') + fmt2 % totalsize)
2069 for chunktype in sorted(chunktypecounts):
2088 for chunktype in sorted(chunktypecounts):
2070 ui.write(fmtchunktype(chunktype))
2089 ui.write(fmtchunktype(chunktype))
2071 ui.write(fmt % pcfmt(chunktypesizes[chunktype], totalsize))
2090 ui.write(fmt % pcfmt(chunktypesizes[chunktype], totalsize))
2072
2091
2073 ui.write('\n')
2092 ui.write('\n')
2074 fmt = dfmtstr(max(avgchainlen, maxchainlen, maxchainspan, compratio))
2093 fmt = dfmtstr(max(avgchainlen, maxchainlen, maxchainspan, compratio))
2075 ui.write(('avg chain length : ') + fmt % avgchainlen)
2094 ui.write(('avg chain length : ') + fmt % avgchainlen)
2076 ui.write(('max chain length : ') + fmt % maxchainlen)
2095 ui.write(('max chain length : ') + fmt % maxchainlen)
2077 ui.write(('max chain reach : ') + fmt % maxchainspan)
2096 ui.write(('max chain reach : ') + fmt % maxchainspan)
2078 ui.write(('compression ratio : ') + fmt % compratio)
2097 ui.write(('compression ratio : ') + fmt % compratio)
2079
2098
2080 if format > 0:
2099 if format > 0:
2081 ui.write('\n')
2100 ui.write('\n')
2082 ui.write(('uncompressed data size (min/max/avg) : %d / %d / %d\n')
2101 ui.write(('uncompressed data size (min/max/avg) : %d / %d / %d\n')
2083 % tuple(datasize))
2102 % tuple(datasize))
2084 ui.write(('full revision size (min/max/avg) : %d / %d / %d\n')
2103 ui.write(('full revision size (min/max/avg) : %d / %d / %d\n')
2085 % tuple(fullsize))
2104 % tuple(fullsize))
2086 ui.write(('delta size (min/max/avg) : %d / %d / %d\n')
2105 ui.write(('delta size (min/max/avg) : %d / %d / %d\n')
2087 % tuple(deltasize))
2106 % tuple(deltasize))
2088
2107
2089 if numdeltas > 0:
2108 if numdeltas > 0:
2090 ui.write('\n')
2109 ui.write('\n')
2091 fmt = pcfmtstr(numdeltas)
2110 fmt = pcfmtstr(numdeltas)
2092 fmt2 = pcfmtstr(numdeltas, 4)
2111 fmt2 = pcfmtstr(numdeltas, 4)
2093 ui.write(('deltas against prev : ') + fmt % pcfmt(numprev, numdeltas))
2112 ui.write(('deltas against prev : ') + fmt % pcfmt(numprev, numdeltas))
2094 if numprev > 0:
2113 if numprev > 0:
2095 ui.write((' where prev = p1 : ') + fmt2 % pcfmt(nump1prev,
2114 ui.write((' where prev = p1 : ') + fmt2 % pcfmt(nump1prev,
2096 numprev))
2115 numprev))
2097 ui.write((' where prev = p2 : ') + fmt2 % pcfmt(nump2prev,
2116 ui.write((' where prev = p2 : ') + fmt2 % pcfmt(nump2prev,
2098 numprev))
2117 numprev))
2099 ui.write((' other : ') + fmt2 % pcfmt(numoprev,
2118 ui.write((' other : ') + fmt2 % pcfmt(numoprev,
2100 numprev))
2119 numprev))
2101 if gdelta:
2120 if gdelta:
2102 ui.write(('deltas against p1 : ')
2121 ui.write(('deltas against p1 : ')
2103 + fmt % pcfmt(nump1, numdeltas))
2122 + fmt % pcfmt(nump1, numdeltas))
2104 ui.write(('deltas against p2 : ')
2123 ui.write(('deltas against p2 : ')
2105 + fmt % pcfmt(nump2, numdeltas))
2124 + fmt % pcfmt(nump2, numdeltas))
2106 ui.write(('deltas against other : ') + fmt % pcfmt(numother,
2125 ui.write(('deltas against other : ') + fmt % pcfmt(numother,
2107 numdeltas))
2126 numdeltas))
2108
2127
2109 @command('debugrevspec',
2128 @command('debugrevspec',
2110 [('', 'optimize', None,
2129 [('', 'optimize', None,
2111 _('print parsed tree after optimizing (DEPRECATED)')),
2130 _('print parsed tree after optimizing (DEPRECATED)')),
2112 ('', 'show-revs', True, _('print list of result revisions (default)')),
2131 ('', 'show-revs', True, _('print list of result revisions (default)')),
2113 ('s', 'show-set', None, _('print internal representation of result set')),
2132 ('s', 'show-set', None, _('print internal representation of result set')),
2114 ('p', 'show-stage', [],
2133 ('p', 'show-stage', [],
2115 _('print parsed tree at the given stage'), _('NAME')),
2134 _('print parsed tree at the given stage'), _('NAME')),
2116 ('', 'no-optimized', False, _('evaluate tree without optimization')),
2135 ('', 'no-optimized', False, _('evaluate tree without optimization')),
2117 ('', 'verify-optimized', False, _('verify optimized result')),
2136 ('', 'verify-optimized', False, _('verify optimized result')),
2118 ],
2137 ],
2119 ('REVSPEC'))
2138 ('REVSPEC'))
2120 def debugrevspec(ui, repo, expr, **opts):
2139 def debugrevspec(ui, repo, expr, **opts):
2121 """parse and apply a revision specification
2140 """parse and apply a revision specification
2122
2141
2123 Use -p/--show-stage option to print the parsed tree at the given stages.
2142 Use -p/--show-stage option to print the parsed tree at the given stages.
2124 Use -p all to print tree at every stage.
2143 Use -p all to print tree at every stage.
2125
2144
2126 Use --no-show-revs option with -s or -p to print only the set
2145 Use --no-show-revs option with -s or -p to print only the set
2127 representation or the parsed tree respectively.
2146 representation or the parsed tree respectively.
2128
2147
2129 Use --verify-optimized to compare the optimized result with the unoptimized
2148 Use --verify-optimized to compare the optimized result with the unoptimized
2130 one. Returns 1 if the optimized result differs.
2149 one. Returns 1 if the optimized result differs.
2131 """
2150 """
2132 opts = pycompat.byteskwargs(opts)
2151 opts = pycompat.byteskwargs(opts)
2133 aliases = ui.configitems('revsetalias')
2152 aliases = ui.configitems('revsetalias')
2134 stages = [
2153 stages = [
2135 ('parsed', lambda tree: tree),
2154 ('parsed', lambda tree: tree),
2136 ('expanded', lambda tree: revsetlang.expandaliases(tree, aliases,
2155 ('expanded', lambda tree: revsetlang.expandaliases(tree, aliases,
2137 ui.warn)),
2156 ui.warn)),
2138 ('concatenated', revsetlang.foldconcat),
2157 ('concatenated', revsetlang.foldconcat),
2139 ('analyzed', revsetlang.analyze),
2158 ('analyzed', revsetlang.analyze),
2140 ('optimized', revsetlang.optimize),
2159 ('optimized', revsetlang.optimize),
2141 ]
2160 ]
2142 if opts['no_optimized']:
2161 if opts['no_optimized']:
2143 stages = stages[:-1]
2162 stages = stages[:-1]
2144 if opts['verify_optimized'] and opts['no_optimized']:
2163 if opts['verify_optimized'] and opts['no_optimized']:
2145 raise error.Abort(_('cannot use --verify-optimized with '
2164 raise error.Abort(_('cannot use --verify-optimized with '
2146 '--no-optimized'))
2165 '--no-optimized'))
2147 stagenames = set(n for n, f in stages)
2166 stagenames = set(n for n, f in stages)
2148
2167
2149 showalways = set()
2168 showalways = set()
2150 showchanged = set()
2169 showchanged = set()
2151 if ui.verbose and not opts['show_stage']:
2170 if ui.verbose and not opts['show_stage']:
2152 # show parsed tree by --verbose (deprecated)
2171 # show parsed tree by --verbose (deprecated)
2153 showalways.add('parsed')
2172 showalways.add('parsed')
2154 showchanged.update(['expanded', 'concatenated'])
2173 showchanged.update(['expanded', 'concatenated'])
2155 if opts['optimize']:
2174 if opts['optimize']:
2156 showalways.add('optimized')
2175 showalways.add('optimized')
2157 if opts['show_stage'] and opts['optimize']:
2176 if opts['show_stage'] and opts['optimize']:
2158 raise error.Abort(_('cannot use --optimize with --show-stage'))
2177 raise error.Abort(_('cannot use --optimize with --show-stage'))
2159 if opts['show_stage'] == ['all']:
2178 if opts['show_stage'] == ['all']:
2160 showalways.update(stagenames)
2179 showalways.update(stagenames)
2161 else:
2180 else:
2162 for n in opts['show_stage']:
2181 for n in opts['show_stage']:
2163 if n not in stagenames:
2182 if n not in stagenames:
2164 raise error.Abort(_('invalid stage name: %s') % n)
2183 raise error.Abort(_('invalid stage name: %s') % n)
2165 showalways.update(opts['show_stage'])
2184 showalways.update(opts['show_stage'])
2166
2185
2167 treebystage = {}
2186 treebystage = {}
2168 printedtree = None
2187 printedtree = None
2169 tree = revsetlang.parse(expr, lookup=repo.__contains__)
2188 tree = revsetlang.parse(expr, lookup=repo.__contains__)
2170 for n, f in stages:
2189 for n, f in stages:
2171 treebystage[n] = tree = f(tree)
2190 treebystage[n] = tree = f(tree)
2172 if n in showalways or (n in showchanged and tree != printedtree):
2191 if n in showalways or (n in showchanged and tree != printedtree):
2173 if opts['show_stage'] or n != 'parsed':
2192 if opts['show_stage'] or n != 'parsed':
2174 ui.write(("* %s:\n") % n)
2193 ui.write(("* %s:\n") % n)
2175 ui.write(revsetlang.prettyformat(tree), "\n")
2194 ui.write(revsetlang.prettyformat(tree), "\n")
2176 printedtree = tree
2195 printedtree = tree
2177
2196
2178 if opts['verify_optimized']:
2197 if opts['verify_optimized']:
2179 arevs = revset.makematcher(treebystage['analyzed'])(repo)
2198 arevs = revset.makematcher(treebystage['analyzed'])(repo)
2180 brevs = revset.makematcher(treebystage['optimized'])(repo)
2199 brevs = revset.makematcher(treebystage['optimized'])(repo)
2181 if opts['show_set'] or (opts['show_set'] is None and ui.verbose):
2200 if opts['show_set'] or (opts['show_set'] is None and ui.verbose):
2182 ui.write(("* analyzed set:\n"), smartset.prettyformat(arevs), "\n")
2201 ui.write(("* analyzed set:\n"), smartset.prettyformat(arevs), "\n")
2183 ui.write(("* optimized set:\n"), smartset.prettyformat(brevs), "\n")
2202 ui.write(("* optimized set:\n"), smartset.prettyformat(brevs), "\n")
2184 arevs = list(arevs)
2203 arevs = list(arevs)
2185 brevs = list(brevs)
2204 brevs = list(brevs)
2186 if arevs == brevs:
2205 if arevs == brevs:
2187 return 0
2206 return 0
2188 ui.write(('--- analyzed\n'), label='diff.file_a')
2207 ui.write(('--- analyzed\n'), label='diff.file_a')
2189 ui.write(('+++ optimized\n'), label='diff.file_b')
2208 ui.write(('+++ optimized\n'), label='diff.file_b')
2190 sm = difflib.SequenceMatcher(None, arevs, brevs)
2209 sm = difflib.SequenceMatcher(None, arevs, brevs)
2191 for tag, alo, ahi, blo, bhi in sm.get_opcodes():
2210 for tag, alo, ahi, blo, bhi in sm.get_opcodes():
2192 if tag in ('delete', 'replace'):
2211 if tag in ('delete', 'replace'):
2193 for c in arevs[alo:ahi]:
2212 for c in arevs[alo:ahi]:
2194 ui.write('-%s\n' % c, label='diff.deleted')
2213 ui.write('-%s\n' % c, label='diff.deleted')
2195 if tag in ('insert', 'replace'):
2214 if tag in ('insert', 'replace'):
2196 for c in brevs[blo:bhi]:
2215 for c in brevs[blo:bhi]:
2197 ui.write('+%s\n' % c, label='diff.inserted')
2216 ui.write('+%s\n' % c, label='diff.inserted')
2198 if tag == 'equal':
2217 if tag == 'equal':
2199 for c in arevs[alo:ahi]:
2218 for c in arevs[alo:ahi]:
2200 ui.write(' %s\n' % c)
2219 ui.write(' %s\n' % c)
2201 return 1
2220 return 1
2202
2221
2203 func = revset.makematcher(tree)
2222 func = revset.makematcher(tree)
2204 revs = func(repo)
2223 revs = func(repo)
2205 if opts['show_set'] or (opts['show_set'] is None and ui.verbose):
2224 if opts['show_set'] or (opts['show_set'] is None and ui.verbose):
2206 ui.write(("* set:\n"), smartset.prettyformat(revs), "\n")
2225 ui.write(("* set:\n"), smartset.prettyformat(revs), "\n")
2207 if not opts['show_revs']:
2226 if not opts['show_revs']:
2208 return
2227 return
2209 for c in revs:
2228 for c in revs:
2210 ui.write("%d\n" % c)
2229 ui.write("%d\n" % c)
2211
2230
2212 @command('debugsetparents', [], _('REV1 [REV2]'))
2231 @command('debugsetparents', [], _('REV1 [REV2]'))
2213 def debugsetparents(ui, repo, rev1, rev2=None):
2232 def debugsetparents(ui, repo, rev1, rev2=None):
2214 """manually set the parents of the current working directory
2233 """manually set the parents of the current working directory
2215
2234
2216 This is useful for writing repository conversion tools, but should
2235 This is useful for writing repository conversion tools, but should
2217 be used with care. For example, neither the working directory nor the
2236 be used with care. For example, neither the working directory nor the
2218 dirstate is updated, so file status may be incorrect after running this
2237 dirstate is updated, so file status may be incorrect after running this
2219 command.
2238 command.
2220
2239
2221 Returns 0 on success.
2240 Returns 0 on success.
2222 """
2241 """
2223
2242
2224 r1 = scmutil.revsingle(repo, rev1).node()
2243 r1 = scmutil.revsingle(repo, rev1).node()
2225 r2 = scmutil.revsingle(repo, rev2, 'null').node()
2244 r2 = scmutil.revsingle(repo, rev2, 'null').node()
2226
2245
2227 with repo.wlock():
2246 with repo.wlock():
2228 repo.setparents(r1, r2)
2247 repo.setparents(r1, r2)
2229
2248
2230 @command('debugssl', [], '[SOURCE]', optionalrepo=True)
2249 @command('debugssl', [], '[SOURCE]', optionalrepo=True)
2231 def debugssl(ui, repo, source=None, **opts):
2250 def debugssl(ui, repo, source=None, **opts):
2232 '''test a secure connection to a server
2251 '''test a secure connection to a server
2233
2252
2234 This builds the certificate chain for the server on Windows, installing the
2253 This builds the certificate chain for the server on Windows, installing the
2235 missing intermediates and trusted root via Windows Update if necessary. It
2254 missing intermediates and trusted root via Windows Update if necessary. It
2236 does nothing on other platforms.
2255 does nothing on other platforms.
2237
2256
2238 If SOURCE is omitted, the 'default' path will be used. If a URL is given,
2257 If SOURCE is omitted, the 'default' path will be used. If a URL is given,
2239 that server is used. See :hg:`help urls` for more information.
2258 that server is used. See :hg:`help urls` for more information.
2240
2259
2241 If the update succeeds, retry the original operation. Otherwise, the cause
2260 If the update succeeds, retry the original operation. Otherwise, the cause
2242 of the SSL error is likely another issue.
2261 of the SSL error is likely another issue.
2243 '''
2262 '''
2244 if not pycompat.iswindows:
2263 if not pycompat.iswindows:
2245 raise error.Abort(_('certificate chain building is only possible on '
2264 raise error.Abort(_('certificate chain building is only possible on '
2246 'Windows'))
2265 'Windows'))
2247
2266
2248 if not source:
2267 if not source:
2249 if not repo:
2268 if not repo:
2250 raise error.Abort(_("there is no Mercurial repository here, and no "
2269 raise error.Abort(_("there is no Mercurial repository here, and no "
2251 "server specified"))
2270 "server specified"))
2252 source = "default"
2271 source = "default"
2253
2272
2254 source, branches = hg.parseurl(ui.expandpath(source))
2273 source, branches = hg.parseurl(ui.expandpath(source))
2255 url = util.url(source)
2274 url = util.url(source)
2256 addr = None
2275 addr = None
2257
2276
2258 defaultport = {'https': 443, 'ssh': 22}
2277 defaultport = {'https': 443, 'ssh': 22}
2259 if url.scheme in defaultport:
2278 if url.scheme in defaultport:
2260 try:
2279 try:
2261 addr = (url.host, int(url.port or defaultport[url.scheme]))
2280 addr = (url.host, int(url.port or defaultport[url.scheme]))
2262 except ValueError:
2281 except ValueError:
2263 raise error.Abort(_("malformed port number in URL"))
2282 raise error.Abort(_("malformed port number in URL"))
2264 else:
2283 else:
2265 raise error.Abort(_("only https and ssh connections are supported"))
2284 raise error.Abort(_("only https and ssh connections are supported"))
2266
2285
2267 from . import win32
2286 from . import win32
2268
2287
2269 s = ssl.wrap_socket(socket.socket(), ssl_version=ssl.PROTOCOL_TLS,
2288 s = ssl.wrap_socket(socket.socket(), ssl_version=ssl.PROTOCOL_TLS,
2270 cert_reqs=ssl.CERT_NONE, ca_certs=None)
2289 cert_reqs=ssl.CERT_NONE, ca_certs=None)
2271
2290
2272 try:
2291 try:
2273 s.connect(addr)
2292 s.connect(addr)
2274 cert = s.getpeercert(True)
2293 cert = s.getpeercert(True)
2275
2294
2276 ui.status(_('checking the certificate chain for %s\n') % url.host)
2295 ui.status(_('checking the certificate chain for %s\n') % url.host)
2277
2296
2278 complete = win32.checkcertificatechain(cert, build=False)
2297 complete = win32.checkcertificatechain(cert, build=False)
2279
2298
2280 if not complete:
2299 if not complete:
2281 ui.status(_('certificate chain is incomplete, updating... '))
2300 ui.status(_('certificate chain is incomplete, updating... '))
2282
2301
2283 if not win32.checkcertificatechain(cert):
2302 if not win32.checkcertificatechain(cert):
2284 ui.status(_('failed.\n'))
2303 ui.status(_('failed.\n'))
2285 else:
2304 else:
2286 ui.status(_('done.\n'))
2305 ui.status(_('done.\n'))
2287 else:
2306 else:
2288 ui.status(_('full certificate chain is available\n'))
2307 ui.status(_('full certificate chain is available\n'))
2289 finally:
2308 finally:
2290 s.close()
2309 s.close()
2291
2310
2292 @command('debugsub',
2311 @command('debugsub',
2293 [('r', 'rev', '',
2312 [('r', 'rev', '',
2294 _('revision to check'), _('REV'))],
2313 _('revision to check'), _('REV'))],
2295 _('[-r REV] [REV]'))
2314 _('[-r REV] [REV]'))
2296 def debugsub(ui, repo, rev=None):
2315 def debugsub(ui, repo, rev=None):
2297 ctx = scmutil.revsingle(repo, rev, None)
2316 ctx = scmutil.revsingle(repo, rev, None)
2298 for k, v in sorted(ctx.substate.items()):
2317 for k, v in sorted(ctx.substate.items()):
2299 ui.write(('path %s\n') % k)
2318 ui.write(('path %s\n') % k)
2300 ui.write((' source %s\n') % v[0])
2319 ui.write((' source %s\n') % v[0])
2301 ui.write((' revision %s\n') % v[1])
2320 ui.write((' revision %s\n') % v[1])
2302
2321
2303 @command('debugsuccessorssets',
2322 @command('debugsuccessorssets',
2304 [('', 'closest', False, _('return closest successors sets only'))],
2323 [('', 'closest', False, _('return closest successors sets only'))],
2305 _('[REV]'))
2324 _('[REV]'))
2306 def debugsuccessorssets(ui, repo, *revs, **opts):
2325 def debugsuccessorssets(ui, repo, *revs, **opts):
2307 """show set of successors for revision
2326 """show set of successors for revision
2308
2327
2309 A successors set of changeset A is a consistent group of revisions that
2328 A successors set of changeset A is a consistent group of revisions that
2310 succeed A. It contains non-obsolete changesets only unless closests
2329 succeed A. It contains non-obsolete changesets only unless closests
2311 successors set is set.
2330 successors set is set.
2312
2331
2313 In most cases a changeset A has a single successors set containing a single
2332 In most cases a changeset A has a single successors set containing a single
2314 successor (changeset A replaced by A').
2333 successor (changeset A replaced by A').
2315
2334
2316 A changeset that is made obsolete with no successors are called "pruned".
2335 A changeset that is made obsolete with no successors are called "pruned".
2317 Such changesets have no successors sets at all.
2336 Such changesets have no successors sets at all.
2318
2337
2319 A changeset that has been "split" will have a successors set containing
2338 A changeset that has been "split" will have a successors set containing
2320 more than one successor.
2339 more than one successor.
2321
2340
2322 A changeset that has been rewritten in multiple different ways is called
2341 A changeset that has been rewritten in multiple different ways is called
2323 "divergent". Such changesets have multiple successor sets (each of which
2342 "divergent". Such changesets have multiple successor sets (each of which
2324 may also be split, i.e. have multiple successors).
2343 may also be split, i.e. have multiple successors).
2325
2344
2326 Results are displayed as follows::
2345 Results are displayed as follows::
2327
2346
2328 <rev1>
2347 <rev1>
2329 <successors-1A>
2348 <successors-1A>
2330 <rev2>
2349 <rev2>
2331 <successors-2A>
2350 <successors-2A>
2332 <successors-2B1> <successors-2B2> <successors-2B3>
2351 <successors-2B1> <successors-2B2> <successors-2B3>
2333
2352
2334 Here rev2 has two possible (i.e. divergent) successors sets. The first
2353 Here rev2 has two possible (i.e. divergent) successors sets. The first
2335 holds one element, whereas the second holds three (i.e. the changeset has
2354 holds one element, whereas the second holds three (i.e. the changeset has
2336 been split).
2355 been split).
2337 """
2356 """
2338 # passed to successorssets caching computation from one call to another
2357 # passed to successorssets caching computation from one call to another
2339 cache = {}
2358 cache = {}
2340 ctx2str = str
2359 ctx2str = str
2341 node2str = short
2360 node2str = short
2342 for rev in scmutil.revrange(repo, revs):
2361 for rev in scmutil.revrange(repo, revs):
2343 ctx = repo[rev]
2362 ctx = repo[rev]
2344 ui.write('%s\n'% ctx2str(ctx))
2363 ui.write('%s\n'% ctx2str(ctx))
2345 for succsset in obsutil.successorssets(repo, ctx.node(),
2364 for succsset in obsutil.successorssets(repo, ctx.node(),
2346 closest=opts[r'closest'],
2365 closest=opts[r'closest'],
2347 cache=cache):
2366 cache=cache):
2348 if succsset:
2367 if succsset:
2349 ui.write(' ')
2368 ui.write(' ')
2350 ui.write(node2str(succsset[0]))
2369 ui.write(node2str(succsset[0]))
2351 for node in succsset[1:]:
2370 for node in succsset[1:]:
2352 ui.write(' ')
2371 ui.write(' ')
2353 ui.write(node2str(node))
2372 ui.write(node2str(node))
2354 ui.write('\n')
2373 ui.write('\n')
2355
2374
2356 @command('debugtemplate',
2375 @command('debugtemplate',
2357 [('r', 'rev', [], _('apply template on changesets'), _('REV')),
2376 [('r', 'rev', [], _('apply template on changesets'), _('REV')),
2358 ('D', 'define', [], _('define template keyword'), _('KEY=VALUE'))],
2377 ('D', 'define', [], _('define template keyword'), _('KEY=VALUE'))],
2359 _('[-r REV]... [-D KEY=VALUE]... TEMPLATE'),
2378 _('[-r REV]... [-D KEY=VALUE]... TEMPLATE'),
2360 optionalrepo=True)
2379 optionalrepo=True)
2361 def debugtemplate(ui, repo, tmpl, **opts):
2380 def debugtemplate(ui, repo, tmpl, **opts):
2362 """parse and apply a template
2381 """parse and apply a template
2363
2382
2364 If -r/--rev is given, the template is processed as a log template and
2383 If -r/--rev is given, the template is processed as a log template and
2365 applied to the given changesets. Otherwise, it is processed as a generic
2384 applied to the given changesets. Otherwise, it is processed as a generic
2366 template.
2385 template.
2367
2386
2368 Use --verbose to print the parsed tree.
2387 Use --verbose to print the parsed tree.
2369 """
2388 """
2370 revs = None
2389 revs = None
2371 if opts[r'rev']:
2390 if opts[r'rev']:
2372 if repo is None:
2391 if repo is None:
2373 raise error.RepoError(_('there is no Mercurial repository here '
2392 raise error.RepoError(_('there is no Mercurial repository here '
2374 '(.hg not found)'))
2393 '(.hg not found)'))
2375 revs = scmutil.revrange(repo, opts[r'rev'])
2394 revs = scmutil.revrange(repo, opts[r'rev'])
2376
2395
2377 props = {}
2396 props = {}
2378 for d in opts[r'define']:
2397 for d in opts[r'define']:
2379 try:
2398 try:
2380 k, v = (e.strip() for e in d.split('=', 1))
2399 k, v = (e.strip() for e in d.split('=', 1))
2381 if not k or k == 'ui':
2400 if not k or k == 'ui':
2382 raise ValueError
2401 raise ValueError
2383 props[k] = v
2402 props[k] = v
2384 except ValueError:
2403 except ValueError:
2385 raise error.Abort(_('malformed keyword definition: %s') % d)
2404 raise error.Abort(_('malformed keyword definition: %s') % d)
2386
2405
2387 if ui.verbose:
2406 if ui.verbose:
2388 aliases = ui.configitems('templatealias')
2407 aliases = ui.configitems('templatealias')
2389 tree = templater.parse(tmpl)
2408 tree = templater.parse(tmpl)
2390 ui.note(templater.prettyformat(tree), '\n')
2409 ui.note(templater.prettyformat(tree), '\n')
2391 newtree = templater.expandaliases(tree, aliases)
2410 newtree = templater.expandaliases(tree, aliases)
2392 if newtree != tree:
2411 if newtree != tree:
2393 ui.note(("* expanded:\n"), templater.prettyformat(newtree), '\n')
2412 ui.note(("* expanded:\n"), templater.prettyformat(newtree), '\n')
2394
2413
2395 if revs is None:
2414 if revs is None:
2396 tres = formatter.templateresources(ui, repo)
2415 tres = formatter.templateresources(ui, repo)
2397 t = formatter.maketemplater(ui, tmpl, resources=tres)
2416 t = formatter.maketemplater(ui, tmpl, resources=tres)
2398 ui.write(t.render(props))
2417 ui.write(t.render(props))
2399 else:
2418 else:
2400 displayer = logcmdutil.maketemplater(ui, repo, tmpl)
2419 displayer = logcmdutil.maketemplater(ui, repo, tmpl)
2401 for r in revs:
2420 for r in revs:
2402 displayer.show(repo[r], **pycompat.strkwargs(props))
2421 displayer.show(repo[r], **pycompat.strkwargs(props))
2403 displayer.close()
2422 displayer.close()
2404
2423
2405 @command('debugupdatecaches', [])
2424 @command('debugupdatecaches', [])
2406 def debugupdatecaches(ui, repo, *pats, **opts):
2425 def debugupdatecaches(ui, repo, *pats, **opts):
2407 """warm all known caches in the repository"""
2426 """warm all known caches in the repository"""
2408 with repo.wlock(), repo.lock():
2427 with repo.wlock(), repo.lock():
2409 repo.updatecaches()
2428 repo.updatecaches()
2410
2429
2411 @command('debugupgraderepo', [
2430 @command('debugupgraderepo', [
2412 ('o', 'optimize', [], _('extra optimization to perform'), _('NAME')),
2431 ('o', 'optimize', [], _('extra optimization to perform'), _('NAME')),
2413 ('', 'run', False, _('performs an upgrade')),
2432 ('', 'run', False, _('performs an upgrade')),
2414 ])
2433 ])
2415 def debugupgraderepo(ui, repo, run=False, optimize=None):
2434 def debugupgraderepo(ui, repo, run=False, optimize=None):
2416 """upgrade a repository to use different features
2435 """upgrade a repository to use different features
2417
2436
2418 If no arguments are specified, the repository is evaluated for upgrade
2437 If no arguments are specified, the repository is evaluated for upgrade
2419 and a list of problems and potential optimizations is printed.
2438 and a list of problems and potential optimizations is printed.
2420
2439
2421 With ``--run``, a repository upgrade is performed. Behavior of the upgrade
2440 With ``--run``, a repository upgrade is performed. Behavior of the upgrade
2422 can be influenced via additional arguments. More details will be provided
2441 can be influenced via additional arguments. More details will be provided
2423 by the command output when run without ``--run``.
2442 by the command output when run without ``--run``.
2424
2443
2425 During the upgrade, the repository will be locked and no writes will be
2444 During the upgrade, the repository will be locked and no writes will be
2426 allowed.
2445 allowed.
2427
2446
2428 At the end of the upgrade, the repository may not be readable while new
2447 At the end of the upgrade, the repository may not be readable while new
2429 repository data is swapped in. This window will be as long as it takes to
2448 repository data is swapped in. This window will be as long as it takes to
2430 rename some directories inside the ``.hg`` directory. On most machines, this
2449 rename some directories inside the ``.hg`` directory. On most machines, this
2431 should complete almost instantaneously and the chances of a consumer being
2450 should complete almost instantaneously and the chances of a consumer being
2432 unable to access the repository should be low.
2451 unable to access the repository should be low.
2433 """
2452 """
2434 return upgrade.upgraderepo(ui, repo, run=run, optimize=optimize)
2453 return upgrade.upgraderepo(ui, repo, run=run, optimize=optimize)
2435
2454
2436 @command('debugwalk', cmdutil.walkopts, _('[OPTION]... [FILE]...'),
2455 @command('debugwalk', cmdutil.walkopts, _('[OPTION]... [FILE]...'),
2437 inferrepo=True)
2456 inferrepo=True)
2438 def debugwalk(ui, repo, *pats, **opts):
2457 def debugwalk(ui, repo, *pats, **opts):
2439 """show how files match on given patterns"""
2458 """show how files match on given patterns"""
2440 opts = pycompat.byteskwargs(opts)
2459 opts = pycompat.byteskwargs(opts)
2441 m = scmutil.match(repo[None], pats, opts)
2460 m = scmutil.match(repo[None], pats, opts)
2442 ui.write(('matcher: %r\n' % m))
2461 ui.write(('matcher: %r\n' % m))
2443 items = list(repo[None].walk(m))
2462 items = list(repo[None].walk(m))
2444 if not items:
2463 if not items:
2445 return
2464 return
2446 f = lambda fn: fn
2465 f = lambda fn: fn
2447 if ui.configbool('ui', 'slash') and pycompat.ossep != '/':
2466 if ui.configbool('ui', 'slash') and pycompat.ossep != '/':
2448 f = lambda fn: util.normpath(fn)
2467 f = lambda fn: util.normpath(fn)
2449 fmt = 'f %%-%ds %%-%ds %%s' % (
2468 fmt = 'f %%-%ds %%-%ds %%s' % (
2450 max([len(abs) for abs in items]),
2469 max([len(abs) for abs in items]),
2451 max([len(m.rel(abs)) for abs in items]))
2470 max([len(m.rel(abs)) for abs in items]))
2452 for abs in items:
2471 for abs in items:
2453 line = fmt % (abs, f(m.rel(abs)), m.exact(abs) and 'exact' or '')
2472 line = fmt % (abs, f(m.rel(abs)), m.exact(abs) and 'exact' or '')
2454 ui.write("%s\n" % line.rstrip())
2473 ui.write("%s\n" % line.rstrip())
2455
2474
2456 @command('debugwireargs',
2475 @command('debugwireargs',
2457 [('', 'three', '', 'three'),
2476 [('', 'three', '', 'three'),
2458 ('', 'four', '', 'four'),
2477 ('', 'four', '', 'four'),
2459 ('', 'five', '', 'five'),
2478 ('', 'five', '', 'five'),
2460 ] + cmdutil.remoteopts,
2479 ] + cmdutil.remoteopts,
2461 _('REPO [OPTIONS]... [ONE [TWO]]'),
2480 _('REPO [OPTIONS]... [ONE [TWO]]'),
2462 norepo=True)
2481 norepo=True)
2463 def debugwireargs(ui, repopath, *vals, **opts):
2482 def debugwireargs(ui, repopath, *vals, **opts):
2464 opts = pycompat.byteskwargs(opts)
2483 opts = pycompat.byteskwargs(opts)
2465 repo = hg.peer(ui, opts, repopath)
2484 repo = hg.peer(ui, opts, repopath)
2466 for opt in cmdutil.remoteopts:
2485 for opt in cmdutil.remoteopts:
2467 del opts[opt[1]]
2486 del opts[opt[1]]
2468 args = {}
2487 args = {}
2469 for k, v in opts.iteritems():
2488 for k, v in opts.iteritems():
2470 if v:
2489 if v:
2471 args[k] = v
2490 args[k] = v
2472 args = pycompat.strkwargs(args)
2491 args = pycompat.strkwargs(args)
2473 # run twice to check that we don't mess up the stream for the next command
2492 # run twice to check that we don't mess up the stream for the next command
2474 res1 = repo.debugwireargs(*vals, **args)
2493 res1 = repo.debugwireargs(*vals, **args)
2475 res2 = repo.debugwireargs(*vals, **args)
2494 res2 = repo.debugwireargs(*vals, **args)
2476 ui.write("%s\n" % res1)
2495 ui.write("%s\n" % res1)
2477 if res1 != res2:
2496 if res1 != res2:
2478 ui.warn("%s\n" % res2)
2497 ui.warn("%s\n" % res2)
@@ -1,389 +1,391 b''
1 Show all commands except debug commands
1 Show all commands except debug commands
2 $ hg debugcomplete
2 $ hg debugcomplete
3 add
3 add
4 addremove
4 addremove
5 annotate
5 annotate
6 archive
6 archive
7 backout
7 backout
8 bisect
8 bisect
9 bookmarks
9 bookmarks
10 branch
10 branch
11 branches
11 branches
12 bundle
12 bundle
13 cat
13 cat
14 clone
14 clone
15 commit
15 commit
16 config
16 config
17 copy
17 copy
18 diff
18 diff
19 export
19 export
20 files
20 files
21 forget
21 forget
22 graft
22 graft
23 grep
23 grep
24 heads
24 heads
25 help
25 help
26 identify
26 identify
27 import
27 import
28 incoming
28 incoming
29 init
29 init
30 locate
30 locate
31 log
31 log
32 manifest
32 manifest
33 merge
33 merge
34 outgoing
34 outgoing
35 parents
35 parents
36 paths
36 paths
37 phase
37 phase
38 pull
38 pull
39 push
39 push
40 recover
40 recover
41 remove
41 remove
42 rename
42 rename
43 resolve
43 resolve
44 revert
44 revert
45 rollback
45 rollback
46 root
46 root
47 serve
47 serve
48 status
48 status
49 summary
49 summary
50 tag
50 tag
51 tags
51 tags
52 tip
52 tip
53 unbundle
53 unbundle
54 update
54 update
55 verify
55 verify
56 version
56 version
57
57
58 Show all commands that start with "a"
58 Show all commands that start with "a"
59 $ hg debugcomplete a
59 $ hg debugcomplete a
60 add
60 add
61 addremove
61 addremove
62 annotate
62 annotate
63 archive
63 archive
64
64
65 Do not show debug commands if there are other candidates
65 Do not show debug commands if there are other candidates
66 $ hg debugcomplete d
66 $ hg debugcomplete d
67 diff
67 diff
68
68
69 Show debug commands if there are no other candidates
69 Show debug commands if there are no other candidates
70 $ hg debugcomplete debug
70 $ hg debugcomplete debug
71 debugancestor
71 debugancestor
72 debugapplystreamclonebundle
72 debugapplystreamclonebundle
73 debugbuilddag
73 debugbuilddag
74 debugbundle
74 debugbundle
75 debugcapabilities
75 debugcapabilities
76 debugcheckstate
76 debugcheckstate
77 debugcolor
77 debugcolor
78 debugcommands
78 debugcommands
79 debugcomplete
79 debugcomplete
80 debugconfig
80 debugconfig
81 debugcreatestreamclonebundle
81 debugcreatestreamclonebundle
82 debugdag
82 debugdag
83 debugdata
83 debugdata
84 debugdate
84 debugdate
85 debugdeltachain
85 debugdeltachain
86 debugdirstate
86 debugdirstate
87 debugdiscovery
87 debugdiscovery
88 debugdownload
88 debugdownload
89 debugextensions
89 debugextensions
90 debugfileset
90 debugfileset
91 debugformat
91 debugformat
92 debugfsinfo
92 debugfsinfo
93 debuggetbundle
93 debuggetbundle
94 debugignore
94 debugignore
95 debugindex
95 debugindex
96 debugindexdot
96 debugindexdot
97 debuginstall
97 debuginstall
98 debugknown
98 debugknown
99 debuglabelcomplete
99 debuglabelcomplete
100 debuglocks
100 debuglocks
101 debugmergestate
101 debugmergestate
102 debugnamecomplete
102 debugnamecomplete
103 debugobsolete
103 debugobsolete
104 debugpathcomplete
104 debugpathcomplete
105 debugpeer
105 debugpickmergetool
106 debugpickmergetool
106 debugpushkey
107 debugpushkey
107 debugpvec
108 debugpvec
108 debugrebuilddirstate
109 debugrebuilddirstate
109 debugrebuildfncache
110 debugrebuildfncache
110 debugrename
111 debugrename
111 debugrevlog
112 debugrevlog
112 debugrevspec
113 debugrevspec
113 debugsetparents
114 debugsetparents
114 debugssl
115 debugssl
115 debugsub
116 debugsub
116 debugsuccessorssets
117 debugsuccessorssets
117 debugtemplate
118 debugtemplate
118 debugupdatecaches
119 debugupdatecaches
119 debugupgraderepo
120 debugupgraderepo
120 debugwalk
121 debugwalk
121 debugwireargs
122 debugwireargs
122
123
123 Do not show the alias of a debug command if there are other candidates
124 Do not show the alias of a debug command if there are other candidates
124 (this should hide rawcommit)
125 (this should hide rawcommit)
125 $ hg debugcomplete r
126 $ hg debugcomplete r
126 recover
127 recover
127 remove
128 remove
128 rename
129 rename
129 resolve
130 resolve
130 revert
131 revert
131 rollback
132 rollback
132 root
133 root
133 Show the alias of a debug command if there are no other candidates
134 Show the alias of a debug command if there are no other candidates
134 $ hg debugcomplete rawc
135 $ hg debugcomplete rawc
135
136
136
137
137 Show the global options
138 Show the global options
138 $ hg debugcomplete --options | sort
139 $ hg debugcomplete --options | sort
139 --color
140 --color
140 --config
141 --config
141 --cwd
142 --cwd
142 --debug
143 --debug
143 --debugger
144 --debugger
144 --encoding
145 --encoding
145 --encodingmode
146 --encodingmode
146 --help
147 --help
147 --hidden
148 --hidden
148 --noninteractive
149 --noninteractive
149 --pager
150 --pager
150 --profile
151 --profile
151 --quiet
152 --quiet
152 --repository
153 --repository
153 --time
154 --time
154 --traceback
155 --traceback
155 --verbose
156 --verbose
156 --version
157 --version
157 -R
158 -R
158 -h
159 -h
159 -q
160 -q
160 -v
161 -v
161 -y
162 -y
162
163
163 Show the options for the "serve" command
164 Show the options for the "serve" command
164 $ hg debugcomplete --options serve | sort
165 $ hg debugcomplete --options serve | sort
165 --accesslog
166 --accesslog
166 --address
167 --address
167 --certificate
168 --certificate
168 --cmdserver
169 --cmdserver
169 --color
170 --color
170 --config
171 --config
171 --cwd
172 --cwd
172 --daemon
173 --daemon
173 --daemon-postexec
174 --daemon-postexec
174 --debug
175 --debug
175 --debugger
176 --debugger
176 --encoding
177 --encoding
177 --encodingmode
178 --encodingmode
178 --errorlog
179 --errorlog
179 --help
180 --help
180 --hidden
181 --hidden
181 --ipv6
182 --ipv6
182 --name
183 --name
183 --noninteractive
184 --noninteractive
184 --pager
185 --pager
185 --pid-file
186 --pid-file
186 --port
187 --port
187 --prefix
188 --prefix
188 --profile
189 --profile
189 --quiet
190 --quiet
190 --repository
191 --repository
191 --stdio
192 --stdio
192 --style
193 --style
193 --subrepos
194 --subrepos
194 --templates
195 --templates
195 --time
196 --time
196 --traceback
197 --traceback
197 --verbose
198 --verbose
198 --version
199 --version
199 --web-conf
200 --web-conf
200 -6
201 -6
201 -A
202 -A
202 -E
203 -E
203 -R
204 -R
204 -S
205 -S
205 -a
206 -a
206 -d
207 -d
207 -h
208 -h
208 -n
209 -n
209 -p
210 -p
210 -q
211 -q
211 -t
212 -t
212 -v
213 -v
213 -y
214 -y
214
215
215 Show an error if we use --options with an ambiguous abbreviation
216 Show an error if we use --options with an ambiguous abbreviation
216 $ hg debugcomplete --options s
217 $ hg debugcomplete --options s
217 hg: command 's' is ambiguous:
218 hg: command 's' is ambiguous:
218 serve showconfig status summary
219 serve showconfig status summary
219 [255]
220 [255]
220
221
221 Show all commands + options
222 Show all commands + options
222 $ hg debugcommands
223 $ hg debugcommands
223 add: include, exclude, subrepos, dry-run
224 add: include, exclude, subrepos, dry-run
224 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
225 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
225 clone: noupdate, updaterev, rev, branch, pull, uncompressed, stream, ssh, remotecmd, insecure
226 clone: noupdate, updaterev, rev, branch, pull, uncompressed, stream, ssh, remotecmd, insecure
226 commit: addremove, close-branch, amend, secret, edit, interactive, include, exclude, message, logfile, date, user, subrepos
227 commit: addremove, close-branch, amend, secret, edit, interactive, include, exclude, message, logfile, date, user, subrepos
227 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
228 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
228 export: output, switch-parent, rev, text, git, binary, nodates
229 export: output, switch-parent, rev, text, git, binary, nodates
229 forget: include, exclude
230 forget: include, exclude
230 init: ssh, remotecmd, insecure
231 init: ssh, remotecmd, insecure
231 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
232 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
232 merge: force, rev, preview, abort, tool
233 merge: force, rev, preview, abort, tool
233 pull: update, force, rev, bookmark, branch, ssh, remotecmd, insecure
234 pull: update, force, rev, bookmark, branch, ssh, remotecmd, insecure
234 push: force, rev, bookmark, branch, new-branch, pushvars, ssh, remotecmd, insecure
235 push: force, rev, bookmark, branch, new-branch, pushvars, ssh, remotecmd, insecure
235 remove: after, force, subrepos, include, exclude
236 remove: after, force, subrepos, include, exclude
236 serve: accesslog, daemon, daemon-postexec, errorlog, port, address, prefix, name, web-conf, webdir-conf, pid-file, stdio, cmdserver, templates, style, ipv6, certificate, subrepos
237 serve: accesslog, daemon, daemon-postexec, errorlog, port, address, prefix, name, web-conf, webdir-conf, pid-file, stdio, cmdserver, templates, style, ipv6, certificate, subrepos
237 status: all, modified, added, removed, deleted, clean, unknown, ignored, no-status, terse, copies, print0, rev, change, include, exclude, subrepos, template
238 status: all, modified, added, removed, deleted, clean, unknown, ignored, no-status, terse, copies, print0, rev, change, include, exclude, subrepos, template
238 summary: remote
239 summary: remote
239 update: clean, check, merge, date, rev, tool
240 update: clean, check, merge, date, rev, tool
240 addremove: similarity, subrepos, include, exclude, dry-run
241 addremove: similarity, subrepos, include, exclude, dry-run
241 archive: no-decode, prefix, rev, type, subrepos, include, exclude
242 archive: no-decode, prefix, rev, type, subrepos, include, exclude
242 backout: merge, commit, no-commit, parent, rev, edit, tool, include, exclude, message, logfile, date, user
243 backout: merge, commit, no-commit, parent, rev, edit, tool, include, exclude, message, logfile, date, user
243 bisect: reset, good, bad, skip, extend, command, noupdate
244 bisect: reset, good, bad, skip, extend, command, noupdate
244 bookmarks: force, rev, delete, rename, inactive, template
245 bookmarks: force, rev, delete, rename, inactive, template
245 branch: force, clean, rev
246 branch: force, clean, rev
246 branches: active, closed, template
247 branches: active, closed, template
247 bundle: force, rev, branch, base, all, type, ssh, remotecmd, insecure
248 bundle: force, rev, branch, base, all, type, ssh, remotecmd, insecure
248 cat: output, rev, decode, include, exclude, template
249 cat: output, rev, decode, include, exclude, template
249 config: untrusted, edit, local, global, template
250 config: untrusted, edit, local, global, template
250 copy: after, force, include, exclude, dry-run
251 copy: after, force, include, exclude, dry-run
251 debugancestor:
252 debugancestor:
252 debugapplystreamclonebundle:
253 debugapplystreamclonebundle:
253 debugbuilddag: mergeable-file, overwritten-file, new-file
254 debugbuilddag: mergeable-file, overwritten-file, new-file
254 debugbundle: all, part-type, spec
255 debugbundle: all, part-type, spec
255 debugcapabilities:
256 debugcapabilities:
256 debugcheckstate:
257 debugcheckstate:
257 debugcolor: style
258 debugcolor: style
258 debugcommands:
259 debugcommands:
259 debugcomplete: options
260 debugcomplete: options
260 debugcreatestreamclonebundle:
261 debugcreatestreamclonebundle:
261 debugdag: tags, branches, dots, spaces
262 debugdag: tags, branches, dots, spaces
262 debugdata: changelog, manifest, dir
263 debugdata: changelog, manifest, dir
263 debugdate: extended
264 debugdate: extended
264 debugdeltachain: changelog, manifest, dir, template
265 debugdeltachain: changelog, manifest, dir, template
265 debugdirstate: nodates, datesort
266 debugdirstate: nodates, datesort
266 debugdiscovery: old, nonheads, rev, ssh, remotecmd, insecure
267 debugdiscovery: old, nonheads, rev, ssh, remotecmd, insecure
267 debugdownload: output
268 debugdownload: output
268 debugextensions: template
269 debugextensions: template
269 debugfileset: rev
270 debugfileset: rev
270 debugformat: template
271 debugformat: template
271 debugfsinfo:
272 debugfsinfo:
272 debuggetbundle: head, common, type
273 debuggetbundle: head, common, type
273 debugignore:
274 debugignore:
274 debugindex: changelog, manifest, dir, format
275 debugindex: changelog, manifest, dir, format
275 debugindexdot: changelog, manifest, dir
276 debugindexdot: changelog, manifest, dir
276 debuginstall: template
277 debuginstall: template
277 debugknown:
278 debugknown:
278 debuglabelcomplete:
279 debuglabelcomplete:
279 debuglocks: force-lock, force-wlock, set-lock, set-wlock
280 debuglocks: force-lock, force-wlock, set-lock, set-wlock
280 debugmergestate:
281 debugmergestate:
281 debugnamecomplete:
282 debugnamecomplete:
282 debugobsolete: flags, record-parents, rev, exclusive, index, delete, date, user, template
283 debugobsolete: flags, record-parents, rev, exclusive, index, delete, date, user, template
283 debugpathcomplete: full, normal, added, removed
284 debugpathcomplete: full, normal, added, removed
285 debugpeer:
284 debugpickmergetool: rev, changedelete, include, exclude, tool
286 debugpickmergetool: rev, changedelete, include, exclude, tool
285 debugpushkey:
287 debugpushkey:
286 debugpvec:
288 debugpvec:
287 debugrebuilddirstate: rev, minimal
289 debugrebuilddirstate: rev, minimal
288 debugrebuildfncache:
290 debugrebuildfncache:
289 debugrename: rev
291 debugrename: rev
290 debugrevlog: changelog, manifest, dir, dump
292 debugrevlog: changelog, manifest, dir, dump
291 debugrevspec: optimize, show-revs, show-set, show-stage, no-optimized, verify-optimized
293 debugrevspec: optimize, show-revs, show-set, show-stage, no-optimized, verify-optimized
292 debugsetparents:
294 debugsetparents:
293 debugssl:
295 debugssl:
294 debugsub: rev
296 debugsub: rev
295 debugsuccessorssets: closest
297 debugsuccessorssets: closest
296 debugtemplate: rev, define
298 debugtemplate: rev, define
297 debugupdatecaches:
299 debugupdatecaches:
298 debugupgraderepo: optimize, run
300 debugupgraderepo: optimize, run
299 debugwalk: include, exclude
301 debugwalk: include, exclude
300 debugwireargs: three, four, five, ssh, remotecmd, insecure
302 debugwireargs: three, four, five, ssh, remotecmd, insecure
301 files: rev, print0, include, exclude, template, subrepos
303 files: rev, print0, include, exclude, template, subrepos
302 graft: rev, continue, edit, log, force, currentdate, currentuser, date, user, tool, dry-run
304 graft: rev, continue, edit, log, force, currentdate, currentuser, date, user, tool, dry-run
303 grep: print0, all, text, follow, ignore-case, files-with-matches, line-number, rev, user, date, template, include, exclude
305 grep: print0, all, text, follow, ignore-case, files-with-matches, line-number, rev, user, date, template, include, exclude
304 heads: rev, topo, active, closed, style, template
306 heads: rev, topo, active, closed, style, template
305 help: extension, command, keyword, system
307 help: extension, command, keyword, system
306 identify: rev, num, id, branch, tags, bookmarks, ssh, remotecmd, insecure, template
308 identify: rev, num, id, branch, tags, bookmarks, ssh, remotecmd, insecure, template
307 import: strip, base, edit, force, no-commit, bypass, partial, exact, prefix, import-branch, message, logfile, date, user, similarity
309 import: strip, base, edit, force, no-commit, bypass, partial, exact, prefix, import-branch, message, logfile, date, user, similarity
308 incoming: force, newest-first, bundle, rev, bookmarks, branch, patch, git, limit, no-merges, stat, graph, style, template, ssh, remotecmd, insecure, subrepos
310 incoming: force, newest-first, bundle, rev, bookmarks, branch, patch, git, limit, no-merges, stat, graph, style, template, ssh, remotecmd, insecure, subrepos
309 locate: rev, print0, fullpath, include, exclude
311 locate: rev, print0, fullpath, include, exclude
310 manifest: rev, all, template
312 manifest: rev, all, template
311 outgoing: force, rev, newest-first, bookmarks, branch, patch, git, limit, no-merges, stat, graph, style, template, ssh, remotecmd, insecure, subrepos
313 outgoing: force, rev, newest-first, bookmarks, branch, patch, git, limit, no-merges, stat, graph, style, template, ssh, remotecmd, insecure, subrepos
312 parents: rev, style, template
314 parents: rev, style, template
313 paths: template
315 paths: template
314 phase: public, draft, secret, force, rev
316 phase: public, draft, secret, force, rev
315 recover:
317 recover:
316 rename: after, force, include, exclude, dry-run
318 rename: after, force, include, exclude, dry-run
317 resolve: all, list, mark, unmark, no-status, tool, include, exclude, template
319 resolve: all, list, mark, unmark, no-status, tool, include, exclude, template
318 revert: all, date, rev, no-backup, interactive, include, exclude, dry-run
320 revert: all, date, rev, no-backup, interactive, include, exclude, dry-run
319 rollback: dry-run, force
321 rollback: dry-run, force
320 root:
322 root:
321 tag: force, local, rev, remove, edit, message, date, user
323 tag: force, local, rev, remove, edit, message, date, user
322 tags: template
324 tags: template
323 tip: patch, git, style, template
325 tip: patch, git, style, template
324 unbundle: update
326 unbundle: update
325 verify:
327 verify:
326 version: template
328 version: template
327
329
328 $ hg init a
330 $ hg init a
329 $ cd a
331 $ cd a
330 $ echo fee > fee
332 $ echo fee > fee
331 $ hg ci -q -Amfee
333 $ hg ci -q -Amfee
332 $ hg tag fee
334 $ hg tag fee
333 $ mkdir fie
335 $ mkdir fie
334 $ echo dead > fie/dead
336 $ echo dead > fie/dead
335 $ echo live > fie/live
337 $ echo live > fie/live
336 $ hg bookmark fo
338 $ hg bookmark fo
337 $ hg branch -q fie
339 $ hg branch -q fie
338 $ hg ci -q -Amfie
340 $ hg ci -q -Amfie
339 $ echo fo > fo
341 $ echo fo > fo
340 $ hg branch -qf default
342 $ hg branch -qf default
341 $ hg ci -q -Amfo
343 $ hg ci -q -Amfo
342 $ echo Fum > Fum
344 $ echo Fum > Fum
343 $ hg ci -q -AmFum
345 $ hg ci -q -AmFum
344 $ hg bookmark Fum
346 $ hg bookmark Fum
345
347
346 Test debugpathcomplete
348 Test debugpathcomplete
347
349
348 $ hg debugpathcomplete f
350 $ hg debugpathcomplete f
349 fee
351 fee
350 fie
352 fie
351 fo
353 fo
352 $ hg debugpathcomplete -f f
354 $ hg debugpathcomplete -f f
353 fee
355 fee
354 fie/dead
356 fie/dead
355 fie/live
357 fie/live
356 fo
358 fo
357
359
358 $ hg rm Fum
360 $ hg rm Fum
359 $ hg debugpathcomplete -r F
361 $ hg debugpathcomplete -r F
360 Fum
362 Fum
361
363
362 Test debugnamecomplete
364 Test debugnamecomplete
363
365
364 $ hg debugnamecomplete
366 $ hg debugnamecomplete
365 Fum
367 Fum
366 default
368 default
367 fee
369 fee
368 fie
370 fie
369 fo
371 fo
370 tip
372 tip
371 $ hg debugnamecomplete f
373 $ hg debugnamecomplete f
372 fee
374 fee
373 fie
375 fie
374 fo
376 fo
375
377
376 Test debuglabelcomplete, a deprecated name for debugnamecomplete that is still
378 Test debuglabelcomplete, a deprecated name for debugnamecomplete that is still
377 used for completions in some shells.
379 used for completions in some shells.
378
380
379 $ hg debuglabelcomplete
381 $ hg debuglabelcomplete
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 debuglabelcomplete f
388 $ hg debuglabelcomplete f
387 fee
389 fee
388 fie
390 fie
389 fo
391 fo
@@ -1,383 +1,404 b''
1 $ cat << EOF >> $HGRCPATH
1 $ cat << EOF >> $HGRCPATH
2 > [ui]
2 > [ui]
3 > interactive=yes
3 > interactive=yes
4 > [format]
4 > [format]
5 > usegeneraldelta=yes
5 > usegeneraldelta=yes
6 > EOF
6 > EOF
7
7
8 $ hg init debugrevlog
8 $ hg init debugrevlog
9 $ cd debugrevlog
9 $ cd debugrevlog
10 $ echo a > a
10 $ echo a > a
11 $ hg ci -Am adda
11 $ hg ci -Am adda
12 adding a
12 adding a
13 $ hg debugrevlog -m
13 $ hg debugrevlog -m
14 format : 1
14 format : 1
15 flags : inline, generaldelta
15 flags : inline, generaldelta
16
16
17 revisions : 1
17 revisions : 1
18 merges : 0 ( 0.00%)
18 merges : 0 ( 0.00%)
19 normal : 1 (100.00%)
19 normal : 1 (100.00%)
20 revisions : 1
20 revisions : 1
21 full : 1 (100.00%)
21 full : 1 (100.00%)
22 deltas : 0 ( 0.00%)
22 deltas : 0 ( 0.00%)
23 revision size : 44
23 revision size : 44
24 full : 44 (100.00%)
24 full : 44 (100.00%)
25 deltas : 0 ( 0.00%)
25 deltas : 0 ( 0.00%)
26
26
27 chunks : 1
27 chunks : 1
28 0x75 (u) : 1 (100.00%)
28 0x75 (u) : 1 (100.00%)
29 chunks size : 44
29 chunks size : 44
30 0x75 (u) : 44 (100.00%)
30 0x75 (u) : 44 (100.00%)
31
31
32 avg chain length : 0
32 avg chain length : 0
33 max chain length : 0
33 max chain length : 0
34 max chain reach : 44
34 max chain reach : 44
35 compression ratio : 0
35 compression ratio : 0
36
36
37 uncompressed data size (min/max/avg) : 43 / 43 / 43
37 uncompressed data size (min/max/avg) : 43 / 43 / 43
38 full revision size (min/max/avg) : 44 / 44 / 44
38 full revision size (min/max/avg) : 44 / 44 / 44
39 delta size (min/max/avg) : 0 / 0 / 0
39 delta size (min/max/avg) : 0 / 0 / 0
40
40
41 Test debugindex, with and without the --debug flag
41 Test debugindex, with and without the --debug flag
42 $ hg debugindex a
42 $ hg debugindex a
43 rev offset length ..... linkrev nodeid p1 p2 (re)
43 rev offset length ..... linkrev nodeid p1 p2 (re)
44 0 0 3 .... 0 b789fdd96dc2 000000000000 000000000000 (re)
44 0 0 3 .... 0 b789fdd96dc2 000000000000 000000000000 (re)
45 $ hg --debug debugindex a
45 $ hg --debug debugindex a
46 rev offset length ..... linkrev nodeid p1 p2 (re)
46 rev offset length ..... linkrev nodeid p1 p2 (re)
47 0 0 3 .... 0 b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 (re)
47 0 0 3 .... 0 b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 (re)
48 $ hg debugindex -f 1 a
48 $ hg debugindex -f 1 a
49 rev flag offset length size ..... link p1 p2 nodeid (re)
49 rev flag offset length size ..... link p1 p2 nodeid (re)
50 0 0000 0 3 2 .... 0 -1 -1 b789fdd96dc2 (re)
50 0 0000 0 3 2 .... 0 -1 -1 b789fdd96dc2 (re)
51 $ hg --debug debugindex -f 1 a
51 $ hg --debug debugindex -f 1 a
52 rev flag offset length size ..... link p1 p2 nodeid (re)
52 rev flag offset length size ..... link p1 p2 nodeid (re)
53 0 0000 0 3 2 .... 0 -1 -1 b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 (re)
53 0 0000 0 3 2 .... 0 -1 -1 b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 (re)
54
54
55 debugdelta chain basic output
55 debugdelta chain basic output
56
56
57 $ hg debugdeltachain -m
57 $ hg debugdeltachain -m
58 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio
58 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio
59 0 1 1 -1 base 44 43 44 1.02326 44 0 0.00000
59 0 1 1 -1 base 44 43 44 1.02326 44 0 0.00000
60
60
61 $ hg debugdeltachain -m -T '{rev} {chainid} {chainlen}\n'
61 $ hg debugdeltachain -m -T '{rev} {chainid} {chainlen}\n'
62 0 1 1
62 0 1 1
63
63
64 $ hg debugdeltachain -m -Tjson
64 $ hg debugdeltachain -m -Tjson
65 [
65 [
66 {
66 {
67 "chainid": 1,
67 "chainid": 1,
68 "chainlen": 1,
68 "chainlen": 1,
69 "chainratio": 1.02325581395,
69 "chainratio": 1.02325581395,
70 "chainsize": 44,
70 "chainsize": 44,
71 "compsize": 44,
71 "compsize": 44,
72 "deltatype": "base",
72 "deltatype": "base",
73 "extradist": 0,
73 "extradist": 0,
74 "extraratio": 0.0,
74 "extraratio": 0.0,
75 "lindist": 44,
75 "lindist": 44,
76 "prevrev": -1,
76 "prevrev": -1,
77 "rev": 0,
77 "rev": 0,
78 "uncompsize": 43
78 "uncompsize": 43
79 }
79 }
80 ]
80 ]
81
81
82 debugdelta chain with sparse read enabled
82 debugdelta chain with sparse read enabled
83
83
84 $ cat >> $HGRCPATH <<EOF
84 $ cat >> $HGRCPATH <<EOF
85 > [experimental]
85 > [experimental]
86 > sparse-read = True
86 > sparse-read = True
87 > EOF
87 > EOF
88 $ hg debugdeltachain -m
88 $ hg debugdeltachain -m
89 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio readsize largestblk rddensity srchunks
89 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio readsize largestblk rddensity srchunks
90 0 1 1 -1 base 44 43 44 1.02326 44 0 0.00000 44 44 1.00000 1
90 0 1 1 -1 base 44 43 44 1.02326 44 0 0.00000 44 44 1.00000 1
91
91
92 $ hg debugdeltachain -m -T '{rev} {chainid} {chainlen} {readsize} {largestblock} {readdensity}\n'
92 $ hg debugdeltachain -m -T '{rev} {chainid} {chainlen} {readsize} {largestblock} {readdensity}\n'
93 0 1 1 44 44 1.0
93 0 1 1 44 44 1.0
94
94
95 $ hg debugdeltachain -m -Tjson
95 $ hg debugdeltachain -m -Tjson
96 [
96 [
97 {
97 {
98 "chainid": 1,
98 "chainid": 1,
99 "chainlen": 1,
99 "chainlen": 1,
100 "chainratio": 1.02325581395,
100 "chainratio": 1.02325581395,
101 "chainsize": 44,
101 "chainsize": 44,
102 "compsize": 44,
102 "compsize": 44,
103 "deltatype": "base",
103 "deltatype": "base",
104 "extradist": 0,
104 "extradist": 0,
105 "extraratio": 0.0,
105 "extraratio": 0.0,
106 "largestblock": 44,
106 "largestblock": 44,
107 "lindist": 44,
107 "lindist": 44,
108 "prevrev": -1,
108 "prevrev": -1,
109 "readdensity": 1.0,
109 "readdensity": 1.0,
110 "readsize": 44,
110 "readsize": 44,
111 "rev": 0,
111 "rev": 0,
112 "srchunks": 1,
112 "srchunks": 1,
113 "uncompsize": 43
113 "uncompsize": 43
114 }
114 }
115 ]
115 ]
116
116
117 $ printf "This test checks things.\n" >> a
117 $ printf "This test checks things.\n" >> a
118 $ hg ci -m a
118 $ hg ci -m a
119 $ hg branch other
119 $ hg branch other
120 marked working directory as branch other
120 marked working directory as branch other
121 (branches are permanent and global, did you want a bookmark?)
121 (branches are permanent and global, did you want a bookmark?)
122 $ for i in `$TESTDIR/seq.py 5`; do
122 $ for i in `$TESTDIR/seq.py 5`; do
123 > printf "shorter ${i}" >> a
123 > printf "shorter ${i}" >> a
124 > hg ci -m "a other:$i"
124 > hg ci -m "a other:$i"
125 > hg up -q default
125 > hg up -q default
126 > printf "for the branch default we want longer chains: ${i}" >> a
126 > printf "for the branch default we want longer chains: ${i}" >> a
127 > hg ci -m "a default:$i"
127 > hg ci -m "a default:$i"
128 > hg up -q other
128 > hg up -q other
129 > done
129 > done
130 $ hg debugdeltachain a -T '{rev} {srchunks}\n' \
130 $ hg debugdeltachain a -T '{rev} {srchunks}\n' \
131 > --config experimental.sparse-read.density-threshold=0.50 \
131 > --config experimental.sparse-read.density-threshold=0.50 \
132 > --config experimental.sparse-read.min-gap-size=0
132 > --config experimental.sparse-read.min-gap-size=0
133 0 1
133 0 1
134 1 1
134 1 1
135 2 1
135 2 1
136 3 1
136 3 1
137 4 1
137 4 1
138 5 1
138 5 1
139 6 1
139 6 1
140 7 1
140 7 1
141 8 1
141 8 1
142 9 1
142 9 1
143 10 2
143 10 2
144 11 1
144 11 1
145 $ hg --config extensions.strip= strip --no-backup -r 1
145 $ hg --config extensions.strip= strip --no-backup -r 1
146 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
146 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
147
147
148 Test max chain len
148 Test max chain len
149 $ cat >> $HGRCPATH << EOF
149 $ cat >> $HGRCPATH << EOF
150 > [format]
150 > [format]
151 > maxchainlen=4
151 > maxchainlen=4
152 > EOF
152 > EOF
153
153
154 $ printf "This test checks if maxchainlen config value is respected also it can serve as basic test for debugrevlog -d <file>.\n" >> a
154 $ printf "This test checks if maxchainlen config value is respected also it can serve as basic test for debugrevlog -d <file>.\n" >> a
155 $ hg ci -m a
155 $ hg ci -m a
156 $ printf "b\n" >> a
156 $ printf "b\n" >> a
157 $ hg ci -m a
157 $ hg ci -m a
158 $ printf "c\n" >> a
158 $ printf "c\n" >> a
159 $ hg ci -m a
159 $ hg ci -m a
160 $ printf "d\n" >> a
160 $ printf "d\n" >> a
161 $ hg ci -m a
161 $ hg ci -m a
162 $ printf "e\n" >> a
162 $ printf "e\n" >> a
163 $ hg ci -m a
163 $ hg ci -m a
164 $ printf "f\n" >> a
164 $ printf "f\n" >> a
165 $ hg ci -m a
165 $ hg ci -m a
166 $ printf 'g\n' >> a
166 $ printf 'g\n' >> a
167 $ hg ci -m a
167 $ hg ci -m a
168 $ printf 'h\n' >> a
168 $ printf 'h\n' >> a
169 $ hg ci -m a
169 $ hg ci -m a
170 $ hg debugrevlog -d a
170 $ hg debugrevlog -d a
171 # rev p1rev p2rev start end deltastart base p1 p2 rawsize totalsize compression heads chainlen
171 # rev p1rev p2rev start end deltastart base p1 p2 rawsize totalsize compression heads chainlen
172 0 -1 -1 0 ??? 0 0 0 0 ??? ???? ? 1 0 (glob)
172 0 -1 -1 0 ??? 0 0 0 0 ??? ???? ? 1 0 (glob)
173 1 0 -1 ??? ??? 0 0 0 0 ??? ???? ? 1 1 (glob)
173 1 0 -1 ??? ??? 0 0 0 0 ??? ???? ? 1 1 (glob)
174 2 1 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 2 (glob)
174 2 1 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 2 (glob)
175 3 2 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 3 (glob)
175 3 2 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 3 (glob)
176 4 3 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 4 (glob)
176 4 3 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 4 (glob)
177 5 4 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 0 (glob)
177 5 4 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 0 (glob)
178 6 5 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 1 (glob)
178 6 5 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 1 (glob)
179 7 6 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 2 (glob)
179 7 6 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 2 (glob)
180 8 7 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 3 (glob)
180 8 7 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 3 (glob)
181
181
182 Test debuglocks command:
182 Test debuglocks command:
183
183
184 $ hg debuglocks
184 $ hg debuglocks
185 lock: free
185 lock: free
186 wlock: free
186 wlock: free
187
187
188 * Test setting the lock
188 * Test setting the lock
189
189
190 waitlock <file> will wait for file to be created. If it isn't in a reasonable
190 waitlock <file> will wait for file to be created. If it isn't in a reasonable
191 amount of time, displays error message and returns 1
191 amount of time, displays error message and returns 1
192 $ waitlock() {
192 $ waitlock() {
193 > start=`date +%s`
193 > start=`date +%s`
194 > timeout=5
194 > timeout=5
195 > while [ \( ! -f $1 \) -a \( ! -L $1 \) ]; do
195 > while [ \( ! -f $1 \) -a \( ! -L $1 \) ]; do
196 > now=`date +%s`
196 > now=`date +%s`
197 > if [ "`expr $now - $start`" -gt $timeout ]; then
197 > if [ "`expr $now - $start`" -gt $timeout ]; then
198 > echo "timeout: $1 was not created in $timeout seconds"
198 > echo "timeout: $1 was not created in $timeout seconds"
199 > return 1
199 > return 1
200 > fi
200 > fi
201 > sleep 0.1
201 > sleep 0.1
202 > done
202 > done
203 > }
203 > }
204 $ dolock() {
204 $ dolock() {
205 > {
205 > {
206 > waitlock .hg/unlock
206 > waitlock .hg/unlock
207 > rm -f .hg/unlock
207 > rm -f .hg/unlock
208 > echo y
208 > echo y
209 > } | hg debuglocks "$@" > /dev/null
209 > } | hg debuglocks "$@" > /dev/null
210 > }
210 > }
211 $ dolock -s &
211 $ dolock -s &
212 $ waitlock .hg/store/lock
212 $ waitlock .hg/store/lock
213
213
214 $ hg debuglocks
214 $ hg debuglocks
215 lock: user *, process * (*s) (glob)
215 lock: user *, process * (*s) (glob)
216 wlock: free
216 wlock: free
217 [1]
217 [1]
218 $ touch .hg/unlock
218 $ touch .hg/unlock
219 $ wait
219 $ wait
220 $ [ -f .hg/store/lock ] || echo "There is no lock"
220 $ [ -f .hg/store/lock ] || echo "There is no lock"
221 There is no lock
221 There is no lock
222
222
223 * Test setting the wlock
223 * Test setting the wlock
224
224
225 $ dolock -S &
225 $ dolock -S &
226 $ waitlock .hg/wlock
226 $ waitlock .hg/wlock
227
227
228 $ hg debuglocks
228 $ hg debuglocks
229 lock: free
229 lock: free
230 wlock: user *, process * (*s) (glob)
230 wlock: user *, process * (*s) (glob)
231 [1]
231 [1]
232 $ touch .hg/unlock
232 $ touch .hg/unlock
233 $ wait
233 $ wait
234 $ [ -f .hg/wlock ] || echo "There is no wlock"
234 $ [ -f .hg/wlock ] || echo "There is no wlock"
235 There is no wlock
235 There is no wlock
236
236
237 * Test setting both locks
237 * Test setting both locks
238
238
239 $ dolock -Ss &
239 $ dolock -Ss &
240 $ waitlock .hg/wlock && waitlock .hg/store/lock
240 $ waitlock .hg/wlock && waitlock .hg/store/lock
241
241
242 $ hg debuglocks
242 $ hg debuglocks
243 lock: user *, process * (*s) (glob)
243 lock: user *, process * (*s) (glob)
244 wlock: user *, process * (*s) (glob)
244 wlock: user *, process * (*s) (glob)
245 [2]
245 [2]
246
246
247 * Test failing to set a lock
247 * Test failing to set a lock
248
248
249 $ hg debuglocks -s
249 $ hg debuglocks -s
250 abort: lock is already held
250 abort: lock is already held
251 [255]
251 [255]
252
252
253 $ hg debuglocks -S
253 $ hg debuglocks -S
254 abort: wlock is already held
254 abort: wlock is already held
255 [255]
255 [255]
256
256
257 $ touch .hg/unlock
257 $ touch .hg/unlock
258 $ wait
258 $ wait
259
259
260 $ hg debuglocks
260 $ hg debuglocks
261 lock: free
261 lock: free
262 wlock: free
262 wlock: free
263
263
264 * Test forcing the lock
264 * Test forcing the lock
265
265
266 $ dolock -s &
266 $ dolock -s &
267 $ waitlock .hg/store/lock
267 $ waitlock .hg/store/lock
268
268
269 $ hg debuglocks
269 $ hg debuglocks
270 lock: user *, process * (*s) (glob)
270 lock: user *, process * (*s) (glob)
271 wlock: free
271 wlock: free
272 [1]
272 [1]
273
273
274 $ hg debuglocks -L
274 $ hg debuglocks -L
275
275
276 $ hg debuglocks
276 $ hg debuglocks
277 lock: free
277 lock: free
278 wlock: free
278 wlock: free
279
279
280 $ touch .hg/unlock
280 $ touch .hg/unlock
281 $ wait
281 $ wait
282
282
283 * Test forcing the wlock
283 * Test forcing the wlock
284
284
285 $ dolock -S &
285 $ dolock -S &
286 $ waitlock .hg/wlock
286 $ waitlock .hg/wlock
287
287
288 $ hg debuglocks
288 $ hg debuglocks
289 lock: free
289 lock: free
290 wlock: user *, process * (*s) (glob)
290 wlock: user *, process * (*s) (glob)
291 [1]
291 [1]
292
292
293 $ hg debuglocks -W
293 $ hg debuglocks -W
294
294
295 $ hg debuglocks
295 $ hg debuglocks
296 lock: free
296 lock: free
297 wlock: free
297 wlock: free
298
298
299 $ touch .hg/unlock
299 $ touch .hg/unlock
300 $ wait
300 $ wait
301
301
302 Test WdirUnsupported exception
302 Test WdirUnsupported exception
303
303
304 $ hg debugdata -c ffffffffffffffffffffffffffffffffffffffff
304 $ hg debugdata -c ffffffffffffffffffffffffffffffffffffffff
305 abort: working directory revision cannot be specified
305 abort: working directory revision cannot be specified
306 [255]
306 [255]
307
307
308 Test cache warming command
308 Test cache warming command
309
309
310 $ rm -rf .hg/cache/
310 $ rm -rf .hg/cache/
311 $ hg debugupdatecaches --debug
311 $ hg debugupdatecaches --debug
312 updating the branch cache
312 updating the branch cache
313 $ ls -r .hg/cache/*
313 $ ls -r .hg/cache/*
314 .hg/cache/rbc-revs-v1
314 .hg/cache/rbc-revs-v1
315 .hg/cache/rbc-names-v1
315 .hg/cache/rbc-names-v1
316 .hg/cache/branch2-served
316 .hg/cache/branch2-served
317
317
318 $ cd ..
318 $ cd ..
319
319
320 Test internal debugstacktrace command
320 Test internal debugstacktrace command
321
321
322 $ cat > debugstacktrace.py << EOF
322 $ cat > debugstacktrace.py << EOF
323 > from __future__ import absolute_import
323 > from __future__ import absolute_import
324 > import sys
324 > import sys
325 > from mercurial import util
325 > from mercurial import util
326 > def f():
326 > def f():
327 > util.debugstacktrace(f=sys.stdout)
327 > util.debugstacktrace(f=sys.stdout)
328 > g()
328 > g()
329 > def g():
329 > def g():
330 > util.dst('hello from g\\n', skip=1)
330 > util.dst('hello from g\\n', skip=1)
331 > h()
331 > h()
332 > def h():
332 > def h():
333 > util.dst('hi ...\\nfrom h hidden in g', 1, depth=2)
333 > util.dst('hi ...\\nfrom h hidden in g', 1, depth=2)
334 > f()
334 > f()
335 > EOF
335 > EOF
336 $ $PYTHON debugstacktrace.py
336 $ $PYTHON debugstacktrace.py
337 stacktrace at:
337 stacktrace at:
338 debugstacktrace.py:12 in * (glob)
338 debugstacktrace.py:12 in * (glob)
339 debugstacktrace.py:5 in f
339 debugstacktrace.py:5 in f
340 hello from g at:
340 hello from g at:
341 debugstacktrace.py:12 in * (glob)
341 debugstacktrace.py:12 in * (glob)
342 debugstacktrace.py:6 in f
342 debugstacktrace.py:6 in f
343 hi ...
343 hi ...
344 from h hidden in g at:
344 from h hidden in g at:
345 debugstacktrace.py:6 in f
345 debugstacktrace.py:6 in f
346 debugstacktrace.py:9 in g
346 debugstacktrace.py:9 in g
347
347
348 Test debugcapabilities command:
348 Test debugcapabilities command:
349
349
350 $ hg debugcapabilities ./debugrevlog/
350 $ hg debugcapabilities ./debugrevlog/
351 Main capabilities:
351 Main capabilities:
352 branchmap
352 branchmap
353 $USUAL_BUNDLE2_CAPS$
353 $USUAL_BUNDLE2_CAPS$
354 getbundle
354 getbundle
355 known
355 known
356 lookup
356 lookup
357 pushkey
357 pushkey
358 unbundle
358 unbundle
359 Bundle2 capabilities:
359 Bundle2 capabilities:
360 HG20
360 HG20
361 bookmarks
361 bookmarks
362 changegroup
362 changegroup
363 01
363 01
364 02
364 02
365 digests
365 digests
366 md5
366 md5
367 sha1
367 sha1
368 sha512
368 sha512
369 error
369 error
370 abort
370 abort
371 unsupportedcontent
371 unsupportedcontent
372 pushraced
372 pushraced
373 pushkey
373 pushkey
374 hgtagsfnodes
374 hgtagsfnodes
375 listkeys
375 listkeys
376 phases
376 phases
377 heads
377 heads
378 pushkey
378 pushkey
379 remote-changegroup
379 remote-changegroup
380 http
380 http
381 https
381 https
382 stream
382 stream
383 v2
383 v2
384
385 Test debugpeer
386
387 $ hg --config ui.ssh="\"$PYTHON\" \"$TESTDIR/dummyssh\"" debugpeer ssh://user@dummy/debugrevlog
388 url: ssh://user@dummy/debugrevlog
389 local: no
390 pushable: yes
391
392 $ hg --config ui.ssh="\"$PYTHON\" \"$TESTDIR/dummyssh\"" --debug debugpeer ssh://user@dummy/debugrevlog
393 running "*" "*/tests/dummyssh" 'user@dummy' 'hg -R debugrevlog serve --stdio' (glob)
394 devel-peer-request: hello
395 sending hello command
396 devel-peer-request: between
397 devel-peer-request: pairs: 81 bytes
398 sending between command
399 remote: 384
400 remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
401 remote: 1
402 url: ssh://user@dummy/debugrevlog
403 local: no
404 pushable: yes
@@ -1,3392 +1,3393 b''
1 Short help:
1 Short help:
2
2
3 $ hg
3 $ hg
4 Mercurial Distributed SCM
4 Mercurial Distributed SCM
5
5
6 basic commands:
6 basic commands:
7
7
8 add add the specified files on the next commit
8 add add the specified files on the next commit
9 annotate show changeset information by line for each file
9 annotate show changeset information by line for each file
10 clone make a copy of an existing repository
10 clone make a copy of an existing repository
11 commit commit the specified files or all outstanding changes
11 commit commit the specified files or all outstanding changes
12 diff diff repository (or selected files)
12 diff diff repository (or selected files)
13 export dump the header and diffs for one or more changesets
13 export dump the header and diffs for one or more changesets
14 forget forget the specified files on the next commit
14 forget forget the specified files on the next commit
15 init create a new repository in the given directory
15 init create a new repository in the given directory
16 log show revision history of entire repository or files
16 log show revision history of entire repository or files
17 merge merge another revision into working directory
17 merge merge another revision into working directory
18 pull pull changes from the specified source
18 pull pull changes from the specified source
19 push push changes to the specified destination
19 push push changes to the specified destination
20 remove remove the specified files on the next commit
20 remove remove the specified files on the next commit
21 serve start stand-alone webserver
21 serve start stand-alone webserver
22 status show changed files in the working directory
22 status show changed files in the working directory
23 summary summarize working directory state
23 summary summarize working directory state
24 update update working directory (or switch revisions)
24 update update working directory (or switch revisions)
25
25
26 (use 'hg help' for the full list of commands or 'hg -v' for details)
26 (use 'hg help' for the full list of commands or 'hg -v' for details)
27
27
28 $ hg -q
28 $ hg -q
29 add add the specified files on the next commit
29 add add the specified files on the next commit
30 annotate show changeset information by line for each file
30 annotate show changeset information by line for each file
31 clone make a copy of an existing repository
31 clone make a copy of an existing repository
32 commit commit the specified files or all outstanding changes
32 commit commit the specified files or all outstanding changes
33 diff diff repository (or selected files)
33 diff diff repository (or selected files)
34 export dump the header and diffs for one or more changesets
34 export dump the header and diffs for one or more changesets
35 forget forget the specified files on the next commit
35 forget forget the specified files on the next commit
36 init create a new repository in the given directory
36 init create a new repository in the given directory
37 log show revision history of entire repository or files
37 log show revision history of entire repository or files
38 merge merge another revision into working directory
38 merge merge another revision into working directory
39 pull pull changes from the specified source
39 pull pull changes from the specified source
40 push push changes to the specified destination
40 push push changes to the specified destination
41 remove remove the specified files on the next commit
41 remove remove the specified files on the next commit
42 serve start stand-alone webserver
42 serve start stand-alone webserver
43 status show changed files in the working directory
43 status show changed files in the working directory
44 summary summarize working directory state
44 summary summarize working directory state
45 update update working directory (or switch revisions)
45 update update working directory (or switch revisions)
46
46
47 $ hg help
47 $ hg help
48 Mercurial Distributed SCM
48 Mercurial Distributed SCM
49
49
50 list of commands:
50 list of commands:
51
51
52 add add the specified files on the next commit
52 add add the specified files on the next commit
53 addremove add all new files, delete all missing files
53 addremove add all new files, delete all missing files
54 annotate show changeset information by line for each file
54 annotate show changeset information by line for each file
55 archive create an unversioned archive of a repository revision
55 archive create an unversioned archive of a repository revision
56 backout reverse effect of earlier changeset
56 backout reverse effect of earlier changeset
57 bisect subdivision search of changesets
57 bisect subdivision search of changesets
58 bookmarks create a new bookmark or list existing bookmarks
58 bookmarks create a new bookmark or list existing bookmarks
59 branch set or show the current branch name
59 branch set or show the current branch name
60 branches list repository named branches
60 branches list repository named branches
61 bundle create a bundle file
61 bundle create a bundle file
62 cat output the current or given revision of files
62 cat output the current or given revision of files
63 clone make a copy of an existing repository
63 clone make a copy of an existing repository
64 commit commit the specified files or all outstanding changes
64 commit commit the specified files or all outstanding changes
65 config show combined config settings from all hgrc files
65 config show combined config settings from all hgrc files
66 copy mark files as copied for the next commit
66 copy mark files as copied for the next commit
67 diff diff repository (or selected files)
67 diff diff repository (or selected files)
68 export dump the header and diffs for one or more changesets
68 export dump the header and diffs for one or more changesets
69 files list tracked files
69 files list tracked files
70 forget forget the specified files on the next commit
70 forget forget the specified files on the next commit
71 graft copy changes from other branches onto the current branch
71 graft copy changes from other branches onto the current branch
72 grep search revision history for a pattern in specified files
72 grep search revision history for a pattern in specified files
73 heads show branch heads
73 heads show branch heads
74 help show help for a given topic or a help overview
74 help show help for a given topic or a help overview
75 identify identify the working directory or specified revision
75 identify identify the working directory or specified revision
76 import import an ordered set of patches
76 import import an ordered set of patches
77 incoming show new changesets found in source
77 incoming show new changesets found in source
78 init create a new repository in the given directory
78 init create a new repository in the given directory
79 log show revision history of entire repository or files
79 log show revision history of entire repository or files
80 manifest output the current or given revision of the project manifest
80 manifest output the current or given revision of the project manifest
81 merge merge another revision into working directory
81 merge merge another revision into working directory
82 outgoing show changesets not found in the destination
82 outgoing show changesets not found in the destination
83 paths show aliases for remote repositories
83 paths show aliases for remote repositories
84 phase set or show the current phase name
84 phase set or show the current phase name
85 pull pull changes from the specified source
85 pull pull changes from the specified source
86 push push changes to the specified destination
86 push push changes to the specified destination
87 recover roll back an interrupted transaction
87 recover roll back an interrupted transaction
88 remove remove the specified files on the next commit
88 remove remove the specified files on the next commit
89 rename rename files; equivalent of copy + remove
89 rename rename files; equivalent of copy + remove
90 resolve redo merges or set/view the merge status of files
90 resolve redo merges or set/view the merge status of files
91 revert restore files to their checkout state
91 revert restore files to their checkout state
92 root print the root (top) of the current working directory
92 root print the root (top) of the current working directory
93 serve start stand-alone webserver
93 serve start stand-alone webserver
94 status show changed files in the working directory
94 status show changed files in the working directory
95 summary summarize working directory state
95 summary summarize working directory state
96 tag add one or more tags for the current or given revision
96 tag add one or more tags for the current or given revision
97 tags list repository tags
97 tags list repository tags
98 unbundle apply one or more bundle files
98 unbundle apply one or more bundle files
99 update update working directory (or switch revisions)
99 update update working directory (or switch revisions)
100 verify verify the integrity of the repository
100 verify verify the integrity of the repository
101 version output version and copyright information
101 version output version and copyright information
102
102
103 additional help topics:
103 additional help topics:
104
104
105 bundlespec Bundle File Formats
105 bundlespec Bundle File Formats
106 color Colorizing Outputs
106 color Colorizing Outputs
107 config Configuration Files
107 config Configuration Files
108 dates Date Formats
108 dates Date Formats
109 diffs Diff Formats
109 diffs Diff Formats
110 environment Environment Variables
110 environment Environment Variables
111 extensions Using Additional Features
111 extensions Using Additional Features
112 filesets Specifying File Sets
112 filesets Specifying File Sets
113 flags Command-line flags
113 flags Command-line flags
114 glossary Glossary
114 glossary Glossary
115 hgignore Syntax for Mercurial Ignore Files
115 hgignore Syntax for Mercurial Ignore Files
116 hgweb Configuring hgweb
116 hgweb Configuring hgweb
117 internals Technical implementation topics
117 internals Technical implementation topics
118 merge-tools Merge Tools
118 merge-tools Merge Tools
119 pager Pager Support
119 pager Pager Support
120 patterns File Name Patterns
120 patterns File Name Patterns
121 phases Working with Phases
121 phases Working with Phases
122 revisions Specifying Revisions
122 revisions Specifying Revisions
123 scripting Using Mercurial from scripts and automation
123 scripting Using Mercurial from scripts and automation
124 subrepos Subrepositories
124 subrepos Subrepositories
125 templating Template Usage
125 templating Template Usage
126 urls URL Paths
126 urls URL Paths
127
127
128 (use 'hg help -v' to show built-in aliases and global options)
128 (use 'hg help -v' to show built-in aliases and global options)
129
129
130 $ hg -q help
130 $ hg -q help
131 add add the specified files on the next commit
131 add add the specified files on the next commit
132 addremove add all new files, delete all missing files
132 addremove add all new files, delete all missing files
133 annotate show changeset information by line for each file
133 annotate show changeset information by line for each file
134 archive create an unversioned archive of a repository revision
134 archive create an unversioned archive of a repository revision
135 backout reverse effect of earlier changeset
135 backout reverse effect of earlier changeset
136 bisect subdivision search of changesets
136 bisect subdivision search of changesets
137 bookmarks create a new bookmark or list existing bookmarks
137 bookmarks create a new bookmark or list existing bookmarks
138 branch set or show the current branch name
138 branch set or show the current branch name
139 branches list repository named branches
139 branches list repository named branches
140 bundle create a bundle file
140 bundle create a bundle file
141 cat output the current or given revision of files
141 cat output the current or given revision of files
142 clone make a copy of an existing repository
142 clone make a copy of an existing repository
143 commit commit the specified files or all outstanding changes
143 commit commit the specified files or all outstanding changes
144 config show combined config settings from all hgrc files
144 config show combined config settings from all hgrc files
145 copy mark files as copied for the next commit
145 copy mark files as copied for the next commit
146 diff diff repository (or selected files)
146 diff diff repository (or selected files)
147 export dump the header and diffs for one or more changesets
147 export dump the header and diffs for one or more changesets
148 files list tracked files
148 files list tracked files
149 forget forget the specified files on the next commit
149 forget forget the specified files on the next commit
150 graft copy changes from other branches onto the current branch
150 graft copy changes from other branches onto the current branch
151 grep search revision history for a pattern in specified files
151 grep search revision history for a pattern in specified files
152 heads show branch heads
152 heads show branch heads
153 help show help for a given topic or a help overview
153 help show help for a given topic or a help overview
154 identify identify the working directory or specified revision
154 identify identify the working directory or specified revision
155 import import an ordered set of patches
155 import import an ordered set of patches
156 incoming show new changesets found in source
156 incoming show new changesets found in source
157 init create a new repository in the given directory
157 init create a new repository in the given directory
158 log show revision history of entire repository or files
158 log show revision history of entire repository or files
159 manifest output the current or given revision of the project manifest
159 manifest output the current or given revision of the project manifest
160 merge merge another revision into working directory
160 merge merge another revision into working directory
161 outgoing show changesets not found in the destination
161 outgoing show changesets not found in the destination
162 paths show aliases for remote repositories
162 paths show aliases for remote repositories
163 phase set or show the current phase name
163 phase set or show the current phase name
164 pull pull changes from the specified source
164 pull pull changes from the specified source
165 push push changes to the specified destination
165 push push changes to the specified destination
166 recover roll back an interrupted transaction
166 recover roll back an interrupted transaction
167 remove remove the specified files on the next commit
167 remove remove the specified files on the next commit
168 rename rename files; equivalent of copy + remove
168 rename rename files; equivalent of copy + remove
169 resolve redo merges or set/view the merge status of files
169 resolve redo merges or set/view the merge status of files
170 revert restore files to their checkout state
170 revert restore files to their checkout state
171 root print the root (top) of the current working directory
171 root print the root (top) of the current working directory
172 serve start stand-alone webserver
172 serve start stand-alone webserver
173 status show changed files in the working directory
173 status show changed files in the working directory
174 summary summarize working directory state
174 summary summarize working directory state
175 tag add one or more tags for the current or given revision
175 tag add one or more tags for the current or given revision
176 tags list repository tags
176 tags list repository tags
177 unbundle apply one or more bundle files
177 unbundle apply one or more bundle files
178 update update working directory (or switch revisions)
178 update update working directory (or switch revisions)
179 verify verify the integrity of the repository
179 verify verify the integrity of the repository
180 version output version and copyright information
180 version output version and copyright information
181
181
182 additional help topics:
182 additional help topics:
183
183
184 bundlespec Bundle File Formats
184 bundlespec Bundle File Formats
185 color Colorizing Outputs
185 color Colorizing Outputs
186 config Configuration Files
186 config Configuration Files
187 dates Date Formats
187 dates Date Formats
188 diffs Diff Formats
188 diffs Diff Formats
189 environment Environment Variables
189 environment Environment Variables
190 extensions Using Additional Features
190 extensions Using Additional Features
191 filesets Specifying File Sets
191 filesets Specifying File Sets
192 flags Command-line flags
192 flags Command-line flags
193 glossary Glossary
193 glossary Glossary
194 hgignore Syntax for Mercurial Ignore Files
194 hgignore Syntax for Mercurial Ignore Files
195 hgweb Configuring hgweb
195 hgweb Configuring hgweb
196 internals Technical implementation topics
196 internals Technical implementation topics
197 merge-tools Merge Tools
197 merge-tools Merge Tools
198 pager Pager Support
198 pager Pager Support
199 patterns File Name Patterns
199 patterns File Name Patterns
200 phases Working with Phases
200 phases Working with Phases
201 revisions Specifying Revisions
201 revisions Specifying Revisions
202 scripting Using Mercurial from scripts and automation
202 scripting Using Mercurial from scripts and automation
203 subrepos Subrepositories
203 subrepos Subrepositories
204 templating Template Usage
204 templating Template Usage
205 urls URL Paths
205 urls URL Paths
206
206
207 Test extension help:
207 Test extension help:
208 $ hg help extensions --config extensions.rebase= --config extensions.children=
208 $ hg help extensions --config extensions.rebase= --config extensions.children=
209 Using Additional Features
209 Using Additional Features
210 """""""""""""""""""""""""
210 """""""""""""""""""""""""
211
211
212 Mercurial has the ability to add new features through the use of
212 Mercurial has the ability to add new features through the use of
213 extensions. Extensions may add new commands, add options to existing
213 extensions. Extensions may add new commands, add options to existing
214 commands, change the default behavior of commands, or implement hooks.
214 commands, change the default behavior of commands, or implement hooks.
215
215
216 To enable the "foo" extension, either shipped with Mercurial or in the
216 To enable the "foo" extension, either shipped with Mercurial or in the
217 Python search path, create an entry for it in your configuration file,
217 Python search path, create an entry for it in your configuration file,
218 like this:
218 like this:
219
219
220 [extensions]
220 [extensions]
221 foo =
221 foo =
222
222
223 You may also specify the full path to an extension:
223 You may also specify the full path to an extension:
224
224
225 [extensions]
225 [extensions]
226 myfeature = ~/.hgext/myfeature.py
226 myfeature = ~/.hgext/myfeature.py
227
227
228 See 'hg help config' for more information on configuration files.
228 See 'hg help config' for more information on configuration files.
229
229
230 Extensions are not loaded by default for a variety of reasons: they can
230 Extensions are not loaded by default for a variety of reasons: they can
231 increase startup overhead; they may be meant for advanced usage only; they
231 increase startup overhead; they may be meant for advanced usage only; they
232 may provide potentially dangerous abilities (such as letting you destroy
232 may provide potentially dangerous abilities (such as letting you destroy
233 or modify history); they might not be ready for prime time; or they may
233 or modify history); they might not be ready for prime time; or they may
234 alter some usual behaviors of stock Mercurial. It is thus up to the user
234 alter some usual behaviors of stock Mercurial. It is thus up to the user
235 to activate extensions as needed.
235 to activate extensions as needed.
236
236
237 To explicitly disable an extension enabled in a configuration file of
237 To explicitly disable an extension enabled in a configuration file of
238 broader scope, prepend its path with !:
238 broader scope, prepend its path with !:
239
239
240 [extensions]
240 [extensions]
241 # disabling extension bar residing in /path/to/extension/bar.py
241 # disabling extension bar residing in /path/to/extension/bar.py
242 bar = !/path/to/extension/bar.py
242 bar = !/path/to/extension/bar.py
243 # ditto, but no path was supplied for extension baz
243 # ditto, but no path was supplied for extension baz
244 baz = !
244 baz = !
245
245
246 enabled extensions:
246 enabled extensions:
247
247
248 children command to display child changesets (DEPRECATED)
248 children command to display child changesets (DEPRECATED)
249 rebase command to move sets of revisions to a different ancestor
249 rebase command to move sets of revisions to a different ancestor
250
250
251 disabled extensions:
251 disabled extensions:
252
252
253 acl hooks for controlling repository access
253 acl hooks for controlling repository access
254 blackbox log repository events to a blackbox for debugging
254 blackbox log repository events to a blackbox for debugging
255 bugzilla hooks for integrating with the Bugzilla bug tracker
255 bugzilla hooks for integrating with the Bugzilla bug tracker
256 censor erase file content at a given revision
256 censor erase file content at a given revision
257 churn command to display statistics about repository history
257 churn command to display statistics about repository history
258 clonebundles advertise pre-generated bundles to seed clones
258 clonebundles advertise pre-generated bundles to seed clones
259 convert import revisions from foreign VCS repositories into
259 convert import revisions from foreign VCS repositories into
260 Mercurial
260 Mercurial
261 eol automatically manage newlines in repository files
261 eol automatically manage newlines in repository files
262 extdiff command to allow external programs to compare revisions
262 extdiff command to allow external programs to compare revisions
263 factotum http authentication with factotum
263 factotum http authentication with factotum
264 githelp try mapping git commands to Mercurial commands
264 githelp try mapping git commands to Mercurial commands
265 gpg commands to sign and verify changesets
265 gpg commands to sign and verify changesets
266 hgk browse the repository in a graphical way
266 hgk browse the repository in a graphical way
267 highlight syntax highlighting for hgweb (requires Pygments)
267 highlight syntax highlighting for hgweb (requires Pygments)
268 histedit interactive history editing
268 histedit interactive history editing
269 keyword expand keywords in tracked files
269 keyword expand keywords in tracked files
270 largefiles track large binary files
270 largefiles track large binary files
271 mq manage a stack of patches
271 mq manage a stack of patches
272 notify hooks for sending email push notifications
272 notify hooks for sending email push notifications
273 patchbomb command to send changesets as (a series of) patch emails
273 patchbomb command to send changesets as (a series of) patch emails
274 purge command to delete untracked files from the working
274 purge command to delete untracked files from the working
275 directory
275 directory
276 relink recreates hardlinks between repository clones
276 relink recreates hardlinks between repository clones
277 schemes extend schemes with shortcuts to repository swarms
277 schemes extend schemes with shortcuts to repository swarms
278 share share a common history between several working directories
278 share share a common history between several working directories
279 shelve save and restore changes to the working directory
279 shelve save and restore changes to the working directory
280 strip strip changesets and their descendants from history
280 strip strip changesets and their descendants from history
281 transplant command to transplant changesets from another branch
281 transplant command to transplant changesets from another branch
282 win32mbcs allow the use of MBCS paths with problematic encodings
282 win32mbcs allow the use of MBCS paths with problematic encodings
283 zeroconf discover and advertise repositories on the local network
283 zeroconf discover and advertise repositories on the local network
284
284
285 Verify that extension keywords appear in help templates
285 Verify that extension keywords appear in help templates
286
286
287 $ hg help --config extensions.transplant= templating|grep transplant > /dev/null
287 $ hg help --config extensions.transplant= templating|grep transplant > /dev/null
288
288
289 Test short command list with verbose option
289 Test short command list with verbose option
290
290
291 $ hg -v help shortlist
291 $ hg -v help shortlist
292 Mercurial Distributed SCM
292 Mercurial Distributed SCM
293
293
294 basic commands:
294 basic commands:
295
295
296 add add the specified files on the next commit
296 add add the specified files on the next commit
297 annotate, blame
297 annotate, blame
298 show changeset information by line for each file
298 show changeset information by line for each file
299 clone make a copy of an existing repository
299 clone make a copy of an existing repository
300 commit, ci commit the specified files or all outstanding changes
300 commit, ci commit the specified files or all outstanding changes
301 diff diff repository (or selected files)
301 diff diff repository (or selected files)
302 export dump the header and diffs for one or more changesets
302 export dump the header and diffs for one or more changesets
303 forget forget the specified files on the next commit
303 forget forget the specified files on the next commit
304 init create a new repository in the given directory
304 init create a new repository in the given directory
305 log, history show revision history of entire repository or files
305 log, history show revision history of entire repository or files
306 merge merge another revision into working directory
306 merge merge another revision into working directory
307 pull pull changes from the specified source
307 pull pull changes from the specified source
308 push push changes to the specified destination
308 push push changes to the specified destination
309 remove, rm remove the specified files on the next commit
309 remove, rm remove the specified files on the next commit
310 serve start stand-alone webserver
310 serve start stand-alone webserver
311 status, st show changed files in the working directory
311 status, st show changed files in the working directory
312 summary, sum summarize working directory state
312 summary, sum summarize working directory state
313 update, up, checkout, co
313 update, up, checkout, co
314 update working directory (or switch revisions)
314 update working directory (or switch revisions)
315
315
316 global options ([+] can be repeated):
316 global options ([+] can be repeated):
317
317
318 -R --repository REPO repository root directory or name of overlay bundle
318 -R --repository REPO repository root directory or name of overlay bundle
319 file
319 file
320 --cwd DIR change working directory
320 --cwd DIR change working directory
321 -y --noninteractive do not prompt, automatically pick the first choice for
321 -y --noninteractive do not prompt, automatically pick the first choice for
322 all prompts
322 all prompts
323 -q --quiet suppress output
323 -q --quiet suppress output
324 -v --verbose enable additional output
324 -v --verbose enable additional output
325 --color TYPE when to colorize (boolean, always, auto, never, or
325 --color TYPE when to colorize (boolean, always, auto, never, or
326 debug)
326 debug)
327 --config CONFIG [+] set/override config option (use 'section.name=value')
327 --config CONFIG [+] set/override config option (use 'section.name=value')
328 --debug enable debugging output
328 --debug enable debugging output
329 --debugger start debugger
329 --debugger start debugger
330 --encoding ENCODE set the charset encoding (default: ascii)
330 --encoding ENCODE set the charset encoding (default: ascii)
331 --encodingmode MODE set the charset encoding mode (default: strict)
331 --encodingmode MODE set the charset encoding mode (default: strict)
332 --traceback always print a traceback on exception
332 --traceback always print a traceback on exception
333 --time time how long the command takes
333 --time time how long the command takes
334 --profile print command execution profile
334 --profile print command execution profile
335 --version output version information and exit
335 --version output version information and exit
336 -h --help display help and exit
336 -h --help display help and exit
337 --hidden consider hidden changesets
337 --hidden consider hidden changesets
338 --pager TYPE when to paginate (boolean, always, auto, or never)
338 --pager TYPE when to paginate (boolean, always, auto, or never)
339 (default: auto)
339 (default: auto)
340
340
341 (use 'hg help' for the full list of commands)
341 (use 'hg help' for the full list of commands)
342
342
343 $ hg add -h
343 $ hg add -h
344 hg add [OPTION]... [FILE]...
344 hg add [OPTION]... [FILE]...
345
345
346 add the specified files on the next commit
346 add the specified files on the next commit
347
347
348 Schedule files to be version controlled and added to the repository.
348 Schedule files to be version controlled and added to the repository.
349
349
350 The files will be added to the repository at the next commit. To undo an
350 The files will be added to the repository at the next commit. To undo an
351 add before that, see 'hg forget'.
351 add before that, see 'hg forget'.
352
352
353 If no names are given, add all files to the repository (except files
353 If no names are given, add all files to the repository (except files
354 matching ".hgignore").
354 matching ".hgignore").
355
355
356 Returns 0 if all files are successfully added.
356 Returns 0 if all files are successfully added.
357
357
358 options ([+] can be repeated):
358 options ([+] can be repeated):
359
359
360 -I --include PATTERN [+] include names matching the given patterns
360 -I --include PATTERN [+] include names matching the given patterns
361 -X --exclude PATTERN [+] exclude names matching the given patterns
361 -X --exclude PATTERN [+] exclude names matching the given patterns
362 -S --subrepos recurse into subrepositories
362 -S --subrepos recurse into subrepositories
363 -n --dry-run do not perform actions, just print output
363 -n --dry-run do not perform actions, just print output
364
364
365 (some details hidden, use --verbose to show complete help)
365 (some details hidden, use --verbose to show complete help)
366
366
367 Verbose help for add
367 Verbose help for add
368
368
369 $ hg add -hv
369 $ hg add -hv
370 hg add [OPTION]... [FILE]...
370 hg add [OPTION]... [FILE]...
371
371
372 add the specified files on the next commit
372 add the specified files on the next commit
373
373
374 Schedule files to be version controlled and added to the repository.
374 Schedule files to be version controlled and added to the repository.
375
375
376 The files will be added to the repository at the next commit. To undo an
376 The files will be added to the repository at the next commit. To undo an
377 add before that, see 'hg forget'.
377 add before that, see 'hg forget'.
378
378
379 If no names are given, add all files to the repository (except files
379 If no names are given, add all files to the repository (except files
380 matching ".hgignore").
380 matching ".hgignore").
381
381
382 Examples:
382 Examples:
383
383
384 - New (unknown) files are added automatically by 'hg add':
384 - New (unknown) files are added automatically by 'hg add':
385
385
386 $ ls
386 $ ls
387 foo.c
387 foo.c
388 $ hg status
388 $ hg status
389 ? foo.c
389 ? foo.c
390 $ hg add
390 $ hg add
391 adding foo.c
391 adding foo.c
392 $ hg status
392 $ hg status
393 A foo.c
393 A foo.c
394
394
395 - Specific files to be added can be specified:
395 - Specific files to be added can be specified:
396
396
397 $ ls
397 $ ls
398 bar.c foo.c
398 bar.c foo.c
399 $ hg status
399 $ hg status
400 ? bar.c
400 ? bar.c
401 ? foo.c
401 ? foo.c
402 $ hg add bar.c
402 $ hg add bar.c
403 $ hg status
403 $ hg status
404 A bar.c
404 A bar.c
405 ? foo.c
405 ? foo.c
406
406
407 Returns 0 if all files are successfully added.
407 Returns 0 if all files are successfully added.
408
408
409 options ([+] can be repeated):
409 options ([+] can be repeated):
410
410
411 -I --include PATTERN [+] include names matching the given patterns
411 -I --include PATTERN [+] include names matching the given patterns
412 -X --exclude PATTERN [+] exclude names matching the given patterns
412 -X --exclude PATTERN [+] exclude names matching the given patterns
413 -S --subrepos recurse into subrepositories
413 -S --subrepos recurse into subrepositories
414 -n --dry-run do not perform actions, just print output
414 -n --dry-run do not perform actions, just print output
415
415
416 global options ([+] can be repeated):
416 global options ([+] can be repeated):
417
417
418 -R --repository REPO repository root directory or name of overlay bundle
418 -R --repository REPO repository root directory or name of overlay bundle
419 file
419 file
420 --cwd DIR change working directory
420 --cwd DIR change working directory
421 -y --noninteractive do not prompt, automatically pick the first choice for
421 -y --noninteractive do not prompt, automatically pick the first choice for
422 all prompts
422 all prompts
423 -q --quiet suppress output
423 -q --quiet suppress output
424 -v --verbose enable additional output
424 -v --verbose enable additional output
425 --color TYPE when to colorize (boolean, always, auto, never, or
425 --color TYPE when to colorize (boolean, always, auto, never, or
426 debug)
426 debug)
427 --config CONFIG [+] set/override config option (use 'section.name=value')
427 --config CONFIG [+] set/override config option (use 'section.name=value')
428 --debug enable debugging output
428 --debug enable debugging output
429 --debugger start debugger
429 --debugger start debugger
430 --encoding ENCODE set the charset encoding (default: ascii)
430 --encoding ENCODE set the charset encoding (default: ascii)
431 --encodingmode MODE set the charset encoding mode (default: strict)
431 --encodingmode MODE set the charset encoding mode (default: strict)
432 --traceback always print a traceback on exception
432 --traceback always print a traceback on exception
433 --time time how long the command takes
433 --time time how long the command takes
434 --profile print command execution profile
434 --profile print command execution profile
435 --version output version information and exit
435 --version output version information and exit
436 -h --help display help and exit
436 -h --help display help and exit
437 --hidden consider hidden changesets
437 --hidden consider hidden changesets
438 --pager TYPE when to paginate (boolean, always, auto, or never)
438 --pager TYPE when to paginate (boolean, always, auto, or never)
439 (default: auto)
439 (default: auto)
440
440
441 Test the textwidth config option
441 Test the textwidth config option
442
442
443 $ hg root -h --config ui.textwidth=50
443 $ hg root -h --config ui.textwidth=50
444 hg root
444 hg root
445
445
446 print the root (top) of the current working
446 print the root (top) of the current working
447 directory
447 directory
448
448
449 Print the root directory of the current
449 Print the root directory of the current
450 repository.
450 repository.
451
451
452 Returns 0 on success.
452 Returns 0 on success.
453
453
454 (some details hidden, use --verbose to show
454 (some details hidden, use --verbose to show
455 complete help)
455 complete help)
456
456
457 Test help option with version option
457 Test help option with version option
458
458
459 $ hg add -h --version
459 $ hg add -h --version
460 Mercurial Distributed SCM (version *) (glob)
460 Mercurial Distributed SCM (version *) (glob)
461 (see https://mercurial-scm.org for more information)
461 (see https://mercurial-scm.org for more information)
462
462
463 Copyright (C) 2005-* Matt Mackall and others (glob)
463 Copyright (C) 2005-* Matt Mackall and others (glob)
464 This is free software; see the source for copying conditions. There is NO
464 This is free software; see the source for copying conditions. There is NO
465 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
465 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
466
466
467 $ hg add --skjdfks
467 $ hg add --skjdfks
468 hg add: option --skjdfks not recognized
468 hg add: option --skjdfks not recognized
469 hg add [OPTION]... [FILE]...
469 hg add [OPTION]... [FILE]...
470
470
471 add the specified files on the next commit
471 add the specified files on the next commit
472
472
473 options ([+] can be repeated):
473 options ([+] can be repeated):
474
474
475 -I --include PATTERN [+] include names matching the given patterns
475 -I --include PATTERN [+] include names matching the given patterns
476 -X --exclude PATTERN [+] exclude names matching the given patterns
476 -X --exclude PATTERN [+] exclude names matching the given patterns
477 -S --subrepos recurse into subrepositories
477 -S --subrepos recurse into subrepositories
478 -n --dry-run do not perform actions, just print output
478 -n --dry-run do not perform actions, just print output
479
479
480 (use 'hg add -h' to show more help)
480 (use 'hg add -h' to show more help)
481 [255]
481 [255]
482
482
483 Test ambiguous command help
483 Test ambiguous command help
484
484
485 $ hg help ad
485 $ hg help ad
486 list of commands:
486 list of commands:
487
487
488 add add the specified files on the next commit
488 add add the specified files on the next commit
489 addremove add all new files, delete all missing files
489 addremove add all new files, delete all missing files
490
490
491 (use 'hg help -v ad' to show built-in aliases and global options)
491 (use 'hg help -v ad' to show built-in aliases and global options)
492
492
493 Test command without options
493 Test command without options
494
494
495 $ hg help verify
495 $ hg help verify
496 hg verify
496 hg verify
497
497
498 verify the integrity of the repository
498 verify the integrity of the repository
499
499
500 Verify the integrity of the current repository.
500 Verify the integrity of the current repository.
501
501
502 This will perform an extensive check of the repository's integrity,
502 This will perform an extensive check of the repository's integrity,
503 validating the hashes and checksums of each entry in the changelog,
503 validating the hashes and checksums of each entry in the changelog,
504 manifest, and tracked files, as well as the integrity of their crosslinks
504 manifest, and tracked files, as well as the integrity of their crosslinks
505 and indices.
505 and indices.
506
506
507 Please see https://mercurial-scm.org/wiki/RepositoryCorruption for more
507 Please see https://mercurial-scm.org/wiki/RepositoryCorruption for more
508 information about recovery from corruption of the repository.
508 information about recovery from corruption of the repository.
509
509
510 Returns 0 on success, 1 if errors are encountered.
510 Returns 0 on success, 1 if errors are encountered.
511
511
512 (some details hidden, use --verbose to show complete help)
512 (some details hidden, use --verbose to show complete help)
513
513
514 $ hg help diff
514 $ hg help diff
515 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
515 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
516
516
517 diff repository (or selected files)
517 diff repository (or selected files)
518
518
519 Show differences between revisions for the specified files.
519 Show differences between revisions for the specified files.
520
520
521 Differences between files are shown using the unified diff format.
521 Differences between files are shown using the unified diff format.
522
522
523 Note:
523 Note:
524 'hg diff' may generate unexpected results for merges, as it will
524 'hg diff' may generate unexpected results for merges, as it will
525 default to comparing against the working directory's first parent
525 default to comparing against the working directory's first parent
526 changeset if no revisions are specified.
526 changeset if no revisions are specified.
527
527
528 When two revision arguments are given, then changes are shown between
528 When two revision arguments are given, then changes are shown between
529 those revisions. If only one revision is specified then that revision is
529 those revisions. If only one revision is specified then that revision is
530 compared to the working directory, and, when no revisions are specified,
530 compared to the working directory, and, when no revisions are specified,
531 the working directory files are compared to its first parent.
531 the working directory files are compared to its first parent.
532
532
533 Alternatively you can specify -c/--change with a revision to see the
533 Alternatively you can specify -c/--change with a revision to see the
534 changes in that changeset relative to its first parent.
534 changes in that changeset relative to its first parent.
535
535
536 Without the -a/--text option, diff will avoid generating diffs of files it
536 Without the -a/--text option, diff will avoid generating diffs of files it
537 detects as binary. With -a, diff will generate a diff anyway, probably
537 detects as binary. With -a, diff will generate a diff anyway, probably
538 with undesirable results.
538 with undesirable results.
539
539
540 Use the -g/--git option to generate diffs in the git extended diff format.
540 Use the -g/--git option to generate diffs in the git extended diff format.
541 For more information, read 'hg help diffs'.
541 For more information, read 'hg help diffs'.
542
542
543 Returns 0 on success.
543 Returns 0 on success.
544
544
545 options ([+] can be repeated):
545 options ([+] can be repeated):
546
546
547 -r --rev REV [+] revision
547 -r --rev REV [+] revision
548 -c --change REV change made by revision
548 -c --change REV change made by revision
549 -a --text treat all files as text
549 -a --text treat all files as text
550 -g --git use git extended diff format
550 -g --git use git extended diff format
551 --binary generate binary diffs in git mode (default)
551 --binary generate binary diffs in git mode (default)
552 --nodates omit dates from diff headers
552 --nodates omit dates from diff headers
553 --noprefix omit a/ and b/ prefixes from filenames
553 --noprefix omit a/ and b/ prefixes from filenames
554 -p --show-function show which function each change is in
554 -p --show-function show which function each change is in
555 --reverse produce a diff that undoes the changes
555 --reverse produce a diff that undoes the changes
556 -w --ignore-all-space ignore white space when comparing lines
556 -w --ignore-all-space ignore white space when comparing lines
557 -b --ignore-space-change ignore changes in the amount of white space
557 -b --ignore-space-change ignore changes in the amount of white space
558 -B --ignore-blank-lines ignore changes whose lines are all blank
558 -B --ignore-blank-lines ignore changes whose lines are all blank
559 -Z --ignore-space-at-eol ignore changes in whitespace at EOL
559 -Z --ignore-space-at-eol ignore changes in whitespace at EOL
560 -U --unified NUM number of lines of context to show
560 -U --unified NUM number of lines of context to show
561 --stat output diffstat-style summary of changes
561 --stat output diffstat-style summary of changes
562 --root DIR produce diffs relative to subdirectory
562 --root DIR produce diffs relative to subdirectory
563 -I --include PATTERN [+] include names matching the given patterns
563 -I --include PATTERN [+] include names matching the given patterns
564 -X --exclude PATTERN [+] exclude names matching the given patterns
564 -X --exclude PATTERN [+] exclude names matching the given patterns
565 -S --subrepos recurse into subrepositories
565 -S --subrepos recurse into subrepositories
566
566
567 (some details hidden, use --verbose to show complete help)
567 (some details hidden, use --verbose to show complete help)
568
568
569 $ hg help status
569 $ hg help status
570 hg status [OPTION]... [FILE]...
570 hg status [OPTION]... [FILE]...
571
571
572 aliases: st
572 aliases: st
573
573
574 show changed files in the working directory
574 show changed files in the working directory
575
575
576 Show status of files in the repository. If names are given, only files
576 Show status of files in the repository. If names are given, only files
577 that match are shown. Files that are clean or ignored or the source of a
577 that match are shown. Files that are clean or ignored or the source of a
578 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
578 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
579 -C/--copies or -A/--all are given. Unless options described with "show
579 -C/--copies or -A/--all are given. Unless options described with "show
580 only ..." are given, the options -mardu are used.
580 only ..." are given, the options -mardu are used.
581
581
582 Option -q/--quiet hides untracked (unknown and ignored) files unless
582 Option -q/--quiet hides untracked (unknown and ignored) files unless
583 explicitly requested with -u/--unknown or -i/--ignored.
583 explicitly requested with -u/--unknown or -i/--ignored.
584
584
585 Note:
585 Note:
586 'hg status' may appear to disagree with diff if permissions have
586 'hg status' may appear to disagree with diff if permissions have
587 changed or a merge has occurred. The standard diff format does not
587 changed or a merge has occurred. The standard diff format does not
588 report permission changes and diff only reports changes relative to one
588 report permission changes and diff only reports changes relative to one
589 merge parent.
589 merge parent.
590
590
591 If one revision is given, it is used as the base revision. If two
591 If one revision is given, it is used as the base revision. If two
592 revisions are given, the differences between them are shown. The --change
592 revisions are given, the differences between them are shown. The --change
593 option can also be used as a shortcut to list the changed files of a
593 option can also be used as a shortcut to list the changed files of a
594 revision from its first parent.
594 revision from its first parent.
595
595
596 The codes used to show the status of files are:
596 The codes used to show the status of files are:
597
597
598 M = modified
598 M = modified
599 A = added
599 A = added
600 R = removed
600 R = removed
601 C = clean
601 C = clean
602 ! = missing (deleted by non-hg command, but still tracked)
602 ! = missing (deleted by non-hg command, but still tracked)
603 ? = not tracked
603 ? = not tracked
604 I = ignored
604 I = ignored
605 = origin of the previous file (with --copies)
605 = origin of the previous file (with --copies)
606
606
607 Returns 0 on success.
607 Returns 0 on success.
608
608
609 options ([+] can be repeated):
609 options ([+] can be repeated):
610
610
611 -A --all show status of all files
611 -A --all show status of all files
612 -m --modified show only modified files
612 -m --modified show only modified files
613 -a --added show only added files
613 -a --added show only added files
614 -r --removed show only removed files
614 -r --removed show only removed files
615 -d --deleted show only deleted (but tracked) files
615 -d --deleted show only deleted (but tracked) files
616 -c --clean show only files without changes
616 -c --clean show only files without changes
617 -u --unknown show only unknown (not tracked) files
617 -u --unknown show only unknown (not tracked) files
618 -i --ignored show only ignored files
618 -i --ignored show only ignored files
619 -n --no-status hide status prefix
619 -n --no-status hide status prefix
620 -C --copies show source of copied files
620 -C --copies show source of copied files
621 -0 --print0 end filenames with NUL, for use with xargs
621 -0 --print0 end filenames with NUL, for use with xargs
622 --rev REV [+] show difference from revision
622 --rev REV [+] show difference from revision
623 --change REV list the changed files of a revision
623 --change REV list the changed files of a revision
624 -I --include PATTERN [+] include names matching the given patterns
624 -I --include PATTERN [+] include names matching the given patterns
625 -X --exclude PATTERN [+] exclude names matching the given patterns
625 -X --exclude PATTERN [+] exclude names matching the given patterns
626 -S --subrepos recurse into subrepositories
626 -S --subrepos recurse into subrepositories
627
627
628 (some details hidden, use --verbose to show complete help)
628 (some details hidden, use --verbose to show complete help)
629
629
630 $ hg -q help status
630 $ hg -q help status
631 hg status [OPTION]... [FILE]...
631 hg status [OPTION]... [FILE]...
632
632
633 show changed files in the working directory
633 show changed files in the working directory
634
634
635 $ hg help foo
635 $ hg help foo
636 abort: no such help topic: foo
636 abort: no such help topic: foo
637 (try 'hg help --keyword foo')
637 (try 'hg help --keyword foo')
638 [255]
638 [255]
639
639
640 $ hg skjdfks
640 $ hg skjdfks
641 hg: unknown command 'skjdfks'
641 hg: unknown command 'skjdfks'
642 Mercurial Distributed SCM
642 Mercurial Distributed SCM
643
643
644 basic commands:
644 basic commands:
645
645
646 add add the specified files on the next commit
646 add add the specified files on the next commit
647 annotate show changeset information by line for each file
647 annotate show changeset information by line for each file
648 clone make a copy of an existing repository
648 clone make a copy of an existing repository
649 commit commit the specified files or all outstanding changes
649 commit commit the specified files or all outstanding changes
650 diff diff repository (or selected files)
650 diff diff repository (or selected files)
651 export dump the header and diffs for one or more changesets
651 export dump the header and diffs for one or more changesets
652 forget forget the specified files on the next commit
652 forget forget the specified files on the next commit
653 init create a new repository in the given directory
653 init create a new repository in the given directory
654 log show revision history of entire repository or files
654 log show revision history of entire repository or files
655 merge merge another revision into working directory
655 merge merge another revision into working directory
656 pull pull changes from the specified source
656 pull pull changes from the specified source
657 push push changes to the specified destination
657 push push changes to the specified destination
658 remove remove the specified files on the next commit
658 remove remove the specified files on the next commit
659 serve start stand-alone webserver
659 serve start stand-alone webserver
660 status show changed files in the working directory
660 status show changed files in the working directory
661 summary summarize working directory state
661 summary summarize working directory state
662 update update working directory (or switch revisions)
662 update update working directory (or switch revisions)
663
663
664 (use 'hg help' for the full list of commands or 'hg -v' for details)
664 (use 'hg help' for the full list of commands or 'hg -v' for details)
665 [255]
665 [255]
666
666
667 Typoed command gives suggestion
667 Typoed command gives suggestion
668 $ hg puls
668 $ hg puls
669 hg: unknown command 'puls'
669 hg: unknown command 'puls'
670 (did you mean one of pull, push?)
670 (did you mean one of pull, push?)
671 [255]
671 [255]
672
672
673 Not enabled extension gets suggested
673 Not enabled extension gets suggested
674
674
675 $ hg rebase
675 $ hg rebase
676 hg: unknown command 'rebase'
676 hg: unknown command 'rebase'
677 'rebase' is provided by the following extension:
677 'rebase' is provided by the following extension:
678
678
679 rebase command to move sets of revisions to a different ancestor
679 rebase command to move sets of revisions to a different ancestor
680
680
681 (use 'hg help extensions' for information on enabling extensions)
681 (use 'hg help extensions' for information on enabling extensions)
682 [255]
682 [255]
683
683
684 Disabled extension gets suggested
684 Disabled extension gets suggested
685 $ hg --config extensions.rebase=! rebase
685 $ hg --config extensions.rebase=! rebase
686 hg: unknown command 'rebase'
686 hg: unknown command 'rebase'
687 'rebase' is provided by the following extension:
687 'rebase' is provided by the following extension:
688
688
689 rebase command to move sets of revisions to a different ancestor
689 rebase command to move sets of revisions to a different ancestor
690
690
691 (use 'hg help extensions' for information on enabling extensions)
691 (use 'hg help extensions' for information on enabling extensions)
692 [255]
692 [255]
693
693
694 Make sure that we don't run afoul of the help system thinking that
694 Make sure that we don't run afoul of the help system thinking that
695 this is a section and erroring out weirdly.
695 this is a section and erroring out weirdly.
696
696
697 $ hg .log
697 $ hg .log
698 hg: unknown command '.log'
698 hg: unknown command '.log'
699 (did you mean log?)
699 (did you mean log?)
700 [255]
700 [255]
701
701
702 $ hg log.
702 $ hg log.
703 hg: unknown command 'log.'
703 hg: unknown command 'log.'
704 (did you mean log?)
704 (did you mean log?)
705 [255]
705 [255]
706 $ hg pu.lh
706 $ hg pu.lh
707 hg: unknown command 'pu.lh'
707 hg: unknown command 'pu.lh'
708 (did you mean one of pull, push?)
708 (did you mean one of pull, push?)
709 [255]
709 [255]
710
710
711 $ cat > helpext.py <<EOF
711 $ cat > helpext.py <<EOF
712 > import os
712 > import os
713 > from mercurial import commands, registrar
713 > from mercurial import commands, registrar
714 >
714 >
715 > cmdtable = {}
715 > cmdtable = {}
716 > command = registrar.command(cmdtable)
716 > command = registrar.command(cmdtable)
717 >
717 >
718 > @command(b'nohelp',
718 > @command(b'nohelp',
719 > [(b'', b'longdesc', 3, b'x'*90),
719 > [(b'', b'longdesc', 3, b'x'*90),
720 > (b'n', b'', None, b'normal desc'),
720 > (b'n', b'', None, b'normal desc'),
721 > (b'', b'newline', b'', b'line1\nline2')],
721 > (b'', b'newline', b'', b'line1\nline2')],
722 > b'hg nohelp',
722 > b'hg nohelp',
723 > norepo=True)
723 > norepo=True)
724 > @command(b'debugoptADV', [(b'', b'aopt', None, b'option is (ADVANCED)')])
724 > @command(b'debugoptADV', [(b'', b'aopt', None, b'option is (ADVANCED)')])
725 > @command(b'debugoptDEP', [(b'', b'dopt', None, b'option is (DEPRECATED)')])
725 > @command(b'debugoptDEP', [(b'', b'dopt', None, b'option is (DEPRECATED)')])
726 > @command(b'debugoptEXP', [(b'', b'eopt', None, b'option is (EXPERIMENTAL)')])
726 > @command(b'debugoptEXP', [(b'', b'eopt', None, b'option is (EXPERIMENTAL)')])
727 > def nohelp(ui, *args, **kwargs):
727 > def nohelp(ui, *args, **kwargs):
728 > pass
728 > pass
729 >
729 >
730 > def uisetup(ui):
730 > def uisetup(ui):
731 > ui.setconfig(b'alias', b'shellalias', b'!echo hi', b'helpext')
731 > ui.setconfig(b'alias', b'shellalias', b'!echo hi', b'helpext')
732 > ui.setconfig(b'alias', b'hgalias', b'summary', b'helpext')
732 > ui.setconfig(b'alias', b'hgalias', b'summary', b'helpext')
733 >
733 >
734 > EOF
734 > EOF
735 $ echo '[extensions]' >> $HGRCPATH
735 $ echo '[extensions]' >> $HGRCPATH
736 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
736 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
737
737
738 Test for aliases
738 Test for aliases
739
739
740 $ hg help hgalias
740 $ hg help hgalias
741 hg hgalias [--remote]
741 hg hgalias [--remote]
742
742
743 alias for: hg summary
743 alias for: hg summary
744
744
745 summarize working directory state
745 summarize working directory state
746
746
747 This generates a brief summary of the working directory state, including
747 This generates a brief summary of the working directory state, including
748 parents, branch, commit status, phase and available updates.
748 parents, branch, commit status, phase and available updates.
749
749
750 With the --remote option, this will check the default paths for incoming
750 With the --remote option, this will check the default paths for incoming
751 and outgoing changes. This can be time-consuming.
751 and outgoing changes. This can be time-consuming.
752
752
753 Returns 0 on success.
753 Returns 0 on success.
754
754
755 defined by: helpext
755 defined by: helpext
756
756
757 options:
757 options:
758
758
759 --remote check for push and pull
759 --remote check for push and pull
760
760
761 (some details hidden, use --verbose to show complete help)
761 (some details hidden, use --verbose to show complete help)
762
762
763 $ hg help shellalias
763 $ hg help shellalias
764 hg shellalias
764 hg shellalias
765
765
766 shell alias for:
766 shell alias for:
767
767
768 echo hi
768 echo hi
769
769
770 defined by: helpext
770 defined by: helpext
771
771
772 (some details hidden, use --verbose to show complete help)
772 (some details hidden, use --verbose to show complete help)
773
773
774 Test command with no help text
774 Test command with no help text
775
775
776 $ hg help nohelp
776 $ hg help nohelp
777 hg nohelp
777 hg nohelp
778
778
779 (no help text available)
779 (no help text available)
780
780
781 options:
781 options:
782
782
783 --longdesc VALUE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
783 --longdesc VALUE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
784 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (default: 3)
784 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (default: 3)
785 -n -- normal desc
785 -n -- normal desc
786 --newline VALUE line1 line2
786 --newline VALUE line1 line2
787
787
788 (some details hidden, use --verbose to show complete help)
788 (some details hidden, use --verbose to show complete help)
789
789
790 $ hg help -k nohelp
790 $ hg help -k nohelp
791 Commands:
791 Commands:
792
792
793 nohelp hg nohelp
793 nohelp hg nohelp
794
794
795 Extension Commands:
795 Extension Commands:
796
796
797 nohelp (no help text available)
797 nohelp (no help text available)
798
798
799 Test that default list of commands omits extension commands
799 Test that default list of commands omits extension commands
800
800
801 $ hg help
801 $ hg help
802 Mercurial Distributed SCM
802 Mercurial Distributed SCM
803
803
804 list of commands:
804 list of commands:
805
805
806 add add the specified files on the next commit
806 add add the specified files on the next commit
807 addremove add all new files, delete all missing files
807 addremove add all new files, delete all missing files
808 annotate show changeset information by line for each file
808 annotate show changeset information by line for each file
809 archive create an unversioned archive of a repository revision
809 archive create an unversioned archive of a repository revision
810 backout reverse effect of earlier changeset
810 backout reverse effect of earlier changeset
811 bisect subdivision search of changesets
811 bisect subdivision search of changesets
812 bookmarks create a new bookmark or list existing bookmarks
812 bookmarks create a new bookmark or list existing bookmarks
813 branch set or show the current branch name
813 branch set or show the current branch name
814 branches list repository named branches
814 branches list repository named branches
815 bundle create a bundle file
815 bundle create a bundle file
816 cat output the current or given revision of files
816 cat output the current or given revision of files
817 clone make a copy of an existing repository
817 clone make a copy of an existing repository
818 commit commit the specified files or all outstanding changes
818 commit commit the specified files or all outstanding changes
819 config show combined config settings from all hgrc files
819 config show combined config settings from all hgrc files
820 copy mark files as copied for the next commit
820 copy mark files as copied for the next commit
821 diff diff repository (or selected files)
821 diff diff repository (or selected files)
822 export dump the header and diffs for one or more changesets
822 export dump the header and diffs for one or more changesets
823 files list tracked files
823 files list tracked files
824 forget forget the specified files on the next commit
824 forget forget the specified files on the next commit
825 graft copy changes from other branches onto the current branch
825 graft copy changes from other branches onto the current branch
826 grep search revision history for a pattern in specified files
826 grep search revision history for a pattern in specified files
827 heads show branch heads
827 heads show branch heads
828 help show help for a given topic or a help overview
828 help show help for a given topic or a help overview
829 identify identify the working directory or specified revision
829 identify identify the working directory or specified revision
830 import import an ordered set of patches
830 import import an ordered set of patches
831 incoming show new changesets found in source
831 incoming show new changesets found in source
832 init create a new repository in the given directory
832 init create a new repository in the given directory
833 log show revision history of entire repository or files
833 log show revision history of entire repository or files
834 manifest output the current or given revision of the project manifest
834 manifest output the current or given revision of the project manifest
835 merge merge another revision into working directory
835 merge merge another revision into working directory
836 outgoing show changesets not found in the destination
836 outgoing show changesets not found in the destination
837 paths show aliases for remote repositories
837 paths show aliases for remote repositories
838 phase set or show the current phase name
838 phase set or show the current phase name
839 pull pull changes from the specified source
839 pull pull changes from the specified source
840 push push changes to the specified destination
840 push push changes to the specified destination
841 recover roll back an interrupted transaction
841 recover roll back an interrupted transaction
842 remove remove the specified files on the next commit
842 remove remove the specified files on the next commit
843 rename rename files; equivalent of copy + remove
843 rename rename files; equivalent of copy + remove
844 resolve redo merges or set/view the merge status of files
844 resolve redo merges or set/view the merge status of files
845 revert restore files to their checkout state
845 revert restore files to their checkout state
846 root print the root (top) of the current working directory
846 root print the root (top) of the current working directory
847 serve start stand-alone webserver
847 serve start stand-alone webserver
848 status show changed files in the working directory
848 status show changed files in the working directory
849 summary summarize working directory state
849 summary summarize working directory state
850 tag add one or more tags for the current or given revision
850 tag add one or more tags for the current or given revision
851 tags list repository tags
851 tags list repository tags
852 unbundle apply one or more bundle files
852 unbundle apply one or more bundle files
853 update update working directory (or switch revisions)
853 update update working directory (or switch revisions)
854 verify verify the integrity of the repository
854 verify verify the integrity of the repository
855 version output version and copyright information
855 version output version and copyright information
856
856
857 enabled extensions:
857 enabled extensions:
858
858
859 helpext (no help text available)
859 helpext (no help text available)
860
860
861 additional help topics:
861 additional help topics:
862
862
863 bundlespec Bundle File Formats
863 bundlespec Bundle File Formats
864 color Colorizing Outputs
864 color Colorizing Outputs
865 config Configuration Files
865 config Configuration Files
866 dates Date Formats
866 dates Date Formats
867 diffs Diff Formats
867 diffs Diff Formats
868 environment Environment Variables
868 environment Environment Variables
869 extensions Using Additional Features
869 extensions Using Additional Features
870 filesets Specifying File Sets
870 filesets Specifying File Sets
871 flags Command-line flags
871 flags Command-line flags
872 glossary Glossary
872 glossary Glossary
873 hgignore Syntax for Mercurial Ignore Files
873 hgignore Syntax for Mercurial Ignore Files
874 hgweb Configuring hgweb
874 hgweb Configuring hgweb
875 internals Technical implementation topics
875 internals Technical implementation topics
876 merge-tools Merge Tools
876 merge-tools Merge Tools
877 pager Pager Support
877 pager Pager Support
878 patterns File Name Patterns
878 patterns File Name Patterns
879 phases Working with Phases
879 phases Working with Phases
880 revisions Specifying Revisions
880 revisions Specifying Revisions
881 scripting Using Mercurial from scripts and automation
881 scripting Using Mercurial from scripts and automation
882 subrepos Subrepositories
882 subrepos Subrepositories
883 templating Template Usage
883 templating Template Usage
884 urls URL Paths
884 urls URL Paths
885
885
886 (use 'hg help -v' to show built-in aliases and global options)
886 (use 'hg help -v' to show built-in aliases and global options)
887
887
888
888
889 Test list of internal help commands
889 Test list of internal help commands
890
890
891 $ hg help debug
891 $ hg help debug
892 debug commands (internal and unsupported):
892 debug commands (internal and unsupported):
893
893
894 debugancestor
894 debugancestor
895 find the ancestor revision of two revisions in a given index
895 find the ancestor revision of two revisions in a given index
896 debugapplystreamclonebundle
896 debugapplystreamclonebundle
897 apply a stream clone bundle file
897 apply a stream clone bundle file
898 debugbuilddag
898 debugbuilddag
899 builds a repo with a given DAG from scratch in the current
899 builds a repo with a given DAG from scratch in the current
900 empty repo
900 empty repo
901 debugbundle lists the contents of a bundle
901 debugbundle lists the contents of a bundle
902 debugcapabilities
902 debugcapabilities
903 lists the capabilities of a remote peer
903 lists the capabilities of a remote peer
904 debugcheckstate
904 debugcheckstate
905 validate the correctness of the current dirstate
905 validate the correctness of the current dirstate
906 debugcolor show available color, effects or style
906 debugcolor show available color, effects or style
907 debugcommands
907 debugcommands
908 list all available commands and options
908 list all available commands and options
909 debugcomplete
909 debugcomplete
910 returns the completion list associated with the given command
910 returns the completion list associated with the given command
911 debugcreatestreamclonebundle
911 debugcreatestreamclonebundle
912 create a stream clone bundle file
912 create a stream clone bundle file
913 debugdag format the changelog or an index DAG as a concise textual
913 debugdag format the changelog or an index DAG as a concise textual
914 description
914 description
915 debugdata dump the contents of a data file revision
915 debugdata dump the contents of a data file revision
916 debugdate parse and display a date
916 debugdate parse and display a date
917 debugdeltachain
917 debugdeltachain
918 dump information about delta chains in a revlog
918 dump information about delta chains in a revlog
919 debugdirstate
919 debugdirstate
920 show the contents of the current dirstate
920 show the contents of the current dirstate
921 debugdiscovery
921 debugdiscovery
922 runs the changeset discovery protocol in isolation
922 runs the changeset discovery protocol in isolation
923 debugdownload
923 debugdownload
924 download a resource using Mercurial logic and config
924 download a resource using Mercurial logic and config
925 debugextensions
925 debugextensions
926 show information about active extensions
926 show information about active extensions
927 debugfileset parse and apply a fileset specification
927 debugfileset parse and apply a fileset specification
928 debugformat display format information about the current repository
928 debugformat display format information about the current repository
929 debugfsinfo show information detected about current filesystem
929 debugfsinfo show information detected about current filesystem
930 debuggetbundle
930 debuggetbundle
931 retrieves a bundle from a repo
931 retrieves a bundle from a repo
932 debugignore display the combined ignore pattern and information about
932 debugignore display the combined ignore pattern and information about
933 ignored files
933 ignored files
934 debugindex dump the contents of an index file
934 debugindex dump the contents of an index file
935 debugindexdot
935 debugindexdot
936 dump an index DAG as a graphviz dot file
936 dump an index DAG as a graphviz dot file
937 debuginstall test Mercurial installation
937 debuginstall test Mercurial installation
938 debugknown test whether node ids are known to a repo
938 debugknown test whether node ids are known to a repo
939 debuglocks show or modify state of locks
939 debuglocks show or modify state of locks
940 debugmergestate
940 debugmergestate
941 print merge state
941 print merge state
942 debugnamecomplete
942 debugnamecomplete
943 complete "names" - tags, open branch names, bookmark names
943 complete "names" - tags, open branch names, bookmark names
944 debugobsolete
944 debugobsolete
945 create arbitrary obsolete marker
945 create arbitrary obsolete marker
946 debugoptADV (no help text available)
946 debugoptADV (no help text available)
947 debugoptDEP (no help text available)
947 debugoptDEP (no help text available)
948 debugoptEXP (no help text available)
948 debugoptEXP (no help text available)
949 debugpathcomplete
949 debugpathcomplete
950 complete part or all of a tracked path
950 complete part or all of a tracked path
951 debugpeer establish a connection to a peer repository
951 debugpickmergetool
952 debugpickmergetool
952 examine which merge tool is chosen for specified file
953 examine which merge tool is chosen for specified file
953 debugpushkey access the pushkey key/value protocol
954 debugpushkey access the pushkey key/value protocol
954 debugpvec (no help text available)
955 debugpvec (no help text available)
955 debugrebuilddirstate
956 debugrebuilddirstate
956 rebuild the dirstate as it would look like for the given
957 rebuild the dirstate as it would look like for the given
957 revision
958 revision
958 debugrebuildfncache
959 debugrebuildfncache
959 rebuild the fncache file
960 rebuild the fncache file
960 debugrename dump rename information
961 debugrename dump rename information
961 debugrevlog show data and statistics about a revlog
962 debugrevlog show data and statistics about a revlog
962 debugrevspec parse and apply a revision specification
963 debugrevspec parse and apply a revision specification
963 debugsetparents
964 debugsetparents
964 manually set the parents of the current working directory
965 manually set the parents of the current working directory
965 debugssl test a secure connection to a server
966 debugssl test a secure connection to a server
966 debugsub (no help text available)
967 debugsub (no help text available)
967 debugsuccessorssets
968 debugsuccessorssets
968 show set of successors for revision
969 show set of successors for revision
969 debugtemplate
970 debugtemplate
970 parse and apply a template
971 parse and apply a template
971 debugupdatecaches
972 debugupdatecaches
972 warm all known caches in the repository
973 warm all known caches in the repository
973 debugupgraderepo
974 debugupgraderepo
974 upgrade a repository to use different features
975 upgrade a repository to use different features
975 debugwalk show how files match on given patterns
976 debugwalk show how files match on given patterns
976 debugwireargs
977 debugwireargs
977 (no help text available)
978 (no help text available)
978
979
979 (use 'hg help -v debug' to show built-in aliases and global options)
980 (use 'hg help -v debug' to show built-in aliases and global options)
980
981
981 internals topic renders index of available sub-topics
982 internals topic renders index of available sub-topics
982
983
983 $ hg help internals
984 $ hg help internals
984 Technical implementation topics
985 Technical implementation topics
985 """""""""""""""""""""""""""""""
986 """""""""""""""""""""""""""""""
986
987
987 To access a subtopic, use "hg help internals.{subtopic-name}"
988 To access a subtopic, use "hg help internals.{subtopic-name}"
988
989
989 bundles Bundles
990 bundles Bundles
990 censor Censor
991 censor Censor
991 changegroups Changegroups
992 changegroups Changegroups
992 config Config Registrar
993 config Config Registrar
993 requirements Repository Requirements
994 requirements Repository Requirements
994 revlogs Revision Logs
995 revlogs Revision Logs
995 wireprotocol Wire Protocol
996 wireprotocol Wire Protocol
996
997
997 sub-topics can be accessed
998 sub-topics can be accessed
998
999
999 $ hg help internals.changegroups
1000 $ hg help internals.changegroups
1000 Changegroups
1001 Changegroups
1001 """"""""""""
1002 """"""""""""
1002
1003
1003 Changegroups are representations of repository revlog data, specifically
1004 Changegroups are representations of repository revlog data, specifically
1004 the changelog data, root/flat manifest data, treemanifest data, and
1005 the changelog data, root/flat manifest data, treemanifest data, and
1005 filelogs.
1006 filelogs.
1006
1007
1007 There are 3 versions of changegroups: "1", "2", and "3". From a high-
1008 There are 3 versions of changegroups: "1", "2", and "3". From a high-
1008 level, versions "1" and "2" are almost exactly the same, with the only
1009 level, versions "1" and "2" are almost exactly the same, with the only
1009 difference being an additional item in the *delta header*. Version "3"
1010 difference being an additional item in the *delta header*. Version "3"
1010 adds support for revlog flags in the *delta header* and optionally
1011 adds support for revlog flags in the *delta header* and optionally
1011 exchanging treemanifests (enabled by setting an option on the
1012 exchanging treemanifests (enabled by setting an option on the
1012 "changegroup" part in the bundle2).
1013 "changegroup" part in the bundle2).
1013
1014
1014 Changegroups when not exchanging treemanifests consist of 3 logical
1015 Changegroups when not exchanging treemanifests consist of 3 logical
1015 segments:
1016 segments:
1016
1017
1017 +---------------------------------+
1018 +---------------------------------+
1018 | | | |
1019 | | | |
1019 | changeset | manifest | filelogs |
1020 | changeset | manifest | filelogs |
1020 | | | |
1021 | | | |
1021 | | | |
1022 | | | |
1022 +---------------------------------+
1023 +---------------------------------+
1023
1024
1024 When exchanging treemanifests, there are 4 logical segments:
1025 When exchanging treemanifests, there are 4 logical segments:
1025
1026
1026 +-------------------------------------------------+
1027 +-------------------------------------------------+
1027 | | | | |
1028 | | | | |
1028 | changeset | root | treemanifests | filelogs |
1029 | changeset | root | treemanifests | filelogs |
1029 | | manifest | | |
1030 | | manifest | | |
1030 | | | | |
1031 | | | | |
1031 +-------------------------------------------------+
1032 +-------------------------------------------------+
1032
1033
1033 The principle building block of each segment is a *chunk*. A *chunk* is a
1034 The principle building block of each segment is a *chunk*. A *chunk* is a
1034 framed piece of data:
1035 framed piece of data:
1035
1036
1036 +---------------------------------------+
1037 +---------------------------------------+
1037 | | |
1038 | | |
1038 | length | data |
1039 | length | data |
1039 | (4 bytes) | (<length - 4> bytes) |
1040 | (4 bytes) | (<length - 4> bytes) |
1040 | | |
1041 | | |
1041 +---------------------------------------+
1042 +---------------------------------------+
1042
1043
1043 All integers are big-endian signed integers. Each chunk starts with a
1044 All integers are big-endian signed integers. Each chunk starts with a
1044 32-bit integer indicating the length of the entire chunk (including the
1045 32-bit integer indicating the length of the entire chunk (including the
1045 length field itself).
1046 length field itself).
1046
1047
1047 There is a special case chunk that has a value of 0 for the length
1048 There is a special case chunk that has a value of 0 for the length
1048 ("0x00000000"). We call this an *empty chunk*.
1049 ("0x00000000"). We call this an *empty chunk*.
1049
1050
1050 Delta Groups
1051 Delta Groups
1051 ============
1052 ============
1052
1053
1053 A *delta group* expresses the content of a revlog as a series of deltas,
1054 A *delta group* expresses the content of a revlog as a series of deltas,
1054 or patches against previous revisions.
1055 or patches against previous revisions.
1055
1056
1056 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
1057 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
1057 to signal the end of the delta group:
1058 to signal the end of the delta group:
1058
1059
1059 +------------------------------------------------------------------------+
1060 +------------------------------------------------------------------------+
1060 | | | | | |
1061 | | | | | |
1061 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
1062 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
1062 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
1063 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
1063 | | | | | |
1064 | | | | | |
1064 +------------------------------------------------------------------------+
1065 +------------------------------------------------------------------------+
1065
1066
1066 Each *chunk*'s data consists of the following:
1067 Each *chunk*'s data consists of the following:
1067
1068
1068 +---------------------------------------+
1069 +---------------------------------------+
1069 | | |
1070 | | |
1070 | delta header | delta data |
1071 | delta header | delta data |
1071 | (various by version) | (various) |
1072 | (various by version) | (various) |
1072 | | |
1073 | | |
1073 +---------------------------------------+
1074 +---------------------------------------+
1074
1075
1075 The *delta data* is a series of *delta*s that describe a diff from an
1076 The *delta data* is a series of *delta*s that describe a diff from an
1076 existing entry (either that the recipient already has, or previously
1077 existing entry (either that the recipient already has, or previously
1077 specified in the bundle/changegroup).
1078 specified in the bundle/changegroup).
1078
1079
1079 The *delta header* is different between versions "1", "2", and "3" of the
1080 The *delta header* is different between versions "1", "2", and "3" of the
1080 changegroup format.
1081 changegroup format.
1081
1082
1082 Version 1 (headerlen=80):
1083 Version 1 (headerlen=80):
1083
1084
1084 +------------------------------------------------------+
1085 +------------------------------------------------------+
1085 | | | | |
1086 | | | | |
1086 | node | p1 node | p2 node | link node |
1087 | node | p1 node | p2 node | link node |
1087 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1088 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1088 | | | | |
1089 | | | | |
1089 +------------------------------------------------------+
1090 +------------------------------------------------------+
1090
1091
1091 Version 2 (headerlen=100):
1092 Version 2 (headerlen=100):
1092
1093
1093 +------------------------------------------------------------------+
1094 +------------------------------------------------------------------+
1094 | | | | | |
1095 | | | | | |
1095 | node | p1 node | p2 node | base node | link node |
1096 | node | p1 node | p2 node | base node | link node |
1096 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1097 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1097 | | | | | |
1098 | | | | | |
1098 +------------------------------------------------------------------+
1099 +------------------------------------------------------------------+
1099
1100
1100 Version 3 (headerlen=102):
1101 Version 3 (headerlen=102):
1101
1102
1102 +------------------------------------------------------------------------------+
1103 +------------------------------------------------------------------------------+
1103 | | | | | | |
1104 | | | | | | |
1104 | node | p1 node | p2 node | base node | link node | flags |
1105 | node | p1 node | p2 node | base node | link node | flags |
1105 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
1106 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
1106 | | | | | | |
1107 | | | | | | |
1107 +------------------------------------------------------------------------------+
1108 +------------------------------------------------------------------------------+
1108
1109
1109 The *delta data* consists of "chunklen - 4 - headerlen" bytes, which
1110 The *delta data* consists of "chunklen - 4 - headerlen" bytes, which
1110 contain a series of *delta*s, densely packed (no separators). These deltas
1111 contain a series of *delta*s, densely packed (no separators). These deltas
1111 describe a diff from an existing entry (either that the recipient already
1112 describe a diff from an existing entry (either that the recipient already
1112 has, or previously specified in the bundle/changegroup). The format is
1113 has, or previously specified in the bundle/changegroup). The format is
1113 described more fully in "hg help internals.bdiff", but briefly:
1114 described more fully in "hg help internals.bdiff", but briefly:
1114
1115
1115 +---------------------------------------------------------------+
1116 +---------------------------------------------------------------+
1116 | | | | |
1117 | | | | |
1117 | start offset | end offset | new length | content |
1118 | start offset | end offset | new length | content |
1118 | (4 bytes) | (4 bytes) | (4 bytes) | (<new length> bytes) |
1119 | (4 bytes) | (4 bytes) | (4 bytes) | (<new length> bytes) |
1119 | | | | |
1120 | | | | |
1120 +---------------------------------------------------------------+
1121 +---------------------------------------------------------------+
1121
1122
1122 Please note that the length field in the delta data does *not* include
1123 Please note that the length field in the delta data does *not* include
1123 itself.
1124 itself.
1124
1125
1125 In version 1, the delta is always applied against the previous node from
1126 In version 1, the delta is always applied against the previous node from
1126 the changegroup or the first parent if this is the first entry in the
1127 the changegroup or the first parent if this is the first entry in the
1127 changegroup.
1128 changegroup.
1128
1129
1129 In version 2 and up, the delta base node is encoded in the entry in the
1130 In version 2 and up, the delta base node is encoded in the entry in the
1130 changegroup. This allows the delta to be expressed against any parent,
1131 changegroup. This allows the delta to be expressed against any parent,
1131 which can result in smaller deltas and more efficient encoding of data.
1132 which can result in smaller deltas and more efficient encoding of data.
1132
1133
1133 Changeset Segment
1134 Changeset Segment
1134 =================
1135 =================
1135
1136
1136 The *changeset segment* consists of a single *delta group* holding
1137 The *changeset segment* consists of a single *delta group* holding
1137 changelog data. The *empty chunk* at the end of the *delta group* denotes
1138 changelog data. The *empty chunk* at the end of the *delta group* denotes
1138 the boundary to the *manifest segment*.
1139 the boundary to the *manifest segment*.
1139
1140
1140 Manifest Segment
1141 Manifest Segment
1141 ================
1142 ================
1142
1143
1143 The *manifest segment* consists of a single *delta group* holding manifest
1144 The *manifest segment* consists of a single *delta group* holding manifest
1144 data. If treemanifests are in use, it contains only the manifest for the
1145 data. If treemanifests are in use, it contains only the manifest for the
1145 root directory of the repository. Otherwise, it contains the entire
1146 root directory of the repository. Otherwise, it contains the entire
1146 manifest data. The *empty chunk* at the end of the *delta group* denotes
1147 manifest data. The *empty chunk* at the end of the *delta group* denotes
1147 the boundary to the next segment (either the *treemanifests segment* or
1148 the boundary to the next segment (either the *treemanifests segment* or
1148 the *filelogs segment*, depending on version and the request options).
1149 the *filelogs segment*, depending on version and the request options).
1149
1150
1150 Treemanifests Segment
1151 Treemanifests Segment
1151 ---------------------
1152 ---------------------
1152
1153
1153 The *treemanifests segment* only exists in changegroup version "3", and
1154 The *treemanifests segment* only exists in changegroup version "3", and
1154 only if the 'treemanifest' param is part of the bundle2 changegroup part
1155 only if the 'treemanifest' param is part of the bundle2 changegroup part
1155 (it is not possible to use changegroup version 3 outside of bundle2).
1156 (it is not possible to use changegroup version 3 outside of bundle2).
1156 Aside from the filenames in the *treemanifests segment* containing a
1157 Aside from the filenames in the *treemanifests segment* containing a
1157 trailing "/" character, it behaves identically to the *filelogs segment*
1158 trailing "/" character, it behaves identically to the *filelogs segment*
1158 (see below). The final sub-segment is followed by an *empty chunk*
1159 (see below). The final sub-segment is followed by an *empty chunk*
1159 (logically, a sub-segment with filename size 0). This denotes the boundary
1160 (logically, a sub-segment with filename size 0). This denotes the boundary
1160 to the *filelogs segment*.
1161 to the *filelogs segment*.
1161
1162
1162 Filelogs Segment
1163 Filelogs Segment
1163 ================
1164 ================
1164
1165
1165 The *filelogs segment* consists of multiple sub-segments, each
1166 The *filelogs segment* consists of multiple sub-segments, each
1166 corresponding to an individual file whose data is being described:
1167 corresponding to an individual file whose data is being described:
1167
1168
1168 +--------------------------------------------------+
1169 +--------------------------------------------------+
1169 | | | | | |
1170 | | | | | |
1170 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
1171 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
1171 | | | | | (4 bytes) |
1172 | | | | | (4 bytes) |
1172 | | | | | |
1173 | | | | | |
1173 +--------------------------------------------------+
1174 +--------------------------------------------------+
1174
1175
1175 The final filelog sub-segment is followed by an *empty chunk* (logically,
1176 The final filelog sub-segment is followed by an *empty chunk* (logically,
1176 a sub-segment with filename size 0). This denotes the end of the segment
1177 a sub-segment with filename size 0). This denotes the end of the segment
1177 and of the overall changegroup.
1178 and of the overall changegroup.
1178
1179
1179 Each filelog sub-segment consists of the following:
1180 Each filelog sub-segment consists of the following:
1180
1181
1181 +------------------------------------------------------+
1182 +------------------------------------------------------+
1182 | | | |
1183 | | | |
1183 | filename length | filename | delta group |
1184 | filename length | filename | delta group |
1184 | (4 bytes) | (<length - 4> bytes) | (various) |
1185 | (4 bytes) | (<length - 4> bytes) | (various) |
1185 | | | |
1186 | | | |
1186 +------------------------------------------------------+
1187 +------------------------------------------------------+
1187
1188
1188 That is, a *chunk* consisting of the filename (not terminated or padded)
1189 That is, a *chunk* consisting of the filename (not terminated or padded)
1189 followed by N chunks constituting the *delta group* for this file. The
1190 followed by N chunks constituting the *delta group* for this file. The
1190 *empty chunk* at the end of each *delta group* denotes the boundary to the
1191 *empty chunk* at the end of each *delta group* denotes the boundary to the
1191 next filelog sub-segment.
1192 next filelog sub-segment.
1192
1193
1193 Test list of commands with command with no help text
1194 Test list of commands with command with no help text
1194
1195
1195 $ hg help helpext
1196 $ hg help helpext
1196 helpext extension - no help text available
1197 helpext extension - no help text available
1197
1198
1198 list of commands:
1199 list of commands:
1199
1200
1200 nohelp (no help text available)
1201 nohelp (no help text available)
1201
1202
1202 (use 'hg help -v helpext' to show built-in aliases and global options)
1203 (use 'hg help -v helpext' to show built-in aliases and global options)
1203
1204
1204
1205
1205 test advanced, deprecated and experimental options are hidden in command help
1206 test advanced, deprecated and experimental options are hidden in command help
1206 $ hg help debugoptADV
1207 $ hg help debugoptADV
1207 hg debugoptADV
1208 hg debugoptADV
1208
1209
1209 (no help text available)
1210 (no help text available)
1210
1211
1211 options:
1212 options:
1212
1213
1213 (some details hidden, use --verbose to show complete help)
1214 (some details hidden, use --verbose to show complete help)
1214 $ hg help debugoptDEP
1215 $ hg help debugoptDEP
1215 hg debugoptDEP
1216 hg debugoptDEP
1216
1217
1217 (no help text available)
1218 (no help text available)
1218
1219
1219 options:
1220 options:
1220
1221
1221 (some details hidden, use --verbose to show complete help)
1222 (some details hidden, use --verbose to show complete help)
1222
1223
1223 $ hg help debugoptEXP
1224 $ hg help debugoptEXP
1224 hg debugoptEXP
1225 hg debugoptEXP
1225
1226
1226 (no help text available)
1227 (no help text available)
1227
1228
1228 options:
1229 options:
1229
1230
1230 (some details hidden, use --verbose to show complete help)
1231 (some details hidden, use --verbose to show complete help)
1231
1232
1232 test advanced, deprecated and experimental options are shown with -v
1233 test advanced, deprecated and experimental options are shown with -v
1233 $ hg help -v debugoptADV | grep aopt
1234 $ hg help -v debugoptADV | grep aopt
1234 --aopt option is (ADVANCED)
1235 --aopt option is (ADVANCED)
1235 $ hg help -v debugoptDEP | grep dopt
1236 $ hg help -v debugoptDEP | grep dopt
1236 --dopt option is (DEPRECATED)
1237 --dopt option is (DEPRECATED)
1237 $ hg help -v debugoptEXP | grep eopt
1238 $ hg help -v debugoptEXP | grep eopt
1238 --eopt option is (EXPERIMENTAL)
1239 --eopt option is (EXPERIMENTAL)
1239
1240
1240 #if gettext
1241 #if gettext
1241 test deprecated option is hidden with translation with untranslated description
1242 test deprecated option is hidden with translation with untranslated description
1242 (use many globy for not failing on changed transaction)
1243 (use many globy for not failing on changed transaction)
1243 $ LANGUAGE=sv hg help debugoptDEP
1244 $ LANGUAGE=sv hg help debugoptDEP
1244 hg debugoptDEP
1245 hg debugoptDEP
1245
1246
1246 (*) (glob)
1247 (*) (glob)
1247
1248
1248 options:
1249 options:
1249
1250
1250 (some details hidden, use --verbose to show complete help)
1251 (some details hidden, use --verbose to show complete help)
1251 #endif
1252 #endif
1252
1253
1253 Test commands that collide with topics (issue4240)
1254 Test commands that collide with topics (issue4240)
1254
1255
1255 $ hg config -hq
1256 $ hg config -hq
1256 hg config [-u] [NAME]...
1257 hg config [-u] [NAME]...
1257
1258
1258 show combined config settings from all hgrc files
1259 show combined config settings from all hgrc files
1259 $ hg showconfig -hq
1260 $ hg showconfig -hq
1260 hg config [-u] [NAME]...
1261 hg config [-u] [NAME]...
1261
1262
1262 show combined config settings from all hgrc files
1263 show combined config settings from all hgrc files
1263
1264
1264 Test a help topic
1265 Test a help topic
1265
1266
1266 $ hg help dates
1267 $ hg help dates
1267 Date Formats
1268 Date Formats
1268 """"""""""""
1269 """"""""""""
1269
1270
1270 Some commands allow the user to specify a date, e.g.:
1271 Some commands allow the user to specify a date, e.g.:
1271
1272
1272 - backout, commit, import, tag: Specify the commit date.
1273 - backout, commit, import, tag: Specify the commit date.
1273 - log, revert, update: Select revision(s) by date.
1274 - log, revert, update: Select revision(s) by date.
1274
1275
1275 Many date formats are valid. Here are some examples:
1276 Many date formats are valid. Here are some examples:
1276
1277
1277 - "Wed Dec 6 13:18:29 2006" (local timezone assumed)
1278 - "Wed Dec 6 13:18:29 2006" (local timezone assumed)
1278 - "Dec 6 13:18 -0600" (year assumed, time offset provided)
1279 - "Dec 6 13:18 -0600" (year assumed, time offset provided)
1279 - "Dec 6 13:18 UTC" (UTC and GMT are aliases for +0000)
1280 - "Dec 6 13:18 UTC" (UTC and GMT are aliases for +0000)
1280 - "Dec 6" (midnight)
1281 - "Dec 6" (midnight)
1281 - "13:18" (today assumed)
1282 - "13:18" (today assumed)
1282 - "3:39" (3:39AM assumed)
1283 - "3:39" (3:39AM assumed)
1283 - "3:39pm" (15:39)
1284 - "3:39pm" (15:39)
1284 - "2006-12-06 13:18:29" (ISO 8601 format)
1285 - "2006-12-06 13:18:29" (ISO 8601 format)
1285 - "2006-12-6 13:18"
1286 - "2006-12-6 13:18"
1286 - "2006-12-6"
1287 - "2006-12-6"
1287 - "12-6"
1288 - "12-6"
1288 - "12/6"
1289 - "12/6"
1289 - "12/6/6" (Dec 6 2006)
1290 - "12/6/6" (Dec 6 2006)
1290 - "today" (midnight)
1291 - "today" (midnight)
1291 - "yesterday" (midnight)
1292 - "yesterday" (midnight)
1292 - "now" - right now
1293 - "now" - right now
1293
1294
1294 Lastly, there is Mercurial's internal format:
1295 Lastly, there is Mercurial's internal format:
1295
1296
1296 - "1165411109 0" (Wed Dec 6 13:18:29 2006 UTC)
1297 - "1165411109 0" (Wed Dec 6 13:18:29 2006 UTC)
1297
1298
1298 This is the internal representation format for dates. The first number is
1299 This is the internal representation format for dates. The first number is
1299 the number of seconds since the epoch (1970-01-01 00:00 UTC). The second
1300 the number of seconds since the epoch (1970-01-01 00:00 UTC). The second
1300 is the offset of the local timezone, in seconds west of UTC (negative if
1301 is the offset of the local timezone, in seconds west of UTC (negative if
1301 the timezone is east of UTC).
1302 the timezone is east of UTC).
1302
1303
1303 The log command also accepts date ranges:
1304 The log command also accepts date ranges:
1304
1305
1305 - "<DATE" - at or before a given date/time
1306 - "<DATE" - at or before a given date/time
1306 - ">DATE" - on or after a given date/time
1307 - ">DATE" - on or after a given date/time
1307 - "DATE to DATE" - a date range, inclusive
1308 - "DATE to DATE" - a date range, inclusive
1308 - "-DAYS" - within a given number of days of today
1309 - "-DAYS" - within a given number of days of today
1309
1310
1310 Test repeated config section name
1311 Test repeated config section name
1311
1312
1312 $ hg help config.host
1313 $ hg help config.host
1313 "http_proxy.host"
1314 "http_proxy.host"
1314 Host name and (optional) port of the proxy server, for example
1315 Host name and (optional) port of the proxy server, for example
1315 "myproxy:8000".
1316 "myproxy:8000".
1316
1317
1317 "smtp.host"
1318 "smtp.host"
1318 Host name of mail server, e.g. "mail.example.com".
1319 Host name of mail server, e.g. "mail.example.com".
1319
1320
1320 Unrelated trailing paragraphs shouldn't be included
1321 Unrelated trailing paragraphs shouldn't be included
1321
1322
1322 $ hg help config.extramsg | grep '^$'
1323 $ hg help config.extramsg | grep '^$'
1323
1324
1324
1325
1325 Test capitalized section name
1326 Test capitalized section name
1326
1327
1327 $ hg help scripting.HGPLAIN > /dev/null
1328 $ hg help scripting.HGPLAIN > /dev/null
1328
1329
1329 Help subsection:
1330 Help subsection:
1330
1331
1331 $ hg help config.charsets |grep "Email example:" > /dev/null
1332 $ hg help config.charsets |grep "Email example:" > /dev/null
1332 [1]
1333 [1]
1333
1334
1334 Show nested definitions
1335 Show nested definitions
1335 ("profiling.type"[break]"ls"[break]"stat"[break])
1336 ("profiling.type"[break]"ls"[break]"stat"[break])
1336
1337
1337 $ hg help config.type | egrep '^$'|wc -l
1338 $ hg help config.type | egrep '^$'|wc -l
1338 \s*3 (re)
1339 \s*3 (re)
1339
1340
1340 Separate sections from subsections
1341 Separate sections from subsections
1341
1342
1342 $ hg help config.format | egrep '^ ("|-)|^\s*$' | uniq
1343 $ hg help config.format | egrep '^ ("|-)|^\s*$' | uniq
1343 "format"
1344 "format"
1344 --------
1345 --------
1345
1346
1346 "usegeneraldelta"
1347 "usegeneraldelta"
1347
1348
1348 "dotencode"
1349 "dotencode"
1349
1350
1350 "usefncache"
1351 "usefncache"
1351
1352
1352 "usestore"
1353 "usestore"
1353
1354
1354 "profiling"
1355 "profiling"
1355 -----------
1356 -----------
1356
1357
1357 "format"
1358 "format"
1358
1359
1359 "progress"
1360 "progress"
1360 ----------
1361 ----------
1361
1362
1362 "format"
1363 "format"
1363
1364
1364
1365
1365 Last item in help config.*:
1366 Last item in help config.*:
1366
1367
1367 $ hg help config.`hg help config|grep '^ "'| \
1368 $ hg help config.`hg help config|grep '^ "'| \
1368 > tail -1|sed 's![ "]*!!g'`| \
1369 > tail -1|sed 's![ "]*!!g'`| \
1369 > grep 'hg help -c config' > /dev/null
1370 > grep 'hg help -c config' > /dev/null
1370 [1]
1371 [1]
1371
1372
1372 note to use help -c for general hg help config:
1373 note to use help -c for general hg help config:
1373
1374
1374 $ hg help config |grep 'hg help -c config' > /dev/null
1375 $ hg help config |grep 'hg help -c config' > /dev/null
1375
1376
1376 Test templating help
1377 Test templating help
1377
1378
1378 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
1379 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
1379 desc String. The text of the changeset description.
1380 desc String. The text of the changeset description.
1380 diffstat String. Statistics of changes with the following format:
1381 diffstat String. Statistics of changes with the following format:
1381 firstline Any text. Returns the first line of text.
1382 firstline Any text. Returns the first line of text.
1382 nonempty Any text. Returns '(none)' if the string is empty.
1383 nonempty Any text. Returns '(none)' if the string is empty.
1383
1384
1384 Test deprecated items
1385 Test deprecated items
1385
1386
1386 $ hg help -v templating | grep currentbookmark
1387 $ hg help -v templating | grep currentbookmark
1387 currentbookmark
1388 currentbookmark
1388 $ hg help templating | (grep currentbookmark || true)
1389 $ hg help templating | (grep currentbookmark || true)
1389
1390
1390 Test help hooks
1391 Test help hooks
1391
1392
1392 $ cat > helphook1.py <<EOF
1393 $ cat > helphook1.py <<EOF
1393 > from mercurial import help
1394 > from mercurial import help
1394 >
1395 >
1395 > def rewrite(ui, topic, doc):
1396 > def rewrite(ui, topic, doc):
1396 > return doc + '\nhelphook1\n'
1397 > return doc + '\nhelphook1\n'
1397 >
1398 >
1398 > def extsetup(ui):
1399 > def extsetup(ui):
1399 > help.addtopichook('revisions', rewrite)
1400 > help.addtopichook('revisions', rewrite)
1400 > EOF
1401 > EOF
1401 $ cat > helphook2.py <<EOF
1402 $ cat > helphook2.py <<EOF
1402 > from mercurial import help
1403 > from mercurial import help
1403 >
1404 >
1404 > def rewrite(ui, topic, doc):
1405 > def rewrite(ui, topic, doc):
1405 > return doc + '\nhelphook2\n'
1406 > return doc + '\nhelphook2\n'
1406 >
1407 >
1407 > def extsetup(ui):
1408 > def extsetup(ui):
1408 > help.addtopichook('revisions', rewrite)
1409 > help.addtopichook('revisions', rewrite)
1409 > EOF
1410 > EOF
1410 $ echo '[extensions]' >> $HGRCPATH
1411 $ echo '[extensions]' >> $HGRCPATH
1411 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
1412 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
1412 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
1413 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
1413 $ hg help revsets | grep helphook
1414 $ hg help revsets | grep helphook
1414 helphook1
1415 helphook1
1415 helphook2
1416 helphook2
1416
1417
1417 help -c should only show debug --debug
1418 help -c should only show debug --debug
1418
1419
1419 $ hg help -c --debug|egrep debug|wc -l|egrep '^\s*0\s*$'
1420 $ hg help -c --debug|egrep debug|wc -l|egrep '^\s*0\s*$'
1420 [1]
1421 [1]
1421
1422
1422 help -c should only show deprecated for -v
1423 help -c should only show deprecated for -v
1423
1424
1424 $ hg help -c -v|egrep DEPRECATED|wc -l|egrep '^\s*0\s*$'
1425 $ hg help -c -v|egrep DEPRECATED|wc -l|egrep '^\s*0\s*$'
1425 [1]
1426 [1]
1426
1427
1427 Test -s / --system
1428 Test -s / --system
1428
1429
1429 $ hg help config.files -s windows |grep 'etc/mercurial' | \
1430 $ hg help config.files -s windows |grep 'etc/mercurial' | \
1430 > wc -l | sed -e 's/ //g'
1431 > wc -l | sed -e 's/ //g'
1431 0
1432 0
1432 $ hg help config.files --system unix | grep 'USER' | \
1433 $ hg help config.files --system unix | grep 'USER' | \
1433 > wc -l | sed -e 's/ //g'
1434 > wc -l | sed -e 's/ //g'
1434 0
1435 0
1435
1436
1436 Test -e / -c / -k combinations
1437 Test -e / -c / -k combinations
1437
1438
1438 $ hg help -c|egrep '^[A-Z].*:|^ debug'
1439 $ hg help -c|egrep '^[A-Z].*:|^ debug'
1439 Commands:
1440 Commands:
1440 $ hg help -e|egrep '^[A-Z].*:|^ debug'
1441 $ hg help -e|egrep '^[A-Z].*:|^ debug'
1441 Extensions:
1442 Extensions:
1442 $ hg help -k|egrep '^[A-Z].*:|^ debug'
1443 $ hg help -k|egrep '^[A-Z].*:|^ debug'
1443 Topics:
1444 Topics:
1444 Commands:
1445 Commands:
1445 Extensions:
1446 Extensions:
1446 Extension Commands:
1447 Extension Commands:
1447 $ hg help -c schemes
1448 $ hg help -c schemes
1448 abort: no such help topic: schemes
1449 abort: no such help topic: schemes
1449 (try 'hg help --keyword schemes')
1450 (try 'hg help --keyword schemes')
1450 [255]
1451 [255]
1451 $ hg help -e schemes |head -1
1452 $ hg help -e schemes |head -1
1452 schemes extension - extend schemes with shortcuts to repository swarms
1453 schemes extension - extend schemes with shortcuts to repository swarms
1453 $ hg help -c -k dates |egrep '^(Topics|Extensions|Commands):'
1454 $ hg help -c -k dates |egrep '^(Topics|Extensions|Commands):'
1454 Commands:
1455 Commands:
1455 $ hg help -e -k a |egrep '^(Topics|Extensions|Commands):'
1456 $ hg help -e -k a |egrep '^(Topics|Extensions|Commands):'
1456 Extensions:
1457 Extensions:
1457 $ hg help -e -c -k date |egrep '^(Topics|Extensions|Commands):'
1458 $ hg help -e -c -k date |egrep '^(Topics|Extensions|Commands):'
1458 Extensions:
1459 Extensions:
1459 Commands:
1460 Commands:
1460 $ hg help -c commit > /dev/null
1461 $ hg help -c commit > /dev/null
1461 $ hg help -e -c commit > /dev/null
1462 $ hg help -e -c commit > /dev/null
1462 $ hg help -e commit > /dev/null
1463 $ hg help -e commit > /dev/null
1463 abort: no such help topic: commit
1464 abort: no such help topic: commit
1464 (try 'hg help --keyword commit')
1465 (try 'hg help --keyword commit')
1465 [255]
1466 [255]
1466
1467
1467 Test keyword search help
1468 Test keyword search help
1468
1469
1469 $ cat > prefixedname.py <<EOF
1470 $ cat > prefixedname.py <<EOF
1470 > '''matched against word "clone"
1471 > '''matched against word "clone"
1471 > '''
1472 > '''
1472 > EOF
1473 > EOF
1473 $ echo '[extensions]' >> $HGRCPATH
1474 $ echo '[extensions]' >> $HGRCPATH
1474 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
1475 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
1475 $ hg help -k clone
1476 $ hg help -k clone
1476 Topics:
1477 Topics:
1477
1478
1478 config Configuration Files
1479 config Configuration Files
1479 extensions Using Additional Features
1480 extensions Using Additional Features
1480 glossary Glossary
1481 glossary Glossary
1481 phases Working with Phases
1482 phases Working with Phases
1482 subrepos Subrepositories
1483 subrepos Subrepositories
1483 urls URL Paths
1484 urls URL Paths
1484
1485
1485 Commands:
1486 Commands:
1486
1487
1487 bookmarks create a new bookmark or list existing bookmarks
1488 bookmarks create a new bookmark or list existing bookmarks
1488 clone make a copy of an existing repository
1489 clone make a copy of an existing repository
1489 paths show aliases for remote repositories
1490 paths show aliases for remote repositories
1490 update update working directory (or switch revisions)
1491 update update working directory (or switch revisions)
1491
1492
1492 Extensions:
1493 Extensions:
1493
1494
1494 clonebundles advertise pre-generated bundles to seed clones
1495 clonebundles advertise pre-generated bundles to seed clones
1495 prefixedname matched against word "clone"
1496 prefixedname matched against word "clone"
1496 relink recreates hardlinks between repository clones
1497 relink recreates hardlinks between repository clones
1497
1498
1498 Extension Commands:
1499 Extension Commands:
1499
1500
1500 qclone clone main and patch repository at same time
1501 qclone clone main and patch repository at same time
1501
1502
1502 Test unfound topic
1503 Test unfound topic
1503
1504
1504 $ hg help nonexistingtopicthatwillneverexisteverever
1505 $ hg help nonexistingtopicthatwillneverexisteverever
1505 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
1506 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
1506 (try 'hg help --keyword nonexistingtopicthatwillneverexisteverever')
1507 (try 'hg help --keyword nonexistingtopicthatwillneverexisteverever')
1507 [255]
1508 [255]
1508
1509
1509 Test unfound keyword
1510 Test unfound keyword
1510
1511
1511 $ hg help --keyword nonexistingwordthatwillneverexisteverever
1512 $ hg help --keyword nonexistingwordthatwillneverexisteverever
1512 abort: no matches
1513 abort: no matches
1513 (try 'hg help' for a list of topics)
1514 (try 'hg help' for a list of topics)
1514 [255]
1515 [255]
1515
1516
1516 Test omit indicating for help
1517 Test omit indicating for help
1517
1518
1518 $ cat > addverboseitems.py <<EOF
1519 $ cat > addverboseitems.py <<EOF
1519 > '''extension to test omit indicating.
1520 > '''extension to test omit indicating.
1520 >
1521 >
1521 > This paragraph is never omitted (for extension)
1522 > This paragraph is never omitted (for extension)
1522 >
1523 >
1523 > .. container:: verbose
1524 > .. container:: verbose
1524 >
1525 >
1525 > This paragraph is omitted,
1526 > This paragraph is omitted,
1526 > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension)
1527 > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension)
1527 >
1528 >
1528 > This paragraph is never omitted, too (for extension)
1529 > This paragraph is never omitted, too (for extension)
1529 > '''
1530 > '''
1530 > from __future__ import absolute_import
1531 > from __future__ import absolute_import
1531 > from mercurial import commands, help
1532 > from mercurial import commands, help
1532 > testtopic = """This paragraph is never omitted (for topic).
1533 > testtopic = """This paragraph is never omitted (for topic).
1533 >
1534 >
1534 > .. container:: verbose
1535 > .. container:: verbose
1535 >
1536 >
1536 > This paragraph is omitted,
1537 > This paragraph is omitted,
1537 > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic)
1538 > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic)
1538 >
1539 >
1539 > This paragraph is never omitted, too (for topic)
1540 > This paragraph is never omitted, too (for topic)
1540 > """
1541 > """
1541 > def extsetup(ui):
1542 > def extsetup(ui):
1542 > help.helptable.append((["topic-containing-verbose"],
1543 > help.helptable.append((["topic-containing-verbose"],
1543 > "This is the topic to test omit indicating.",
1544 > "This is the topic to test omit indicating.",
1544 > lambda ui: testtopic))
1545 > lambda ui: testtopic))
1545 > EOF
1546 > EOF
1546 $ echo '[extensions]' >> $HGRCPATH
1547 $ echo '[extensions]' >> $HGRCPATH
1547 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1548 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1548 $ hg help addverboseitems
1549 $ hg help addverboseitems
1549 addverboseitems extension - extension to test omit indicating.
1550 addverboseitems extension - extension to test omit indicating.
1550
1551
1551 This paragraph is never omitted (for extension)
1552 This paragraph is never omitted (for extension)
1552
1553
1553 This paragraph is never omitted, too (for extension)
1554 This paragraph is never omitted, too (for extension)
1554
1555
1555 (some details hidden, use --verbose to show complete help)
1556 (some details hidden, use --verbose to show complete help)
1556
1557
1557 no commands defined
1558 no commands defined
1558 $ hg help -v addverboseitems
1559 $ hg help -v addverboseitems
1559 addverboseitems extension - extension to test omit indicating.
1560 addverboseitems extension - extension to test omit indicating.
1560
1561
1561 This paragraph is never omitted (for extension)
1562 This paragraph is never omitted (for extension)
1562
1563
1563 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1564 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1564 extension)
1565 extension)
1565
1566
1566 This paragraph is never omitted, too (for extension)
1567 This paragraph is never omitted, too (for extension)
1567
1568
1568 no commands defined
1569 no commands defined
1569 $ hg help topic-containing-verbose
1570 $ hg help topic-containing-verbose
1570 This is the topic to test omit indicating.
1571 This is the topic to test omit indicating.
1571 """"""""""""""""""""""""""""""""""""""""""
1572 """"""""""""""""""""""""""""""""""""""""""
1572
1573
1573 This paragraph is never omitted (for topic).
1574 This paragraph is never omitted (for topic).
1574
1575
1575 This paragraph is never omitted, too (for topic)
1576 This paragraph is never omitted, too (for topic)
1576
1577
1577 (some details hidden, use --verbose to show complete help)
1578 (some details hidden, use --verbose to show complete help)
1578 $ hg help -v topic-containing-verbose
1579 $ hg help -v topic-containing-verbose
1579 This is the topic to test omit indicating.
1580 This is the topic to test omit indicating.
1580 """"""""""""""""""""""""""""""""""""""""""
1581 """"""""""""""""""""""""""""""""""""""""""
1581
1582
1582 This paragraph is never omitted (for topic).
1583 This paragraph is never omitted (for topic).
1583
1584
1584 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1585 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1585 topic)
1586 topic)
1586
1587
1587 This paragraph is never omitted, too (for topic)
1588 This paragraph is never omitted, too (for topic)
1588
1589
1589 Test section lookup
1590 Test section lookup
1590
1591
1591 $ hg help revset.merge
1592 $ hg help revset.merge
1592 "merge()"
1593 "merge()"
1593 Changeset is a merge changeset.
1594 Changeset is a merge changeset.
1594
1595
1595 $ hg help glossary.dag
1596 $ hg help glossary.dag
1596 DAG
1597 DAG
1597 The repository of changesets of a distributed version control system
1598 The repository of changesets of a distributed version control system
1598 (DVCS) can be described as a directed acyclic graph (DAG), consisting
1599 (DVCS) can be described as a directed acyclic graph (DAG), consisting
1599 of nodes and edges, where nodes correspond to changesets and edges
1600 of nodes and edges, where nodes correspond to changesets and edges
1600 imply a parent -> child relation. This graph can be visualized by
1601 imply a parent -> child relation. This graph can be visualized by
1601 graphical tools such as 'hg log --graph'. In Mercurial, the DAG is
1602 graphical tools such as 'hg log --graph'. In Mercurial, the DAG is
1602 limited by the requirement for children to have at most two parents.
1603 limited by the requirement for children to have at most two parents.
1603
1604
1604
1605
1605 $ hg help hgrc.paths
1606 $ hg help hgrc.paths
1606 "paths"
1607 "paths"
1607 -------
1608 -------
1608
1609
1609 Assigns symbolic names and behavior to repositories.
1610 Assigns symbolic names and behavior to repositories.
1610
1611
1611 Options are symbolic names defining the URL or directory that is the
1612 Options are symbolic names defining the URL or directory that is the
1612 location of the repository. Example:
1613 location of the repository. Example:
1613
1614
1614 [paths]
1615 [paths]
1615 my_server = https://example.com/my_repo
1616 my_server = https://example.com/my_repo
1616 local_path = /home/me/repo
1617 local_path = /home/me/repo
1617
1618
1618 These symbolic names can be used from the command line. To pull from
1619 These symbolic names can be used from the command line. To pull from
1619 "my_server": 'hg pull my_server'. To push to "local_path": 'hg push
1620 "my_server": 'hg pull my_server'. To push to "local_path": 'hg push
1620 local_path'.
1621 local_path'.
1621
1622
1622 Options containing colons (":") denote sub-options that can influence
1623 Options containing colons (":") denote sub-options that can influence
1623 behavior for that specific path. Example:
1624 behavior for that specific path. Example:
1624
1625
1625 [paths]
1626 [paths]
1626 my_server = https://example.com/my_path
1627 my_server = https://example.com/my_path
1627 my_server:pushurl = ssh://example.com/my_path
1628 my_server:pushurl = ssh://example.com/my_path
1628
1629
1629 The following sub-options can be defined:
1630 The following sub-options can be defined:
1630
1631
1631 "pushurl"
1632 "pushurl"
1632 The URL to use for push operations. If not defined, the location
1633 The URL to use for push operations. If not defined, the location
1633 defined by the path's main entry is used.
1634 defined by the path's main entry is used.
1634
1635
1635 "pushrev"
1636 "pushrev"
1636 A revset defining which revisions to push by default.
1637 A revset defining which revisions to push by default.
1637
1638
1638 When 'hg push' is executed without a "-r" argument, the revset defined
1639 When 'hg push' is executed without a "-r" argument, the revset defined
1639 by this sub-option is evaluated to determine what to push.
1640 by this sub-option is evaluated to determine what to push.
1640
1641
1641 For example, a value of "." will push the working directory's revision
1642 For example, a value of "." will push the working directory's revision
1642 by default.
1643 by default.
1643
1644
1644 Revsets specifying bookmarks will not result in the bookmark being
1645 Revsets specifying bookmarks will not result in the bookmark being
1645 pushed.
1646 pushed.
1646
1647
1647 The following special named paths exist:
1648 The following special named paths exist:
1648
1649
1649 "default"
1650 "default"
1650 The URL or directory to use when no source or remote is specified.
1651 The URL or directory to use when no source or remote is specified.
1651
1652
1652 'hg clone' will automatically define this path to the location the
1653 'hg clone' will automatically define this path to the location the
1653 repository was cloned from.
1654 repository was cloned from.
1654
1655
1655 "default-push"
1656 "default-push"
1656 (deprecated) The URL or directory for the default 'hg push' location.
1657 (deprecated) The URL or directory for the default 'hg push' location.
1657 "default:pushurl" should be used instead.
1658 "default:pushurl" should be used instead.
1658
1659
1659 $ hg help glossary.mcguffin
1660 $ hg help glossary.mcguffin
1660 abort: help section not found: glossary.mcguffin
1661 abort: help section not found: glossary.mcguffin
1661 [255]
1662 [255]
1662
1663
1663 $ hg help glossary.mc.guffin
1664 $ hg help glossary.mc.guffin
1664 abort: help section not found: glossary.mc.guffin
1665 abort: help section not found: glossary.mc.guffin
1665 [255]
1666 [255]
1666
1667
1667 $ hg help template.files
1668 $ hg help template.files
1668 files List of strings. All files modified, added, or removed by
1669 files List of strings. All files modified, added, or removed by
1669 this changeset.
1670 this changeset.
1670 files(pattern)
1671 files(pattern)
1671 All files of the current changeset matching the pattern. See
1672 All files of the current changeset matching the pattern. See
1672 'hg help patterns'.
1673 'hg help patterns'.
1673
1674
1674 Test section lookup by translated message
1675 Test section lookup by translated message
1675
1676
1676 str.lower() instead of encoding.lower(str) on translated message might
1677 str.lower() instead of encoding.lower(str) on translated message might
1677 make message meaningless, because some encoding uses 0x41(A) - 0x5a(Z)
1678 make message meaningless, because some encoding uses 0x41(A) - 0x5a(Z)
1678 as the second or later byte of multi-byte character.
1679 as the second or later byte of multi-byte character.
1679
1680
1680 For example, "\x8bL\x98^" (translation of "record" in ja_JP.cp932)
1681 For example, "\x8bL\x98^" (translation of "record" in ja_JP.cp932)
1681 contains 0x4c (L). str.lower() replaces 0x4c(L) by 0x6c(l) and this
1682 contains 0x4c (L). str.lower() replaces 0x4c(L) by 0x6c(l) and this
1682 replacement makes message meaningless.
1683 replacement makes message meaningless.
1683
1684
1684 This tests that section lookup by translated string isn't broken by
1685 This tests that section lookup by translated string isn't broken by
1685 such str.lower().
1686 such str.lower().
1686
1687
1687 $ $PYTHON <<EOF
1688 $ $PYTHON <<EOF
1688 > def escape(s):
1689 > def escape(s):
1689 > return ''.join('\u%x' % ord(uc) for uc in s.decode('cp932'))
1690 > return ''.join('\u%x' % ord(uc) for uc in s.decode('cp932'))
1690 > # translation of "record" in ja_JP.cp932
1691 > # translation of "record" in ja_JP.cp932
1691 > upper = "\x8bL\x98^"
1692 > upper = "\x8bL\x98^"
1692 > # str.lower()-ed section name should be treated as different one
1693 > # str.lower()-ed section name should be treated as different one
1693 > lower = "\x8bl\x98^"
1694 > lower = "\x8bl\x98^"
1694 > with open('ambiguous.py', 'w') as fp:
1695 > with open('ambiguous.py', 'w') as fp:
1695 > fp.write("""# ambiguous section names in ja_JP.cp932
1696 > fp.write("""# ambiguous section names in ja_JP.cp932
1696 > u'''summary of extension
1697 > u'''summary of extension
1697 >
1698 >
1698 > %s
1699 > %s
1699 > ----
1700 > ----
1700 >
1701 >
1701 > Upper name should show only this message
1702 > Upper name should show only this message
1702 >
1703 >
1703 > %s
1704 > %s
1704 > ----
1705 > ----
1705 >
1706 >
1706 > Lower name should show only this message
1707 > Lower name should show only this message
1707 >
1708 >
1708 > subsequent section
1709 > subsequent section
1709 > ------------------
1710 > ------------------
1710 >
1711 >
1711 > This should be hidden at 'hg help ambiguous' with section name.
1712 > This should be hidden at 'hg help ambiguous' with section name.
1712 > '''
1713 > '''
1713 > """ % (escape(upper), escape(lower)))
1714 > """ % (escape(upper), escape(lower)))
1714 > EOF
1715 > EOF
1715
1716
1716 $ cat >> $HGRCPATH <<EOF
1717 $ cat >> $HGRCPATH <<EOF
1717 > [extensions]
1718 > [extensions]
1718 > ambiguous = ./ambiguous.py
1719 > ambiguous = ./ambiguous.py
1719 > EOF
1720 > EOF
1720
1721
1721 $ $PYTHON <<EOF | sh
1722 $ $PYTHON <<EOF | sh
1722 > upper = "\x8bL\x98^"
1723 > upper = "\x8bL\x98^"
1723 > print("hg --encoding cp932 help -e ambiguous.%s" % upper)
1724 > print("hg --encoding cp932 help -e ambiguous.%s" % upper)
1724 > EOF
1725 > EOF
1725 \x8bL\x98^ (esc)
1726 \x8bL\x98^ (esc)
1726 ----
1727 ----
1727
1728
1728 Upper name should show only this message
1729 Upper name should show only this message
1729
1730
1730
1731
1731 $ $PYTHON <<EOF | sh
1732 $ $PYTHON <<EOF | sh
1732 > lower = "\x8bl\x98^"
1733 > lower = "\x8bl\x98^"
1733 > print("hg --encoding cp932 help -e ambiguous.%s" % lower)
1734 > print("hg --encoding cp932 help -e ambiguous.%s" % lower)
1734 > EOF
1735 > EOF
1735 \x8bl\x98^ (esc)
1736 \x8bl\x98^ (esc)
1736 ----
1737 ----
1737
1738
1738 Lower name should show only this message
1739 Lower name should show only this message
1739
1740
1740
1741
1741 $ cat >> $HGRCPATH <<EOF
1742 $ cat >> $HGRCPATH <<EOF
1742 > [extensions]
1743 > [extensions]
1743 > ambiguous = !
1744 > ambiguous = !
1744 > EOF
1745 > EOF
1745
1746
1746 Show help content of disabled extensions
1747 Show help content of disabled extensions
1747
1748
1748 $ cat >> $HGRCPATH <<EOF
1749 $ cat >> $HGRCPATH <<EOF
1749 > [extensions]
1750 > [extensions]
1750 > ambiguous = !./ambiguous.py
1751 > ambiguous = !./ambiguous.py
1751 > EOF
1752 > EOF
1752 $ hg help -e ambiguous
1753 $ hg help -e ambiguous
1753 ambiguous extension - (no help text available)
1754 ambiguous extension - (no help text available)
1754
1755
1755 (use 'hg help extensions' for information on enabling extensions)
1756 (use 'hg help extensions' for information on enabling extensions)
1756
1757
1757 Test dynamic list of merge tools only shows up once
1758 Test dynamic list of merge tools only shows up once
1758 $ hg help merge-tools
1759 $ hg help merge-tools
1759 Merge Tools
1760 Merge Tools
1760 """""""""""
1761 """""""""""
1761
1762
1762 To merge files Mercurial uses merge tools.
1763 To merge files Mercurial uses merge tools.
1763
1764
1764 A merge tool combines two different versions of a file into a merged file.
1765 A merge tool combines two different versions of a file into a merged file.
1765 Merge tools are given the two files and the greatest common ancestor of
1766 Merge tools are given the two files and the greatest common ancestor of
1766 the two file versions, so they can determine the changes made on both
1767 the two file versions, so they can determine the changes made on both
1767 branches.
1768 branches.
1768
1769
1769 Merge tools are used both for 'hg resolve', 'hg merge', 'hg update', 'hg
1770 Merge tools are used both for 'hg resolve', 'hg merge', 'hg update', 'hg
1770 backout' and in several extensions.
1771 backout' and in several extensions.
1771
1772
1772 Usually, the merge tool tries to automatically reconcile the files by
1773 Usually, the merge tool tries to automatically reconcile the files by
1773 combining all non-overlapping changes that occurred separately in the two
1774 combining all non-overlapping changes that occurred separately in the two
1774 different evolutions of the same initial base file. Furthermore, some
1775 different evolutions of the same initial base file. Furthermore, some
1775 interactive merge programs make it easier to manually resolve conflicting
1776 interactive merge programs make it easier to manually resolve conflicting
1776 merges, either in a graphical way, or by inserting some conflict markers.
1777 merges, either in a graphical way, or by inserting some conflict markers.
1777 Mercurial does not include any interactive merge programs but relies on
1778 Mercurial does not include any interactive merge programs but relies on
1778 external tools for that.
1779 external tools for that.
1779
1780
1780 Available merge tools
1781 Available merge tools
1781 =====================
1782 =====================
1782
1783
1783 External merge tools and their properties are configured in the merge-
1784 External merge tools and their properties are configured in the merge-
1784 tools configuration section - see hgrc(5) - but they can often just be
1785 tools configuration section - see hgrc(5) - but they can often just be
1785 named by their executable.
1786 named by their executable.
1786
1787
1787 A merge tool is generally usable if its executable can be found on the
1788 A merge tool is generally usable if its executable can be found on the
1788 system and if it can handle the merge. The executable is found if it is an
1789 system and if it can handle the merge. The executable is found if it is an
1789 absolute or relative executable path or the name of an application in the
1790 absolute or relative executable path or the name of an application in the
1790 executable search path. The tool is assumed to be able to handle the merge
1791 executable search path. The tool is assumed to be able to handle the merge
1791 if it can handle symlinks if the file is a symlink, if it can handle
1792 if it can handle symlinks if the file is a symlink, if it can handle
1792 binary files if the file is binary, and if a GUI is available if the tool
1793 binary files if the file is binary, and if a GUI is available if the tool
1793 requires a GUI.
1794 requires a GUI.
1794
1795
1795 There are some internal merge tools which can be used. The internal merge
1796 There are some internal merge tools which can be used. The internal merge
1796 tools are:
1797 tools are:
1797
1798
1798 ":dump"
1799 ":dump"
1799 Creates three versions of the files to merge, containing the contents of
1800 Creates three versions of the files to merge, containing the contents of
1800 local, other and base. These files can then be used to perform a merge
1801 local, other and base. These files can then be used to perform a merge
1801 manually. If the file to be merged is named "a.txt", these files will
1802 manually. If the file to be merged is named "a.txt", these files will
1802 accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and
1803 accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and
1803 they will be placed in the same directory as "a.txt".
1804 they will be placed in the same directory as "a.txt".
1804
1805
1805 This implies premerge. Therefore, files aren't dumped, if premerge runs
1806 This implies premerge. Therefore, files aren't dumped, if premerge runs
1806 successfully. Use :forcedump to forcibly write files out.
1807 successfully. Use :forcedump to forcibly write files out.
1807
1808
1808 ":fail"
1809 ":fail"
1809 Rather than attempting to merge files that were modified on both
1810 Rather than attempting to merge files that were modified on both
1810 branches, it marks them as unresolved. The resolve command must be used
1811 branches, it marks them as unresolved. The resolve command must be used
1811 to resolve these conflicts.
1812 to resolve these conflicts.
1812
1813
1813 ":forcedump"
1814 ":forcedump"
1814 Creates three versions of the files as same as :dump, but omits
1815 Creates three versions of the files as same as :dump, but omits
1815 premerge.
1816 premerge.
1816
1817
1817 ":local"
1818 ":local"
1818 Uses the local 'p1()' version of files as the merged version.
1819 Uses the local 'p1()' version of files as the merged version.
1819
1820
1820 ":merge"
1821 ":merge"
1821 Uses the internal non-interactive simple merge algorithm for merging
1822 Uses the internal non-interactive simple merge algorithm for merging
1822 files. It will fail if there are any conflicts and leave markers in the
1823 files. It will fail if there are any conflicts and leave markers in the
1823 partially merged file. Markers will have two sections, one for each side
1824 partially merged file. Markers will have two sections, one for each side
1824 of merge.
1825 of merge.
1825
1826
1826 ":merge-local"
1827 ":merge-local"
1827 Like :merge, but resolve all conflicts non-interactively in favor of the
1828 Like :merge, but resolve all conflicts non-interactively in favor of the
1828 local 'p1()' changes.
1829 local 'p1()' changes.
1829
1830
1830 ":merge-other"
1831 ":merge-other"
1831 Like :merge, but resolve all conflicts non-interactively in favor of the
1832 Like :merge, but resolve all conflicts non-interactively in favor of the
1832 other 'p2()' changes.
1833 other 'p2()' changes.
1833
1834
1834 ":merge3"
1835 ":merge3"
1835 Uses the internal non-interactive simple merge algorithm for merging
1836 Uses the internal non-interactive simple merge algorithm for merging
1836 files. It will fail if there are any conflicts and leave markers in the
1837 files. It will fail if there are any conflicts and leave markers in the
1837 partially merged file. Marker will have three sections, one from each
1838 partially merged file. Marker will have three sections, one from each
1838 side of the merge and one for the base content.
1839 side of the merge and one for the base content.
1839
1840
1840 ":other"
1841 ":other"
1841 Uses the other 'p2()' version of files as the merged version.
1842 Uses the other 'p2()' version of files as the merged version.
1842
1843
1843 ":prompt"
1844 ":prompt"
1844 Asks the user which of the local 'p1()' or the other 'p2()' version to
1845 Asks the user which of the local 'p1()' or the other 'p2()' version to
1845 keep as the merged version.
1846 keep as the merged version.
1846
1847
1847 ":tagmerge"
1848 ":tagmerge"
1848 Uses the internal tag merge algorithm (experimental).
1849 Uses the internal tag merge algorithm (experimental).
1849
1850
1850 ":union"
1851 ":union"
1851 Uses the internal non-interactive simple merge algorithm for merging
1852 Uses the internal non-interactive simple merge algorithm for merging
1852 files. It will use both left and right sides for conflict regions. No
1853 files. It will use both left and right sides for conflict regions. No
1853 markers are inserted.
1854 markers are inserted.
1854
1855
1855 Internal tools are always available and do not require a GUI but will by
1856 Internal tools are always available and do not require a GUI but will by
1856 default not handle symlinks or binary files.
1857 default not handle symlinks or binary files.
1857
1858
1858 Choosing a merge tool
1859 Choosing a merge tool
1859 =====================
1860 =====================
1860
1861
1861 Mercurial uses these rules when deciding which merge tool to use:
1862 Mercurial uses these rules when deciding which merge tool to use:
1862
1863
1863 1. If a tool has been specified with the --tool option to merge or
1864 1. If a tool has been specified with the --tool option to merge or
1864 resolve, it is used. If it is the name of a tool in the merge-tools
1865 resolve, it is used. If it is the name of a tool in the merge-tools
1865 configuration, its configuration is used. Otherwise the specified tool
1866 configuration, its configuration is used. Otherwise the specified tool
1866 must be executable by the shell.
1867 must be executable by the shell.
1867 2. If the "HGMERGE" environment variable is present, its value is used and
1868 2. If the "HGMERGE" environment variable is present, its value is used and
1868 must be executable by the shell.
1869 must be executable by the shell.
1869 3. If the filename of the file to be merged matches any of the patterns in
1870 3. If the filename of the file to be merged matches any of the patterns in
1870 the merge-patterns configuration section, the first usable merge tool
1871 the merge-patterns configuration section, the first usable merge tool
1871 corresponding to a matching pattern is used. Here, binary capabilities
1872 corresponding to a matching pattern is used. Here, binary capabilities
1872 of the merge tool are not considered.
1873 of the merge tool are not considered.
1873 4. If ui.merge is set it will be considered next. If the value is not the
1874 4. If ui.merge is set it will be considered next. If the value is not the
1874 name of a configured tool, the specified value is used and must be
1875 name of a configured tool, the specified value is used and must be
1875 executable by the shell. Otherwise the named tool is used if it is
1876 executable by the shell. Otherwise the named tool is used if it is
1876 usable.
1877 usable.
1877 5. If any usable merge tools are present in the merge-tools configuration
1878 5. If any usable merge tools are present in the merge-tools configuration
1878 section, the one with the highest priority is used.
1879 section, the one with the highest priority is used.
1879 6. If a program named "hgmerge" can be found on the system, it is used -
1880 6. If a program named "hgmerge" can be found on the system, it is used -
1880 but it will by default not be used for symlinks and binary files.
1881 but it will by default not be used for symlinks and binary files.
1881 7. If the file to be merged is not binary and is not a symlink, then
1882 7. If the file to be merged is not binary and is not a symlink, then
1882 internal ":merge" is used.
1883 internal ":merge" is used.
1883 8. Otherwise, ":prompt" is used.
1884 8. Otherwise, ":prompt" is used.
1884
1885
1885 Note:
1886 Note:
1886 After selecting a merge program, Mercurial will by default attempt to
1887 After selecting a merge program, Mercurial will by default attempt to
1887 merge the files using a simple merge algorithm first. Only if it
1888 merge the files using a simple merge algorithm first. Only if it
1888 doesn't succeed because of conflicting changes will Mercurial actually
1889 doesn't succeed because of conflicting changes will Mercurial actually
1889 execute the merge program. Whether to use the simple merge algorithm
1890 execute the merge program. Whether to use the simple merge algorithm
1890 first can be controlled by the premerge setting of the merge tool.
1891 first can be controlled by the premerge setting of the merge tool.
1891 Premerge is enabled by default unless the file is binary or a symlink.
1892 Premerge is enabled by default unless the file is binary or a symlink.
1892
1893
1893 See the merge-tools and ui sections of hgrc(5) for details on the
1894 See the merge-tools and ui sections of hgrc(5) for details on the
1894 configuration of merge tools.
1895 configuration of merge tools.
1895
1896
1896 Compression engines listed in `hg help bundlespec`
1897 Compression engines listed in `hg help bundlespec`
1897
1898
1898 $ hg help bundlespec | grep gzip
1899 $ hg help bundlespec | grep gzip
1899 "v1" bundles can only use the "gzip", "bzip2", and "none" compression
1900 "v1" bundles can only use the "gzip", "bzip2", and "none" compression
1900 An algorithm that produces smaller bundles than "gzip".
1901 An algorithm that produces smaller bundles than "gzip".
1901 This engine will likely produce smaller bundles than "gzip" but will be
1902 This engine will likely produce smaller bundles than "gzip" but will be
1902 "gzip"
1903 "gzip"
1903 better compression than "gzip". It also frequently yields better (?)
1904 better compression than "gzip". It also frequently yields better (?)
1904
1905
1905 Test usage of section marks in help documents
1906 Test usage of section marks in help documents
1906
1907
1907 $ cd "$TESTDIR"/../doc
1908 $ cd "$TESTDIR"/../doc
1908 $ $PYTHON check-seclevel.py
1909 $ $PYTHON check-seclevel.py
1909 $ cd $TESTTMP
1910 $ cd $TESTTMP
1910
1911
1911 #if serve
1912 #if serve
1912
1913
1913 Test the help pages in hgweb.
1914 Test the help pages in hgweb.
1914
1915
1915 Dish up an empty repo; serve it cold.
1916 Dish up an empty repo; serve it cold.
1916
1917
1917 $ hg init "$TESTTMP/test"
1918 $ hg init "$TESTTMP/test"
1918 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
1919 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
1919 $ cat hg.pid >> $DAEMON_PIDS
1920 $ cat hg.pid >> $DAEMON_PIDS
1920
1921
1921 $ get-with-headers.py $LOCALIP:$HGPORT "help"
1922 $ get-with-headers.py $LOCALIP:$HGPORT "help"
1922 200 Script output follows
1923 200 Script output follows
1923
1924
1924 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1925 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1925 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1926 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1926 <head>
1927 <head>
1927 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1928 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1928 <meta name="robots" content="index, nofollow" />
1929 <meta name="robots" content="index, nofollow" />
1929 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1930 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1930 <script type="text/javascript" src="/static/mercurial.js"></script>
1931 <script type="text/javascript" src="/static/mercurial.js"></script>
1931
1932
1932 <title>Help: Index</title>
1933 <title>Help: Index</title>
1933 </head>
1934 </head>
1934 <body>
1935 <body>
1935
1936
1936 <div class="container">
1937 <div class="container">
1937 <div class="menu">
1938 <div class="menu">
1938 <div class="logo">
1939 <div class="logo">
1939 <a href="https://mercurial-scm.org/">
1940 <a href="https://mercurial-scm.org/">
1940 <img src="/static/hglogo.png" alt="mercurial" /></a>
1941 <img src="/static/hglogo.png" alt="mercurial" /></a>
1941 </div>
1942 </div>
1942 <ul>
1943 <ul>
1943 <li><a href="/shortlog">log</a></li>
1944 <li><a href="/shortlog">log</a></li>
1944 <li><a href="/graph">graph</a></li>
1945 <li><a href="/graph">graph</a></li>
1945 <li><a href="/tags">tags</a></li>
1946 <li><a href="/tags">tags</a></li>
1946 <li><a href="/bookmarks">bookmarks</a></li>
1947 <li><a href="/bookmarks">bookmarks</a></li>
1947 <li><a href="/branches">branches</a></li>
1948 <li><a href="/branches">branches</a></li>
1948 </ul>
1949 </ul>
1949 <ul>
1950 <ul>
1950 <li class="active">help</li>
1951 <li class="active">help</li>
1951 </ul>
1952 </ul>
1952 </div>
1953 </div>
1953
1954
1954 <div class="main">
1955 <div class="main">
1955 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1956 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1956
1957
1957 <form class="search" action="/log">
1958 <form class="search" action="/log">
1958
1959
1959 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
1960 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
1960 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1961 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1961 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1962 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1962 </form>
1963 </form>
1963 <table class="bigtable">
1964 <table class="bigtable">
1964 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
1965 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
1965
1966
1966 <tr><td>
1967 <tr><td>
1967 <a href="/help/bundlespec">
1968 <a href="/help/bundlespec">
1968 bundlespec
1969 bundlespec
1969 </a>
1970 </a>
1970 </td><td>
1971 </td><td>
1971 Bundle File Formats
1972 Bundle File Formats
1972 </td></tr>
1973 </td></tr>
1973 <tr><td>
1974 <tr><td>
1974 <a href="/help/color">
1975 <a href="/help/color">
1975 color
1976 color
1976 </a>
1977 </a>
1977 </td><td>
1978 </td><td>
1978 Colorizing Outputs
1979 Colorizing Outputs
1979 </td></tr>
1980 </td></tr>
1980 <tr><td>
1981 <tr><td>
1981 <a href="/help/config">
1982 <a href="/help/config">
1982 config
1983 config
1983 </a>
1984 </a>
1984 </td><td>
1985 </td><td>
1985 Configuration Files
1986 Configuration Files
1986 </td></tr>
1987 </td></tr>
1987 <tr><td>
1988 <tr><td>
1988 <a href="/help/dates">
1989 <a href="/help/dates">
1989 dates
1990 dates
1990 </a>
1991 </a>
1991 </td><td>
1992 </td><td>
1992 Date Formats
1993 Date Formats
1993 </td></tr>
1994 </td></tr>
1994 <tr><td>
1995 <tr><td>
1995 <a href="/help/diffs">
1996 <a href="/help/diffs">
1996 diffs
1997 diffs
1997 </a>
1998 </a>
1998 </td><td>
1999 </td><td>
1999 Diff Formats
2000 Diff Formats
2000 </td></tr>
2001 </td></tr>
2001 <tr><td>
2002 <tr><td>
2002 <a href="/help/environment">
2003 <a href="/help/environment">
2003 environment
2004 environment
2004 </a>
2005 </a>
2005 </td><td>
2006 </td><td>
2006 Environment Variables
2007 Environment Variables
2007 </td></tr>
2008 </td></tr>
2008 <tr><td>
2009 <tr><td>
2009 <a href="/help/extensions">
2010 <a href="/help/extensions">
2010 extensions
2011 extensions
2011 </a>
2012 </a>
2012 </td><td>
2013 </td><td>
2013 Using Additional Features
2014 Using Additional Features
2014 </td></tr>
2015 </td></tr>
2015 <tr><td>
2016 <tr><td>
2016 <a href="/help/filesets">
2017 <a href="/help/filesets">
2017 filesets
2018 filesets
2018 </a>
2019 </a>
2019 </td><td>
2020 </td><td>
2020 Specifying File Sets
2021 Specifying File Sets
2021 </td></tr>
2022 </td></tr>
2022 <tr><td>
2023 <tr><td>
2023 <a href="/help/flags">
2024 <a href="/help/flags">
2024 flags
2025 flags
2025 </a>
2026 </a>
2026 </td><td>
2027 </td><td>
2027 Command-line flags
2028 Command-line flags
2028 </td></tr>
2029 </td></tr>
2029 <tr><td>
2030 <tr><td>
2030 <a href="/help/glossary">
2031 <a href="/help/glossary">
2031 glossary
2032 glossary
2032 </a>
2033 </a>
2033 </td><td>
2034 </td><td>
2034 Glossary
2035 Glossary
2035 </td></tr>
2036 </td></tr>
2036 <tr><td>
2037 <tr><td>
2037 <a href="/help/hgignore">
2038 <a href="/help/hgignore">
2038 hgignore
2039 hgignore
2039 </a>
2040 </a>
2040 </td><td>
2041 </td><td>
2041 Syntax for Mercurial Ignore Files
2042 Syntax for Mercurial Ignore Files
2042 </td></tr>
2043 </td></tr>
2043 <tr><td>
2044 <tr><td>
2044 <a href="/help/hgweb">
2045 <a href="/help/hgweb">
2045 hgweb
2046 hgweb
2046 </a>
2047 </a>
2047 </td><td>
2048 </td><td>
2048 Configuring hgweb
2049 Configuring hgweb
2049 </td></tr>
2050 </td></tr>
2050 <tr><td>
2051 <tr><td>
2051 <a href="/help/internals">
2052 <a href="/help/internals">
2052 internals
2053 internals
2053 </a>
2054 </a>
2054 </td><td>
2055 </td><td>
2055 Technical implementation topics
2056 Technical implementation topics
2056 </td></tr>
2057 </td></tr>
2057 <tr><td>
2058 <tr><td>
2058 <a href="/help/merge-tools">
2059 <a href="/help/merge-tools">
2059 merge-tools
2060 merge-tools
2060 </a>
2061 </a>
2061 </td><td>
2062 </td><td>
2062 Merge Tools
2063 Merge Tools
2063 </td></tr>
2064 </td></tr>
2064 <tr><td>
2065 <tr><td>
2065 <a href="/help/pager">
2066 <a href="/help/pager">
2066 pager
2067 pager
2067 </a>
2068 </a>
2068 </td><td>
2069 </td><td>
2069 Pager Support
2070 Pager Support
2070 </td></tr>
2071 </td></tr>
2071 <tr><td>
2072 <tr><td>
2072 <a href="/help/patterns">
2073 <a href="/help/patterns">
2073 patterns
2074 patterns
2074 </a>
2075 </a>
2075 </td><td>
2076 </td><td>
2076 File Name Patterns
2077 File Name Patterns
2077 </td></tr>
2078 </td></tr>
2078 <tr><td>
2079 <tr><td>
2079 <a href="/help/phases">
2080 <a href="/help/phases">
2080 phases
2081 phases
2081 </a>
2082 </a>
2082 </td><td>
2083 </td><td>
2083 Working with Phases
2084 Working with Phases
2084 </td></tr>
2085 </td></tr>
2085 <tr><td>
2086 <tr><td>
2086 <a href="/help/revisions">
2087 <a href="/help/revisions">
2087 revisions
2088 revisions
2088 </a>
2089 </a>
2089 </td><td>
2090 </td><td>
2090 Specifying Revisions
2091 Specifying Revisions
2091 </td></tr>
2092 </td></tr>
2092 <tr><td>
2093 <tr><td>
2093 <a href="/help/scripting">
2094 <a href="/help/scripting">
2094 scripting
2095 scripting
2095 </a>
2096 </a>
2096 </td><td>
2097 </td><td>
2097 Using Mercurial from scripts and automation
2098 Using Mercurial from scripts and automation
2098 </td></tr>
2099 </td></tr>
2099 <tr><td>
2100 <tr><td>
2100 <a href="/help/subrepos">
2101 <a href="/help/subrepos">
2101 subrepos
2102 subrepos
2102 </a>
2103 </a>
2103 </td><td>
2104 </td><td>
2104 Subrepositories
2105 Subrepositories
2105 </td></tr>
2106 </td></tr>
2106 <tr><td>
2107 <tr><td>
2107 <a href="/help/templating">
2108 <a href="/help/templating">
2108 templating
2109 templating
2109 </a>
2110 </a>
2110 </td><td>
2111 </td><td>
2111 Template Usage
2112 Template Usage
2112 </td></tr>
2113 </td></tr>
2113 <tr><td>
2114 <tr><td>
2114 <a href="/help/urls">
2115 <a href="/help/urls">
2115 urls
2116 urls
2116 </a>
2117 </a>
2117 </td><td>
2118 </td><td>
2118 URL Paths
2119 URL Paths
2119 </td></tr>
2120 </td></tr>
2120 <tr><td>
2121 <tr><td>
2121 <a href="/help/topic-containing-verbose">
2122 <a href="/help/topic-containing-verbose">
2122 topic-containing-verbose
2123 topic-containing-verbose
2123 </a>
2124 </a>
2124 </td><td>
2125 </td><td>
2125 This is the topic to test omit indicating.
2126 This is the topic to test omit indicating.
2126 </td></tr>
2127 </td></tr>
2127
2128
2128
2129
2129 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
2130 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
2130
2131
2131 <tr><td>
2132 <tr><td>
2132 <a href="/help/add">
2133 <a href="/help/add">
2133 add
2134 add
2134 </a>
2135 </a>
2135 </td><td>
2136 </td><td>
2136 add the specified files on the next commit
2137 add the specified files on the next commit
2137 </td></tr>
2138 </td></tr>
2138 <tr><td>
2139 <tr><td>
2139 <a href="/help/annotate">
2140 <a href="/help/annotate">
2140 annotate
2141 annotate
2141 </a>
2142 </a>
2142 </td><td>
2143 </td><td>
2143 show changeset information by line for each file
2144 show changeset information by line for each file
2144 </td></tr>
2145 </td></tr>
2145 <tr><td>
2146 <tr><td>
2146 <a href="/help/clone">
2147 <a href="/help/clone">
2147 clone
2148 clone
2148 </a>
2149 </a>
2149 </td><td>
2150 </td><td>
2150 make a copy of an existing repository
2151 make a copy of an existing repository
2151 </td></tr>
2152 </td></tr>
2152 <tr><td>
2153 <tr><td>
2153 <a href="/help/commit">
2154 <a href="/help/commit">
2154 commit
2155 commit
2155 </a>
2156 </a>
2156 </td><td>
2157 </td><td>
2157 commit the specified files or all outstanding changes
2158 commit the specified files or all outstanding changes
2158 </td></tr>
2159 </td></tr>
2159 <tr><td>
2160 <tr><td>
2160 <a href="/help/diff">
2161 <a href="/help/diff">
2161 diff
2162 diff
2162 </a>
2163 </a>
2163 </td><td>
2164 </td><td>
2164 diff repository (or selected files)
2165 diff repository (or selected files)
2165 </td></tr>
2166 </td></tr>
2166 <tr><td>
2167 <tr><td>
2167 <a href="/help/export">
2168 <a href="/help/export">
2168 export
2169 export
2169 </a>
2170 </a>
2170 </td><td>
2171 </td><td>
2171 dump the header and diffs for one or more changesets
2172 dump the header and diffs for one or more changesets
2172 </td></tr>
2173 </td></tr>
2173 <tr><td>
2174 <tr><td>
2174 <a href="/help/forget">
2175 <a href="/help/forget">
2175 forget
2176 forget
2176 </a>
2177 </a>
2177 </td><td>
2178 </td><td>
2178 forget the specified files on the next commit
2179 forget the specified files on the next commit
2179 </td></tr>
2180 </td></tr>
2180 <tr><td>
2181 <tr><td>
2181 <a href="/help/init">
2182 <a href="/help/init">
2182 init
2183 init
2183 </a>
2184 </a>
2184 </td><td>
2185 </td><td>
2185 create a new repository in the given directory
2186 create a new repository in the given directory
2186 </td></tr>
2187 </td></tr>
2187 <tr><td>
2188 <tr><td>
2188 <a href="/help/log">
2189 <a href="/help/log">
2189 log
2190 log
2190 </a>
2191 </a>
2191 </td><td>
2192 </td><td>
2192 show revision history of entire repository or files
2193 show revision history of entire repository or files
2193 </td></tr>
2194 </td></tr>
2194 <tr><td>
2195 <tr><td>
2195 <a href="/help/merge">
2196 <a href="/help/merge">
2196 merge
2197 merge
2197 </a>
2198 </a>
2198 </td><td>
2199 </td><td>
2199 merge another revision into working directory
2200 merge another revision into working directory
2200 </td></tr>
2201 </td></tr>
2201 <tr><td>
2202 <tr><td>
2202 <a href="/help/pull">
2203 <a href="/help/pull">
2203 pull
2204 pull
2204 </a>
2205 </a>
2205 </td><td>
2206 </td><td>
2206 pull changes from the specified source
2207 pull changes from the specified source
2207 </td></tr>
2208 </td></tr>
2208 <tr><td>
2209 <tr><td>
2209 <a href="/help/push">
2210 <a href="/help/push">
2210 push
2211 push
2211 </a>
2212 </a>
2212 </td><td>
2213 </td><td>
2213 push changes to the specified destination
2214 push changes to the specified destination
2214 </td></tr>
2215 </td></tr>
2215 <tr><td>
2216 <tr><td>
2216 <a href="/help/remove">
2217 <a href="/help/remove">
2217 remove
2218 remove
2218 </a>
2219 </a>
2219 </td><td>
2220 </td><td>
2220 remove the specified files on the next commit
2221 remove the specified files on the next commit
2221 </td></tr>
2222 </td></tr>
2222 <tr><td>
2223 <tr><td>
2223 <a href="/help/serve">
2224 <a href="/help/serve">
2224 serve
2225 serve
2225 </a>
2226 </a>
2226 </td><td>
2227 </td><td>
2227 start stand-alone webserver
2228 start stand-alone webserver
2228 </td></tr>
2229 </td></tr>
2229 <tr><td>
2230 <tr><td>
2230 <a href="/help/status">
2231 <a href="/help/status">
2231 status
2232 status
2232 </a>
2233 </a>
2233 </td><td>
2234 </td><td>
2234 show changed files in the working directory
2235 show changed files in the working directory
2235 </td></tr>
2236 </td></tr>
2236 <tr><td>
2237 <tr><td>
2237 <a href="/help/summary">
2238 <a href="/help/summary">
2238 summary
2239 summary
2239 </a>
2240 </a>
2240 </td><td>
2241 </td><td>
2241 summarize working directory state
2242 summarize working directory state
2242 </td></tr>
2243 </td></tr>
2243 <tr><td>
2244 <tr><td>
2244 <a href="/help/update">
2245 <a href="/help/update">
2245 update
2246 update
2246 </a>
2247 </a>
2247 </td><td>
2248 </td><td>
2248 update working directory (or switch revisions)
2249 update working directory (or switch revisions)
2249 </td></tr>
2250 </td></tr>
2250
2251
2251
2252
2252
2253
2253 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
2254 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
2254
2255
2255 <tr><td>
2256 <tr><td>
2256 <a href="/help/addremove">
2257 <a href="/help/addremove">
2257 addremove
2258 addremove
2258 </a>
2259 </a>
2259 </td><td>
2260 </td><td>
2260 add all new files, delete all missing files
2261 add all new files, delete all missing files
2261 </td></tr>
2262 </td></tr>
2262 <tr><td>
2263 <tr><td>
2263 <a href="/help/archive">
2264 <a href="/help/archive">
2264 archive
2265 archive
2265 </a>
2266 </a>
2266 </td><td>
2267 </td><td>
2267 create an unversioned archive of a repository revision
2268 create an unversioned archive of a repository revision
2268 </td></tr>
2269 </td></tr>
2269 <tr><td>
2270 <tr><td>
2270 <a href="/help/backout">
2271 <a href="/help/backout">
2271 backout
2272 backout
2272 </a>
2273 </a>
2273 </td><td>
2274 </td><td>
2274 reverse effect of earlier changeset
2275 reverse effect of earlier changeset
2275 </td></tr>
2276 </td></tr>
2276 <tr><td>
2277 <tr><td>
2277 <a href="/help/bisect">
2278 <a href="/help/bisect">
2278 bisect
2279 bisect
2279 </a>
2280 </a>
2280 </td><td>
2281 </td><td>
2281 subdivision search of changesets
2282 subdivision search of changesets
2282 </td></tr>
2283 </td></tr>
2283 <tr><td>
2284 <tr><td>
2284 <a href="/help/bookmarks">
2285 <a href="/help/bookmarks">
2285 bookmarks
2286 bookmarks
2286 </a>
2287 </a>
2287 </td><td>
2288 </td><td>
2288 create a new bookmark or list existing bookmarks
2289 create a new bookmark or list existing bookmarks
2289 </td></tr>
2290 </td></tr>
2290 <tr><td>
2291 <tr><td>
2291 <a href="/help/branch">
2292 <a href="/help/branch">
2292 branch
2293 branch
2293 </a>
2294 </a>
2294 </td><td>
2295 </td><td>
2295 set or show the current branch name
2296 set or show the current branch name
2296 </td></tr>
2297 </td></tr>
2297 <tr><td>
2298 <tr><td>
2298 <a href="/help/branches">
2299 <a href="/help/branches">
2299 branches
2300 branches
2300 </a>
2301 </a>
2301 </td><td>
2302 </td><td>
2302 list repository named branches
2303 list repository named branches
2303 </td></tr>
2304 </td></tr>
2304 <tr><td>
2305 <tr><td>
2305 <a href="/help/bundle">
2306 <a href="/help/bundle">
2306 bundle
2307 bundle
2307 </a>
2308 </a>
2308 </td><td>
2309 </td><td>
2309 create a bundle file
2310 create a bundle file
2310 </td></tr>
2311 </td></tr>
2311 <tr><td>
2312 <tr><td>
2312 <a href="/help/cat">
2313 <a href="/help/cat">
2313 cat
2314 cat
2314 </a>
2315 </a>
2315 </td><td>
2316 </td><td>
2316 output the current or given revision of files
2317 output the current or given revision of files
2317 </td></tr>
2318 </td></tr>
2318 <tr><td>
2319 <tr><td>
2319 <a href="/help/config">
2320 <a href="/help/config">
2320 config
2321 config
2321 </a>
2322 </a>
2322 </td><td>
2323 </td><td>
2323 show combined config settings from all hgrc files
2324 show combined config settings from all hgrc files
2324 </td></tr>
2325 </td></tr>
2325 <tr><td>
2326 <tr><td>
2326 <a href="/help/copy">
2327 <a href="/help/copy">
2327 copy
2328 copy
2328 </a>
2329 </a>
2329 </td><td>
2330 </td><td>
2330 mark files as copied for the next commit
2331 mark files as copied for the next commit
2331 </td></tr>
2332 </td></tr>
2332 <tr><td>
2333 <tr><td>
2333 <a href="/help/files">
2334 <a href="/help/files">
2334 files
2335 files
2335 </a>
2336 </a>
2336 </td><td>
2337 </td><td>
2337 list tracked files
2338 list tracked files
2338 </td></tr>
2339 </td></tr>
2339 <tr><td>
2340 <tr><td>
2340 <a href="/help/graft">
2341 <a href="/help/graft">
2341 graft
2342 graft
2342 </a>
2343 </a>
2343 </td><td>
2344 </td><td>
2344 copy changes from other branches onto the current branch
2345 copy changes from other branches onto the current branch
2345 </td></tr>
2346 </td></tr>
2346 <tr><td>
2347 <tr><td>
2347 <a href="/help/grep">
2348 <a href="/help/grep">
2348 grep
2349 grep
2349 </a>
2350 </a>
2350 </td><td>
2351 </td><td>
2351 search revision history for a pattern in specified files
2352 search revision history for a pattern in specified files
2352 </td></tr>
2353 </td></tr>
2353 <tr><td>
2354 <tr><td>
2354 <a href="/help/heads">
2355 <a href="/help/heads">
2355 heads
2356 heads
2356 </a>
2357 </a>
2357 </td><td>
2358 </td><td>
2358 show branch heads
2359 show branch heads
2359 </td></tr>
2360 </td></tr>
2360 <tr><td>
2361 <tr><td>
2361 <a href="/help/help">
2362 <a href="/help/help">
2362 help
2363 help
2363 </a>
2364 </a>
2364 </td><td>
2365 </td><td>
2365 show help for a given topic or a help overview
2366 show help for a given topic or a help overview
2366 </td></tr>
2367 </td></tr>
2367 <tr><td>
2368 <tr><td>
2368 <a href="/help/hgalias">
2369 <a href="/help/hgalias">
2369 hgalias
2370 hgalias
2370 </a>
2371 </a>
2371 </td><td>
2372 </td><td>
2372 summarize working directory state
2373 summarize working directory state
2373 </td></tr>
2374 </td></tr>
2374 <tr><td>
2375 <tr><td>
2375 <a href="/help/identify">
2376 <a href="/help/identify">
2376 identify
2377 identify
2377 </a>
2378 </a>
2378 </td><td>
2379 </td><td>
2379 identify the working directory or specified revision
2380 identify the working directory or specified revision
2380 </td></tr>
2381 </td></tr>
2381 <tr><td>
2382 <tr><td>
2382 <a href="/help/import">
2383 <a href="/help/import">
2383 import
2384 import
2384 </a>
2385 </a>
2385 </td><td>
2386 </td><td>
2386 import an ordered set of patches
2387 import an ordered set of patches
2387 </td></tr>
2388 </td></tr>
2388 <tr><td>
2389 <tr><td>
2389 <a href="/help/incoming">
2390 <a href="/help/incoming">
2390 incoming
2391 incoming
2391 </a>
2392 </a>
2392 </td><td>
2393 </td><td>
2393 show new changesets found in source
2394 show new changesets found in source
2394 </td></tr>
2395 </td></tr>
2395 <tr><td>
2396 <tr><td>
2396 <a href="/help/manifest">
2397 <a href="/help/manifest">
2397 manifest
2398 manifest
2398 </a>
2399 </a>
2399 </td><td>
2400 </td><td>
2400 output the current or given revision of the project manifest
2401 output the current or given revision of the project manifest
2401 </td></tr>
2402 </td></tr>
2402 <tr><td>
2403 <tr><td>
2403 <a href="/help/nohelp">
2404 <a href="/help/nohelp">
2404 nohelp
2405 nohelp
2405 </a>
2406 </a>
2406 </td><td>
2407 </td><td>
2407 (no help text available)
2408 (no help text available)
2408 </td></tr>
2409 </td></tr>
2409 <tr><td>
2410 <tr><td>
2410 <a href="/help/outgoing">
2411 <a href="/help/outgoing">
2411 outgoing
2412 outgoing
2412 </a>
2413 </a>
2413 </td><td>
2414 </td><td>
2414 show changesets not found in the destination
2415 show changesets not found in the destination
2415 </td></tr>
2416 </td></tr>
2416 <tr><td>
2417 <tr><td>
2417 <a href="/help/paths">
2418 <a href="/help/paths">
2418 paths
2419 paths
2419 </a>
2420 </a>
2420 </td><td>
2421 </td><td>
2421 show aliases for remote repositories
2422 show aliases for remote repositories
2422 </td></tr>
2423 </td></tr>
2423 <tr><td>
2424 <tr><td>
2424 <a href="/help/phase">
2425 <a href="/help/phase">
2425 phase
2426 phase
2426 </a>
2427 </a>
2427 </td><td>
2428 </td><td>
2428 set or show the current phase name
2429 set or show the current phase name
2429 </td></tr>
2430 </td></tr>
2430 <tr><td>
2431 <tr><td>
2431 <a href="/help/recover">
2432 <a href="/help/recover">
2432 recover
2433 recover
2433 </a>
2434 </a>
2434 </td><td>
2435 </td><td>
2435 roll back an interrupted transaction
2436 roll back an interrupted transaction
2436 </td></tr>
2437 </td></tr>
2437 <tr><td>
2438 <tr><td>
2438 <a href="/help/rename">
2439 <a href="/help/rename">
2439 rename
2440 rename
2440 </a>
2441 </a>
2441 </td><td>
2442 </td><td>
2442 rename files; equivalent of copy + remove
2443 rename files; equivalent of copy + remove
2443 </td></tr>
2444 </td></tr>
2444 <tr><td>
2445 <tr><td>
2445 <a href="/help/resolve">
2446 <a href="/help/resolve">
2446 resolve
2447 resolve
2447 </a>
2448 </a>
2448 </td><td>
2449 </td><td>
2449 redo merges or set/view the merge status of files
2450 redo merges or set/view the merge status of files
2450 </td></tr>
2451 </td></tr>
2451 <tr><td>
2452 <tr><td>
2452 <a href="/help/revert">
2453 <a href="/help/revert">
2453 revert
2454 revert
2454 </a>
2455 </a>
2455 </td><td>
2456 </td><td>
2456 restore files to their checkout state
2457 restore files to their checkout state
2457 </td></tr>
2458 </td></tr>
2458 <tr><td>
2459 <tr><td>
2459 <a href="/help/root">
2460 <a href="/help/root">
2460 root
2461 root
2461 </a>
2462 </a>
2462 </td><td>
2463 </td><td>
2463 print the root (top) of the current working directory
2464 print the root (top) of the current working directory
2464 </td></tr>
2465 </td></tr>
2465 <tr><td>
2466 <tr><td>
2466 <a href="/help/shellalias">
2467 <a href="/help/shellalias">
2467 shellalias
2468 shellalias
2468 </a>
2469 </a>
2469 </td><td>
2470 </td><td>
2470 (no help text available)
2471 (no help text available)
2471 </td></tr>
2472 </td></tr>
2472 <tr><td>
2473 <tr><td>
2473 <a href="/help/tag">
2474 <a href="/help/tag">
2474 tag
2475 tag
2475 </a>
2476 </a>
2476 </td><td>
2477 </td><td>
2477 add one or more tags for the current or given revision
2478 add one or more tags for the current or given revision
2478 </td></tr>
2479 </td></tr>
2479 <tr><td>
2480 <tr><td>
2480 <a href="/help/tags">
2481 <a href="/help/tags">
2481 tags
2482 tags
2482 </a>
2483 </a>
2483 </td><td>
2484 </td><td>
2484 list repository tags
2485 list repository tags
2485 </td></tr>
2486 </td></tr>
2486 <tr><td>
2487 <tr><td>
2487 <a href="/help/unbundle">
2488 <a href="/help/unbundle">
2488 unbundle
2489 unbundle
2489 </a>
2490 </a>
2490 </td><td>
2491 </td><td>
2491 apply one or more bundle files
2492 apply one or more bundle files
2492 </td></tr>
2493 </td></tr>
2493 <tr><td>
2494 <tr><td>
2494 <a href="/help/verify">
2495 <a href="/help/verify">
2495 verify
2496 verify
2496 </a>
2497 </a>
2497 </td><td>
2498 </td><td>
2498 verify the integrity of the repository
2499 verify the integrity of the repository
2499 </td></tr>
2500 </td></tr>
2500 <tr><td>
2501 <tr><td>
2501 <a href="/help/version">
2502 <a href="/help/version">
2502 version
2503 version
2503 </a>
2504 </a>
2504 </td><td>
2505 </td><td>
2505 output version and copyright information
2506 output version and copyright information
2506 </td></tr>
2507 </td></tr>
2507
2508
2508
2509
2509 </table>
2510 </table>
2510 </div>
2511 </div>
2511 </div>
2512 </div>
2512
2513
2513
2514
2514
2515
2515 </body>
2516 </body>
2516 </html>
2517 </html>
2517
2518
2518
2519
2519 $ get-with-headers.py $LOCALIP:$HGPORT "help/add"
2520 $ get-with-headers.py $LOCALIP:$HGPORT "help/add"
2520 200 Script output follows
2521 200 Script output follows
2521
2522
2522 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2523 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2523 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2524 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2524 <head>
2525 <head>
2525 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2526 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2526 <meta name="robots" content="index, nofollow" />
2527 <meta name="robots" content="index, nofollow" />
2527 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2528 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2528 <script type="text/javascript" src="/static/mercurial.js"></script>
2529 <script type="text/javascript" src="/static/mercurial.js"></script>
2529
2530
2530 <title>Help: add</title>
2531 <title>Help: add</title>
2531 </head>
2532 </head>
2532 <body>
2533 <body>
2533
2534
2534 <div class="container">
2535 <div class="container">
2535 <div class="menu">
2536 <div class="menu">
2536 <div class="logo">
2537 <div class="logo">
2537 <a href="https://mercurial-scm.org/">
2538 <a href="https://mercurial-scm.org/">
2538 <img src="/static/hglogo.png" alt="mercurial" /></a>
2539 <img src="/static/hglogo.png" alt="mercurial" /></a>
2539 </div>
2540 </div>
2540 <ul>
2541 <ul>
2541 <li><a href="/shortlog">log</a></li>
2542 <li><a href="/shortlog">log</a></li>
2542 <li><a href="/graph">graph</a></li>
2543 <li><a href="/graph">graph</a></li>
2543 <li><a href="/tags">tags</a></li>
2544 <li><a href="/tags">tags</a></li>
2544 <li><a href="/bookmarks">bookmarks</a></li>
2545 <li><a href="/bookmarks">bookmarks</a></li>
2545 <li><a href="/branches">branches</a></li>
2546 <li><a href="/branches">branches</a></li>
2546 </ul>
2547 </ul>
2547 <ul>
2548 <ul>
2548 <li class="active"><a href="/help">help</a></li>
2549 <li class="active"><a href="/help">help</a></li>
2549 </ul>
2550 </ul>
2550 </div>
2551 </div>
2551
2552
2552 <div class="main">
2553 <div class="main">
2553 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2554 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2554 <h3>Help: add</h3>
2555 <h3>Help: add</h3>
2555
2556
2556 <form class="search" action="/log">
2557 <form class="search" action="/log">
2557
2558
2558 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2559 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2559 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2560 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2560 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2561 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2561 </form>
2562 </form>
2562 <div id="doc">
2563 <div id="doc">
2563 <p>
2564 <p>
2564 hg add [OPTION]... [FILE]...
2565 hg add [OPTION]... [FILE]...
2565 </p>
2566 </p>
2566 <p>
2567 <p>
2567 add the specified files on the next commit
2568 add the specified files on the next commit
2568 </p>
2569 </p>
2569 <p>
2570 <p>
2570 Schedule files to be version controlled and added to the
2571 Schedule files to be version controlled and added to the
2571 repository.
2572 repository.
2572 </p>
2573 </p>
2573 <p>
2574 <p>
2574 The files will be added to the repository at the next commit. To
2575 The files will be added to the repository at the next commit. To
2575 undo an add before that, see 'hg forget'.
2576 undo an add before that, see 'hg forget'.
2576 </p>
2577 </p>
2577 <p>
2578 <p>
2578 If no names are given, add all files to the repository (except
2579 If no names are given, add all files to the repository (except
2579 files matching &quot;.hgignore&quot;).
2580 files matching &quot;.hgignore&quot;).
2580 </p>
2581 </p>
2581 <p>
2582 <p>
2582 Examples:
2583 Examples:
2583 </p>
2584 </p>
2584 <ul>
2585 <ul>
2585 <li> New (unknown) files are added automatically by 'hg add':
2586 <li> New (unknown) files are added automatically by 'hg add':
2586 <pre>
2587 <pre>
2587 \$ ls (re)
2588 \$ ls (re)
2588 foo.c
2589 foo.c
2589 \$ hg status (re)
2590 \$ hg status (re)
2590 ? foo.c
2591 ? foo.c
2591 \$ hg add (re)
2592 \$ hg add (re)
2592 adding foo.c
2593 adding foo.c
2593 \$ hg status (re)
2594 \$ hg status (re)
2594 A foo.c
2595 A foo.c
2595 </pre>
2596 </pre>
2596 <li> Specific files to be added can be specified:
2597 <li> Specific files to be added can be specified:
2597 <pre>
2598 <pre>
2598 \$ ls (re)
2599 \$ ls (re)
2599 bar.c foo.c
2600 bar.c foo.c
2600 \$ hg status (re)
2601 \$ hg status (re)
2601 ? bar.c
2602 ? bar.c
2602 ? foo.c
2603 ? foo.c
2603 \$ hg add bar.c (re)
2604 \$ hg add bar.c (re)
2604 \$ hg status (re)
2605 \$ hg status (re)
2605 A bar.c
2606 A bar.c
2606 ? foo.c
2607 ? foo.c
2607 </pre>
2608 </pre>
2608 </ul>
2609 </ul>
2609 <p>
2610 <p>
2610 Returns 0 if all files are successfully added.
2611 Returns 0 if all files are successfully added.
2611 </p>
2612 </p>
2612 <p>
2613 <p>
2613 options ([+] can be repeated):
2614 options ([+] can be repeated):
2614 </p>
2615 </p>
2615 <table>
2616 <table>
2616 <tr><td>-I</td>
2617 <tr><td>-I</td>
2617 <td>--include PATTERN [+]</td>
2618 <td>--include PATTERN [+]</td>
2618 <td>include names matching the given patterns</td></tr>
2619 <td>include names matching the given patterns</td></tr>
2619 <tr><td>-X</td>
2620 <tr><td>-X</td>
2620 <td>--exclude PATTERN [+]</td>
2621 <td>--exclude PATTERN [+]</td>
2621 <td>exclude names matching the given patterns</td></tr>
2622 <td>exclude names matching the given patterns</td></tr>
2622 <tr><td>-S</td>
2623 <tr><td>-S</td>
2623 <td>--subrepos</td>
2624 <td>--subrepos</td>
2624 <td>recurse into subrepositories</td></tr>
2625 <td>recurse into subrepositories</td></tr>
2625 <tr><td>-n</td>
2626 <tr><td>-n</td>
2626 <td>--dry-run</td>
2627 <td>--dry-run</td>
2627 <td>do not perform actions, just print output</td></tr>
2628 <td>do not perform actions, just print output</td></tr>
2628 </table>
2629 </table>
2629 <p>
2630 <p>
2630 global options ([+] can be repeated):
2631 global options ([+] can be repeated):
2631 </p>
2632 </p>
2632 <table>
2633 <table>
2633 <tr><td>-R</td>
2634 <tr><td>-R</td>
2634 <td>--repository REPO</td>
2635 <td>--repository REPO</td>
2635 <td>repository root directory or name of overlay bundle file</td></tr>
2636 <td>repository root directory or name of overlay bundle file</td></tr>
2636 <tr><td></td>
2637 <tr><td></td>
2637 <td>--cwd DIR</td>
2638 <td>--cwd DIR</td>
2638 <td>change working directory</td></tr>
2639 <td>change working directory</td></tr>
2639 <tr><td>-y</td>
2640 <tr><td>-y</td>
2640 <td>--noninteractive</td>
2641 <td>--noninteractive</td>
2641 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2642 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2642 <tr><td>-q</td>
2643 <tr><td>-q</td>
2643 <td>--quiet</td>
2644 <td>--quiet</td>
2644 <td>suppress output</td></tr>
2645 <td>suppress output</td></tr>
2645 <tr><td>-v</td>
2646 <tr><td>-v</td>
2646 <td>--verbose</td>
2647 <td>--verbose</td>
2647 <td>enable additional output</td></tr>
2648 <td>enable additional output</td></tr>
2648 <tr><td></td>
2649 <tr><td></td>
2649 <td>--color TYPE</td>
2650 <td>--color TYPE</td>
2650 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2651 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2651 <tr><td></td>
2652 <tr><td></td>
2652 <td>--config CONFIG [+]</td>
2653 <td>--config CONFIG [+]</td>
2653 <td>set/override config option (use 'section.name=value')</td></tr>
2654 <td>set/override config option (use 'section.name=value')</td></tr>
2654 <tr><td></td>
2655 <tr><td></td>
2655 <td>--debug</td>
2656 <td>--debug</td>
2656 <td>enable debugging output</td></tr>
2657 <td>enable debugging output</td></tr>
2657 <tr><td></td>
2658 <tr><td></td>
2658 <td>--debugger</td>
2659 <td>--debugger</td>
2659 <td>start debugger</td></tr>
2660 <td>start debugger</td></tr>
2660 <tr><td></td>
2661 <tr><td></td>
2661 <td>--encoding ENCODE</td>
2662 <td>--encoding ENCODE</td>
2662 <td>set the charset encoding (default: ascii)</td></tr>
2663 <td>set the charset encoding (default: ascii)</td></tr>
2663 <tr><td></td>
2664 <tr><td></td>
2664 <td>--encodingmode MODE</td>
2665 <td>--encodingmode MODE</td>
2665 <td>set the charset encoding mode (default: strict)</td></tr>
2666 <td>set the charset encoding mode (default: strict)</td></tr>
2666 <tr><td></td>
2667 <tr><td></td>
2667 <td>--traceback</td>
2668 <td>--traceback</td>
2668 <td>always print a traceback on exception</td></tr>
2669 <td>always print a traceback on exception</td></tr>
2669 <tr><td></td>
2670 <tr><td></td>
2670 <td>--time</td>
2671 <td>--time</td>
2671 <td>time how long the command takes</td></tr>
2672 <td>time how long the command takes</td></tr>
2672 <tr><td></td>
2673 <tr><td></td>
2673 <td>--profile</td>
2674 <td>--profile</td>
2674 <td>print command execution profile</td></tr>
2675 <td>print command execution profile</td></tr>
2675 <tr><td></td>
2676 <tr><td></td>
2676 <td>--version</td>
2677 <td>--version</td>
2677 <td>output version information and exit</td></tr>
2678 <td>output version information and exit</td></tr>
2678 <tr><td>-h</td>
2679 <tr><td>-h</td>
2679 <td>--help</td>
2680 <td>--help</td>
2680 <td>display help and exit</td></tr>
2681 <td>display help and exit</td></tr>
2681 <tr><td></td>
2682 <tr><td></td>
2682 <td>--hidden</td>
2683 <td>--hidden</td>
2683 <td>consider hidden changesets</td></tr>
2684 <td>consider hidden changesets</td></tr>
2684 <tr><td></td>
2685 <tr><td></td>
2685 <td>--pager TYPE</td>
2686 <td>--pager TYPE</td>
2686 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2687 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2687 </table>
2688 </table>
2688
2689
2689 </div>
2690 </div>
2690 </div>
2691 </div>
2691 </div>
2692 </div>
2692
2693
2693
2694
2694
2695
2695 </body>
2696 </body>
2696 </html>
2697 </html>
2697
2698
2698
2699
2699 $ get-with-headers.py $LOCALIP:$HGPORT "help/remove"
2700 $ get-with-headers.py $LOCALIP:$HGPORT "help/remove"
2700 200 Script output follows
2701 200 Script output follows
2701
2702
2702 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2703 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2703 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2704 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2704 <head>
2705 <head>
2705 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2706 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2706 <meta name="robots" content="index, nofollow" />
2707 <meta name="robots" content="index, nofollow" />
2707 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2708 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2708 <script type="text/javascript" src="/static/mercurial.js"></script>
2709 <script type="text/javascript" src="/static/mercurial.js"></script>
2709
2710
2710 <title>Help: remove</title>
2711 <title>Help: remove</title>
2711 </head>
2712 </head>
2712 <body>
2713 <body>
2713
2714
2714 <div class="container">
2715 <div class="container">
2715 <div class="menu">
2716 <div class="menu">
2716 <div class="logo">
2717 <div class="logo">
2717 <a href="https://mercurial-scm.org/">
2718 <a href="https://mercurial-scm.org/">
2718 <img src="/static/hglogo.png" alt="mercurial" /></a>
2719 <img src="/static/hglogo.png" alt="mercurial" /></a>
2719 </div>
2720 </div>
2720 <ul>
2721 <ul>
2721 <li><a href="/shortlog">log</a></li>
2722 <li><a href="/shortlog">log</a></li>
2722 <li><a href="/graph">graph</a></li>
2723 <li><a href="/graph">graph</a></li>
2723 <li><a href="/tags">tags</a></li>
2724 <li><a href="/tags">tags</a></li>
2724 <li><a href="/bookmarks">bookmarks</a></li>
2725 <li><a href="/bookmarks">bookmarks</a></li>
2725 <li><a href="/branches">branches</a></li>
2726 <li><a href="/branches">branches</a></li>
2726 </ul>
2727 </ul>
2727 <ul>
2728 <ul>
2728 <li class="active"><a href="/help">help</a></li>
2729 <li class="active"><a href="/help">help</a></li>
2729 </ul>
2730 </ul>
2730 </div>
2731 </div>
2731
2732
2732 <div class="main">
2733 <div class="main">
2733 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2734 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2734 <h3>Help: remove</h3>
2735 <h3>Help: remove</h3>
2735
2736
2736 <form class="search" action="/log">
2737 <form class="search" action="/log">
2737
2738
2738 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2739 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2739 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2740 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2740 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2741 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2741 </form>
2742 </form>
2742 <div id="doc">
2743 <div id="doc">
2743 <p>
2744 <p>
2744 hg remove [OPTION]... FILE...
2745 hg remove [OPTION]... FILE...
2745 </p>
2746 </p>
2746 <p>
2747 <p>
2747 aliases: rm
2748 aliases: rm
2748 </p>
2749 </p>
2749 <p>
2750 <p>
2750 remove the specified files on the next commit
2751 remove the specified files on the next commit
2751 </p>
2752 </p>
2752 <p>
2753 <p>
2753 Schedule the indicated files for removal from the current branch.
2754 Schedule the indicated files for removal from the current branch.
2754 </p>
2755 </p>
2755 <p>
2756 <p>
2756 This command schedules the files to be removed at the next commit.
2757 This command schedules the files to be removed at the next commit.
2757 To undo a remove before that, see 'hg revert'. To undo added
2758 To undo a remove before that, see 'hg revert'. To undo added
2758 files, see 'hg forget'.
2759 files, see 'hg forget'.
2759 </p>
2760 </p>
2760 <p>
2761 <p>
2761 -A/--after can be used to remove only files that have already
2762 -A/--after can be used to remove only files that have already
2762 been deleted, -f/--force can be used to force deletion, and -Af
2763 been deleted, -f/--force can be used to force deletion, and -Af
2763 can be used to remove files from the next revision without
2764 can be used to remove files from the next revision without
2764 deleting them from the working directory.
2765 deleting them from the working directory.
2765 </p>
2766 </p>
2766 <p>
2767 <p>
2767 The following table details the behavior of remove for different
2768 The following table details the behavior of remove for different
2768 file states (columns) and option combinations (rows). The file
2769 file states (columns) and option combinations (rows). The file
2769 states are Added [A], Clean [C], Modified [M] and Missing [!]
2770 states are Added [A], Clean [C], Modified [M] and Missing [!]
2770 (as reported by 'hg status'). The actions are Warn, Remove
2771 (as reported by 'hg status'). The actions are Warn, Remove
2771 (from branch) and Delete (from disk):
2772 (from branch) and Delete (from disk):
2772 </p>
2773 </p>
2773 <table>
2774 <table>
2774 <tr><td>opt/state</td>
2775 <tr><td>opt/state</td>
2775 <td>A</td>
2776 <td>A</td>
2776 <td>C</td>
2777 <td>C</td>
2777 <td>M</td>
2778 <td>M</td>
2778 <td>!</td></tr>
2779 <td>!</td></tr>
2779 <tr><td>none</td>
2780 <tr><td>none</td>
2780 <td>W</td>
2781 <td>W</td>
2781 <td>RD</td>
2782 <td>RD</td>
2782 <td>W</td>
2783 <td>W</td>
2783 <td>R</td></tr>
2784 <td>R</td></tr>
2784 <tr><td>-f</td>
2785 <tr><td>-f</td>
2785 <td>R</td>
2786 <td>R</td>
2786 <td>RD</td>
2787 <td>RD</td>
2787 <td>RD</td>
2788 <td>RD</td>
2788 <td>R</td></tr>
2789 <td>R</td></tr>
2789 <tr><td>-A</td>
2790 <tr><td>-A</td>
2790 <td>W</td>
2791 <td>W</td>
2791 <td>W</td>
2792 <td>W</td>
2792 <td>W</td>
2793 <td>W</td>
2793 <td>R</td></tr>
2794 <td>R</td></tr>
2794 <tr><td>-Af</td>
2795 <tr><td>-Af</td>
2795 <td>R</td>
2796 <td>R</td>
2796 <td>R</td>
2797 <td>R</td>
2797 <td>R</td>
2798 <td>R</td>
2798 <td>R</td></tr>
2799 <td>R</td></tr>
2799 </table>
2800 </table>
2800 <p>
2801 <p>
2801 <b>Note:</b>
2802 <b>Note:</b>
2802 </p>
2803 </p>
2803 <p>
2804 <p>
2804 'hg remove' never deletes files in Added [A] state from the
2805 'hg remove' never deletes files in Added [A] state from the
2805 working directory, not even if &quot;--force&quot; is specified.
2806 working directory, not even if &quot;--force&quot; is specified.
2806 </p>
2807 </p>
2807 <p>
2808 <p>
2808 Returns 0 on success, 1 if any warnings encountered.
2809 Returns 0 on success, 1 if any warnings encountered.
2809 </p>
2810 </p>
2810 <p>
2811 <p>
2811 options ([+] can be repeated):
2812 options ([+] can be repeated):
2812 </p>
2813 </p>
2813 <table>
2814 <table>
2814 <tr><td>-A</td>
2815 <tr><td>-A</td>
2815 <td>--after</td>
2816 <td>--after</td>
2816 <td>record delete for missing files</td></tr>
2817 <td>record delete for missing files</td></tr>
2817 <tr><td>-f</td>
2818 <tr><td>-f</td>
2818 <td>--force</td>
2819 <td>--force</td>
2819 <td>forget added files, delete modified files</td></tr>
2820 <td>forget added files, delete modified files</td></tr>
2820 <tr><td>-S</td>
2821 <tr><td>-S</td>
2821 <td>--subrepos</td>
2822 <td>--subrepos</td>
2822 <td>recurse into subrepositories</td></tr>
2823 <td>recurse into subrepositories</td></tr>
2823 <tr><td>-I</td>
2824 <tr><td>-I</td>
2824 <td>--include PATTERN [+]</td>
2825 <td>--include PATTERN [+]</td>
2825 <td>include names matching the given patterns</td></tr>
2826 <td>include names matching the given patterns</td></tr>
2826 <tr><td>-X</td>
2827 <tr><td>-X</td>
2827 <td>--exclude PATTERN [+]</td>
2828 <td>--exclude PATTERN [+]</td>
2828 <td>exclude names matching the given patterns</td></tr>
2829 <td>exclude names matching the given patterns</td></tr>
2829 </table>
2830 </table>
2830 <p>
2831 <p>
2831 global options ([+] can be repeated):
2832 global options ([+] can be repeated):
2832 </p>
2833 </p>
2833 <table>
2834 <table>
2834 <tr><td>-R</td>
2835 <tr><td>-R</td>
2835 <td>--repository REPO</td>
2836 <td>--repository REPO</td>
2836 <td>repository root directory or name of overlay bundle file</td></tr>
2837 <td>repository root directory or name of overlay bundle file</td></tr>
2837 <tr><td></td>
2838 <tr><td></td>
2838 <td>--cwd DIR</td>
2839 <td>--cwd DIR</td>
2839 <td>change working directory</td></tr>
2840 <td>change working directory</td></tr>
2840 <tr><td>-y</td>
2841 <tr><td>-y</td>
2841 <td>--noninteractive</td>
2842 <td>--noninteractive</td>
2842 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2843 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2843 <tr><td>-q</td>
2844 <tr><td>-q</td>
2844 <td>--quiet</td>
2845 <td>--quiet</td>
2845 <td>suppress output</td></tr>
2846 <td>suppress output</td></tr>
2846 <tr><td>-v</td>
2847 <tr><td>-v</td>
2847 <td>--verbose</td>
2848 <td>--verbose</td>
2848 <td>enable additional output</td></tr>
2849 <td>enable additional output</td></tr>
2849 <tr><td></td>
2850 <tr><td></td>
2850 <td>--color TYPE</td>
2851 <td>--color TYPE</td>
2851 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2852 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2852 <tr><td></td>
2853 <tr><td></td>
2853 <td>--config CONFIG [+]</td>
2854 <td>--config CONFIG [+]</td>
2854 <td>set/override config option (use 'section.name=value')</td></tr>
2855 <td>set/override config option (use 'section.name=value')</td></tr>
2855 <tr><td></td>
2856 <tr><td></td>
2856 <td>--debug</td>
2857 <td>--debug</td>
2857 <td>enable debugging output</td></tr>
2858 <td>enable debugging output</td></tr>
2858 <tr><td></td>
2859 <tr><td></td>
2859 <td>--debugger</td>
2860 <td>--debugger</td>
2860 <td>start debugger</td></tr>
2861 <td>start debugger</td></tr>
2861 <tr><td></td>
2862 <tr><td></td>
2862 <td>--encoding ENCODE</td>
2863 <td>--encoding ENCODE</td>
2863 <td>set the charset encoding (default: ascii)</td></tr>
2864 <td>set the charset encoding (default: ascii)</td></tr>
2864 <tr><td></td>
2865 <tr><td></td>
2865 <td>--encodingmode MODE</td>
2866 <td>--encodingmode MODE</td>
2866 <td>set the charset encoding mode (default: strict)</td></tr>
2867 <td>set the charset encoding mode (default: strict)</td></tr>
2867 <tr><td></td>
2868 <tr><td></td>
2868 <td>--traceback</td>
2869 <td>--traceback</td>
2869 <td>always print a traceback on exception</td></tr>
2870 <td>always print a traceback on exception</td></tr>
2870 <tr><td></td>
2871 <tr><td></td>
2871 <td>--time</td>
2872 <td>--time</td>
2872 <td>time how long the command takes</td></tr>
2873 <td>time how long the command takes</td></tr>
2873 <tr><td></td>
2874 <tr><td></td>
2874 <td>--profile</td>
2875 <td>--profile</td>
2875 <td>print command execution profile</td></tr>
2876 <td>print command execution profile</td></tr>
2876 <tr><td></td>
2877 <tr><td></td>
2877 <td>--version</td>
2878 <td>--version</td>
2878 <td>output version information and exit</td></tr>
2879 <td>output version information and exit</td></tr>
2879 <tr><td>-h</td>
2880 <tr><td>-h</td>
2880 <td>--help</td>
2881 <td>--help</td>
2881 <td>display help and exit</td></tr>
2882 <td>display help and exit</td></tr>
2882 <tr><td></td>
2883 <tr><td></td>
2883 <td>--hidden</td>
2884 <td>--hidden</td>
2884 <td>consider hidden changesets</td></tr>
2885 <td>consider hidden changesets</td></tr>
2885 <tr><td></td>
2886 <tr><td></td>
2886 <td>--pager TYPE</td>
2887 <td>--pager TYPE</td>
2887 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2888 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2888 </table>
2889 </table>
2889
2890
2890 </div>
2891 </div>
2891 </div>
2892 </div>
2892 </div>
2893 </div>
2893
2894
2894
2895
2895
2896
2896 </body>
2897 </body>
2897 </html>
2898 </html>
2898
2899
2899
2900
2900 $ get-with-headers.py $LOCALIP:$HGPORT "help/dates"
2901 $ get-with-headers.py $LOCALIP:$HGPORT "help/dates"
2901 200 Script output follows
2902 200 Script output follows
2902
2903
2903 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2904 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2904 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2905 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2905 <head>
2906 <head>
2906 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2907 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2907 <meta name="robots" content="index, nofollow" />
2908 <meta name="robots" content="index, nofollow" />
2908 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2909 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2909 <script type="text/javascript" src="/static/mercurial.js"></script>
2910 <script type="text/javascript" src="/static/mercurial.js"></script>
2910
2911
2911 <title>Help: dates</title>
2912 <title>Help: dates</title>
2912 </head>
2913 </head>
2913 <body>
2914 <body>
2914
2915
2915 <div class="container">
2916 <div class="container">
2916 <div class="menu">
2917 <div class="menu">
2917 <div class="logo">
2918 <div class="logo">
2918 <a href="https://mercurial-scm.org/">
2919 <a href="https://mercurial-scm.org/">
2919 <img src="/static/hglogo.png" alt="mercurial" /></a>
2920 <img src="/static/hglogo.png" alt="mercurial" /></a>
2920 </div>
2921 </div>
2921 <ul>
2922 <ul>
2922 <li><a href="/shortlog">log</a></li>
2923 <li><a href="/shortlog">log</a></li>
2923 <li><a href="/graph">graph</a></li>
2924 <li><a href="/graph">graph</a></li>
2924 <li><a href="/tags">tags</a></li>
2925 <li><a href="/tags">tags</a></li>
2925 <li><a href="/bookmarks">bookmarks</a></li>
2926 <li><a href="/bookmarks">bookmarks</a></li>
2926 <li><a href="/branches">branches</a></li>
2927 <li><a href="/branches">branches</a></li>
2927 </ul>
2928 </ul>
2928 <ul>
2929 <ul>
2929 <li class="active"><a href="/help">help</a></li>
2930 <li class="active"><a href="/help">help</a></li>
2930 </ul>
2931 </ul>
2931 </div>
2932 </div>
2932
2933
2933 <div class="main">
2934 <div class="main">
2934 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2935 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2935 <h3>Help: dates</h3>
2936 <h3>Help: dates</h3>
2936
2937
2937 <form class="search" action="/log">
2938 <form class="search" action="/log">
2938
2939
2939 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2940 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2940 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2941 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2941 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2942 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2942 </form>
2943 </form>
2943 <div id="doc">
2944 <div id="doc">
2944 <h1>Date Formats</h1>
2945 <h1>Date Formats</h1>
2945 <p>
2946 <p>
2946 Some commands allow the user to specify a date, e.g.:
2947 Some commands allow the user to specify a date, e.g.:
2947 </p>
2948 </p>
2948 <ul>
2949 <ul>
2949 <li> backout, commit, import, tag: Specify the commit date.
2950 <li> backout, commit, import, tag: Specify the commit date.
2950 <li> log, revert, update: Select revision(s) by date.
2951 <li> log, revert, update: Select revision(s) by date.
2951 </ul>
2952 </ul>
2952 <p>
2953 <p>
2953 Many date formats are valid. Here are some examples:
2954 Many date formats are valid. Here are some examples:
2954 </p>
2955 </p>
2955 <ul>
2956 <ul>
2956 <li> &quot;Wed Dec 6 13:18:29 2006&quot; (local timezone assumed)
2957 <li> &quot;Wed Dec 6 13:18:29 2006&quot; (local timezone assumed)
2957 <li> &quot;Dec 6 13:18 -0600&quot; (year assumed, time offset provided)
2958 <li> &quot;Dec 6 13:18 -0600&quot; (year assumed, time offset provided)
2958 <li> &quot;Dec 6 13:18 UTC&quot; (UTC and GMT are aliases for +0000)
2959 <li> &quot;Dec 6 13:18 UTC&quot; (UTC and GMT are aliases for +0000)
2959 <li> &quot;Dec 6&quot; (midnight)
2960 <li> &quot;Dec 6&quot; (midnight)
2960 <li> &quot;13:18&quot; (today assumed)
2961 <li> &quot;13:18&quot; (today assumed)
2961 <li> &quot;3:39&quot; (3:39AM assumed)
2962 <li> &quot;3:39&quot; (3:39AM assumed)
2962 <li> &quot;3:39pm&quot; (15:39)
2963 <li> &quot;3:39pm&quot; (15:39)
2963 <li> &quot;2006-12-06 13:18:29&quot; (ISO 8601 format)
2964 <li> &quot;2006-12-06 13:18:29&quot; (ISO 8601 format)
2964 <li> &quot;2006-12-6 13:18&quot;
2965 <li> &quot;2006-12-6 13:18&quot;
2965 <li> &quot;2006-12-6&quot;
2966 <li> &quot;2006-12-6&quot;
2966 <li> &quot;12-6&quot;
2967 <li> &quot;12-6&quot;
2967 <li> &quot;12/6&quot;
2968 <li> &quot;12/6&quot;
2968 <li> &quot;12/6/6&quot; (Dec 6 2006)
2969 <li> &quot;12/6/6&quot; (Dec 6 2006)
2969 <li> &quot;today&quot; (midnight)
2970 <li> &quot;today&quot; (midnight)
2970 <li> &quot;yesterday&quot; (midnight)
2971 <li> &quot;yesterday&quot; (midnight)
2971 <li> &quot;now&quot; - right now
2972 <li> &quot;now&quot; - right now
2972 </ul>
2973 </ul>
2973 <p>
2974 <p>
2974 Lastly, there is Mercurial's internal format:
2975 Lastly, there is Mercurial's internal format:
2975 </p>
2976 </p>
2976 <ul>
2977 <ul>
2977 <li> &quot;1165411109 0&quot; (Wed Dec 6 13:18:29 2006 UTC)
2978 <li> &quot;1165411109 0&quot; (Wed Dec 6 13:18:29 2006 UTC)
2978 </ul>
2979 </ul>
2979 <p>
2980 <p>
2980 This is the internal representation format for dates. The first number
2981 This is the internal representation format for dates. The first number
2981 is the number of seconds since the epoch (1970-01-01 00:00 UTC). The
2982 is the number of seconds since the epoch (1970-01-01 00:00 UTC). The
2982 second is the offset of the local timezone, in seconds west of UTC
2983 second is the offset of the local timezone, in seconds west of UTC
2983 (negative if the timezone is east of UTC).
2984 (negative if the timezone is east of UTC).
2984 </p>
2985 </p>
2985 <p>
2986 <p>
2986 The log command also accepts date ranges:
2987 The log command also accepts date ranges:
2987 </p>
2988 </p>
2988 <ul>
2989 <ul>
2989 <li> &quot;&lt;DATE&quot; - at or before a given date/time
2990 <li> &quot;&lt;DATE&quot; - at or before a given date/time
2990 <li> &quot;&gt;DATE&quot; - on or after a given date/time
2991 <li> &quot;&gt;DATE&quot; - on or after a given date/time
2991 <li> &quot;DATE to DATE&quot; - a date range, inclusive
2992 <li> &quot;DATE to DATE&quot; - a date range, inclusive
2992 <li> &quot;-DAYS&quot; - within a given number of days of today
2993 <li> &quot;-DAYS&quot; - within a given number of days of today
2993 </ul>
2994 </ul>
2994
2995
2995 </div>
2996 </div>
2996 </div>
2997 </div>
2997 </div>
2998 </div>
2998
2999
2999
3000
3000
3001
3001 </body>
3002 </body>
3002 </html>
3003 </html>
3003
3004
3004
3005
3005 Sub-topic indexes rendered properly
3006 Sub-topic indexes rendered properly
3006
3007
3007 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals"
3008 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals"
3008 200 Script output follows
3009 200 Script output follows
3009
3010
3010 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3011 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3011 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3012 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3012 <head>
3013 <head>
3013 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3014 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3014 <meta name="robots" content="index, nofollow" />
3015 <meta name="robots" content="index, nofollow" />
3015 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3016 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3016 <script type="text/javascript" src="/static/mercurial.js"></script>
3017 <script type="text/javascript" src="/static/mercurial.js"></script>
3017
3018
3018 <title>Help: internals</title>
3019 <title>Help: internals</title>
3019 </head>
3020 </head>
3020 <body>
3021 <body>
3021
3022
3022 <div class="container">
3023 <div class="container">
3023 <div class="menu">
3024 <div class="menu">
3024 <div class="logo">
3025 <div class="logo">
3025 <a href="https://mercurial-scm.org/">
3026 <a href="https://mercurial-scm.org/">
3026 <img src="/static/hglogo.png" alt="mercurial" /></a>
3027 <img src="/static/hglogo.png" alt="mercurial" /></a>
3027 </div>
3028 </div>
3028 <ul>
3029 <ul>
3029 <li><a href="/shortlog">log</a></li>
3030 <li><a href="/shortlog">log</a></li>
3030 <li><a href="/graph">graph</a></li>
3031 <li><a href="/graph">graph</a></li>
3031 <li><a href="/tags">tags</a></li>
3032 <li><a href="/tags">tags</a></li>
3032 <li><a href="/bookmarks">bookmarks</a></li>
3033 <li><a href="/bookmarks">bookmarks</a></li>
3033 <li><a href="/branches">branches</a></li>
3034 <li><a href="/branches">branches</a></li>
3034 </ul>
3035 </ul>
3035 <ul>
3036 <ul>
3036 <li><a href="/help">help</a></li>
3037 <li><a href="/help">help</a></li>
3037 </ul>
3038 </ul>
3038 </div>
3039 </div>
3039
3040
3040 <div class="main">
3041 <div class="main">
3041 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3042 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3042
3043
3043 <form class="search" action="/log">
3044 <form class="search" action="/log">
3044
3045
3045 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3046 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3046 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3047 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3047 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3048 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3048 </form>
3049 </form>
3049 <table class="bigtable">
3050 <table class="bigtable">
3050 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
3051 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
3051
3052
3052 <tr><td>
3053 <tr><td>
3053 <a href="/help/internals.bundles">
3054 <a href="/help/internals.bundles">
3054 bundles
3055 bundles
3055 </a>
3056 </a>
3056 </td><td>
3057 </td><td>
3057 Bundles
3058 Bundles
3058 </td></tr>
3059 </td></tr>
3059 <tr><td>
3060 <tr><td>
3060 <a href="/help/internals.censor">
3061 <a href="/help/internals.censor">
3061 censor
3062 censor
3062 </a>
3063 </a>
3063 </td><td>
3064 </td><td>
3064 Censor
3065 Censor
3065 </td></tr>
3066 </td></tr>
3066 <tr><td>
3067 <tr><td>
3067 <a href="/help/internals.changegroups">
3068 <a href="/help/internals.changegroups">
3068 changegroups
3069 changegroups
3069 </a>
3070 </a>
3070 </td><td>
3071 </td><td>
3071 Changegroups
3072 Changegroups
3072 </td></tr>
3073 </td></tr>
3073 <tr><td>
3074 <tr><td>
3074 <a href="/help/internals.config">
3075 <a href="/help/internals.config">
3075 config
3076 config
3076 </a>
3077 </a>
3077 </td><td>
3078 </td><td>
3078 Config Registrar
3079 Config Registrar
3079 </td></tr>
3080 </td></tr>
3080 <tr><td>
3081 <tr><td>
3081 <a href="/help/internals.requirements">
3082 <a href="/help/internals.requirements">
3082 requirements
3083 requirements
3083 </a>
3084 </a>
3084 </td><td>
3085 </td><td>
3085 Repository Requirements
3086 Repository Requirements
3086 </td></tr>
3087 </td></tr>
3087 <tr><td>
3088 <tr><td>
3088 <a href="/help/internals.revlogs">
3089 <a href="/help/internals.revlogs">
3089 revlogs
3090 revlogs
3090 </a>
3091 </a>
3091 </td><td>
3092 </td><td>
3092 Revision Logs
3093 Revision Logs
3093 </td></tr>
3094 </td></tr>
3094 <tr><td>
3095 <tr><td>
3095 <a href="/help/internals.wireprotocol">
3096 <a href="/help/internals.wireprotocol">
3096 wireprotocol
3097 wireprotocol
3097 </a>
3098 </a>
3098 </td><td>
3099 </td><td>
3099 Wire Protocol
3100 Wire Protocol
3100 </td></tr>
3101 </td></tr>
3101
3102
3102
3103
3103
3104
3104
3105
3105
3106
3106 </table>
3107 </table>
3107 </div>
3108 </div>
3108 </div>
3109 </div>
3109
3110
3110
3111
3111
3112
3112 </body>
3113 </body>
3113 </html>
3114 </html>
3114
3115
3115
3116
3116 Sub-topic topics rendered properly
3117 Sub-topic topics rendered properly
3117
3118
3118 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals.changegroups"
3119 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals.changegroups"
3119 200 Script output follows
3120 200 Script output follows
3120
3121
3121 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3122 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3122 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3123 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3123 <head>
3124 <head>
3124 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3125 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3125 <meta name="robots" content="index, nofollow" />
3126 <meta name="robots" content="index, nofollow" />
3126 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3127 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3127 <script type="text/javascript" src="/static/mercurial.js"></script>
3128 <script type="text/javascript" src="/static/mercurial.js"></script>
3128
3129
3129 <title>Help: internals.changegroups</title>
3130 <title>Help: internals.changegroups</title>
3130 </head>
3131 </head>
3131 <body>
3132 <body>
3132
3133
3133 <div class="container">
3134 <div class="container">
3134 <div class="menu">
3135 <div class="menu">
3135 <div class="logo">
3136 <div class="logo">
3136 <a href="https://mercurial-scm.org/">
3137 <a href="https://mercurial-scm.org/">
3137 <img src="/static/hglogo.png" alt="mercurial" /></a>
3138 <img src="/static/hglogo.png" alt="mercurial" /></a>
3138 </div>
3139 </div>
3139 <ul>
3140 <ul>
3140 <li><a href="/shortlog">log</a></li>
3141 <li><a href="/shortlog">log</a></li>
3141 <li><a href="/graph">graph</a></li>
3142 <li><a href="/graph">graph</a></li>
3142 <li><a href="/tags">tags</a></li>
3143 <li><a href="/tags">tags</a></li>
3143 <li><a href="/bookmarks">bookmarks</a></li>
3144 <li><a href="/bookmarks">bookmarks</a></li>
3144 <li><a href="/branches">branches</a></li>
3145 <li><a href="/branches">branches</a></li>
3145 </ul>
3146 </ul>
3146 <ul>
3147 <ul>
3147 <li class="active"><a href="/help">help</a></li>
3148 <li class="active"><a href="/help">help</a></li>
3148 </ul>
3149 </ul>
3149 </div>
3150 </div>
3150
3151
3151 <div class="main">
3152 <div class="main">
3152 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3153 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3153 <h3>Help: internals.changegroups</h3>
3154 <h3>Help: internals.changegroups</h3>
3154
3155
3155 <form class="search" action="/log">
3156 <form class="search" action="/log">
3156
3157
3157 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3158 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3158 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3159 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3159 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3160 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3160 </form>
3161 </form>
3161 <div id="doc">
3162 <div id="doc">
3162 <h1>Changegroups</h1>
3163 <h1>Changegroups</h1>
3163 <p>
3164 <p>
3164 Changegroups are representations of repository revlog data, specifically
3165 Changegroups are representations of repository revlog data, specifically
3165 the changelog data, root/flat manifest data, treemanifest data, and
3166 the changelog data, root/flat manifest data, treemanifest data, and
3166 filelogs.
3167 filelogs.
3167 </p>
3168 </p>
3168 <p>
3169 <p>
3169 There are 3 versions of changegroups: &quot;1&quot;, &quot;2&quot;, and &quot;3&quot;. From a
3170 There are 3 versions of changegroups: &quot;1&quot;, &quot;2&quot;, and &quot;3&quot;. From a
3170 high-level, versions &quot;1&quot; and &quot;2&quot; are almost exactly the same, with the
3171 high-level, versions &quot;1&quot; and &quot;2&quot; are almost exactly the same, with the
3171 only difference being an additional item in the *delta header*. Version
3172 only difference being an additional item in the *delta header*. Version
3172 &quot;3&quot; adds support for revlog flags in the *delta header* and optionally
3173 &quot;3&quot; adds support for revlog flags in the *delta header* and optionally
3173 exchanging treemanifests (enabled by setting an option on the
3174 exchanging treemanifests (enabled by setting an option on the
3174 &quot;changegroup&quot; part in the bundle2).
3175 &quot;changegroup&quot; part in the bundle2).
3175 </p>
3176 </p>
3176 <p>
3177 <p>
3177 Changegroups when not exchanging treemanifests consist of 3 logical
3178 Changegroups when not exchanging treemanifests consist of 3 logical
3178 segments:
3179 segments:
3179 </p>
3180 </p>
3180 <pre>
3181 <pre>
3181 +---------------------------------+
3182 +---------------------------------+
3182 | | | |
3183 | | | |
3183 | changeset | manifest | filelogs |
3184 | changeset | manifest | filelogs |
3184 | | | |
3185 | | | |
3185 | | | |
3186 | | | |
3186 +---------------------------------+
3187 +---------------------------------+
3187 </pre>
3188 </pre>
3188 <p>
3189 <p>
3189 When exchanging treemanifests, there are 4 logical segments:
3190 When exchanging treemanifests, there are 4 logical segments:
3190 </p>
3191 </p>
3191 <pre>
3192 <pre>
3192 +-------------------------------------------------+
3193 +-------------------------------------------------+
3193 | | | | |
3194 | | | | |
3194 | changeset | root | treemanifests | filelogs |
3195 | changeset | root | treemanifests | filelogs |
3195 | | manifest | | |
3196 | | manifest | | |
3196 | | | | |
3197 | | | | |
3197 +-------------------------------------------------+
3198 +-------------------------------------------------+
3198 </pre>
3199 </pre>
3199 <p>
3200 <p>
3200 The principle building block of each segment is a *chunk*. A *chunk*
3201 The principle building block of each segment is a *chunk*. A *chunk*
3201 is a framed piece of data:
3202 is a framed piece of data:
3202 </p>
3203 </p>
3203 <pre>
3204 <pre>
3204 +---------------------------------------+
3205 +---------------------------------------+
3205 | | |
3206 | | |
3206 | length | data |
3207 | length | data |
3207 | (4 bytes) | (&lt;length - 4&gt; bytes) |
3208 | (4 bytes) | (&lt;length - 4&gt; bytes) |
3208 | | |
3209 | | |
3209 +---------------------------------------+
3210 +---------------------------------------+
3210 </pre>
3211 </pre>
3211 <p>
3212 <p>
3212 All integers are big-endian signed integers. Each chunk starts with a 32-bit
3213 All integers are big-endian signed integers. Each chunk starts with a 32-bit
3213 integer indicating the length of the entire chunk (including the length field
3214 integer indicating the length of the entire chunk (including the length field
3214 itself).
3215 itself).
3215 </p>
3216 </p>
3216 <p>
3217 <p>
3217 There is a special case chunk that has a value of 0 for the length
3218 There is a special case chunk that has a value of 0 for the length
3218 (&quot;0x00000000&quot;). We call this an *empty chunk*.
3219 (&quot;0x00000000&quot;). We call this an *empty chunk*.
3219 </p>
3220 </p>
3220 <h2>Delta Groups</h2>
3221 <h2>Delta Groups</h2>
3221 <p>
3222 <p>
3222 A *delta group* expresses the content of a revlog as a series of deltas,
3223 A *delta group* expresses the content of a revlog as a series of deltas,
3223 or patches against previous revisions.
3224 or patches against previous revisions.
3224 </p>
3225 </p>
3225 <p>
3226 <p>
3226 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
3227 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
3227 to signal the end of the delta group:
3228 to signal the end of the delta group:
3228 </p>
3229 </p>
3229 <pre>
3230 <pre>
3230 +------------------------------------------------------------------------+
3231 +------------------------------------------------------------------------+
3231 | | | | | |
3232 | | | | | |
3232 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
3233 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
3233 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
3234 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
3234 | | | | | |
3235 | | | | | |
3235 +------------------------------------------------------------------------+
3236 +------------------------------------------------------------------------+
3236 </pre>
3237 </pre>
3237 <p>
3238 <p>
3238 Each *chunk*'s data consists of the following:
3239 Each *chunk*'s data consists of the following:
3239 </p>
3240 </p>
3240 <pre>
3241 <pre>
3241 +---------------------------------------+
3242 +---------------------------------------+
3242 | | |
3243 | | |
3243 | delta header | delta data |
3244 | delta header | delta data |
3244 | (various by version) | (various) |
3245 | (various by version) | (various) |
3245 | | |
3246 | | |
3246 +---------------------------------------+
3247 +---------------------------------------+
3247 </pre>
3248 </pre>
3248 <p>
3249 <p>
3249 The *delta data* is a series of *delta*s that describe a diff from an existing
3250 The *delta data* is a series of *delta*s that describe a diff from an existing
3250 entry (either that the recipient already has, or previously specified in the
3251 entry (either that the recipient already has, or previously specified in the
3251 bundle/changegroup).
3252 bundle/changegroup).
3252 </p>
3253 </p>
3253 <p>
3254 <p>
3254 The *delta header* is different between versions &quot;1&quot;, &quot;2&quot;, and
3255 The *delta header* is different between versions &quot;1&quot;, &quot;2&quot;, and
3255 &quot;3&quot; of the changegroup format.
3256 &quot;3&quot; of the changegroup format.
3256 </p>
3257 </p>
3257 <p>
3258 <p>
3258 Version 1 (headerlen=80):
3259 Version 1 (headerlen=80):
3259 </p>
3260 </p>
3260 <pre>
3261 <pre>
3261 +------------------------------------------------------+
3262 +------------------------------------------------------+
3262 | | | | |
3263 | | | | |
3263 | node | p1 node | p2 node | link node |
3264 | node | p1 node | p2 node | link node |
3264 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3265 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3265 | | | | |
3266 | | | | |
3266 +------------------------------------------------------+
3267 +------------------------------------------------------+
3267 </pre>
3268 </pre>
3268 <p>
3269 <p>
3269 Version 2 (headerlen=100):
3270 Version 2 (headerlen=100):
3270 </p>
3271 </p>
3271 <pre>
3272 <pre>
3272 +------------------------------------------------------------------+
3273 +------------------------------------------------------------------+
3273 | | | | | |
3274 | | | | | |
3274 | node | p1 node | p2 node | base node | link node |
3275 | node | p1 node | p2 node | base node | link node |
3275 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3276 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3276 | | | | | |
3277 | | | | | |
3277 +------------------------------------------------------------------+
3278 +------------------------------------------------------------------+
3278 </pre>
3279 </pre>
3279 <p>
3280 <p>
3280 Version 3 (headerlen=102):
3281 Version 3 (headerlen=102):
3281 </p>
3282 </p>
3282 <pre>
3283 <pre>
3283 +------------------------------------------------------------------------------+
3284 +------------------------------------------------------------------------------+
3284 | | | | | | |
3285 | | | | | | |
3285 | node | p1 node | p2 node | base node | link node | flags |
3286 | node | p1 node | p2 node | base node | link node | flags |
3286 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
3287 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
3287 | | | | | | |
3288 | | | | | | |
3288 +------------------------------------------------------------------------------+
3289 +------------------------------------------------------------------------------+
3289 </pre>
3290 </pre>
3290 <p>
3291 <p>
3291 The *delta data* consists of &quot;chunklen - 4 - headerlen&quot; bytes, which contain a
3292 The *delta data* consists of &quot;chunklen - 4 - headerlen&quot; bytes, which contain a
3292 series of *delta*s, densely packed (no separators). These deltas describe a diff
3293 series of *delta*s, densely packed (no separators). These deltas describe a diff
3293 from an existing entry (either that the recipient already has, or previously
3294 from an existing entry (either that the recipient already has, or previously
3294 specified in the bundle/changegroup). The format is described more fully in
3295 specified in the bundle/changegroup). The format is described more fully in
3295 &quot;hg help internals.bdiff&quot;, but briefly:
3296 &quot;hg help internals.bdiff&quot;, but briefly:
3296 </p>
3297 </p>
3297 <pre>
3298 <pre>
3298 +---------------------------------------------------------------+
3299 +---------------------------------------------------------------+
3299 | | | | |
3300 | | | | |
3300 | start offset | end offset | new length | content |
3301 | start offset | end offset | new length | content |
3301 | (4 bytes) | (4 bytes) | (4 bytes) | (&lt;new length&gt; bytes) |
3302 | (4 bytes) | (4 bytes) | (4 bytes) | (&lt;new length&gt; bytes) |
3302 | | | | |
3303 | | | | |
3303 +---------------------------------------------------------------+
3304 +---------------------------------------------------------------+
3304 </pre>
3305 </pre>
3305 <p>
3306 <p>
3306 Please note that the length field in the delta data does *not* include itself.
3307 Please note that the length field in the delta data does *not* include itself.
3307 </p>
3308 </p>
3308 <p>
3309 <p>
3309 In version 1, the delta is always applied against the previous node from
3310 In version 1, the delta is always applied against the previous node from
3310 the changegroup or the first parent if this is the first entry in the
3311 the changegroup or the first parent if this is the first entry in the
3311 changegroup.
3312 changegroup.
3312 </p>
3313 </p>
3313 <p>
3314 <p>
3314 In version 2 and up, the delta base node is encoded in the entry in the
3315 In version 2 and up, the delta base node is encoded in the entry in the
3315 changegroup. This allows the delta to be expressed against any parent,
3316 changegroup. This allows the delta to be expressed against any parent,
3316 which can result in smaller deltas and more efficient encoding of data.
3317 which can result in smaller deltas and more efficient encoding of data.
3317 </p>
3318 </p>
3318 <h2>Changeset Segment</h2>
3319 <h2>Changeset Segment</h2>
3319 <p>
3320 <p>
3320 The *changeset segment* consists of a single *delta group* holding
3321 The *changeset segment* consists of a single *delta group* holding
3321 changelog data. The *empty chunk* at the end of the *delta group* denotes
3322 changelog data. The *empty chunk* at the end of the *delta group* denotes
3322 the boundary to the *manifest segment*.
3323 the boundary to the *manifest segment*.
3323 </p>
3324 </p>
3324 <h2>Manifest Segment</h2>
3325 <h2>Manifest Segment</h2>
3325 <p>
3326 <p>
3326 The *manifest segment* consists of a single *delta group* holding manifest
3327 The *manifest segment* consists of a single *delta group* holding manifest
3327 data. If treemanifests are in use, it contains only the manifest for the
3328 data. If treemanifests are in use, it contains only the manifest for the
3328 root directory of the repository. Otherwise, it contains the entire
3329 root directory of the repository. Otherwise, it contains the entire
3329 manifest data. The *empty chunk* at the end of the *delta group* denotes
3330 manifest data. The *empty chunk* at the end of the *delta group* denotes
3330 the boundary to the next segment (either the *treemanifests segment* or the
3331 the boundary to the next segment (either the *treemanifests segment* or the
3331 *filelogs segment*, depending on version and the request options).
3332 *filelogs segment*, depending on version and the request options).
3332 </p>
3333 </p>
3333 <h3>Treemanifests Segment</h3>
3334 <h3>Treemanifests Segment</h3>
3334 <p>
3335 <p>
3335 The *treemanifests segment* only exists in changegroup version &quot;3&quot;, and
3336 The *treemanifests segment* only exists in changegroup version &quot;3&quot;, and
3336 only if the 'treemanifest' param is part of the bundle2 changegroup part
3337 only if the 'treemanifest' param is part of the bundle2 changegroup part
3337 (it is not possible to use changegroup version 3 outside of bundle2).
3338 (it is not possible to use changegroup version 3 outside of bundle2).
3338 Aside from the filenames in the *treemanifests segment* containing a
3339 Aside from the filenames in the *treemanifests segment* containing a
3339 trailing &quot;/&quot; character, it behaves identically to the *filelogs segment*
3340 trailing &quot;/&quot; character, it behaves identically to the *filelogs segment*
3340 (see below). The final sub-segment is followed by an *empty chunk* (logically,
3341 (see below). The final sub-segment is followed by an *empty chunk* (logically,
3341 a sub-segment with filename size 0). This denotes the boundary to the
3342 a sub-segment with filename size 0). This denotes the boundary to the
3342 *filelogs segment*.
3343 *filelogs segment*.
3343 </p>
3344 </p>
3344 <h2>Filelogs Segment</h2>
3345 <h2>Filelogs Segment</h2>
3345 <p>
3346 <p>
3346 The *filelogs segment* consists of multiple sub-segments, each
3347 The *filelogs segment* consists of multiple sub-segments, each
3347 corresponding to an individual file whose data is being described:
3348 corresponding to an individual file whose data is being described:
3348 </p>
3349 </p>
3349 <pre>
3350 <pre>
3350 +--------------------------------------------------+
3351 +--------------------------------------------------+
3351 | | | | | |
3352 | | | | | |
3352 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
3353 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
3353 | | | | | (4 bytes) |
3354 | | | | | (4 bytes) |
3354 | | | | | |
3355 | | | | | |
3355 +--------------------------------------------------+
3356 +--------------------------------------------------+
3356 </pre>
3357 </pre>
3357 <p>
3358 <p>
3358 The final filelog sub-segment is followed by an *empty chunk* (logically,
3359 The final filelog sub-segment is followed by an *empty chunk* (logically,
3359 a sub-segment with filename size 0). This denotes the end of the segment
3360 a sub-segment with filename size 0). This denotes the end of the segment
3360 and of the overall changegroup.
3361 and of the overall changegroup.
3361 </p>
3362 </p>
3362 <p>
3363 <p>
3363 Each filelog sub-segment consists of the following:
3364 Each filelog sub-segment consists of the following:
3364 </p>
3365 </p>
3365 <pre>
3366 <pre>
3366 +------------------------------------------------------+
3367 +------------------------------------------------------+
3367 | | | |
3368 | | | |
3368 | filename length | filename | delta group |
3369 | filename length | filename | delta group |
3369 | (4 bytes) | (&lt;length - 4&gt; bytes) | (various) |
3370 | (4 bytes) | (&lt;length - 4&gt; bytes) | (various) |
3370 | | | |
3371 | | | |
3371 +------------------------------------------------------+
3372 +------------------------------------------------------+
3372 </pre>
3373 </pre>
3373 <p>
3374 <p>
3374 That is, a *chunk* consisting of the filename (not terminated or padded)
3375 That is, a *chunk* consisting of the filename (not terminated or padded)
3375 followed by N chunks constituting the *delta group* for this file. The
3376 followed by N chunks constituting the *delta group* for this file. The
3376 *empty chunk* at the end of each *delta group* denotes the boundary to the
3377 *empty chunk* at the end of each *delta group* denotes the boundary to the
3377 next filelog sub-segment.
3378 next filelog sub-segment.
3378 </p>
3379 </p>
3379
3380
3380 </div>
3381 </div>
3381 </div>
3382 </div>
3382 </div>
3383 </div>
3383
3384
3384
3385
3385
3386
3386 </body>
3387 </body>
3387 </html>
3388 </html>
3388
3389
3389
3390
3390 $ killdaemons.py
3391 $ killdaemons.py
3391
3392
3392 #endif
3393 #endif
General Comments 0
You need to be logged in to leave comments. Login now