##// END OF EJS Templates
debug: add a debugcapabilities commands...
Boris Feld -
r34960:7ee2d859 default
parent child Browse files
Show More
@@ -1,2310 +1,2320 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 merge as mergemod,
51 merge as mergemod,
52 obsolete,
52 obsolete,
53 obsutil,
53 obsutil,
54 phases,
54 phases,
55 policy,
55 policy,
56 pvec,
56 pvec,
57 pycompat,
57 pycompat,
58 registrar,
58 registrar,
59 repair,
59 repair,
60 revlog,
60 revlog,
61 revset,
61 revset,
62 revsetlang,
62 revsetlang,
63 scmutil,
63 scmutil,
64 setdiscovery,
64 setdiscovery,
65 simplemerge,
65 simplemerge,
66 smartset,
66 smartset,
67 sslutil,
67 sslutil,
68 streamclone,
68 streamclone,
69 templater,
69 templater,
70 treediscovery,
70 treediscovery,
71 upgrade,
71 upgrade,
72 util,
72 util,
73 vfs as vfsmod,
73 vfs as vfsmod,
74 )
74 )
75
75
76 release = lockmod.release
76 release = lockmod.release
77
77
78 command = registrar.command()
78 command = registrar.command()
79
79
80 @command('debugancestor', [], _('[INDEX] REV1 REV2'), optionalrepo=True)
80 @command('debugancestor', [], _('[INDEX] REV1 REV2'), optionalrepo=True)
81 def debugancestor(ui, repo, *args):
81 def debugancestor(ui, repo, *args):
82 """find the ancestor revision of two revisions in a given index"""
82 """find the ancestor revision of two revisions in a given index"""
83 if len(args) == 3:
83 if len(args) == 3:
84 index, rev1, rev2 = args
84 index, rev1, rev2 = args
85 r = revlog.revlog(vfsmod.vfs(pycompat.getcwd(), audit=False), index)
85 r = revlog.revlog(vfsmod.vfs(pycompat.getcwd(), audit=False), index)
86 lookup = r.lookup
86 lookup = r.lookup
87 elif len(args) == 2:
87 elif len(args) == 2:
88 if not repo:
88 if not repo:
89 raise error.Abort(_('there is no Mercurial repository here '
89 raise error.Abort(_('there is no Mercurial repository here '
90 '(.hg not found)'))
90 '(.hg not found)'))
91 rev1, rev2 = args
91 rev1, rev2 = args
92 r = repo.changelog
92 r = repo.changelog
93 lookup = repo.lookup
93 lookup = repo.lookup
94 else:
94 else:
95 raise error.Abort(_('either two or three arguments required'))
95 raise error.Abort(_('either two or three arguments required'))
96 a = r.ancestor(lookup(rev1), lookup(rev2))
96 a = r.ancestor(lookup(rev1), lookup(rev2))
97 ui.write('%d:%s\n' % (r.rev(a), hex(a)))
97 ui.write('%d:%s\n' % (r.rev(a), hex(a)))
98
98
99 @command('debugapplystreamclonebundle', [], 'FILE')
99 @command('debugapplystreamclonebundle', [], 'FILE')
100 def debugapplystreamclonebundle(ui, repo, fname):
100 def debugapplystreamclonebundle(ui, repo, fname):
101 """apply a stream clone bundle file"""
101 """apply a stream clone bundle file"""
102 f = hg.openpath(ui, fname)
102 f = hg.openpath(ui, fname)
103 gen = exchange.readbundle(ui, f, fname)
103 gen = exchange.readbundle(ui, f, fname)
104 gen.apply(repo)
104 gen.apply(repo)
105
105
106 @command('debugbuilddag',
106 @command('debugbuilddag',
107 [('m', 'mergeable-file', None, _('add single file mergeable changes')),
107 [('m', 'mergeable-file', None, _('add single file mergeable changes')),
108 ('o', 'overwritten-file', None, _('add single file all revs overwrite')),
108 ('o', 'overwritten-file', None, _('add single file all revs overwrite')),
109 ('n', 'new-file', None, _('add new file at each rev'))],
109 ('n', 'new-file', None, _('add new file at each rev'))],
110 _('[OPTION]... [TEXT]'))
110 _('[OPTION]... [TEXT]'))
111 def debugbuilddag(ui, repo, text=None,
111 def debugbuilddag(ui, repo, text=None,
112 mergeable_file=False,
112 mergeable_file=False,
113 overwritten_file=False,
113 overwritten_file=False,
114 new_file=False):
114 new_file=False):
115 """builds a repo with a given DAG from scratch in the current empty repo
115 """builds a repo with a given DAG from scratch in the current empty repo
116
116
117 The description of the DAG is read from stdin if not given on the
117 The description of the DAG is read from stdin if not given on the
118 command line.
118 command line.
119
119
120 Elements:
120 Elements:
121
121
122 - "+n" is a linear run of n nodes based on the current default parent
122 - "+n" is a linear run of n nodes based on the current default parent
123 - "." is a single node based on the current default parent
123 - "." is a single node based on the current default parent
124 - "$" resets the default parent to null (implied at the start);
124 - "$" resets the default parent to null (implied at the start);
125 otherwise the default parent is always the last node created
125 otherwise the default parent is always the last node created
126 - "<p" sets the default parent to the backref p
126 - "<p" sets the default parent to the backref p
127 - "*p" is a fork at parent p, which is a backref
127 - "*p" is a fork at parent p, which is a backref
128 - "*p1/p2" is a merge of parents p1 and p2, which are backrefs
128 - "*p1/p2" is a merge of parents p1 and p2, which are backrefs
129 - "/p2" is a merge of the preceding node and p2
129 - "/p2" is a merge of the preceding node and p2
130 - ":tag" defines a local tag for the preceding node
130 - ":tag" defines a local tag for the preceding node
131 - "@branch" sets the named branch for subsequent nodes
131 - "@branch" sets the named branch for subsequent nodes
132 - "#...\\n" is a comment up to the end of the line
132 - "#...\\n" is a comment up to the end of the line
133
133
134 Whitespace between the above elements is ignored.
134 Whitespace between the above elements is ignored.
135
135
136 A backref is either
136 A backref is either
137
137
138 - a number n, which references the node curr-n, where curr is the current
138 - a number n, which references the node curr-n, where curr is the current
139 node, or
139 node, or
140 - the name of a local tag you placed earlier using ":tag", or
140 - the name of a local tag you placed earlier using ":tag", or
141 - empty to denote the default parent.
141 - empty to denote the default parent.
142
142
143 All string valued-elements are either strictly alphanumeric, or must
143 All string valued-elements are either strictly alphanumeric, or must
144 be enclosed in double quotes ("..."), with "\\" as escape character.
144 be enclosed in double quotes ("..."), with "\\" as escape character.
145 """
145 """
146
146
147 if text is None:
147 if text is None:
148 ui.status(_("reading DAG from stdin\n"))
148 ui.status(_("reading DAG from stdin\n"))
149 text = ui.fin.read()
149 text = ui.fin.read()
150
150
151 cl = repo.changelog
151 cl = repo.changelog
152 if len(cl) > 0:
152 if len(cl) > 0:
153 raise error.Abort(_('repository is not empty'))
153 raise error.Abort(_('repository is not empty'))
154
154
155 # determine number of revs in DAG
155 # determine number of revs in DAG
156 total = 0
156 total = 0
157 for type, data in dagparser.parsedag(text):
157 for type, data in dagparser.parsedag(text):
158 if type == 'n':
158 if type == 'n':
159 total += 1
159 total += 1
160
160
161 if mergeable_file:
161 if mergeable_file:
162 linesperrev = 2
162 linesperrev = 2
163 # make a file with k lines per rev
163 # make a file with k lines per rev
164 initialmergedlines = [str(i) for i in xrange(0, total * linesperrev)]
164 initialmergedlines = [str(i) for i in xrange(0, total * linesperrev)]
165 initialmergedlines.append("")
165 initialmergedlines.append("")
166
166
167 tags = []
167 tags = []
168
168
169 wlock = lock = tr = None
169 wlock = lock = tr = None
170 try:
170 try:
171 wlock = repo.wlock()
171 wlock = repo.wlock()
172 lock = repo.lock()
172 lock = repo.lock()
173 tr = repo.transaction("builddag")
173 tr = repo.transaction("builddag")
174
174
175 at = -1
175 at = -1
176 atbranch = 'default'
176 atbranch = 'default'
177 nodeids = []
177 nodeids = []
178 id = 0
178 id = 0
179 ui.progress(_('building'), id, unit=_('revisions'), total=total)
179 ui.progress(_('building'), id, unit=_('revisions'), total=total)
180 for type, data in dagparser.parsedag(text):
180 for type, data in dagparser.parsedag(text):
181 if type == 'n':
181 if type == 'n':
182 ui.note(('node %s\n' % str(data)))
182 ui.note(('node %s\n' % str(data)))
183 id, ps = data
183 id, ps = data
184
184
185 files = []
185 files = []
186 fctxs = {}
186 fctxs = {}
187
187
188 p2 = None
188 p2 = None
189 if mergeable_file:
189 if mergeable_file:
190 fn = "mf"
190 fn = "mf"
191 p1 = repo[ps[0]]
191 p1 = repo[ps[0]]
192 if len(ps) > 1:
192 if len(ps) > 1:
193 p2 = repo[ps[1]]
193 p2 = repo[ps[1]]
194 pa = p1.ancestor(p2)
194 pa = p1.ancestor(p2)
195 base, local, other = [x[fn].data() for x in (pa, p1,
195 base, local, other = [x[fn].data() for x in (pa, p1,
196 p2)]
196 p2)]
197 m3 = simplemerge.Merge3Text(base, local, other)
197 m3 = simplemerge.Merge3Text(base, local, other)
198 ml = [l.strip() for l in m3.merge_lines()]
198 ml = [l.strip() for l in m3.merge_lines()]
199 ml.append("")
199 ml.append("")
200 elif at > 0:
200 elif at > 0:
201 ml = p1[fn].data().split("\n")
201 ml = p1[fn].data().split("\n")
202 else:
202 else:
203 ml = initialmergedlines
203 ml = initialmergedlines
204 ml[id * linesperrev] += " r%i" % id
204 ml[id * linesperrev] += " r%i" % id
205 mergedtext = "\n".join(ml)
205 mergedtext = "\n".join(ml)
206 files.append(fn)
206 files.append(fn)
207 fctxs[fn] = context.memfilectx(repo, fn, mergedtext)
207 fctxs[fn] = context.memfilectx(repo, fn, mergedtext)
208
208
209 if overwritten_file:
209 if overwritten_file:
210 fn = "of"
210 fn = "of"
211 files.append(fn)
211 files.append(fn)
212 fctxs[fn] = context.memfilectx(repo, fn, "r%i\n" % id)
212 fctxs[fn] = context.memfilectx(repo, fn, "r%i\n" % id)
213
213
214 if new_file:
214 if new_file:
215 fn = "nf%i" % id
215 fn = "nf%i" % id
216 files.append(fn)
216 files.append(fn)
217 fctxs[fn] = context.memfilectx(repo, fn, "r%i\n" % id)
217 fctxs[fn] = context.memfilectx(repo, fn, "r%i\n" % id)
218 if len(ps) > 1:
218 if len(ps) > 1:
219 if not p2:
219 if not p2:
220 p2 = repo[ps[1]]
220 p2 = repo[ps[1]]
221 for fn in p2:
221 for fn in p2:
222 if fn.startswith("nf"):
222 if fn.startswith("nf"):
223 files.append(fn)
223 files.append(fn)
224 fctxs[fn] = p2[fn]
224 fctxs[fn] = p2[fn]
225
225
226 def fctxfn(repo, cx, path):
226 def fctxfn(repo, cx, path):
227 return fctxs.get(path)
227 return fctxs.get(path)
228
228
229 if len(ps) == 0 or ps[0] < 0:
229 if len(ps) == 0 or ps[0] < 0:
230 pars = [None, None]
230 pars = [None, None]
231 elif len(ps) == 1:
231 elif len(ps) == 1:
232 pars = [nodeids[ps[0]], None]
232 pars = [nodeids[ps[0]], None]
233 else:
233 else:
234 pars = [nodeids[p] for p in ps]
234 pars = [nodeids[p] for p in ps]
235 cx = context.memctx(repo, pars, "r%i" % id, files, fctxfn,
235 cx = context.memctx(repo, pars, "r%i" % id, files, fctxfn,
236 date=(id, 0),
236 date=(id, 0),
237 user="debugbuilddag",
237 user="debugbuilddag",
238 extra={'branch': atbranch})
238 extra={'branch': atbranch})
239 nodeid = repo.commitctx(cx)
239 nodeid = repo.commitctx(cx)
240 nodeids.append(nodeid)
240 nodeids.append(nodeid)
241 at = id
241 at = id
242 elif type == 'l':
242 elif type == 'l':
243 id, name = data
243 id, name = data
244 ui.note(('tag %s\n' % name))
244 ui.note(('tag %s\n' % name))
245 tags.append("%s %s\n" % (hex(repo.changelog.node(id)), name))
245 tags.append("%s %s\n" % (hex(repo.changelog.node(id)), name))
246 elif type == 'a':
246 elif type == 'a':
247 ui.note(('branch %s\n' % data))
247 ui.note(('branch %s\n' % data))
248 atbranch = data
248 atbranch = data
249 ui.progress(_('building'), id, unit=_('revisions'), total=total)
249 ui.progress(_('building'), id, unit=_('revisions'), total=total)
250 tr.close()
250 tr.close()
251
251
252 if tags:
252 if tags:
253 repo.vfs.write("localtags", "".join(tags))
253 repo.vfs.write("localtags", "".join(tags))
254 finally:
254 finally:
255 ui.progress(_('building'), None)
255 ui.progress(_('building'), None)
256 release(tr, lock, wlock)
256 release(tr, lock, wlock)
257
257
258 def _debugchangegroup(ui, gen, all=None, indent=0, **opts):
258 def _debugchangegroup(ui, gen, all=None, indent=0, **opts):
259 indent_string = ' ' * indent
259 indent_string = ' ' * indent
260 if all:
260 if all:
261 ui.write(("%sformat: id, p1, p2, cset, delta base, len(delta)\n")
261 ui.write(("%sformat: id, p1, p2, cset, delta base, len(delta)\n")
262 % indent_string)
262 % indent_string)
263
263
264 def showchunks(named):
264 def showchunks(named):
265 ui.write("\n%s%s\n" % (indent_string, named))
265 ui.write("\n%s%s\n" % (indent_string, named))
266 for deltadata in gen.deltaiter():
266 for deltadata in gen.deltaiter():
267 node, p1, p2, cs, deltabase, delta, flags = deltadata
267 node, p1, p2, cs, deltabase, delta, flags = deltadata
268 ui.write("%s%s %s %s %s %s %s\n" %
268 ui.write("%s%s %s %s %s %s %s\n" %
269 (indent_string, hex(node), hex(p1), hex(p2),
269 (indent_string, hex(node), hex(p1), hex(p2),
270 hex(cs), hex(deltabase), len(delta)))
270 hex(cs), hex(deltabase), len(delta)))
271
271
272 chunkdata = gen.changelogheader()
272 chunkdata = gen.changelogheader()
273 showchunks("changelog")
273 showchunks("changelog")
274 chunkdata = gen.manifestheader()
274 chunkdata = gen.manifestheader()
275 showchunks("manifest")
275 showchunks("manifest")
276 for chunkdata in iter(gen.filelogheader, {}):
276 for chunkdata in iter(gen.filelogheader, {}):
277 fname = chunkdata['filename']
277 fname = chunkdata['filename']
278 showchunks(fname)
278 showchunks(fname)
279 else:
279 else:
280 if isinstance(gen, bundle2.unbundle20):
280 if isinstance(gen, bundle2.unbundle20):
281 raise error.Abort(_('use debugbundle2 for this file'))
281 raise error.Abort(_('use debugbundle2 for this file'))
282 chunkdata = gen.changelogheader()
282 chunkdata = gen.changelogheader()
283 for deltadata in gen.deltaiter():
283 for deltadata in gen.deltaiter():
284 node, p1, p2, cs, deltabase, delta, flags = deltadata
284 node, p1, p2, cs, deltabase, delta, flags = deltadata
285 ui.write("%s%s\n" % (indent_string, hex(node)))
285 ui.write("%s%s\n" % (indent_string, hex(node)))
286
286
287 def _debugobsmarkers(ui, part, indent=0, **opts):
287 def _debugobsmarkers(ui, part, indent=0, **opts):
288 """display version and markers contained in 'data'"""
288 """display version and markers contained in 'data'"""
289 opts = pycompat.byteskwargs(opts)
289 opts = pycompat.byteskwargs(opts)
290 data = part.read()
290 data = part.read()
291 indent_string = ' ' * indent
291 indent_string = ' ' * indent
292 try:
292 try:
293 version, markers = obsolete._readmarkers(data)
293 version, markers = obsolete._readmarkers(data)
294 except error.UnknownVersion as exc:
294 except error.UnknownVersion as exc:
295 msg = "%sunsupported version: %s (%d bytes)\n"
295 msg = "%sunsupported version: %s (%d bytes)\n"
296 msg %= indent_string, exc.version, len(data)
296 msg %= indent_string, exc.version, len(data)
297 ui.write(msg)
297 ui.write(msg)
298 else:
298 else:
299 msg = "%sversion: %s (%d bytes)\n"
299 msg = "%sversion: %s (%d bytes)\n"
300 msg %= indent_string, version, len(data)
300 msg %= indent_string, version, len(data)
301 ui.write(msg)
301 ui.write(msg)
302 fm = ui.formatter('debugobsolete', opts)
302 fm = ui.formatter('debugobsolete', opts)
303 for rawmarker in sorted(markers):
303 for rawmarker in sorted(markers):
304 m = obsutil.marker(None, rawmarker)
304 m = obsutil.marker(None, rawmarker)
305 fm.startitem()
305 fm.startitem()
306 fm.plain(indent_string)
306 fm.plain(indent_string)
307 cmdutil.showmarker(fm, m)
307 cmdutil.showmarker(fm, m)
308 fm.end()
308 fm.end()
309
309
310 def _debugphaseheads(ui, data, indent=0):
310 def _debugphaseheads(ui, data, indent=0):
311 """display version and markers contained in 'data'"""
311 """display version and markers contained in 'data'"""
312 indent_string = ' ' * indent
312 indent_string = ' ' * indent
313 headsbyphase = phases.binarydecode(data)
313 headsbyphase = phases.binarydecode(data)
314 for phase in phases.allphases:
314 for phase in phases.allphases:
315 for head in headsbyphase[phase]:
315 for head in headsbyphase[phase]:
316 ui.write(indent_string)
316 ui.write(indent_string)
317 ui.write('%s %s\n' % (hex(head), phases.phasenames[phase]))
317 ui.write('%s %s\n' % (hex(head), phases.phasenames[phase]))
318
318
319 def _quasirepr(thing):
319 def _quasirepr(thing):
320 if isinstance(thing, (dict, util.sortdict, collections.OrderedDict)):
320 if isinstance(thing, (dict, util.sortdict, collections.OrderedDict)):
321 return '{%s}' % (
321 return '{%s}' % (
322 b', '.join(b'%s: %s' % (k, thing[k]) for k in sorted(thing)))
322 b', '.join(b'%s: %s' % (k, thing[k]) for k in sorted(thing)))
323 return pycompat.bytestr(repr(thing))
323 return pycompat.bytestr(repr(thing))
324
324
325 def _debugbundle2(ui, gen, all=None, **opts):
325 def _debugbundle2(ui, gen, all=None, **opts):
326 """lists the contents of a bundle2"""
326 """lists the contents of a bundle2"""
327 if not isinstance(gen, bundle2.unbundle20):
327 if not isinstance(gen, bundle2.unbundle20):
328 raise error.Abort(_('not a bundle2 file'))
328 raise error.Abort(_('not a bundle2 file'))
329 ui.write(('Stream params: %s\n' % _quasirepr(gen.params)))
329 ui.write(('Stream params: %s\n' % _quasirepr(gen.params)))
330 parttypes = opts.get(r'part_type', [])
330 parttypes = opts.get(r'part_type', [])
331 for part in gen.iterparts():
331 for part in gen.iterparts():
332 if parttypes and part.type not in parttypes:
332 if parttypes and part.type not in parttypes:
333 continue
333 continue
334 ui.write('%s -- %s\n' % (part.type, _quasirepr(part.params)))
334 ui.write('%s -- %s\n' % (part.type, _quasirepr(part.params)))
335 if part.type == 'changegroup':
335 if part.type == 'changegroup':
336 version = part.params.get('version', '01')
336 version = part.params.get('version', '01')
337 cg = changegroup.getunbundler(version, part, 'UN')
337 cg = changegroup.getunbundler(version, part, 'UN')
338 _debugchangegroup(ui, cg, all=all, indent=4, **opts)
338 _debugchangegroup(ui, cg, all=all, indent=4, **opts)
339 if part.type == 'obsmarkers':
339 if part.type == 'obsmarkers':
340 _debugobsmarkers(ui, part, indent=4, **opts)
340 _debugobsmarkers(ui, part, indent=4, **opts)
341 if part.type == 'phase-heads':
341 if part.type == 'phase-heads':
342 _debugphaseheads(ui, part, indent=4)
342 _debugphaseheads(ui, part, indent=4)
343
343
344 @command('debugbundle',
344 @command('debugbundle',
345 [('a', 'all', None, _('show all details')),
345 [('a', 'all', None, _('show all details')),
346 ('', 'part-type', [], _('show only the named part type')),
346 ('', 'part-type', [], _('show only the named part type')),
347 ('', 'spec', None, _('print the bundlespec of the bundle'))],
347 ('', 'spec', None, _('print the bundlespec of the bundle'))],
348 _('FILE'),
348 _('FILE'),
349 norepo=True)
349 norepo=True)
350 def debugbundle(ui, bundlepath, all=None, spec=None, **opts):
350 def debugbundle(ui, bundlepath, all=None, spec=None, **opts):
351 """lists the contents of a bundle"""
351 """lists the contents of a bundle"""
352 with hg.openpath(ui, bundlepath) as f:
352 with hg.openpath(ui, bundlepath) as f:
353 if spec:
353 if spec:
354 spec = exchange.getbundlespec(ui, f)
354 spec = exchange.getbundlespec(ui, f)
355 ui.write('%s\n' % spec)
355 ui.write('%s\n' % spec)
356 return
356 return
357
357
358 gen = exchange.readbundle(ui, f, bundlepath)
358 gen = exchange.readbundle(ui, f, bundlepath)
359 if isinstance(gen, bundle2.unbundle20):
359 if isinstance(gen, bundle2.unbundle20):
360 return _debugbundle2(ui, gen, all=all, **opts)
360 return _debugbundle2(ui, gen, all=all, **opts)
361 _debugchangegroup(ui, gen, all=all, **opts)
361 _debugchangegroup(ui, gen, all=all, **opts)
362
362
363 @command('debugcapabilities',
364 [], _('PATH'),
365 norepo=True)
366 def debugcapabilities(ui, path, **opts):
367 """lists the capabilities of a remote peer"""
368 peer = hg.peer(ui, opts, path)
369 caps = peer.capabilities()
370 ui.write(('Main capabilities:\n'))
371 for c in sorted(caps):
372 ui.write((' %s\n') % c)
363 @command('debugcheckstate', [], '')
373 @command('debugcheckstate', [], '')
364 def debugcheckstate(ui, repo):
374 def debugcheckstate(ui, repo):
365 """validate the correctness of the current dirstate"""
375 """validate the correctness of the current dirstate"""
366 parent1, parent2 = repo.dirstate.parents()
376 parent1, parent2 = repo.dirstate.parents()
367 m1 = repo[parent1].manifest()
377 m1 = repo[parent1].manifest()
368 m2 = repo[parent2].manifest()
378 m2 = repo[parent2].manifest()
369 errors = 0
379 errors = 0
370 for f in repo.dirstate:
380 for f in repo.dirstate:
371 state = repo.dirstate[f]
381 state = repo.dirstate[f]
372 if state in "nr" and f not in m1:
382 if state in "nr" and f not in m1:
373 ui.warn(_("%s in state %s, but not in manifest1\n") % (f, state))
383 ui.warn(_("%s in state %s, but not in manifest1\n") % (f, state))
374 errors += 1
384 errors += 1
375 if state in "a" and f in m1:
385 if state in "a" and f in m1:
376 ui.warn(_("%s in state %s, but also in manifest1\n") % (f, state))
386 ui.warn(_("%s in state %s, but also in manifest1\n") % (f, state))
377 errors += 1
387 errors += 1
378 if state in "m" and f not in m1 and f not in m2:
388 if state in "m" and f not in m1 and f not in m2:
379 ui.warn(_("%s in state %s, but not in either manifest\n") %
389 ui.warn(_("%s in state %s, but not in either manifest\n") %
380 (f, state))
390 (f, state))
381 errors += 1
391 errors += 1
382 for f in m1:
392 for f in m1:
383 state = repo.dirstate[f]
393 state = repo.dirstate[f]
384 if state not in "nrm":
394 if state not in "nrm":
385 ui.warn(_("%s in manifest1, but listed as state %s") % (f, state))
395 ui.warn(_("%s in manifest1, but listed as state %s") % (f, state))
386 errors += 1
396 errors += 1
387 if errors:
397 if errors:
388 error = _(".hg/dirstate inconsistent with current parent's manifest")
398 error = _(".hg/dirstate inconsistent with current parent's manifest")
389 raise error.Abort(error)
399 raise error.Abort(error)
390
400
391 @command('debugcolor',
401 @command('debugcolor',
392 [('', 'style', None, _('show all configured styles'))],
402 [('', 'style', None, _('show all configured styles'))],
393 'hg debugcolor')
403 'hg debugcolor')
394 def debugcolor(ui, repo, **opts):
404 def debugcolor(ui, repo, **opts):
395 """show available color, effects or style"""
405 """show available color, effects or style"""
396 ui.write(('color mode: %s\n') % ui._colormode)
406 ui.write(('color mode: %s\n') % ui._colormode)
397 if opts.get(r'style'):
407 if opts.get(r'style'):
398 return _debugdisplaystyle(ui)
408 return _debugdisplaystyle(ui)
399 else:
409 else:
400 return _debugdisplaycolor(ui)
410 return _debugdisplaycolor(ui)
401
411
402 def _debugdisplaycolor(ui):
412 def _debugdisplaycolor(ui):
403 ui = ui.copy()
413 ui = ui.copy()
404 ui._styles.clear()
414 ui._styles.clear()
405 for effect in color._activeeffects(ui).keys():
415 for effect in color._activeeffects(ui).keys():
406 ui._styles[effect] = effect
416 ui._styles[effect] = effect
407 if ui._terminfoparams:
417 if ui._terminfoparams:
408 for k, v in ui.configitems('color'):
418 for k, v in ui.configitems('color'):
409 if k.startswith('color.'):
419 if k.startswith('color.'):
410 ui._styles[k] = k[6:]
420 ui._styles[k] = k[6:]
411 elif k.startswith('terminfo.'):
421 elif k.startswith('terminfo.'):
412 ui._styles[k] = k[9:]
422 ui._styles[k] = k[9:]
413 ui.write(_('available colors:\n'))
423 ui.write(_('available colors:\n'))
414 # sort label with a '_' after the other to group '_background' entry.
424 # sort label with a '_' after the other to group '_background' entry.
415 items = sorted(ui._styles.items(),
425 items = sorted(ui._styles.items(),
416 key=lambda i: ('_' in i[0], i[0], i[1]))
426 key=lambda i: ('_' in i[0], i[0], i[1]))
417 for colorname, label in items:
427 for colorname, label in items:
418 ui.write(('%s\n') % colorname, label=label)
428 ui.write(('%s\n') % colorname, label=label)
419
429
420 def _debugdisplaystyle(ui):
430 def _debugdisplaystyle(ui):
421 ui.write(_('available style:\n'))
431 ui.write(_('available style:\n'))
422 width = max(len(s) for s in ui._styles)
432 width = max(len(s) for s in ui._styles)
423 for label, effects in sorted(ui._styles.items()):
433 for label, effects in sorted(ui._styles.items()):
424 ui.write('%s' % label, label=label)
434 ui.write('%s' % label, label=label)
425 if effects:
435 if effects:
426 # 50
436 # 50
427 ui.write(': ')
437 ui.write(': ')
428 ui.write(' ' * (max(0, width - len(label))))
438 ui.write(' ' * (max(0, width - len(label))))
429 ui.write(', '.join(ui.label(e, e) for e in effects.split()))
439 ui.write(', '.join(ui.label(e, e) for e in effects.split()))
430 ui.write('\n')
440 ui.write('\n')
431
441
432 @command('debugcreatestreamclonebundle', [], 'FILE')
442 @command('debugcreatestreamclonebundle', [], 'FILE')
433 def debugcreatestreamclonebundle(ui, repo, fname):
443 def debugcreatestreamclonebundle(ui, repo, fname):
434 """create a stream clone bundle file
444 """create a stream clone bundle file
435
445
436 Stream bundles are special bundles that are essentially archives of
446 Stream bundles are special bundles that are essentially archives of
437 revlog files. They are commonly used for cloning very quickly.
447 revlog files. They are commonly used for cloning very quickly.
438 """
448 """
439 # TODO we may want to turn this into an abort when this functionality
449 # TODO we may want to turn this into an abort when this functionality
440 # is moved into `hg bundle`.
450 # is moved into `hg bundle`.
441 if phases.hassecret(repo):
451 if phases.hassecret(repo):
442 ui.warn(_('(warning: stream clone bundle will contain secret '
452 ui.warn(_('(warning: stream clone bundle will contain secret '
443 'revisions)\n'))
453 'revisions)\n'))
444
454
445 requirements, gen = streamclone.generatebundlev1(repo)
455 requirements, gen = streamclone.generatebundlev1(repo)
446 changegroup.writechunks(ui, gen, fname)
456 changegroup.writechunks(ui, gen, fname)
447
457
448 ui.write(_('bundle requirements: %s\n') % ', '.join(sorted(requirements)))
458 ui.write(_('bundle requirements: %s\n') % ', '.join(sorted(requirements)))
449
459
450 @command('debugdag',
460 @command('debugdag',
451 [('t', 'tags', None, _('use tags as labels')),
461 [('t', 'tags', None, _('use tags as labels')),
452 ('b', 'branches', None, _('annotate with branch names')),
462 ('b', 'branches', None, _('annotate with branch names')),
453 ('', 'dots', None, _('use dots for runs')),
463 ('', 'dots', None, _('use dots for runs')),
454 ('s', 'spaces', None, _('separate elements by spaces'))],
464 ('s', 'spaces', None, _('separate elements by spaces'))],
455 _('[OPTION]... [FILE [REV]...]'),
465 _('[OPTION]... [FILE [REV]...]'),
456 optionalrepo=True)
466 optionalrepo=True)
457 def debugdag(ui, repo, file_=None, *revs, **opts):
467 def debugdag(ui, repo, file_=None, *revs, **opts):
458 """format the changelog or an index DAG as a concise textual description
468 """format the changelog or an index DAG as a concise textual description
459
469
460 If you pass a revlog index, the revlog's DAG is emitted. If you list
470 If you pass a revlog index, the revlog's DAG is emitted. If you list
461 revision numbers, they get labeled in the output as rN.
471 revision numbers, they get labeled in the output as rN.
462
472
463 Otherwise, the changelog DAG of the current repo is emitted.
473 Otherwise, the changelog DAG of the current repo is emitted.
464 """
474 """
465 spaces = opts.get(r'spaces')
475 spaces = opts.get(r'spaces')
466 dots = opts.get(r'dots')
476 dots = opts.get(r'dots')
467 if file_:
477 if file_:
468 rlog = revlog.revlog(vfsmod.vfs(pycompat.getcwd(), audit=False),
478 rlog = revlog.revlog(vfsmod.vfs(pycompat.getcwd(), audit=False),
469 file_)
479 file_)
470 revs = set((int(r) for r in revs))
480 revs = set((int(r) for r in revs))
471 def events():
481 def events():
472 for r in rlog:
482 for r in rlog:
473 yield 'n', (r, list(p for p in rlog.parentrevs(r)
483 yield 'n', (r, list(p for p in rlog.parentrevs(r)
474 if p != -1))
484 if p != -1))
475 if r in revs:
485 if r in revs:
476 yield 'l', (r, "r%i" % r)
486 yield 'l', (r, "r%i" % r)
477 elif repo:
487 elif repo:
478 cl = repo.changelog
488 cl = repo.changelog
479 tags = opts.get(r'tags')
489 tags = opts.get(r'tags')
480 branches = opts.get(r'branches')
490 branches = opts.get(r'branches')
481 if tags:
491 if tags:
482 labels = {}
492 labels = {}
483 for l, n in repo.tags().items():
493 for l, n in repo.tags().items():
484 labels.setdefault(cl.rev(n), []).append(l)
494 labels.setdefault(cl.rev(n), []).append(l)
485 def events():
495 def events():
486 b = "default"
496 b = "default"
487 for r in cl:
497 for r in cl:
488 if branches:
498 if branches:
489 newb = cl.read(cl.node(r))[5]['branch']
499 newb = cl.read(cl.node(r))[5]['branch']
490 if newb != b:
500 if newb != b:
491 yield 'a', newb
501 yield 'a', newb
492 b = newb
502 b = newb
493 yield 'n', (r, list(p for p in cl.parentrevs(r)
503 yield 'n', (r, list(p for p in cl.parentrevs(r)
494 if p != -1))
504 if p != -1))
495 if tags:
505 if tags:
496 ls = labels.get(r)
506 ls = labels.get(r)
497 if ls:
507 if ls:
498 for l in ls:
508 for l in ls:
499 yield 'l', (r, l)
509 yield 'l', (r, l)
500 else:
510 else:
501 raise error.Abort(_('need repo for changelog dag'))
511 raise error.Abort(_('need repo for changelog dag'))
502
512
503 for line in dagparser.dagtextlines(events(),
513 for line in dagparser.dagtextlines(events(),
504 addspaces=spaces,
514 addspaces=spaces,
505 wraplabels=True,
515 wraplabels=True,
506 wrapannotations=True,
516 wrapannotations=True,
507 wrapnonlinear=dots,
517 wrapnonlinear=dots,
508 usedots=dots,
518 usedots=dots,
509 maxlinewidth=70):
519 maxlinewidth=70):
510 ui.write(line)
520 ui.write(line)
511 ui.write("\n")
521 ui.write("\n")
512
522
513 @command('debugdata', cmdutil.debugrevlogopts, _('-c|-m|FILE REV'))
523 @command('debugdata', cmdutil.debugrevlogopts, _('-c|-m|FILE REV'))
514 def debugdata(ui, repo, file_, rev=None, **opts):
524 def debugdata(ui, repo, file_, rev=None, **opts):
515 """dump the contents of a data file revision"""
525 """dump the contents of a data file revision"""
516 opts = pycompat.byteskwargs(opts)
526 opts = pycompat.byteskwargs(opts)
517 if opts.get('changelog') or opts.get('manifest') or opts.get('dir'):
527 if opts.get('changelog') or opts.get('manifest') or opts.get('dir'):
518 if rev is not None:
528 if rev is not None:
519 raise error.CommandError('debugdata', _('invalid arguments'))
529 raise error.CommandError('debugdata', _('invalid arguments'))
520 file_, rev = None, file_
530 file_, rev = None, file_
521 elif rev is None:
531 elif rev is None:
522 raise error.CommandError('debugdata', _('invalid arguments'))
532 raise error.CommandError('debugdata', _('invalid arguments'))
523 r = cmdutil.openrevlog(repo, 'debugdata', file_, opts)
533 r = cmdutil.openrevlog(repo, 'debugdata', file_, opts)
524 try:
534 try:
525 ui.write(r.revision(r.lookup(rev), raw=True))
535 ui.write(r.revision(r.lookup(rev), raw=True))
526 except KeyError:
536 except KeyError:
527 raise error.Abort(_('invalid revision identifier %s') % rev)
537 raise error.Abort(_('invalid revision identifier %s') % rev)
528
538
529 @command('debugdate',
539 @command('debugdate',
530 [('e', 'extended', None, _('try extended date formats'))],
540 [('e', 'extended', None, _('try extended date formats'))],
531 _('[-e] DATE [RANGE]'),
541 _('[-e] DATE [RANGE]'),
532 norepo=True, optionalrepo=True)
542 norepo=True, optionalrepo=True)
533 def debugdate(ui, date, range=None, **opts):
543 def debugdate(ui, date, range=None, **opts):
534 """parse and display a date"""
544 """parse and display a date"""
535 if opts[r"extended"]:
545 if opts[r"extended"]:
536 d = util.parsedate(date, util.extendeddateformats)
546 d = util.parsedate(date, util.extendeddateformats)
537 else:
547 else:
538 d = util.parsedate(date)
548 d = util.parsedate(date)
539 ui.write(("internal: %s %s\n") % d)
549 ui.write(("internal: %s %s\n") % d)
540 ui.write(("standard: %s\n") % util.datestr(d))
550 ui.write(("standard: %s\n") % util.datestr(d))
541 if range:
551 if range:
542 m = util.matchdate(range)
552 m = util.matchdate(range)
543 ui.write(("match: %s\n") % m(d[0]))
553 ui.write(("match: %s\n") % m(d[0]))
544
554
545 @command('debugdeltachain',
555 @command('debugdeltachain',
546 cmdutil.debugrevlogopts + cmdutil.formatteropts,
556 cmdutil.debugrevlogopts + cmdutil.formatteropts,
547 _('-c|-m|FILE'),
557 _('-c|-m|FILE'),
548 optionalrepo=True)
558 optionalrepo=True)
549 def debugdeltachain(ui, repo, file_=None, **opts):
559 def debugdeltachain(ui, repo, file_=None, **opts):
550 """dump information about delta chains in a revlog
560 """dump information about delta chains in a revlog
551
561
552 Output can be templatized. Available template keywords are:
562 Output can be templatized. Available template keywords are:
553
563
554 :``rev``: revision number
564 :``rev``: revision number
555 :``chainid``: delta chain identifier (numbered by unique base)
565 :``chainid``: delta chain identifier (numbered by unique base)
556 :``chainlen``: delta chain length to this revision
566 :``chainlen``: delta chain length to this revision
557 :``prevrev``: previous revision in delta chain
567 :``prevrev``: previous revision in delta chain
558 :``deltatype``: role of delta / how it was computed
568 :``deltatype``: role of delta / how it was computed
559 :``compsize``: compressed size of revision
569 :``compsize``: compressed size of revision
560 :``uncompsize``: uncompressed size of revision
570 :``uncompsize``: uncompressed size of revision
561 :``chainsize``: total size of compressed revisions in chain
571 :``chainsize``: total size of compressed revisions in chain
562 :``chainratio``: total chain size divided by uncompressed revision size
572 :``chainratio``: total chain size divided by uncompressed revision size
563 (new delta chains typically start at ratio 2.00)
573 (new delta chains typically start at ratio 2.00)
564 :``lindist``: linear distance from base revision in delta chain to end
574 :``lindist``: linear distance from base revision in delta chain to end
565 of this revision
575 of this revision
566 :``extradist``: total size of revisions not part of this delta chain from
576 :``extradist``: total size of revisions not part of this delta chain from
567 base of delta chain to end of this revision; a measurement
577 base of delta chain to end of this revision; a measurement
568 of how much extra data we need to read/seek across to read
578 of how much extra data we need to read/seek across to read
569 the delta chain for this revision
579 the delta chain for this revision
570 :``extraratio``: extradist divided by chainsize; another representation of
580 :``extraratio``: extradist divided by chainsize; another representation of
571 how much unrelated data is needed to load this delta chain
581 how much unrelated data is needed to load this delta chain
572 """
582 """
573 opts = pycompat.byteskwargs(opts)
583 opts = pycompat.byteskwargs(opts)
574 r = cmdutil.openrevlog(repo, 'debugdeltachain', file_, opts)
584 r = cmdutil.openrevlog(repo, 'debugdeltachain', file_, opts)
575 index = r.index
585 index = r.index
576 generaldelta = r.version & revlog.FLAG_GENERALDELTA
586 generaldelta = r.version & revlog.FLAG_GENERALDELTA
577
587
578 def revinfo(rev):
588 def revinfo(rev):
579 e = index[rev]
589 e = index[rev]
580 compsize = e[1]
590 compsize = e[1]
581 uncompsize = e[2]
591 uncompsize = e[2]
582 chainsize = 0
592 chainsize = 0
583
593
584 if generaldelta:
594 if generaldelta:
585 if e[3] == e[5]:
595 if e[3] == e[5]:
586 deltatype = 'p1'
596 deltatype = 'p1'
587 elif e[3] == e[6]:
597 elif e[3] == e[6]:
588 deltatype = 'p2'
598 deltatype = 'p2'
589 elif e[3] == rev - 1:
599 elif e[3] == rev - 1:
590 deltatype = 'prev'
600 deltatype = 'prev'
591 elif e[3] == rev:
601 elif e[3] == rev:
592 deltatype = 'base'
602 deltatype = 'base'
593 else:
603 else:
594 deltatype = 'other'
604 deltatype = 'other'
595 else:
605 else:
596 if e[3] == rev:
606 if e[3] == rev:
597 deltatype = 'base'
607 deltatype = 'base'
598 else:
608 else:
599 deltatype = 'prev'
609 deltatype = 'prev'
600
610
601 chain = r._deltachain(rev)[0]
611 chain = r._deltachain(rev)[0]
602 for iterrev in chain:
612 for iterrev in chain:
603 e = index[iterrev]
613 e = index[iterrev]
604 chainsize += e[1]
614 chainsize += e[1]
605
615
606 return compsize, uncompsize, deltatype, chain, chainsize
616 return compsize, uncompsize, deltatype, chain, chainsize
607
617
608 fm = ui.formatter('debugdeltachain', opts)
618 fm = ui.formatter('debugdeltachain', opts)
609
619
610 fm.plain(' rev chain# chainlen prev delta '
620 fm.plain(' rev chain# chainlen prev delta '
611 'size rawsize chainsize ratio lindist extradist '
621 'size rawsize chainsize ratio lindist extradist '
612 'extraratio\n')
622 'extraratio\n')
613
623
614 chainbases = {}
624 chainbases = {}
615 for rev in r:
625 for rev in r:
616 comp, uncomp, deltatype, chain, chainsize = revinfo(rev)
626 comp, uncomp, deltatype, chain, chainsize = revinfo(rev)
617 chainbase = chain[0]
627 chainbase = chain[0]
618 chainid = chainbases.setdefault(chainbase, len(chainbases) + 1)
628 chainid = chainbases.setdefault(chainbase, len(chainbases) + 1)
619 basestart = r.start(chainbase)
629 basestart = r.start(chainbase)
620 revstart = r.start(rev)
630 revstart = r.start(rev)
621 lineardist = revstart + comp - basestart
631 lineardist = revstart + comp - basestart
622 extradist = lineardist - chainsize
632 extradist = lineardist - chainsize
623 try:
633 try:
624 prevrev = chain[-2]
634 prevrev = chain[-2]
625 except IndexError:
635 except IndexError:
626 prevrev = -1
636 prevrev = -1
627
637
628 chainratio = float(chainsize) / float(uncomp)
638 chainratio = float(chainsize) / float(uncomp)
629 extraratio = float(extradist) / float(chainsize)
639 extraratio = float(extradist) / float(chainsize)
630
640
631 fm.startitem()
641 fm.startitem()
632 fm.write('rev chainid chainlen prevrev deltatype compsize '
642 fm.write('rev chainid chainlen prevrev deltatype compsize '
633 'uncompsize chainsize chainratio lindist extradist '
643 'uncompsize chainsize chainratio lindist extradist '
634 'extraratio',
644 'extraratio',
635 '%7d %7d %8d %8d %7s %10d %10d %10d %9.5f %9d %9d %10.5f\n',
645 '%7d %7d %8d %8d %7s %10d %10d %10d %9.5f %9d %9d %10.5f\n',
636 rev, chainid, len(chain), prevrev, deltatype, comp,
646 rev, chainid, len(chain), prevrev, deltatype, comp,
637 uncomp, chainsize, chainratio, lineardist, extradist,
647 uncomp, chainsize, chainratio, lineardist, extradist,
638 extraratio,
648 extraratio,
639 rev=rev, chainid=chainid, chainlen=len(chain),
649 rev=rev, chainid=chainid, chainlen=len(chain),
640 prevrev=prevrev, deltatype=deltatype, compsize=comp,
650 prevrev=prevrev, deltatype=deltatype, compsize=comp,
641 uncompsize=uncomp, chainsize=chainsize,
651 uncompsize=uncomp, chainsize=chainsize,
642 chainratio=chainratio, lindist=lineardist,
652 chainratio=chainratio, lindist=lineardist,
643 extradist=extradist, extraratio=extraratio)
653 extradist=extradist, extraratio=extraratio)
644
654
645 fm.end()
655 fm.end()
646
656
647 @command('debugdirstate|debugstate',
657 @command('debugdirstate|debugstate',
648 [('', 'nodates', None, _('do not display the saved mtime')),
658 [('', 'nodates', None, _('do not display the saved mtime')),
649 ('', 'datesort', None, _('sort by saved mtime'))],
659 ('', 'datesort', None, _('sort by saved mtime'))],
650 _('[OPTION]...'))
660 _('[OPTION]...'))
651 def debugstate(ui, repo, **opts):
661 def debugstate(ui, repo, **opts):
652 """show the contents of the current dirstate"""
662 """show the contents of the current dirstate"""
653
663
654 nodates = opts.get(r'nodates')
664 nodates = opts.get(r'nodates')
655 datesort = opts.get(r'datesort')
665 datesort = opts.get(r'datesort')
656
666
657 timestr = ""
667 timestr = ""
658 if datesort:
668 if datesort:
659 keyfunc = lambda x: (x[1][3], x[0]) # sort by mtime, then by filename
669 keyfunc = lambda x: (x[1][3], x[0]) # sort by mtime, then by filename
660 else:
670 else:
661 keyfunc = None # sort by filename
671 keyfunc = None # sort by filename
662 for file_, ent in sorted(repo.dirstate._map.iteritems(), key=keyfunc):
672 for file_, ent in sorted(repo.dirstate._map.iteritems(), key=keyfunc):
663 if ent[3] == -1:
673 if ent[3] == -1:
664 timestr = 'unset '
674 timestr = 'unset '
665 elif nodates:
675 elif nodates:
666 timestr = 'set '
676 timestr = 'set '
667 else:
677 else:
668 timestr = time.strftime("%Y-%m-%d %H:%M:%S ",
678 timestr = time.strftime("%Y-%m-%d %H:%M:%S ",
669 time.localtime(ent[3]))
679 time.localtime(ent[3]))
670 if ent[1] & 0o20000:
680 if ent[1] & 0o20000:
671 mode = 'lnk'
681 mode = 'lnk'
672 else:
682 else:
673 mode = '%3o' % (ent[1] & 0o777 & ~util.umask)
683 mode = '%3o' % (ent[1] & 0o777 & ~util.umask)
674 ui.write("%c %s %10d %s%s\n" % (ent[0], mode, ent[2], timestr, file_))
684 ui.write("%c %s %10d %s%s\n" % (ent[0], mode, ent[2], timestr, file_))
675 for f in repo.dirstate.copies():
685 for f in repo.dirstate.copies():
676 ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copied(f), f))
686 ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copied(f), f))
677
687
678 @command('debugdiscovery',
688 @command('debugdiscovery',
679 [('', 'old', None, _('use old-style discovery')),
689 [('', 'old', None, _('use old-style discovery')),
680 ('', 'nonheads', None,
690 ('', 'nonheads', None,
681 _('use old-style discovery with non-heads included')),
691 _('use old-style discovery with non-heads included')),
682 ] + cmdutil.remoteopts,
692 ] + cmdutil.remoteopts,
683 _('[-l REV] [-r REV] [-b BRANCH]... [OTHER]'))
693 _('[-l REV] [-r REV] [-b BRANCH]... [OTHER]'))
684 def debugdiscovery(ui, repo, remoteurl="default", **opts):
694 def debugdiscovery(ui, repo, remoteurl="default", **opts):
685 """runs the changeset discovery protocol in isolation"""
695 """runs the changeset discovery protocol in isolation"""
686 opts = pycompat.byteskwargs(opts)
696 opts = pycompat.byteskwargs(opts)
687 remoteurl, branches = hg.parseurl(ui.expandpath(remoteurl),
697 remoteurl, branches = hg.parseurl(ui.expandpath(remoteurl),
688 opts.get('branch'))
698 opts.get('branch'))
689 remote = hg.peer(repo, opts, remoteurl)
699 remote = hg.peer(repo, opts, remoteurl)
690 ui.status(_('comparing with %s\n') % util.hidepassword(remoteurl))
700 ui.status(_('comparing with %s\n') % util.hidepassword(remoteurl))
691
701
692 # make sure tests are repeatable
702 # make sure tests are repeatable
693 random.seed(12323)
703 random.seed(12323)
694
704
695 def doit(localheads, remoteheads, remote=remote):
705 def doit(localheads, remoteheads, remote=remote):
696 if opts.get('old'):
706 if opts.get('old'):
697 if localheads:
707 if localheads:
698 raise error.Abort('cannot use localheads with old style '
708 raise error.Abort('cannot use localheads with old style '
699 'discovery')
709 'discovery')
700 if not util.safehasattr(remote, 'branches'):
710 if not util.safehasattr(remote, 'branches'):
701 # enable in-client legacy support
711 # enable in-client legacy support
702 remote = localrepo.locallegacypeer(remote.local())
712 remote = localrepo.locallegacypeer(remote.local())
703 common, _in, hds = treediscovery.findcommonincoming(repo, remote,
713 common, _in, hds = treediscovery.findcommonincoming(repo, remote,
704 force=True)
714 force=True)
705 common = set(common)
715 common = set(common)
706 if not opts.get('nonheads'):
716 if not opts.get('nonheads'):
707 ui.write(("unpruned common: %s\n") %
717 ui.write(("unpruned common: %s\n") %
708 " ".join(sorted(short(n) for n in common)))
718 " ".join(sorted(short(n) for n in common)))
709 dag = dagutil.revlogdag(repo.changelog)
719 dag = dagutil.revlogdag(repo.changelog)
710 all = dag.ancestorset(dag.internalizeall(common))
720 all = dag.ancestorset(dag.internalizeall(common))
711 common = dag.externalizeall(dag.headsetofconnecteds(all))
721 common = dag.externalizeall(dag.headsetofconnecteds(all))
712 else:
722 else:
713 common, any, hds = setdiscovery.findcommonheads(ui, repo, remote)
723 common, any, hds = setdiscovery.findcommonheads(ui, repo, remote)
714 common = set(common)
724 common = set(common)
715 rheads = set(hds)
725 rheads = set(hds)
716 lheads = set(repo.heads())
726 lheads = set(repo.heads())
717 ui.write(("common heads: %s\n") %
727 ui.write(("common heads: %s\n") %
718 " ".join(sorted(short(n) for n in common)))
728 " ".join(sorted(short(n) for n in common)))
719 if lheads <= common:
729 if lheads <= common:
720 ui.write(("local is subset\n"))
730 ui.write(("local is subset\n"))
721 elif rheads <= common:
731 elif rheads <= common:
722 ui.write(("remote is subset\n"))
732 ui.write(("remote is subset\n"))
723
733
724 serverlogs = opts.get('serverlog')
734 serverlogs = opts.get('serverlog')
725 if serverlogs:
735 if serverlogs:
726 for filename in serverlogs:
736 for filename in serverlogs:
727 with open(filename, 'r') as logfile:
737 with open(filename, 'r') as logfile:
728 line = logfile.readline()
738 line = logfile.readline()
729 while line:
739 while line:
730 parts = line.strip().split(';')
740 parts = line.strip().split(';')
731 op = parts[1]
741 op = parts[1]
732 if op == 'cg':
742 if op == 'cg':
733 pass
743 pass
734 elif op == 'cgss':
744 elif op == 'cgss':
735 doit(parts[2].split(' '), parts[3].split(' '))
745 doit(parts[2].split(' '), parts[3].split(' '))
736 elif op == 'unb':
746 elif op == 'unb':
737 doit(parts[3].split(' '), parts[2].split(' '))
747 doit(parts[3].split(' '), parts[2].split(' '))
738 line = logfile.readline()
748 line = logfile.readline()
739 else:
749 else:
740 remoterevs, _checkout = hg.addbranchrevs(repo, remote, branches,
750 remoterevs, _checkout = hg.addbranchrevs(repo, remote, branches,
741 opts.get('remote_head'))
751 opts.get('remote_head'))
742 localrevs = opts.get('local_head')
752 localrevs = opts.get('local_head')
743 doit(localrevs, remoterevs)
753 doit(localrevs, remoterevs)
744
754
745 @command('debugextensions', cmdutil.formatteropts, [], norepo=True)
755 @command('debugextensions', cmdutil.formatteropts, [], norepo=True)
746 def debugextensions(ui, **opts):
756 def debugextensions(ui, **opts):
747 '''show information about active extensions'''
757 '''show information about active extensions'''
748 opts = pycompat.byteskwargs(opts)
758 opts = pycompat.byteskwargs(opts)
749 exts = extensions.extensions(ui)
759 exts = extensions.extensions(ui)
750 hgver = util.version()
760 hgver = util.version()
751 fm = ui.formatter('debugextensions', opts)
761 fm = ui.formatter('debugextensions', opts)
752 for extname, extmod in sorted(exts, key=operator.itemgetter(0)):
762 for extname, extmod in sorted(exts, key=operator.itemgetter(0)):
753 isinternal = extensions.ismoduleinternal(extmod)
763 isinternal = extensions.ismoduleinternal(extmod)
754 extsource = pycompat.fsencode(extmod.__file__)
764 extsource = pycompat.fsencode(extmod.__file__)
755 if isinternal:
765 if isinternal:
756 exttestedwith = [] # never expose magic string to users
766 exttestedwith = [] # never expose magic string to users
757 else:
767 else:
758 exttestedwith = getattr(extmod, 'testedwith', '').split()
768 exttestedwith = getattr(extmod, 'testedwith', '').split()
759 extbuglink = getattr(extmod, 'buglink', None)
769 extbuglink = getattr(extmod, 'buglink', None)
760
770
761 fm.startitem()
771 fm.startitem()
762
772
763 if ui.quiet or ui.verbose:
773 if ui.quiet or ui.verbose:
764 fm.write('name', '%s\n', extname)
774 fm.write('name', '%s\n', extname)
765 else:
775 else:
766 fm.write('name', '%s', extname)
776 fm.write('name', '%s', extname)
767 if isinternal or hgver in exttestedwith:
777 if isinternal or hgver in exttestedwith:
768 fm.plain('\n')
778 fm.plain('\n')
769 elif not exttestedwith:
779 elif not exttestedwith:
770 fm.plain(_(' (untested!)\n'))
780 fm.plain(_(' (untested!)\n'))
771 else:
781 else:
772 lasttestedversion = exttestedwith[-1]
782 lasttestedversion = exttestedwith[-1]
773 fm.plain(' (%s!)\n' % lasttestedversion)
783 fm.plain(' (%s!)\n' % lasttestedversion)
774
784
775 fm.condwrite(ui.verbose and extsource, 'source',
785 fm.condwrite(ui.verbose and extsource, 'source',
776 _(' location: %s\n'), extsource or "")
786 _(' location: %s\n'), extsource or "")
777
787
778 if ui.verbose:
788 if ui.verbose:
779 fm.plain(_(' bundled: %s\n') % ['no', 'yes'][isinternal])
789 fm.plain(_(' bundled: %s\n') % ['no', 'yes'][isinternal])
780 fm.data(bundled=isinternal)
790 fm.data(bundled=isinternal)
781
791
782 fm.condwrite(ui.verbose and exttestedwith, 'testedwith',
792 fm.condwrite(ui.verbose and exttestedwith, 'testedwith',
783 _(' tested with: %s\n'),
793 _(' tested with: %s\n'),
784 fm.formatlist(exttestedwith, name='ver'))
794 fm.formatlist(exttestedwith, name='ver'))
785
795
786 fm.condwrite(ui.verbose and extbuglink, 'buglink',
796 fm.condwrite(ui.verbose and extbuglink, 'buglink',
787 _(' bug reporting: %s\n'), extbuglink or "")
797 _(' bug reporting: %s\n'), extbuglink or "")
788
798
789 fm.end()
799 fm.end()
790
800
791 @command('debugfileset',
801 @command('debugfileset',
792 [('r', 'rev', '', _('apply the filespec on this revision'), _('REV'))],
802 [('r', 'rev', '', _('apply the filespec on this revision'), _('REV'))],
793 _('[-r REV] FILESPEC'))
803 _('[-r REV] FILESPEC'))
794 def debugfileset(ui, repo, expr, **opts):
804 def debugfileset(ui, repo, expr, **opts):
795 '''parse and apply a fileset specification'''
805 '''parse and apply a fileset specification'''
796 ctx = scmutil.revsingle(repo, opts.get(r'rev'), None)
806 ctx = scmutil.revsingle(repo, opts.get(r'rev'), None)
797 if ui.verbose:
807 if ui.verbose:
798 tree = fileset.parse(expr)
808 tree = fileset.parse(expr)
799 ui.note(fileset.prettyformat(tree), "\n")
809 ui.note(fileset.prettyformat(tree), "\n")
800
810
801 for f in ctx.getfileset(expr):
811 for f in ctx.getfileset(expr):
802 ui.write("%s\n" % f)
812 ui.write("%s\n" % f)
803
813
804 @command('debugfsinfo', [], _('[PATH]'), norepo=True)
814 @command('debugfsinfo', [], _('[PATH]'), norepo=True)
805 def debugfsinfo(ui, path="."):
815 def debugfsinfo(ui, path="."):
806 """show information detected about current filesystem"""
816 """show information detected about current filesystem"""
807 ui.write(('exec: %s\n') % (util.checkexec(path) and 'yes' or 'no'))
817 ui.write(('exec: %s\n') % (util.checkexec(path) and 'yes' or 'no'))
808 ui.write(('fstype: %s\n') % (util.getfstype(path) or '(unknown)'))
818 ui.write(('fstype: %s\n') % (util.getfstype(path) or '(unknown)'))
809 ui.write(('symlink: %s\n') % (util.checklink(path) and 'yes' or 'no'))
819 ui.write(('symlink: %s\n') % (util.checklink(path) and 'yes' or 'no'))
810 ui.write(('hardlink: %s\n') % (util.checknlink(path) and 'yes' or 'no'))
820 ui.write(('hardlink: %s\n') % (util.checknlink(path) and 'yes' or 'no'))
811 casesensitive = '(unknown)'
821 casesensitive = '(unknown)'
812 try:
822 try:
813 with tempfile.NamedTemporaryFile(prefix='.debugfsinfo', dir=path) as f:
823 with tempfile.NamedTemporaryFile(prefix='.debugfsinfo', dir=path) as f:
814 casesensitive = util.fscasesensitive(f.name) and 'yes' or 'no'
824 casesensitive = util.fscasesensitive(f.name) and 'yes' or 'no'
815 except OSError:
825 except OSError:
816 pass
826 pass
817 ui.write(('case-sensitive: %s\n') % casesensitive)
827 ui.write(('case-sensitive: %s\n') % casesensitive)
818
828
819 @command('debuggetbundle',
829 @command('debuggetbundle',
820 [('H', 'head', [], _('id of head node'), _('ID')),
830 [('H', 'head', [], _('id of head node'), _('ID')),
821 ('C', 'common', [], _('id of common node'), _('ID')),
831 ('C', 'common', [], _('id of common node'), _('ID')),
822 ('t', 'type', 'bzip2', _('bundle compression type to use'), _('TYPE'))],
832 ('t', 'type', 'bzip2', _('bundle compression type to use'), _('TYPE'))],
823 _('REPO FILE [-H|-C ID]...'),
833 _('REPO FILE [-H|-C ID]...'),
824 norepo=True)
834 norepo=True)
825 def debuggetbundle(ui, repopath, bundlepath, head=None, common=None, **opts):
835 def debuggetbundle(ui, repopath, bundlepath, head=None, common=None, **opts):
826 """retrieves a bundle from a repo
836 """retrieves a bundle from a repo
827
837
828 Every ID must be a full-length hex node id string. Saves the bundle to the
838 Every ID must be a full-length hex node id string. Saves the bundle to the
829 given file.
839 given file.
830 """
840 """
831 opts = pycompat.byteskwargs(opts)
841 opts = pycompat.byteskwargs(opts)
832 repo = hg.peer(ui, opts, repopath)
842 repo = hg.peer(ui, opts, repopath)
833 if not repo.capable('getbundle'):
843 if not repo.capable('getbundle'):
834 raise error.Abort("getbundle() not supported by target repository")
844 raise error.Abort("getbundle() not supported by target repository")
835 args = {}
845 args = {}
836 if common:
846 if common:
837 args[r'common'] = [bin(s) for s in common]
847 args[r'common'] = [bin(s) for s in common]
838 if head:
848 if head:
839 args[r'heads'] = [bin(s) for s in head]
849 args[r'heads'] = [bin(s) for s in head]
840 # TODO: get desired bundlecaps from command line.
850 # TODO: get desired bundlecaps from command line.
841 args[r'bundlecaps'] = None
851 args[r'bundlecaps'] = None
842 bundle = repo.getbundle('debug', **args)
852 bundle = repo.getbundle('debug', **args)
843
853
844 bundletype = opts.get('type', 'bzip2').lower()
854 bundletype = opts.get('type', 'bzip2').lower()
845 btypes = {'none': 'HG10UN',
855 btypes = {'none': 'HG10UN',
846 'bzip2': 'HG10BZ',
856 'bzip2': 'HG10BZ',
847 'gzip': 'HG10GZ',
857 'gzip': 'HG10GZ',
848 'bundle2': 'HG20'}
858 'bundle2': 'HG20'}
849 bundletype = btypes.get(bundletype)
859 bundletype = btypes.get(bundletype)
850 if bundletype not in bundle2.bundletypes:
860 if bundletype not in bundle2.bundletypes:
851 raise error.Abort(_('unknown bundle type specified with --type'))
861 raise error.Abort(_('unknown bundle type specified with --type'))
852 bundle2.writebundle(ui, bundle, bundlepath, bundletype)
862 bundle2.writebundle(ui, bundle, bundlepath, bundletype)
853
863
854 @command('debugignore', [], '[FILE]')
864 @command('debugignore', [], '[FILE]')
855 def debugignore(ui, repo, *files, **opts):
865 def debugignore(ui, repo, *files, **opts):
856 """display the combined ignore pattern and information about ignored files
866 """display the combined ignore pattern and information about ignored files
857
867
858 With no argument display the combined ignore pattern.
868 With no argument display the combined ignore pattern.
859
869
860 Given space separated file names, shows if the given file is ignored and
870 Given space separated file names, shows if the given file is ignored and
861 if so, show the ignore rule (file and line number) that matched it.
871 if so, show the ignore rule (file and line number) that matched it.
862 """
872 """
863 ignore = repo.dirstate._ignore
873 ignore = repo.dirstate._ignore
864 if not files:
874 if not files:
865 # Show all the patterns
875 # Show all the patterns
866 ui.write("%s\n" % repr(ignore))
876 ui.write("%s\n" % repr(ignore))
867 else:
877 else:
868 m = scmutil.match(repo[None], pats=files)
878 m = scmutil.match(repo[None], pats=files)
869 for f in m.files():
879 for f in m.files():
870 nf = util.normpath(f)
880 nf = util.normpath(f)
871 ignored = None
881 ignored = None
872 ignoredata = None
882 ignoredata = None
873 if nf != '.':
883 if nf != '.':
874 if ignore(nf):
884 if ignore(nf):
875 ignored = nf
885 ignored = nf
876 ignoredata = repo.dirstate._ignorefileandline(nf)
886 ignoredata = repo.dirstate._ignorefileandline(nf)
877 else:
887 else:
878 for p in util.finddirs(nf):
888 for p in util.finddirs(nf):
879 if ignore(p):
889 if ignore(p):
880 ignored = p
890 ignored = p
881 ignoredata = repo.dirstate._ignorefileandline(p)
891 ignoredata = repo.dirstate._ignorefileandline(p)
882 break
892 break
883 if ignored:
893 if ignored:
884 if ignored == nf:
894 if ignored == nf:
885 ui.write(_("%s is ignored\n") % m.uipath(f))
895 ui.write(_("%s is ignored\n") % m.uipath(f))
886 else:
896 else:
887 ui.write(_("%s is ignored because of "
897 ui.write(_("%s is ignored because of "
888 "containing folder %s\n")
898 "containing folder %s\n")
889 % (m.uipath(f), ignored))
899 % (m.uipath(f), ignored))
890 ignorefile, lineno, line = ignoredata
900 ignorefile, lineno, line = ignoredata
891 ui.write(_("(ignore rule in %s, line %d: '%s')\n")
901 ui.write(_("(ignore rule in %s, line %d: '%s')\n")
892 % (ignorefile, lineno, line))
902 % (ignorefile, lineno, line))
893 else:
903 else:
894 ui.write(_("%s is not ignored\n") % m.uipath(f))
904 ui.write(_("%s is not ignored\n") % m.uipath(f))
895
905
896 @command('debugindex', cmdutil.debugrevlogopts +
906 @command('debugindex', cmdutil.debugrevlogopts +
897 [('f', 'format', 0, _('revlog format'), _('FORMAT'))],
907 [('f', 'format', 0, _('revlog format'), _('FORMAT'))],
898 _('[-f FORMAT] -c|-m|FILE'),
908 _('[-f FORMAT] -c|-m|FILE'),
899 optionalrepo=True)
909 optionalrepo=True)
900 def debugindex(ui, repo, file_=None, **opts):
910 def debugindex(ui, repo, file_=None, **opts):
901 """dump the contents of an index file"""
911 """dump the contents of an index file"""
902 opts = pycompat.byteskwargs(opts)
912 opts = pycompat.byteskwargs(opts)
903 r = cmdutil.openrevlog(repo, 'debugindex', file_, opts)
913 r = cmdutil.openrevlog(repo, 'debugindex', file_, opts)
904 format = opts.get('format', 0)
914 format = opts.get('format', 0)
905 if format not in (0, 1):
915 if format not in (0, 1):
906 raise error.Abort(_("unknown format %d") % format)
916 raise error.Abort(_("unknown format %d") % format)
907
917
908 generaldelta = r.version & revlog.FLAG_GENERALDELTA
918 generaldelta = r.version & revlog.FLAG_GENERALDELTA
909 if generaldelta:
919 if generaldelta:
910 basehdr = ' delta'
920 basehdr = ' delta'
911 else:
921 else:
912 basehdr = ' base'
922 basehdr = ' base'
913
923
914 if ui.debugflag:
924 if ui.debugflag:
915 shortfn = hex
925 shortfn = hex
916 else:
926 else:
917 shortfn = short
927 shortfn = short
918
928
919 # There might not be anything in r, so have a sane default
929 # There might not be anything in r, so have a sane default
920 idlen = 12
930 idlen = 12
921 for i in r:
931 for i in r:
922 idlen = len(shortfn(r.node(i)))
932 idlen = len(shortfn(r.node(i)))
923 break
933 break
924
934
925 if format == 0:
935 if format == 0:
926 ui.write((" rev offset length " + basehdr + " linkrev"
936 ui.write((" rev offset length " + basehdr + " linkrev"
927 " %s %s p2\n") % ("nodeid".ljust(idlen), "p1".ljust(idlen)))
937 " %s %s p2\n") % ("nodeid".ljust(idlen), "p1".ljust(idlen)))
928 elif format == 1:
938 elif format == 1:
929 ui.write((" rev flag offset length"
939 ui.write((" rev flag offset length"
930 " size " + basehdr + " link p1 p2"
940 " size " + basehdr + " link p1 p2"
931 " %s\n") % "nodeid".rjust(idlen))
941 " %s\n") % "nodeid".rjust(idlen))
932
942
933 for i in r:
943 for i in r:
934 node = r.node(i)
944 node = r.node(i)
935 if generaldelta:
945 if generaldelta:
936 base = r.deltaparent(i)
946 base = r.deltaparent(i)
937 else:
947 else:
938 base = r.chainbase(i)
948 base = r.chainbase(i)
939 if format == 0:
949 if format == 0:
940 try:
950 try:
941 pp = r.parents(node)
951 pp = r.parents(node)
942 except Exception:
952 except Exception:
943 pp = [nullid, nullid]
953 pp = [nullid, nullid]
944 ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % (
954 ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % (
945 i, r.start(i), r.length(i), base, r.linkrev(i),
955 i, r.start(i), r.length(i), base, r.linkrev(i),
946 shortfn(node), shortfn(pp[0]), shortfn(pp[1])))
956 shortfn(node), shortfn(pp[0]), shortfn(pp[1])))
947 elif format == 1:
957 elif format == 1:
948 pr = r.parentrevs(i)
958 pr = r.parentrevs(i)
949 ui.write("% 6d %04x % 8d % 8d % 8d % 6d % 6d % 6d % 6d %s\n" % (
959 ui.write("% 6d %04x % 8d % 8d % 8d % 6d % 6d % 6d % 6d %s\n" % (
950 i, r.flags(i), r.start(i), r.length(i), r.rawsize(i),
960 i, r.flags(i), r.start(i), r.length(i), r.rawsize(i),
951 base, r.linkrev(i), pr[0], pr[1], shortfn(node)))
961 base, r.linkrev(i), pr[0], pr[1], shortfn(node)))
952
962
953 @command('debugindexdot', cmdutil.debugrevlogopts,
963 @command('debugindexdot', cmdutil.debugrevlogopts,
954 _('-c|-m|FILE'), optionalrepo=True)
964 _('-c|-m|FILE'), optionalrepo=True)
955 def debugindexdot(ui, repo, file_=None, **opts):
965 def debugindexdot(ui, repo, file_=None, **opts):
956 """dump an index DAG as a graphviz dot file"""
966 """dump an index DAG as a graphviz dot file"""
957 opts = pycompat.byteskwargs(opts)
967 opts = pycompat.byteskwargs(opts)
958 r = cmdutil.openrevlog(repo, 'debugindexdot', file_, opts)
968 r = cmdutil.openrevlog(repo, 'debugindexdot', file_, opts)
959 ui.write(("digraph G {\n"))
969 ui.write(("digraph G {\n"))
960 for i in r:
970 for i in r:
961 node = r.node(i)
971 node = r.node(i)
962 pp = r.parents(node)
972 pp = r.parents(node)
963 ui.write("\t%d -> %d\n" % (r.rev(pp[0]), i))
973 ui.write("\t%d -> %d\n" % (r.rev(pp[0]), i))
964 if pp[1] != nullid:
974 if pp[1] != nullid:
965 ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i))
975 ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i))
966 ui.write("}\n")
976 ui.write("}\n")
967
977
968 @command('debuginstall', [] + cmdutil.formatteropts, '', norepo=True)
978 @command('debuginstall', [] + cmdutil.formatteropts, '', norepo=True)
969 def debuginstall(ui, **opts):
979 def debuginstall(ui, **opts):
970 '''test Mercurial installation
980 '''test Mercurial installation
971
981
972 Returns 0 on success.
982 Returns 0 on success.
973 '''
983 '''
974 opts = pycompat.byteskwargs(opts)
984 opts = pycompat.byteskwargs(opts)
975
985
976 def writetemp(contents):
986 def writetemp(contents):
977 (fd, name) = tempfile.mkstemp(prefix="hg-debuginstall-")
987 (fd, name) = tempfile.mkstemp(prefix="hg-debuginstall-")
978 f = os.fdopen(fd, pycompat.sysstr("wb"))
988 f = os.fdopen(fd, pycompat.sysstr("wb"))
979 f.write(contents)
989 f.write(contents)
980 f.close()
990 f.close()
981 return name
991 return name
982
992
983 problems = 0
993 problems = 0
984
994
985 fm = ui.formatter('debuginstall', opts)
995 fm = ui.formatter('debuginstall', opts)
986 fm.startitem()
996 fm.startitem()
987
997
988 # encoding
998 # encoding
989 fm.write('encoding', _("checking encoding (%s)...\n"), encoding.encoding)
999 fm.write('encoding', _("checking encoding (%s)...\n"), encoding.encoding)
990 err = None
1000 err = None
991 try:
1001 try:
992 codecs.lookup(pycompat.sysstr(encoding.encoding))
1002 codecs.lookup(pycompat.sysstr(encoding.encoding))
993 except LookupError as inst:
1003 except LookupError as inst:
994 err = util.forcebytestr(inst)
1004 err = util.forcebytestr(inst)
995 problems += 1
1005 problems += 1
996 fm.condwrite(err, 'encodingerror', _(" %s\n"
1006 fm.condwrite(err, 'encodingerror', _(" %s\n"
997 " (check that your locale is properly set)\n"), err)
1007 " (check that your locale is properly set)\n"), err)
998
1008
999 # Python
1009 # Python
1000 fm.write('pythonexe', _("checking Python executable (%s)\n"),
1010 fm.write('pythonexe', _("checking Python executable (%s)\n"),
1001 pycompat.sysexecutable)
1011 pycompat.sysexecutable)
1002 fm.write('pythonver', _("checking Python version (%s)\n"),
1012 fm.write('pythonver', _("checking Python version (%s)\n"),
1003 ("%d.%d.%d" % sys.version_info[:3]))
1013 ("%d.%d.%d" % sys.version_info[:3]))
1004 fm.write('pythonlib', _("checking Python lib (%s)...\n"),
1014 fm.write('pythonlib', _("checking Python lib (%s)...\n"),
1005 os.path.dirname(pycompat.fsencode(os.__file__)))
1015 os.path.dirname(pycompat.fsencode(os.__file__)))
1006
1016
1007 security = set(sslutil.supportedprotocols)
1017 security = set(sslutil.supportedprotocols)
1008 if sslutil.hassni:
1018 if sslutil.hassni:
1009 security.add('sni')
1019 security.add('sni')
1010
1020
1011 fm.write('pythonsecurity', _("checking Python security support (%s)\n"),
1021 fm.write('pythonsecurity', _("checking Python security support (%s)\n"),
1012 fm.formatlist(sorted(security), name='protocol',
1022 fm.formatlist(sorted(security), name='protocol',
1013 fmt='%s', sep=','))
1023 fmt='%s', sep=','))
1014
1024
1015 # These are warnings, not errors. So don't increment problem count. This
1025 # These are warnings, not errors. So don't increment problem count. This
1016 # may change in the future.
1026 # may change in the future.
1017 if 'tls1.2' not in security:
1027 if 'tls1.2' not in security:
1018 fm.plain(_(' TLS 1.2 not supported by Python install; '
1028 fm.plain(_(' TLS 1.2 not supported by Python install; '
1019 'network connections lack modern security\n'))
1029 'network connections lack modern security\n'))
1020 if 'sni' not in security:
1030 if 'sni' not in security:
1021 fm.plain(_(' SNI not supported by Python install; may have '
1031 fm.plain(_(' SNI not supported by Python install; may have '
1022 'connectivity issues with some servers\n'))
1032 'connectivity issues with some servers\n'))
1023
1033
1024 # TODO print CA cert info
1034 # TODO print CA cert info
1025
1035
1026 # hg version
1036 # hg version
1027 hgver = util.version()
1037 hgver = util.version()
1028 fm.write('hgver', _("checking Mercurial version (%s)\n"),
1038 fm.write('hgver', _("checking Mercurial version (%s)\n"),
1029 hgver.split('+')[0])
1039 hgver.split('+')[0])
1030 fm.write('hgverextra', _("checking Mercurial custom build (%s)\n"),
1040 fm.write('hgverextra', _("checking Mercurial custom build (%s)\n"),
1031 '+'.join(hgver.split('+')[1:]))
1041 '+'.join(hgver.split('+')[1:]))
1032
1042
1033 # compiled modules
1043 # compiled modules
1034 fm.write('hgmodulepolicy', _("checking module policy (%s)\n"),
1044 fm.write('hgmodulepolicy', _("checking module policy (%s)\n"),
1035 policy.policy)
1045 policy.policy)
1036 fm.write('hgmodules', _("checking installed modules (%s)...\n"),
1046 fm.write('hgmodules', _("checking installed modules (%s)...\n"),
1037 os.path.dirname(pycompat.fsencode(__file__)))
1047 os.path.dirname(pycompat.fsencode(__file__)))
1038
1048
1039 if policy.policy in ('c', 'allow'):
1049 if policy.policy in ('c', 'allow'):
1040 err = None
1050 err = None
1041 try:
1051 try:
1042 from .cext import (
1052 from .cext import (
1043 base85,
1053 base85,
1044 bdiff,
1054 bdiff,
1045 mpatch,
1055 mpatch,
1046 osutil,
1056 osutil,
1047 )
1057 )
1048 dir(bdiff), dir(mpatch), dir(base85), dir(osutil) # quiet pyflakes
1058 dir(bdiff), dir(mpatch), dir(base85), dir(osutil) # quiet pyflakes
1049 except Exception as inst:
1059 except Exception as inst:
1050 err = util.forcebytestr(inst)
1060 err = util.forcebytestr(inst)
1051 problems += 1
1061 problems += 1
1052 fm.condwrite(err, 'extensionserror', " %s\n", err)
1062 fm.condwrite(err, 'extensionserror', " %s\n", err)
1053
1063
1054 compengines = util.compengines._engines.values()
1064 compengines = util.compengines._engines.values()
1055 fm.write('compengines', _('checking registered compression engines (%s)\n'),
1065 fm.write('compengines', _('checking registered compression engines (%s)\n'),
1056 fm.formatlist(sorted(e.name() for e in compengines),
1066 fm.formatlist(sorted(e.name() for e in compengines),
1057 name='compengine', fmt='%s', sep=', '))
1067 name='compengine', fmt='%s', sep=', '))
1058 fm.write('compenginesavail', _('checking available compression engines '
1068 fm.write('compenginesavail', _('checking available compression engines '
1059 '(%s)\n'),
1069 '(%s)\n'),
1060 fm.formatlist(sorted(e.name() for e in compengines
1070 fm.formatlist(sorted(e.name() for e in compengines
1061 if e.available()),
1071 if e.available()),
1062 name='compengine', fmt='%s', sep=', '))
1072 name='compengine', fmt='%s', sep=', '))
1063 wirecompengines = util.compengines.supportedwireengines(util.SERVERROLE)
1073 wirecompengines = util.compengines.supportedwireengines(util.SERVERROLE)
1064 fm.write('compenginesserver', _('checking available compression engines '
1074 fm.write('compenginesserver', _('checking available compression engines '
1065 'for wire protocol (%s)\n'),
1075 'for wire protocol (%s)\n'),
1066 fm.formatlist([e.name() for e in wirecompengines
1076 fm.formatlist([e.name() for e in wirecompengines
1067 if e.wireprotosupport()],
1077 if e.wireprotosupport()],
1068 name='compengine', fmt='%s', sep=', '))
1078 name='compengine', fmt='%s', sep=', '))
1069
1079
1070 # templates
1080 # templates
1071 p = templater.templatepaths()
1081 p = templater.templatepaths()
1072 fm.write('templatedirs', 'checking templates (%s)...\n', ' '.join(p))
1082 fm.write('templatedirs', 'checking templates (%s)...\n', ' '.join(p))
1073 fm.condwrite(not p, '', _(" no template directories found\n"))
1083 fm.condwrite(not p, '', _(" no template directories found\n"))
1074 if p:
1084 if p:
1075 m = templater.templatepath("map-cmdline.default")
1085 m = templater.templatepath("map-cmdline.default")
1076 if m:
1086 if m:
1077 # template found, check if it is working
1087 # template found, check if it is working
1078 err = None
1088 err = None
1079 try:
1089 try:
1080 templater.templater.frommapfile(m)
1090 templater.templater.frommapfile(m)
1081 except Exception as inst:
1091 except Exception as inst:
1082 err = util.forcebytestr(inst)
1092 err = util.forcebytestr(inst)
1083 p = None
1093 p = None
1084 fm.condwrite(err, 'defaulttemplateerror', " %s\n", err)
1094 fm.condwrite(err, 'defaulttemplateerror', " %s\n", err)
1085 else:
1095 else:
1086 p = None
1096 p = None
1087 fm.condwrite(p, 'defaulttemplate',
1097 fm.condwrite(p, 'defaulttemplate',
1088 _("checking default template (%s)\n"), m)
1098 _("checking default template (%s)\n"), m)
1089 fm.condwrite(not m, 'defaulttemplatenotfound',
1099 fm.condwrite(not m, 'defaulttemplatenotfound',
1090 _(" template '%s' not found\n"), "default")
1100 _(" template '%s' not found\n"), "default")
1091 if not p:
1101 if not p:
1092 problems += 1
1102 problems += 1
1093 fm.condwrite(not p, '',
1103 fm.condwrite(not p, '',
1094 _(" (templates seem to have been installed incorrectly)\n"))
1104 _(" (templates seem to have been installed incorrectly)\n"))
1095
1105
1096 # editor
1106 # editor
1097 editor = ui.geteditor()
1107 editor = ui.geteditor()
1098 editor = util.expandpath(editor)
1108 editor = util.expandpath(editor)
1099 fm.write('editor', _("checking commit editor... (%s)\n"), editor)
1109 fm.write('editor', _("checking commit editor... (%s)\n"), editor)
1100 cmdpath = util.findexe(pycompat.shlexsplit(editor)[0])
1110 cmdpath = util.findexe(pycompat.shlexsplit(editor)[0])
1101 fm.condwrite(not cmdpath and editor == 'vi', 'vinotfound',
1111 fm.condwrite(not cmdpath and editor == 'vi', 'vinotfound',
1102 _(" No commit editor set and can't find %s in PATH\n"
1112 _(" No commit editor set and can't find %s in PATH\n"
1103 " (specify a commit editor in your configuration"
1113 " (specify a commit editor in your configuration"
1104 " file)\n"), not cmdpath and editor == 'vi' and editor)
1114 " file)\n"), not cmdpath and editor == 'vi' and editor)
1105 fm.condwrite(not cmdpath and editor != 'vi', 'editornotfound',
1115 fm.condwrite(not cmdpath and editor != 'vi', 'editornotfound',
1106 _(" Can't find editor '%s' in PATH\n"
1116 _(" Can't find editor '%s' in PATH\n"
1107 " (specify a commit editor in your configuration"
1117 " (specify a commit editor in your configuration"
1108 " file)\n"), not cmdpath and editor)
1118 " file)\n"), not cmdpath and editor)
1109 if not cmdpath and editor != 'vi':
1119 if not cmdpath and editor != 'vi':
1110 problems += 1
1120 problems += 1
1111
1121
1112 # check username
1122 # check username
1113 username = None
1123 username = None
1114 err = None
1124 err = None
1115 try:
1125 try:
1116 username = ui.username()
1126 username = ui.username()
1117 except error.Abort as e:
1127 except error.Abort as e:
1118 err = util.forcebytestr(e)
1128 err = util.forcebytestr(e)
1119 problems += 1
1129 problems += 1
1120
1130
1121 fm.condwrite(username, 'username', _("checking username (%s)\n"), username)
1131 fm.condwrite(username, 'username', _("checking username (%s)\n"), username)
1122 fm.condwrite(err, 'usernameerror', _("checking username...\n %s\n"
1132 fm.condwrite(err, 'usernameerror', _("checking username...\n %s\n"
1123 " (specify a username in your configuration file)\n"), err)
1133 " (specify a username in your configuration file)\n"), err)
1124
1134
1125 fm.condwrite(not problems, '',
1135 fm.condwrite(not problems, '',
1126 _("no problems detected\n"))
1136 _("no problems detected\n"))
1127 if not problems:
1137 if not problems:
1128 fm.data(problems=problems)
1138 fm.data(problems=problems)
1129 fm.condwrite(problems, 'problems',
1139 fm.condwrite(problems, 'problems',
1130 _("%d problems detected,"
1140 _("%d problems detected,"
1131 " please check your install!\n"), problems)
1141 " please check your install!\n"), problems)
1132 fm.end()
1142 fm.end()
1133
1143
1134 return problems
1144 return problems
1135
1145
1136 @command('debugknown', [], _('REPO ID...'), norepo=True)
1146 @command('debugknown', [], _('REPO ID...'), norepo=True)
1137 def debugknown(ui, repopath, *ids, **opts):
1147 def debugknown(ui, repopath, *ids, **opts):
1138 """test whether node ids are known to a repo
1148 """test whether node ids are known to a repo
1139
1149
1140 Every ID must be a full-length hex node id string. Returns a list of 0s
1150 Every ID must be a full-length hex node id string. Returns a list of 0s
1141 and 1s indicating unknown/known.
1151 and 1s indicating unknown/known.
1142 """
1152 """
1143 opts = pycompat.byteskwargs(opts)
1153 opts = pycompat.byteskwargs(opts)
1144 repo = hg.peer(ui, opts, repopath)
1154 repo = hg.peer(ui, opts, repopath)
1145 if not repo.capable('known'):
1155 if not repo.capable('known'):
1146 raise error.Abort("known() not supported by target repository")
1156 raise error.Abort("known() not supported by target repository")
1147 flags = repo.known([bin(s) for s in ids])
1157 flags = repo.known([bin(s) for s in ids])
1148 ui.write("%s\n" % ("".join([f and "1" or "0" for f in flags])))
1158 ui.write("%s\n" % ("".join([f and "1" or "0" for f in flags])))
1149
1159
1150 @command('debuglabelcomplete', [], _('LABEL...'))
1160 @command('debuglabelcomplete', [], _('LABEL...'))
1151 def debuglabelcomplete(ui, repo, *args):
1161 def debuglabelcomplete(ui, repo, *args):
1152 '''backwards compatibility with old bash completion scripts (DEPRECATED)'''
1162 '''backwards compatibility with old bash completion scripts (DEPRECATED)'''
1153 debugnamecomplete(ui, repo, *args)
1163 debugnamecomplete(ui, repo, *args)
1154
1164
1155 @command('debuglocks',
1165 @command('debuglocks',
1156 [('L', 'force-lock', None, _('free the store lock (DANGEROUS)')),
1166 [('L', 'force-lock', None, _('free the store lock (DANGEROUS)')),
1157 ('W', 'force-wlock', None,
1167 ('W', 'force-wlock', None,
1158 _('free the working state lock (DANGEROUS)'))],
1168 _('free the working state lock (DANGEROUS)'))],
1159 _('[OPTION]...'))
1169 _('[OPTION]...'))
1160 def debuglocks(ui, repo, **opts):
1170 def debuglocks(ui, repo, **opts):
1161 """show or modify state of locks
1171 """show or modify state of locks
1162
1172
1163 By default, this command will show which locks are held. This
1173 By default, this command will show which locks are held. This
1164 includes the user and process holding the lock, the amount of time
1174 includes the user and process holding the lock, the amount of time
1165 the lock has been held, and the machine name where the process is
1175 the lock has been held, and the machine name where the process is
1166 running if it's not local.
1176 running if it's not local.
1167
1177
1168 Locks protect the integrity of Mercurial's data, so should be
1178 Locks protect the integrity of Mercurial's data, so should be
1169 treated with care. System crashes or other interruptions may cause
1179 treated with care. System crashes or other interruptions may cause
1170 locks to not be properly released, though Mercurial will usually
1180 locks to not be properly released, though Mercurial will usually
1171 detect and remove such stale locks automatically.
1181 detect and remove such stale locks automatically.
1172
1182
1173 However, detecting stale locks may not always be possible (for
1183 However, detecting stale locks may not always be possible (for
1174 instance, on a shared filesystem). Removing locks may also be
1184 instance, on a shared filesystem). Removing locks may also be
1175 blocked by filesystem permissions.
1185 blocked by filesystem permissions.
1176
1186
1177 Returns 0 if no locks are held.
1187 Returns 0 if no locks are held.
1178
1188
1179 """
1189 """
1180
1190
1181 if opts.get(r'force_lock'):
1191 if opts.get(r'force_lock'):
1182 repo.svfs.unlink('lock')
1192 repo.svfs.unlink('lock')
1183 if opts.get(r'force_wlock'):
1193 if opts.get(r'force_wlock'):
1184 repo.vfs.unlink('wlock')
1194 repo.vfs.unlink('wlock')
1185 if opts.get(r'force_lock') or opts.get(r'force_lock'):
1195 if opts.get(r'force_lock') or opts.get(r'force_lock'):
1186 return 0
1196 return 0
1187
1197
1188 now = time.time()
1198 now = time.time()
1189 held = 0
1199 held = 0
1190
1200
1191 def report(vfs, name, method):
1201 def report(vfs, name, method):
1192 # this causes stale locks to get reaped for more accurate reporting
1202 # this causes stale locks to get reaped for more accurate reporting
1193 try:
1203 try:
1194 l = method(False)
1204 l = method(False)
1195 except error.LockHeld:
1205 except error.LockHeld:
1196 l = None
1206 l = None
1197
1207
1198 if l:
1208 if l:
1199 l.release()
1209 l.release()
1200 else:
1210 else:
1201 try:
1211 try:
1202 stat = vfs.lstat(name)
1212 stat = vfs.lstat(name)
1203 age = now - stat.st_mtime
1213 age = now - stat.st_mtime
1204 user = util.username(stat.st_uid)
1214 user = util.username(stat.st_uid)
1205 locker = vfs.readlock(name)
1215 locker = vfs.readlock(name)
1206 if ":" in locker:
1216 if ":" in locker:
1207 host, pid = locker.split(':')
1217 host, pid = locker.split(':')
1208 if host == socket.gethostname():
1218 if host == socket.gethostname():
1209 locker = 'user %s, process %s' % (user, pid)
1219 locker = 'user %s, process %s' % (user, pid)
1210 else:
1220 else:
1211 locker = 'user %s, process %s, host %s' \
1221 locker = 'user %s, process %s, host %s' \
1212 % (user, pid, host)
1222 % (user, pid, host)
1213 ui.write(("%-6s %s (%ds)\n") % (name + ":", locker, age))
1223 ui.write(("%-6s %s (%ds)\n") % (name + ":", locker, age))
1214 return 1
1224 return 1
1215 except OSError as e:
1225 except OSError as e:
1216 if e.errno != errno.ENOENT:
1226 if e.errno != errno.ENOENT:
1217 raise
1227 raise
1218
1228
1219 ui.write(("%-6s free\n") % (name + ":"))
1229 ui.write(("%-6s free\n") % (name + ":"))
1220 return 0
1230 return 0
1221
1231
1222 held += report(repo.svfs, "lock", repo.lock)
1232 held += report(repo.svfs, "lock", repo.lock)
1223 held += report(repo.vfs, "wlock", repo.wlock)
1233 held += report(repo.vfs, "wlock", repo.wlock)
1224
1234
1225 return held
1235 return held
1226
1236
1227 @command('debugmergestate', [], '')
1237 @command('debugmergestate', [], '')
1228 def debugmergestate(ui, repo, *args):
1238 def debugmergestate(ui, repo, *args):
1229 """print merge state
1239 """print merge state
1230
1240
1231 Use --verbose to print out information about whether v1 or v2 merge state
1241 Use --verbose to print out information about whether v1 or v2 merge state
1232 was chosen."""
1242 was chosen."""
1233 def _hashornull(h):
1243 def _hashornull(h):
1234 if h == nullhex:
1244 if h == nullhex:
1235 return 'null'
1245 return 'null'
1236 else:
1246 else:
1237 return h
1247 return h
1238
1248
1239 def printrecords(version):
1249 def printrecords(version):
1240 ui.write(('* version %s records\n') % version)
1250 ui.write(('* version %s records\n') % version)
1241 if version == 1:
1251 if version == 1:
1242 records = v1records
1252 records = v1records
1243 else:
1253 else:
1244 records = v2records
1254 records = v2records
1245
1255
1246 for rtype, record in records:
1256 for rtype, record in records:
1247 # pretty print some record types
1257 # pretty print some record types
1248 if rtype == 'L':
1258 if rtype == 'L':
1249 ui.write(('local: %s\n') % record)
1259 ui.write(('local: %s\n') % record)
1250 elif rtype == 'O':
1260 elif rtype == 'O':
1251 ui.write(('other: %s\n') % record)
1261 ui.write(('other: %s\n') % record)
1252 elif rtype == 'm':
1262 elif rtype == 'm':
1253 driver, mdstate = record.split('\0', 1)
1263 driver, mdstate = record.split('\0', 1)
1254 ui.write(('merge driver: %s (state "%s")\n')
1264 ui.write(('merge driver: %s (state "%s")\n')
1255 % (driver, mdstate))
1265 % (driver, mdstate))
1256 elif rtype in 'FDC':
1266 elif rtype in 'FDC':
1257 r = record.split('\0')
1267 r = record.split('\0')
1258 f, state, hash, lfile, afile, anode, ofile = r[0:7]
1268 f, state, hash, lfile, afile, anode, ofile = r[0:7]
1259 if version == 1:
1269 if version == 1:
1260 onode = 'not stored in v1 format'
1270 onode = 'not stored in v1 format'
1261 flags = r[7]
1271 flags = r[7]
1262 else:
1272 else:
1263 onode, flags = r[7:9]
1273 onode, flags = r[7:9]
1264 ui.write(('file: %s (record type "%s", state "%s", hash %s)\n')
1274 ui.write(('file: %s (record type "%s", state "%s", hash %s)\n')
1265 % (f, rtype, state, _hashornull(hash)))
1275 % (f, rtype, state, _hashornull(hash)))
1266 ui.write((' local path: %s (flags "%s")\n') % (lfile, flags))
1276 ui.write((' local path: %s (flags "%s")\n') % (lfile, flags))
1267 ui.write((' ancestor path: %s (node %s)\n')
1277 ui.write((' ancestor path: %s (node %s)\n')
1268 % (afile, _hashornull(anode)))
1278 % (afile, _hashornull(anode)))
1269 ui.write((' other path: %s (node %s)\n')
1279 ui.write((' other path: %s (node %s)\n')
1270 % (ofile, _hashornull(onode)))
1280 % (ofile, _hashornull(onode)))
1271 elif rtype == 'f':
1281 elif rtype == 'f':
1272 filename, rawextras = record.split('\0', 1)
1282 filename, rawextras = record.split('\0', 1)
1273 extras = rawextras.split('\0')
1283 extras = rawextras.split('\0')
1274 i = 0
1284 i = 0
1275 extrastrings = []
1285 extrastrings = []
1276 while i < len(extras):
1286 while i < len(extras):
1277 extrastrings.append('%s = %s' % (extras[i], extras[i + 1]))
1287 extrastrings.append('%s = %s' % (extras[i], extras[i + 1]))
1278 i += 2
1288 i += 2
1279
1289
1280 ui.write(('file extras: %s (%s)\n')
1290 ui.write(('file extras: %s (%s)\n')
1281 % (filename, ', '.join(extrastrings)))
1291 % (filename, ', '.join(extrastrings)))
1282 elif rtype == 'l':
1292 elif rtype == 'l':
1283 labels = record.split('\0', 2)
1293 labels = record.split('\0', 2)
1284 labels = [l for l in labels if len(l) > 0]
1294 labels = [l for l in labels if len(l) > 0]
1285 ui.write(('labels:\n'))
1295 ui.write(('labels:\n'))
1286 ui.write((' local: %s\n' % labels[0]))
1296 ui.write((' local: %s\n' % labels[0]))
1287 ui.write((' other: %s\n' % labels[1]))
1297 ui.write((' other: %s\n' % labels[1]))
1288 if len(labels) > 2:
1298 if len(labels) > 2:
1289 ui.write((' base: %s\n' % labels[2]))
1299 ui.write((' base: %s\n' % labels[2]))
1290 else:
1300 else:
1291 ui.write(('unrecognized entry: %s\t%s\n')
1301 ui.write(('unrecognized entry: %s\t%s\n')
1292 % (rtype, record.replace('\0', '\t')))
1302 % (rtype, record.replace('\0', '\t')))
1293
1303
1294 # Avoid mergestate.read() since it may raise an exception for unsupported
1304 # Avoid mergestate.read() since it may raise an exception for unsupported
1295 # merge state records. We shouldn't be doing this, but this is OK since this
1305 # merge state records. We shouldn't be doing this, but this is OK since this
1296 # command is pretty low-level.
1306 # command is pretty low-level.
1297 ms = mergemod.mergestate(repo)
1307 ms = mergemod.mergestate(repo)
1298
1308
1299 # sort so that reasonable information is on top
1309 # sort so that reasonable information is on top
1300 v1records = ms._readrecordsv1()
1310 v1records = ms._readrecordsv1()
1301 v2records = ms._readrecordsv2()
1311 v2records = ms._readrecordsv2()
1302 order = 'LOml'
1312 order = 'LOml'
1303 def key(r):
1313 def key(r):
1304 idx = order.find(r[0])
1314 idx = order.find(r[0])
1305 if idx == -1:
1315 if idx == -1:
1306 return (1, r[1])
1316 return (1, r[1])
1307 else:
1317 else:
1308 return (0, idx)
1318 return (0, idx)
1309 v1records.sort(key=key)
1319 v1records.sort(key=key)
1310 v2records.sort(key=key)
1320 v2records.sort(key=key)
1311
1321
1312 if not v1records and not v2records:
1322 if not v1records and not v2records:
1313 ui.write(('no merge state found\n'))
1323 ui.write(('no merge state found\n'))
1314 elif not v2records:
1324 elif not v2records:
1315 ui.note(('no version 2 merge state\n'))
1325 ui.note(('no version 2 merge state\n'))
1316 printrecords(1)
1326 printrecords(1)
1317 elif ms._v1v2match(v1records, v2records):
1327 elif ms._v1v2match(v1records, v2records):
1318 ui.note(('v1 and v2 states match: using v2\n'))
1328 ui.note(('v1 and v2 states match: using v2\n'))
1319 printrecords(2)
1329 printrecords(2)
1320 else:
1330 else:
1321 ui.note(('v1 and v2 states mismatch: using v1\n'))
1331 ui.note(('v1 and v2 states mismatch: using v1\n'))
1322 printrecords(1)
1332 printrecords(1)
1323 if ui.verbose:
1333 if ui.verbose:
1324 printrecords(2)
1334 printrecords(2)
1325
1335
1326 @command('debugnamecomplete', [], _('NAME...'))
1336 @command('debugnamecomplete', [], _('NAME...'))
1327 def debugnamecomplete(ui, repo, *args):
1337 def debugnamecomplete(ui, repo, *args):
1328 '''complete "names" - tags, open branch names, bookmark names'''
1338 '''complete "names" - tags, open branch names, bookmark names'''
1329
1339
1330 names = set()
1340 names = set()
1331 # since we previously only listed open branches, we will handle that
1341 # since we previously only listed open branches, we will handle that
1332 # specially (after this for loop)
1342 # specially (after this for loop)
1333 for name, ns in repo.names.iteritems():
1343 for name, ns in repo.names.iteritems():
1334 if name != 'branches':
1344 if name != 'branches':
1335 names.update(ns.listnames(repo))
1345 names.update(ns.listnames(repo))
1336 names.update(tag for (tag, heads, tip, closed)
1346 names.update(tag for (tag, heads, tip, closed)
1337 in repo.branchmap().iterbranches() if not closed)
1347 in repo.branchmap().iterbranches() if not closed)
1338 completions = set()
1348 completions = set()
1339 if not args:
1349 if not args:
1340 args = ['']
1350 args = ['']
1341 for a in args:
1351 for a in args:
1342 completions.update(n for n in names if n.startswith(a))
1352 completions.update(n for n in names if n.startswith(a))
1343 ui.write('\n'.join(sorted(completions)))
1353 ui.write('\n'.join(sorted(completions)))
1344 ui.write('\n')
1354 ui.write('\n')
1345
1355
1346 @command('debugobsolete',
1356 @command('debugobsolete',
1347 [('', 'flags', 0, _('markers flag')),
1357 [('', 'flags', 0, _('markers flag')),
1348 ('', 'record-parents', False,
1358 ('', 'record-parents', False,
1349 _('record parent information for the precursor')),
1359 _('record parent information for the precursor')),
1350 ('r', 'rev', [], _('display markers relevant to REV')),
1360 ('r', 'rev', [], _('display markers relevant to REV')),
1351 ('', 'exclusive', False, _('restrict display to markers only '
1361 ('', 'exclusive', False, _('restrict display to markers only '
1352 'relevant to REV')),
1362 'relevant to REV')),
1353 ('', 'index', False, _('display index of the marker')),
1363 ('', 'index', False, _('display index of the marker')),
1354 ('', 'delete', [], _('delete markers specified by indices')),
1364 ('', 'delete', [], _('delete markers specified by indices')),
1355 ] + cmdutil.commitopts2 + cmdutil.formatteropts,
1365 ] + cmdutil.commitopts2 + cmdutil.formatteropts,
1356 _('[OBSOLETED [REPLACEMENT ...]]'))
1366 _('[OBSOLETED [REPLACEMENT ...]]'))
1357 def debugobsolete(ui, repo, precursor=None, *successors, **opts):
1367 def debugobsolete(ui, repo, precursor=None, *successors, **opts):
1358 """create arbitrary obsolete marker
1368 """create arbitrary obsolete marker
1359
1369
1360 With no arguments, displays the list of obsolescence markers."""
1370 With no arguments, displays the list of obsolescence markers."""
1361
1371
1362 opts = pycompat.byteskwargs(opts)
1372 opts = pycompat.byteskwargs(opts)
1363
1373
1364 def parsenodeid(s):
1374 def parsenodeid(s):
1365 try:
1375 try:
1366 # We do not use revsingle/revrange functions here to accept
1376 # We do not use revsingle/revrange functions here to accept
1367 # arbitrary node identifiers, possibly not present in the
1377 # arbitrary node identifiers, possibly not present in the
1368 # local repository.
1378 # local repository.
1369 n = bin(s)
1379 n = bin(s)
1370 if len(n) != len(nullid):
1380 if len(n) != len(nullid):
1371 raise TypeError()
1381 raise TypeError()
1372 return n
1382 return n
1373 except TypeError:
1383 except TypeError:
1374 raise error.Abort('changeset references must be full hexadecimal '
1384 raise error.Abort('changeset references must be full hexadecimal '
1375 'node identifiers')
1385 'node identifiers')
1376
1386
1377 if opts.get('delete'):
1387 if opts.get('delete'):
1378 indices = []
1388 indices = []
1379 for v in opts.get('delete'):
1389 for v in opts.get('delete'):
1380 try:
1390 try:
1381 indices.append(int(v))
1391 indices.append(int(v))
1382 except ValueError:
1392 except ValueError:
1383 raise error.Abort(_('invalid index value: %r') % v,
1393 raise error.Abort(_('invalid index value: %r') % v,
1384 hint=_('use integers for indices'))
1394 hint=_('use integers for indices'))
1385
1395
1386 if repo.currenttransaction():
1396 if repo.currenttransaction():
1387 raise error.Abort(_('cannot delete obsmarkers in the middle '
1397 raise error.Abort(_('cannot delete obsmarkers in the middle '
1388 'of transaction.'))
1398 'of transaction.'))
1389
1399
1390 with repo.lock():
1400 with repo.lock():
1391 n = repair.deleteobsmarkers(repo.obsstore, indices)
1401 n = repair.deleteobsmarkers(repo.obsstore, indices)
1392 ui.write(_('deleted %i obsolescence markers\n') % n)
1402 ui.write(_('deleted %i obsolescence markers\n') % n)
1393
1403
1394 return
1404 return
1395
1405
1396 if precursor is not None:
1406 if precursor is not None:
1397 if opts['rev']:
1407 if opts['rev']:
1398 raise error.Abort('cannot select revision when creating marker')
1408 raise error.Abort('cannot select revision when creating marker')
1399 metadata = {}
1409 metadata = {}
1400 metadata['user'] = opts['user'] or ui.username()
1410 metadata['user'] = opts['user'] or ui.username()
1401 succs = tuple(parsenodeid(succ) for succ in successors)
1411 succs = tuple(parsenodeid(succ) for succ in successors)
1402 l = repo.lock()
1412 l = repo.lock()
1403 try:
1413 try:
1404 tr = repo.transaction('debugobsolete')
1414 tr = repo.transaction('debugobsolete')
1405 try:
1415 try:
1406 date = opts.get('date')
1416 date = opts.get('date')
1407 if date:
1417 if date:
1408 date = util.parsedate(date)
1418 date = util.parsedate(date)
1409 else:
1419 else:
1410 date = None
1420 date = None
1411 prec = parsenodeid(precursor)
1421 prec = parsenodeid(precursor)
1412 parents = None
1422 parents = None
1413 if opts['record_parents']:
1423 if opts['record_parents']:
1414 if prec not in repo.unfiltered():
1424 if prec not in repo.unfiltered():
1415 raise error.Abort('cannot used --record-parents on '
1425 raise error.Abort('cannot used --record-parents on '
1416 'unknown changesets')
1426 'unknown changesets')
1417 parents = repo.unfiltered()[prec].parents()
1427 parents = repo.unfiltered()[prec].parents()
1418 parents = tuple(p.node() for p in parents)
1428 parents = tuple(p.node() for p in parents)
1419 repo.obsstore.create(tr, prec, succs, opts['flags'],
1429 repo.obsstore.create(tr, prec, succs, opts['flags'],
1420 parents=parents, date=date,
1430 parents=parents, date=date,
1421 metadata=metadata, ui=ui)
1431 metadata=metadata, ui=ui)
1422 tr.close()
1432 tr.close()
1423 except ValueError as exc:
1433 except ValueError as exc:
1424 raise error.Abort(_('bad obsmarker input: %s') % exc)
1434 raise error.Abort(_('bad obsmarker input: %s') % exc)
1425 finally:
1435 finally:
1426 tr.release()
1436 tr.release()
1427 finally:
1437 finally:
1428 l.release()
1438 l.release()
1429 else:
1439 else:
1430 if opts['rev']:
1440 if opts['rev']:
1431 revs = scmutil.revrange(repo, opts['rev'])
1441 revs = scmutil.revrange(repo, opts['rev'])
1432 nodes = [repo[r].node() for r in revs]
1442 nodes = [repo[r].node() for r in revs]
1433 markers = list(obsutil.getmarkers(repo, nodes=nodes,
1443 markers = list(obsutil.getmarkers(repo, nodes=nodes,
1434 exclusive=opts['exclusive']))
1444 exclusive=opts['exclusive']))
1435 markers.sort(key=lambda x: x._data)
1445 markers.sort(key=lambda x: x._data)
1436 else:
1446 else:
1437 markers = obsutil.getmarkers(repo)
1447 markers = obsutil.getmarkers(repo)
1438
1448
1439 markerstoiter = markers
1449 markerstoiter = markers
1440 isrelevant = lambda m: True
1450 isrelevant = lambda m: True
1441 if opts.get('rev') and opts.get('index'):
1451 if opts.get('rev') and opts.get('index'):
1442 markerstoiter = obsutil.getmarkers(repo)
1452 markerstoiter = obsutil.getmarkers(repo)
1443 markerset = set(markers)
1453 markerset = set(markers)
1444 isrelevant = lambda m: m in markerset
1454 isrelevant = lambda m: m in markerset
1445
1455
1446 fm = ui.formatter('debugobsolete', opts)
1456 fm = ui.formatter('debugobsolete', opts)
1447 for i, m in enumerate(markerstoiter):
1457 for i, m in enumerate(markerstoiter):
1448 if not isrelevant(m):
1458 if not isrelevant(m):
1449 # marker can be irrelevant when we're iterating over a set
1459 # marker can be irrelevant when we're iterating over a set
1450 # of markers (markerstoiter) which is bigger than the set
1460 # of markers (markerstoiter) which is bigger than the set
1451 # of markers we want to display (markers)
1461 # of markers we want to display (markers)
1452 # this can happen if both --index and --rev options are
1462 # this can happen if both --index and --rev options are
1453 # provided and thus we need to iterate over all of the markers
1463 # provided and thus we need to iterate over all of the markers
1454 # to get the correct indices, but only display the ones that
1464 # to get the correct indices, but only display the ones that
1455 # are relevant to --rev value
1465 # are relevant to --rev value
1456 continue
1466 continue
1457 fm.startitem()
1467 fm.startitem()
1458 ind = i if opts.get('index') else None
1468 ind = i if opts.get('index') else None
1459 cmdutil.showmarker(fm, m, index=ind)
1469 cmdutil.showmarker(fm, m, index=ind)
1460 fm.end()
1470 fm.end()
1461
1471
1462 @command('debugpathcomplete',
1472 @command('debugpathcomplete',
1463 [('f', 'full', None, _('complete an entire path')),
1473 [('f', 'full', None, _('complete an entire path')),
1464 ('n', 'normal', None, _('show only normal files')),
1474 ('n', 'normal', None, _('show only normal files')),
1465 ('a', 'added', None, _('show only added files')),
1475 ('a', 'added', None, _('show only added files')),
1466 ('r', 'removed', None, _('show only removed files'))],
1476 ('r', 'removed', None, _('show only removed files'))],
1467 _('FILESPEC...'))
1477 _('FILESPEC...'))
1468 def debugpathcomplete(ui, repo, *specs, **opts):
1478 def debugpathcomplete(ui, repo, *specs, **opts):
1469 '''complete part or all of a tracked path
1479 '''complete part or all of a tracked path
1470
1480
1471 This command supports shells that offer path name completion. It
1481 This command supports shells that offer path name completion. It
1472 currently completes only files already known to the dirstate.
1482 currently completes only files already known to the dirstate.
1473
1483
1474 Completion extends only to the next path segment unless
1484 Completion extends only to the next path segment unless
1475 --full is specified, in which case entire paths are used.'''
1485 --full is specified, in which case entire paths are used.'''
1476
1486
1477 def complete(path, acceptable):
1487 def complete(path, acceptable):
1478 dirstate = repo.dirstate
1488 dirstate = repo.dirstate
1479 spec = os.path.normpath(os.path.join(pycompat.getcwd(), path))
1489 spec = os.path.normpath(os.path.join(pycompat.getcwd(), path))
1480 rootdir = repo.root + pycompat.ossep
1490 rootdir = repo.root + pycompat.ossep
1481 if spec != repo.root and not spec.startswith(rootdir):
1491 if spec != repo.root and not spec.startswith(rootdir):
1482 return [], []
1492 return [], []
1483 if os.path.isdir(spec):
1493 if os.path.isdir(spec):
1484 spec += '/'
1494 spec += '/'
1485 spec = spec[len(rootdir):]
1495 spec = spec[len(rootdir):]
1486 fixpaths = pycompat.ossep != '/'
1496 fixpaths = pycompat.ossep != '/'
1487 if fixpaths:
1497 if fixpaths:
1488 spec = spec.replace(pycompat.ossep, '/')
1498 spec = spec.replace(pycompat.ossep, '/')
1489 speclen = len(spec)
1499 speclen = len(spec)
1490 fullpaths = opts[r'full']
1500 fullpaths = opts[r'full']
1491 files, dirs = set(), set()
1501 files, dirs = set(), set()
1492 adddir, addfile = dirs.add, files.add
1502 adddir, addfile = dirs.add, files.add
1493 for f, st in dirstate.iteritems():
1503 for f, st in dirstate.iteritems():
1494 if f.startswith(spec) and st[0] in acceptable:
1504 if f.startswith(spec) and st[0] in acceptable:
1495 if fixpaths:
1505 if fixpaths:
1496 f = f.replace('/', pycompat.ossep)
1506 f = f.replace('/', pycompat.ossep)
1497 if fullpaths:
1507 if fullpaths:
1498 addfile(f)
1508 addfile(f)
1499 continue
1509 continue
1500 s = f.find(pycompat.ossep, speclen)
1510 s = f.find(pycompat.ossep, speclen)
1501 if s >= 0:
1511 if s >= 0:
1502 adddir(f[:s])
1512 adddir(f[:s])
1503 else:
1513 else:
1504 addfile(f)
1514 addfile(f)
1505 return files, dirs
1515 return files, dirs
1506
1516
1507 acceptable = ''
1517 acceptable = ''
1508 if opts[r'normal']:
1518 if opts[r'normal']:
1509 acceptable += 'nm'
1519 acceptable += 'nm'
1510 if opts[r'added']:
1520 if opts[r'added']:
1511 acceptable += 'a'
1521 acceptable += 'a'
1512 if opts[r'removed']:
1522 if opts[r'removed']:
1513 acceptable += 'r'
1523 acceptable += 'r'
1514 cwd = repo.getcwd()
1524 cwd = repo.getcwd()
1515 if not specs:
1525 if not specs:
1516 specs = ['.']
1526 specs = ['.']
1517
1527
1518 files, dirs = set(), set()
1528 files, dirs = set(), set()
1519 for spec in specs:
1529 for spec in specs:
1520 f, d = complete(spec, acceptable or 'nmar')
1530 f, d = complete(spec, acceptable or 'nmar')
1521 files.update(f)
1531 files.update(f)
1522 dirs.update(d)
1532 dirs.update(d)
1523 files.update(dirs)
1533 files.update(dirs)
1524 ui.write('\n'.join(repo.pathto(p, cwd) for p in sorted(files)))
1534 ui.write('\n'.join(repo.pathto(p, cwd) for p in sorted(files)))
1525 ui.write('\n')
1535 ui.write('\n')
1526
1536
1527 @command('debugpickmergetool',
1537 @command('debugpickmergetool',
1528 [('r', 'rev', '', _('check for files in this revision'), _('REV')),
1538 [('r', 'rev', '', _('check for files in this revision'), _('REV')),
1529 ('', 'changedelete', None, _('emulate merging change and delete')),
1539 ('', 'changedelete', None, _('emulate merging change and delete')),
1530 ] + cmdutil.walkopts + cmdutil.mergetoolopts,
1540 ] + cmdutil.walkopts + cmdutil.mergetoolopts,
1531 _('[PATTERN]...'),
1541 _('[PATTERN]...'),
1532 inferrepo=True)
1542 inferrepo=True)
1533 def debugpickmergetool(ui, repo, *pats, **opts):
1543 def debugpickmergetool(ui, repo, *pats, **opts):
1534 """examine which merge tool is chosen for specified file
1544 """examine which merge tool is chosen for specified file
1535
1545
1536 As described in :hg:`help merge-tools`, Mercurial examines
1546 As described in :hg:`help merge-tools`, Mercurial examines
1537 configurations below in this order to decide which merge tool is
1547 configurations below in this order to decide which merge tool is
1538 chosen for specified file.
1548 chosen for specified file.
1539
1549
1540 1. ``--tool`` option
1550 1. ``--tool`` option
1541 2. ``HGMERGE`` environment variable
1551 2. ``HGMERGE`` environment variable
1542 3. configurations in ``merge-patterns`` section
1552 3. configurations in ``merge-patterns`` section
1543 4. configuration of ``ui.merge``
1553 4. configuration of ``ui.merge``
1544 5. configurations in ``merge-tools`` section
1554 5. configurations in ``merge-tools`` section
1545 6. ``hgmerge`` tool (for historical reason only)
1555 6. ``hgmerge`` tool (for historical reason only)
1546 7. default tool for fallback (``:merge`` or ``:prompt``)
1556 7. default tool for fallback (``:merge`` or ``:prompt``)
1547
1557
1548 This command writes out examination result in the style below::
1558 This command writes out examination result in the style below::
1549
1559
1550 FILE = MERGETOOL
1560 FILE = MERGETOOL
1551
1561
1552 By default, all files known in the first parent context of the
1562 By default, all files known in the first parent context of the
1553 working directory are examined. Use file patterns and/or -I/-X
1563 working directory are examined. Use file patterns and/or -I/-X
1554 options to limit target files. -r/--rev is also useful to examine
1564 options to limit target files. -r/--rev is also useful to examine
1555 files in another context without actual updating to it.
1565 files in another context without actual updating to it.
1556
1566
1557 With --debug, this command shows warning messages while matching
1567 With --debug, this command shows warning messages while matching
1558 against ``merge-patterns`` and so on, too. It is recommended to
1568 against ``merge-patterns`` and so on, too. It is recommended to
1559 use this option with explicit file patterns and/or -I/-X options,
1569 use this option with explicit file patterns and/or -I/-X options,
1560 because this option increases amount of output per file according
1570 because this option increases amount of output per file according
1561 to configurations in hgrc.
1571 to configurations in hgrc.
1562
1572
1563 With -v/--verbose, this command shows configurations below at
1573 With -v/--verbose, this command shows configurations below at
1564 first (only if specified).
1574 first (only if specified).
1565
1575
1566 - ``--tool`` option
1576 - ``--tool`` option
1567 - ``HGMERGE`` environment variable
1577 - ``HGMERGE`` environment variable
1568 - configuration of ``ui.merge``
1578 - configuration of ``ui.merge``
1569
1579
1570 If merge tool is chosen before matching against
1580 If merge tool is chosen before matching against
1571 ``merge-patterns``, this command can't show any helpful
1581 ``merge-patterns``, this command can't show any helpful
1572 information, even with --debug. In such case, information above is
1582 information, even with --debug. In such case, information above is
1573 useful to know why a merge tool is chosen.
1583 useful to know why a merge tool is chosen.
1574 """
1584 """
1575 opts = pycompat.byteskwargs(opts)
1585 opts = pycompat.byteskwargs(opts)
1576 overrides = {}
1586 overrides = {}
1577 if opts['tool']:
1587 if opts['tool']:
1578 overrides[('ui', 'forcemerge')] = opts['tool']
1588 overrides[('ui', 'forcemerge')] = opts['tool']
1579 ui.note(('with --tool %r\n') % (opts['tool']))
1589 ui.note(('with --tool %r\n') % (opts['tool']))
1580
1590
1581 with ui.configoverride(overrides, 'debugmergepatterns'):
1591 with ui.configoverride(overrides, 'debugmergepatterns'):
1582 hgmerge = encoding.environ.get("HGMERGE")
1592 hgmerge = encoding.environ.get("HGMERGE")
1583 if hgmerge is not None:
1593 if hgmerge is not None:
1584 ui.note(('with HGMERGE=%r\n') % (hgmerge))
1594 ui.note(('with HGMERGE=%r\n') % (hgmerge))
1585 uimerge = ui.config("ui", "merge")
1595 uimerge = ui.config("ui", "merge")
1586 if uimerge:
1596 if uimerge:
1587 ui.note(('with ui.merge=%r\n') % (uimerge))
1597 ui.note(('with ui.merge=%r\n') % (uimerge))
1588
1598
1589 ctx = scmutil.revsingle(repo, opts.get('rev'))
1599 ctx = scmutil.revsingle(repo, opts.get('rev'))
1590 m = scmutil.match(ctx, pats, opts)
1600 m = scmutil.match(ctx, pats, opts)
1591 changedelete = opts['changedelete']
1601 changedelete = opts['changedelete']
1592 for path in ctx.walk(m):
1602 for path in ctx.walk(m):
1593 fctx = ctx[path]
1603 fctx = ctx[path]
1594 try:
1604 try:
1595 if not ui.debugflag:
1605 if not ui.debugflag:
1596 ui.pushbuffer(error=True)
1606 ui.pushbuffer(error=True)
1597 tool, toolpath = filemerge._picktool(repo, ui, path,
1607 tool, toolpath = filemerge._picktool(repo, ui, path,
1598 fctx.isbinary(),
1608 fctx.isbinary(),
1599 'l' in fctx.flags(),
1609 'l' in fctx.flags(),
1600 changedelete)
1610 changedelete)
1601 finally:
1611 finally:
1602 if not ui.debugflag:
1612 if not ui.debugflag:
1603 ui.popbuffer()
1613 ui.popbuffer()
1604 ui.write(('%s = %s\n') % (path, tool))
1614 ui.write(('%s = %s\n') % (path, tool))
1605
1615
1606 @command('debugpushkey', [], _('REPO NAMESPACE [KEY OLD NEW]'), norepo=True)
1616 @command('debugpushkey', [], _('REPO NAMESPACE [KEY OLD NEW]'), norepo=True)
1607 def debugpushkey(ui, repopath, namespace, *keyinfo, **opts):
1617 def debugpushkey(ui, repopath, namespace, *keyinfo, **opts):
1608 '''access the pushkey key/value protocol
1618 '''access the pushkey key/value protocol
1609
1619
1610 With two args, list the keys in the given namespace.
1620 With two args, list the keys in the given namespace.
1611
1621
1612 With five args, set a key to new if it currently is set to old.
1622 With five args, set a key to new if it currently is set to old.
1613 Reports success or failure.
1623 Reports success or failure.
1614 '''
1624 '''
1615
1625
1616 target = hg.peer(ui, {}, repopath)
1626 target = hg.peer(ui, {}, repopath)
1617 if keyinfo:
1627 if keyinfo:
1618 key, old, new = keyinfo
1628 key, old, new = keyinfo
1619 r = target.pushkey(namespace, key, old, new)
1629 r = target.pushkey(namespace, key, old, new)
1620 ui.status(str(r) + '\n')
1630 ui.status(str(r) + '\n')
1621 return not r
1631 return not r
1622 else:
1632 else:
1623 for k, v in sorted(target.listkeys(namespace).iteritems()):
1633 for k, v in sorted(target.listkeys(namespace).iteritems()):
1624 ui.write("%s\t%s\n" % (util.escapestr(k),
1634 ui.write("%s\t%s\n" % (util.escapestr(k),
1625 util.escapestr(v)))
1635 util.escapestr(v)))
1626
1636
1627 @command('debugpvec', [], _('A B'))
1637 @command('debugpvec', [], _('A B'))
1628 def debugpvec(ui, repo, a, b=None):
1638 def debugpvec(ui, repo, a, b=None):
1629 ca = scmutil.revsingle(repo, a)
1639 ca = scmutil.revsingle(repo, a)
1630 cb = scmutil.revsingle(repo, b)
1640 cb = scmutil.revsingle(repo, b)
1631 pa = pvec.ctxpvec(ca)
1641 pa = pvec.ctxpvec(ca)
1632 pb = pvec.ctxpvec(cb)
1642 pb = pvec.ctxpvec(cb)
1633 if pa == pb:
1643 if pa == pb:
1634 rel = "="
1644 rel = "="
1635 elif pa > pb:
1645 elif pa > pb:
1636 rel = ">"
1646 rel = ">"
1637 elif pa < pb:
1647 elif pa < pb:
1638 rel = "<"
1648 rel = "<"
1639 elif pa | pb:
1649 elif pa | pb:
1640 rel = "|"
1650 rel = "|"
1641 ui.write(_("a: %s\n") % pa)
1651 ui.write(_("a: %s\n") % pa)
1642 ui.write(_("b: %s\n") % pb)
1652 ui.write(_("b: %s\n") % pb)
1643 ui.write(_("depth(a): %d depth(b): %d\n") % (pa._depth, pb._depth))
1653 ui.write(_("depth(a): %d depth(b): %d\n") % (pa._depth, pb._depth))
1644 ui.write(_("delta: %d hdist: %d distance: %d relation: %s\n") %
1654 ui.write(_("delta: %d hdist: %d distance: %d relation: %s\n") %
1645 (abs(pa._depth - pb._depth), pvec._hamming(pa._vec, pb._vec),
1655 (abs(pa._depth - pb._depth), pvec._hamming(pa._vec, pb._vec),
1646 pa.distance(pb), rel))
1656 pa.distance(pb), rel))
1647
1657
1648 @command('debugrebuilddirstate|debugrebuildstate',
1658 @command('debugrebuilddirstate|debugrebuildstate',
1649 [('r', 'rev', '', _('revision to rebuild to'), _('REV')),
1659 [('r', 'rev', '', _('revision to rebuild to'), _('REV')),
1650 ('', 'minimal', None, _('only rebuild files that are inconsistent with '
1660 ('', 'minimal', None, _('only rebuild files that are inconsistent with '
1651 'the working copy parent')),
1661 'the working copy parent')),
1652 ],
1662 ],
1653 _('[-r REV]'))
1663 _('[-r REV]'))
1654 def debugrebuilddirstate(ui, repo, rev, **opts):
1664 def debugrebuilddirstate(ui, repo, rev, **opts):
1655 """rebuild the dirstate as it would look like for the given revision
1665 """rebuild the dirstate as it would look like for the given revision
1656
1666
1657 If no revision is specified the first current parent will be used.
1667 If no revision is specified the first current parent will be used.
1658
1668
1659 The dirstate will be set to the files of the given revision.
1669 The dirstate will be set to the files of the given revision.
1660 The actual working directory content or existing dirstate
1670 The actual working directory content or existing dirstate
1661 information such as adds or removes is not considered.
1671 information such as adds or removes is not considered.
1662
1672
1663 ``minimal`` will only rebuild the dirstate status for files that claim to be
1673 ``minimal`` will only rebuild the dirstate status for files that claim to be
1664 tracked but are not in the parent manifest, or that exist in the parent
1674 tracked but are not in the parent manifest, or that exist in the parent
1665 manifest but are not in the dirstate. It will not change adds, removes, or
1675 manifest but are not in the dirstate. It will not change adds, removes, or
1666 modified files that are in the working copy parent.
1676 modified files that are in the working copy parent.
1667
1677
1668 One use of this command is to make the next :hg:`status` invocation
1678 One use of this command is to make the next :hg:`status` invocation
1669 check the actual file content.
1679 check the actual file content.
1670 """
1680 """
1671 ctx = scmutil.revsingle(repo, rev)
1681 ctx = scmutil.revsingle(repo, rev)
1672 with repo.wlock():
1682 with repo.wlock():
1673 dirstate = repo.dirstate
1683 dirstate = repo.dirstate
1674 changedfiles = None
1684 changedfiles = None
1675 # See command doc for what minimal does.
1685 # See command doc for what minimal does.
1676 if opts.get(r'minimal'):
1686 if opts.get(r'minimal'):
1677 manifestfiles = set(ctx.manifest().keys())
1687 manifestfiles = set(ctx.manifest().keys())
1678 dirstatefiles = set(dirstate)
1688 dirstatefiles = set(dirstate)
1679 manifestonly = manifestfiles - dirstatefiles
1689 manifestonly = manifestfiles - dirstatefiles
1680 dsonly = dirstatefiles - manifestfiles
1690 dsonly = dirstatefiles - manifestfiles
1681 dsnotadded = set(f for f in dsonly if dirstate[f] != 'a')
1691 dsnotadded = set(f for f in dsonly if dirstate[f] != 'a')
1682 changedfiles = manifestonly | dsnotadded
1692 changedfiles = manifestonly | dsnotadded
1683
1693
1684 dirstate.rebuild(ctx.node(), ctx.manifest(), changedfiles)
1694 dirstate.rebuild(ctx.node(), ctx.manifest(), changedfiles)
1685
1695
1686 @command('debugrebuildfncache', [], '')
1696 @command('debugrebuildfncache', [], '')
1687 def debugrebuildfncache(ui, repo):
1697 def debugrebuildfncache(ui, repo):
1688 """rebuild the fncache file"""
1698 """rebuild the fncache file"""
1689 repair.rebuildfncache(ui, repo)
1699 repair.rebuildfncache(ui, repo)
1690
1700
1691 @command('debugrename',
1701 @command('debugrename',
1692 [('r', 'rev', '', _('revision to debug'), _('REV'))],
1702 [('r', 'rev', '', _('revision to debug'), _('REV'))],
1693 _('[-r REV] FILE'))
1703 _('[-r REV] FILE'))
1694 def debugrename(ui, repo, file1, *pats, **opts):
1704 def debugrename(ui, repo, file1, *pats, **opts):
1695 """dump rename information"""
1705 """dump rename information"""
1696
1706
1697 opts = pycompat.byteskwargs(opts)
1707 opts = pycompat.byteskwargs(opts)
1698 ctx = scmutil.revsingle(repo, opts.get('rev'))
1708 ctx = scmutil.revsingle(repo, opts.get('rev'))
1699 m = scmutil.match(ctx, (file1,) + pats, opts)
1709 m = scmutil.match(ctx, (file1,) + pats, opts)
1700 for abs in ctx.walk(m):
1710 for abs in ctx.walk(m):
1701 fctx = ctx[abs]
1711 fctx = ctx[abs]
1702 o = fctx.filelog().renamed(fctx.filenode())
1712 o = fctx.filelog().renamed(fctx.filenode())
1703 rel = m.rel(abs)
1713 rel = m.rel(abs)
1704 if o:
1714 if o:
1705 ui.write(_("%s renamed from %s:%s\n") % (rel, o[0], hex(o[1])))
1715 ui.write(_("%s renamed from %s:%s\n") % (rel, o[0], hex(o[1])))
1706 else:
1716 else:
1707 ui.write(_("%s not renamed\n") % rel)
1717 ui.write(_("%s not renamed\n") % rel)
1708
1718
1709 @command('debugrevlog', cmdutil.debugrevlogopts +
1719 @command('debugrevlog', cmdutil.debugrevlogopts +
1710 [('d', 'dump', False, _('dump index data'))],
1720 [('d', 'dump', False, _('dump index data'))],
1711 _('-c|-m|FILE'),
1721 _('-c|-m|FILE'),
1712 optionalrepo=True)
1722 optionalrepo=True)
1713 def debugrevlog(ui, repo, file_=None, **opts):
1723 def debugrevlog(ui, repo, file_=None, **opts):
1714 """show data and statistics about a revlog"""
1724 """show data and statistics about a revlog"""
1715 opts = pycompat.byteskwargs(opts)
1725 opts = pycompat.byteskwargs(opts)
1716 r = cmdutil.openrevlog(repo, 'debugrevlog', file_, opts)
1726 r = cmdutil.openrevlog(repo, 'debugrevlog', file_, opts)
1717
1727
1718 if opts.get("dump"):
1728 if opts.get("dump"):
1719 numrevs = len(r)
1729 numrevs = len(r)
1720 ui.write(("# rev p1rev p2rev start end deltastart base p1 p2"
1730 ui.write(("# rev p1rev p2rev start end deltastart base p1 p2"
1721 " rawsize totalsize compression heads chainlen\n"))
1731 " rawsize totalsize compression heads chainlen\n"))
1722 ts = 0
1732 ts = 0
1723 heads = set()
1733 heads = set()
1724
1734
1725 for rev in xrange(numrevs):
1735 for rev in xrange(numrevs):
1726 dbase = r.deltaparent(rev)
1736 dbase = r.deltaparent(rev)
1727 if dbase == -1:
1737 if dbase == -1:
1728 dbase = rev
1738 dbase = rev
1729 cbase = r.chainbase(rev)
1739 cbase = r.chainbase(rev)
1730 clen = r.chainlen(rev)
1740 clen = r.chainlen(rev)
1731 p1, p2 = r.parentrevs(rev)
1741 p1, p2 = r.parentrevs(rev)
1732 rs = r.rawsize(rev)
1742 rs = r.rawsize(rev)
1733 ts = ts + rs
1743 ts = ts + rs
1734 heads -= set(r.parentrevs(rev))
1744 heads -= set(r.parentrevs(rev))
1735 heads.add(rev)
1745 heads.add(rev)
1736 try:
1746 try:
1737 compression = ts / r.end(rev)
1747 compression = ts / r.end(rev)
1738 except ZeroDivisionError:
1748 except ZeroDivisionError:
1739 compression = 0
1749 compression = 0
1740 ui.write("%5d %5d %5d %5d %5d %10d %4d %4d %4d %7d %9d "
1750 ui.write("%5d %5d %5d %5d %5d %10d %4d %4d %4d %7d %9d "
1741 "%11d %5d %8d\n" %
1751 "%11d %5d %8d\n" %
1742 (rev, p1, p2, r.start(rev), r.end(rev),
1752 (rev, p1, p2, r.start(rev), r.end(rev),
1743 r.start(dbase), r.start(cbase),
1753 r.start(dbase), r.start(cbase),
1744 r.start(p1), r.start(p2),
1754 r.start(p1), r.start(p2),
1745 rs, ts, compression, len(heads), clen))
1755 rs, ts, compression, len(heads), clen))
1746 return 0
1756 return 0
1747
1757
1748 v = r.version
1758 v = r.version
1749 format = v & 0xFFFF
1759 format = v & 0xFFFF
1750 flags = []
1760 flags = []
1751 gdelta = False
1761 gdelta = False
1752 if v & revlog.FLAG_INLINE_DATA:
1762 if v & revlog.FLAG_INLINE_DATA:
1753 flags.append('inline')
1763 flags.append('inline')
1754 if v & revlog.FLAG_GENERALDELTA:
1764 if v & revlog.FLAG_GENERALDELTA:
1755 gdelta = True
1765 gdelta = True
1756 flags.append('generaldelta')
1766 flags.append('generaldelta')
1757 if not flags:
1767 if not flags:
1758 flags = ['(none)']
1768 flags = ['(none)']
1759
1769
1760 nummerges = 0
1770 nummerges = 0
1761 numfull = 0
1771 numfull = 0
1762 numprev = 0
1772 numprev = 0
1763 nump1 = 0
1773 nump1 = 0
1764 nump2 = 0
1774 nump2 = 0
1765 numother = 0
1775 numother = 0
1766 nump1prev = 0
1776 nump1prev = 0
1767 nump2prev = 0
1777 nump2prev = 0
1768 chainlengths = []
1778 chainlengths = []
1769 chainbases = []
1779 chainbases = []
1770 chainspans = []
1780 chainspans = []
1771
1781
1772 datasize = [None, 0, 0]
1782 datasize = [None, 0, 0]
1773 fullsize = [None, 0, 0]
1783 fullsize = [None, 0, 0]
1774 deltasize = [None, 0, 0]
1784 deltasize = [None, 0, 0]
1775 chunktypecounts = {}
1785 chunktypecounts = {}
1776 chunktypesizes = {}
1786 chunktypesizes = {}
1777
1787
1778 def addsize(size, l):
1788 def addsize(size, l):
1779 if l[0] is None or size < l[0]:
1789 if l[0] is None or size < l[0]:
1780 l[0] = size
1790 l[0] = size
1781 if size > l[1]:
1791 if size > l[1]:
1782 l[1] = size
1792 l[1] = size
1783 l[2] += size
1793 l[2] += size
1784
1794
1785 numrevs = len(r)
1795 numrevs = len(r)
1786 for rev in xrange(numrevs):
1796 for rev in xrange(numrevs):
1787 p1, p2 = r.parentrevs(rev)
1797 p1, p2 = r.parentrevs(rev)
1788 delta = r.deltaparent(rev)
1798 delta = r.deltaparent(rev)
1789 if format > 0:
1799 if format > 0:
1790 addsize(r.rawsize(rev), datasize)
1800 addsize(r.rawsize(rev), datasize)
1791 if p2 != nullrev:
1801 if p2 != nullrev:
1792 nummerges += 1
1802 nummerges += 1
1793 size = r.length(rev)
1803 size = r.length(rev)
1794 if delta == nullrev:
1804 if delta == nullrev:
1795 chainlengths.append(0)
1805 chainlengths.append(0)
1796 chainbases.append(r.start(rev))
1806 chainbases.append(r.start(rev))
1797 chainspans.append(size)
1807 chainspans.append(size)
1798 numfull += 1
1808 numfull += 1
1799 addsize(size, fullsize)
1809 addsize(size, fullsize)
1800 else:
1810 else:
1801 chainlengths.append(chainlengths[delta] + 1)
1811 chainlengths.append(chainlengths[delta] + 1)
1802 baseaddr = chainbases[delta]
1812 baseaddr = chainbases[delta]
1803 revaddr = r.start(rev)
1813 revaddr = r.start(rev)
1804 chainbases.append(baseaddr)
1814 chainbases.append(baseaddr)
1805 chainspans.append((revaddr - baseaddr) + size)
1815 chainspans.append((revaddr - baseaddr) + size)
1806 addsize(size, deltasize)
1816 addsize(size, deltasize)
1807 if delta == rev - 1:
1817 if delta == rev - 1:
1808 numprev += 1
1818 numprev += 1
1809 if delta == p1:
1819 if delta == p1:
1810 nump1prev += 1
1820 nump1prev += 1
1811 elif delta == p2:
1821 elif delta == p2:
1812 nump2prev += 1
1822 nump2prev += 1
1813 elif delta == p1:
1823 elif delta == p1:
1814 nump1 += 1
1824 nump1 += 1
1815 elif delta == p2:
1825 elif delta == p2:
1816 nump2 += 1
1826 nump2 += 1
1817 elif delta != nullrev:
1827 elif delta != nullrev:
1818 numother += 1
1828 numother += 1
1819
1829
1820 # Obtain data on the raw chunks in the revlog.
1830 # Obtain data on the raw chunks in the revlog.
1821 segment = r._getsegmentforrevs(rev, rev)[1]
1831 segment = r._getsegmentforrevs(rev, rev)[1]
1822 if segment:
1832 if segment:
1823 chunktype = bytes(segment[0:1])
1833 chunktype = bytes(segment[0:1])
1824 else:
1834 else:
1825 chunktype = 'empty'
1835 chunktype = 'empty'
1826
1836
1827 if chunktype not in chunktypecounts:
1837 if chunktype not in chunktypecounts:
1828 chunktypecounts[chunktype] = 0
1838 chunktypecounts[chunktype] = 0
1829 chunktypesizes[chunktype] = 0
1839 chunktypesizes[chunktype] = 0
1830
1840
1831 chunktypecounts[chunktype] += 1
1841 chunktypecounts[chunktype] += 1
1832 chunktypesizes[chunktype] += size
1842 chunktypesizes[chunktype] += size
1833
1843
1834 # Adjust size min value for empty cases
1844 # Adjust size min value for empty cases
1835 for size in (datasize, fullsize, deltasize):
1845 for size in (datasize, fullsize, deltasize):
1836 if size[0] is None:
1846 if size[0] is None:
1837 size[0] = 0
1847 size[0] = 0
1838
1848
1839 numdeltas = numrevs - numfull
1849 numdeltas = numrevs - numfull
1840 numoprev = numprev - nump1prev - nump2prev
1850 numoprev = numprev - nump1prev - nump2prev
1841 totalrawsize = datasize[2]
1851 totalrawsize = datasize[2]
1842 datasize[2] /= numrevs
1852 datasize[2] /= numrevs
1843 fulltotal = fullsize[2]
1853 fulltotal = fullsize[2]
1844 fullsize[2] /= numfull
1854 fullsize[2] /= numfull
1845 deltatotal = deltasize[2]
1855 deltatotal = deltasize[2]
1846 if numrevs - numfull > 0:
1856 if numrevs - numfull > 0:
1847 deltasize[2] /= numrevs - numfull
1857 deltasize[2] /= numrevs - numfull
1848 totalsize = fulltotal + deltatotal
1858 totalsize = fulltotal + deltatotal
1849 avgchainlen = sum(chainlengths) / numrevs
1859 avgchainlen = sum(chainlengths) / numrevs
1850 maxchainlen = max(chainlengths)
1860 maxchainlen = max(chainlengths)
1851 maxchainspan = max(chainspans)
1861 maxchainspan = max(chainspans)
1852 compratio = 1
1862 compratio = 1
1853 if totalsize:
1863 if totalsize:
1854 compratio = totalrawsize / totalsize
1864 compratio = totalrawsize / totalsize
1855
1865
1856 basedfmtstr = '%%%dd\n'
1866 basedfmtstr = '%%%dd\n'
1857 basepcfmtstr = '%%%dd %s(%%5.2f%%%%)\n'
1867 basepcfmtstr = '%%%dd %s(%%5.2f%%%%)\n'
1858
1868
1859 def dfmtstr(max):
1869 def dfmtstr(max):
1860 return basedfmtstr % len(str(max))
1870 return basedfmtstr % len(str(max))
1861 def pcfmtstr(max, padding=0):
1871 def pcfmtstr(max, padding=0):
1862 return basepcfmtstr % (len(str(max)), ' ' * padding)
1872 return basepcfmtstr % (len(str(max)), ' ' * padding)
1863
1873
1864 def pcfmt(value, total):
1874 def pcfmt(value, total):
1865 if total:
1875 if total:
1866 return (value, 100 * float(value) / total)
1876 return (value, 100 * float(value) / total)
1867 else:
1877 else:
1868 return value, 100.0
1878 return value, 100.0
1869
1879
1870 ui.write(('format : %d\n') % format)
1880 ui.write(('format : %d\n') % format)
1871 ui.write(('flags : %s\n') % ', '.join(flags))
1881 ui.write(('flags : %s\n') % ', '.join(flags))
1872
1882
1873 ui.write('\n')
1883 ui.write('\n')
1874 fmt = pcfmtstr(totalsize)
1884 fmt = pcfmtstr(totalsize)
1875 fmt2 = dfmtstr(totalsize)
1885 fmt2 = dfmtstr(totalsize)
1876 ui.write(('revisions : ') + fmt2 % numrevs)
1886 ui.write(('revisions : ') + fmt2 % numrevs)
1877 ui.write((' merges : ') + fmt % pcfmt(nummerges, numrevs))
1887 ui.write((' merges : ') + fmt % pcfmt(nummerges, numrevs))
1878 ui.write((' normal : ') + fmt % pcfmt(numrevs - nummerges, numrevs))
1888 ui.write((' normal : ') + fmt % pcfmt(numrevs - nummerges, numrevs))
1879 ui.write(('revisions : ') + fmt2 % numrevs)
1889 ui.write(('revisions : ') + fmt2 % numrevs)
1880 ui.write((' full : ') + fmt % pcfmt(numfull, numrevs))
1890 ui.write((' full : ') + fmt % pcfmt(numfull, numrevs))
1881 ui.write((' deltas : ') + fmt % pcfmt(numdeltas, numrevs))
1891 ui.write((' deltas : ') + fmt % pcfmt(numdeltas, numrevs))
1882 ui.write(('revision size : ') + fmt2 % totalsize)
1892 ui.write(('revision size : ') + fmt2 % totalsize)
1883 ui.write((' full : ') + fmt % pcfmt(fulltotal, totalsize))
1893 ui.write((' full : ') + fmt % pcfmt(fulltotal, totalsize))
1884 ui.write((' deltas : ') + fmt % pcfmt(deltatotal, totalsize))
1894 ui.write((' deltas : ') + fmt % pcfmt(deltatotal, totalsize))
1885
1895
1886 def fmtchunktype(chunktype):
1896 def fmtchunktype(chunktype):
1887 if chunktype == 'empty':
1897 if chunktype == 'empty':
1888 return ' %s : ' % chunktype
1898 return ' %s : ' % chunktype
1889 elif chunktype in pycompat.bytestr(string.ascii_letters):
1899 elif chunktype in pycompat.bytestr(string.ascii_letters):
1890 return ' 0x%s (%s) : ' % (hex(chunktype), chunktype)
1900 return ' 0x%s (%s) : ' % (hex(chunktype), chunktype)
1891 else:
1901 else:
1892 return ' 0x%s : ' % hex(chunktype)
1902 return ' 0x%s : ' % hex(chunktype)
1893
1903
1894 ui.write('\n')
1904 ui.write('\n')
1895 ui.write(('chunks : ') + fmt2 % numrevs)
1905 ui.write(('chunks : ') + fmt2 % numrevs)
1896 for chunktype in sorted(chunktypecounts):
1906 for chunktype in sorted(chunktypecounts):
1897 ui.write(fmtchunktype(chunktype))
1907 ui.write(fmtchunktype(chunktype))
1898 ui.write(fmt % pcfmt(chunktypecounts[chunktype], numrevs))
1908 ui.write(fmt % pcfmt(chunktypecounts[chunktype], numrevs))
1899 ui.write(('chunks size : ') + fmt2 % totalsize)
1909 ui.write(('chunks size : ') + fmt2 % totalsize)
1900 for chunktype in sorted(chunktypecounts):
1910 for chunktype in sorted(chunktypecounts):
1901 ui.write(fmtchunktype(chunktype))
1911 ui.write(fmtchunktype(chunktype))
1902 ui.write(fmt % pcfmt(chunktypesizes[chunktype], totalsize))
1912 ui.write(fmt % pcfmt(chunktypesizes[chunktype], totalsize))
1903
1913
1904 ui.write('\n')
1914 ui.write('\n')
1905 fmt = dfmtstr(max(avgchainlen, maxchainlen, maxchainspan, compratio))
1915 fmt = dfmtstr(max(avgchainlen, maxchainlen, maxchainspan, compratio))
1906 ui.write(('avg chain length : ') + fmt % avgchainlen)
1916 ui.write(('avg chain length : ') + fmt % avgchainlen)
1907 ui.write(('max chain length : ') + fmt % maxchainlen)
1917 ui.write(('max chain length : ') + fmt % maxchainlen)
1908 ui.write(('max chain reach : ') + fmt % maxchainspan)
1918 ui.write(('max chain reach : ') + fmt % maxchainspan)
1909 ui.write(('compression ratio : ') + fmt % compratio)
1919 ui.write(('compression ratio : ') + fmt % compratio)
1910
1920
1911 if format > 0:
1921 if format > 0:
1912 ui.write('\n')
1922 ui.write('\n')
1913 ui.write(('uncompressed data size (min/max/avg) : %d / %d / %d\n')
1923 ui.write(('uncompressed data size (min/max/avg) : %d / %d / %d\n')
1914 % tuple(datasize))
1924 % tuple(datasize))
1915 ui.write(('full revision size (min/max/avg) : %d / %d / %d\n')
1925 ui.write(('full revision size (min/max/avg) : %d / %d / %d\n')
1916 % tuple(fullsize))
1926 % tuple(fullsize))
1917 ui.write(('delta size (min/max/avg) : %d / %d / %d\n')
1927 ui.write(('delta size (min/max/avg) : %d / %d / %d\n')
1918 % tuple(deltasize))
1928 % tuple(deltasize))
1919
1929
1920 if numdeltas > 0:
1930 if numdeltas > 0:
1921 ui.write('\n')
1931 ui.write('\n')
1922 fmt = pcfmtstr(numdeltas)
1932 fmt = pcfmtstr(numdeltas)
1923 fmt2 = pcfmtstr(numdeltas, 4)
1933 fmt2 = pcfmtstr(numdeltas, 4)
1924 ui.write(('deltas against prev : ') + fmt % pcfmt(numprev, numdeltas))
1934 ui.write(('deltas against prev : ') + fmt % pcfmt(numprev, numdeltas))
1925 if numprev > 0:
1935 if numprev > 0:
1926 ui.write((' where prev = p1 : ') + fmt2 % pcfmt(nump1prev,
1936 ui.write((' where prev = p1 : ') + fmt2 % pcfmt(nump1prev,
1927 numprev))
1937 numprev))
1928 ui.write((' where prev = p2 : ') + fmt2 % pcfmt(nump2prev,
1938 ui.write((' where prev = p2 : ') + fmt2 % pcfmt(nump2prev,
1929 numprev))
1939 numprev))
1930 ui.write((' other : ') + fmt2 % pcfmt(numoprev,
1940 ui.write((' other : ') + fmt2 % pcfmt(numoprev,
1931 numprev))
1941 numprev))
1932 if gdelta:
1942 if gdelta:
1933 ui.write(('deltas against p1 : ')
1943 ui.write(('deltas against p1 : ')
1934 + fmt % pcfmt(nump1, numdeltas))
1944 + fmt % pcfmt(nump1, numdeltas))
1935 ui.write(('deltas against p2 : ')
1945 ui.write(('deltas against p2 : ')
1936 + fmt % pcfmt(nump2, numdeltas))
1946 + fmt % pcfmt(nump2, numdeltas))
1937 ui.write(('deltas against other : ') + fmt % pcfmt(numother,
1947 ui.write(('deltas against other : ') + fmt % pcfmt(numother,
1938 numdeltas))
1948 numdeltas))
1939
1949
1940 @command('debugrevspec',
1950 @command('debugrevspec',
1941 [('', 'optimize', None,
1951 [('', 'optimize', None,
1942 _('print parsed tree after optimizing (DEPRECATED)')),
1952 _('print parsed tree after optimizing (DEPRECATED)')),
1943 ('', 'show-revs', True, _('print list of result revisions (default)')),
1953 ('', 'show-revs', True, _('print list of result revisions (default)')),
1944 ('s', 'show-set', None, _('print internal representation of result set')),
1954 ('s', 'show-set', None, _('print internal representation of result set')),
1945 ('p', 'show-stage', [],
1955 ('p', 'show-stage', [],
1946 _('print parsed tree at the given stage'), _('NAME')),
1956 _('print parsed tree at the given stage'), _('NAME')),
1947 ('', 'no-optimized', False, _('evaluate tree without optimization')),
1957 ('', 'no-optimized', False, _('evaluate tree without optimization')),
1948 ('', 'verify-optimized', False, _('verify optimized result')),
1958 ('', 'verify-optimized', False, _('verify optimized result')),
1949 ],
1959 ],
1950 ('REVSPEC'))
1960 ('REVSPEC'))
1951 def debugrevspec(ui, repo, expr, **opts):
1961 def debugrevspec(ui, repo, expr, **opts):
1952 """parse and apply a revision specification
1962 """parse and apply a revision specification
1953
1963
1954 Use -p/--show-stage option to print the parsed tree at the given stages.
1964 Use -p/--show-stage option to print the parsed tree at the given stages.
1955 Use -p all to print tree at every stage.
1965 Use -p all to print tree at every stage.
1956
1966
1957 Use --no-show-revs option with -s or -p to print only the set
1967 Use --no-show-revs option with -s or -p to print only the set
1958 representation or the parsed tree respectively.
1968 representation or the parsed tree respectively.
1959
1969
1960 Use --verify-optimized to compare the optimized result with the unoptimized
1970 Use --verify-optimized to compare the optimized result with the unoptimized
1961 one. Returns 1 if the optimized result differs.
1971 one. Returns 1 if the optimized result differs.
1962 """
1972 """
1963 opts = pycompat.byteskwargs(opts)
1973 opts = pycompat.byteskwargs(opts)
1964 aliases = ui.configitems('revsetalias')
1974 aliases = ui.configitems('revsetalias')
1965 stages = [
1975 stages = [
1966 ('parsed', lambda tree: tree),
1976 ('parsed', lambda tree: tree),
1967 ('expanded', lambda tree: revsetlang.expandaliases(tree, aliases,
1977 ('expanded', lambda tree: revsetlang.expandaliases(tree, aliases,
1968 ui.warn)),
1978 ui.warn)),
1969 ('concatenated', revsetlang.foldconcat),
1979 ('concatenated', revsetlang.foldconcat),
1970 ('analyzed', revsetlang.analyze),
1980 ('analyzed', revsetlang.analyze),
1971 ('optimized', revsetlang.optimize),
1981 ('optimized', revsetlang.optimize),
1972 ]
1982 ]
1973 if opts['no_optimized']:
1983 if opts['no_optimized']:
1974 stages = stages[:-1]
1984 stages = stages[:-1]
1975 if opts['verify_optimized'] and opts['no_optimized']:
1985 if opts['verify_optimized'] and opts['no_optimized']:
1976 raise error.Abort(_('cannot use --verify-optimized with '
1986 raise error.Abort(_('cannot use --verify-optimized with '
1977 '--no-optimized'))
1987 '--no-optimized'))
1978 stagenames = set(n for n, f in stages)
1988 stagenames = set(n for n, f in stages)
1979
1989
1980 showalways = set()
1990 showalways = set()
1981 showchanged = set()
1991 showchanged = set()
1982 if ui.verbose and not opts['show_stage']:
1992 if ui.verbose and not opts['show_stage']:
1983 # show parsed tree by --verbose (deprecated)
1993 # show parsed tree by --verbose (deprecated)
1984 showalways.add('parsed')
1994 showalways.add('parsed')
1985 showchanged.update(['expanded', 'concatenated'])
1995 showchanged.update(['expanded', 'concatenated'])
1986 if opts['optimize']:
1996 if opts['optimize']:
1987 showalways.add('optimized')
1997 showalways.add('optimized')
1988 if opts['show_stage'] and opts['optimize']:
1998 if opts['show_stage'] and opts['optimize']:
1989 raise error.Abort(_('cannot use --optimize with --show-stage'))
1999 raise error.Abort(_('cannot use --optimize with --show-stage'))
1990 if opts['show_stage'] == ['all']:
2000 if opts['show_stage'] == ['all']:
1991 showalways.update(stagenames)
2001 showalways.update(stagenames)
1992 else:
2002 else:
1993 for n in opts['show_stage']:
2003 for n in opts['show_stage']:
1994 if n not in stagenames:
2004 if n not in stagenames:
1995 raise error.Abort(_('invalid stage name: %s') % n)
2005 raise error.Abort(_('invalid stage name: %s') % n)
1996 showalways.update(opts['show_stage'])
2006 showalways.update(opts['show_stage'])
1997
2007
1998 treebystage = {}
2008 treebystage = {}
1999 printedtree = None
2009 printedtree = None
2000 tree = revsetlang.parse(expr, lookup=repo.__contains__)
2010 tree = revsetlang.parse(expr, lookup=repo.__contains__)
2001 for n, f in stages:
2011 for n, f in stages:
2002 treebystage[n] = tree = f(tree)
2012 treebystage[n] = tree = f(tree)
2003 if n in showalways or (n in showchanged and tree != printedtree):
2013 if n in showalways or (n in showchanged and tree != printedtree):
2004 if opts['show_stage'] or n != 'parsed':
2014 if opts['show_stage'] or n != 'parsed':
2005 ui.write(("* %s:\n") % n)
2015 ui.write(("* %s:\n") % n)
2006 ui.write(revsetlang.prettyformat(tree), "\n")
2016 ui.write(revsetlang.prettyformat(tree), "\n")
2007 printedtree = tree
2017 printedtree = tree
2008
2018
2009 if opts['verify_optimized']:
2019 if opts['verify_optimized']:
2010 arevs = revset.makematcher(treebystage['analyzed'])(repo)
2020 arevs = revset.makematcher(treebystage['analyzed'])(repo)
2011 brevs = revset.makematcher(treebystage['optimized'])(repo)
2021 brevs = revset.makematcher(treebystage['optimized'])(repo)
2012 if opts['show_set'] or (opts['show_set'] is None and ui.verbose):
2022 if opts['show_set'] or (opts['show_set'] is None and ui.verbose):
2013 ui.write(("* analyzed set:\n"), smartset.prettyformat(arevs), "\n")
2023 ui.write(("* analyzed set:\n"), smartset.prettyformat(arevs), "\n")
2014 ui.write(("* optimized set:\n"), smartset.prettyformat(brevs), "\n")
2024 ui.write(("* optimized set:\n"), smartset.prettyformat(brevs), "\n")
2015 arevs = list(arevs)
2025 arevs = list(arevs)
2016 brevs = list(brevs)
2026 brevs = list(brevs)
2017 if arevs == brevs:
2027 if arevs == brevs:
2018 return 0
2028 return 0
2019 ui.write(('--- analyzed\n'), label='diff.file_a')
2029 ui.write(('--- analyzed\n'), label='diff.file_a')
2020 ui.write(('+++ optimized\n'), label='diff.file_b')
2030 ui.write(('+++ optimized\n'), label='diff.file_b')
2021 sm = difflib.SequenceMatcher(None, arevs, brevs)
2031 sm = difflib.SequenceMatcher(None, arevs, brevs)
2022 for tag, alo, ahi, blo, bhi in sm.get_opcodes():
2032 for tag, alo, ahi, blo, bhi in sm.get_opcodes():
2023 if tag in ('delete', 'replace'):
2033 if tag in ('delete', 'replace'):
2024 for c in arevs[alo:ahi]:
2034 for c in arevs[alo:ahi]:
2025 ui.write('-%s\n' % c, label='diff.deleted')
2035 ui.write('-%s\n' % c, label='diff.deleted')
2026 if tag in ('insert', 'replace'):
2036 if tag in ('insert', 'replace'):
2027 for c in brevs[blo:bhi]:
2037 for c in brevs[blo:bhi]:
2028 ui.write('+%s\n' % c, label='diff.inserted')
2038 ui.write('+%s\n' % c, label='diff.inserted')
2029 if tag == 'equal':
2039 if tag == 'equal':
2030 for c in arevs[alo:ahi]:
2040 for c in arevs[alo:ahi]:
2031 ui.write(' %s\n' % c)
2041 ui.write(' %s\n' % c)
2032 return 1
2042 return 1
2033
2043
2034 func = revset.makematcher(tree)
2044 func = revset.makematcher(tree)
2035 revs = func(repo)
2045 revs = func(repo)
2036 if opts['show_set'] or (opts['show_set'] is None and ui.verbose):
2046 if opts['show_set'] or (opts['show_set'] is None and ui.verbose):
2037 ui.write(("* set:\n"), smartset.prettyformat(revs), "\n")
2047 ui.write(("* set:\n"), smartset.prettyformat(revs), "\n")
2038 if not opts['show_revs']:
2048 if not opts['show_revs']:
2039 return
2049 return
2040 for c in revs:
2050 for c in revs:
2041 ui.write("%s\n" % c)
2051 ui.write("%s\n" % c)
2042
2052
2043 @command('debugsetparents', [], _('REV1 [REV2]'))
2053 @command('debugsetparents', [], _('REV1 [REV2]'))
2044 def debugsetparents(ui, repo, rev1, rev2=None):
2054 def debugsetparents(ui, repo, rev1, rev2=None):
2045 """manually set the parents of the current working directory
2055 """manually set the parents of the current working directory
2046
2056
2047 This is useful for writing repository conversion tools, but should
2057 This is useful for writing repository conversion tools, but should
2048 be used with care. For example, neither the working directory nor the
2058 be used with care. For example, neither the working directory nor the
2049 dirstate is updated, so file status may be incorrect after running this
2059 dirstate is updated, so file status may be incorrect after running this
2050 command.
2060 command.
2051
2061
2052 Returns 0 on success.
2062 Returns 0 on success.
2053 """
2063 """
2054
2064
2055 r1 = scmutil.revsingle(repo, rev1).node()
2065 r1 = scmutil.revsingle(repo, rev1).node()
2056 r2 = scmutil.revsingle(repo, rev2, 'null').node()
2066 r2 = scmutil.revsingle(repo, rev2, 'null').node()
2057
2067
2058 with repo.wlock():
2068 with repo.wlock():
2059 repo.setparents(r1, r2)
2069 repo.setparents(r1, r2)
2060
2070
2061 @command('debugssl', [], '[SOURCE]', optionalrepo=True)
2071 @command('debugssl', [], '[SOURCE]', optionalrepo=True)
2062 def debugssl(ui, repo, source=None, **opts):
2072 def debugssl(ui, repo, source=None, **opts):
2063 '''test a secure connection to a server
2073 '''test a secure connection to a server
2064
2074
2065 This builds the certificate chain for the server on Windows, installing the
2075 This builds the certificate chain for the server on Windows, installing the
2066 missing intermediates and trusted root via Windows Update if necessary. It
2076 missing intermediates and trusted root via Windows Update if necessary. It
2067 does nothing on other platforms.
2077 does nothing on other platforms.
2068
2078
2069 If SOURCE is omitted, the 'default' path will be used. If a URL is given,
2079 If SOURCE is omitted, the 'default' path will be used. If a URL is given,
2070 that server is used. See :hg:`help urls` for more information.
2080 that server is used. See :hg:`help urls` for more information.
2071
2081
2072 If the update succeeds, retry the original operation. Otherwise, the cause
2082 If the update succeeds, retry the original operation. Otherwise, the cause
2073 of the SSL error is likely another issue.
2083 of the SSL error is likely another issue.
2074 '''
2084 '''
2075 if not pycompat.iswindows:
2085 if not pycompat.iswindows:
2076 raise error.Abort(_('certificate chain building is only possible on '
2086 raise error.Abort(_('certificate chain building is only possible on '
2077 'Windows'))
2087 'Windows'))
2078
2088
2079 if not source:
2089 if not source:
2080 if not repo:
2090 if not repo:
2081 raise error.Abort(_("there is no Mercurial repository here, and no "
2091 raise error.Abort(_("there is no Mercurial repository here, and no "
2082 "server specified"))
2092 "server specified"))
2083 source = "default"
2093 source = "default"
2084
2094
2085 source, branches = hg.parseurl(ui.expandpath(source))
2095 source, branches = hg.parseurl(ui.expandpath(source))
2086 url = util.url(source)
2096 url = util.url(source)
2087 addr = None
2097 addr = None
2088
2098
2089 if url.scheme == 'https':
2099 if url.scheme == 'https':
2090 addr = (url.host, url.port or 443)
2100 addr = (url.host, url.port or 443)
2091 elif url.scheme == 'ssh':
2101 elif url.scheme == 'ssh':
2092 addr = (url.host, url.port or 22)
2102 addr = (url.host, url.port or 22)
2093 else:
2103 else:
2094 raise error.Abort(_("only https and ssh connections are supported"))
2104 raise error.Abort(_("only https and ssh connections are supported"))
2095
2105
2096 from . import win32
2106 from . import win32
2097
2107
2098 s = ssl.wrap_socket(socket.socket(), ssl_version=ssl.PROTOCOL_TLS,
2108 s = ssl.wrap_socket(socket.socket(), ssl_version=ssl.PROTOCOL_TLS,
2099 cert_reqs=ssl.CERT_NONE, ca_certs=None)
2109 cert_reqs=ssl.CERT_NONE, ca_certs=None)
2100
2110
2101 try:
2111 try:
2102 s.connect(addr)
2112 s.connect(addr)
2103 cert = s.getpeercert(True)
2113 cert = s.getpeercert(True)
2104
2114
2105 ui.status(_('checking the certificate chain for %s\n') % url.host)
2115 ui.status(_('checking the certificate chain for %s\n') % url.host)
2106
2116
2107 complete = win32.checkcertificatechain(cert, build=False)
2117 complete = win32.checkcertificatechain(cert, build=False)
2108
2118
2109 if not complete:
2119 if not complete:
2110 ui.status(_('certificate chain is incomplete, updating... '))
2120 ui.status(_('certificate chain is incomplete, updating... '))
2111
2121
2112 if not win32.checkcertificatechain(cert):
2122 if not win32.checkcertificatechain(cert):
2113 ui.status(_('failed.\n'))
2123 ui.status(_('failed.\n'))
2114 else:
2124 else:
2115 ui.status(_('done.\n'))
2125 ui.status(_('done.\n'))
2116 else:
2126 else:
2117 ui.status(_('full certificate chain is available\n'))
2127 ui.status(_('full certificate chain is available\n'))
2118 finally:
2128 finally:
2119 s.close()
2129 s.close()
2120
2130
2121 @command('debugsub',
2131 @command('debugsub',
2122 [('r', 'rev', '',
2132 [('r', 'rev', '',
2123 _('revision to check'), _('REV'))],
2133 _('revision to check'), _('REV'))],
2124 _('[-r REV] [REV]'))
2134 _('[-r REV] [REV]'))
2125 def debugsub(ui, repo, rev=None):
2135 def debugsub(ui, repo, rev=None):
2126 ctx = scmutil.revsingle(repo, rev, None)
2136 ctx = scmutil.revsingle(repo, rev, None)
2127 for k, v in sorted(ctx.substate.items()):
2137 for k, v in sorted(ctx.substate.items()):
2128 ui.write(('path %s\n') % k)
2138 ui.write(('path %s\n') % k)
2129 ui.write((' source %s\n') % v[0])
2139 ui.write((' source %s\n') % v[0])
2130 ui.write((' revision %s\n') % v[1])
2140 ui.write((' revision %s\n') % v[1])
2131
2141
2132 @command('debugsuccessorssets',
2142 @command('debugsuccessorssets',
2133 [('', 'closest', False, _('return closest successors sets only'))],
2143 [('', 'closest', False, _('return closest successors sets only'))],
2134 _('[REV]'))
2144 _('[REV]'))
2135 def debugsuccessorssets(ui, repo, *revs, **opts):
2145 def debugsuccessorssets(ui, repo, *revs, **opts):
2136 """show set of successors for revision
2146 """show set of successors for revision
2137
2147
2138 A successors set of changeset A is a consistent group of revisions that
2148 A successors set of changeset A is a consistent group of revisions that
2139 succeed A. It contains non-obsolete changesets only unless closests
2149 succeed A. It contains non-obsolete changesets only unless closests
2140 successors set is set.
2150 successors set is set.
2141
2151
2142 In most cases a changeset A has a single successors set containing a single
2152 In most cases a changeset A has a single successors set containing a single
2143 successor (changeset A replaced by A').
2153 successor (changeset A replaced by A').
2144
2154
2145 A changeset that is made obsolete with no successors are called "pruned".
2155 A changeset that is made obsolete with no successors are called "pruned".
2146 Such changesets have no successors sets at all.
2156 Such changesets have no successors sets at all.
2147
2157
2148 A changeset that has been "split" will have a successors set containing
2158 A changeset that has been "split" will have a successors set containing
2149 more than one successor.
2159 more than one successor.
2150
2160
2151 A changeset that has been rewritten in multiple different ways is called
2161 A changeset that has been rewritten in multiple different ways is called
2152 "divergent". Such changesets have multiple successor sets (each of which
2162 "divergent". Such changesets have multiple successor sets (each of which
2153 may also be split, i.e. have multiple successors).
2163 may also be split, i.e. have multiple successors).
2154
2164
2155 Results are displayed as follows::
2165 Results are displayed as follows::
2156
2166
2157 <rev1>
2167 <rev1>
2158 <successors-1A>
2168 <successors-1A>
2159 <rev2>
2169 <rev2>
2160 <successors-2A>
2170 <successors-2A>
2161 <successors-2B1> <successors-2B2> <successors-2B3>
2171 <successors-2B1> <successors-2B2> <successors-2B3>
2162
2172
2163 Here rev2 has two possible (i.e. divergent) successors sets. The first
2173 Here rev2 has two possible (i.e. divergent) successors sets. The first
2164 holds one element, whereas the second holds three (i.e. the changeset has
2174 holds one element, whereas the second holds three (i.e. the changeset has
2165 been split).
2175 been split).
2166 """
2176 """
2167 # passed to successorssets caching computation from one call to another
2177 # passed to successorssets caching computation from one call to another
2168 cache = {}
2178 cache = {}
2169 ctx2str = str
2179 ctx2str = str
2170 node2str = short
2180 node2str = short
2171 if ui.debug():
2181 if ui.debug():
2172 def ctx2str(ctx):
2182 def ctx2str(ctx):
2173 return ctx.hex()
2183 return ctx.hex()
2174 node2str = hex
2184 node2str = hex
2175 for rev in scmutil.revrange(repo, revs):
2185 for rev in scmutil.revrange(repo, revs):
2176 ctx = repo[rev]
2186 ctx = repo[rev]
2177 ui.write('%s\n'% ctx2str(ctx))
2187 ui.write('%s\n'% ctx2str(ctx))
2178 for succsset in obsutil.successorssets(repo, ctx.node(),
2188 for succsset in obsutil.successorssets(repo, ctx.node(),
2179 closest=opts['closest'],
2189 closest=opts['closest'],
2180 cache=cache):
2190 cache=cache):
2181 if succsset:
2191 if succsset:
2182 ui.write(' ')
2192 ui.write(' ')
2183 ui.write(node2str(succsset[0]))
2193 ui.write(node2str(succsset[0]))
2184 for node in succsset[1:]:
2194 for node in succsset[1:]:
2185 ui.write(' ')
2195 ui.write(' ')
2186 ui.write(node2str(node))
2196 ui.write(node2str(node))
2187 ui.write('\n')
2197 ui.write('\n')
2188
2198
2189 @command('debugtemplate',
2199 @command('debugtemplate',
2190 [('r', 'rev', [], _('apply template on changesets'), _('REV')),
2200 [('r', 'rev', [], _('apply template on changesets'), _('REV')),
2191 ('D', 'define', [], _('define template keyword'), _('KEY=VALUE'))],
2201 ('D', 'define', [], _('define template keyword'), _('KEY=VALUE'))],
2192 _('[-r REV]... [-D KEY=VALUE]... TEMPLATE'),
2202 _('[-r REV]... [-D KEY=VALUE]... TEMPLATE'),
2193 optionalrepo=True)
2203 optionalrepo=True)
2194 def debugtemplate(ui, repo, tmpl, **opts):
2204 def debugtemplate(ui, repo, tmpl, **opts):
2195 """parse and apply a template
2205 """parse and apply a template
2196
2206
2197 If -r/--rev is given, the template is processed as a log template and
2207 If -r/--rev is given, the template is processed as a log template and
2198 applied to the given changesets. Otherwise, it is processed as a generic
2208 applied to the given changesets. Otherwise, it is processed as a generic
2199 template.
2209 template.
2200
2210
2201 Use --verbose to print the parsed tree.
2211 Use --verbose to print the parsed tree.
2202 """
2212 """
2203 revs = None
2213 revs = None
2204 if opts[r'rev']:
2214 if opts[r'rev']:
2205 if repo is None:
2215 if repo is None:
2206 raise error.RepoError(_('there is no Mercurial repository here '
2216 raise error.RepoError(_('there is no Mercurial repository here '
2207 '(.hg not found)'))
2217 '(.hg not found)'))
2208 revs = scmutil.revrange(repo, opts[r'rev'])
2218 revs = scmutil.revrange(repo, opts[r'rev'])
2209
2219
2210 props = {}
2220 props = {}
2211 for d in opts[r'define']:
2221 for d in opts[r'define']:
2212 try:
2222 try:
2213 k, v = (e.strip() for e in d.split('=', 1))
2223 k, v = (e.strip() for e in d.split('=', 1))
2214 if not k or k == 'ui':
2224 if not k or k == 'ui':
2215 raise ValueError
2225 raise ValueError
2216 props[k] = v
2226 props[k] = v
2217 except ValueError:
2227 except ValueError:
2218 raise error.Abort(_('malformed keyword definition: %s') % d)
2228 raise error.Abort(_('malformed keyword definition: %s') % d)
2219
2229
2220 if ui.verbose:
2230 if ui.verbose:
2221 aliases = ui.configitems('templatealias')
2231 aliases = ui.configitems('templatealias')
2222 tree = templater.parse(tmpl)
2232 tree = templater.parse(tmpl)
2223 ui.note(templater.prettyformat(tree), '\n')
2233 ui.note(templater.prettyformat(tree), '\n')
2224 newtree = templater.expandaliases(tree, aliases)
2234 newtree = templater.expandaliases(tree, aliases)
2225 if newtree != tree:
2235 if newtree != tree:
2226 ui.note(("* expanded:\n"), templater.prettyformat(newtree), '\n')
2236 ui.note(("* expanded:\n"), templater.prettyformat(newtree), '\n')
2227
2237
2228 if revs is None:
2238 if revs is None:
2229 t = formatter.maketemplater(ui, tmpl)
2239 t = formatter.maketemplater(ui, tmpl)
2230 props['ui'] = ui
2240 props['ui'] = ui
2231 ui.write(t.render(props))
2241 ui.write(t.render(props))
2232 else:
2242 else:
2233 displayer = cmdutil.makelogtemplater(ui, repo, tmpl)
2243 displayer = cmdutil.makelogtemplater(ui, repo, tmpl)
2234 for r in revs:
2244 for r in revs:
2235 displayer.show(repo[r], **pycompat.strkwargs(props))
2245 displayer.show(repo[r], **pycompat.strkwargs(props))
2236 displayer.close()
2246 displayer.close()
2237
2247
2238 @command('debugupdatecaches', [])
2248 @command('debugupdatecaches', [])
2239 def debugupdatecaches(ui, repo, *pats, **opts):
2249 def debugupdatecaches(ui, repo, *pats, **opts):
2240 """warm all known caches in the repository"""
2250 """warm all known caches in the repository"""
2241 with repo.wlock(), repo.lock():
2251 with repo.wlock(), repo.lock():
2242 repo.updatecaches()
2252 repo.updatecaches()
2243
2253
2244 @command('debugupgraderepo', [
2254 @command('debugupgraderepo', [
2245 ('o', 'optimize', [], _('extra optimization to perform'), _('NAME')),
2255 ('o', 'optimize', [], _('extra optimization to perform'), _('NAME')),
2246 ('', 'run', False, _('performs an upgrade')),
2256 ('', 'run', False, _('performs an upgrade')),
2247 ])
2257 ])
2248 def debugupgraderepo(ui, repo, run=False, optimize=None):
2258 def debugupgraderepo(ui, repo, run=False, optimize=None):
2249 """upgrade a repository to use different features
2259 """upgrade a repository to use different features
2250
2260
2251 If no arguments are specified, the repository is evaluated for upgrade
2261 If no arguments are specified, the repository is evaluated for upgrade
2252 and a list of problems and potential optimizations is printed.
2262 and a list of problems and potential optimizations is printed.
2253
2263
2254 With ``--run``, a repository upgrade is performed. Behavior of the upgrade
2264 With ``--run``, a repository upgrade is performed. Behavior of the upgrade
2255 can be influenced via additional arguments. More details will be provided
2265 can be influenced via additional arguments. More details will be provided
2256 by the command output when run without ``--run``.
2266 by the command output when run without ``--run``.
2257
2267
2258 During the upgrade, the repository will be locked and no writes will be
2268 During the upgrade, the repository will be locked and no writes will be
2259 allowed.
2269 allowed.
2260
2270
2261 At the end of the upgrade, the repository may not be readable while new
2271 At the end of the upgrade, the repository may not be readable while new
2262 repository data is swapped in. This window will be as long as it takes to
2272 repository data is swapped in. This window will be as long as it takes to
2263 rename some directories inside the ``.hg`` directory. On most machines, this
2273 rename some directories inside the ``.hg`` directory. On most machines, this
2264 should complete almost instantaneously and the chances of a consumer being
2274 should complete almost instantaneously and the chances of a consumer being
2265 unable to access the repository should be low.
2275 unable to access the repository should be low.
2266 """
2276 """
2267 return upgrade.upgraderepo(ui, repo, run=run, optimize=optimize)
2277 return upgrade.upgraderepo(ui, repo, run=run, optimize=optimize)
2268
2278
2269 @command('debugwalk', cmdutil.walkopts, _('[OPTION]... [FILE]...'),
2279 @command('debugwalk', cmdutil.walkopts, _('[OPTION]... [FILE]...'),
2270 inferrepo=True)
2280 inferrepo=True)
2271 def debugwalk(ui, repo, *pats, **opts):
2281 def debugwalk(ui, repo, *pats, **opts):
2272 """show how files match on given patterns"""
2282 """show how files match on given patterns"""
2273 opts = pycompat.byteskwargs(opts)
2283 opts = pycompat.byteskwargs(opts)
2274 m = scmutil.match(repo[None], pats, opts)
2284 m = scmutil.match(repo[None], pats, opts)
2275 ui.write(('matcher: %r\n' % m))
2285 ui.write(('matcher: %r\n' % m))
2276 items = list(repo[None].walk(m))
2286 items = list(repo[None].walk(m))
2277 if not items:
2287 if not items:
2278 return
2288 return
2279 f = lambda fn: fn
2289 f = lambda fn: fn
2280 if ui.configbool('ui', 'slash') and pycompat.ossep != '/':
2290 if ui.configbool('ui', 'slash') and pycompat.ossep != '/':
2281 f = lambda fn: util.normpath(fn)
2291 f = lambda fn: util.normpath(fn)
2282 fmt = 'f %%-%ds %%-%ds %%s' % (
2292 fmt = 'f %%-%ds %%-%ds %%s' % (
2283 max([len(abs) for abs in items]),
2293 max([len(abs) for abs in items]),
2284 max([len(m.rel(abs)) for abs in items]))
2294 max([len(m.rel(abs)) for abs in items]))
2285 for abs in items:
2295 for abs in items:
2286 line = fmt % (abs, f(m.rel(abs)), m.exact(abs) and 'exact' or '')
2296 line = fmt % (abs, f(m.rel(abs)), m.exact(abs) and 'exact' or '')
2287 ui.write("%s\n" % line.rstrip())
2297 ui.write("%s\n" % line.rstrip())
2288
2298
2289 @command('debugwireargs',
2299 @command('debugwireargs',
2290 [('', 'three', '', 'three'),
2300 [('', 'three', '', 'three'),
2291 ('', 'four', '', 'four'),
2301 ('', 'four', '', 'four'),
2292 ('', 'five', '', 'five'),
2302 ('', 'five', '', 'five'),
2293 ] + cmdutil.remoteopts,
2303 ] + cmdutil.remoteopts,
2294 _('REPO [OPTIONS]... [ONE [TWO]]'),
2304 _('REPO [OPTIONS]... [ONE [TWO]]'),
2295 norepo=True)
2305 norepo=True)
2296 def debugwireargs(ui, repopath, *vals, **opts):
2306 def debugwireargs(ui, repopath, *vals, **opts):
2297 opts = pycompat.byteskwargs(opts)
2307 opts = pycompat.byteskwargs(opts)
2298 repo = hg.peer(ui, opts, repopath)
2308 repo = hg.peer(ui, opts, repopath)
2299 for opt in cmdutil.remoteopts:
2309 for opt in cmdutil.remoteopts:
2300 del opts[opt[1]]
2310 del opts[opt[1]]
2301 args = {}
2311 args = {}
2302 for k, v in opts.iteritems():
2312 for k, v in opts.iteritems():
2303 if v:
2313 if v:
2304 args[k] = v
2314 args[k] = v
2305 # run twice to check that we don't mess up the stream for the next command
2315 # run twice to check that we don't mess up the stream for the next command
2306 res1 = repo.debugwireargs(*vals, **args)
2316 res1 = repo.debugwireargs(*vals, **args)
2307 res2 = repo.debugwireargs(*vals, **args)
2317 res2 = repo.debugwireargs(*vals, **args)
2308 ui.write("%s\n" % res1)
2318 ui.write("%s\n" % res1)
2309 if res1 != res2:
2319 if res1 != res2:
2310 ui.warn("%s\n" % res2)
2320 ui.warn("%s\n" % res2)
@@ -1,383 +1,385 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 debugcheckstate
76 debugcheckstate
76 debugcolor
77 debugcolor
77 debugcommands
78 debugcommands
78 debugcomplete
79 debugcomplete
79 debugconfig
80 debugconfig
80 debugcreatestreamclonebundle
81 debugcreatestreamclonebundle
81 debugdag
82 debugdag
82 debugdata
83 debugdata
83 debugdate
84 debugdate
84 debugdeltachain
85 debugdeltachain
85 debugdirstate
86 debugdirstate
86 debugdiscovery
87 debugdiscovery
87 debugextensions
88 debugextensions
88 debugfileset
89 debugfileset
89 debugfsinfo
90 debugfsinfo
90 debuggetbundle
91 debuggetbundle
91 debugignore
92 debugignore
92 debugindex
93 debugindex
93 debugindexdot
94 debugindexdot
94 debuginstall
95 debuginstall
95 debugknown
96 debugknown
96 debuglabelcomplete
97 debuglabelcomplete
97 debuglocks
98 debuglocks
98 debugmergestate
99 debugmergestate
99 debugnamecomplete
100 debugnamecomplete
100 debugobsolete
101 debugobsolete
101 debugpathcomplete
102 debugpathcomplete
102 debugpickmergetool
103 debugpickmergetool
103 debugpushkey
104 debugpushkey
104 debugpvec
105 debugpvec
105 debugrebuilddirstate
106 debugrebuilddirstate
106 debugrebuildfncache
107 debugrebuildfncache
107 debugrename
108 debugrename
108 debugrevlog
109 debugrevlog
109 debugrevspec
110 debugrevspec
110 debugsetparents
111 debugsetparents
111 debugssl
112 debugssl
112 debugsub
113 debugsub
113 debugsuccessorssets
114 debugsuccessorssets
114 debugtemplate
115 debugtemplate
115 debugupdatecaches
116 debugupdatecaches
116 debugupgraderepo
117 debugupgraderepo
117 debugwalk
118 debugwalk
118 debugwireargs
119 debugwireargs
119
120
120 Do not show the alias of a debug command if there are other candidates
121 Do not show the alias of a debug command if there are other candidates
121 (this should hide rawcommit)
122 (this should hide rawcommit)
122 $ hg debugcomplete r
123 $ hg debugcomplete r
123 recover
124 recover
124 remove
125 remove
125 rename
126 rename
126 resolve
127 resolve
127 revert
128 revert
128 rollback
129 rollback
129 root
130 root
130 Show the alias of a debug command if there are no other candidates
131 Show the alias of a debug command if there are no other candidates
131 $ hg debugcomplete rawc
132 $ hg debugcomplete rawc
132
133
133
134
134 Show the global options
135 Show the global options
135 $ hg debugcomplete --options | sort
136 $ hg debugcomplete --options | sort
136 --color
137 --color
137 --config
138 --config
138 --cwd
139 --cwd
139 --debug
140 --debug
140 --debugger
141 --debugger
141 --encoding
142 --encoding
142 --encodingmode
143 --encodingmode
143 --help
144 --help
144 --hidden
145 --hidden
145 --noninteractive
146 --noninteractive
146 --pager
147 --pager
147 --profile
148 --profile
148 --quiet
149 --quiet
149 --repository
150 --repository
150 --time
151 --time
151 --traceback
152 --traceback
152 --verbose
153 --verbose
153 --version
154 --version
154 -R
155 -R
155 -h
156 -h
156 -q
157 -q
157 -v
158 -v
158 -y
159 -y
159
160
160 Show the options for the "serve" command
161 Show the options for the "serve" command
161 $ hg debugcomplete --options serve | sort
162 $ hg debugcomplete --options serve | sort
162 --accesslog
163 --accesslog
163 --address
164 --address
164 --certificate
165 --certificate
165 --cmdserver
166 --cmdserver
166 --color
167 --color
167 --config
168 --config
168 --cwd
169 --cwd
169 --daemon
170 --daemon
170 --daemon-postexec
171 --daemon-postexec
171 --debug
172 --debug
172 --debugger
173 --debugger
173 --encoding
174 --encoding
174 --encodingmode
175 --encodingmode
175 --errorlog
176 --errorlog
176 --help
177 --help
177 --hidden
178 --hidden
178 --ipv6
179 --ipv6
179 --name
180 --name
180 --noninteractive
181 --noninteractive
181 --pager
182 --pager
182 --pid-file
183 --pid-file
183 --port
184 --port
184 --prefix
185 --prefix
185 --profile
186 --profile
186 --quiet
187 --quiet
187 --repository
188 --repository
188 --stdio
189 --stdio
189 --style
190 --style
190 --subrepos
191 --subrepos
191 --templates
192 --templates
192 --time
193 --time
193 --traceback
194 --traceback
194 --verbose
195 --verbose
195 --version
196 --version
196 --web-conf
197 --web-conf
197 -6
198 -6
198 -A
199 -A
199 -E
200 -E
200 -R
201 -R
201 -S
202 -S
202 -a
203 -a
203 -d
204 -d
204 -h
205 -h
205 -n
206 -n
206 -p
207 -p
207 -q
208 -q
208 -t
209 -t
209 -v
210 -v
210 -y
211 -y
211
212
212 Show an error if we use --options with an ambiguous abbreviation
213 Show an error if we use --options with an ambiguous abbreviation
213 $ hg debugcomplete --options s
214 $ hg debugcomplete --options s
214 hg: command 's' is ambiguous:
215 hg: command 's' is ambiguous:
215 serve showconfig status summary
216 serve showconfig status summary
216 [255]
217 [255]
217
218
218 Show all commands + options
219 Show all commands + options
219 $ hg debugcommands
220 $ hg debugcommands
220 add: include, exclude, subrepos, dry-run
221 add: include, exclude, subrepos, dry-run
221 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
222 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
222 clone: noupdate, updaterev, rev, branch, pull, uncompressed, stream, ssh, remotecmd, insecure
223 clone: noupdate, updaterev, rev, branch, pull, uncompressed, stream, ssh, remotecmd, insecure
223 commit: addremove, close-branch, amend, secret, edit, interactive, include, exclude, message, logfile, date, user, subrepos
224 commit: addremove, close-branch, amend, secret, edit, interactive, include, exclude, message, logfile, date, user, subrepos
224 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
225 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
225 export: output, switch-parent, rev, text, git, binary, nodates
226 export: output, switch-parent, rev, text, git, binary, nodates
226 forget: include, exclude
227 forget: include, exclude
227 init: ssh, remotecmd, insecure
228 init: ssh, remotecmd, insecure
228 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
229 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
229 merge: force, rev, preview, tool
230 merge: force, rev, preview, tool
230 pull: update, force, rev, bookmark, branch, ssh, remotecmd, insecure
231 pull: update, force, rev, bookmark, branch, ssh, remotecmd, insecure
231 push: force, rev, bookmark, branch, new-branch, pushvars, ssh, remotecmd, insecure
232 push: force, rev, bookmark, branch, new-branch, pushvars, ssh, remotecmd, insecure
232 remove: after, force, subrepos, include, exclude
233 remove: after, force, subrepos, include, exclude
233 serve: accesslog, daemon, daemon-postexec, errorlog, port, address, prefix, name, web-conf, webdir-conf, pid-file, stdio, cmdserver, templates, style, ipv6, certificate, subrepos
234 serve: accesslog, daemon, daemon-postexec, errorlog, port, address, prefix, name, web-conf, webdir-conf, pid-file, stdio, cmdserver, templates, style, ipv6, certificate, subrepos
234 status: all, modified, added, removed, deleted, clean, unknown, ignored, no-status, terse, copies, print0, rev, change, include, exclude, subrepos, template
235 status: all, modified, added, removed, deleted, clean, unknown, ignored, no-status, terse, copies, print0, rev, change, include, exclude, subrepos, template
235 summary: remote
236 summary: remote
236 update: clean, check, merge, date, rev, tool
237 update: clean, check, merge, date, rev, tool
237 addremove: similarity, subrepos, include, exclude, dry-run
238 addremove: similarity, subrepos, include, exclude, dry-run
238 archive: no-decode, prefix, rev, type, subrepos, include, exclude
239 archive: no-decode, prefix, rev, type, subrepos, include, exclude
239 backout: merge, commit, no-commit, parent, rev, edit, tool, include, exclude, message, logfile, date, user
240 backout: merge, commit, no-commit, parent, rev, edit, tool, include, exclude, message, logfile, date, user
240 bisect: reset, good, bad, skip, extend, command, noupdate
241 bisect: reset, good, bad, skip, extend, command, noupdate
241 bookmarks: force, rev, delete, rename, inactive, template
242 bookmarks: force, rev, delete, rename, inactive, template
242 branch: force, clean
243 branch: force, clean
243 branches: active, closed, template
244 branches: active, closed, template
244 bundle: force, rev, branch, base, all, type, ssh, remotecmd, insecure
245 bundle: force, rev, branch, base, all, type, ssh, remotecmd, insecure
245 cat: output, rev, decode, include, exclude, template
246 cat: output, rev, decode, include, exclude, template
246 config: untrusted, edit, local, global, template
247 config: untrusted, edit, local, global, template
247 copy: after, force, include, exclude, dry-run
248 copy: after, force, include, exclude, dry-run
248 debugancestor:
249 debugancestor:
249 debugapplystreamclonebundle:
250 debugapplystreamclonebundle:
250 debugbuilddag: mergeable-file, overwritten-file, new-file
251 debugbuilddag: mergeable-file, overwritten-file, new-file
251 debugbundle: all, part-type, spec
252 debugbundle: all, part-type, spec
253 debugcapabilities:
252 debugcheckstate:
254 debugcheckstate:
253 debugcolor: style
255 debugcolor: style
254 debugcommands:
256 debugcommands:
255 debugcomplete: options
257 debugcomplete: options
256 debugcreatestreamclonebundle:
258 debugcreatestreamclonebundle:
257 debugdag: tags, branches, dots, spaces
259 debugdag: tags, branches, dots, spaces
258 debugdata: changelog, manifest, dir
260 debugdata: changelog, manifest, dir
259 debugdate: extended
261 debugdate: extended
260 debugdeltachain: changelog, manifest, dir, template
262 debugdeltachain: changelog, manifest, dir, template
261 debugdirstate: nodates, datesort
263 debugdirstate: nodates, datesort
262 debugdiscovery: old, nonheads, ssh, remotecmd, insecure
264 debugdiscovery: old, nonheads, ssh, remotecmd, insecure
263 debugextensions: template
265 debugextensions: template
264 debugfileset: rev
266 debugfileset: rev
265 debugfsinfo:
267 debugfsinfo:
266 debuggetbundle: head, common, type
268 debuggetbundle: head, common, type
267 debugignore:
269 debugignore:
268 debugindex: changelog, manifest, dir, format
270 debugindex: changelog, manifest, dir, format
269 debugindexdot: changelog, manifest, dir
271 debugindexdot: changelog, manifest, dir
270 debuginstall: template
272 debuginstall: template
271 debugknown:
273 debugknown:
272 debuglabelcomplete:
274 debuglabelcomplete:
273 debuglocks: force-lock, force-wlock
275 debuglocks: force-lock, force-wlock
274 debugmergestate:
276 debugmergestate:
275 debugnamecomplete:
277 debugnamecomplete:
276 debugobsolete: flags, record-parents, rev, exclusive, index, delete, date, user, template
278 debugobsolete: flags, record-parents, rev, exclusive, index, delete, date, user, template
277 debugpathcomplete: full, normal, added, removed
279 debugpathcomplete: full, normal, added, removed
278 debugpickmergetool: rev, changedelete, include, exclude, tool
280 debugpickmergetool: rev, changedelete, include, exclude, tool
279 debugpushkey:
281 debugpushkey:
280 debugpvec:
282 debugpvec:
281 debugrebuilddirstate: rev, minimal
283 debugrebuilddirstate: rev, minimal
282 debugrebuildfncache:
284 debugrebuildfncache:
283 debugrename: rev
285 debugrename: rev
284 debugrevlog: changelog, manifest, dir, dump
286 debugrevlog: changelog, manifest, dir, dump
285 debugrevspec: optimize, show-revs, show-set, show-stage, no-optimized, verify-optimized
287 debugrevspec: optimize, show-revs, show-set, show-stage, no-optimized, verify-optimized
286 debugsetparents:
288 debugsetparents:
287 debugssl:
289 debugssl:
288 debugsub: rev
290 debugsub: rev
289 debugsuccessorssets: closest
291 debugsuccessorssets: closest
290 debugtemplate: rev, define
292 debugtemplate: rev, define
291 debugupdatecaches:
293 debugupdatecaches:
292 debugupgraderepo: optimize, run
294 debugupgraderepo: optimize, run
293 debugwalk: include, exclude
295 debugwalk: include, exclude
294 debugwireargs: three, four, five, ssh, remotecmd, insecure
296 debugwireargs: three, four, five, ssh, remotecmd, insecure
295 files: rev, print0, include, exclude, template, subrepos
297 files: rev, print0, include, exclude, template, subrepos
296 graft: rev, continue, edit, log, force, currentdate, currentuser, date, user, tool, dry-run
298 graft: rev, continue, edit, log, force, currentdate, currentuser, date, user, tool, dry-run
297 grep: print0, all, text, follow, ignore-case, files-with-matches, line-number, rev, user, date, template, include, exclude
299 grep: print0, all, text, follow, ignore-case, files-with-matches, line-number, rev, user, date, template, include, exclude
298 heads: rev, topo, active, closed, style, template
300 heads: rev, topo, active, closed, style, template
299 help: extension, command, keyword, system
301 help: extension, command, keyword, system
300 identify: rev, num, id, branch, tags, bookmarks, ssh, remotecmd, insecure, template
302 identify: rev, num, id, branch, tags, bookmarks, ssh, remotecmd, insecure, template
301 import: strip, base, edit, force, no-commit, bypass, partial, exact, prefix, import-branch, message, logfile, date, user, similarity
303 import: strip, base, edit, force, no-commit, bypass, partial, exact, prefix, import-branch, message, logfile, date, user, similarity
302 incoming: force, newest-first, bundle, rev, bookmarks, branch, patch, git, limit, no-merges, stat, graph, style, template, ssh, remotecmd, insecure, subrepos
304 incoming: force, newest-first, bundle, rev, bookmarks, branch, patch, git, limit, no-merges, stat, graph, style, template, ssh, remotecmd, insecure, subrepos
303 locate: rev, print0, fullpath, include, exclude
305 locate: rev, print0, fullpath, include, exclude
304 manifest: rev, all, template
306 manifest: rev, all, template
305 outgoing: force, rev, newest-first, bookmarks, branch, patch, git, limit, no-merges, stat, graph, style, template, ssh, remotecmd, insecure, subrepos
307 outgoing: force, rev, newest-first, bookmarks, branch, patch, git, limit, no-merges, stat, graph, style, template, ssh, remotecmd, insecure, subrepos
306 parents: rev, style, template
308 parents: rev, style, template
307 paths: template
309 paths: template
308 phase: public, draft, secret, force, rev
310 phase: public, draft, secret, force, rev
309 recover:
311 recover:
310 rename: after, force, include, exclude, dry-run
312 rename: after, force, include, exclude, dry-run
311 resolve: all, list, mark, unmark, no-status, tool, include, exclude, template
313 resolve: all, list, mark, unmark, no-status, tool, include, exclude, template
312 revert: all, date, rev, no-backup, interactive, include, exclude, dry-run
314 revert: all, date, rev, no-backup, interactive, include, exclude, dry-run
313 rollback: dry-run, force
315 rollback: dry-run, force
314 root:
316 root:
315 tag: force, local, rev, remove, edit, message, date, user
317 tag: force, local, rev, remove, edit, message, date, user
316 tags: template
318 tags: template
317 tip: patch, git, style, template
319 tip: patch, git, style, template
318 unbundle: update
320 unbundle: update
319 verify:
321 verify:
320 version: template
322 version: template
321
323
322 $ hg init a
324 $ hg init a
323 $ cd a
325 $ cd a
324 $ echo fee > fee
326 $ echo fee > fee
325 $ hg ci -q -Amfee
327 $ hg ci -q -Amfee
326 $ hg tag fee
328 $ hg tag fee
327 $ mkdir fie
329 $ mkdir fie
328 $ echo dead > fie/dead
330 $ echo dead > fie/dead
329 $ echo live > fie/live
331 $ echo live > fie/live
330 $ hg bookmark fo
332 $ hg bookmark fo
331 $ hg branch -q fie
333 $ hg branch -q fie
332 $ hg ci -q -Amfie
334 $ hg ci -q -Amfie
333 $ echo fo > fo
335 $ echo fo > fo
334 $ hg branch -qf default
336 $ hg branch -qf default
335 $ hg ci -q -Amfo
337 $ hg ci -q -Amfo
336 $ echo Fum > Fum
338 $ echo Fum > Fum
337 $ hg ci -q -AmFum
339 $ hg ci -q -AmFum
338 $ hg bookmark Fum
340 $ hg bookmark Fum
339
341
340 Test debugpathcomplete
342 Test debugpathcomplete
341
343
342 $ hg debugpathcomplete f
344 $ hg debugpathcomplete f
343 fee
345 fee
344 fie
346 fie
345 fo
347 fo
346 $ hg debugpathcomplete -f f
348 $ hg debugpathcomplete -f f
347 fee
349 fee
348 fie/dead
350 fie/dead
349 fie/live
351 fie/live
350 fo
352 fo
351
353
352 $ hg rm Fum
354 $ hg rm Fum
353 $ hg debugpathcomplete -r F
355 $ hg debugpathcomplete -r F
354 Fum
356 Fum
355
357
356 Test debugnamecomplete
358 Test debugnamecomplete
357
359
358 $ hg debugnamecomplete
360 $ hg debugnamecomplete
359 Fum
361 Fum
360 default
362 default
361 fee
363 fee
362 fie
364 fie
363 fo
365 fo
364 tip
366 tip
365 $ hg debugnamecomplete f
367 $ hg debugnamecomplete f
366 fee
368 fee
367 fie
369 fie
368 fo
370 fo
369
371
370 Test debuglabelcomplete, a deprecated name for debugnamecomplete that is still
372 Test debuglabelcomplete, a deprecated name for debugnamecomplete that is still
371 used for completions in some shells.
373 used for completions in some shells.
372
374
373 $ hg debuglabelcomplete
375 $ hg debuglabelcomplete
374 Fum
376 Fum
375 default
377 default
376 fee
378 fee
377 fie
379 fie
378 fo
380 fo
379 tip
381 tip
380 $ hg debuglabelcomplete f
382 $ hg debuglabelcomplete f
381 fee
383 fee
382 fie
384 fie
383 fo
385 fo
@@ -1,158 +1,170 b''
1 $ cat << EOF >> $HGRCPATH
1 $ cat << EOF >> $HGRCPATH
2 > [format]
2 > [format]
3 > usegeneraldelta=yes
3 > usegeneraldelta=yes
4 > EOF
4 > EOF
5
5
6 $ hg init debugrevlog
6 $ hg init debugrevlog
7 $ cd debugrevlog
7 $ cd debugrevlog
8 $ echo a > a
8 $ echo a > a
9 $ hg ci -Am adda
9 $ hg ci -Am adda
10 adding a
10 adding a
11 $ hg debugrevlog -m
11 $ hg debugrevlog -m
12 format : 1
12 format : 1
13 flags : inline, generaldelta
13 flags : inline, generaldelta
14
14
15 revisions : 1
15 revisions : 1
16 merges : 0 ( 0.00%)
16 merges : 0 ( 0.00%)
17 normal : 1 (100.00%)
17 normal : 1 (100.00%)
18 revisions : 1
18 revisions : 1
19 full : 1 (100.00%)
19 full : 1 (100.00%)
20 deltas : 0 ( 0.00%)
20 deltas : 0 ( 0.00%)
21 revision size : 44
21 revision size : 44
22 full : 44 (100.00%)
22 full : 44 (100.00%)
23 deltas : 0 ( 0.00%)
23 deltas : 0 ( 0.00%)
24
24
25 chunks : 1
25 chunks : 1
26 0x75 (u) : 1 (100.00%)
26 0x75 (u) : 1 (100.00%)
27 chunks size : 44
27 chunks size : 44
28 0x75 (u) : 44 (100.00%)
28 0x75 (u) : 44 (100.00%)
29
29
30 avg chain length : 0
30 avg chain length : 0
31 max chain length : 0
31 max chain length : 0
32 max chain reach : 44
32 max chain reach : 44
33 compression ratio : 0
33 compression ratio : 0
34
34
35 uncompressed data size (min/max/avg) : 43 / 43 / 43
35 uncompressed data size (min/max/avg) : 43 / 43 / 43
36 full revision size (min/max/avg) : 44 / 44 / 44
36 full revision size (min/max/avg) : 44 / 44 / 44
37 delta size (min/max/avg) : 0 / 0 / 0
37 delta size (min/max/avg) : 0 / 0 / 0
38
38
39 Test debugindex, with and without the --debug flag
39 Test debugindex, with and without the --debug flag
40 $ hg debugindex a
40 $ hg debugindex a
41 rev offset length ..... linkrev nodeid p1 p2 (re)
41 rev offset length ..... linkrev nodeid p1 p2 (re)
42 0 0 3 .... 0 b789fdd96dc2 000000000000 000000000000 (re)
42 0 0 3 .... 0 b789fdd96dc2 000000000000 000000000000 (re)
43 $ hg --debug debugindex a
43 $ hg --debug debugindex a
44 rev offset length ..... linkrev nodeid p1 p2 (re)
44 rev offset length ..... linkrev nodeid p1 p2 (re)
45 0 0 3 .... 0 b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 (re)
45 0 0 3 .... 0 b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 (re)
46 $ hg debugindex -f 1 a
46 $ hg debugindex -f 1 a
47 rev flag offset length size ..... link p1 p2 nodeid (re)
47 rev flag offset length size ..... link p1 p2 nodeid (re)
48 0 0000 0 3 2 .... 0 -1 -1 b789fdd96dc2 (re)
48 0 0000 0 3 2 .... 0 -1 -1 b789fdd96dc2 (re)
49 $ hg --debug debugindex -f 1 a
49 $ hg --debug debugindex -f 1 a
50 rev flag offset length size ..... link p1 p2 nodeid (re)
50 rev flag offset length size ..... link p1 p2 nodeid (re)
51 0 0000 0 3 2 .... 0 -1 -1 b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 (re)
51 0 0000 0 3 2 .... 0 -1 -1 b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 (re)
52
52
53 debugdelta chain basic output
53 debugdelta chain basic output
54
54
55 $ hg debugdeltachain -m
55 $ hg debugdeltachain -m
56 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio
56 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio
57 0 1 1 -1 base 44 43 44 1.02326 44 0 0.00000
57 0 1 1 -1 base 44 43 44 1.02326 44 0 0.00000
58
58
59 $ hg debugdeltachain -m -T '{rev} {chainid} {chainlen}\n'
59 $ hg debugdeltachain -m -T '{rev} {chainid} {chainlen}\n'
60 0 1 1
60 0 1 1
61
61
62 $ hg debugdeltachain -m -Tjson
62 $ hg debugdeltachain -m -Tjson
63 [
63 [
64 {
64 {
65 "chainid": 1,
65 "chainid": 1,
66 "chainlen": 1,
66 "chainlen": 1,
67 "chainratio": 1.02325581395,
67 "chainratio": 1.02325581395,
68 "chainsize": 44,
68 "chainsize": 44,
69 "compsize": 44,
69 "compsize": 44,
70 "deltatype": "base",
70 "deltatype": "base",
71 "extradist": 0,
71 "extradist": 0,
72 "extraratio": 0.0,
72 "extraratio": 0.0,
73 "lindist": 44,
73 "lindist": 44,
74 "prevrev": -1,
74 "prevrev": -1,
75 "rev": 0,
75 "rev": 0,
76 "uncompsize": 43
76 "uncompsize": 43
77 }
77 }
78 ]
78 ]
79
79
80 Test max chain len
80 Test max chain len
81 $ cat >> $HGRCPATH << EOF
81 $ cat >> $HGRCPATH << EOF
82 > [format]
82 > [format]
83 > maxchainlen=4
83 > maxchainlen=4
84 > EOF
84 > EOF
85
85
86 $ printf "This test checks if maxchainlen config value is respected also it can serve as basic test for debugrevlog -d <file>.\n" >> a
86 $ printf "This test checks if maxchainlen config value is respected also it can serve as basic test for debugrevlog -d <file>.\n" >> a
87 $ hg ci -m a
87 $ hg ci -m a
88 $ printf "b\n" >> a
88 $ printf "b\n" >> a
89 $ hg ci -m a
89 $ hg ci -m a
90 $ printf "c\n" >> a
90 $ printf "c\n" >> a
91 $ hg ci -m a
91 $ hg ci -m a
92 $ printf "d\n" >> a
92 $ printf "d\n" >> a
93 $ hg ci -m a
93 $ hg ci -m a
94 $ printf "e\n" >> a
94 $ printf "e\n" >> a
95 $ hg ci -m a
95 $ hg ci -m a
96 $ printf "f\n" >> a
96 $ printf "f\n" >> a
97 $ hg ci -m a
97 $ hg ci -m a
98 $ printf 'g\n' >> a
98 $ printf 'g\n' >> a
99 $ hg ci -m a
99 $ hg ci -m a
100 $ printf 'h\n' >> a
100 $ printf 'h\n' >> a
101 $ hg ci -m a
101 $ hg ci -m a
102 $ hg debugrevlog -d a
102 $ hg debugrevlog -d a
103 # rev p1rev p2rev start end deltastart base p1 p2 rawsize totalsize compression heads chainlen
103 # rev p1rev p2rev start end deltastart base p1 p2 rawsize totalsize compression heads chainlen
104 0 -1 -1 0 ??? 0 0 0 0 ??? ???? ? 1 0 (glob)
104 0 -1 -1 0 ??? 0 0 0 0 ??? ???? ? 1 0 (glob)
105 1 0 -1 ??? ??? 0 0 0 0 ??? ???? ? 1 1 (glob)
105 1 0 -1 ??? ??? 0 0 0 0 ??? ???? ? 1 1 (glob)
106 2 1 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 2 (glob)
106 2 1 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 2 (glob)
107 3 2 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 3 (glob)
107 3 2 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 3 (glob)
108 4 3 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 4 (glob)
108 4 3 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 4 (glob)
109 5 4 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 0 (glob)
109 5 4 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 0 (glob)
110 6 5 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 1 (glob)
110 6 5 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 1 (glob)
111 7 6 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 2 (glob)
111 7 6 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 2 (glob)
112 8 7 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 3 (glob)
112 8 7 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 3 (glob)
113
113
114 Test WdirUnsupported exception
114 Test WdirUnsupported exception
115
115
116 $ hg debugdata -c ffffffffffffffffffffffffffffffffffffffff
116 $ hg debugdata -c ffffffffffffffffffffffffffffffffffffffff
117 abort: working directory revision cannot be specified
117 abort: working directory revision cannot be specified
118 [255]
118 [255]
119
119
120 Test cache warming command
120 Test cache warming command
121
121
122 $ rm -rf .hg/cache/
122 $ rm -rf .hg/cache/
123 $ hg debugupdatecaches --debug
123 $ hg debugupdatecaches --debug
124 updating the branch cache
124 updating the branch cache
125 $ ls -r .hg/cache/*
125 $ ls -r .hg/cache/*
126 .hg/cache/rbc-revs-v1
126 .hg/cache/rbc-revs-v1
127 .hg/cache/rbc-names-v1
127 .hg/cache/rbc-names-v1
128 .hg/cache/branch2-served
128 .hg/cache/branch2-served
129
129
130 $ cd ..
130 $ cd ..
131
131
132 Test internal debugstacktrace command
132 Test internal debugstacktrace command
133
133
134 $ cat > debugstacktrace.py << EOF
134 $ cat > debugstacktrace.py << EOF
135 > from __future__ import absolute_import
135 > from __future__ import absolute_import
136 > import sys
136 > import sys
137 > from mercurial import util
137 > from mercurial import util
138 > def f():
138 > def f():
139 > util.debugstacktrace(f=sys.stdout)
139 > util.debugstacktrace(f=sys.stdout)
140 > g()
140 > g()
141 > def g():
141 > def g():
142 > util.dst('hello from g\\n', skip=1)
142 > util.dst('hello from g\\n', skip=1)
143 > h()
143 > h()
144 > def h():
144 > def h():
145 > util.dst('hi ...\\nfrom h hidden in g', 1, depth=2)
145 > util.dst('hi ...\\nfrom h hidden in g', 1, depth=2)
146 > f()
146 > f()
147 > EOF
147 > EOF
148 $ $PYTHON debugstacktrace.py
148 $ $PYTHON debugstacktrace.py
149 stacktrace at:
149 stacktrace at:
150 debugstacktrace.py:12 in * (glob)
150 debugstacktrace.py:12 in * (glob)
151 debugstacktrace.py:5 in f
151 debugstacktrace.py:5 in f
152 hello from g at:
152 hello from g at:
153 debugstacktrace.py:12 in * (glob)
153 debugstacktrace.py:12 in * (glob)
154 debugstacktrace.py:6 in f
154 debugstacktrace.py:6 in f
155 hi ...
155 hi ...
156 from h hidden in g at:
156 from h hidden in g at:
157 debugstacktrace.py:6 in f
157 debugstacktrace.py:6 in f
158 debugstacktrace.py:9 in g
158 debugstacktrace.py:9 in g
159
160 Test debugcapabilities command:
161
162 $ hg debugcapabilities ./debugrevlog/
163 Main capabilities:
164 branchmap
165 bundle2=HG20%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Aphases%3Dheads%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps
166 getbundle
167 known
168 lookup
169 pushkey
170 unbundle
@@ -1,3376 +1,3378 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 glossary Glossary
113 glossary Glossary
114 hgignore Syntax for Mercurial Ignore Files
114 hgignore Syntax for Mercurial Ignore Files
115 hgweb Configuring hgweb
115 hgweb Configuring hgweb
116 internals Technical implementation topics
116 internals Technical implementation topics
117 merge-tools Merge Tools
117 merge-tools Merge Tools
118 pager Pager Support
118 pager Pager Support
119 patterns File Name Patterns
119 patterns File Name Patterns
120 phases Working with Phases
120 phases Working with Phases
121 revisions Specifying Revisions
121 revisions Specifying Revisions
122 scripting Using Mercurial from scripts and automation
122 scripting Using Mercurial from scripts and automation
123 subrepos Subrepositories
123 subrepos Subrepositories
124 templating Template Usage
124 templating Template Usage
125 urls URL Paths
125 urls URL Paths
126
126
127 (use 'hg help -v' to show built-in aliases and global options)
127 (use 'hg help -v' to show built-in aliases and global options)
128
128
129 $ hg -q help
129 $ hg -q help
130 add add the specified files on the next commit
130 add add the specified files on the next commit
131 addremove add all new files, delete all missing files
131 addremove add all new files, delete all missing files
132 annotate show changeset information by line for each file
132 annotate show changeset information by line for each file
133 archive create an unversioned archive of a repository revision
133 archive create an unversioned archive of a repository revision
134 backout reverse effect of earlier changeset
134 backout reverse effect of earlier changeset
135 bisect subdivision search of changesets
135 bisect subdivision search of changesets
136 bookmarks create a new bookmark or list existing bookmarks
136 bookmarks create a new bookmark or list existing bookmarks
137 branch set or show the current branch name
137 branch set or show the current branch name
138 branches list repository named branches
138 branches list repository named branches
139 bundle create a bundle file
139 bundle create a bundle file
140 cat output the current or given revision of files
140 cat output the current or given revision of files
141 clone make a copy of an existing repository
141 clone make a copy of an existing repository
142 commit commit the specified files or all outstanding changes
142 commit commit the specified files or all outstanding changes
143 config show combined config settings from all hgrc files
143 config show combined config settings from all hgrc files
144 copy mark files as copied for the next commit
144 copy mark files as copied for the next commit
145 diff diff repository (or selected files)
145 diff diff repository (or selected files)
146 export dump the header and diffs for one or more changesets
146 export dump the header and diffs for one or more changesets
147 files list tracked files
147 files list tracked files
148 forget forget the specified files on the next commit
148 forget forget the specified files on the next commit
149 graft copy changes from other branches onto the current branch
149 graft copy changes from other branches onto the current branch
150 grep search revision history for a pattern in specified files
150 grep search revision history for a pattern in specified files
151 heads show branch heads
151 heads show branch heads
152 help show help for a given topic or a help overview
152 help show help for a given topic or a help overview
153 identify identify the working directory or specified revision
153 identify identify the working directory or specified revision
154 import import an ordered set of patches
154 import import an ordered set of patches
155 incoming show new changesets found in source
155 incoming show new changesets found in source
156 init create a new repository in the given directory
156 init create a new repository in the given directory
157 log show revision history of entire repository or files
157 log show revision history of entire repository or files
158 manifest output the current or given revision of the project manifest
158 manifest output the current or given revision of the project manifest
159 merge merge another revision into working directory
159 merge merge another revision into working directory
160 outgoing show changesets not found in the destination
160 outgoing show changesets not found in the destination
161 paths show aliases for remote repositories
161 paths show aliases for remote repositories
162 phase set or show the current phase name
162 phase set or show the current phase name
163 pull pull changes from the specified source
163 pull pull changes from the specified source
164 push push changes to the specified destination
164 push push changes to the specified destination
165 recover roll back an interrupted transaction
165 recover roll back an interrupted transaction
166 remove remove the specified files on the next commit
166 remove remove the specified files on the next commit
167 rename rename files; equivalent of copy + remove
167 rename rename files; equivalent of copy + remove
168 resolve redo merges or set/view the merge status of files
168 resolve redo merges or set/view the merge status of files
169 revert restore files to their checkout state
169 revert restore files to their checkout state
170 root print the root (top) of the current working directory
170 root print the root (top) of the current working directory
171 serve start stand-alone webserver
171 serve start stand-alone webserver
172 status show changed files in the working directory
172 status show changed files in the working directory
173 summary summarize working directory state
173 summary summarize working directory state
174 tag add one or more tags for the current or given revision
174 tag add one or more tags for the current or given revision
175 tags list repository tags
175 tags list repository tags
176 unbundle apply one or more bundle files
176 unbundle apply one or more bundle files
177 update update working directory (or switch revisions)
177 update update working directory (or switch revisions)
178 verify verify the integrity of the repository
178 verify verify the integrity of the repository
179 version output version and copyright information
179 version output version and copyright information
180
180
181 additional help topics:
181 additional help topics:
182
182
183 bundlespec Bundle File Formats
183 bundlespec Bundle File Formats
184 color Colorizing Outputs
184 color Colorizing Outputs
185 config Configuration Files
185 config Configuration Files
186 dates Date Formats
186 dates Date Formats
187 diffs Diff Formats
187 diffs Diff Formats
188 environment Environment Variables
188 environment Environment Variables
189 extensions Using Additional Features
189 extensions Using Additional Features
190 filesets Specifying File Sets
190 filesets Specifying File Sets
191 glossary Glossary
191 glossary Glossary
192 hgignore Syntax for Mercurial Ignore Files
192 hgignore Syntax for Mercurial Ignore Files
193 hgweb Configuring hgweb
193 hgweb Configuring hgweb
194 internals Technical implementation topics
194 internals Technical implementation topics
195 merge-tools Merge Tools
195 merge-tools Merge Tools
196 pager Pager Support
196 pager Pager Support
197 patterns File Name Patterns
197 patterns File Name Patterns
198 phases Working with Phases
198 phases Working with Phases
199 revisions Specifying Revisions
199 revisions Specifying Revisions
200 scripting Using Mercurial from scripts and automation
200 scripting Using Mercurial from scripts and automation
201 subrepos Subrepositories
201 subrepos Subrepositories
202 templating Template Usage
202 templating Template Usage
203 urls URL Paths
203 urls URL Paths
204
204
205 Test extension help:
205 Test extension help:
206 $ hg help extensions --config extensions.rebase= --config extensions.children=
206 $ hg help extensions --config extensions.rebase= --config extensions.children=
207 Using Additional Features
207 Using Additional Features
208 """""""""""""""""""""""""
208 """""""""""""""""""""""""
209
209
210 Mercurial has the ability to add new features through the use of
210 Mercurial has the ability to add new features through the use of
211 extensions. Extensions may add new commands, add options to existing
211 extensions. Extensions may add new commands, add options to existing
212 commands, change the default behavior of commands, or implement hooks.
212 commands, change the default behavior of commands, or implement hooks.
213
213
214 To enable the "foo" extension, either shipped with Mercurial or in the
214 To enable the "foo" extension, either shipped with Mercurial or in the
215 Python search path, create an entry for it in your configuration file,
215 Python search path, create an entry for it in your configuration file,
216 like this:
216 like this:
217
217
218 [extensions]
218 [extensions]
219 foo =
219 foo =
220
220
221 You may also specify the full path to an extension:
221 You may also specify the full path to an extension:
222
222
223 [extensions]
223 [extensions]
224 myfeature = ~/.hgext/myfeature.py
224 myfeature = ~/.hgext/myfeature.py
225
225
226 See 'hg help config' for more information on configuration files.
226 See 'hg help config' for more information on configuration files.
227
227
228 Extensions are not loaded by default for a variety of reasons: they can
228 Extensions are not loaded by default for a variety of reasons: they can
229 increase startup overhead; they may be meant for advanced usage only; they
229 increase startup overhead; they may be meant for advanced usage only; they
230 may provide potentially dangerous abilities (such as letting you destroy
230 may provide potentially dangerous abilities (such as letting you destroy
231 or modify history); they might not be ready for prime time; or they may
231 or modify history); they might not be ready for prime time; or they may
232 alter some usual behaviors of stock Mercurial. It is thus up to the user
232 alter some usual behaviors of stock Mercurial. It is thus up to the user
233 to activate extensions as needed.
233 to activate extensions as needed.
234
234
235 To explicitly disable an extension enabled in a configuration file of
235 To explicitly disable an extension enabled in a configuration file of
236 broader scope, prepend its path with !:
236 broader scope, prepend its path with !:
237
237
238 [extensions]
238 [extensions]
239 # disabling extension bar residing in /path/to/extension/bar.py
239 # disabling extension bar residing in /path/to/extension/bar.py
240 bar = !/path/to/extension/bar.py
240 bar = !/path/to/extension/bar.py
241 # ditto, but no path was supplied for extension baz
241 # ditto, but no path was supplied for extension baz
242 baz = !
242 baz = !
243
243
244 enabled extensions:
244 enabled extensions:
245
245
246 children command to display child changesets (DEPRECATED)
246 children command to display child changesets (DEPRECATED)
247 rebase command to move sets of revisions to a different ancestor
247 rebase command to move sets of revisions to a different ancestor
248
248
249 disabled extensions:
249 disabled extensions:
250
250
251 acl hooks for controlling repository access
251 acl hooks for controlling repository access
252 blackbox log repository events to a blackbox for debugging
252 blackbox log repository events to a blackbox for debugging
253 bugzilla hooks for integrating with the Bugzilla bug tracker
253 bugzilla hooks for integrating with the Bugzilla bug tracker
254 censor erase file content at a given revision
254 censor erase file content at a given revision
255 churn command to display statistics about repository history
255 churn command to display statistics about repository history
256 clonebundles advertise pre-generated bundles to seed clones
256 clonebundles advertise pre-generated bundles to seed clones
257 convert import revisions from foreign VCS repositories into
257 convert import revisions from foreign VCS repositories into
258 Mercurial
258 Mercurial
259 eol automatically manage newlines in repository files
259 eol automatically manage newlines in repository files
260 extdiff command to allow external programs to compare revisions
260 extdiff command to allow external programs to compare revisions
261 factotum http authentication with factotum
261 factotum http authentication with factotum
262 gpg commands to sign and verify changesets
262 gpg commands to sign and verify changesets
263 hgk browse the repository in a graphical way
263 hgk browse the repository in a graphical way
264 highlight syntax highlighting for hgweb (requires Pygments)
264 highlight syntax highlighting for hgweb (requires Pygments)
265 histedit interactive history editing
265 histedit interactive history editing
266 keyword expand keywords in tracked files
266 keyword expand keywords in tracked files
267 largefiles track large binary files
267 largefiles track large binary files
268 mq manage a stack of patches
268 mq manage a stack of patches
269 notify hooks for sending email push notifications
269 notify hooks for sending email push notifications
270 patchbomb command to send changesets as (a series of) patch emails
270 patchbomb command to send changesets as (a series of) patch emails
271 purge command to delete untracked files from the working
271 purge command to delete untracked files from the working
272 directory
272 directory
273 relink recreates hardlinks between repository clones
273 relink recreates hardlinks between repository clones
274 schemes extend schemes with shortcuts to repository swarms
274 schemes extend schemes with shortcuts to repository swarms
275 share share a common history between several working directories
275 share share a common history between several working directories
276 shelve save and restore changes to the working directory
276 shelve save and restore changes to the working directory
277 strip strip changesets and their descendants from history
277 strip strip changesets and their descendants from history
278 transplant command to transplant changesets from another branch
278 transplant command to transplant changesets from another branch
279 win32mbcs allow the use of MBCS paths with problematic encodings
279 win32mbcs allow the use of MBCS paths with problematic encodings
280 zeroconf discover and advertise repositories on the local network
280 zeroconf discover and advertise repositories on the local network
281
281
282 Verify that extension keywords appear in help templates
282 Verify that extension keywords appear in help templates
283
283
284 $ hg help --config extensions.transplant= templating|grep transplant > /dev/null
284 $ hg help --config extensions.transplant= templating|grep transplant > /dev/null
285
285
286 Test short command list with verbose option
286 Test short command list with verbose option
287
287
288 $ hg -v help shortlist
288 $ hg -v help shortlist
289 Mercurial Distributed SCM
289 Mercurial Distributed SCM
290
290
291 basic commands:
291 basic commands:
292
292
293 add add the specified files on the next commit
293 add add the specified files on the next commit
294 annotate, blame
294 annotate, blame
295 show changeset information by line for each file
295 show changeset information by line for each file
296 clone make a copy of an existing repository
296 clone make a copy of an existing repository
297 commit, ci commit the specified files or all outstanding changes
297 commit, ci commit the specified files or all outstanding changes
298 diff diff repository (or selected files)
298 diff diff repository (or selected files)
299 export dump the header and diffs for one or more changesets
299 export dump the header and diffs for one or more changesets
300 forget forget the specified files on the next commit
300 forget forget the specified files on the next commit
301 init create a new repository in the given directory
301 init create a new repository in the given directory
302 log, history show revision history of entire repository or files
302 log, history show revision history of entire repository or files
303 merge merge another revision into working directory
303 merge merge another revision into working directory
304 pull pull changes from the specified source
304 pull pull changes from the specified source
305 push push changes to the specified destination
305 push push changes to the specified destination
306 remove, rm remove the specified files on the next commit
306 remove, rm remove the specified files on the next commit
307 serve start stand-alone webserver
307 serve start stand-alone webserver
308 status, st show changed files in the working directory
308 status, st show changed files in the working directory
309 summary, sum summarize working directory state
309 summary, sum summarize working directory state
310 update, up, checkout, co
310 update, up, checkout, co
311 update working directory (or switch revisions)
311 update working directory (or switch revisions)
312
312
313 global options ([+] can be repeated):
313 global options ([+] can be repeated):
314
314
315 -R --repository REPO repository root directory or name of overlay bundle
315 -R --repository REPO repository root directory or name of overlay bundle
316 file
316 file
317 --cwd DIR change working directory
317 --cwd DIR change working directory
318 -y --noninteractive do not prompt, automatically pick the first choice for
318 -y --noninteractive do not prompt, automatically pick the first choice for
319 all prompts
319 all prompts
320 -q --quiet suppress output
320 -q --quiet suppress output
321 -v --verbose enable additional output
321 -v --verbose enable additional output
322 --color TYPE when to colorize (boolean, always, auto, never, or
322 --color TYPE when to colorize (boolean, always, auto, never, or
323 debug)
323 debug)
324 --config CONFIG [+] set/override config option (use 'section.name=value')
324 --config CONFIG [+] set/override config option (use 'section.name=value')
325 --debug enable debugging output
325 --debug enable debugging output
326 --debugger start debugger
326 --debugger start debugger
327 --encoding ENCODE set the charset encoding (default: ascii)
327 --encoding ENCODE set the charset encoding (default: ascii)
328 --encodingmode MODE set the charset encoding mode (default: strict)
328 --encodingmode MODE set the charset encoding mode (default: strict)
329 --traceback always print a traceback on exception
329 --traceback always print a traceback on exception
330 --time time how long the command takes
330 --time time how long the command takes
331 --profile print command execution profile
331 --profile print command execution profile
332 --version output version information and exit
332 --version output version information and exit
333 -h --help display help and exit
333 -h --help display help and exit
334 --hidden consider hidden changesets
334 --hidden consider hidden changesets
335 --pager TYPE when to paginate (boolean, always, auto, or never)
335 --pager TYPE when to paginate (boolean, always, auto, or never)
336 (default: auto)
336 (default: auto)
337
337
338 (use 'hg help' for the full list of commands)
338 (use 'hg help' for the full list of commands)
339
339
340 $ hg add -h
340 $ hg add -h
341 hg add [OPTION]... [FILE]...
341 hg add [OPTION]... [FILE]...
342
342
343 add the specified files on the next commit
343 add the specified files on the next commit
344
344
345 Schedule files to be version controlled and added to the repository.
345 Schedule files to be version controlled and added to the repository.
346
346
347 The files will be added to the repository at the next commit. To undo an
347 The files will be added to the repository at the next commit. To undo an
348 add before that, see 'hg forget'.
348 add before that, see 'hg forget'.
349
349
350 If no names are given, add all files to the repository (except files
350 If no names are given, add all files to the repository (except files
351 matching ".hgignore").
351 matching ".hgignore").
352
352
353 Returns 0 if all files are successfully added.
353 Returns 0 if all files are successfully added.
354
354
355 options ([+] can be repeated):
355 options ([+] can be repeated):
356
356
357 -I --include PATTERN [+] include names matching the given patterns
357 -I --include PATTERN [+] include names matching the given patterns
358 -X --exclude PATTERN [+] exclude names matching the given patterns
358 -X --exclude PATTERN [+] exclude names matching the given patterns
359 -S --subrepos recurse into subrepositories
359 -S --subrepos recurse into subrepositories
360 -n --dry-run do not perform actions, just print output
360 -n --dry-run do not perform actions, just print output
361
361
362 (some details hidden, use --verbose to show complete help)
362 (some details hidden, use --verbose to show complete help)
363
363
364 Verbose help for add
364 Verbose help for add
365
365
366 $ hg add -hv
366 $ hg add -hv
367 hg add [OPTION]... [FILE]...
367 hg add [OPTION]... [FILE]...
368
368
369 add the specified files on the next commit
369 add the specified files on the next commit
370
370
371 Schedule files to be version controlled and added to the repository.
371 Schedule files to be version controlled and added to the repository.
372
372
373 The files will be added to the repository at the next commit. To undo an
373 The files will be added to the repository at the next commit. To undo an
374 add before that, see 'hg forget'.
374 add before that, see 'hg forget'.
375
375
376 If no names are given, add all files to the repository (except files
376 If no names are given, add all files to the repository (except files
377 matching ".hgignore").
377 matching ".hgignore").
378
378
379 Examples:
379 Examples:
380
380
381 - New (unknown) files are added automatically by 'hg add':
381 - New (unknown) files are added automatically by 'hg add':
382
382
383 $ ls
383 $ ls
384 foo.c
384 foo.c
385 $ hg status
385 $ hg status
386 ? foo.c
386 ? foo.c
387 $ hg add
387 $ hg add
388 adding foo.c
388 adding foo.c
389 $ hg status
389 $ hg status
390 A foo.c
390 A foo.c
391
391
392 - Specific files to be added can be specified:
392 - Specific files to be added can be specified:
393
393
394 $ ls
394 $ ls
395 bar.c foo.c
395 bar.c foo.c
396 $ hg status
396 $ hg status
397 ? bar.c
397 ? bar.c
398 ? foo.c
398 ? foo.c
399 $ hg add bar.c
399 $ hg add bar.c
400 $ hg status
400 $ hg status
401 A bar.c
401 A bar.c
402 ? foo.c
402 ? foo.c
403
403
404 Returns 0 if all files are successfully added.
404 Returns 0 if all files are successfully added.
405
405
406 options ([+] can be repeated):
406 options ([+] can be repeated):
407
407
408 -I --include PATTERN [+] include names matching the given patterns
408 -I --include PATTERN [+] include names matching the given patterns
409 -X --exclude PATTERN [+] exclude names matching the given patterns
409 -X --exclude PATTERN [+] exclude names matching the given patterns
410 -S --subrepos recurse into subrepositories
410 -S --subrepos recurse into subrepositories
411 -n --dry-run do not perform actions, just print output
411 -n --dry-run do not perform actions, just print output
412
412
413 global options ([+] can be repeated):
413 global options ([+] can be repeated):
414
414
415 -R --repository REPO repository root directory or name of overlay bundle
415 -R --repository REPO repository root directory or name of overlay bundle
416 file
416 file
417 --cwd DIR change working directory
417 --cwd DIR change working directory
418 -y --noninteractive do not prompt, automatically pick the first choice for
418 -y --noninteractive do not prompt, automatically pick the first choice for
419 all prompts
419 all prompts
420 -q --quiet suppress output
420 -q --quiet suppress output
421 -v --verbose enable additional output
421 -v --verbose enable additional output
422 --color TYPE when to colorize (boolean, always, auto, never, or
422 --color TYPE when to colorize (boolean, always, auto, never, or
423 debug)
423 debug)
424 --config CONFIG [+] set/override config option (use 'section.name=value')
424 --config CONFIG [+] set/override config option (use 'section.name=value')
425 --debug enable debugging output
425 --debug enable debugging output
426 --debugger start debugger
426 --debugger start debugger
427 --encoding ENCODE set the charset encoding (default: ascii)
427 --encoding ENCODE set the charset encoding (default: ascii)
428 --encodingmode MODE set the charset encoding mode (default: strict)
428 --encodingmode MODE set the charset encoding mode (default: strict)
429 --traceback always print a traceback on exception
429 --traceback always print a traceback on exception
430 --time time how long the command takes
430 --time time how long the command takes
431 --profile print command execution profile
431 --profile print command execution profile
432 --version output version information and exit
432 --version output version information and exit
433 -h --help display help and exit
433 -h --help display help and exit
434 --hidden consider hidden changesets
434 --hidden consider hidden changesets
435 --pager TYPE when to paginate (boolean, always, auto, or never)
435 --pager TYPE when to paginate (boolean, always, auto, or never)
436 (default: auto)
436 (default: auto)
437
437
438 Test the textwidth config option
438 Test the textwidth config option
439
439
440 $ hg root -h --config ui.textwidth=50
440 $ hg root -h --config ui.textwidth=50
441 hg root
441 hg root
442
442
443 print the root (top) of the current working
443 print the root (top) of the current working
444 directory
444 directory
445
445
446 Print the root directory of the current
446 Print the root directory of the current
447 repository.
447 repository.
448
448
449 Returns 0 on success.
449 Returns 0 on success.
450
450
451 (some details hidden, use --verbose to show
451 (some details hidden, use --verbose to show
452 complete help)
452 complete help)
453
453
454 Test help option with version option
454 Test help option with version option
455
455
456 $ hg add -h --version
456 $ hg add -h --version
457 Mercurial Distributed SCM (version *) (glob)
457 Mercurial Distributed SCM (version *) (glob)
458 (see https://mercurial-scm.org for more information)
458 (see https://mercurial-scm.org for more information)
459
459
460 Copyright (C) 2005-* Matt Mackall and others (glob)
460 Copyright (C) 2005-* Matt Mackall and others (glob)
461 This is free software; see the source for copying conditions. There is NO
461 This is free software; see the source for copying conditions. There is NO
462 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
462 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
463
463
464 $ hg add --skjdfks
464 $ hg add --skjdfks
465 hg add: option --skjdfks not recognized
465 hg add: option --skjdfks not recognized
466 hg add [OPTION]... [FILE]...
466 hg add [OPTION]... [FILE]...
467
467
468 add the specified files on the next commit
468 add the specified files on the next commit
469
469
470 options ([+] can be repeated):
470 options ([+] can be repeated):
471
471
472 -I --include PATTERN [+] include names matching the given patterns
472 -I --include PATTERN [+] include names matching the given patterns
473 -X --exclude PATTERN [+] exclude names matching the given patterns
473 -X --exclude PATTERN [+] exclude names matching the given patterns
474 -S --subrepos recurse into subrepositories
474 -S --subrepos recurse into subrepositories
475 -n --dry-run do not perform actions, just print output
475 -n --dry-run do not perform actions, just print output
476
476
477 (use 'hg add -h' to show more help)
477 (use 'hg add -h' to show more help)
478 [255]
478 [255]
479
479
480 Test ambiguous command help
480 Test ambiguous command help
481
481
482 $ hg help ad
482 $ hg help ad
483 list of commands:
483 list of commands:
484
484
485 add add the specified files on the next commit
485 add add the specified files on the next commit
486 addremove add all new files, delete all missing files
486 addremove add all new files, delete all missing files
487
487
488 (use 'hg help -v ad' to show built-in aliases and global options)
488 (use 'hg help -v ad' to show built-in aliases and global options)
489
489
490 Test command without options
490 Test command without options
491
491
492 $ hg help verify
492 $ hg help verify
493 hg verify
493 hg verify
494
494
495 verify the integrity of the repository
495 verify the integrity of the repository
496
496
497 Verify the integrity of the current repository.
497 Verify the integrity of the current repository.
498
498
499 This will perform an extensive check of the repository's integrity,
499 This will perform an extensive check of the repository's integrity,
500 validating the hashes and checksums of each entry in the changelog,
500 validating the hashes and checksums of each entry in the changelog,
501 manifest, and tracked files, as well as the integrity of their crosslinks
501 manifest, and tracked files, as well as the integrity of their crosslinks
502 and indices.
502 and indices.
503
503
504 Please see https://mercurial-scm.org/wiki/RepositoryCorruption for more
504 Please see https://mercurial-scm.org/wiki/RepositoryCorruption for more
505 information about recovery from corruption of the repository.
505 information about recovery from corruption of the repository.
506
506
507 Returns 0 on success, 1 if errors are encountered.
507 Returns 0 on success, 1 if errors are encountered.
508
508
509 (some details hidden, use --verbose to show complete help)
509 (some details hidden, use --verbose to show complete help)
510
510
511 $ hg help diff
511 $ hg help diff
512 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
512 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
513
513
514 diff repository (or selected files)
514 diff repository (or selected files)
515
515
516 Show differences between revisions for the specified files.
516 Show differences between revisions for the specified files.
517
517
518 Differences between files are shown using the unified diff format.
518 Differences between files are shown using the unified diff format.
519
519
520 Note:
520 Note:
521 'hg diff' may generate unexpected results for merges, as it will
521 'hg diff' may generate unexpected results for merges, as it will
522 default to comparing against the working directory's first parent
522 default to comparing against the working directory's first parent
523 changeset if no revisions are specified.
523 changeset if no revisions are specified.
524
524
525 When two revision arguments are given, then changes are shown between
525 When two revision arguments are given, then changes are shown between
526 those revisions. If only one revision is specified then that revision is
526 those revisions. If only one revision is specified then that revision is
527 compared to the working directory, and, when no revisions are specified,
527 compared to the working directory, and, when no revisions are specified,
528 the working directory files are compared to its first parent.
528 the working directory files are compared to its first parent.
529
529
530 Alternatively you can specify -c/--change with a revision to see the
530 Alternatively you can specify -c/--change with a revision to see the
531 changes in that changeset relative to its first parent.
531 changes in that changeset relative to its first parent.
532
532
533 Without the -a/--text option, diff will avoid generating diffs of files it
533 Without the -a/--text option, diff will avoid generating diffs of files it
534 detects as binary. With -a, diff will generate a diff anyway, probably
534 detects as binary. With -a, diff will generate a diff anyway, probably
535 with undesirable results.
535 with undesirable results.
536
536
537 Use the -g/--git option to generate diffs in the git extended diff format.
537 Use the -g/--git option to generate diffs in the git extended diff format.
538 For more information, read 'hg help diffs'.
538 For more information, read 'hg help diffs'.
539
539
540 Returns 0 on success.
540 Returns 0 on success.
541
541
542 options ([+] can be repeated):
542 options ([+] can be repeated):
543
543
544 -r --rev REV [+] revision
544 -r --rev REV [+] revision
545 -c --change REV change made by revision
545 -c --change REV change made by revision
546 -a --text treat all files as text
546 -a --text treat all files as text
547 -g --git use git extended diff format
547 -g --git use git extended diff format
548 --binary generate binary diffs in git mode (default)
548 --binary generate binary diffs in git mode (default)
549 --nodates omit dates from diff headers
549 --nodates omit dates from diff headers
550 --noprefix omit a/ and b/ prefixes from filenames
550 --noprefix omit a/ and b/ prefixes from filenames
551 -p --show-function show which function each change is in
551 -p --show-function show which function each change is in
552 --reverse produce a diff that undoes the changes
552 --reverse produce a diff that undoes the changes
553 -w --ignore-all-space ignore white space when comparing lines
553 -w --ignore-all-space ignore white space when comparing lines
554 -b --ignore-space-change ignore changes in the amount of white space
554 -b --ignore-space-change ignore changes in the amount of white space
555 -B --ignore-blank-lines ignore changes whose lines are all blank
555 -B --ignore-blank-lines ignore changes whose lines are all blank
556 -Z --ignore-space-at-eol ignore changes in whitespace at EOL
556 -Z --ignore-space-at-eol ignore changes in whitespace at EOL
557 -U --unified NUM number of lines of context to show
557 -U --unified NUM number of lines of context to show
558 --stat output diffstat-style summary of changes
558 --stat output diffstat-style summary of changes
559 --root DIR produce diffs relative to subdirectory
559 --root DIR produce diffs relative to subdirectory
560 -I --include PATTERN [+] include names matching the given patterns
560 -I --include PATTERN [+] include names matching the given patterns
561 -X --exclude PATTERN [+] exclude names matching the given patterns
561 -X --exclude PATTERN [+] exclude names matching the given patterns
562 -S --subrepos recurse into subrepositories
562 -S --subrepos recurse into subrepositories
563
563
564 (some details hidden, use --verbose to show complete help)
564 (some details hidden, use --verbose to show complete help)
565
565
566 $ hg help status
566 $ hg help status
567 hg status [OPTION]... [FILE]...
567 hg status [OPTION]... [FILE]...
568
568
569 aliases: st
569 aliases: st
570
570
571 show changed files in the working directory
571 show changed files in the working directory
572
572
573 Show status of files in the repository. If names are given, only files
573 Show status of files in the repository. If names are given, only files
574 that match are shown. Files that are clean or ignored or the source of a
574 that match are shown. Files that are clean or ignored or the source of a
575 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
575 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
576 -C/--copies or -A/--all are given. Unless options described with "show
576 -C/--copies or -A/--all are given. Unless options described with "show
577 only ..." are given, the options -mardu are used.
577 only ..." are given, the options -mardu are used.
578
578
579 Option -q/--quiet hides untracked (unknown and ignored) files unless
579 Option -q/--quiet hides untracked (unknown and ignored) files unless
580 explicitly requested with -u/--unknown or -i/--ignored.
580 explicitly requested with -u/--unknown or -i/--ignored.
581
581
582 Note:
582 Note:
583 'hg status' may appear to disagree with diff if permissions have
583 'hg status' may appear to disagree with diff if permissions have
584 changed or a merge has occurred. The standard diff format does not
584 changed or a merge has occurred. The standard diff format does not
585 report permission changes and diff only reports changes relative to one
585 report permission changes and diff only reports changes relative to one
586 merge parent.
586 merge parent.
587
587
588 If one revision is given, it is used as the base revision. If two
588 If one revision is given, it is used as the base revision. If two
589 revisions are given, the differences between them are shown. The --change
589 revisions are given, the differences between them are shown. The --change
590 option can also be used as a shortcut to list the changed files of a
590 option can also be used as a shortcut to list the changed files of a
591 revision from its first parent.
591 revision from its first parent.
592
592
593 The codes used to show the status of files are:
593 The codes used to show the status of files are:
594
594
595 M = modified
595 M = modified
596 A = added
596 A = added
597 R = removed
597 R = removed
598 C = clean
598 C = clean
599 ! = missing (deleted by non-hg command, but still tracked)
599 ! = missing (deleted by non-hg command, but still tracked)
600 ? = not tracked
600 ? = not tracked
601 I = ignored
601 I = ignored
602 = origin of the previous file (with --copies)
602 = origin of the previous file (with --copies)
603
603
604 Returns 0 on success.
604 Returns 0 on success.
605
605
606 options ([+] can be repeated):
606 options ([+] can be repeated):
607
607
608 -A --all show status of all files
608 -A --all show status of all files
609 -m --modified show only modified files
609 -m --modified show only modified files
610 -a --added show only added files
610 -a --added show only added files
611 -r --removed show only removed files
611 -r --removed show only removed files
612 -d --deleted show only deleted (but tracked) files
612 -d --deleted show only deleted (but tracked) files
613 -c --clean show only files without changes
613 -c --clean show only files without changes
614 -u --unknown show only unknown (not tracked) files
614 -u --unknown show only unknown (not tracked) files
615 -i --ignored show only ignored files
615 -i --ignored show only ignored files
616 -n --no-status hide status prefix
616 -n --no-status hide status prefix
617 -C --copies show source of copied files
617 -C --copies show source of copied files
618 -0 --print0 end filenames with NUL, for use with xargs
618 -0 --print0 end filenames with NUL, for use with xargs
619 --rev REV [+] show difference from revision
619 --rev REV [+] show difference from revision
620 --change REV list the changed files of a revision
620 --change REV list the changed files of a revision
621 -I --include PATTERN [+] include names matching the given patterns
621 -I --include PATTERN [+] include names matching the given patterns
622 -X --exclude PATTERN [+] exclude names matching the given patterns
622 -X --exclude PATTERN [+] exclude names matching the given patterns
623 -S --subrepos recurse into subrepositories
623 -S --subrepos recurse into subrepositories
624
624
625 (some details hidden, use --verbose to show complete help)
625 (some details hidden, use --verbose to show complete help)
626
626
627 $ hg -q help status
627 $ hg -q help status
628 hg status [OPTION]... [FILE]...
628 hg status [OPTION]... [FILE]...
629
629
630 show changed files in the working directory
630 show changed files in the working directory
631
631
632 $ hg help foo
632 $ hg help foo
633 abort: no such help topic: foo
633 abort: no such help topic: foo
634 (try 'hg help --keyword foo')
634 (try 'hg help --keyword foo')
635 [255]
635 [255]
636
636
637 $ hg skjdfks
637 $ hg skjdfks
638 hg: unknown command 'skjdfks'
638 hg: unknown command 'skjdfks'
639 Mercurial Distributed SCM
639 Mercurial Distributed SCM
640
640
641 basic commands:
641 basic commands:
642
642
643 add add the specified files on the next commit
643 add add the specified files on the next commit
644 annotate show changeset information by line for each file
644 annotate show changeset information by line for each file
645 clone make a copy of an existing repository
645 clone make a copy of an existing repository
646 commit commit the specified files or all outstanding changes
646 commit commit the specified files or all outstanding changes
647 diff diff repository (or selected files)
647 diff diff repository (or selected files)
648 export dump the header and diffs for one or more changesets
648 export dump the header and diffs for one or more changesets
649 forget forget the specified files on the next commit
649 forget forget the specified files on the next commit
650 init create a new repository in the given directory
650 init create a new repository in the given directory
651 log show revision history of entire repository or files
651 log show revision history of entire repository or files
652 merge merge another revision into working directory
652 merge merge another revision into working directory
653 pull pull changes from the specified source
653 pull pull changes from the specified source
654 push push changes to the specified destination
654 push push changes to the specified destination
655 remove remove the specified files on the next commit
655 remove remove the specified files on the next commit
656 serve start stand-alone webserver
656 serve start stand-alone webserver
657 status show changed files in the working directory
657 status show changed files in the working directory
658 summary summarize working directory state
658 summary summarize working directory state
659 update update working directory (or switch revisions)
659 update update working directory (or switch revisions)
660
660
661 (use 'hg help' for the full list of commands or 'hg -v' for details)
661 (use 'hg help' for the full list of commands or 'hg -v' for details)
662 [255]
662 [255]
663
663
664 Typoed command gives suggestion
664 Typoed command gives suggestion
665 $ hg puls
665 $ hg puls
666 hg: unknown command 'puls'
666 hg: unknown command 'puls'
667 (did you mean one of pull, push?)
667 (did you mean one of pull, push?)
668 [255]
668 [255]
669
669
670 Not enabled extension gets suggested
670 Not enabled extension gets suggested
671
671
672 $ hg rebase
672 $ hg rebase
673 hg: unknown command 'rebase'
673 hg: unknown command 'rebase'
674 'rebase' is provided by the following extension:
674 'rebase' is provided by the following extension:
675
675
676 rebase command to move sets of revisions to a different ancestor
676 rebase command to move sets of revisions to a different ancestor
677
677
678 (use 'hg help extensions' for information on enabling extensions)
678 (use 'hg help extensions' for information on enabling extensions)
679 [255]
679 [255]
680
680
681 Disabled extension gets suggested
681 Disabled extension gets suggested
682 $ hg --config extensions.rebase=! rebase
682 $ hg --config extensions.rebase=! rebase
683 hg: unknown command 'rebase'
683 hg: unknown command 'rebase'
684 'rebase' is provided by the following extension:
684 'rebase' is provided by the following extension:
685
685
686 rebase command to move sets of revisions to a different ancestor
686 rebase command to move sets of revisions to a different ancestor
687
687
688 (use 'hg help extensions' for information on enabling extensions)
688 (use 'hg help extensions' for information on enabling extensions)
689 [255]
689 [255]
690
690
691 Make sure that we don't run afoul of the help system thinking that
691 Make sure that we don't run afoul of the help system thinking that
692 this is a section and erroring out weirdly.
692 this is a section and erroring out weirdly.
693
693
694 $ hg .log
694 $ hg .log
695 hg: unknown command '.log'
695 hg: unknown command '.log'
696 (did you mean log?)
696 (did you mean log?)
697 [255]
697 [255]
698
698
699 $ hg log.
699 $ hg log.
700 hg: unknown command 'log.'
700 hg: unknown command 'log.'
701 (did you mean log?)
701 (did you mean log?)
702 [255]
702 [255]
703 $ hg pu.lh
703 $ hg pu.lh
704 hg: unknown command 'pu.lh'
704 hg: unknown command 'pu.lh'
705 (did you mean one of pull, push?)
705 (did you mean one of pull, push?)
706 [255]
706 [255]
707
707
708 $ cat > helpext.py <<EOF
708 $ cat > helpext.py <<EOF
709 > import os
709 > import os
710 > from mercurial import commands, registrar
710 > from mercurial import commands, registrar
711 >
711 >
712 > cmdtable = {}
712 > cmdtable = {}
713 > command = registrar.command(cmdtable)
713 > command = registrar.command(cmdtable)
714 >
714 >
715 > @command(b'nohelp',
715 > @command(b'nohelp',
716 > [(b'', b'longdesc', 3, b'x'*90),
716 > [(b'', b'longdesc', 3, b'x'*90),
717 > (b'n', b'', None, b'normal desc'),
717 > (b'n', b'', None, b'normal desc'),
718 > (b'', b'newline', b'', b'line1\nline2')],
718 > (b'', b'newline', b'', b'line1\nline2')],
719 > b'hg nohelp',
719 > b'hg nohelp',
720 > norepo=True)
720 > norepo=True)
721 > @command(b'debugoptADV', [(b'', b'aopt', None, b'option is (ADVANCED)')])
721 > @command(b'debugoptADV', [(b'', b'aopt', None, b'option is (ADVANCED)')])
722 > @command(b'debugoptDEP', [(b'', b'dopt', None, b'option is (DEPRECATED)')])
722 > @command(b'debugoptDEP', [(b'', b'dopt', None, b'option is (DEPRECATED)')])
723 > @command(b'debugoptEXP', [(b'', b'eopt', None, b'option is (EXPERIMENTAL)')])
723 > @command(b'debugoptEXP', [(b'', b'eopt', None, b'option is (EXPERIMENTAL)')])
724 > def nohelp(ui, *args, **kwargs):
724 > def nohelp(ui, *args, **kwargs):
725 > pass
725 > pass
726 >
726 >
727 > def uisetup(ui):
727 > def uisetup(ui):
728 > ui.setconfig(b'alias', b'shellalias', b'!echo hi', b'helpext')
728 > ui.setconfig(b'alias', b'shellalias', b'!echo hi', b'helpext')
729 > ui.setconfig(b'alias', b'hgalias', b'summary', b'helpext')
729 > ui.setconfig(b'alias', b'hgalias', b'summary', b'helpext')
730 >
730 >
731 > EOF
731 > EOF
732 $ echo '[extensions]' >> $HGRCPATH
732 $ echo '[extensions]' >> $HGRCPATH
733 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
733 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
734
734
735 Test for aliases
735 Test for aliases
736
736
737 $ hg help hgalias
737 $ hg help hgalias
738 hg hgalias [--remote]
738 hg hgalias [--remote]
739
739
740 alias for: hg summary
740 alias for: hg summary
741
741
742 summarize working directory state
742 summarize working directory state
743
743
744 This generates a brief summary of the working directory state, including
744 This generates a brief summary of the working directory state, including
745 parents, branch, commit status, phase and available updates.
745 parents, branch, commit status, phase and available updates.
746
746
747 With the --remote option, this will check the default paths for incoming
747 With the --remote option, this will check the default paths for incoming
748 and outgoing changes. This can be time-consuming.
748 and outgoing changes. This can be time-consuming.
749
749
750 Returns 0 on success.
750 Returns 0 on success.
751
751
752 defined by: helpext
752 defined by: helpext
753
753
754 options:
754 options:
755
755
756 --remote check for push and pull
756 --remote check for push and pull
757
757
758 (some details hidden, use --verbose to show complete help)
758 (some details hidden, use --verbose to show complete help)
759
759
760 $ hg help shellalias
760 $ hg help shellalias
761 hg shellalias
761 hg shellalias
762
762
763 shell alias for:
763 shell alias for:
764
764
765 echo hi
765 echo hi
766
766
767 defined by: helpext
767 defined by: helpext
768
768
769 (some details hidden, use --verbose to show complete help)
769 (some details hidden, use --verbose to show complete help)
770
770
771 Test command with no help text
771 Test command with no help text
772
772
773 $ hg help nohelp
773 $ hg help nohelp
774 hg nohelp
774 hg nohelp
775
775
776 (no help text available)
776 (no help text available)
777
777
778 options:
778 options:
779
779
780 --longdesc VALUE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
780 --longdesc VALUE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
781 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (default: 3)
781 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (default: 3)
782 -n -- normal desc
782 -n -- normal desc
783 --newline VALUE line1 line2
783 --newline VALUE line1 line2
784
784
785 (some details hidden, use --verbose to show complete help)
785 (some details hidden, use --verbose to show complete help)
786
786
787 $ hg help -k nohelp
787 $ hg help -k nohelp
788 Commands:
788 Commands:
789
789
790 nohelp hg nohelp
790 nohelp hg nohelp
791
791
792 Extension Commands:
792 Extension Commands:
793
793
794 nohelp (no help text available)
794 nohelp (no help text available)
795
795
796 Test that default list of commands omits extension commands
796 Test that default list of commands omits extension commands
797
797
798 $ hg help
798 $ hg help
799 Mercurial Distributed SCM
799 Mercurial Distributed SCM
800
800
801 list of commands:
801 list of commands:
802
802
803 add add the specified files on the next commit
803 add add the specified files on the next commit
804 addremove add all new files, delete all missing files
804 addremove add all new files, delete all missing files
805 annotate show changeset information by line for each file
805 annotate show changeset information by line for each file
806 archive create an unversioned archive of a repository revision
806 archive create an unversioned archive of a repository revision
807 backout reverse effect of earlier changeset
807 backout reverse effect of earlier changeset
808 bisect subdivision search of changesets
808 bisect subdivision search of changesets
809 bookmarks create a new bookmark or list existing bookmarks
809 bookmarks create a new bookmark or list existing bookmarks
810 branch set or show the current branch name
810 branch set or show the current branch name
811 branches list repository named branches
811 branches list repository named branches
812 bundle create a bundle file
812 bundle create a bundle file
813 cat output the current or given revision of files
813 cat output the current or given revision of files
814 clone make a copy of an existing repository
814 clone make a copy of an existing repository
815 commit commit the specified files or all outstanding changes
815 commit commit the specified files or all outstanding changes
816 config show combined config settings from all hgrc files
816 config show combined config settings from all hgrc files
817 copy mark files as copied for the next commit
817 copy mark files as copied for the next commit
818 diff diff repository (or selected files)
818 diff diff repository (or selected files)
819 export dump the header and diffs for one or more changesets
819 export dump the header and diffs for one or more changesets
820 files list tracked files
820 files list tracked files
821 forget forget the specified files on the next commit
821 forget forget the specified files on the next commit
822 graft copy changes from other branches onto the current branch
822 graft copy changes from other branches onto the current branch
823 grep search revision history for a pattern in specified files
823 grep search revision history for a pattern in specified files
824 heads show branch heads
824 heads show branch heads
825 help show help for a given topic or a help overview
825 help show help for a given topic or a help overview
826 identify identify the working directory or specified revision
826 identify identify the working directory or specified revision
827 import import an ordered set of patches
827 import import an ordered set of patches
828 incoming show new changesets found in source
828 incoming show new changesets found in source
829 init create a new repository in the given directory
829 init create a new repository in the given directory
830 log show revision history of entire repository or files
830 log show revision history of entire repository or files
831 manifest output the current or given revision of the project manifest
831 manifest output the current or given revision of the project manifest
832 merge merge another revision into working directory
832 merge merge another revision into working directory
833 outgoing show changesets not found in the destination
833 outgoing show changesets not found in the destination
834 paths show aliases for remote repositories
834 paths show aliases for remote repositories
835 phase set or show the current phase name
835 phase set or show the current phase name
836 pull pull changes from the specified source
836 pull pull changes from the specified source
837 push push changes to the specified destination
837 push push changes to the specified destination
838 recover roll back an interrupted transaction
838 recover roll back an interrupted transaction
839 remove remove the specified files on the next commit
839 remove remove the specified files on the next commit
840 rename rename files; equivalent of copy + remove
840 rename rename files; equivalent of copy + remove
841 resolve redo merges or set/view the merge status of files
841 resolve redo merges or set/view the merge status of files
842 revert restore files to their checkout state
842 revert restore files to their checkout state
843 root print the root (top) of the current working directory
843 root print the root (top) of the current working directory
844 serve start stand-alone webserver
844 serve start stand-alone webserver
845 status show changed files in the working directory
845 status show changed files in the working directory
846 summary summarize working directory state
846 summary summarize working directory state
847 tag add one or more tags for the current or given revision
847 tag add one or more tags for the current or given revision
848 tags list repository tags
848 tags list repository tags
849 unbundle apply one or more bundle files
849 unbundle apply one or more bundle files
850 update update working directory (or switch revisions)
850 update update working directory (or switch revisions)
851 verify verify the integrity of the repository
851 verify verify the integrity of the repository
852 version output version and copyright information
852 version output version and copyright information
853
853
854 enabled extensions:
854 enabled extensions:
855
855
856 helpext (no help text available)
856 helpext (no help text available)
857
857
858 additional help topics:
858 additional help topics:
859
859
860 bundlespec Bundle File Formats
860 bundlespec Bundle File Formats
861 color Colorizing Outputs
861 color Colorizing Outputs
862 config Configuration Files
862 config Configuration Files
863 dates Date Formats
863 dates Date Formats
864 diffs Diff Formats
864 diffs Diff Formats
865 environment Environment Variables
865 environment Environment Variables
866 extensions Using Additional Features
866 extensions Using Additional Features
867 filesets Specifying File Sets
867 filesets Specifying File Sets
868 glossary Glossary
868 glossary Glossary
869 hgignore Syntax for Mercurial Ignore Files
869 hgignore Syntax for Mercurial Ignore Files
870 hgweb Configuring hgweb
870 hgweb Configuring hgweb
871 internals Technical implementation topics
871 internals Technical implementation topics
872 merge-tools Merge Tools
872 merge-tools Merge Tools
873 pager Pager Support
873 pager Pager Support
874 patterns File Name Patterns
874 patterns File Name Patterns
875 phases Working with Phases
875 phases Working with Phases
876 revisions Specifying Revisions
876 revisions Specifying Revisions
877 scripting Using Mercurial from scripts and automation
877 scripting Using Mercurial from scripts and automation
878 subrepos Subrepositories
878 subrepos Subrepositories
879 templating Template Usage
879 templating Template Usage
880 urls URL Paths
880 urls URL Paths
881
881
882 (use 'hg help -v' to show built-in aliases and global options)
882 (use 'hg help -v' to show built-in aliases and global options)
883
883
884
884
885 Test list of internal help commands
885 Test list of internal help commands
886
886
887 $ hg help debug
887 $ hg help debug
888 debug commands (internal and unsupported):
888 debug commands (internal and unsupported):
889
889
890 debugancestor
890 debugancestor
891 find the ancestor revision of two revisions in a given index
891 find the ancestor revision of two revisions in a given index
892 debugapplystreamclonebundle
892 debugapplystreamclonebundle
893 apply a stream clone bundle file
893 apply a stream clone bundle file
894 debugbuilddag
894 debugbuilddag
895 builds a repo with a given DAG from scratch in the current
895 builds a repo with a given DAG from scratch in the current
896 empty repo
896 empty repo
897 debugbundle lists the contents of a bundle
897 debugbundle lists the contents of a bundle
898 debugcapabilities
899 lists the capabilities of a remote peer
898 debugcheckstate
900 debugcheckstate
899 validate the correctness of the current dirstate
901 validate the correctness of the current dirstate
900 debugcolor show available color, effects or style
902 debugcolor show available color, effects or style
901 debugcommands
903 debugcommands
902 list all available commands and options
904 list all available commands and options
903 debugcomplete
905 debugcomplete
904 returns the completion list associated with the given command
906 returns the completion list associated with the given command
905 debugcreatestreamclonebundle
907 debugcreatestreamclonebundle
906 create a stream clone bundle file
908 create a stream clone bundle file
907 debugdag format the changelog or an index DAG as a concise textual
909 debugdag format the changelog or an index DAG as a concise textual
908 description
910 description
909 debugdata dump the contents of a data file revision
911 debugdata dump the contents of a data file revision
910 debugdate parse and display a date
912 debugdate parse and display a date
911 debugdeltachain
913 debugdeltachain
912 dump information about delta chains in a revlog
914 dump information about delta chains in a revlog
913 debugdirstate
915 debugdirstate
914 show the contents of the current dirstate
916 show the contents of the current dirstate
915 debugdiscovery
917 debugdiscovery
916 runs the changeset discovery protocol in isolation
918 runs the changeset discovery protocol in isolation
917 debugextensions
919 debugextensions
918 show information about active extensions
920 show information about active extensions
919 debugfileset parse and apply a fileset specification
921 debugfileset parse and apply a fileset specification
920 debugfsinfo show information detected about current filesystem
922 debugfsinfo show information detected about current filesystem
921 debuggetbundle
923 debuggetbundle
922 retrieves a bundle from a repo
924 retrieves a bundle from a repo
923 debugignore display the combined ignore pattern and information about
925 debugignore display the combined ignore pattern and information about
924 ignored files
926 ignored files
925 debugindex dump the contents of an index file
927 debugindex dump the contents of an index file
926 debugindexdot
928 debugindexdot
927 dump an index DAG as a graphviz dot file
929 dump an index DAG as a graphviz dot file
928 debuginstall test Mercurial installation
930 debuginstall test Mercurial installation
929 debugknown test whether node ids are known to a repo
931 debugknown test whether node ids are known to a repo
930 debuglocks show or modify state of locks
932 debuglocks show or modify state of locks
931 debugmergestate
933 debugmergestate
932 print merge state
934 print merge state
933 debugnamecomplete
935 debugnamecomplete
934 complete "names" - tags, open branch names, bookmark names
936 complete "names" - tags, open branch names, bookmark names
935 debugobsolete
937 debugobsolete
936 create arbitrary obsolete marker
938 create arbitrary obsolete marker
937 debugoptADV (no help text available)
939 debugoptADV (no help text available)
938 debugoptDEP (no help text available)
940 debugoptDEP (no help text available)
939 debugoptEXP (no help text available)
941 debugoptEXP (no help text available)
940 debugpathcomplete
942 debugpathcomplete
941 complete part or all of a tracked path
943 complete part or all of a tracked path
942 debugpickmergetool
944 debugpickmergetool
943 examine which merge tool is chosen for specified file
945 examine which merge tool is chosen for specified file
944 debugpushkey access the pushkey key/value protocol
946 debugpushkey access the pushkey key/value protocol
945 debugpvec (no help text available)
947 debugpvec (no help text available)
946 debugrebuilddirstate
948 debugrebuilddirstate
947 rebuild the dirstate as it would look like for the given
949 rebuild the dirstate as it would look like for the given
948 revision
950 revision
949 debugrebuildfncache
951 debugrebuildfncache
950 rebuild the fncache file
952 rebuild the fncache file
951 debugrename dump rename information
953 debugrename dump rename information
952 debugrevlog show data and statistics about a revlog
954 debugrevlog show data and statistics about a revlog
953 debugrevspec parse and apply a revision specification
955 debugrevspec parse and apply a revision specification
954 debugsetparents
956 debugsetparents
955 manually set the parents of the current working directory
957 manually set the parents of the current working directory
956 debugssl test a secure connection to a server
958 debugssl test a secure connection to a server
957 debugsub (no help text available)
959 debugsub (no help text available)
958 debugsuccessorssets
960 debugsuccessorssets
959 show set of successors for revision
961 show set of successors for revision
960 debugtemplate
962 debugtemplate
961 parse and apply a template
963 parse and apply a template
962 debugupdatecaches
964 debugupdatecaches
963 warm all known caches in the repository
965 warm all known caches in the repository
964 debugupgraderepo
966 debugupgraderepo
965 upgrade a repository to use different features
967 upgrade a repository to use different features
966 debugwalk show how files match on given patterns
968 debugwalk show how files match on given patterns
967 debugwireargs
969 debugwireargs
968 (no help text available)
970 (no help text available)
969
971
970 (use 'hg help -v debug' to show built-in aliases and global options)
972 (use 'hg help -v debug' to show built-in aliases and global options)
971
973
972 internals topic renders index of available sub-topics
974 internals topic renders index of available sub-topics
973
975
974 $ hg help internals
976 $ hg help internals
975 Technical implementation topics
977 Technical implementation topics
976 """""""""""""""""""""""""""""""
978 """""""""""""""""""""""""""""""
977
979
978 To access a subtopic, use "hg help internals.{subtopic-name}"
980 To access a subtopic, use "hg help internals.{subtopic-name}"
979
981
980 bundles Bundles
982 bundles Bundles
981 censor Censor
983 censor Censor
982 changegroups Changegroups
984 changegroups Changegroups
983 config Config Registrar
985 config Config Registrar
984 requirements Repository Requirements
986 requirements Repository Requirements
985 revlogs Revision Logs
987 revlogs Revision Logs
986 wireprotocol Wire Protocol
988 wireprotocol Wire Protocol
987
989
988 sub-topics can be accessed
990 sub-topics can be accessed
989
991
990 $ hg help internals.changegroups
992 $ hg help internals.changegroups
991 Changegroups
993 Changegroups
992 """"""""""""
994 """"""""""""
993
995
994 Changegroups are representations of repository revlog data, specifically
996 Changegroups are representations of repository revlog data, specifically
995 the changelog data, root/flat manifest data, treemanifest data, and
997 the changelog data, root/flat manifest data, treemanifest data, and
996 filelogs.
998 filelogs.
997
999
998 There are 3 versions of changegroups: "1", "2", and "3". From a high-
1000 There are 3 versions of changegroups: "1", "2", and "3". From a high-
999 level, versions "1" and "2" are almost exactly the same, with the only
1001 level, versions "1" and "2" are almost exactly the same, with the only
1000 difference being an additional item in the *delta header*. Version "3"
1002 difference being an additional item in the *delta header*. Version "3"
1001 adds support for revlog flags in the *delta header* and optionally
1003 adds support for revlog flags in the *delta header* and optionally
1002 exchanging treemanifests (enabled by setting an option on the
1004 exchanging treemanifests (enabled by setting an option on the
1003 "changegroup" part in the bundle2).
1005 "changegroup" part in the bundle2).
1004
1006
1005 Changegroups when not exchanging treemanifests consist of 3 logical
1007 Changegroups when not exchanging treemanifests consist of 3 logical
1006 segments:
1008 segments:
1007
1009
1008 +---------------------------------+
1010 +---------------------------------+
1009 | | | |
1011 | | | |
1010 | changeset | manifest | filelogs |
1012 | changeset | manifest | filelogs |
1011 | | | |
1013 | | | |
1012 | | | |
1014 | | | |
1013 +---------------------------------+
1015 +---------------------------------+
1014
1016
1015 When exchanging treemanifests, there are 4 logical segments:
1017 When exchanging treemanifests, there are 4 logical segments:
1016
1018
1017 +-------------------------------------------------+
1019 +-------------------------------------------------+
1018 | | | | |
1020 | | | | |
1019 | changeset | root | treemanifests | filelogs |
1021 | changeset | root | treemanifests | filelogs |
1020 | | manifest | | |
1022 | | manifest | | |
1021 | | | | |
1023 | | | | |
1022 +-------------------------------------------------+
1024 +-------------------------------------------------+
1023
1025
1024 The principle building block of each segment is a *chunk*. A *chunk* is a
1026 The principle building block of each segment is a *chunk*. A *chunk* is a
1025 framed piece of data:
1027 framed piece of data:
1026
1028
1027 +---------------------------------------+
1029 +---------------------------------------+
1028 | | |
1030 | | |
1029 | length | data |
1031 | length | data |
1030 | (4 bytes) | (<length - 4> bytes) |
1032 | (4 bytes) | (<length - 4> bytes) |
1031 | | |
1033 | | |
1032 +---------------------------------------+
1034 +---------------------------------------+
1033
1035
1034 All integers are big-endian signed integers. Each chunk starts with a
1036 All integers are big-endian signed integers. Each chunk starts with a
1035 32-bit integer indicating the length of the entire chunk (including the
1037 32-bit integer indicating the length of the entire chunk (including the
1036 length field itself).
1038 length field itself).
1037
1039
1038 There is a special case chunk that has a value of 0 for the length
1040 There is a special case chunk that has a value of 0 for the length
1039 ("0x00000000"). We call this an *empty chunk*.
1041 ("0x00000000"). We call this an *empty chunk*.
1040
1042
1041 Delta Groups
1043 Delta Groups
1042 ============
1044 ============
1043
1045
1044 A *delta group* expresses the content of a revlog as a series of deltas,
1046 A *delta group* expresses the content of a revlog as a series of deltas,
1045 or patches against previous revisions.
1047 or patches against previous revisions.
1046
1048
1047 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
1049 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
1048 to signal the end of the delta group:
1050 to signal the end of the delta group:
1049
1051
1050 +------------------------------------------------------------------------+
1052 +------------------------------------------------------------------------+
1051 | | | | | |
1053 | | | | | |
1052 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
1054 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
1053 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
1055 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
1054 | | | | | |
1056 | | | | | |
1055 +------------------------------------------------------------------------+
1057 +------------------------------------------------------------------------+
1056
1058
1057 Each *chunk*'s data consists of the following:
1059 Each *chunk*'s data consists of the following:
1058
1060
1059 +---------------------------------------+
1061 +---------------------------------------+
1060 | | |
1062 | | |
1061 | delta header | delta data |
1063 | delta header | delta data |
1062 | (various by version) | (various) |
1064 | (various by version) | (various) |
1063 | | |
1065 | | |
1064 +---------------------------------------+
1066 +---------------------------------------+
1065
1067
1066 The *delta data* is a series of *delta*s that describe a diff from an
1068 The *delta data* is a series of *delta*s that describe a diff from an
1067 existing entry (either that the recipient already has, or previously
1069 existing entry (either that the recipient already has, or previously
1068 specified in the bundle/changegroup).
1070 specified in the bundle/changegroup).
1069
1071
1070 The *delta header* is different between versions "1", "2", and "3" of the
1072 The *delta header* is different between versions "1", "2", and "3" of the
1071 changegroup format.
1073 changegroup format.
1072
1074
1073 Version 1 (headerlen=80):
1075 Version 1 (headerlen=80):
1074
1076
1075 +------------------------------------------------------+
1077 +------------------------------------------------------+
1076 | | | | |
1078 | | | | |
1077 | node | p1 node | p2 node | link node |
1079 | node | p1 node | p2 node | link node |
1078 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1080 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1079 | | | | |
1081 | | | | |
1080 +------------------------------------------------------+
1082 +------------------------------------------------------+
1081
1083
1082 Version 2 (headerlen=100):
1084 Version 2 (headerlen=100):
1083
1085
1084 +------------------------------------------------------------------+
1086 +------------------------------------------------------------------+
1085 | | | | | |
1087 | | | | | |
1086 | node | p1 node | p2 node | base node | link node |
1088 | node | p1 node | p2 node | base node | link node |
1087 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1089 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1088 | | | | | |
1090 | | | | | |
1089 +------------------------------------------------------------------+
1091 +------------------------------------------------------------------+
1090
1092
1091 Version 3 (headerlen=102):
1093 Version 3 (headerlen=102):
1092
1094
1093 +------------------------------------------------------------------------------+
1095 +------------------------------------------------------------------------------+
1094 | | | | | | |
1096 | | | | | | |
1095 | node | p1 node | p2 node | base node | link node | flags |
1097 | node | p1 node | p2 node | base node | link node | flags |
1096 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
1098 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
1097 | | | | | | |
1099 | | | | | | |
1098 +------------------------------------------------------------------------------+
1100 +------------------------------------------------------------------------------+
1099
1101
1100 The *delta data* consists of "chunklen - 4 - headerlen" bytes, which
1102 The *delta data* consists of "chunklen - 4 - headerlen" bytes, which
1101 contain a series of *delta*s, densely packed (no separators). These deltas
1103 contain a series of *delta*s, densely packed (no separators). These deltas
1102 describe a diff from an existing entry (either that the recipient already
1104 describe a diff from an existing entry (either that the recipient already
1103 has, or previously specified in the bundle/changegroup). The format is
1105 has, or previously specified in the bundle/changegroup). The format is
1104 described more fully in "hg help internals.bdiff", but briefly:
1106 described more fully in "hg help internals.bdiff", but briefly:
1105
1107
1106 +---------------------------------------------------------------+
1108 +---------------------------------------------------------------+
1107 | | | | |
1109 | | | | |
1108 | start offset | end offset | new length | content |
1110 | start offset | end offset | new length | content |
1109 | (4 bytes) | (4 bytes) | (4 bytes) | (<new length> bytes) |
1111 | (4 bytes) | (4 bytes) | (4 bytes) | (<new length> bytes) |
1110 | | | | |
1112 | | | | |
1111 +---------------------------------------------------------------+
1113 +---------------------------------------------------------------+
1112
1114
1113 Please note that the length field in the delta data does *not* include
1115 Please note that the length field in the delta data does *not* include
1114 itself.
1116 itself.
1115
1117
1116 In version 1, the delta is always applied against the previous node from
1118 In version 1, the delta is always applied against the previous node from
1117 the changegroup or the first parent if this is the first entry in the
1119 the changegroup or the first parent if this is the first entry in the
1118 changegroup.
1120 changegroup.
1119
1121
1120 In version 2 and up, the delta base node is encoded in the entry in the
1122 In version 2 and up, the delta base node is encoded in the entry in the
1121 changegroup. This allows the delta to be expressed against any parent,
1123 changegroup. This allows the delta to be expressed against any parent,
1122 which can result in smaller deltas and more efficient encoding of data.
1124 which can result in smaller deltas and more efficient encoding of data.
1123
1125
1124 Changeset Segment
1126 Changeset Segment
1125 =================
1127 =================
1126
1128
1127 The *changeset segment* consists of a single *delta group* holding
1129 The *changeset segment* consists of a single *delta group* holding
1128 changelog data. The *empty chunk* at the end of the *delta group* denotes
1130 changelog data. The *empty chunk* at the end of the *delta group* denotes
1129 the boundary to the *manifest segment*.
1131 the boundary to the *manifest segment*.
1130
1132
1131 Manifest Segment
1133 Manifest Segment
1132 ================
1134 ================
1133
1135
1134 The *manifest segment* consists of a single *delta group* holding manifest
1136 The *manifest segment* consists of a single *delta group* holding manifest
1135 data. If treemanifests are in use, it contains only the manifest for the
1137 data. If treemanifests are in use, it contains only the manifest for the
1136 root directory of the repository. Otherwise, it contains the entire
1138 root directory of the repository. Otherwise, it contains the entire
1137 manifest data. The *empty chunk* at the end of the *delta group* denotes
1139 manifest data. The *empty chunk* at the end of the *delta group* denotes
1138 the boundary to the next segment (either the *treemanifests segment* or
1140 the boundary to the next segment (either the *treemanifests segment* or
1139 the *filelogs segment*, depending on version and the request options).
1141 the *filelogs segment*, depending on version and the request options).
1140
1142
1141 Treemanifests Segment
1143 Treemanifests Segment
1142 ---------------------
1144 ---------------------
1143
1145
1144 The *treemanifests segment* only exists in changegroup version "3", and
1146 The *treemanifests segment* only exists in changegroup version "3", and
1145 only if the 'treemanifest' param is part of the bundle2 changegroup part
1147 only if the 'treemanifest' param is part of the bundle2 changegroup part
1146 (it is not possible to use changegroup version 3 outside of bundle2).
1148 (it is not possible to use changegroup version 3 outside of bundle2).
1147 Aside from the filenames in the *treemanifests segment* containing a
1149 Aside from the filenames in the *treemanifests segment* containing a
1148 trailing "/" character, it behaves identically to the *filelogs segment*
1150 trailing "/" character, it behaves identically to the *filelogs segment*
1149 (see below). The final sub-segment is followed by an *empty chunk*
1151 (see below). The final sub-segment is followed by an *empty chunk*
1150 (logically, a sub-segment with filename size 0). This denotes the boundary
1152 (logically, a sub-segment with filename size 0). This denotes the boundary
1151 to the *filelogs segment*.
1153 to the *filelogs segment*.
1152
1154
1153 Filelogs Segment
1155 Filelogs Segment
1154 ================
1156 ================
1155
1157
1156 The *filelogs segment* consists of multiple sub-segments, each
1158 The *filelogs segment* consists of multiple sub-segments, each
1157 corresponding to an individual file whose data is being described:
1159 corresponding to an individual file whose data is being described:
1158
1160
1159 +--------------------------------------------------+
1161 +--------------------------------------------------+
1160 | | | | | |
1162 | | | | | |
1161 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
1163 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
1162 | | | | | (4 bytes) |
1164 | | | | | (4 bytes) |
1163 | | | | | |
1165 | | | | | |
1164 +--------------------------------------------------+
1166 +--------------------------------------------------+
1165
1167
1166 The final filelog sub-segment is followed by an *empty chunk* (logically,
1168 The final filelog sub-segment is followed by an *empty chunk* (logically,
1167 a sub-segment with filename size 0). This denotes the end of the segment
1169 a sub-segment with filename size 0). This denotes the end of the segment
1168 and of the overall changegroup.
1170 and of the overall changegroup.
1169
1171
1170 Each filelog sub-segment consists of the following:
1172 Each filelog sub-segment consists of the following:
1171
1173
1172 +------------------------------------------------------+
1174 +------------------------------------------------------+
1173 | | | |
1175 | | | |
1174 | filename length | filename | delta group |
1176 | filename length | filename | delta group |
1175 | (4 bytes) | (<length - 4> bytes) | (various) |
1177 | (4 bytes) | (<length - 4> bytes) | (various) |
1176 | | | |
1178 | | | |
1177 +------------------------------------------------------+
1179 +------------------------------------------------------+
1178
1180
1179 That is, a *chunk* consisting of the filename (not terminated or padded)
1181 That is, a *chunk* consisting of the filename (not terminated or padded)
1180 followed by N chunks constituting the *delta group* for this file. The
1182 followed by N chunks constituting the *delta group* for this file. The
1181 *empty chunk* at the end of each *delta group* denotes the boundary to the
1183 *empty chunk* at the end of each *delta group* denotes the boundary to the
1182 next filelog sub-segment.
1184 next filelog sub-segment.
1183
1185
1184 Test list of commands with command with no help text
1186 Test list of commands with command with no help text
1185
1187
1186 $ hg help helpext
1188 $ hg help helpext
1187 helpext extension - no help text available
1189 helpext extension - no help text available
1188
1190
1189 list of commands:
1191 list of commands:
1190
1192
1191 nohelp (no help text available)
1193 nohelp (no help text available)
1192
1194
1193 (use 'hg help -v helpext' to show built-in aliases and global options)
1195 (use 'hg help -v helpext' to show built-in aliases and global options)
1194
1196
1195
1197
1196 test advanced, deprecated and experimental options are hidden in command help
1198 test advanced, deprecated and experimental options are hidden in command help
1197 $ hg help debugoptADV
1199 $ hg help debugoptADV
1198 hg debugoptADV
1200 hg debugoptADV
1199
1201
1200 (no help text available)
1202 (no help text available)
1201
1203
1202 options:
1204 options:
1203
1205
1204 (some details hidden, use --verbose to show complete help)
1206 (some details hidden, use --verbose to show complete help)
1205 $ hg help debugoptDEP
1207 $ hg help debugoptDEP
1206 hg debugoptDEP
1208 hg debugoptDEP
1207
1209
1208 (no help text available)
1210 (no help text available)
1209
1211
1210 options:
1212 options:
1211
1213
1212 (some details hidden, use --verbose to show complete help)
1214 (some details hidden, use --verbose to show complete help)
1213
1215
1214 $ hg help debugoptEXP
1216 $ hg help debugoptEXP
1215 hg debugoptEXP
1217 hg debugoptEXP
1216
1218
1217 (no help text available)
1219 (no help text available)
1218
1220
1219 options:
1221 options:
1220
1222
1221 (some details hidden, use --verbose to show complete help)
1223 (some details hidden, use --verbose to show complete help)
1222
1224
1223 test advanced, deprecated and experimental options are shown with -v
1225 test advanced, deprecated and experimental options are shown with -v
1224 $ hg help -v debugoptADV | grep aopt
1226 $ hg help -v debugoptADV | grep aopt
1225 --aopt option is (ADVANCED)
1227 --aopt option is (ADVANCED)
1226 $ hg help -v debugoptDEP | grep dopt
1228 $ hg help -v debugoptDEP | grep dopt
1227 --dopt option is (DEPRECATED)
1229 --dopt option is (DEPRECATED)
1228 $ hg help -v debugoptEXP | grep eopt
1230 $ hg help -v debugoptEXP | grep eopt
1229 --eopt option is (EXPERIMENTAL)
1231 --eopt option is (EXPERIMENTAL)
1230
1232
1231 #if gettext
1233 #if gettext
1232 test deprecated option is hidden with translation with untranslated description
1234 test deprecated option is hidden with translation with untranslated description
1233 (use many globy for not failing on changed transaction)
1235 (use many globy for not failing on changed transaction)
1234 $ LANGUAGE=sv hg help debugoptDEP
1236 $ LANGUAGE=sv hg help debugoptDEP
1235 hg debugoptDEP
1237 hg debugoptDEP
1236
1238
1237 (*) (glob)
1239 (*) (glob)
1238
1240
1239 options:
1241 options:
1240
1242
1241 (some details hidden, use --verbose to show complete help)
1243 (some details hidden, use --verbose to show complete help)
1242 #endif
1244 #endif
1243
1245
1244 Test commands that collide with topics (issue4240)
1246 Test commands that collide with topics (issue4240)
1245
1247
1246 $ hg config -hq
1248 $ hg config -hq
1247 hg config [-u] [NAME]...
1249 hg config [-u] [NAME]...
1248
1250
1249 show combined config settings from all hgrc files
1251 show combined config settings from all hgrc files
1250 $ hg showconfig -hq
1252 $ hg showconfig -hq
1251 hg config [-u] [NAME]...
1253 hg config [-u] [NAME]...
1252
1254
1253 show combined config settings from all hgrc files
1255 show combined config settings from all hgrc files
1254
1256
1255 Test a help topic
1257 Test a help topic
1256
1258
1257 $ hg help dates
1259 $ hg help dates
1258 Date Formats
1260 Date Formats
1259 """"""""""""
1261 """"""""""""
1260
1262
1261 Some commands allow the user to specify a date, e.g.:
1263 Some commands allow the user to specify a date, e.g.:
1262
1264
1263 - backout, commit, import, tag: Specify the commit date.
1265 - backout, commit, import, tag: Specify the commit date.
1264 - log, revert, update: Select revision(s) by date.
1266 - log, revert, update: Select revision(s) by date.
1265
1267
1266 Many date formats are valid. Here are some examples:
1268 Many date formats are valid. Here are some examples:
1267
1269
1268 - "Wed Dec 6 13:18:29 2006" (local timezone assumed)
1270 - "Wed Dec 6 13:18:29 2006" (local timezone assumed)
1269 - "Dec 6 13:18 -0600" (year assumed, time offset provided)
1271 - "Dec 6 13:18 -0600" (year assumed, time offset provided)
1270 - "Dec 6 13:18 UTC" (UTC and GMT are aliases for +0000)
1272 - "Dec 6 13:18 UTC" (UTC and GMT are aliases for +0000)
1271 - "Dec 6" (midnight)
1273 - "Dec 6" (midnight)
1272 - "13:18" (today assumed)
1274 - "13:18" (today assumed)
1273 - "3:39" (3:39AM assumed)
1275 - "3:39" (3:39AM assumed)
1274 - "3:39pm" (15:39)
1276 - "3:39pm" (15:39)
1275 - "2006-12-06 13:18:29" (ISO 8601 format)
1277 - "2006-12-06 13:18:29" (ISO 8601 format)
1276 - "2006-12-6 13:18"
1278 - "2006-12-6 13:18"
1277 - "2006-12-6"
1279 - "2006-12-6"
1278 - "12-6"
1280 - "12-6"
1279 - "12/6"
1281 - "12/6"
1280 - "12/6/6" (Dec 6 2006)
1282 - "12/6/6" (Dec 6 2006)
1281 - "today" (midnight)
1283 - "today" (midnight)
1282 - "yesterday" (midnight)
1284 - "yesterday" (midnight)
1283 - "now" - right now
1285 - "now" - right now
1284
1286
1285 Lastly, there is Mercurial's internal format:
1287 Lastly, there is Mercurial's internal format:
1286
1288
1287 - "1165411109 0" (Wed Dec 6 13:18:29 2006 UTC)
1289 - "1165411109 0" (Wed Dec 6 13:18:29 2006 UTC)
1288
1290
1289 This is the internal representation format for dates. The first number is
1291 This is the internal representation format for dates. The first number is
1290 the number of seconds since the epoch (1970-01-01 00:00 UTC). The second
1292 the number of seconds since the epoch (1970-01-01 00:00 UTC). The second
1291 is the offset of the local timezone, in seconds west of UTC (negative if
1293 is the offset of the local timezone, in seconds west of UTC (negative if
1292 the timezone is east of UTC).
1294 the timezone is east of UTC).
1293
1295
1294 The log command also accepts date ranges:
1296 The log command also accepts date ranges:
1295
1297
1296 - "<DATE" - at or before a given date/time
1298 - "<DATE" - at or before a given date/time
1297 - ">DATE" - on or after a given date/time
1299 - ">DATE" - on or after a given date/time
1298 - "DATE to DATE" - a date range, inclusive
1300 - "DATE to DATE" - a date range, inclusive
1299 - "-DAYS" - within a given number of days of today
1301 - "-DAYS" - within a given number of days of today
1300
1302
1301 Test repeated config section name
1303 Test repeated config section name
1302
1304
1303 $ hg help config.host
1305 $ hg help config.host
1304 "http_proxy.host"
1306 "http_proxy.host"
1305 Host name and (optional) port of the proxy server, for example
1307 Host name and (optional) port of the proxy server, for example
1306 "myproxy:8000".
1308 "myproxy:8000".
1307
1309
1308 "smtp.host"
1310 "smtp.host"
1309 Host name of mail server, e.g. "mail.example.com".
1311 Host name of mail server, e.g. "mail.example.com".
1310
1312
1311 Unrelated trailing paragraphs shouldn't be included
1313 Unrelated trailing paragraphs shouldn't be included
1312
1314
1313 $ hg help config.extramsg | grep '^$'
1315 $ hg help config.extramsg | grep '^$'
1314
1316
1315
1317
1316 Test capitalized section name
1318 Test capitalized section name
1317
1319
1318 $ hg help scripting.HGPLAIN > /dev/null
1320 $ hg help scripting.HGPLAIN > /dev/null
1319
1321
1320 Help subsection:
1322 Help subsection:
1321
1323
1322 $ hg help config.charsets |grep "Email example:" > /dev/null
1324 $ hg help config.charsets |grep "Email example:" > /dev/null
1323 [1]
1325 [1]
1324
1326
1325 Show nested definitions
1327 Show nested definitions
1326 ("profiling.type"[break]"ls"[break]"stat"[break])
1328 ("profiling.type"[break]"ls"[break]"stat"[break])
1327
1329
1328 $ hg help config.type | egrep '^$'|wc -l
1330 $ hg help config.type | egrep '^$'|wc -l
1329 \s*3 (re)
1331 \s*3 (re)
1330
1332
1331 Separate sections from subsections
1333 Separate sections from subsections
1332
1334
1333 $ hg help config.format | egrep '^ ("|-)|^\s*$' | uniq
1335 $ hg help config.format | egrep '^ ("|-)|^\s*$' | uniq
1334 "format"
1336 "format"
1335 --------
1337 --------
1336
1338
1337 "usegeneraldelta"
1339 "usegeneraldelta"
1338
1340
1339 "dotencode"
1341 "dotencode"
1340
1342
1341 "usefncache"
1343 "usefncache"
1342
1344
1343 "usestore"
1345 "usestore"
1344
1346
1345 "profiling"
1347 "profiling"
1346 -----------
1348 -----------
1347
1349
1348 "format"
1350 "format"
1349
1351
1350 "progress"
1352 "progress"
1351 ----------
1353 ----------
1352
1354
1353 "format"
1355 "format"
1354
1356
1355
1357
1356 Last item in help config.*:
1358 Last item in help config.*:
1357
1359
1358 $ hg help config.`hg help config|grep '^ "'| \
1360 $ hg help config.`hg help config|grep '^ "'| \
1359 > tail -1|sed 's![ "]*!!g'`| \
1361 > tail -1|sed 's![ "]*!!g'`| \
1360 > grep 'hg help -c config' > /dev/null
1362 > grep 'hg help -c config' > /dev/null
1361 [1]
1363 [1]
1362
1364
1363 note to use help -c for general hg help config:
1365 note to use help -c for general hg help config:
1364
1366
1365 $ hg help config |grep 'hg help -c config' > /dev/null
1367 $ hg help config |grep 'hg help -c config' > /dev/null
1366
1368
1367 Test templating help
1369 Test templating help
1368
1370
1369 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
1371 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
1370 desc String. The text of the changeset description.
1372 desc String. The text of the changeset description.
1371 diffstat String. Statistics of changes with the following format:
1373 diffstat String. Statistics of changes with the following format:
1372 firstline Any text. Returns the first line of text.
1374 firstline Any text. Returns the first line of text.
1373 nonempty Any text. Returns '(none)' if the string is empty.
1375 nonempty Any text. Returns '(none)' if the string is empty.
1374
1376
1375 Test deprecated items
1377 Test deprecated items
1376
1378
1377 $ hg help -v templating | grep currentbookmark
1379 $ hg help -v templating | grep currentbookmark
1378 currentbookmark
1380 currentbookmark
1379 $ hg help templating | (grep currentbookmark || true)
1381 $ hg help templating | (grep currentbookmark || true)
1380
1382
1381 Test help hooks
1383 Test help hooks
1382
1384
1383 $ cat > helphook1.py <<EOF
1385 $ cat > helphook1.py <<EOF
1384 > from mercurial import help
1386 > from mercurial import help
1385 >
1387 >
1386 > def rewrite(ui, topic, doc):
1388 > def rewrite(ui, topic, doc):
1387 > return doc + '\nhelphook1\n'
1389 > return doc + '\nhelphook1\n'
1388 >
1390 >
1389 > def extsetup(ui):
1391 > def extsetup(ui):
1390 > help.addtopichook('revisions', rewrite)
1392 > help.addtopichook('revisions', rewrite)
1391 > EOF
1393 > EOF
1392 $ cat > helphook2.py <<EOF
1394 $ cat > helphook2.py <<EOF
1393 > from mercurial import help
1395 > from mercurial import help
1394 >
1396 >
1395 > def rewrite(ui, topic, doc):
1397 > def rewrite(ui, topic, doc):
1396 > return doc + '\nhelphook2\n'
1398 > return doc + '\nhelphook2\n'
1397 >
1399 >
1398 > def extsetup(ui):
1400 > def extsetup(ui):
1399 > help.addtopichook('revisions', rewrite)
1401 > help.addtopichook('revisions', rewrite)
1400 > EOF
1402 > EOF
1401 $ echo '[extensions]' >> $HGRCPATH
1403 $ echo '[extensions]' >> $HGRCPATH
1402 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
1404 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
1403 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
1405 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
1404 $ hg help revsets | grep helphook
1406 $ hg help revsets | grep helphook
1405 helphook1
1407 helphook1
1406 helphook2
1408 helphook2
1407
1409
1408 help -c should only show debug --debug
1410 help -c should only show debug --debug
1409
1411
1410 $ hg help -c --debug|egrep debug|wc -l|egrep '^\s*0\s*$'
1412 $ hg help -c --debug|egrep debug|wc -l|egrep '^\s*0\s*$'
1411 [1]
1413 [1]
1412
1414
1413 help -c should only show deprecated for -v
1415 help -c should only show deprecated for -v
1414
1416
1415 $ hg help -c -v|egrep DEPRECATED|wc -l|egrep '^\s*0\s*$'
1417 $ hg help -c -v|egrep DEPRECATED|wc -l|egrep '^\s*0\s*$'
1416 [1]
1418 [1]
1417
1419
1418 Test -s / --system
1420 Test -s / --system
1419
1421
1420 $ hg help config.files -s windows |grep 'etc/mercurial' | \
1422 $ hg help config.files -s windows |grep 'etc/mercurial' | \
1421 > wc -l | sed -e 's/ //g'
1423 > wc -l | sed -e 's/ //g'
1422 0
1424 0
1423 $ hg help config.files --system unix | grep 'USER' | \
1425 $ hg help config.files --system unix | grep 'USER' | \
1424 > wc -l | sed -e 's/ //g'
1426 > wc -l | sed -e 's/ //g'
1425 0
1427 0
1426
1428
1427 Test -e / -c / -k combinations
1429 Test -e / -c / -k combinations
1428
1430
1429 $ hg help -c|egrep '^[A-Z].*:|^ debug'
1431 $ hg help -c|egrep '^[A-Z].*:|^ debug'
1430 Commands:
1432 Commands:
1431 $ hg help -e|egrep '^[A-Z].*:|^ debug'
1433 $ hg help -e|egrep '^[A-Z].*:|^ debug'
1432 Extensions:
1434 Extensions:
1433 $ hg help -k|egrep '^[A-Z].*:|^ debug'
1435 $ hg help -k|egrep '^[A-Z].*:|^ debug'
1434 Topics:
1436 Topics:
1435 Commands:
1437 Commands:
1436 Extensions:
1438 Extensions:
1437 Extension Commands:
1439 Extension Commands:
1438 $ hg help -c schemes
1440 $ hg help -c schemes
1439 abort: no such help topic: schemes
1441 abort: no such help topic: schemes
1440 (try 'hg help --keyword schemes')
1442 (try 'hg help --keyword schemes')
1441 [255]
1443 [255]
1442 $ hg help -e schemes |head -1
1444 $ hg help -e schemes |head -1
1443 schemes extension - extend schemes with shortcuts to repository swarms
1445 schemes extension - extend schemes with shortcuts to repository swarms
1444 $ hg help -c -k dates |egrep '^(Topics|Extensions|Commands):'
1446 $ hg help -c -k dates |egrep '^(Topics|Extensions|Commands):'
1445 Commands:
1447 Commands:
1446 $ hg help -e -k a |egrep '^(Topics|Extensions|Commands):'
1448 $ hg help -e -k a |egrep '^(Topics|Extensions|Commands):'
1447 Extensions:
1449 Extensions:
1448 $ hg help -e -c -k date |egrep '^(Topics|Extensions|Commands):'
1450 $ hg help -e -c -k date |egrep '^(Topics|Extensions|Commands):'
1449 Extensions:
1451 Extensions:
1450 Commands:
1452 Commands:
1451 $ hg help -c commit > /dev/null
1453 $ hg help -c commit > /dev/null
1452 $ hg help -e -c commit > /dev/null
1454 $ hg help -e -c commit > /dev/null
1453 $ hg help -e commit > /dev/null
1455 $ hg help -e commit > /dev/null
1454 abort: no such help topic: commit
1456 abort: no such help topic: commit
1455 (try 'hg help --keyword commit')
1457 (try 'hg help --keyword commit')
1456 [255]
1458 [255]
1457
1459
1458 Test keyword search help
1460 Test keyword search help
1459
1461
1460 $ cat > prefixedname.py <<EOF
1462 $ cat > prefixedname.py <<EOF
1461 > '''matched against word "clone"
1463 > '''matched against word "clone"
1462 > '''
1464 > '''
1463 > EOF
1465 > EOF
1464 $ echo '[extensions]' >> $HGRCPATH
1466 $ echo '[extensions]' >> $HGRCPATH
1465 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
1467 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
1466 $ hg help -k clone
1468 $ hg help -k clone
1467 Topics:
1469 Topics:
1468
1470
1469 config Configuration Files
1471 config Configuration Files
1470 extensions Using Additional Features
1472 extensions Using Additional Features
1471 glossary Glossary
1473 glossary Glossary
1472 phases Working with Phases
1474 phases Working with Phases
1473 subrepos Subrepositories
1475 subrepos Subrepositories
1474 urls URL Paths
1476 urls URL Paths
1475
1477
1476 Commands:
1478 Commands:
1477
1479
1478 bookmarks create a new bookmark or list existing bookmarks
1480 bookmarks create a new bookmark or list existing bookmarks
1479 clone make a copy of an existing repository
1481 clone make a copy of an existing repository
1480 paths show aliases for remote repositories
1482 paths show aliases for remote repositories
1481 update update working directory (or switch revisions)
1483 update update working directory (or switch revisions)
1482
1484
1483 Extensions:
1485 Extensions:
1484
1486
1485 clonebundles advertise pre-generated bundles to seed clones
1487 clonebundles advertise pre-generated bundles to seed clones
1486 prefixedname matched against word "clone"
1488 prefixedname matched against word "clone"
1487 relink recreates hardlinks between repository clones
1489 relink recreates hardlinks between repository clones
1488
1490
1489 Extension Commands:
1491 Extension Commands:
1490
1492
1491 qclone clone main and patch repository at same time
1493 qclone clone main and patch repository at same time
1492
1494
1493 Test unfound topic
1495 Test unfound topic
1494
1496
1495 $ hg help nonexistingtopicthatwillneverexisteverever
1497 $ hg help nonexistingtopicthatwillneverexisteverever
1496 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
1498 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
1497 (try 'hg help --keyword nonexistingtopicthatwillneverexisteverever')
1499 (try 'hg help --keyword nonexistingtopicthatwillneverexisteverever')
1498 [255]
1500 [255]
1499
1501
1500 Test unfound keyword
1502 Test unfound keyword
1501
1503
1502 $ hg help --keyword nonexistingwordthatwillneverexisteverever
1504 $ hg help --keyword nonexistingwordthatwillneverexisteverever
1503 abort: no matches
1505 abort: no matches
1504 (try 'hg help' for a list of topics)
1506 (try 'hg help' for a list of topics)
1505 [255]
1507 [255]
1506
1508
1507 Test omit indicating for help
1509 Test omit indicating for help
1508
1510
1509 $ cat > addverboseitems.py <<EOF
1511 $ cat > addverboseitems.py <<EOF
1510 > '''extension to test omit indicating.
1512 > '''extension to test omit indicating.
1511 >
1513 >
1512 > This paragraph is never omitted (for extension)
1514 > This paragraph is never omitted (for extension)
1513 >
1515 >
1514 > .. container:: verbose
1516 > .. container:: verbose
1515 >
1517 >
1516 > This paragraph is omitted,
1518 > This paragraph is omitted,
1517 > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension)
1519 > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension)
1518 >
1520 >
1519 > This paragraph is never omitted, too (for extension)
1521 > This paragraph is never omitted, too (for extension)
1520 > '''
1522 > '''
1521 > from __future__ import absolute_import
1523 > from __future__ import absolute_import
1522 > from mercurial import commands, help
1524 > from mercurial import commands, help
1523 > testtopic = """This paragraph is never omitted (for topic).
1525 > testtopic = """This paragraph is never omitted (for topic).
1524 >
1526 >
1525 > .. container:: verbose
1527 > .. container:: verbose
1526 >
1528 >
1527 > This paragraph is omitted,
1529 > This paragraph is omitted,
1528 > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic)
1530 > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic)
1529 >
1531 >
1530 > This paragraph is never omitted, too (for topic)
1532 > This paragraph is never omitted, too (for topic)
1531 > """
1533 > """
1532 > def extsetup(ui):
1534 > def extsetup(ui):
1533 > help.helptable.append((["topic-containing-verbose"],
1535 > help.helptable.append((["topic-containing-verbose"],
1534 > "This is the topic to test omit indicating.",
1536 > "This is the topic to test omit indicating.",
1535 > lambda ui: testtopic))
1537 > lambda ui: testtopic))
1536 > EOF
1538 > EOF
1537 $ echo '[extensions]' >> $HGRCPATH
1539 $ echo '[extensions]' >> $HGRCPATH
1538 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1540 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1539 $ hg help addverboseitems
1541 $ hg help addverboseitems
1540 addverboseitems extension - extension to test omit indicating.
1542 addverboseitems extension - extension to test omit indicating.
1541
1543
1542 This paragraph is never omitted (for extension)
1544 This paragraph is never omitted (for extension)
1543
1545
1544 This paragraph is never omitted, too (for extension)
1546 This paragraph is never omitted, too (for extension)
1545
1547
1546 (some details hidden, use --verbose to show complete help)
1548 (some details hidden, use --verbose to show complete help)
1547
1549
1548 no commands defined
1550 no commands defined
1549 $ hg help -v addverboseitems
1551 $ hg help -v addverboseitems
1550 addverboseitems extension - extension to test omit indicating.
1552 addverboseitems extension - extension to test omit indicating.
1551
1553
1552 This paragraph is never omitted (for extension)
1554 This paragraph is never omitted (for extension)
1553
1555
1554 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1556 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1555 extension)
1557 extension)
1556
1558
1557 This paragraph is never omitted, too (for extension)
1559 This paragraph is never omitted, too (for extension)
1558
1560
1559 no commands defined
1561 no commands defined
1560 $ hg help topic-containing-verbose
1562 $ hg help topic-containing-verbose
1561 This is the topic to test omit indicating.
1563 This is the topic to test omit indicating.
1562 """"""""""""""""""""""""""""""""""""""""""
1564 """"""""""""""""""""""""""""""""""""""""""
1563
1565
1564 This paragraph is never omitted (for topic).
1566 This paragraph is never omitted (for topic).
1565
1567
1566 This paragraph is never omitted, too (for topic)
1568 This paragraph is never omitted, too (for topic)
1567
1569
1568 (some details hidden, use --verbose to show complete help)
1570 (some details hidden, use --verbose to show complete help)
1569 $ hg help -v topic-containing-verbose
1571 $ hg help -v topic-containing-verbose
1570 This is the topic to test omit indicating.
1572 This is the topic to test omit indicating.
1571 """"""""""""""""""""""""""""""""""""""""""
1573 """"""""""""""""""""""""""""""""""""""""""
1572
1574
1573 This paragraph is never omitted (for topic).
1575 This paragraph is never omitted (for topic).
1574
1576
1575 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1577 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1576 topic)
1578 topic)
1577
1579
1578 This paragraph is never omitted, too (for topic)
1580 This paragraph is never omitted, too (for topic)
1579
1581
1580 Test section lookup
1582 Test section lookup
1581
1583
1582 $ hg help revset.merge
1584 $ hg help revset.merge
1583 "merge()"
1585 "merge()"
1584 Changeset is a merge changeset.
1586 Changeset is a merge changeset.
1585
1587
1586 $ hg help glossary.dag
1588 $ hg help glossary.dag
1587 DAG
1589 DAG
1588 The repository of changesets of a distributed version control system
1590 The repository of changesets of a distributed version control system
1589 (DVCS) can be described as a directed acyclic graph (DAG), consisting
1591 (DVCS) can be described as a directed acyclic graph (DAG), consisting
1590 of nodes and edges, where nodes correspond to changesets and edges
1592 of nodes and edges, where nodes correspond to changesets and edges
1591 imply a parent -> child relation. This graph can be visualized by
1593 imply a parent -> child relation. This graph can be visualized by
1592 graphical tools such as 'hg log --graph'. In Mercurial, the DAG is
1594 graphical tools such as 'hg log --graph'. In Mercurial, the DAG is
1593 limited by the requirement for children to have at most two parents.
1595 limited by the requirement for children to have at most two parents.
1594
1596
1595
1597
1596 $ hg help hgrc.paths
1598 $ hg help hgrc.paths
1597 "paths"
1599 "paths"
1598 -------
1600 -------
1599
1601
1600 Assigns symbolic names and behavior to repositories.
1602 Assigns symbolic names and behavior to repositories.
1601
1603
1602 Options are symbolic names defining the URL or directory that is the
1604 Options are symbolic names defining the URL or directory that is the
1603 location of the repository. Example:
1605 location of the repository. Example:
1604
1606
1605 [paths]
1607 [paths]
1606 my_server = https://example.com/my_repo
1608 my_server = https://example.com/my_repo
1607 local_path = /home/me/repo
1609 local_path = /home/me/repo
1608
1610
1609 These symbolic names can be used from the command line. To pull from
1611 These symbolic names can be used from the command line. To pull from
1610 "my_server": 'hg pull my_server'. To push to "local_path": 'hg push
1612 "my_server": 'hg pull my_server'. To push to "local_path": 'hg push
1611 local_path'.
1613 local_path'.
1612
1614
1613 Options containing colons (":") denote sub-options that can influence
1615 Options containing colons (":") denote sub-options that can influence
1614 behavior for that specific path. Example:
1616 behavior for that specific path. Example:
1615
1617
1616 [paths]
1618 [paths]
1617 my_server = https://example.com/my_path
1619 my_server = https://example.com/my_path
1618 my_server:pushurl = ssh://example.com/my_path
1620 my_server:pushurl = ssh://example.com/my_path
1619
1621
1620 The following sub-options can be defined:
1622 The following sub-options can be defined:
1621
1623
1622 "pushurl"
1624 "pushurl"
1623 The URL to use for push operations. If not defined, the location
1625 The URL to use for push operations. If not defined, the location
1624 defined by the path's main entry is used.
1626 defined by the path's main entry is used.
1625
1627
1626 "pushrev"
1628 "pushrev"
1627 A revset defining which revisions to push by default.
1629 A revset defining which revisions to push by default.
1628
1630
1629 When 'hg push' is executed without a "-r" argument, the revset defined
1631 When 'hg push' is executed without a "-r" argument, the revset defined
1630 by this sub-option is evaluated to determine what to push.
1632 by this sub-option is evaluated to determine what to push.
1631
1633
1632 For example, a value of "." will push the working directory's revision
1634 For example, a value of "." will push the working directory's revision
1633 by default.
1635 by default.
1634
1636
1635 Revsets specifying bookmarks will not result in the bookmark being
1637 Revsets specifying bookmarks will not result in the bookmark being
1636 pushed.
1638 pushed.
1637
1639
1638 The following special named paths exist:
1640 The following special named paths exist:
1639
1641
1640 "default"
1642 "default"
1641 The URL or directory to use when no source or remote is specified.
1643 The URL or directory to use when no source or remote is specified.
1642
1644
1643 'hg clone' will automatically define this path to the location the
1645 'hg clone' will automatically define this path to the location the
1644 repository was cloned from.
1646 repository was cloned from.
1645
1647
1646 "default-push"
1648 "default-push"
1647 (deprecated) The URL or directory for the default 'hg push' location.
1649 (deprecated) The URL or directory for the default 'hg push' location.
1648 "default:pushurl" should be used instead.
1650 "default:pushurl" should be used instead.
1649
1651
1650 $ hg help glossary.mcguffin
1652 $ hg help glossary.mcguffin
1651 abort: help section not found: glossary.mcguffin
1653 abort: help section not found: glossary.mcguffin
1652 [255]
1654 [255]
1653
1655
1654 $ hg help glossary.mc.guffin
1656 $ hg help glossary.mc.guffin
1655 abort: help section not found: glossary.mc.guffin
1657 abort: help section not found: glossary.mc.guffin
1656 [255]
1658 [255]
1657
1659
1658 $ hg help template.files
1660 $ hg help template.files
1659 files List of strings. All files modified, added, or removed by
1661 files List of strings. All files modified, added, or removed by
1660 this changeset.
1662 this changeset.
1661 files(pattern)
1663 files(pattern)
1662 All files of the current changeset matching the pattern. See
1664 All files of the current changeset matching the pattern. See
1663 'hg help patterns'.
1665 'hg help patterns'.
1664
1666
1665 Test section lookup by translated message
1667 Test section lookup by translated message
1666
1668
1667 str.lower() instead of encoding.lower(str) on translated message might
1669 str.lower() instead of encoding.lower(str) on translated message might
1668 make message meaningless, because some encoding uses 0x41(A) - 0x5a(Z)
1670 make message meaningless, because some encoding uses 0x41(A) - 0x5a(Z)
1669 as the second or later byte of multi-byte character.
1671 as the second or later byte of multi-byte character.
1670
1672
1671 For example, "\x8bL\x98^" (translation of "record" in ja_JP.cp932)
1673 For example, "\x8bL\x98^" (translation of "record" in ja_JP.cp932)
1672 contains 0x4c (L). str.lower() replaces 0x4c(L) by 0x6c(l) and this
1674 contains 0x4c (L). str.lower() replaces 0x4c(L) by 0x6c(l) and this
1673 replacement makes message meaningless.
1675 replacement makes message meaningless.
1674
1676
1675 This tests that section lookup by translated string isn't broken by
1677 This tests that section lookup by translated string isn't broken by
1676 such str.lower().
1678 such str.lower().
1677
1679
1678 $ $PYTHON <<EOF
1680 $ $PYTHON <<EOF
1679 > def escape(s):
1681 > def escape(s):
1680 > return ''.join('\u%x' % ord(uc) for uc in s.decode('cp932'))
1682 > return ''.join('\u%x' % ord(uc) for uc in s.decode('cp932'))
1681 > # translation of "record" in ja_JP.cp932
1683 > # translation of "record" in ja_JP.cp932
1682 > upper = "\x8bL\x98^"
1684 > upper = "\x8bL\x98^"
1683 > # str.lower()-ed section name should be treated as different one
1685 > # str.lower()-ed section name should be treated as different one
1684 > lower = "\x8bl\x98^"
1686 > lower = "\x8bl\x98^"
1685 > with open('ambiguous.py', 'w') as fp:
1687 > with open('ambiguous.py', 'w') as fp:
1686 > fp.write("""# ambiguous section names in ja_JP.cp932
1688 > fp.write("""# ambiguous section names in ja_JP.cp932
1687 > u'''summary of extension
1689 > u'''summary of extension
1688 >
1690 >
1689 > %s
1691 > %s
1690 > ----
1692 > ----
1691 >
1693 >
1692 > Upper name should show only this message
1694 > Upper name should show only this message
1693 >
1695 >
1694 > %s
1696 > %s
1695 > ----
1697 > ----
1696 >
1698 >
1697 > Lower name should show only this message
1699 > Lower name should show only this message
1698 >
1700 >
1699 > subsequent section
1701 > subsequent section
1700 > ------------------
1702 > ------------------
1701 >
1703 >
1702 > This should be hidden at 'hg help ambiguous' with section name.
1704 > This should be hidden at 'hg help ambiguous' with section name.
1703 > '''
1705 > '''
1704 > """ % (escape(upper), escape(lower)))
1706 > """ % (escape(upper), escape(lower)))
1705 > EOF
1707 > EOF
1706
1708
1707 $ cat >> $HGRCPATH <<EOF
1709 $ cat >> $HGRCPATH <<EOF
1708 > [extensions]
1710 > [extensions]
1709 > ambiguous = ./ambiguous.py
1711 > ambiguous = ./ambiguous.py
1710 > EOF
1712 > EOF
1711
1713
1712 $ $PYTHON <<EOF | sh
1714 $ $PYTHON <<EOF | sh
1713 > upper = "\x8bL\x98^"
1715 > upper = "\x8bL\x98^"
1714 > print("hg --encoding cp932 help -e ambiguous.%s" % upper)
1716 > print("hg --encoding cp932 help -e ambiguous.%s" % upper)
1715 > EOF
1717 > EOF
1716 \x8bL\x98^ (esc)
1718 \x8bL\x98^ (esc)
1717 ----
1719 ----
1718
1720
1719 Upper name should show only this message
1721 Upper name should show only this message
1720
1722
1721
1723
1722 $ $PYTHON <<EOF | sh
1724 $ $PYTHON <<EOF | sh
1723 > lower = "\x8bl\x98^"
1725 > lower = "\x8bl\x98^"
1724 > print("hg --encoding cp932 help -e ambiguous.%s" % lower)
1726 > print("hg --encoding cp932 help -e ambiguous.%s" % lower)
1725 > EOF
1727 > EOF
1726 \x8bl\x98^ (esc)
1728 \x8bl\x98^ (esc)
1727 ----
1729 ----
1728
1730
1729 Lower name should show only this message
1731 Lower name should show only this message
1730
1732
1731
1733
1732 $ cat >> $HGRCPATH <<EOF
1734 $ cat >> $HGRCPATH <<EOF
1733 > [extensions]
1735 > [extensions]
1734 > ambiguous = !
1736 > ambiguous = !
1735 > EOF
1737 > EOF
1736
1738
1737 Show help content of disabled extensions
1739 Show help content of disabled extensions
1738
1740
1739 $ cat >> $HGRCPATH <<EOF
1741 $ cat >> $HGRCPATH <<EOF
1740 > [extensions]
1742 > [extensions]
1741 > ambiguous = !./ambiguous.py
1743 > ambiguous = !./ambiguous.py
1742 > EOF
1744 > EOF
1743 $ hg help -e ambiguous
1745 $ hg help -e ambiguous
1744 ambiguous extension - (no help text available)
1746 ambiguous extension - (no help text available)
1745
1747
1746 (use 'hg help extensions' for information on enabling extensions)
1748 (use 'hg help extensions' for information on enabling extensions)
1747
1749
1748 Test dynamic list of merge tools only shows up once
1750 Test dynamic list of merge tools only shows up once
1749 $ hg help merge-tools
1751 $ hg help merge-tools
1750 Merge Tools
1752 Merge Tools
1751 """""""""""
1753 """""""""""
1752
1754
1753 To merge files Mercurial uses merge tools.
1755 To merge files Mercurial uses merge tools.
1754
1756
1755 A merge tool combines two different versions of a file into a merged file.
1757 A merge tool combines two different versions of a file into a merged file.
1756 Merge tools are given the two files and the greatest common ancestor of
1758 Merge tools are given the two files and the greatest common ancestor of
1757 the two file versions, so they can determine the changes made on both
1759 the two file versions, so they can determine the changes made on both
1758 branches.
1760 branches.
1759
1761
1760 Merge tools are used both for 'hg resolve', 'hg merge', 'hg update', 'hg
1762 Merge tools are used both for 'hg resolve', 'hg merge', 'hg update', 'hg
1761 backout' and in several extensions.
1763 backout' and in several extensions.
1762
1764
1763 Usually, the merge tool tries to automatically reconcile the files by
1765 Usually, the merge tool tries to automatically reconcile the files by
1764 combining all non-overlapping changes that occurred separately in the two
1766 combining all non-overlapping changes that occurred separately in the two
1765 different evolutions of the same initial base file. Furthermore, some
1767 different evolutions of the same initial base file. Furthermore, some
1766 interactive merge programs make it easier to manually resolve conflicting
1768 interactive merge programs make it easier to manually resolve conflicting
1767 merges, either in a graphical way, or by inserting some conflict markers.
1769 merges, either in a graphical way, or by inserting some conflict markers.
1768 Mercurial does not include any interactive merge programs but relies on
1770 Mercurial does not include any interactive merge programs but relies on
1769 external tools for that.
1771 external tools for that.
1770
1772
1771 Available merge tools
1773 Available merge tools
1772 =====================
1774 =====================
1773
1775
1774 External merge tools and their properties are configured in the merge-
1776 External merge tools and their properties are configured in the merge-
1775 tools configuration section - see hgrc(5) - but they can often just be
1777 tools configuration section - see hgrc(5) - but they can often just be
1776 named by their executable.
1778 named by their executable.
1777
1779
1778 A merge tool is generally usable if its executable can be found on the
1780 A merge tool is generally usable if its executable can be found on the
1779 system and if it can handle the merge. The executable is found if it is an
1781 system and if it can handle the merge. The executable is found if it is an
1780 absolute or relative executable path or the name of an application in the
1782 absolute or relative executable path or the name of an application in the
1781 executable search path. The tool is assumed to be able to handle the merge
1783 executable search path. The tool is assumed to be able to handle the merge
1782 if it can handle symlinks if the file is a symlink, if it can handle
1784 if it can handle symlinks if the file is a symlink, if it can handle
1783 binary files if the file is binary, and if a GUI is available if the tool
1785 binary files if the file is binary, and if a GUI is available if the tool
1784 requires a GUI.
1786 requires a GUI.
1785
1787
1786 There are some internal merge tools which can be used. The internal merge
1788 There are some internal merge tools which can be used. The internal merge
1787 tools are:
1789 tools are:
1788
1790
1789 ":dump"
1791 ":dump"
1790 Creates three versions of the files to merge, containing the contents of
1792 Creates three versions of the files to merge, containing the contents of
1791 local, other and base. These files can then be used to perform a merge
1793 local, other and base. These files can then be used to perform a merge
1792 manually. If the file to be merged is named "a.txt", these files will
1794 manually. If the file to be merged is named "a.txt", these files will
1793 accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and
1795 accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and
1794 they will be placed in the same directory as "a.txt".
1796 they will be placed in the same directory as "a.txt".
1795
1797
1796 This implies premerge. Therefore, files aren't dumped, if premerge runs
1798 This implies premerge. Therefore, files aren't dumped, if premerge runs
1797 successfully. Use :forcedump to forcibly write files out.
1799 successfully. Use :forcedump to forcibly write files out.
1798
1800
1799 ":fail"
1801 ":fail"
1800 Rather than attempting to merge files that were modified on both
1802 Rather than attempting to merge files that were modified on both
1801 branches, it marks them as unresolved. The resolve command must be used
1803 branches, it marks them as unresolved. The resolve command must be used
1802 to resolve these conflicts.
1804 to resolve these conflicts.
1803
1805
1804 ":forcedump"
1806 ":forcedump"
1805 Creates three versions of the files as same as :dump, but omits
1807 Creates three versions of the files as same as :dump, but omits
1806 premerge.
1808 premerge.
1807
1809
1808 ":local"
1810 ":local"
1809 Uses the local 'p1()' version of files as the merged version.
1811 Uses the local 'p1()' version of files as the merged version.
1810
1812
1811 ":merge"
1813 ":merge"
1812 Uses the internal non-interactive simple merge algorithm for merging
1814 Uses the internal non-interactive simple merge algorithm for merging
1813 files. It will fail if there are any conflicts and leave markers in the
1815 files. It will fail if there are any conflicts and leave markers in the
1814 partially merged file. Markers will have two sections, one for each side
1816 partially merged file. Markers will have two sections, one for each side
1815 of merge.
1817 of merge.
1816
1818
1817 ":merge-local"
1819 ":merge-local"
1818 Like :merge, but resolve all conflicts non-interactively in favor of the
1820 Like :merge, but resolve all conflicts non-interactively in favor of the
1819 local 'p1()' changes.
1821 local 'p1()' changes.
1820
1822
1821 ":merge-other"
1823 ":merge-other"
1822 Like :merge, but resolve all conflicts non-interactively in favor of the
1824 Like :merge, but resolve all conflicts non-interactively in favor of the
1823 other 'p2()' changes.
1825 other 'p2()' changes.
1824
1826
1825 ":merge3"
1827 ":merge3"
1826 Uses the internal non-interactive simple merge algorithm for merging
1828 Uses the internal non-interactive simple merge algorithm for merging
1827 files. It will fail if there are any conflicts and leave markers in the
1829 files. It will fail if there are any conflicts and leave markers in the
1828 partially merged file. Marker will have three sections, one from each
1830 partially merged file. Marker will have three sections, one from each
1829 side of the merge and one for the base content.
1831 side of the merge and one for the base content.
1830
1832
1831 ":other"
1833 ":other"
1832 Uses the other 'p2()' version of files as the merged version.
1834 Uses the other 'p2()' version of files as the merged version.
1833
1835
1834 ":prompt"
1836 ":prompt"
1835 Asks the user which of the local 'p1()' or the other 'p2()' version to
1837 Asks the user which of the local 'p1()' or the other 'p2()' version to
1836 keep as the merged version.
1838 keep as the merged version.
1837
1839
1838 ":tagmerge"
1840 ":tagmerge"
1839 Uses the internal tag merge algorithm (experimental).
1841 Uses the internal tag merge algorithm (experimental).
1840
1842
1841 ":union"
1843 ":union"
1842 Uses the internal non-interactive simple merge algorithm for merging
1844 Uses the internal non-interactive simple merge algorithm for merging
1843 files. It will use both left and right sides for conflict regions. No
1845 files. It will use both left and right sides for conflict regions. No
1844 markers are inserted.
1846 markers are inserted.
1845
1847
1846 Internal tools are always available and do not require a GUI but will by
1848 Internal tools are always available and do not require a GUI but will by
1847 default not handle symlinks or binary files.
1849 default not handle symlinks or binary files.
1848
1850
1849 Choosing a merge tool
1851 Choosing a merge tool
1850 =====================
1852 =====================
1851
1853
1852 Mercurial uses these rules when deciding which merge tool to use:
1854 Mercurial uses these rules when deciding which merge tool to use:
1853
1855
1854 1. If a tool has been specified with the --tool option to merge or
1856 1. If a tool has been specified with the --tool option to merge or
1855 resolve, it is used. If it is the name of a tool in the merge-tools
1857 resolve, it is used. If it is the name of a tool in the merge-tools
1856 configuration, its configuration is used. Otherwise the specified tool
1858 configuration, its configuration is used. Otherwise the specified tool
1857 must be executable by the shell.
1859 must be executable by the shell.
1858 2. If the "HGMERGE" environment variable is present, its value is used and
1860 2. If the "HGMERGE" environment variable is present, its value is used and
1859 must be executable by the shell.
1861 must be executable by the shell.
1860 3. If the filename of the file to be merged matches any of the patterns in
1862 3. If the filename of the file to be merged matches any of the patterns in
1861 the merge-patterns configuration section, the first usable merge tool
1863 the merge-patterns configuration section, the first usable merge tool
1862 corresponding to a matching pattern is used. Here, binary capabilities
1864 corresponding to a matching pattern is used. Here, binary capabilities
1863 of the merge tool are not considered.
1865 of the merge tool are not considered.
1864 4. If ui.merge is set it will be considered next. If the value is not the
1866 4. If ui.merge is set it will be considered next. If the value is not the
1865 name of a configured tool, the specified value is used and must be
1867 name of a configured tool, the specified value is used and must be
1866 executable by the shell. Otherwise the named tool is used if it is
1868 executable by the shell. Otherwise the named tool is used if it is
1867 usable.
1869 usable.
1868 5. If any usable merge tools are present in the merge-tools configuration
1870 5. If any usable merge tools are present in the merge-tools configuration
1869 section, the one with the highest priority is used.
1871 section, the one with the highest priority is used.
1870 6. If a program named "hgmerge" can be found on the system, it is used -
1872 6. If a program named "hgmerge" can be found on the system, it is used -
1871 but it will by default not be used for symlinks and binary files.
1873 but it will by default not be used for symlinks and binary files.
1872 7. If the file to be merged is not binary and is not a symlink, then
1874 7. If the file to be merged is not binary and is not a symlink, then
1873 internal ":merge" is used.
1875 internal ":merge" is used.
1874 8. Otherwise, ":prompt" is used.
1876 8. Otherwise, ":prompt" is used.
1875
1877
1876 Note:
1878 Note:
1877 After selecting a merge program, Mercurial will by default attempt to
1879 After selecting a merge program, Mercurial will by default attempt to
1878 merge the files using a simple merge algorithm first. Only if it
1880 merge the files using a simple merge algorithm first. Only if it
1879 doesn't succeed because of conflicting changes will Mercurial actually
1881 doesn't succeed because of conflicting changes will Mercurial actually
1880 execute the merge program. Whether to use the simple merge algorithm
1882 execute the merge program. Whether to use the simple merge algorithm
1881 first can be controlled by the premerge setting of the merge tool.
1883 first can be controlled by the premerge setting of the merge tool.
1882 Premerge is enabled by default unless the file is binary or a symlink.
1884 Premerge is enabled by default unless the file is binary or a symlink.
1883
1885
1884 See the merge-tools and ui sections of hgrc(5) for details on the
1886 See the merge-tools and ui sections of hgrc(5) for details on the
1885 configuration of merge tools.
1887 configuration of merge tools.
1886
1888
1887 Compression engines listed in `hg help bundlespec`
1889 Compression engines listed in `hg help bundlespec`
1888
1890
1889 $ hg help bundlespec | grep gzip
1891 $ hg help bundlespec | grep gzip
1890 "v1" bundles can only use the "gzip", "bzip2", and "none" compression
1892 "v1" bundles can only use the "gzip", "bzip2", and "none" compression
1891 An algorithm that produces smaller bundles than "gzip".
1893 An algorithm that produces smaller bundles than "gzip".
1892 This engine will likely produce smaller bundles than "gzip" but will be
1894 This engine will likely produce smaller bundles than "gzip" but will be
1893 "gzip"
1895 "gzip"
1894 better compression than "gzip". It also frequently yields better (?)
1896 better compression than "gzip". It also frequently yields better (?)
1895
1897
1896 Test usage of section marks in help documents
1898 Test usage of section marks in help documents
1897
1899
1898 $ cd "$TESTDIR"/../doc
1900 $ cd "$TESTDIR"/../doc
1899 $ $PYTHON check-seclevel.py
1901 $ $PYTHON check-seclevel.py
1900 $ cd $TESTTMP
1902 $ cd $TESTTMP
1901
1903
1902 #if serve
1904 #if serve
1903
1905
1904 Test the help pages in hgweb.
1906 Test the help pages in hgweb.
1905
1907
1906 Dish up an empty repo; serve it cold.
1908 Dish up an empty repo; serve it cold.
1907
1909
1908 $ hg init "$TESTTMP/test"
1910 $ hg init "$TESTTMP/test"
1909 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
1911 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
1910 $ cat hg.pid >> $DAEMON_PIDS
1912 $ cat hg.pid >> $DAEMON_PIDS
1911
1913
1912 $ get-with-headers.py $LOCALIP:$HGPORT "help"
1914 $ get-with-headers.py $LOCALIP:$HGPORT "help"
1913 200 Script output follows
1915 200 Script output follows
1914
1916
1915 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1917 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1916 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1918 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1917 <head>
1919 <head>
1918 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1920 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1919 <meta name="robots" content="index, nofollow" />
1921 <meta name="robots" content="index, nofollow" />
1920 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1922 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1921 <script type="text/javascript" src="/static/mercurial.js"></script>
1923 <script type="text/javascript" src="/static/mercurial.js"></script>
1922
1924
1923 <title>Help: Index</title>
1925 <title>Help: Index</title>
1924 </head>
1926 </head>
1925 <body>
1927 <body>
1926
1928
1927 <div class="container">
1929 <div class="container">
1928 <div class="menu">
1930 <div class="menu">
1929 <div class="logo">
1931 <div class="logo">
1930 <a href="https://mercurial-scm.org/">
1932 <a href="https://mercurial-scm.org/">
1931 <img src="/static/hglogo.png" alt="mercurial" /></a>
1933 <img src="/static/hglogo.png" alt="mercurial" /></a>
1932 </div>
1934 </div>
1933 <ul>
1935 <ul>
1934 <li><a href="/shortlog">log</a></li>
1936 <li><a href="/shortlog">log</a></li>
1935 <li><a href="/graph">graph</a></li>
1937 <li><a href="/graph">graph</a></li>
1936 <li><a href="/tags">tags</a></li>
1938 <li><a href="/tags">tags</a></li>
1937 <li><a href="/bookmarks">bookmarks</a></li>
1939 <li><a href="/bookmarks">bookmarks</a></li>
1938 <li><a href="/branches">branches</a></li>
1940 <li><a href="/branches">branches</a></li>
1939 </ul>
1941 </ul>
1940 <ul>
1942 <ul>
1941 <li class="active">help</li>
1943 <li class="active">help</li>
1942 </ul>
1944 </ul>
1943 </div>
1945 </div>
1944
1946
1945 <div class="main">
1947 <div class="main">
1946 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1948 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1947
1949
1948 <form class="search" action="/log">
1950 <form class="search" action="/log">
1949
1951
1950 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
1952 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
1951 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1953 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1952 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1954 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1953 </form>
1955 </form>
1954 <table class="bigtable">
1956 <table class="bigtable">
1955 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
1957 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
1956
1958
1957 <tr><td>
1959 <tr><td>
1958 <a href="/help/bundlespec">
1960 <a href="/help/bundlespec">
1959 bundlespec
1961 bundlespec
1960 </a>
1962 </a>
1961 </td><td>
1963 </td><td>
1962 Bundle File Formats
1964 Bundle File Formats
1963 </td></tr>
1965 </td></tr>
1964 <tr><td>
1966 <tr><td>
1965 <a href="/help/color">
1967 <a href="/help/color">
1966 color
1968 color
1967 </a>
1969 </a>
1968 </td><td>
1970 </td><td>
1969 Colorizing Outputs
1971 Colorizing Outputs
1970 </td></tr>
1972 </td></tr>
1971 <tr><td>
1973 <tr><td>
1972 <a href="/help/config">
1974 <a href="/help/config">
1973 config
1975 config
1974 </a>
1976 </a>
1975 </td><td>
1977 </td><td>
1976 Configuration Files
1978 Configuration Files
1977 </td></tr>
1979 </td></tr>
1978 <tr><td>
1980 <tr><td>
1979 <a href="/help/dates">
1981 <a href="/help/dates">
1980 dates
1982 dates
1981 </a>
1983 </a>
1982 </td><td>
1984 </td><td>
1983 Date Formats
1985 Date Formats
1984 </td></tr>
1986 </td></tr>
1985 <tr><td>
1987 <tr><td>
1986 <a href="/help/diffs">
1988 <a href="/help/diffs">
1987 diffs
1989 diffs
1988 </a>
1990 </a>
1989 </td><td>
1991 </td><td>
1990 Diff Formats
1992 Diff Formats
1991 </td></tr>
1993 </td></tr>
1992 <tr><td>
1994 <tr><td>
1993 <a href="/help/environment">
1995 <a href="/help/environment">
1994 environment
1996 environment
1995 </a>
1997 </a>
1996 </td><td>
1998 </td><td>
1997 Environment Variables
1999 Environment Variables
1998 </td></tr>
2000 </td></tr>
1999 <tr><td>
2001 <tr><td>
2000 <a href="/help/extensions">
2002 <a href="/help/extensions">
2001 extensions
2003 extensions
2002 </a>
2004 </a>
2003 </td><td>
2005 </td><td>
2004 Using Additional Features
2006 Using Additional Features
2005 </td></tr>
2007 </td></tr>
2006 <tr><td>
2008 <tr><td>
2007 <a href="/help/filesets">
2009 <a href="/help/filesets">
2008 filesets
2010 filesets
2009 </a>
2011 </a>
2010 </td><td>
2012 </td><td>
2011 Specifying File Sets
2013 Specifying File Sets
2012 </td></tr>
2014 </td></tr>
2013 <tr><td>
2015 <tr><td>
2014 <a href="/help/glossary">
2016 <a href="/help/glossary">
2015 glossary
2017 glossary
2016 </a>
2018 </a>
2017 </td><td>
2019 </td><td>
2018 Glossary
2020 Glossary
2019 </td></tr>
2021 </td></tr>
2020 <tr><td>
2022 <tr><td>
2021 <a href="/help/hgignore">
2023 <a href="/help/hgignore">
2022 hgignore
2024 hgignore
2023 </a>
2025 </a>
2024 </td><td>
2026 </td><td>
2025 Syntax for Mercurial Ignore Files
2027 Syntax for Mercurial Ignore Files
2026 </td></tr>
2028 </td></tr>
2027 <tr><td>
2029 <tr><td>
2028 <a href="/help/hgweb">
2030 <a href="/help/hgweb">
2029 hgweb
2031 hgweb
2030 </a>
2032 </a>
2031 </td><td>
2033 </td><td>
2032 Configuring hgweb
2034 Configuring hgweb
2033 </td></tr>
2035 </td></tr>
2034 <tr><td>
2036 <tr><td>
2035 <a href="/help/internals">
2037 <a href="/help/internals">
2036 internals
2038 internals
2037 </a>
2039 </a>
2038 </td><td>
2040 </td><td>
2039 Technical implementation topics
2041 Technical implementation topics
2040 </td></tr>
2042 </td></tr>
2041 <tr><td>
2043 <tr><td>
2042 <a href="/help/merge-tools">
2044 <a href="/help/merge-tools">
2043 merge-tools
2045 merge-tools
2044 </a>
2046 </a>
2045 </td><td>
2047 </td><td>
2046 Merge Tools
2048 Merge Tools
2047 </td></tr>
2049 </td></tr>
2048 <tr><td>
2050 <tr><td>
2049 <a href="/help/pager">
2051 <a href="/help/pager">
2050 pager
2052 pager
2051 </a>
2053 </a>
2052 </td><td>
2054 </td><td>
2053 Pager Support
2055 Pager Support
2054 </td></tr>
2056 </td></tr>
2055 <tr><td>
2057 <tr><td>
2056 <a href="/help/patterns">
2058 <a href="/help/patterns">
2057 patterns
2059 patterns
2058 </a>
2060 </a>
2059 </td><td>
2061 </td><td>
2060 File Name Patterns
2062 File Name Patterns
2061 </td></tr>
2063 </td></tr>
2062 <tr><td>
2064 <tr><td>
2063 <a href="/help/phases">
2065 <a href="/help/phases">
2064 phases
2066 phases
2065 </a>
2067 </a>
2066 </td><td>
2068 </td><td>
2067 Working with Phases
2069 Working with Phases
2068 </td></tr>
2070 </td></tr>
2069 <tr><td>
2071 <tr><td>
2070 <a href="/help/revisions">
2072 <a href="/help/revisions">
2071 revisions
2073 revisions
2072 </a>
2074 </a>
2073 </td><td>
2075 </td><td>
2074 Specifying Revisions
2076 Specifying Revisions
2075 </td></tr>
2077 </td></tr>
2076 <tr><td>
2078 <tr><td>
2077 <a href="/help/scripting">
2079 <a href="/help/scripting">
2078 scripting
2080 scripting
2079 </a>
2081 </a>
2080 </td><td>
2082 </td><td>
2081 Using Mercurial from scripts and automation
2083 Using Mercurial from scripts and automation
2082 </td></tr>
2084 </td></tr>
2083 <tr><td>
2085 <tr><td>
2084 <a href="/help/subrepos">
2086 <a href="/help/subrepos">
2085 subrepos
2087 subrepos
2086 </a>
2088 </a>
2087 </td><td>
2089 </td><td>
2088 Subrepositories
2090 Subrepositories
2089 </td></tr>
2091 </td></tr>
2090 <tr><td>
2092 <tr><td>
2091 <a href="/help/templating">
2093 <a href="/help/templating">
2092 templating
2094 templating
2093 </a>
2095 </a>
2094 </td><td>
2096 </td><td>
2095 Template Usage
2097 Template Usage
2096 </td></tr>
2098 </td></tr>
2097 <tr><td>
2099 <tr><td>
2098 <a href="/help/urls">
2100 <a href="/help/urls">
2099 urls
2101 urls
2100 </a>
2102 </a>
2101 </td><td>
2103 </td><td>
2102 URL Paths
2104 URL Paths
2103 </td></tr>
2105 </td></tr>
2104 <tr><td>
2106 <tr><td>
2105 <a href="/help/topic-containing-verbose">
2107 <a href="/help/topic-containing-verbose">
2106 topic-containing-verbose
2108 topic-containing-verbose
2107 </a>
2109 </a>
2108 </td><td>
2110 </td><td>
2109 This is the topic to test omit indicating.
2111 This is the topic to test omit indicating.
2110 </td></tr>
2112 </td></tr>
2111
2113
2112
2114
2113 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
2115 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
2114
2116
2115 <tr><td>
2117 <tr><td>
2116 <a href="/help/add">
2118 <a href="/help/add">
2117 add
2119 add
2118 </a>
2120 </a>
2119 </td><td>
2121 </td><td>
2120 add the specified files on the next commit
2122 add the specified files on the next commit
2121 </td></tr>
2123 </td></tr>
2122 <tr><td>
2124 <tr><td>
2123 <a href="/help/annotate">
2125 <a href="/help/annotate">
2124 annotate
2126 annotate
2125 </a>
2127 </a>
2126 </td><td>
2128 </td><td>
2127 show changeset information by line for each file
2129 show changeset information by line for each file
2128 </td></tr>
2130 </td></tr>
2129 <tr><td>
2131 <tr><td>
2130 <a href="/help/clone">
2132 <a href="/help/clone">
2131 clone
2133 clone
2132 </a>
2134 </a>
2133 </td><td>
2135 </td><td>
2134 make a copy of an existing repository
2136 make a copy of an existing repository
2135 </td></tr>
2137 </td></tr>
2136 <tr><td>
2138 <tr><td>
2137 <a href="/help/commit">
2139 <a href="/help/commit">
2138 commit
2140 commit
2139 </a>
2141 </a>
2140 </td><td>
2142 </td><td>
2141 commit the specified files or all outstanding changes
2143 commit the specified files or all outstanding changes
2142 </td></tr>
2144 </td></tr>
2143 <tr><td>
2145 <tr><td>
2144 <a href="/help/diff">
2146 <a href="/help/diff">
2145 diff
2147 diff
2146 </a>
2148 </a>
2147 </td><td>
2149 </td><td>
2148 diff repository (or selected files)
2150 diff repository (or selected files)
2149 </td></tr>
2151 </td></tr>
2150 <tr><td>
2152 <tr><td>
2151 <a href="/help/export">
2153 <a href="/help/export">
2152 export
2154 export
2153 </a>
2155 </a>
2154 </td><td>
2156 </td><td>
2155 dump the header and diffs for one or more changesets
2157 dump the header and diffs for one or more changesets
2156 </td></tr>
2158 </td></tr>
2157 <tr><td>
2159 <tr><td>
2158 <a href="/help/forget">
2160 <a href="/help/forget">
2159 forget
2161 forget
2160 </a>
2162 </a>
2161 </td><td>
2163 </td><td>
2162 forget the specified files on the next commit
2164 forget the specified files on the next commit
2163 </td></tr>
2165 </td></tr>
2164 <tr><td>
2166 <tr><td>
2165 <a href="/help/init">
2167 <a href="/help/init">
2166 init
2168 init
2167 </a>
2169 </a>
2168 </td><td>
2170 </td><td>
2169 create a new repository in the given directory
2171 create a new repository in the given directory
2170 </td></tr>
2172 </td></tr>
2171 <tr><td>
2173 <tr><td>
2172 <a href="/help/log">
2174 <a href="/help/log">
2173 log
2175 log
2174 </a>
2176 </a>
2175 </td><td>
2177 </td><td>
2176 show revision history of entire repository or files
2178 show revision history of entire repository or files
2177 </td></tr>
2179 </td></tr>
2178 <tr><td>
2180 <tr><td>
2179 <a href="/help/merge">
2181 <a href="/help/merge">
2180 merge
2182 merge
2181 </a>
2183 </a>
2182 </td><td>
2184 </td><td>
2183 merge another revision into working directory
2185 merge another revision into working directory
2184 </td></tr>
2186 </td></tr>
2185 <tr><td>
2187 <tr><td>
2186 <a href="/help/pull">
2188 <a href="/help/pull">
2187 pull
2189 pull
2188 </a>
2190 </a>
2189 </td><td>
2191 </td><td>
2190 pull changes from the specified source
2192 pull changes from the specified source
2191 </td></tr>
2193 </td></tr>
2192 <tr><td>
2194 <tr><td>
2193 <a href="/help/push">
2195 <a href="/help/push">
2194 push
2196 push
2195 </a>
2197 </a>
2196 </td><td>
2198 </td><td>
2197 push changes to the specified destination
2199 push changes to the specified destination
2198 </td></tr>
2200 </td></tr>
2199 <tr><td>
2201 <tr><td>
2200 <a href="/help/remove">
2202 <a href="/help/remove">
2201 remove
2203 remove
2202 </a>
2204 </a>
2203 </td><td>
2205 </td><td>
2204 remove the specified files on the next commit
2206 remove the specified files on the next commit
2205 </td></tr>
2207 </td></tr>
2206 <tr><td>
2208 <tr><td>
2207 <a href="/help/serve">
2209 <a href="/help/serve">
2208 serve
2210 serve
2209 </a>
2211 </a>
2210 </td><td>
2212 </td><td>
2211 start stand-alone webserver
2213 start stand-alone webserver
2212 </td></tr>
2214 </td></tr>
2213 <tr><td>
2215 <tr><td>
2214 <a href="/help/status">
2216 <a href="/help/status">
2215 status
2217 status
2216 </a>
2218 </a>
2217 </td><td>
2219 </td><td>
2218 show changed files in the working directory
2220 show changed files in the working directory
2219 </td></tr>
2221 </td></tr>
2220 <tr><td>
2222 <tr><td>
2221 <a href="/help/summary">
2223 <a href="/help/summary">
2222 summary
2224 summary
2223 </a>
2225 </a>
2224 </td><td>
2226 </td><td>
2225 summarize working directory state
2227 summarize working directory state
2226 </td></tr>
2228 </td></tr>
2227 <tr><td>
2229 <tr><td>
2228 <a href="/help/update">
2230 <a href="/help/update">
2229 update
2231 update
2230 </a>
2232 </a>
2231 </td><td>
2233 </td><td>
2232 update working directory (or switch revisions)
2234 update working directory (or switch revisions)
2233 </td></tr>
2235 </td></tr>
2234
2236
2235
2237
2236
2238
2237 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
2239 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
2238
2240
2239 <tr><td>
2241 <tr><td>
2240 <a href="/help/addremove">
2242 <a href="/help/addremove">
2241 addremove
2243 addremove
2242 </a>
2244 </a>
2243 </td><td>
2245 </td><td>
2244 add all new files, delete all missing files
2246 add all new files, delete all missing files
2245 </td></tr>
2247 </td></tr>
2246 <tr><td>
2248 <tr><td>
2247 <a href="/help/archive">
2249 <a href="/help/archive">
2248 archive
2250 archive
2249 </a>
2251 </a>
2250 </td><td>
2252 </td><td>
2251 create an unversioned archive of a repository revision
2253 create an unversioned archive of a repository revision
2252 </td></tr>
2254 </td></tr>
2253 <tr><td>
2255 <tr><td>
2254 <a href="/help/backout">
2256 <a href="/help/backout">
2255 backout
2257 backout
2256 </a>
2258 </a>
2257 </td><td>
2259 </td><td>
2258 reverse effect of earlier changeset
2260 reverse effect of earlier changeset
2259 </td></tr>
2261 </td></tr>
2260 <tr><td>
2262 <tr><td>
2261 <a href="/help/bisect">
2263 <a href="/help/bisect">
2262 bisect
2264 bisect
2263 </a>
2265 </a>
2264 </td><td>
2266 </td><td>
2265 subdivision search of changesets
2267 subdivision search of changesets
2266 </td></tr>
2268 </td></tr>
2267 <tr><td>
2269 <tr><td>
2268 <a href="/help/bookmarks">
2270 <a href="/help/bookmarks">
2269 bookmarks
2271 bookmarks
2270 </a>
2272 </a>
2271 </td><td>
2273 </td><td>
2272 create a new bookmark or list existing bookmarks
2274 create a new bookmark or list existing bookmarks
2273 </td></tr>
2275 </td></tr>
2274 <tr><td>
2276 <tr><td>
2275 <a href="/help/branch">
2277 <a href="/help/branch">
2276 branch
2278 branch
2277 </a>
2279 </a>
2278 </td><td>
2280 </td><td>
2279 set or show the current branch name
2281 set or show the current branch name
2280 </td></tr>
2282 </td></tr>
2281 <tr><td>
2283 <tr><td>
2282 <a href="/help/branches">
2284 <a href="/help/branches">
2283 branches
2285 branches
2284 </a>
2286 </a>
2285 </td><td>
2287 </td><td>
2286 list repository named branches
2288 list repository named branches
2287 </td></tr>
2289 </td></tr>
2288 <tr><td>
2290 <tr><td>
2289 <a href="/help/bundle">
2291 <a href="/help/bundle">
2290 bundle
2292 bundle
2291 </a>
2293 </a>
2292 </td><td>
2294 </td><td>
2293 create a bundle file
2295 create a bundle file
2294 </td></tr>
2296 </td></tr>
2295 <tr><td>
2297 <tr><td>
2296 <a href="/help/cat">
2298 <a href="/help/cat">
2297 cat
2299 cat
2298 </a>
2300 </a>
2299 </td><td>
2301 </td><td>
2300 output the current or given revision of files
2302 output the current or given revision of files
2301 </td></tr>
2303 </td></tr>
2302 <tr><td>
2304 <tr><td>
2303 <a href="/help/config">
2305 <a href="/help/config">
2304 config
2306 config
2305 </a>
2307 </a>
2306 </td><td>
2308 </td><td>
2307 show combined config settings from all hgrc files
2309 show combined config settings from all hgrc files
2308 </td></tr>
2310 </td></tr>
2309 <tr><td>
2311 <tr><td>
2310 <a href="/help/copy">
2312 <a href="/help/copy">
2311 copy
2313 copy
2312 </a>
2314 </a>
2313 </td><td>
2315 </td><td>
2314 mark files as copied for the next commit
2316 mark files as copied for the next commit
2315 </td></tr>
2317 </td></tr>
2316 <tr><td>
2318 <tr><td>
2317 <a href="/help/files">
2319 <a href="/help/files">
2318 files
2320 files
2319 </a>
2321 </a>
2320 </td><td>
2322 </td><td>
2321 list tracked files
2323 list tracked files
2322 </td></tr>
2324 </td></tr>
2323 <tr><td>
2325 <tr><td>
2324 <a href="/help/graft">
2326 <a href="/help/graft">
2325 graft
2327 graft
2326 </a>
2328 </a>
2327 </td><td>
2329 </td><td>
2328 copy changes from other branches onto the current branch
2330 copy changes from other branches onto the current branch
2329 </td></tr>
2331 </td></tr>
2330 <tr><td>
2332 <tr><td>
2331 <a href="/help/grep">
2333 <a href="/help/grep">
2332 grep
2334 grep
2333 </a>
2335 </a>
2334 </td><td>
2336 </td><td>
2335 search revision history for a pattern in specified files
2337 search revision history for a pattern in specified files
2336 </td></tr>
2338 </td></tr>
2337 <tr><td>
2339 <tr><td>
2338 <a href="/help/heads">
2340 <a href="/help/heads">
2339 heads
2341 heads
2340 </a>
2342 </a>
2341 </td><td>
2343 </td><td>
2342 show branch heads
2344 show branch heads
2343 </td></tr>
2345 </td></tr>
2344 <tr><td>
2346 <tr><td>
2345 <a href="/help/help">
2347 <a href="/help/help">
2346 help
2348 help
2347 </a>
2349 </a>
2348 </td><td>
2350 </td><td>
2349 show help for a given topic or a help overview
2351 show help for a given topic or a help overview
2350 </td></tr>
2352 </td></tr>
2351 <tr><td>
2353 <tr><td>
2352 <a href="/help/hgalias">
2354 <a href="/help/hgalias">
2353 hgalias
2355 hgalias
2354 </a>
2356 </a>
2355 </td><td>
2357 </td><td>
2356 summarize working directory state
2358 summarize working directory state
2357 </td></tr>
2359 </td></tr>
2358 <tr><td>
2360 <tr><td>
2359 <a href="/help/identify">
2361 <a href="/help/identify">
2360 identify
2362 identify
2361 </a>
2363 </a>
2362 </td><td>
2364 </td><td>
2363 identify the working directory or specified revision
2365 identify the working directory or specified revision
2364 </td></tr>
2366 </td></tr>
2365 <tr><td>
2367 <tr><td>
2366 <a href="/help/import">
2368 <a href="/help/import">
2367 import
2369 import
2368 </a>
2370 </a>
2369 </td><td>
2371 </td><td>
2370 import an ordered set of patches
2372 import an ordered set of patches
2371 </td></tr>
2373 </td></tr>
2372 <tr><td>
2374 <tr><td>
2373 <a href="/help/incoming">
2375 <a href="/help/incoming">
2374 incoming
2376 incoming
2375 </a>
2377 </a>
2376 </td><td>
2378 </td><td>
2377 show new changesets found in source
2379 show new changesets found in source
2378 </td></tr>
2380 </td></tr>
2379 <tr><td>
2381 <tr><td>
2380 <a href="/help/manifest">
2382 <a href="/help/manifest">
2381 manifest
2383 manifest
2382 </a>
2384 </a>
2383 </td><td>
2385 </td><td>
2384 output the current or given revision of the project manifest
2386 output the current or given revision of the project manifest
2385 </td></tr>
2387 </td></tr>
2386 <tr><td>
2388 <tr><td>
2387 <a href="/help/nohelp">
2389 <a href="/help/nohelp">
2388 nohelp
2390 nohelp
2389 </a>
2391 </a>
2390 </td><td>
2392 </td><td>
2391 (no help text available)
2393 (no help text available)
2392 </td></tr>
2394 </td></tr>
2393 <tr><td>
2395 <tr><td>
2394 <a href="/help/outgoing">
2396 <a href="/help/outgoing">
2395 outgoing
2397 outgoing
2396 </a>
2398 </a>
2397 </td><td>
2399 </td><td>
2398 show changesets not found in the destination
2400 show changesets not found in the destination
2399 </td></tr>
2401 </td></tr>
2400 <tr><td>
2402 <tr><td>
2401 <a href="/help/paths">
2403 <a href="/help/paths">
2402 paths
2404 paths
2403 </a>
2405 </a>
2404 </td><td>
2406 </td><td>
2405 show aliases for remote repositories
2407 show aliases for remote repositories
2406 </td></tr>
2408 </td></tr>
2407 <tr><td>
2409 <tr><td>
2408 <a href="/help/phase">
2410 <a href="/help/phase">
2409 phase
2411 phase
2410 </a>
2412 </a>
2411 </td><td>
2413 </td><td>
2412 set or show the current phase name
2414 set or show the current phase name
2413 </td></tr>
2415 </td></tr>
2414 <tr><td>
2416 <tr><td>
2415 <a href="/help/recover">
2417 <a href="/help/recover">
2416 recover
2418 recover
2417 </a>
2419 </a>
2418 </td><td>
2420 </td><td>
2419 roll back an interrupted transaction
2421 roll back an interrupted transaction
2420 </td></tr>
2422 </td></tr>
2421 <tr><td>
2423 <tr><td>
2422 <a href="/help/rename">
2424 <a href="/help/rename">
2423 rename
2425 rename
2424 </a>
2426 </a>
2425 </td><td>
2427 </td><td>
2426 rename files; equivalent of copy + remove
2428 rename files; equivalent of copy + remove
2427 </td></tr>
2429 </td></tr>
2428 <tr><td>
2430 <tr><td>
2429 <a href="/help/resolve">
2431 <a href="/help/resolve">
2430 resolve
2432 resolve
2431 </a>
2433 </a>
2432 </td><td>
2434 </td><td>
2433 redo merges or set/view the merge status of files
2435 redo merges or set/view the merge status of files
2434 </td></tr>
2436 </td></tr>
2435 <tr><td>
2437 <tr><td>
2436 <a href="/help/revert">
2438 <a href="/help/revert">
2437 revert
2439 revert
2438 </a>
2440 </a>
2439 </td><td>
2441 </td><td>
2440 restore files to their checkout state
2442 restore files to their checkout state
2441 </td></tr>
2443 </td></tr>
2442 <tr><td>
2444 <tr><td>
2443 <a href="/help/root">
2445 <a href="/help/root">
2444 root
2446 root
2445 </a>
2447 </a>
2446 </td><td>
2448 </td><td>
2447 print the root (top) of the current working directory
2449 print the root (top) of the current working directory
2448 </td></tr>
2450 </td></tr>
2449 <tr><td>
2451 <tr><td>
2450 <a href="/help/shellalias">
2452 <a href="/help/shellalias">
2451 shellalias
2453 shellalias
2452 </a>
2454 </a>
2453 </td><td>
2455 </td><td>
2454 (no help text available)
2456 (no help text available)
2455 </td></tr>
2457 </td></tr>
2456 <tr><td>
2458 <tr><td>
2457 <a href="/help/tag">
2459 <a href="/help/tag">
2458 tag
2460 tag
2459 </a>
2461 </a>
2460 </td><td>
2462 </td><td>
2461 add one or more tags for the current or given revision
2463 add one or more tags for the current or given revision
2462 </td></tr>
2464 </td></tr>
2463 <tr><td>
2465 <tr><td>
2464 <a href="/help/tags">
2466 <a href="/help/tags">
2465 tags
2467 tags
2466 </a>
2468 </a>
2467 </td><td>
2469 </td><td>
2468 list repository tags
2470 list repository tags
2469 </td></tr>
2471 </td></tr>
2470 <tr><td>
2472 <tr><td>
2471 <a href="/help/unbundle">
2473 <a href="/help/unbundle">
2472 unbundle
2474 unbundle
2473 </a>
2475 </a>
2474 </td><td>
2476 </td><td>
2475 apply one or more bundle files
2477 apply one or more bundle files
2476 </td></tr>
2478 </td></tr>
2477 <tr><td>
2479 <tr><td>
2478 <a href="/help/verify">
2480 <a href="/help/verify">
2479 verify
2481 verify
2480 </a>
2482 </a>
2481 </td><td>
2483 </td><td>
2482 verify the integrity of the repository
2484 verify the integrity of the repository
2483 </td></tr>
2485 </td></tr>
2484 <tr><td>
2486 <tr><td>
2485 <a href="/help/version">
2487 <a href="/help/version">
2486 version
2488 version
2487 </a>
2489 </a>
2488 </td><td>
2490 </td><td>
2489 output version and copyright information
2491 output version and copyright information
2490 </td></tr>
2492 </td></tr>
2491
2493
2492
2494
2493 </table>
2495 </table>
2494 </div>
2496 </div>
2495 </div>
2497 </div>
2496
2498
2497
2499
2498
2500
2499 </body>
2501 </body>
2500 </html>
2502 </html>
2501
2503
2502
2504
2503 $ get-with-headers.py $LOCALIP:$HGPORT "help/add"
2505 $ get-with-headers.py $LOCALIP:$HGPORT "help/add"
2504 200 Script output follows
2506 200 Script output follows
2505
2507
2506 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2508 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2507 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2509 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2508 <head>
2510 <head>
2509 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2511 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2510 <meta name="robots" content="index, nofollow" />
2512 <meta name="robots" content="index, nofollow" />
2511 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2513 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2512 <script type="text/javascript" src="/static/mercurial.js"></script>
2514 <script type="text/javascript" src="/static/mercurial.js"></script>
2513
2515
2514 <title>Help: add</title>
2516 <title>Help: add</title>
2515 </head>
2517 </head>
2516 <body>
2518 <body>
2517
2519
2518 <div class="container">
2520 <div class="container">
2519 <div class="menu">
2521 <div class="menu">
2520 <div class="logo">
2522 <div class="logo">
2521 <a href="https://mercurial-scm.org/">
2523 <a href="https://mercurial-scm.org/">
2522 <img src="/static/hglogo.png" alt="mercurial" /></a>
2524 <img src="/static/hglogo.png" alt="mercurial" /></a>
2523 </div>
2525 </div>
2524 <ul>
2526 <ul>
2525 <li><a href="/shortlog">log</a></li>
2527 <li><a href="/shortlog">log</a></li>
2526 <li><a href="/graph">graph</a></li>
2528 <li><a href="/graph">graph</a></li>
2527 <li><a href="/tags">tags</a></li>
2529 <li><a href="/tags">tags</a></li>
2528 <li><a href="/bookmarks">bookmarks</a></li>
2530 <li><a href="/bookmarks">bookmarks</a></li>
2529 <li><a href="/branches">branches</a></li>
2531 <li><a href="/branches">branches</a></li>
2530 </ul>
2532 </ul>
2531 <ul>
2533 <ul>
2532 <li class="active"><a href="/help">help</a></li>
2534 <li class="active"><a href="/help">help</a></li>
2533 </ul>
2535 </ul>
2534 </div>
2536 </div>
2535
2537
2536 <div class="main">
2538 <div class="main">
2537 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2539 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2538 <h3>Help: add</h3>
2540 <h3>Help: add</h3>
2539
2541
2540 <form class="search" action="/log">
2542 <form class="search" action="/log">
2541
2543
2542 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2544 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2543 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2545 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2544 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2546 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2545 </form>
2547 </form>
2546 <div id="doc">
2548 <div id="doc">
2547 <p>
2549 <p>
2548 hg add [OPTION]... [FILE]...
2550 hg add [OPTION]... [FILE]...
2549 </p>
2551 </p>
2550 <p>
2552 <p>
2551 add the specified files on the next commit
2553 add the specified files on the next commit
2552 </p>
2554 </p>
2553 <p>
2555 <p>
2554 Schedule files to be version controlled and added to the
2556 Schedule files to be version controlled and added to the
2555 repository.
2557 repository.
2556 </p>
2558 </p>
2557 <p>
2559 <p>
2558 The files will be added to the repository at the next commit. To
2560 The files will be added to the repository at the next commit. To
2559 undo an add before that, see 'hg forget'.
2561 undo an add before that, see 'hg forget'.
2560 </p>
2562 </p>
2561 <p>
2563 <p>
2562 If no names are given, add all files to the repository (except
2564 If no names are given, add all files to the repository (except
2563 files matching &quot;.hgignore&quot;).
2565 files matching &quot;.hgignore&quot;).
2564 </p>
2566 </p>
2565 <p>
2567 <p>
2566 Examples:
2568 Examples:
2567 </p>
2569 </p>
2568 <ul>
2570 <ul>
2569 <li> New (unknown) files are added automatically by 'hg add':
2571 <li> New (unknown) files are added automatically by 'hg add':
2570 <pre>
2572 <pre>
2571 \$ ls (re)
2573 \$ ls (re)
2572 foo.c
2574 foo.c
2573 \$ hg status (re)
2575 \$ hg status (re)
2574 ? foo.c
2576 ? foo.c
2575 \$ hg add (re)
2577 \$ hg add (re)
2576 adding foo.c
2578 adding foo.c
2577 \$ hg status (re)
2579 \$ hg status (re)
2578 A foo.c
2580 A foo.c
2579 </pre>
2581 </pre>
2580 <li> Specific files to be added can be specified:
2582 <li> Specific files to be added can be specified:
2581 <pre>
2583 <pre>
2582 \$ ls (re)
2584 \$ ls (re)
2583 bar.c foo.c
2585 bar.c foo.c
2584 \$ hg status (re)
2586 \$ hg status (re)
2585 ? bar.c
2587 ? bar.c
2586 ? foo.c
2588 ? foo.c
2587 \$ hg add bar.c (re)
2589 \$ hg add bar.c (re)
2588 \$ hg status (re)
2590 \$ hg status (re)
2589 A bar.c
2591 A bar.c
2590 ? foo.c
2592 ? foo.c
2591 </pre>
2593 </pre>
2592 </ul>
2594 </ul>
2593 <p>
2595 <p>
2594 Returns 0 if all files are successfully added.
2596 Returns 0 if all files are successfully added.
2595 </p>
2597 </p>
2596 <p>
2598 <p>
2597 options ([+] can be repeated):
2599 options ([+] can be repeated):
2598 </p>
2600 </p>
2599 <table>
2601 <table>
2600 <tr><td>-I</td>
2602 <tr><td>-I</td>
2601 <td>--include PATTERN [+]</td>
2603 <td>--include PATTERN [+]</td>
2602 <td>include names matching the given patterns</td></tr>
2604 <td>include names matching the given patterns</td></tr>
2603 <tr><td>-X</td>
2605 <tr><td>-X</td>
2604 <td>--exclude PATTERN [+]</td>
2606 <td>--exclude PATTERN [+]</td>
2605 <td>exclude names matching the given patterns</td></tr>
2607 <td>exclude names matching the given patterns</td></tr>
2606 <tr><td>-S</td>
2608 <tr><td>-S</td>
2607 <td>--subrepos</td>
2609 <td>--subrepos</td>
2608 <td>recurse into subrepositories</td></tr>
2610 <td>recurse into subrepositories</td></tr>
2609 <tr><td>-n</td>
2611 <tr><td>-n</td>
2610 <td>--dry-run</td>
2612 <td>--dry-run</td>
2611 <td>do not perform actions, just print output</td></tr>
2613 <td>do not perform actions, just print output</td></tr>
2612 </table>
2614 </table>
2613 <p>
2615 <p>
2614 global options ([+] can be repeated):
2616 global options ([+] can be repeated):
2615 </p>
2617 </p>
2616 <table>
2618 <table>
2617 <tr><td>-R</td>
2619 <tr><td>-R</td>
2618 <td>--repository REPO</td>
2620 <td>--repository REPO</td>
2619 <td>repository root directory or name of overlay bundle file</td></tr>
2621 <td>repository root directory or name of overlay bundle file</td></tr>
2620 <tr><td></td>
2622 <tr><td></td>
2621 <td>--cwd DIR</td>
2623 <td>--cwd DIR</td>
2622 <td>change working directory</td></tr>
2624 <td>change working directory</td></tr>
2623 <tr><td>-y</td>
2625 <tr><td>-y</td>
2624 <td>--noninteractive</td>
2626 <td>--noninteractive</td>
2625 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2627 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2626 <tr><td>-q</td>
2628 <tr><td>-q</td>
2627 <td>--quiet</td>
2629 <td>--quiet</td>
2628 <td>suppress output</td></tr>
2630 <td>suppress output</td></tr>
2629 <tr><td>-v</td>
2631 <tr><td>-v</td>
2630 <td>--verbose</td>
2632 <td>--verbose</td>
2631 <td>enable additional output</td></tr>
2633 <td>enable additional output</td></tr>
2632 <tr><td></td>
2634 <tr><td></td>
2633 <td>--color TYPE</td>
2635 <td>--color TYPE</td>
2634 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2636 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2635 <tr><td></td>
2637 <tr><td></td>
2636 <td>--config CONFIG [+]</td>
2638 <td>--config CONFIG [+]</td>
2637 <td>set/override config option (use 'section.name=value')</td></tr>
2639 <td>set/override config option (use 'section.name=value')</td></tr>
2638 <tr><td></td>
2640 <tr><td></td>
2639 <td>--debug</td>
2641 <td>--debug</td>
2640 <td>enable debugging output</td></tr>
2642 <td>enable debugging output</td></tr>
2641 <tr><td></td>
2643 <tr><td></td>
2642 <td>--debugger</td>
2644 <td>--debugger</td>
2643 <td>start debugger</td></tr>
2645 <td>start debugger</td></tr>
2644 <tr><td></td>
2646 <tr><td></td>
2645 <td>--encoding ENCODE</td>
2647 <td>--encoding ENCODE</td>
2646 <td>set the charset encoding (default: ascii)</td></tr>
2648 <td>set the charset encoding (default: ascii)</td></tr>
2647 <tr><td></td>
2649 <tr><td></td>
2648 <td>--encodingmode MODE</td>
2650 <td>--encodingmode MODE</td>
2649 <td>set the charset encoding mode (default: strict)</td></tr>
2651 <td>set the charset encoding mode (default: strict)</td></tr>
2650 <tr><td></td>
2652 <tr><td></td>
2651 <td>--traceback</td>
2653 <td>--traceback</td>
2652 <td>always print a traceback on exception</td></tr>
2654 <td>always print a traceback on exception</td></tr>
2653 <tr><td></td>
2655 <tr><td></td>
2654 <td>--time</td>
2656 <td>--time</td>
2655 <td>time how long the command takes</td></tr>
2657 <td>time how long the command takes</td></tr>
2656 <tr><td></td>
2658 <tr><td></td>
2657 <td>--profile</td>
2659 <td>--profile</td>
2658 <td>print command execution profile</td></tr>
2660 <td>print command execution profile</td></tr>
2659 <tr><td></td>
2661 <tr><td></td>
2660 <td>--version</td>
2662 <td>--version</td>
2661 <td>output version information and exit</td></tr>
2663 <td>output version information and exit</td></tr>
2662 <tr><td>-h</td>
2664 <tr><td>-h</td>
2663 <td>--help</td>
2665 <td>--help</td>
2664 <td>display help and exit</td></tr>
2666 <td>display help and exit</td></tr>
2665 <tr><td></td>
2667 <tr><td></td>
2666 <td>--hidden</td>
2668 <td>--hidden</td>
2667 <td>consider hidden changesets</td></tr>
2669 <td>consider hidden changesets</td></tr>
2668 <tr><td></td>
2670 <tr><td></td>
2669 <td>--pager TYPE</td>
2671 <td>--pager TYPE</td>
2670 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2672 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2671 </table>
2673 </table>
2672
2674
2673 </div>
2675 </div>
2674 </div>
2676 </div>
2675 </div>
2677 </div>
2676
2678
2677
2679
2678
2680
2679 </body>
2681 </body>
2680 </html>
2682 </html>
2681
2683
2682
2684
2683 $ get-with-headers.py $LOCALIP:$HGPORT "help/remove"
2685 $ get-with-headers.py $LOCALIP:$HGPORT "help/remove"
2684 200 Script output follows
2686 200 Script output follows
2685
2687
2686 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2688 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2687 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2689 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2688 <head>
2690 <head>
2689 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2691 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2690 <meta name="robots" content="index, nofollow" />
2692 <meta name="robots" content="index, nofollow" />
2691 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2693 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2692 <script type="text/javascript" src="/static/mercurial.js"></script>
2694 <script type="text/javascript" src="/static/mercurial.js"></script>
2693
2695
2694 <title>Help: remove</title>
2696 <title>Help: remove</title>
2695 </head>
2697 </head>
2696 <body>
2698 <body>
2697
2699
2698 <div class="container">
2700 <div class="container">
2699 <div class="menu">
2701 <div class="menu">
2700 <div class="logo">
2702 <div class="logo">
2701 <a href="https://mercurial-scm.org/">
2703 <a href="https://mercurial-scm.org/">
2702 <img src="/static/hglogo.png" alt="mercurial" /></a>
2704 <img src="/static/hglogo.png" alt="mercurial" /></a>
2703 </div>
2705 </div>
2704 <ul>
2706 <ul>
2705 <li><a href="/shortlog">log</a></li>
2707 <li><a href="/shortlog">log</a></li>
2706 <li><a href="/graph">graph</a></li>
2708 <li><a href="/graph">graph</a></li>
2707 <li><a href="/tags">tags</a></li>
2709 <li><a href="/tags">tags</a></li>
2708 <li><a href="/bookmarks">bookmarks</a></li>
2710 <li><a href="/bookmarks">bookmarks</a></li>
2709 <li><a href="/branches">branches</a></li>
2711 <li><a href="/branches">branches</a></li>
2710 </ul>
2712 </ul>
2711 <ul>
2713 <ul>
2712 <li class="active"><a href="/help">help</a></li>
2714 <li class="active"><a href="/help">help</a></li>
2713 </ul>
2715 </ul>
2714 </div>
2716 </div>
2715
2717
2716 <div class="main">
2718 <div class="main">
2717 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2719 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2718 <h3>Help: remove</h3>
2720 <h3>Help: remove</h3>
2719
2721
2720 <form class="search" action="/log">
2722 <form class="search" action="/log">
2721
2723
2722 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2724 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2723 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2725 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2724 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2726 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2725 </form>
2727 </form>
2726 <div id="doc">
2728 <div id="doc">
2727 <p>
2729 <p>
2728 hg remove [OPTION]... FILE...
2730 hg remove [OPTION]... FILE...
2729 </p>
2731 </p>
2730 <p>
2732 <p>
2731 aliases: rm
2733 aliases: rm
2732 </p>
2734 </p>
2733 <p>
2735 <p>
2734 remove the specified files on the next commit
2736 remove the specified files on the next commit
2735 </p>
2737 </p>
2736 <p>
2738 <p>
2737 Schedule the indicated files for removal from the current branch.
2739 Schedule the indicated files for removal from the current branch.
2738 </p>
2740 </p>
2739 <p>
2741 <p>
2740 This command schedules the files to be removed at the next commit.
2742 This command schedules the files to be removed at the next commit.
2741 To undo a remove before that, see 'hg revert'. To undo added
2743 To undo a remove before that, see 'hg revert'. To undo added
2742 files, see 'hg forget'.
2744 files, see 'hg forget'.
2743 </p>
2745 </p>
2744 <p>
2746 <p>
2745 -A/--after can be used to remove only files that have already
2747 -A/--after can be used to remove only files that have already
2746 been deleted, -f/--force can be used to force deletion, and -Af
2748 been deleted, -f/--force can be used to force deletion, and -Af
2747 can be used to remove files from the next revision without
2749 can be used to remove files from the next revision without
2748 deleting them from the working directory.
2750 deleting them from the working directory.
2749 </p>
2751 </p>
2750 <p>
2752 <p>
2751 The following table details the behavior of remove for different
2753 The following table details the behavior of remove for different
2752 file states (columns) and option combinations (rows). The file
2754 file states (columns) and option combinations (rows). The file
2753 states are Added [A], Clean [C], Modified [M] and Missing [!]
2755 states are Added [A], Clean [C], Modified [M] and Missing [!]
2754 (as reported by 'hg status'). The actions are Warn, Remove
2756 (as reported by 'hg status'). The actions are Warn, Remove
2755 (from branch) and Delete (from disk):
2757 (from branch) and Delete (from disk):
2756 </p>
2758 </p>
2757 <table>
2759 <table>
2758 <tr><td>opt/state</td>
2760 <tr><td>opt/state</td>
2759 <td>A</td>
2761 <td>A</td>
2760 <td>C</td>
2762 <td>C</td>
2761 <td>M</td>
2763 <td>M</td>
2762 <td>!</td></tr>
2764 <td>!</td></tr>
2763 <tr><td>none</td>
2765 <tr><td>none</td>
2764 <td>W</td>
2766 <td>W</td>
2765 <td>RD</td>
2767 <td>RD</td>
2766 <td>W</td>
2768 <td>W</td>
2767 <td>R</td></tr>
2769 <td>R</td></tr>
2768 <tr><td>-f</td>
2770 <tr><td>-f</td>
2769 <td>R</td>
2771 <td>R</td>
2770 <td>RD</td>
2772 <td>RD</td>
2771 <td>RD</td>
2773 <td>RD</td>
2772 <td>R</td></tr>
2774 <td>R</td></tr>
2773 <tr><td>-A</td>
2775 <tr><td>-A</td>
2774 <td>W</td>
2776 <td>W</td>
2775 <td>W</td>
2777 <td>W</td>
2776 <td>W</td>
2778 <td>W</td>
2777 <td>R</td></tr>
2779 <td>R</td></tr>
2778 <tr><td>-Af</td>
2780 <tr><td>-Af</td>
2779 <td>R</td>
2781 <td>R</td>
2780 <td>R</td>
2782 <td>R</td>
2781 <td>R</td>
2783 <td>R</td>
2782 <td>R</td></tr>
2784 <td>R</td></tr>
2783 </table>
2785 </table>
2784 <p>
2786 <p>
2785 <b>Note:</b>
2787 <b>Note:</b>
2786 </p>
2788 </p>
2787 <p>
2789 <p>
2788 'hg remove' never deletes files in Added [A] state from the
2790 'hg remove' never deletes files in Added [A] state from the
2789 working directory, not even if &quot;--force&quot; is specified.
2791 working directory, not even if &quot;--force&quot; is specified.
2790 </p>
2792 </p>
2791 <p>
2793 <p>
2792 Returns 0 on success, 1 if any warnings encountered.
2794 Returns 0 on success, 1 if any warnings encountered.
2793 </p>
2795 </p>
2794 <p>
2796 <p>
2795 options ([+] can be repeated):
2797 options ([+] can be repeated):
2796 </p>
2798 </p>
2797 <table>
2799 <table>
2798 <tr><td>-A</td>
2800 <tr><td>-A</td>
2799 <td>--after</td>
2801 <td>--after</td>
2800 <td>record delete for missing files</td></tr>
2802 <td>record delete for missing files</td></tr>
2801 <tr><td>-f</td>
2803 <tr><td>-f</td>
2802 <td>--force</td>
2804 <td>--force</td>
2803 <td>forget added files, delete modified files</td></tr>
2805 <td>forget added files, delete modified files</td></tr>
2804 <tr><td>-S</td>
2806 <tr><td>-S</td>
2805 <td>--subrepos</td>
2807 <td>--subrepos</td>
2806 <td>recurse into subrepositories</td></tr>
2808 <td>recurse into subrepositories</td></tr>
2807 <tr><td>-I</td>
2809 <tr><td>-I</td>
2808 <td>--include PATTERN [+]</td>
2810 <td>--include PATTERN [+]</td>
2809 <td>include names matching the given patterns</td></tr>
2811 <td>include names matching the given patterns</td></tr>
2810 <tr><td>-X</td>
2812 <tr><td>-X</td>
2811 <td>--exclude PATTERN [+]</td>
2813 <td>--exclude PATTERN [+]</td>
2812 <td>exclude names matching the given patterns</td></tr>
2814 <td>exclude names matching the given patterns</td></tr>
2813 </table>
2815 </table>
2814 <p>
2816 <p>
2815 global options ([+] can be repeated):
2817 global options ([+] can be repeated):
2816 </p>
2818 </p>
2817 <table>
2819 <table>
2818 <tr><td>-R</td>
2820 <tr><td>-R</td>
2819 <td>--repository REPO</td>
2821 <td>--repository REPO</td>
2820 <td>repository root directory or name of overlay bundle file</td></tr>
2822 <td>repository root directory or name of overlay bundle file</td></tr>
2821 <tr><td></td>
2823 <tr><td></td>
2822 <td>--cwd DIR</td>
2824 <td>--cwd DIR</td>
2823 <td>change working directory</td></tr>
2825 <td>change working directory</td></tr>
2824 <tr><td>-y</td>
2826 <tr><td>-y</td>
2825 <td>--noninteractive</td>
2827 <td>--noninteractive</td>
2826 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2828 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2827 <tr><td>-q</td>
2829 <tr><td>-q</td>
2828 <td>--quiet</td>
2830 <td>--quiet</td>
2829 <td>suppress output</td></tr>
2831 <td>suppress output</td></tr>
2830 <tr><td>-v</td>
2832 <tr><td>-v</td>
2831 <td>--verbose</td>
2833 <td>--verbose</td>
2832 <td>enable additional output</td></tr>
2834 <td>enable additional output</td></tr>
2833 <tr><td></td>
2835 <tr><td></td>
2834 <td>--color TYPE</td>
2836 <td>--color TYPE</td>
2835 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2837 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2836 <tr><td></td>
2838 <tr><td></td>
2837 <td>--config CONFIG [+]</td>
2839 <td>--config CONFIG [+]</td>
2838 <td>set/override config option (use 'section.name=value')</td></tr>
2840 <td>set/override config option (use 'section.name=value')</td></tr>
2839 <tr><td></td>
2841 <tr><td></td>
2840 <td>--debug</td>
2842 <td>--debug</td>
2841 <td>enable debugging output</td></tr>
2843 <td>enable debugging output</td></tr>
2842 <tr><td></td>
2844 <tr><td></td>
2843 <td>--debugger</td>
2845 <td>--debugger</td>
2844 <td>start debugger</td></tr>
2846 <td>start debugger</td></tr>
2845 <tr><td></td>
2847 <tr><td></td>
2846 <td>--encoding ENCODE</td>
2848 <td>--encoding ENCODE</td>
2847 <td>set the charset encoding (default: ascii)</td></tr>
2849 <td>set the charset encoding (default: ascii)</td></tr>
2848 <tr><td></td>
2850 <tr><td></td>
2849 <td>--encodingmode MODE</td>
2851 <td>--encodingmode MODE</td>
2850 <td>set the charset encoding mode (default: strict)</td></tr>
2852 <td>set the charset encoding mode (default: strict)</td></tr>
2851 <tr><td></td>
2853 <tr><td></td>
2852 <td>--traceback</td>
2854 <td>--traceback</td>
2853 <td>always print a traceback on exception</td></tr>
2855 <td>always print a traceback on exception</td></tr>
2854 <tr><td></td>
2856 <tr><td></td>
2855 <td>--time</td>
2857 <td>--time</td>
2856 <td>time how long the command takes</td></tr>
2858 <td>time how long the command takes</td></tr>
2857 <tr><td></td>
2859 <tr><td></td>
2858 <td>--profile</td>
2860 <td>--profile</td>
2859 <td>print command execution profile</td></tr>
2861 <td>print command execution profile</td></tr>
2860 <tr><td></td>
2862 <tr><td></td>
2861 <td>--version</td>
2863 <td>--version</td>
2862 <td>output version information and exit</td></tr>
2864 <td>output version information and exit</td></tr>
2863 <tr><td>-h</td>
2865 <tr><td>-h</td>
2864 <td>--help</td>
2866 <td>--help</td>
2865 <td>display help and exit</td></tr>
2867 <td>display help and exit</td></tr>
2866 <tr><td></td>
2868 <tr><td></td>
2867 <td>--hidden</td>
2869 <td>--hidden</td>
2868 <td>consider hidden changesets</td></tr>
2870 <td>consider hidden changesets</td></tr>
2869 <tr><td></td>
2871 <tr><td></td>
2870 <td>--pager TYPE</td>
2872 <td>--pager TYPE</td>
2871 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2873 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2872 </table>
2874 </table>
2873
2875
2874 </div>
2876 </div>
2875 </div>
2877 </div>
2876 </div>
2878 </div>
2877
2879
2878
2880
2879
2881
2880 </body>
2882 </body>
2881 </html>
2883 </html>
2882
2884
2883
2885
2884 $ get-with-headers.py $LOCALIP:$HGPORT "help/dates"
2886 $ get-with-headers.py $LOCALIP:$HGPORT "help/dates"
2885 200 Script output follows
2887 200 Script output follows
2886
2888
2887 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2889 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2888 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2890 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2889 <head>
2891 <head>
2890 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2892 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2891 <meta name="robots" content="index, nofollow" />
2893 <meta name="robots" content="index, nofollow" />
2892 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2894 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2893 <script type="text/javascript" src="/static/mercurial.js"></script>
2895 <script type="text/javascript" src="/static/mercurial.js"></script>
2894
2896
2895 <title>Help: dates</title>
2897 <title>Help: dates</title>
2896 </head>
2898 </head>
2897 <body>
2899 <body>
2898
2900
2899 <div class="container">
2901 <div class="container">
2900 <div class="menu">
2902 <div class="menu">
2901 <div class="logo">
2903 <div class="logo">
2902 <a href="https://mercurial-scm.org/">
2904 <a href="https://mercurial-scm.org/">
2903 <img src="/static/hglogo.png" alt="mercurial" /></a>
2905 <img src="/static/hglogo.png" alt="mercurial" /></a>
2904 </div>
2906 </div>
2905 <ul>
2907 <ul>
2906 <li><a href="/shortlog">log</a></li>
2908 <li><a href="/shortlog">log</a></li>
2907 <li><a href="/graph">graph</a></li>
2909 <li><a href="/graph">graph</a></li>
2908 <li><a href="/tags">tags</a></li>
2910 <li><a href="/tags">tags</a></li>
2909 <li><a href="/bookmarks">bookmarks</a></li>
2911 <li><a href="/bookmarks">bookmarks</a></li>
2910 <li><a href="/branches">branches</a></li>
2912 <li><a href="/branches">branches</a></li>
2911 </ul>
2913 </ul>
2912 <ul>
2914 <ul>
2913 <li class="active"><a href="/help">help</a></li>
2915 <li class="active"><a href="/help">help</a></li>
2914 </ul>
2916 </ul>
2915 </div>
2917 </div>
2916
2918
2917 <div class="main">
2919 <div class="main">
2918 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2920 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2919 <h3>Help: dates</h3>
2921 <h3>Help: dates</h3>
2920
2922
2921 <form class="search" action="/log">
2923 <form class="search" action="/log">
2922
2924
2923 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2925 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2924 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2926 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2925 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2927 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2926 </form>
2928 </form>
2927 <div id="doc">
2929 <div id="doc">
2928 <h1>Date Formats</h1>
2930 <h1>Date Formats</h1>
2929 <p>
2931 <p>
2930 Some commands allow the user to specify a date, e.g.:
2932 Some commands allow the user to specify a date, e.g.:
2931 </p>
2933 </p>
2932 <ul>
2934 <ul>
2933 <li> backout, commit, import, tag: Specify the commit date.
2935 <li> backout, commit, import, tag: Specify the commit date.
2934 <li> log, revert, update: Select revision(s) by date.
2936 <li> log, revert, update: Select revision(s) by date.
2935 </ul>
2937 </ul>
2936 <p>
2938 <p>
2937 Many date formats are valid. Here are some examples:
2939 Many date formats are valid. Here are some examples:
2938 </p>
2940 </p>
2939 <ul>
2941 <ul>
2940 <li> &quot;Wed Dec 6 13:18:29 2006&quot; (local timezone assumed)
2942 <li> &quot;Wed Dec 6 13:18:29 2006&quot; (local timezone assumed)
2941 <li> &quot;Dec 6 13:18 -0600&quot; (year assumed, time offset provided)
2943 <li> &quot;Dec 6 13:18 -0600&quot; (year assumed, time offset provided)
2942 <li> &quot;Dec 6 13:18 UTC&quot; (UTC and GMT are aliases for +0000)
2944 <li> &quot;Dec 6 13:18 UTC&quot; (UTC and GMT are aliases for +0000)
2943 <li> &quot;Dec 6&quot; (midnight)
2945 <li> &quot;Dec 6&quot; (midnight)
2944 <li> &quot;13:18&quot; (today assumed)
2946 <li> &quot;13:18&quot; (today assumed)
2945 <li> &quot;3:39&quot; (3:39AM assumed)
2947 <li> &quot;3:39&quot; (3:39AM assumed)
2946 <li> &quot;3:39pm&quot; (15:39)
2948 <li> &quot;3:39pm&quot; (15:39)
2947 <li> &quot;2006-12-06 13:18:29&quot; (ISO 8601 format)
2949 <li> &quot;2006-12-06 13:18:29&quot; (ISO 8601 format)
2948 <li> &quot;2006-12-6 13:18&quot;
2950 <li> &quot;2006-12-6 13:18&quot;
2949 <li> &quot;2006-12-6&quot;
2951 <li> &quot;2006-12-6&quot;
2950 <li> &quot;12-6&quot;
2952 <li> &quot;12-6&quot;
2951 <li> &quot;12/6&quot;
2953 <li> &quot;12/6&quot;
2952 <li> &quot;12/6/6&quot; (Dec 6 2006)
2954 <li> &quot;12/6/6&quot; (Dec 6 2006)
2953 <li> &quot;today&quot; (midnight)
2955 <li> &quot;today&quot; (midnight)
2954 <li> &quot;yesterday&quot; (midnight)
2956 <li> &quot;yesterday&quot; (midnight)
2955 <li> &quot;now&quot; - right now
2957 <li> &quot;now&quot; - right now
2956 </ul>
2958 </ul>
2957 <p>
2959 <p>
2958 Lastly, there is Mercurial's internal format:
2960 Lastly, there is Mercurial's internal format:
2959 </p>
2961 </p>
2960 <ul>
2962 <ul>
2961 <li> &quot;1165411109 0&quot; (Wed Dec 6 13:18:29 2006 UTC)
2963 <li> &quot;1165411109 0&quot; (Wed Dec 6 13:18:29 2006 UTC)
2962 </ul>
2964 </ul>
2963 <p>
2965 <p>
2964 This is the internal representation format for dates. The first number
2966 This is the internal representation format for dates. The first number
2965 is the number of seconds since the epoch (1970-01-01 00:00 UTC). The
2967 is the number of seconds since the epoch (1970-01-01 00:00 UTC). The
2966 second is the offset of the local timezone, in seconds west of UTC
2968 second is the offset of the local timezone, in seconds west of UTC
2967 (negative if the timezone is east of UTC).
2969 (negative if the timezone is east of UTC).
2968 </p>
2970 </p>
2969 <p>
2971 <p>
2970 The log command also accepts date ranges:
2972 The log command also accepts date ranges:
2971 </p>
2973 </p>
2972 <ul>
2974 <ul>
2973 <li> &quot;&lt;DATE&quot; - at or before a given date/time
2975 <li> &quot;&lt;DATE&quot; - at or before a given date/time
2974 <li> &quot;&gt;DATE&quot; - on or after a given date/time
2976 <li> &quot;&gt;DATE&quot; - on or after a given date/time
2975 <li> &quot;DATE to DATE&quot; - a date range, inclusive
2977 <li> &quot;DATE to DATE&quot; - a date range, inclusive
2976 <li> &quot;-DAYS&quot; - within a given number of days of today
2978 <li> &quot;-DAYS&quot; - within a given number of days of today
2977 </ul>
2979 </ul>
2978
2980
2979 </div>
2981 </div>
2980 </div>
2982 </div>
2981 </div>
2983 </div>
2982
2984
2983
2985
2984
2986
2985 </body>
2987 </body>
2986 </html>
2988 </html>
2987
2989
2988
2990
2989 Sub-topic indexes rendered properly
2991 Sub-topic indexes rendered properly
2990
2992
2991 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals"
2993 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals"
2992 200 Script output follows
2994 200 Script output follows
2993
2995
2994 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2996 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2995 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2997 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2996 <head>
2998 <head>
2997 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2999 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2998 <meta name="robots" content="index, nofollow" />
3000 <meta name="robots" content="index, nofollow" />
2999 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3001 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3000 <script type="text/javascript" src="/static/mercurial.js"></script>
3002 <script type="text/javascript" src="/static/mercurial.js"></script>
3001
3003
3002 <title>Help: internals</title>
3004 <title>Help: internals</title>
3003 </head>
3005 </head>
3004 <body>
3006 <body>
3005
3007
3006 <div class="container">
3008 <div class="container">
3007 <div class="menu">
3009 <div class="menu">
3008 <div class="logo">
3010 <div class="logo">
3009 <a href="https://mercurial-scm.org/">
3011 <a href="https://mercurial-scm.org/">
3010 <img src="/static/hglogo.png" alt="mercurial" /></a>
3012 <img src="/static/hglogo.png" alt="mercurial" /></a>
3011 </div>
3013 </div>
3012 <ul>
3014 <ul>
3013 <li><a href="/shortlog">log</a></li>
3015 <li><a href="/shortlog">log</a></li>
3014 <li><a href="/graph">graph</a></li>
3016 <li><a href="/graph">graph</a></li>
3015 <li><a href="/tags">tags</a></li>
3017 <li><a href="/tags">tags</a></li>
3016 <li><a href="/bookmarks">bookmarks</a></li>
3018 <li><a href="/bookmarks">bookmarks</a></li>
3017 <li><a href="/branches">branches</a></li>
3019 <li><a href="/branches">branches</a></li>
3018 </ul>
3020 </ul>
3019 <ul>
3021 <ul>
3020 <li><a href="/help">help</a></li>
3022 <li><a href="/help">help</a></li>
3021 </ul>
3023 </ul>
3022 </div>
3024 </div>
3023
3025
3024 <div class="main">
3026 <div class="main">
3025 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3027 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3026
3028
3027 <form class="search" action="/log">
3029 <form class="search" action="/log">
3028
3030
3029 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3031 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3030 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3032 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3031 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3033 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3032 </form>
3034 </form>
3033 <table class="bigtable">
3035 <table class="bigtable">
3034 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
3036 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
3035
3037
3036 <tr><td>
3038 <tr><td>
3037 <a href="/help/internals.bundles">
3039 <a href="/help/internals.bundles">
3038 bundles
3040 bundles
3039 </a>
3041 </a>
3040 </td><td>
3042 </td><td>
3041 Bundles
3043 Bundles
3042 </td></tr>
3044 </td></tr>
3043 <tr><td>
3045 <tr><td>
3044 <a href="/help/internals.censor">
3046 <a href="/help/internals.censor">
3045 censor
3047 censor
3046 </a>
3048 </a>
3047 </td><td>
3049 </td><td>
3048 Censor
3050 Censor
3049 </td></tr>
3051 </td></tr>
3050 <tr><td>
3052 <tr><td>
3051 <a href="/help/internals.changegroups">
3053 <a href="/help/internals.changegroups">
3052 changegroups
3054 changegroups
3053 </a>
3055 </a>
3054 </td><td>
3056 </td><td>
3055 Changegroups
3057 Changegroups
3056 </td></tr>
3058 </td></tr>
3057 <tr><td>
3059 <tr><td>
3058 <a href="/help/internals.config">
3060 <a href="/help/internals.config">
3059 config
3061 config
3060 </a>
3062 </a>
3061 </td><td>
3063 </td><td>
3062 Config Registrar
3064 Config Registrar
3063 </td></tr>
3065 </td></tr>
3064 <tr><td>
3066 <tr><td>
3065 <a href="/help/internals.requirements">
3067 <a href="/help/internals.requirements">
3066 requirements
3068 requirements
3067 </a>
3069 </a>
3068 </td><td>
3070 </td><td>
3069 Repository Requirements
3071 Repository Requirements
3070 </td></tr>
3072 </td></tr>
3071 <tr><td>
3073 <tr><td>
3072 <a href="/help/internals.revlogs">
3074 <a href="/help/internals.revlogs">
3073 revlogs
3075 revlogs
3074 </a>
3076 </a>
3075 </td><td>
3077 </td><td>
3076 Revision Logs
3078 Revision Logs
3077 </td></tr>
3079 </td></tr>
3078 <tr><td>
3080 <tr><td>
3079 <a href="/help/internals.wireprotocol">
3081 <a href="/help/internals.wireprotocol">
3080 wireprotocol
3082 wireprotocol
3081 </a>
3083 </a>
3082 </td><td>
3084 </td><td>
3083 Wire Protocol
3085 Wire Protocol
3084 </td></tr>
3086 </td></tr>
3085
3087
3086
3088
3087
3089
3088
3090
3089
3091
3090 </table>
3092 </table>
3091 </div>
3093 </div>
3092 </div>
3094 </div>
3093
3095
3094
3096
3095
3097
3096 </body>
3098 </body>
3097 </html>
3099 </html>
3098
3100
3099
3101
3100 Sub-topic topics rendered properly
3102 Sub-topic topics rendered properly
3101
3103
3102 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals.changegroups"
3104 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals.changegroups"
3103 200 Script output follows
3105 200 Script output follows
3104
3106
3105 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3107 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3106 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3108 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3107 <head>
3109 <head>
3108 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3110 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3109 <meta name="robots" content="index, nofollow" />
3111 <meta name="robots" content="index, nofollow" />
3110 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3112 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3111 <script type="text/javascript" src="/static/mercurial.js"></script>
3113 <script type="text/javascript" src="/static/mercurial.js"></script>
3112
3114
3113 <title>Help: internals.changegroups</title>
3115 <title>Help: internals.changegroups</title>
3114 </head>
3116 </head>
3115 <body>
3117 <body>
3116
3118
3117 <div class="container">
3119 <div class="container">
3118 <div class="menu">
3120 <div class="menu">
3119 <div class="logo">
3121 <div class="logo">
3120 <a href="https://mercurial-scm.org/">
3122 <a href="https://mercurial-scm.org/">
3121 <img src="/static/hglogo.png" alt="mercurial" /></a>
3123 <img src="/static/hglogo.png" alt="mercurial" /></a>
3122 </div>
3124 </div>
3123 <ul>
3125 <ul>
3124 <li><a href="/shortlog">log</a></li>
3126 <li><a href="/shortlog">log</a></li>
3125 <li><a href="/graph">graph</a></li>
3127 <li><a href="/graph">graph</a></li>
3126 <li><a href="/tags">tags</a></li>
3128 <li><a href="/tags">tags</a></li>
3127 <li><a href="/bookmarks">bookmarks</a></li>
3129 <li><a href="/bookmarks">bookmarks</a></li>
3128 <li><a href="/branches">branches</a></li>
3130 <li><a href="/branches">branches</a></li>
3129 </ul>
3131 </ul>
3130 <ul>
3132 <ul>
3131 <li class="active"><a href="/help">help</a></li>
3133 <li class="active"><a href="/help">help</a></li>
3132 </ul>
3134 </ul>
3133 </div>
3135 </div>
3134
3136
3135 <div class="main">
3137 <div class="main">
3136 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3138 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3137 <h3>Help: internals.changegroups</h3>
3139 <h3>Help: internals.changegroups</h3>
3138
3140
3139 <form class="search" action="/log">
3141 <form class="search" action="/log">
3140
3142
3141 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3143 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3142 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3144 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3143 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3145 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3144 </form>
3146 </form>
3145 <div id="doc">
3147 <div id="doc">
3146 <h1>Changegroups</h1>
3148 <h1>Changegroups</h1>
3147 <p>
3149 <p>
3148 Changegroups are representations of repository revlog data, specifically
3150 Changegroups are representations of repository revlog data, specifically
3149 the changelog data, root/flat manifest data, treemanifest data, and
3151 the changelog data, root/flat manifest data, treemanifest data, and
3150 filelogs.
3152 filelogs.
3151 </p>
3153 </p>
3152 <p>
3154 <p>
3153 There are 3 versions of changegroups: &quot;1&quot;, &quot;2&quot;, and &quot;3&quot;. From a
3155 There are 3 versions of changegroups: &quot;1&quot;, &quot;2&quot;, and &quot;3&quot;. From a
3154 high-level, versions &quot;1&quot; and &quot;2&quot; are almost exactly the same, with the
3156 high-level, versions &quot;1&quot; and &quot;2&quot; are almost exactly the same, with the
3155 only difference being an additional item in the *delta header*. Version
3157 only difference being an additional item in the *delta header*. Version
3156 &quot;3&quot; adds support for revlog flags in the *delta header* and optionally
3158 &quot;3&quot; adds support for revlog flags in the *delta header* and optionally
3157 exchanging treemanifests (enabled by setting an option on the
3159 exchanging treemanifests (enabled by setting an option on the
3158 &quot;changegroup&quot; part in the bundle2).
3160 &quot;changegroup&quot; part in the bundle2).
3159 </p>
3161 </p>
3160 <p>
3162 <p>
3161 Changegroups when not exchanging treemanifests consist of 3 logical
3163 Changegroups when not exchanging treemanifests consist of 3 logical
3162 segments:
3164 segments:
3163 </p>
3165 </p>
3164 <pre>
3166 <pre>
3165 +---------------------------------+
3167 +---------------------------------+
3166 | | | |
3168 | | | |
3167 | changeset | manifest | filelogs |
3169 | changeset | manifest | filelogs |
3168 | | | |
3170 | | | |
3169 | | | |
3171 | | | |
3170 +---------------------------------+
3172 +---------------------------------+
3171 </pre>
3173 </pre>
3172 <p>
3174 <p>
3173 When exchanging treemanifests, there are 4 logical segments:
3175 When exchanging treemanifests, there are 4 logical segments:
3174 </p>
3176 </p>
3175 <pre>
3177 <pre>
3176 +-------------------------------------------------+
3178 +-------------------------------------------------+
3177 | | | | |
3179 | | | | |
3178 | changeset | root | treemanifests | filelogs |
3180 | changeset | root | treemanifests | filelogs |
3179 | | manifest | | |
3181 | | manifest | | |
3180 | | | | |
3182 | | | | |
3181 +-------------------------------------------------+
3183 +-------------------------------------------------+
3182 </pre>
3184 </pre>
3183 <p>
3185 <p>
3184 The principle building block of each segment is a *chunk*. A *chunk*
3186 The principle building block of each segment is a *chunk*. A *chunk*
3185 is a framed piece of data:
3187 is a framed piece of data:
3186 </p>
3188 </p>
3187 <pre>
3189 <pre>
3188 +---------------------------------------+
3190 +---------------------------------------+
3189 | | |
3191 | | |
3190 | length | data |
3192 | length | data |
3191 | (4 bytes) | (&lt;length - 4&gt; bytes) |
3193 | (4 bytes) | (&lt;length - 4&gt; bytes) |
3192 | | |
3194 | | |
3193 +---------------------------------------+
3195 +---------------------------------------+
3194 </pre>
3196 </pre>
3195 <p>
3197 <p>
3196 All integers are big-endian signed integers. Each chunk starts with a 32-bit
3198 All integers are big-endian signed integers. Each chunk starts with a 32-bit
3197 integer indicating the length of the entire chunk (including the length field
3199 integer indicating the length of the entire chunk (including the length field
3198 itself).
3200 itself).
3199 </p>
3201 </p>
3200 <p>
3202 <p>
3201 There is a special case chunk that has a value of 0 for the length
3203 There is a special case chunk that has a value of 0 for the length
3202 (&quot;0x00000000&quot;). We call this an *empty chunk*.
3204 (&quot;0x00000000&quot;). We call this an *empty chunk*.
3203 </p>
3205 </p>
3204 <h2>Delta Groups</h2>
3206 <h2>Delta Groups</h2>
3205 <p>
3207 <p>
3206 A *delta group* expresses the content of a revlog as a series of deltas,
3208 A *delta group* expresses the content of a revlog as a series of deltas,
3207 or patches against previous revisions.
3209 or patches against previous revisions.
3208 </p>
3210 </p>
3209 <p>
3211 <p>
3210 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
3212 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
3211 to signal the end of the delta group:
3213 to signal the end of the delta group:
3212 </p>
3214 </p>
3213 <pre>
3215 <pre>
3214 +------------------------------------------------------------------------+
3216 +------------------------------------------------------------------------+
3215 | | | | | |
3217 | | | | | |
3216 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
3218 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
3217 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
3219 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
3218 | | | | | |
3220 | | | | | |
3219 +------------------------------------------------------------------------+
3221 +------------------------------------------------------------------------+
3220 </pre>
3222 </pre>
3221 <p>
3223 <p>
3222 Each *chunk*'s data consists of the following:
3224 Each *chunk*'s data consists of the following:
3223 </p>
3225 </p>
3224 <pre>
3226 <pre>
3225 +---------------------------------------+
3227 +---------------------------------------+
3226 | | |
3228 | | |
3227 | delta header | delta data |
3229 | delta header | delta data |
3228 | (various by version) | (various) |
3230 | (various by version) | (various) |
3229 | | |
3231 | | |
3230 +---------------------------------------+
3232 +---------------------------------------+
3231 </pre>
3233 </pre>
3232 <p>
3234 <p>
3233 The *delta data* is a series of *delta*s that describe a diff from an existing
3235 The *delta data* is a series of *delta*s that describe a diff from an existing
3234 entry (either that the recipient already has, or previously specified in the
3236 entry (either that the recipient already has, or previously specified in the
3235 bundle/changegroup).
3237 bundle/changegroup).
3236 </p>
3238 </p>
3237 <p>
3239 <p>
3238 The *delta header* is different between versions &quot;1&quot;, &quot;2&quot;, and
3240 The *delta header* is different between versions &quot;1&quot;, &quot;2&quot;, and
3239 &quot;3&quot; of the changegroup format.
3241 &quot;3&quot; of the changegroup format.
3240 </p>
3242 </p>
3241 <p>
3243 <p>
3242 Version 1 (headerlen=80):
3244 Version 1 (headerlen=80):
3243 </p>
3245 </p>
3244 <pre>
3246 <pre>
3245 +------------------------------------------------------+
3247 +------------------------------------------------------+
3246 | | | | |
3248 | | | | |
3247 | node | p1 node | p2 node | link node |
3249 | node | p1 node | p2 node | link node |
3248 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3250 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3249 | | | | |
3251 | | | | |
3250 +------------------------------------------------------+
3252 +------------------------------------------------------+
3251 </pre>
3253 </pre>
3252 <p>
3254 <p>
3253 Version 2 (headerlen=100):
3255 Version 2 (headerlen=100):
3254 </p>
3256 </p>
3255 <pre>
3257 <pre>
3256 +------------------------------------------------------------------+
3258 +------------------------------------------------------------------+
3257 | | | | | |
3259 | | | | | |
3258 | node | p1 node | p2 node | base node | link node |
3260 | node | p1 node | p2 node | base node | link node |
3259 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3261 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3260 | | | | | |
3262 | | | | | |
3261 +------------------------------------------------------------------+
3263 +------------------------------------------------------------------+
3262 </pre>
3264 </pre>
3263 <p>
3265 <p>
3264 Version 3 (headerlen=102):
3266 Version 3 (headerlen=102):
3265 </p>
3267 </p>
3266 <pre>
3268 <pre>
3267 +------------------------------------------------------------------------------+
3269 +------------------------------------------------------------------------------+
3268 | | | | | | |
3270 | | | | | | |
3269 | node | p1 node | p2 node | base node | link node | flags |
3271 | node | p1 node | p2 node | base node | link node | flags |
3270 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
3272 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
3271 | | | | | | |
3273 | | | | | | |
3272 +------------------------------------------------------------------------------+
3274 +------------------------------------------------------------------------------+
3273 </pre>
3275 </pre>
3274 <p>
3276 <p>
3275 The *delta data* consists of &quot;chunklen - 4 - headerlen&quot; bytes, which contain a
3277 The *delta data* consists of &quot;chunklen - 4 - headerlen&quot; bytes, which contain a
3276 series of *delta*s, densely packed (no separators). These deltas describe a diff
3278 series of *delta*s, densely packed (no separators). These deltas describe a diff
3277 from an existing entry (either that the recipient already has, or previously
3279 from an existing entry (either that the recipient already has, or previously
3278 specified in the bundle/changegroup). The format is described more fully in
3280 specified in the bundle/changegroup). The format is described more fully in
3279 &quot;hg help internals.bdiff&quot;, but briefly:
3281 &quot;hg help internals.bdiff&quot;, but briefly:
3280 </p>
3282 </p>
3281 <pre>
3283 <pre>
3282 +---------------------------------------------------------------+
3284 +---------------------------------------------------------------+
3283 | | | | |
3285 | | | | |
3284 | start offset | end offset | new length | content |
3286 | start offset | end offset | new length | content |
3285 | (4 bytes) | (4 bytes) | (4 bytes) | (&lt;new length&gt; bytes) |
3287 | (4 bytes) | (4 bytes) | (4 bytes) | (&lt;new length&gt; bytes) |
3286 | | | | |
3288 | | | | |
3287 +---------------------------------------------------------------+
3289 +---------------------------------------------------------------+
3288 </pre>
3290 </pre>
3289 <p>
3291 <p>
3290 Please note that the length field in the delta data does *not* include itself.
3292 Please note that the length field in the delta data does *not* include itself.
3291 </p>
3293 </p>
3292 <p>
3294 <p>
3293 In version 1, the delta is always applied against the previous node from
3295 In version 1, the delta is always applied against the previous node from
3294 the changegroup or the first parent if this is the first entry in the
3296 the changegroup or the first parent if this is the first entry in the
3295 changegroup.
3297 changegroup.
3296 </p>
3298 </p>
3297 <p>
3299 <p>
3298 In version 2 and up, the delta base node is encoded in the entry in the
3300 In version 2 and up, the delta base node is encoded in the entry in the
3299 changegroup. This allows the delta to be expressed against any parent,
3301 changegroup. This allows the delta to be expressed against any parent,
3300 which can result in smaller deltas and more efficient encoding of data.
3302 which can result in smaller deltas and more efficient encoding of data.
3301 </p>
3303 </p>
3302 <h2>Changeset Segment</h2>
3304 <h2>Changeset Segment</h2>
3303 <p>
3305 <p>
3304 The *changeset segment* consists of a single *delta group* holding
3306 The *changeset segment* consists of a single *delta group* holding
3305 changelog data. The *empty chunk* at the end of the *delta group* denotes
3307 changelog data. The *empty chunk* at the end of the *delta group* denotes
3306 the boundary to the *manifest segment*.
3308 the boundary to the *manifest segment*.
3307 </p>
3309 </p>
3308 <h2>Manifest Segment</h2>
3310 <h2>Manifest Segment</h2>
3309 <p>
3311 <p>
3310 The *manifest segment* consists of a single *delta group* holding manifest
3312 The *manifest segment* consists of a single *delta group* holding manifest
3311 data. If treemanifests are in use, it contains only the manifest for the
3313 data. If treemanifests are in use, it contains only the manifest for the
3312 root directory of the repository. Otherwise, it contains the entire
3314 root directory of the repository. Otherwise, it contains the entire
3313 manifest data. The *empty chunk* at the end of the *delta group* denotes
3315 manifest data. The *empty chunk* at the end of the *delta group* denotes
3314 the boundary to the next segment (either the *treemanifests segment* or the
3316 the boundary to the next segment (either the *treemanifests segment* or the
3315 *filelogs segment*, depending on version and the request options).
3317 *filelogs segment*, depending on version and the request options).
3316 </p>
3318 </p>
3317 <h3>Treemanifests Segment</h3>
3319 <h3>Treemanifests Segment</h3>
3318 <p>
3320 <p>
3319 The *treemanifests segment* only exists in changegroup version &quot;3&quot;, and
3321 The *treemanifests segment* only exists in changegroup version &quot;3&quot;, and
3320 only if the 'treemanifest' param is part of the bundle2 changegroup part
3322 only if the 'treemanifest' param is part of the bundle2 changegroup part
3321 (it is not possible to use changegroup version 3 outside of bundle2).
3323 (it is not possible to use changegroup version 3 outside of bundle2).
3322 Aside from the filenames in the *treemanifests segment* containing a
3324 Aside from the filenames in the *treemanifests segment* containing a
3323 trailing &quot;/&quot; character, it behaves identically to the *filelogs segment*
3325 trailing &quot;/&quot; character, it behaves identically to the *filelogs segment*
3324 (see below). The final sub-segment is followed by an *empty chunk* (logically,
3326 (see below). The final sub-segment is followed by an *empty chunk* (logically,
3325 a sub-segment with filename size 0). This denotes the boundary to the
3327 a sub-segment with filename size 0). This denotes the boundary to the
3326 *filelogs segment*.
3328 *filelogs segment*.
3327 </p>
3329 </p>
3328 <h2>Filelogs Segment</h2>
3330 <h2>Filelogs Segment</h2>
3329 <p>
3331 <p>
3330 The *filelogs segment* consists of multiple sub-segments, each
3332 The *filelogs segment* consists of multiple sub-segments, each
3331 corresponding to an individual file whose data is being described:
3333 corresponding to an individual file whose data is being described:
3332 </p>
3334 </p>
3333 <pre>
3335 <pre>
3334 +--------------------------------------------------+
3336 +--------------------------------------------------+
3335 | | | | | |
3337 | | | | | |
3336 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
3338 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
3337 | | | | | (4 bytes) |
3339 | | | | | (4 bytes) |
3338 | | | | | |
3340 | | | | | |
3339 +--------------------------------------------------+
3341 +--------------------------------------------------+
3340 </pre>
3342 </pre>
3341 <p>
3343 <p>
3342 The final filelog sub-segment is followed by an *empty chunk* (logically,
3344 The final filelog sub-segment is followed by an *empty chunk* (logically,
3343 a sub-segment with filename size 0). This denotes the end of the segment
3345 a sub-segment with filename size 0). This denotes the end of the segment
3344 and of the overall changegroup.
3346 and of the overall changegroup.
3345 </p>
3347 </p>
3346 <p>
3348 <p>
3347 Each filelog sub-segment consists of the following:
3349 Each filelog sub-segment consists of the following:
3348 </p>
3350 </p>
3349 <pre>
3351 <pre>
3350 +------------------------------------------------------+
3352 +------------------------------------------------------+
3351 | | | |
3353 | | | |
3352 | filename length | filename | delta group |
3354 | filename length | filename | delta group |
3353 | (4 bytes) | (&lt;length - 4&gt; bytes) | (various) |
3355 | (4 bytes) | (&lt;length - 4&gt; bytes) | (various) |
3354 | | | |
3356 | | | |
3355 +------------------------------------------------------+
3357 +------------------------------------------------------+
3356 </pre>
3358 </pre>
3357 <p>
3359 <p>
3358 That is, a *chunk* consisting of the filename (not terminated or padded)
3360 That is, a *chunk* consisting of the filename (not terminated or padded)
3359 followed by N chunks constituting the *delta group* for this file. The
3361 followed by N chunks constituting the *delta group* for this file. The
3360 *empty chunk* at the end of each *delta group* denotes the boundary to the
3362 *empty chunk* at the end of each *delta group* denotes the boundary to the
3361 next filelog sub-segment.
3363 next filelog sub-segment.
3362 </p>
3364 </p>
3363
3365
3364 </div>
3366 </div>
3365 </div>
3367 </div>
3366 </div>
3368 </div>
3367
3369
3368
3370
3369
3371
3370 </body>
3372 </body>
3371 </html>
3373 </html>
3372
3374
3373
3375
3374 $ killdaemons.py
3376 $ killdaemons.py
3375
3377
3376 #endif
3378 #endif
General Comments 0
You need to be logged in to leave comments. Login now