##// END OF EJS Templates
debug: add a method to check the state of, and built an SSL cert chain...
Matt Harbison -
r33493:9a9f9521 default
parent child Browse files
Show More
@@ -1,2249 +1,2310 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 difflib
10 import difflib
11 import errno
11 import errno
12 import operator
12 import operator
13 import os
13 import os
14 import random
14 import random
15 import socket
15 import socket
16 import ssl
16 import string
17 import string
17 import sys
18 import sys
18 import tempfile
19 import tempfile
19 import time
20 import time
20
21
21 from .i18n import _
22 from .i18n import _
22 from .node import (
23 from .node import (
23 bin,
24 bin,
24 hex,
25 hex,
25 nullhex,
26 nullhex,
26 nullid,
27 nullid,
27 nullrev,
28 nullrev,
28 short,
29 short,
29 )
30 )
30 from . import (
31 from . import (
31 bundle2,
32 bundle2,
32 changegroup,
33 changegroup,
33 cmdutil,
34 cmdutil,
34 color,
35 color,
35 context,
36 context,
36 dagparser,
37 dagparser,
37 dagutil,
38 dagutil,
38 encoding,
39 encoding,
39 error,
40 error,
40 exchange,
41 exchange,
41 extensions,
42 extensions,
42 filemerge,
43 filemerge,
43 fileset,
44 fileset,
44 formatter,
45 formatter,
45 hg,
46 hg,
46 localrepo,
47 localrepo,
47 lock as lockmod,
48 lock as lockmod,
48 merge as mergemod,
49 merge as mergemod,
49 obsolete,
50 obsolete,
50 obsutil,
51 obsutil,
51 phases,
52 phases,
52 policy,
53 policy,
53 pvec,
54 pvec,
54 pycompat,
55 pycompat,
55 registrar,
56 registrar,
56 repair,
57 repair,
57 revlog,
58 revlog,
58 revset,
59 revset,
59 revsetlang,
60 revsetlang,
60 scmutil,
61 scmutil,
61 setdiscovery,
62 setdiscovery,
62 simplemerge,
63 simplemerge,
63 smartset,
64 smartset,
64 sslutil,
65 sslutil,
65 streamclone,
66 streamclone,
66 templater,
67 templater,
67 treediscovery,
68 treediscovery,
68 upgrade,
69 upgrade,
69 util,
70 util,
70 vfs as vfsmod,
71 vfs as vfsmod,
71 )
72 )
72
73
73 release = lockmod.release
74 release = lockmod.release
74
75
75 command = registrar.command()
76 command = registrar.command()
76
77
77 @command('debugancestor', [], _('[INDEX] REV1 REV2'), optionalrepo=True)
78 @command('debugancestor', [], _('[INDEX] REV1 REV2'), optionalrepo=True)
78 def debugancestor(ui, repo, *args):
79 def debugancestor(ui, repo, *args):
79 """find the ancestor revision of two revisions in a given index"""
80 """find the ancestor revision of two revisions in a given index"""
80 if len(args) == 3:
81 if len(args) == 3:
81 index, rev1, rev2 = args
82 index, rev1, rev2 = args
82 r = revlog.revlog(vfsmod.vfs(pycompat.getcwd(), audit=False), index)
83 r = revlog.revlog(vfsmod.vfs(pycompat.getcwd(), audit=False), index)
83 lookup = r.lookup
84 lookup = r.lookup
84 elif len(args) == 2:
85 elif len(args) == 2:
85 if not repo:
86 if not repo:
86 raise error.Abort(_('there is no Mercurial repository here '
87 raise error.Abort(_('there is no Mercurial repository here '
87 '(.hg not found)'))
88 '(.hg not found)'))
88 rev1, rev2 = args
89 rev1, rev2 = args
89 r = repo.changelog
90 r = repo.changelog
90 lookup = repo.lookup
91 lookup = repo.lookup
91 else:
92 else:
92 raise error.Abort(_('either two or three arguments required'))
93 raise error.Abort(_('either two or three arguments required'))
93 a = r.ancestor(lookup(rev1), lookup(rev2))
94 a = r.ancestor(lookup(rev1), lookup(rev2))
94 ui.write('%d:%s\n' % (r.rev(a), hex(a)))
95 ui.write('%d:%s\n' % (r.rev(a), hex(a)))
95
96
96 @command('debugapplystreamclonebundle', [], 'FILE')
97 @command('debugapplystreamclonebundle', [], 'FILE')
97 def debugapplystreamclonebundle(ui, repo, fname):
98 def debugapplystreamclonebundle(ui, repo, fname):
98 """apply a stream clone bundle file"""
99 """apply a stream clone bundle file"""
99 f = hg.openpath(ui, fname)
100 f = hg.openpath(ui, fname)
100 gen = exchange.readbundle(ui, f, fname)
101 gen = exchange.readbundle(ui, f, fname)
101 gen.apply(repo)
102 gen.apply(repo)
102
103
103 @command('debugbuilddag',
104 @command('debugbuilddag',
104 [('m', 'mergeable-file', None, _('add single file mergeable changes')),
105 [('m', 'mergeable-file', None, _('add single file mergeable changes')),
105 ('o', 'overwritten-file', None, _('add single file all revs overwrite')),
106 ('o', 'overwritten-file', None, _('add single file all revs overwrite')),
106 ('n', 'new-file', None, _('add new file at each rev'))],
107 ('n', 'new-file', None, _('add new file at each rev'))],
107 _('[OPTION]... [TEXT]'))
108 _('[OPTION]... [TEXT]'))
108 def debugbuilddag(ui, repo, text=None,
109 def debugbuilddag(ui, repo, text=None,
109 mergeable_file=False,
110 mergeable_file=False,
110 overwritten_file=False,
111 overwritten_file=False,
111 new_file=False):
112 new_file=False):
112 """builds a repo with a given DAG from scratch in the current empty repo
113 """builds a repo with a given DAG from scratch in the current empty repo
113
114
114 The description of the DAG is read from stdin if not given on the
115 The description of the DAG is read from stdin if not given on the
115 command line.
116 command line.
116
117
117 Elements:
118 Elements:
118
119
119 - "+n" is a linear run of n nodes based on the current default parent
120 - "+n" is a linear run of n nodes based on the current default parent
120 - "." is a single node based on the current default parent
121 - "." is a single node based on the current default parent
121 - "$" resets the default parent to null (implied at the start);
122 - "$" resets the default parent to null (implied at the start);
122 otherwise the default parent is always the last node created
123 otherwise the default parent is always the last node created
123 - "<p" sets the default parent to the backref p
124 - "<p" sets the default parent to the backref p
124 - "*p" is a fork at parent p, which is a backref
125 - "*p" is a fork at parent p, which is a backref
125 - "*p1/p2" is a merge of parents p1 and p2, which are backrefs
126 - "*p1/p2" is a merge of parents p1 and p2, which are backrefs
126 - "/p2" is a merge of the preceding node and p2
127 - "/p2" is a merge of the preceding node and p2
127 - ":tag" defines a local tag for the preceding node
128 - ":tag" defines a local tag for the preceding node
128 - "@branch" sets the named branch for subsequent nodes
129 - "@branch" sets the named branch for subsequent nodes
129 - "#...\\n" is a comment up to the end of the line
130 - "#...\\n" is a comment up to the end of the line
130
131
131 Whitespace between the above elements is ignored.
132 Whitespace between the above elements is ignored.
132
133
133 A backref is either
134 A backref is either
134
135
135 - a number n, which references the node curr-n, where curr is the current
136 - a number n, which references the node curr-n, where curr is the current
136 node, or
137 node, or
137 - the name of a local tag you placed earlier using ":tag", or
138 - the name of a local tag you placed earlier using ":tag", or
138 - empty to denote the default parent.
139 - empty to denote the default parent.
139
140
140 All string valued-elements are either strictly alphanumeric, or must
141 All string valued-elements are either strictly alphanumeric, or must
141 be enclosed in double quotes ("..."), with "\\" as escape character.
142 be enclosed in double quotes ("..."), with "\\" as escape character.
142 """
143 """
143
144
144 if text is None:
145 if text is None:
145 ui.status(_("reading DAG from stdin\n"))
146 ui.status(_("reading DAG from stdin\n"))
146 text = ui.fin.read()
147 text = ui.fin.read()
147
148
148 cl = repo.changelog
149 cl = repo.changelog
149 if len(cl) > 0:
150 if len(cl) > 0:
150 raise error.Abort(_('repository is not empty'))
151 raise error.Abort(_('repository is not empty'))
151
152
152 # determine number of revs in DAG
153 # determine number of revs in DAG
153 total = 0
154 total = 0
154 for type, data in dagparser.parsedag(text):
155 for type, data in dagparser.parsedag(text):
155 if type == 'n':
156 if type == 'n':
156 total += 1
157 total += 1
157
158
158 if mergeable_file:
159 if mergeable_file:
159 linesperrev = 2
160 linesperrev = 2
160 # make a file with k lines per rev
161 # make a file with k lines per rev
161 initialmergedlines = [str(i) for i in xrange(0, total * linesperrev)]
162 initialmergedlines = [str(i) for i in xrange(0, total * linesperrev)]
162 initialmergedlines.append("")
163 initialmergedlines.append("")
163
164
164 tags = []
165 tags = []
165
166
166 wlock = lock = tr = None
167 wlock = lock = tr = None
167 try:
168 try:
168 wlock = repo.wlock()
169 wlock = repo.wlock()
169 lock = repo.lock()
170 lock = repo.lock()
170 tr = repo.transaction("builddag")
171 tr = repo.transaction("builddag")
171
172
172 at = -1
173 at = -1
173 atbranch = 'default'
174 atbranch = 'default'
174 nodeids = []
175 nodeids = []
175 id = 0
176 id = 0
176 ui.progress(_('building'), id, unit=_('revisions'), total=total)
177 ui.progress(_('building'), id, unit=_('revisions'), total=total)
177 for type, data in dagparser.parsedag(text):
178 for type, data in dagparser.parsedag(text):
178 if type == 'n':
179 if type == 'n':
179 ui.note(('node %s\n' % str(data)))
180 ui.note(('node %s\n' % str(data)))
180 id, ps = data
181 id, ps = data
181
182
182 files = []
183 files = []
183 fctxs = {}
184 fctxs = {}
184
185
185 p2 = None
186 p2 = None
186 if mergeable_file:
187 if mergeable_file:
187 fn = "mf"
188 fn = "mf"
188 p1 = repo[ps[0]]
189 p1 = repo[ps[0]]
189 if len(ps) > 1:
190 if len(ps) > 1:
190 p2 = repo[ps[1]]
191 p2 = repo[ps[1]]
191 pa = p1.ancestor(p2)
192 pa = p1.ancestor(p2)
192 base, local, other = [x[fn].data() for x in (pa, p1,
193 base, local, other = [x[fn].data() for x in (pa, p1,
193 p2)]
194 p2)]
194 m3 = simplemerge.Merge3Text(base, local, other)
195 m3 = simplemerge.Merge3Text(base, local, other)
195 ml = [l.strip() for l in m3.merge_lines()]
196 ml = [l.strip() for l in m3.merge_lines()]
196 ml.append("")
197 ml.append("")
197 elif at > 0:
198 elif at > 0:
198 ml = p1[fn].data().split("\n")
199 ml = p1[fn].data().split("\n")
199 else:
200 else:
200 ml = initialmergedlines
201 ml = initialmergedlines
201 ml[id * linesperrev] += " r%i" % id
202 ml[id * linesperrev] += " r%i" % id
202 mergedtext = "\n".join(ml)
203 mergedtext = "\n".join(ml)
203 files.append(fn)
204 files.append(fn)
204 fctxs[fn] = context.memfilectx(repo, fn, mergedtext)
205 fctxs[fn] = context.memfilectx(repo, fn, mergedtext)
205
206
206 if overwritten_file:
207 if overwritten_file:
207 fn = "of"
208 fn = "of"
208 files.append(fn)
209 files.append(fn)
209 fctxs[fn] = context.memfilectx(repo, fn, "r%i\n" % id)
210 fctxs[fn] = context.memfilectx(repo, fn, "r%i\n" % id)
210
211
211 if new_file:
212 if new_file:
212 fn = "nf%i" % id
213 fn = "nf%i" % id
213 files.append(fn)
214 files.append(fn)
214 fctxs[fn] = context.memfilectx(repo, fn, "r%i\n" % id)
215 fctxs[fn] = context.memfilectx(repo, fn, "r%i\n" % id)
215 if len(ps) > 1:
216 if len(ps) > 1:
216 if not p2:
217 if not p2:
217 p2 = repo[ps[1]]
218 p2 = repo[ps[1]]
218 for fn in p2:
219 for fn in p2:
219 if fn.startswith("nf"):
220 if fn.startswith("nf"):
220 files.append(fn)
221 files.append(fn)
221 fctxs[fn] = p2[fn]
222 fctxs[fn] = p2[fn]
222
223
223 def fctxfn(repo, cx, path):
224 def fctxfn(repo, cx, path):
224 return fctxs.get(path)
225 return fctxs.get(path)
225
226
226 if len(ps) == 0 or ps[0] < 0:
227 if len(ps) == 0 or ps[0] < 0:
227 pars = [None, None]
228 pars = [None, None]
228 elif len(ps) == 1:
229 elif len(ps) == 1:
229 pars = [nodeids[ps[0]], None]
230 pars = [nodeids[ps[0]], None]
230 else:
231 else:
231 pars = [nodeids[p] for p in ps]
232 pars = [nodeids[p] for p in ps]
232 cx = context.memctx(repo, pars, "r%i" % id, files, fctxfn,
233 cx = context.memctx(repo, pars, "r%i" % id, files, fctxfn,
233 date=(id, 0),
234 date=(id, 0),
234 user="debugbuilddag",
235 user="debugbuilddag",
235 extra={'branch': atbranch})
236 extra={'branch': atbranch})
236 nodeid = repo.commitctx(cx)
237 nodeid = repo.commitctx(cx)
237 nodeids.append(nodeid)
238 nodeids.append(nodeid)
238 at = id
239 at = id
239 elif type == 'l':
240 elif type == 'l':
240 id, name = data
241 id, name = data
241 ui.note(('tag %s\n' % name))
242 ui.note(('tag %s\n' % name))
242 tags.append("%s %s\n" % (hex(repo.changelog.node(id)), name))
243 tags.append("%s %s\n" % (hex(repo.changelog.node(id)), name))
243 elif type == 'a':
244 elif type == 'a':
244 ui.note(('branch %s\n' % data))
245 ui.note(('branch %s\n' % data))
245 atbranch = data
246 atbranch = data
246 ui.progress(_('building'), id, unit=_('revisions'), total=total)
247 ui.progress(_('building'), id, unit=_('revisions'), total=total)
247 tr.close()
248 tr.close()
248
249
249 if tags:
250 if tags:
250 repo.vfs.write("localtags", "".join(tags))
251 repo.vfs.write("localtags", "".join(tags))
251 finally:
252 finally:
252 ui.progress(_('building'), None)
253 ui.progress(_('building'), None)
253 release(tr, lock, wlock)
254 release(tr, lock, wlock)
254
255
255 def _debugchangegroup(ui, gen, all=None, indent=0, **opts):
256 def _debugchangegroup(ui, gen, all=None, indent=0, **opts):
256 indent_string = ' ' * indent
257 indent_string = ' ' * indent
257 if all:
258 if all:
258 ui.write(("%sformat: id, p1, p2, cset, delta base, len(delta)\n")
259 ui.write(("%sformat: id, p1, p2, cset, delta base, len(delta)\n")
259 % indent_string)
260 % indent_string)
260
261
261 def showchunks(named):
262 def showchunks(named):
262 ui.write("\n%s%s\n" % (indent_string, named))
263 ui.write("\n%s%s\n" % (indent_string, named))
263 chain = None
264 chain = None
264 for chunkdata in iter(lambda: gen.deltachunk(chain), {}):
265 for chunkdata in iter(lambda: gen.deltachunk(chain), {}):
265 node = chunkdata['node']
266 node = chunkdata['node']
266 p1 = chunkdata['p1']
267 p1 = chunkdata['p1']
267 p2 = chunkdata['p2']
268 p2 = chunkdata['p2']
268 cs = chunkdata['cs']
269 cs = chunkdata['cs']
269 deltabase = chunkdata['deltabase']
270 deltabase = chunkdata['deltabase']
270 delta = chunkdata['delta']
271 delta = chunkdata['delta']
271 ui.write("%s%s %s %s %s %s %s\n" %
272 ui.write("%s%s %s %s %s %s %s\n" %
272 (indent_string, hex(node), hex(p1), hex(p2),
273 (indent_string, hex(node), hex(p1), hex(p2),
273 hex(cs), hex(deltabase), len(delta)))
274 hex(cs), hex(deltabase), len(delta)))
274 chain = node
275 chain = node
275
276
276 chunkdata = gen.changelogheader()
277 chunkdata = gen.changelogheader()
277 showchunks("changelog")
278 showchunks("changelog")
278 chunkdata = gen.manifestheader()
279 chunkdata = gen.manifestheader()
279 showchunks("manifest")
280 showchunks("manifest")
280 for chunkdata in iter(gen.filelogheader, {}):
281 for chunkdata in iter(gen.filelogheader, {}):
281 fname = chunkdata['filename']
282 fname = chunkdata['filename']
282 showchunks(fname)
283 showchunks(fname)
283 else:
284 else:
284 if isinstance(gen, bundle2.unbundle20):
285 if isinstance(gen, bundle2.unbundle20):
285 raise error.Abort(_('use debugbundle2 for this file'))
286 raise error.Abort(_('use debugbundle2 for this file'))
286 chunkdata = gen.changelogheader()
287 chunkdata = gen.changelogheader()
287 chain = None
288 chain = None
288 for chunkdata in iter(lambda: gen.deltachunk(chain), {}):
289 for chunkdata in iter(lambda: gen.deltachunk(chain), {}):
289 node = chunkdata['node']
290 node = chunkdata['node']
290 ui.write("%s%s\n" % (indent_string, hex(node)))
291 ui.write("%s%s\n" % (indent_string, hex(node)))
291 chain = node
292 chain = node
292
293
293 def _debugobsmarkers(ui, part, indent=0, **opts):
294 def _debugobsmarkers(ui, part, indent=0, **opts):
294 """display version and markers contained in 'data'"""
295 """display version and markers contained in 'data'"""
295 opts = pycompat.byteskwargs(opts)
296 opts = pycompat.byteskwargs(opts)
296 data = part.read()
297 data = part.read()
297 indent_string = ' ' * indent
298 indent_string = ' ' * indent
298 try:
299 try:
299 version, markers = obsolete._readmarkers(data)
300 version, markers = obsolete._readmarkers(data)
300 except error.UnknownVersion as exc:
301 except error.UnknownVersion as exc:
301 msg = "%sunsupported version: %s (%d bytes)\n"
302 msg = "%sunsupported version: %s (%d bytes)\n"
302 msg %= indent_string, exc.version, len(data)
303 msg %= indent_string, exc.version, len(data)
303 ui.write(msg)
304 ui.write(msg)
304 else:
305 else:
305 msg = "%sversion: %s (%d bytes)\n"
306 msg = "%sversion: %s (%d bytes)\n"
306 msg %= indent_string, version, len(data)
307 msg %= indent_string, version, len(data)
307 ui.write(msg)
308 ui.write(msg)
308 fm = ui.formatter('debugobsolete', opts)
309 fm = ui.formatter('debugobsolete', opts)
309 for rawmarker in sorted(markers):
310 for rawmarker in sorted(markers):
310 m = obsutil.marker(None, rawmarker)
311 m = obsutil.marker(None, rawmarker)
311 fm.startitem()
312 fm.startitem()
312 fm.plain(indent_string)
313 fm.plain(indent_string)
313 cmdutil.showmarker(fm, m)
314 cmdutil.showmarker(fm, m)
314 fm.end()
315 fm.end()
315
316
316 def _debugphaseheads(ui, data, indent=0):
317 def _debugphaseheads(ui, data, indent=0):
317 """display version and markers contained in 'data'"""
318 """display version and markers contained in 'data'"""
318 indent_string = ' ' * indent
319 indent_string = ' ' * indent
319 headsbyphase = bundle2._readphaseheads(data)
320 headsbyphase = bundle2._readphaseheads(data)
320 for phase in phases.allphases:
321 for phase in phases.allphases:
321 for head in headsbyphase[phase]:
322 for head in headsbyphase[phase]:
322 ui.write(indent_string)
323 ui.write(indent_string)
323 ui.write('%s %s\n' % (hex(head), phases.phasenames[phase]))
324 ui.write('%s %s\n' % (hex(head), phases.phasenames[phase]))
324
325
325 def _debugbundle2(ui, gen, all=None, **opts):
326 def _debugbundle2(ui, gen, all=None, **opts):
326 """lists the contents of a bundle2"""
327 """lists the contents of a bundle2"""
327 if not isinstance(gen, bundle2.unbundle20):
328 if not isinstance(gen, bundle2.unbundle20):
328 raise error.Abort(_('not a bundle2 file'))
329 raise error.Abort(_('not a bundle2 file'))
329 ui.write(('Stream params: %s\n' % repr(gen.params)))
330 ui.write(('Stream params: %s\n' % repr(gen.params)))
330 parttypes = opts.get(r'part_type', [])
331 parttypes = opts.get(r'part_type', [])
331 for part in gen.iterparts():
332 for part in gen.iterparts():
332 if parttypes and part.type not in parttypes:
333 if parttypes and part.type not in parttypes:
333 continue
334 continue
334 ui.write('%s -- %r\n' % (part.type, repr(part.params)))
335 ui.write('%s -- %r\n' % (part.type, repr(part.params)))
335 if part.type == 'changegroup':
336 if part.type == 'changegroup':
336 version = part.params.get('version', '01')
337 version = part.params.get('version', '01')
337 cg = changegroup.getunbundler(version, part, 'UN')
338 cg = changegroup.getunbundler(version, part, 'UN')
338 _debugchangegroup(ui, cg, all=all, indent=4, **opts)
339 _debugchangegroup(ui, cg, all=all, indent=4, **opts)
339 if part.type == 'obsmarkers':
340 if part.type == 'obsmarkers':
340 _debugobsmarkers(ui, part, indent=4, **opts)
341 _debugobsmarkers(ui, part, indent=4, **opts)
341 if part.type == 'phase-heads':
342 if part.type == 'phase-heads':
342 _debugphaseheads(ui, part, indent=4)
343 _debugphaseheads(ui, part, indent=4)
343
344
344 @command('debugbundle',
345 @command('debugbundle',
345 [('a', 'all', None, _('show all details')),
346 [('a', 'all', None, _('show all details')),
346 ('', 'part-type', [], _('show only the named part type')),
347 ('', 'part-type', [], _('show only the named part type')),
347 ('', 'spec', None, _('print the bundlespec of the bundle'))],
348 ('', 'spec', None, _('print the bundlespec of the bundle'))],
348 _('FILE'),
349 _('FILE'),
349 norepo=True)
350 norepo=True)
350 def debugbundle(ui, bundlepath, all=None, spec=None, **opts):
351 def debugbundle(ui, bundlepath, all=None, spec=None, **opts):
351 """lists the contents of a bundle"""
352 """lists the contents of a bundle"""
352 with hg.openpath(ui, bundlepath) as f:
353 with hg.openpath(ui, bundlepath) as f:
353 if spec:
354 if spec:
354 spec = exchange.getbundlespec(ui, f)
355 spec = exchange.getbundlespec(ui, f)
355 ui.write('%s\n' % spec)
356 ui.write('%s\n' % spec)
356 return
357 return
357
358
358 gen = exchange.readbundle(ui, f, bundlepath)
359 gen = exchange.readbundle(ui, f, bundlepath)
359 if isinstance(gen, bundle2.unbundle20):
360 if isinstance(gen, bundle2.unbundle20):
360 return _debugbundle2(ui, gen, all=all, **opts)
361 return _debugbundle2(ui, gen, all=all, **opts)
361 _debugchangegroup(ui, gen, all=all, **opts)
362 _debugchangegroup(ui, gen, all=all, **opts)
362
363
363 @command('debugcheckstate', [], '')
364 @command('debugcheckstate', [], '')
364 def debugcheckstate(ui, repo):
365 def debugcheckstate(ui, repo):
365 """validate the correctness of the current dirstate"""
366 """validate the correctness of the current dirstate"""
366 parent1, parent2 = repo.dirstate.parents()
367 parent1, parent2 = repo.dirstate.parents()
367 m1 = repo[parent1].manifest()
368 m1 = repo[parent1].manifest()
368 m2 = repo[parent2].manifest()
369 m2 = repo[parent2].manifest()
369 errors = 0
370 errors = 0
370 for f in repo.dirstate:
371 for f in repo.dirstate:
371 state = repo.dirstate[f]
372 state = repo.dirstate[f]
372 if state in "nr" and f not in m1:
373 if state in "nr" and f not in m1:
373 ui.warn(_("%s in state %s, but not in manifest1\n") % (f, state))
374 ui.warn(_("%s in state %s, but not in manifest1\n") % (f, state))
374 errors += 1
375 errors += 1
375 if state in "a" and f in m1:
376 if state in "a" and f in m1:
376 ui.warn(_("%s in state %s, but also in manifest1\n") % (f, state))
377 ui.warn(_("%s in state %s, but also in manifest1\n") % (f, state))
377 errors += 1
378 errors += 1
378 if state in "m" and f not in m1 and f not in m2:
379 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") %
380 ui.warn(_("%s in state %s, but not in either manifest\n") %
380 (f, state))
381 (f, state))
381 errors += 1
382 errors += 1
382 for f in m1:
383 for f in m1:
383 state = repo.dirstate[f]
384 state = repo.dirstate[f]
384 if state not in "nrm":
385 if state not in "nrm":
385 ui.warn(_("%s in manifest1, but listed as state %s") % (f, state))
386 ui.warn(_("%s in manifest1, but listed as state %s") % (f, state))
386 errors += 1
387 errors += 1
387 if errors:
388 if errors:
388 error = _(".hg/dirstate inconsistent with current parent's manifest")
389 error = _(".hg/dirstate inconsistent with current parent's manifest")
389 raise error.Abort(error)
390 raise error.Abort(error)
390
391
391 @command('debugcolor',
392 @command('debugcolor',
392 [('', 'style', None, _('show all configured styles'))],
393 [('', 'style', None, _('show all configured styles'))],
393 'hg debugcolor')
394 'hg debugcolor')
394 def debugcolor(ui, repo, **opts):
395 def debugcolor(ui, repo, **opts):
395 """show available color, effects or style"""
396 """show available color, effects or style"""
396 ui.write(('color mode: %s\n') % ui._colormode)
397 ui.write(('color mode: %s\n') % ui._colormode)
397 if opts.get(r'style'):
398 if opts.get(r'style'):
398 return _debugdisplaystyle(ui)
399 return _debugdisplaystyle(ui)
399 else:
400 else:
400 return _debugdisplaycolor(ui)
401 return _debugdisplaycolor(ui)
401
402
402 def _debugdisplaycolor(ui):
403 def _debugdisplaycolor(ui):
403 ui = ui.copy()
404 ui = ui.copy()
404 ui._styles.clear()
405 ui._styles.clear()
405 for effect in color._activeeffects(ui).keys():
406 for effect in color._activeeffects(ui).keys():
406 ui._styles[effect] = effect
407 ui._styles[effect] = effect
407 if ui._terminfoparams:
408 if ui._terminfoparams:
408 for k, v in ui.configitems('color'):
409 for k, v in ui.configitems('color'):
409 if k.startswith('color.'):
410 if k.startswith('color.'):
410 ui._styles[k] = k[6:]
411 ui._styles[k] = k[6:]
411 elif k.startswith('terminfo.'):
412 elif k.startswith('terminfo.'):
412 ui._styles[k] = k[9:]
413 ui._styles[k] = k[9:]
413 ui.write(_('available colors:\n'))
414 ui.write(_('available colors:\n'))
414 # sort label with a '_' after the other to group '_background' entry.
415 # sort label with a '_' after the other to group '_background' entry.
415 items = sorted(ui._styles.items(),
416 items = sorted(ui._styles.items(),
416 key=lambda i: ('_' in i[0], i[0], i[1]))
417 key=lambda i: ('_' in i[0], i[0], i[1]))
417 for colorname, label in items:
418 for colorname, label in items:
418 ui.write(('%s\n') % colorname, label=label)
419 ui.write(('%s\n') % colorname, label=label)
419
420
420 def _debugdisplaystyle(ui):
421 def _debugdisplaystyle(ui):
421 ui.write(_('available style:\n'))
422 ui.write(_('available style:\n'))
422 width = max(len(s) for s in ui._styles)
423 width = max(len(s) for s in ui._styles)
423 for label, effects in sorted(ui._styles.items()):
424 for label, effects in sorted(ui._styles.items()):
424 ui.write('%s' % label, label=label)
425 ui.write('%s' % label, label=label)
425 if effects:
426 if effects:
426 # 50
427 # 50
427 ui.write(': ')
428 ui.write(': ')
428 ui.write(' ' * (max(0, width - len(label))))
429 ui.write(' ' * (max(0, width - len(label))))
429 ui.write(', '.join(ui.label(e, e) for e in effects.split()))
430 ui.write(', '.join(ui.label(e, e) for e in effects.split()))
430 ui.write('\n')
431 ui.write('\n')
431
432
432 @command('debugcreatestreamclonebundle', [], 'FILE')
433 @command('debugcreatestreamclonebundle', [], 'FILE')
433 def debugcreatestreamclonebundle(ui, repo, fname):
434 def debugcreatestreamclonebundle(ui, repo, fname):
434 """create a stream clone bundle file
435 """create a stream clone bundle file
435
436
436 Stream bundles are special bundles that are essentially archives of
437 Stream bundles are special bundles that are essentially archives of
437 revlog files. They are commonly used for cloning very quickly.
438 revlog files. They are commonly used for cloning very quickly.
438 """
439 """
439 # TODO we may want to turn this into an abort when this functionality
440 # TODO we may want to turn this into an abort when this functionality
440 # is moved into `hg bundle`.
441 # is moved into `hg bundle`.
441 if phases.hassecret(repo):
442 if phases.hassecret(repo):
442 ui.warn(_('(warning: stream clone bundle will contain secret '
443 ui.warn(_('(warning: stream clone bundle will contain secret '
443 'revisions)\n'))
444 'revisions)\n'))
444
445
445 requirements, gen = streamclone.generatebundlev1(repo)
446 requirements, gen = streamclone.generatebundlev1(repo)
446 changegroup.writechunks(ui, gen, fname)
447 changegroup.writechunks(ui, gen, fname)
447
448
448 ui.write(_('bundle requirements: %s\n') % ', '.join(sorted(requirements)))
449 ui.write(_('bundle requirements: %s\n') % ', '.join(sorted(requirements)))
449
450
450 @command('debugdag',
451 @command('debugdag',
451 [('t', 'tags', None, _('use tags as labels')),
452 [('t', 'tags', None, _('use tags as labels')),
452 ('b', 'branches', None, _('annotate with branch names')),
453 ('b', 'branches', None, _('annotate with branch names')),
453 ('', 'dots', None, _('use dots for runs')),
454 ('', 'dots', None, _('use dots for runs')),
454 ('s', 'spaces', None, _('separate elements by spaces'))],
455 ('s', 'spaces', None, _('separate elements by spaces'))],
455 _('[OPTION]... [FILE [REV]...]'),
456 _('[OPTION]... [FILE [REV]...]'),
456 optionalrepo=True)
457 optionalrepo=True)
457 def debugdag(ui, repo, file_=None, *revs, **opts):
458 def debugdag(ui, repo, file_=None, *revs, **opts):
458 """format the changelog or an index DAG as a concise textual description
459 """format the changelog or an index DAG as a concise textual description
459
460
460 If you pass a revlog index, the revlog's DAG is emitted. If you list
461 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.
462 revision numbers, they get labeled in the output as rN.
462
463
463 Otherwise, the changelog DAG of the current repo is emitted.
464 Otherwise, the changelog DAG of the current repo is emitted.
464 """
465 """
465 spaces = opts.get(r'spaces')
466 spaces = opts.get(r'spaces')
466 dots = opts.get(r'dots')
467 dots = opts.get(r'dots')
467 if file_:
468 if file_:
468 rlog = revlog.revlog(vfsmod.vfs(pycompat.getcwd(), audit=False),
469 rlog = revlog.revlog(vfsmod.vfs(pycompat.getcwd(), audit=False),
469 file_)
470 file_)
470 revs = set((int(r) for r in revs))
471 revs = set((int(r) for r in revs))
471 def events():
472 def events():
472 for r in rlog:
473 for r in rlog:
473 yield 'n', (r, list(p for p in rlog.parentrevs(r)
474 yield 'n', (r, list(p for p in rlog.parentrevs(r)
474 if p != -1))
475 if p != -1))
475 if r in revs:
476 if r in revs:
476 yield 'l', (r, "r%i" % r)
477 yield 'l', (r, "r%i" % r)
477 elif repo:
478 elif repo:
478 cl = repo.changelog
479 cl = repo.changelog
479 tags = opts.get(r'tags')
480 tags = opts.get(r'tags')
480 branches = opts.get(r'branches')
481 branches = opts.get(r'branches')
481 if tags:
482 if tags:
482 labels = {}
483 labels = {}
483 for l, n in repo.tags().items():
484 for l, n in repo.tags().items():
484 labels.setdefault(cl.rev(n), []).append(l)
485 labels.setdefault(cl.rev(n), []).append(l)
485 def events():
486 def events():
486 b = "default"
487 b = "default"
487 for r in cl:
488 for r in cl:
488 if branches:
489 if branches:
489 newb = cl.read(cl.node(r))[5]['branch']
490 newb = cl.read(cl.node(r))[5]['branch']
490 if newb != b:
491 if newb != b:
491 yield 'a', newb
492 yield 'a', newb
492 b = newb
493 b = newb
493 yield 'n', (r, list(p for p in cl.parentrevs(r)
494 yield 'n', (r, list(p for p in cl.parentrevs(r)
494 if p != -1))
495 if p != -1))
495 if tags:
496 if tags:
496 ls = labels.get(r)
497 ls = labels.get(r)
497 if ls:
498 if ls:
498 for l in ls:
499 for l in ls:
499 yield 'l', (r, l)
500 yield 'l', (r, l)
500 else:
501 else:
501 raise error.Abort(_('need repo for changelog dag'))
502 raise error.Abort(_('need repo for changelog dag'))
502
503
503 for line in dagparser.dagtextlines(events(),
504 for line in dagparser.dagtextlines(events(),
504 addspaces=spaces,
505 addspaces=spaces,
505 wraplabels=True,
506 wraplabels=True,
506 wrapannotations=True,
507 wrapannotations=True,
507 wrapnonlinear=dots,
508 wrapnonlinear=dots,
508 usedots=dots,
509 usedots=dots,
509 maxlinewidth=70):
510 maxlinewidth=70):
510 ui.write(line)
511 ui.write(line)
511 ui.write("\n")
512 ui.write("\n")
512
513
513 @command('debugdata', cmdutil.debugrevlogopts, _('-c|-m|FILE REV'))
514 @command('debugdata', cmdutil.debugrevlogopts, _('-c|-m|FILE REV'))
514 def debugdata(ui, repo, file_, rev=None, **opts):
515 def debugdata(ui, repo, file_, rev=None, **opts):
515 """dump the contents of a data file revision"""
516 """dump the contents of a data file revision"""
516 opts = pycompat.byteskwargs(opts)
517 opts = pycompat.byteskwargs(opts)
517 if opts.get('changelog') or opts.get('manifest') or opts.get('dir'):
518 if opts.get('changelog') or opts.get('manifest') or opts.get('dir'):
518 if rev is not None:
519 if rev is not None:
519 raise error.CommandError('debugdata', _('invalid arguments'))
520 raise error.CommandError('debugdata', _('invalid arguments'))
520 file_, rev = None, file_
521 file_, rev = None, file_
521 elif rev is None:
522 elif rev is None:
522 raise error.CommandError('debugdata', _('invalid arguments'))
523 raise error.CommandError('debugdata', _('invalid arguments'))
523 r = cmdutil.openrevlog(repo, 'debugdata', file_, opts)
524 r = cmdutil.openrevlog(repo, 'debugdata', file_, opts)
524 try:
525 try:
525 ui.write(r.revision(r.lookup(rev), raw=True))
526 ui.write(r.revision(r.lookup(rev), raw=True))
526 except KeyError:
527 except KeyError:
527 raise error.Abort(_('invalid revision identifier %s') % rev)
528 raise error.Abort(_('invalid revision identifier %s') % rev)
528
529
529 @command('debugdate',
530 @command('debugdate',
530 [('e', 'extended', None, _('try extended date formats'))],
531 [('e', 'extended', None, _('try extended date formats'))],
531 _('[-e] DATE [RANGE]'),
532 _('[-e] DATE [RANGE]'),
532 norepo=True, optionalrepo=True)
533 norepo=True, optionalrepo=True)
533 def debugdate(ui, date, range=None, **opts):
534 def debugdate(ui, date, range=None, **opts):
534 """parse and display a date"""
535 """parse and display a date"""
535 if opts[r"extended"]:
536 if opts[r"extended"]:
536 d = util.parsedate(date, util.extendeddateformats)
537 d = util.parsedate(date, util.extendeddateformats)
537 else:
538 else:
538 d = util.parsedate(date)
539 d = util.parsedate(date)
539 ui.write(("internal: %s %s\n") % d)
540 ui.write(("internal: %s %s\n") % d)
540 ui.write(("standard: %s\n") % util.datestr(d))
541 ui.write(("standard: %s\n") % util.datestr(d))
541 if range:
542 if range:
542 m = util.matchdate(range)
543 m = util.matchdate(range)
543 ui.write(("match: %s\n") % m(d[0]))
544 ui.write(("match: %s\n") % m(d[0]))
544
545
545 @command('debugdeltachain',
546 @command('debugdeltachain',
546 cmdutil.debugrevlogopts + cmdutil.formatteropts,
547 cmdutil.debugrevlogopts + cmdutil.formatteropts,
547 _('-c|-m|FILE'),
548 _('-c|-m|FILE'),
548 optionalrepo=True)
549 optionalrepo=True)
549 def debugdeltachain(ui, repo, file_=None, **opts):
550 def debugdeltachain(ui, repo, file_=None, **opts):
550 """dump information about delta chains in a revlog
551 """dump information about delta chains in a revlog
551
552
552 Output can be templatized. Available template keywords are:
553 Output can be templatized. Available template keywords are:
553
554
554 :``rev``: revision number
555 :``rev``: revision number
555 :``chainid``: delta chain identifier (numbered by unique base)
556 :``chainid``: delta chain identifier (numbered by unique base)
556 :``chainlen``: delta chain length to this revision
557 :``chainlen``: delta chain length to this revision
557 :``prevrev``: previous revision in delta chain
558 :``prevrev``: previous revision in delta chain
558 :``deltatype``: role of delta / how it was computed
559 :``deltatype``: role of delta / how it was computed
559 :``compsize``: compressed size of revision
560 :``compsize``: compressed size of revision
560 :``uncompsize``: uncompressed size of revision
561 :``uncompsize``: uncompressed size of revision
561 :``chainsize``: total size of compressed revisions in chain
562 :``chainsize``: total size of compressed revisions in chain
562 :``chainratio``: total chain size divided by uncompressed revision size
563 :``chainratio``: total chain size divided by uncompressed revision size
563 (new delta chains typically start at ratio 2.00)
564 (new delta chains typically start at ratio 2.00)
564 :``lindist``: linear distance from base revision in delta chain to end
565 :``lindist``: linear distance from base revision in delta chain to end
565 of this revision
566 of this revision
566 :``extradist``: total size of revisions not part of this delta chain from
567 :``extradist``: total size of revisions not part of this delta chain from
567 base of delta chain to end of this revision; a measurement
568 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
569 of how much extra data we need to read/seek across to read
569 the delta chain for this revision
570 the delta chain for this revision
570 :``extraratio``: extradist divided by chainsize; another representation of
571 :``extraratio``: extradist divided by chainsize; another representation of
571 how much unrelated data is needed to load this delta chain
572 how much unrelated data is needed to load this delta chain
572 """
573 """
573 opts = pycompat.byteskwargs(opts)
574 opts = pycompat.byteskwargs(opts)
574 r = cmdutil.openrevlog(repo, 'debugdeltachain', file_, opts)
575 r = cmdutil.openrevlog(repo, 'debugdeltachain', file_, opts)
575 index = r.index
576 index = r.index
576 generaldelta = r.version & revlog.FLAG_GENERALDELTA
577 generaldelta = r.version & revlog.FLAG_GENERALDELTA
577
578
578 def revinfo(rev):
579 def revinfo(rev):
579 e = index[rev]
580 e = index[rev]
580 compsize = e[1]
581 compsize = e[1]
581 uncompsize = e[2]
582 uncompsize = e[2]
582 chainsize = 0
583 chainsize = 0
583
584
584 if generaldelta:
585 if generaldelta:
585 if e[3] == e[5]:
586 if e[3] == e[5]:
586 deltatype = 'p1'
587 deltatype = 'p1'
587 elif e[3] == e[6]:
588 elif e[3] == e[6]:
588 deltatype = 'p2'
589 deltatype = 'p2'
589 elif e[3] == rev - 1:
590 elif e[3] == rev - 1:
590 deltatype = 'prev'
591 deltatype = 'prev'
591 elif e[3] == rev:
592 elif e[3] == rev:
592 deltatype = 'base'
593 deltatype = 'base'
593 else:
594 else:
594 deltatype = 'other'
595 deltatype = 'other'
595 else:
596 else:
596 if e[3] == rev:
597 if e[3] == rev:
597 deltatype = 'base'
598 deltatype = 'base'
598 else:
599 else:
599 deltatype = 'prev'
600 deltatype = 'prev'
600
601
601 chain = r._deltachain(rev)[0]
602 chain = r._deltachain(rev)[0]
602 for iterrev in chain:
603 for iterrev in chain:
603 e = index[iterrev]
604 e = index[iterrev]
604 chainsize += e[1]
605 chainsize += e[1]
605
606
606 return compsize, uncompsize, deltatype, chain, chainsize
607 return compsize, uncompsize, deltatype, chain, chainsize
607
608
608 fm = ui.formatter('debugdeltachain', opts)
609 fm = ui.formatter('debugdeltachain', opts)
609
610
610 fm.plain(' rev chain# chainlen prev delta '
611 fm.plain(' rev chain# chainlen prev delta '
611 'size rawsize chainsize ratio lindist extradist '
612 'size rawsize chainsize ratio lindist extradist '
612 'extraratio\n')
613 'extraratio\n')
613
614
614 chainbases = {}
615 chainbases = {}
615 for rev in r:
616 for rev in r:
616 comp, uncomp, deltatype, chain, chainsize = revinfo(rev)
617 comp, uncomp, deltatype, chain, chainsize = revinfo(rev)
617 chainbase = chain[0]
618 chainbase = chain[0]
618 chainid = chainbases.setdefault(chainbase, len(chainbases) + 1)
619 chainid = chainbases.setdefault(chainbase, len(chainbases) + 1)
619 basestart = r.start(chainbase)
620 basestart = r.start(chainbase)
620 revstart = r.start(rev)
621 revstart = r.start(rev)
621 lineardist = revstart + comp - basestart
622 lineardist = revstart + comp - basestart
622 extradist = lineardist - chainsize
623 extradist = lineardist - chainsize
623 try:
624 try:
624 prevrev = chain[-2]
625 prevrev = chain[-2]
625 except IndexError:
626 except IndexError:
626 prevrev = -1
627 prevrev = -1
627
628
628 chainratio = float(chainsize) / float(uncomp)
629 chainratio = float(chainsize) / float(uncomp)
629 extraratio = float(extradist) / float(chainsize)
630 extraratio = float(extradist) / float(chainsize)
630
631
631 fm.startitem()
632 fm.startitem()
632 fm.write('rev chainid chainlen prevrev deltatype compsize '
633 fm.write('rev chainid chainlen prevrev deltatype compsize '
633 'uncompsize chainsize chainratio lindist extradist '
634 'uncompsize chainsize chainratio lindist extradist '
634 'extraratio',
635 'extraratio',
635 '%7d %7d %8d %8d %7s %10d %10d %10d %9.5f %9d %9d %10.5f\n',
636 '%7d %7d %8d %8d %7s %10d %10d %10d %9.5f %9d %9d %10.5f\n',
636 rev, chainid, len(chain), prevrev, deltatype, comp,
637 rev, chainid, len(chain), prevrev, deltatype, comp,
637 uncomp, chainsize, chainratio, lineardist, extradist,
638 uncomp, chainsize, chainratio, lineardist, extradist,
638 extraratio,
639 extraratio,
639 rev=rev, chainid=chainid, chainlen=len(chain),
640 rev=rev, chainid=chainid, chainlen=len(chain),
640 prevrev=prevrev, deltatype=deltatype, compsize=comp,
641 prevrev=prevrev, deltatype=deltatype, compsize=comp,
641 uncompsize=uncomp, chainsize=chainsize,
642 uncompsize=uncomp, chainsize=chainsize,
642 chainratio=chainratio, lindist=lineardist,
643 chainratio=chainratio, lindist=lineardist,
643 extradist=extradist, extraratio=extraratio)
644 extradist=extradist, extraratio=extraratio)
644
645
645 fm.end()
646 fm.end()
646
647
647 @command('debugdirstate|debugstate',
648 @command('debugdirstate|debugstate',
648 [('', 'nodates', None, _('do not display the saved mtime')),
649 [('', 'nodates', None, _('do not display the saved mtime')),
649 ('', 'datesort', None, _('sort by saved mtime'))],
650 ('', 'datesort', None, _('sort by saved mtime'))],
650 _('[OPTION]...'))
651 _('[OPTION]...'))
651 def debugstate(ui, repo, **opts):
652 def debugstate(ui, repo, **opts):
652 """show the contents of the current dirstate"""
653 """show the contents of the current dirstate"""
653
654
654 nodates = opts.get(r'nodates')
655 nodates = opts.get(r'nodates')
655 datesort = opts.get(r'datesort')
656 datesort = opts.get(r'datesort')
656
657
657 timestr = ""
658 timestr = ""
658 if datesort:
659 if datesort:
659 keyfunc = lambda x: (x[1][3], x[0]) # sort by mtime, then by filename
660 keyfunc = lambda x: (x[1][3], x[0]) # sort by mtime, then by filename
660 else:
661 else:
661 keyfunc = None # sort by filename
662 keyfunc = None # sort by filename
662 for file_, ent in sorted(repo.dirstate._map.iteritems(), key=keyfunc):
663 for file_, ent in sorted(repo.dirstate._map.iteritems(), key=keyfunc):
663 if ent[3] == -1:
664 if ent[3] == -1:
664 timestr = 'unset '
665 timestr = 'unset '
665 elif nodates:
666 elif nodates:
666 timestr = 'set '
667 timestr = 'set '
667 else:
668 else:
668 timestr = time.strftime("%Y-%m-%d %H:%M:%S ",
669 timestr = time.strftime("%Y-%m-%d %H:%M:%S ",
669 time.localtime(ent[3]))
670 time.localtime(ent[3]))
670 if ent[1] & 0o20000:
671 if ent[1] & 0o20000:
671 mode = 'lnk'
672 mode = 'lnk'
672 else:
673 else:
673 mode = '%3o' % (ent[1] & 0o777 & ~util.umask)
674 mode = '%3o' % (ent[1] & 0o777 & ~util.umask)
674 ui.write("%c %s %10d %s%s\n" % (ent[0], mode, ent[2], timestr, file_))
675 ui.write("%c %s %10d %s%s\n" % (ent[0], mode, ent[2], timestr, file_))
675 for f in repo.dirstate.copies():
676 for f in repo.dirstate.copies():
676 ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copied(f), f))
677 ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copied(f), f))
677
678
678 @command('debugdiscovery',
679 @command('debugdiscovery',
679 [('', 'old', None, _('use old-style discovery')),
680 [('', 'old', None, _('use old-style discovery')),
680 ('', 'nonheads', None,
681 ('', 'nonheads', None,
681 _('use old-style discovery with non-heads included')),
682 _('use old-style discovery with non-heads included')),
682 ] + cmdutil.remoteopts,
683 ] + cmdutil.remoteopts,
683 _('[-l REV] [-r REV] [-b BRANCH]... [OTHER]'))
684 _('[-l REV] [-r REV] [-b BRANCH]... [OTHER]'))
684 def debugdiscovery(ui, repo, remoteurl="default", **opts):
685 def debugdiscovery(ui, repo, remoteurl="default", **opts):
685 """runs the changeset discovery protocol in isolation"""
686 """runs the changeset discovery protocol in isolation"""
686 opts = pycompat.byteskwargs(opts)
687 opts = pycompat.byteskwargs(opts)
687 remoteurl, branches = hg.parseurl(ui.expandpath(remoteurl),
688 remoteurl, branches = hg.parseurl(ui.expandpath(remoteurl),
688 opts.get('branch'))
689 opts.get('branch'))
689 remote = hg.peer(repo, opts, remoteurl)
690 remote = hg.peer(repo, opts, remoteurl)
690 ui.status(_('comparing with %s\n') % util.hidepassword(remoteurl))
691 ui.status(_('comparing with %s\n') % util.hidepassword(remoteurl))
691
692
692 # make sure tests are repeatable
693 # make sure tests are repeatable
693 random.seed(12323)
694 random.seed(12323)
694
695
695 def doit(localheads, remoteheads, remote=remote):
696 def doit(localheads, remoteheads, remote=remote):
696 if opts.get('old'):
697 if opts.get('old'):
697 if localheads:
698 if localheads:
698 raise error.Abort('cannot use localheads with old style '
699 raise error.Abort('cannot use localheads with old style '
699 'discovery')
700 'discovery')
700 if not util.safehasattr(remote, 'branches'):
701 if not util.safehasattr(remote, 'branches'):
701 # enable in-client legacy support
702 # enable in-client legacy support
702 remote = localrepo.locallegacypeer(remote.local())
703 remote = localrepo.locallegacypeer(remote.local())
703 common, _in, hds = treediscovery.findcommonincoming(repo, remote,
704 common, _in, hds = treediscovery.findcommonincoming(repo, remote,
704 force=True)
705 force=True)
705 common = set(common)
706 common = set(common)
706 if not opts.get('nonheads'):
707 if not opts.get('nonheads'):
707 ui.write(("unpruned common: %s\n") %
708 ui.write(("unpruned common: %s\n") %
708 " ".join(sorted(short(n) for n in common)))
709 " ".join(sorted(short(n) for n in common)))
709 dag = dagutil.revlogdag(repo.changelog)
710 dag = dagutil.revlogdag(repo.changelog)
710 all = dag.ancestorset(dag.internalizeall(common))
711 all = dag.ancestorset(dag.internalizeall(common))
711 common = dag.externalizeall(dag.headsetofconnecteds(all))
712 common = dag.externalizeall(dag.headsetofconnecteds(all))
712 else:
713 else:
713 common, any, hds = setdiscovery.findcommonheads(ui, repo, remote)
714 common, any, hds = setdiscovery.findcommonheads(ui, repo, remote)
714 common = set(common)
715 common = set(common)
715 rheads = set(hds)
716 rheads = set(hds)
716 lheads = set(repo.heads())
717 lheads = set(repo.heads())
717 ui.write(("common heads: %s\n") %
718 ui.write(("common heads: %s\n") %
718 " ".join(sorted(short(n) for n in common)))
719 " ".join(sorted(short(n) for n in common)))
719 if lheads <= common:
720 if lheads <= common:
720 ui.write(("local is subset\n"))
721 ui.write(("local is subset\n"))
721 elif rheads <= common:
722 elif rheads <= common:
722 ui.write(("remote is subset\n"))
723 ui.write(("remote is subset\n"))
723
724
724 serverlogs = opts.get('serverlog')
725 serverlogs = opts.get('serverlog')
725 if serverlogs:
726 if serverlogs:
726 for filename in serverlogs:
727 for filename in serverlogs:
727 with open(filename, 'r') as logfile:
728 with open(filename, 'r') as logfile:
728 line = logfile.readline()
729 line = logfile.readline()
729 while line:
730 while line:
730 parts = line.strip().split(';')
731 parts = line.strip().split(';')
731 op = parts[1]
732 op = parts[1]
732 if op == 'cg':
733 if op == 'cg':
733 pass
734 pass
734 elif op == 'cgss':
735 elif op == 'cgss':
735 doit(parts[2].split(' '), parts[3].split(' '))
736 doit(parts[2].split(' '), parts[3].split(' '))
736 elif op == 'unb':
737 elif op == 'unb':
737 doit(parts[3].split(' '), parts[2].split(' '))
738 doit(parts[3].split(' '), parts[2].split(' '))
738 line = logfile.readline()
739 line = logfile.readline()
739 else:
740 else:
740 remoterevs, _checkout = hg.addbranchrevs(repo, remote, branches,
741 remoterevs, _checkout = hg.addbranchrevs(repo, remote, branches,
741 opts.get('remote_head'))
742 opts.get('remote_head'))
742 localrevs = opts.get('local_head')
743 localrevs = opts.get('local_head')
743 doit(localrevs, remoterevs)
744 doit(localrevs, remoterevs)
744
745
745 @command('debugextensions', cmdutil.formatteropts, [], norepo=True)
746 @command('debugextensions', cmdutil.formatteropts, [], norepo=True)
746 def debugextensions(ui, **opts):
747 def debugextensions(ui, **opts):
747 '''show information about active extensions'''
748 '''show information about active extensions'''
748 opts = pycompat.byteskwargs(opts)
749 opts = pycompat.byteskwargs(opts)
749 exts = extensions.extensions(ui)
750 exts = extensions.extensions(ui)
750 hgver = util.version()
751 hgver = util.version()
751 fm = ui.formatter('debugextensions', opts)
752 fm = ui.formatter('debugextensions', opts)
752 for extname, extmod in sorted(exts, key=operator.itemgetter(0)):
753 for extname, extmod in sorted(exts, key=operator.itemgetter(0)):
753 isinternal = extensions.ismoduleinternal(extmod)
754 isinternal = extensions.ismoduleinternal(extmod)
754 extsource = pycompat.fsencode(extmod.__file__)
755 extsource = pycompat.fsencode(extmod.__file__)
755 if isinternal:
756 if isinternal:
756 exttestedwith = [] # never expose magic string to users
757 exttestedwith = [] # never expose magic string to users
757 else:
758 else:
758 exttestedwith = getattr(extmod, 'testedwith', '').split()
759 exttestedwith = getattr(extmod, 'testedwith', '').split()
759 extbuglink = getattr(extmod, 'buglink', None)
760 extbuglink = getattr(extmod, 'buglink', None)
760
761
761 fm.startitem()
762 fm.startitem()
762
763
763 if ui.quiet or ui.verbose:
764 if ui.quiet or ui.verbose:
764 fm.write('name', '%s\n', extname)
765 fm.write('name', '%s\n', extname)
765 else:
766 else:
766 fm.write('name', '%s', extname)
767 fm.write('name', '%s', extname)
767 if isinternal or hgver in exttestedwith:
768 if isinternal or hgver in exttestedwith:
768 fm.plain('\n')
769 fm.plain('\n')
769 elif not exttestedwith:
770 elif not exttestedwith:
770 fm.plain(_(' (untested!)\n'))
771 fm.plain(_(' (untested!)\n'))
771 else:
772 else:
772 lasttestedversion = exttestedwith[-1]
773 lasttestedversion = exttestedwith[-1]
773 fm.plain(' (%s!)\n' % lasttestedversion)
774 fm.plain(' (%s!)\n' % lasttestedversion)
774
775
775 fm.condwrite(ui.verbose and extsource, 'source',
776 fm.condwrite(ui.verbose and extsource, 'source',
776 _(' location: %s\n'), extsource or "")
777 _(' location: %s\n'), extsource or "")
777
778
778 if ui.verbose:
779 if ui.verbose:
779 fm.plain(_(' bundled: %s\n') % ['no', 'yes'][isinternal])
780 fm.plain(_(' bundled: %s\n') % ['no', 'yes'][isinternal])
780 fm.data(bundled=isinternal)
781 fm.data(bundled=isinternal)
781
782
782 fm.condwrite(ui.verbose and exttestedwith, 'testedwith',
783 fm.condwrite(ui.verbose and exttestedwith, 'testedwith',
783 _(' tested with: %s\n'),
784 _(' tested with: %s\n'),
784 fm.formatlist(exttestedwith, name='ver'))
785 fm.formatlist(exttestedwith, name='ver'))
785
786
786 fm.condwrite(ui.verbose and extbuglink, 'buglink',
787 fm.condwrite(ui.verbose and extbuglink, 'buglink',
787 _(' bug reporting: %s\n'), extbuglink or "")
788 _(' bug reporting: %s\n'), extbuglink or "")
788
789
789 fm.end()
790 fm.end()
790
791
791 @command('debugfileset',
792 @command('debugfileset',
792 [('r', 'rev', '', _('apply the filespec on this revision'), _('REV'))],
793 [('r', 'rev', '', _('apply the filespec on this revision'), _('REV'))],
793 _('[-r REV] FILESPEC'))
794 _('[-r REV] FILESPEC'))
794 def debugfileset(ui, repo, expr, **opts):
795 def debugfileset(ui, repo, expr, **opts):
795 '''parse and apply a fileset specification'''
796 '''parse and apply a fileset specification'''
796 ctx = scmutil.revsingle(repo, opts.get(r'rev'), None)
797 ctx = scmutil.revsingle(repo, opts.get(r'rev'), None)
797 if ui.verbose:
798 if ui.verbose:
798 tree = fileset.parse(expr)
799 tree = fileset.parse(expr)
799 ui.note(fileset.prettyformat(tree), "\n")
800 ui.note(fileset.prettyformat(tree), "\n")
800
801
801 for f in ctx.getfileset(expr):
802 for f in ctx.getfileset(expr):
802 ui.write("%s\n" % f)
803 ui.write("%s\n" % f)
803
804
804 @command('debugfsinfo', [], _('[PATH]'), norepo=True)
805 @command('debugfsinfo', [], _('[PATH]'), norepo=True)
805 def debugfsinfo(ui, path="."):
806 def debugfsinfo(ui, path="."):
806 """show information detected about current filesystem"""
807 """show information detected about current filesystem"""
807 ui.write(('exec: %s\n') % (util.checkexec(path) and 'yes' or 'no'))
808 ui.write(('exec: %s\n') % (util.checkexec(path) and 'yes' or 'no'))
808 ui.write(('fstype: %s\n') % (util.getfstype(path) or '(unknown)'))
809 ui.write(('fstype: %s\n') % (util.getfstype(path) or '(unknown)'))
809 ui.write(('symlink: %s\n') % (util.checklink(path) and 'yes' or 'no'))
810 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'))
811 ui.write(('hardlink: %s\n') % (util.checknlink(path) and 'yes' or 'no'))
811 casesensitive = '(unknown)'
812 casesensitive = '(unknown)'
812 try:
813 try:
813 with tempfile.NamedTemporaryFile(prefix='.debugfsinfo', dir=path) as f:
814 with tempfile.NamedTemporaryFile(prefix='.debugfsinfo', dir=path) as f:
814 casesensitive = util.fscasesensitive(f.name) and 'yes' or 'no'
815 casesensitive = util.fscasesensitive(f.name) and 'yes' or 'no'
815 except OSError:
816 except OSError:
816 pass
817 pass
817 ui.write(('case-sensitive: %s\n') % casesensitive)
818 ui.write(('case-sensitive: %s\n') % casesensitive)
818
819
819 @command('debuggetbundle',
820 @command('debuggetbundle',
820 [('H', 'head', [], _('id of head node'), _('ID')),
821 [('H', 'head', [], _('id of head node'), _('ID')),
821 ('C', 'common', [], _('id of common node'), _('ID')),
822 ('C', 'common', [], _('id of common node'), _('ID')),
822 ('t', 'type', 'bzip2', _('bundle compression type to use'), _('TYPE'))],
823 ('t', 'type', 'bzip2', _('bundle compression type to use'), _('TYPE'))],
823 _('REPO FILE [-H|-C ID]...'),
824 _('REPO FILE [-H|-C ID]...'),
824 norepo=True)
825 norepo=True)
825 def debuggetbundle(ui, repopath, bundlepath, head=None, common=None, **opts):
826 def debuggetbundle(ui, repopath, bundlepath, head=None, common=None, **opts):
826 """retrieves a bundle from a repo
827 """retrieves a bundle from a repo
827
828
828 Every ID must be a full-length hex node id string. Saves the bundle to the
829 Every ID must be a full-length hex node id string. Saves the bundle to the
829 given file.
830 given file.
830 """
831 """
831 opts = pycompat.byteskwargs(opts)
832 opts = pycompat.byteskwargs(opts)
832 repo = hg.peer(ui, opts, repopath)
833 repo = hg.peer(ui, opts, repopath)
833 if not repo.capable('getbundle'):
834 if not repo.capable('getbundle'):
834 raise error.Abort("getbundle() not supported by target repository")
835 raise error.Abort("getbundle() not supported by target repository")
835 args = {}
836 args = {}
836 if common:
837 if common:
837 args[r'common'] = [bin(s) for s in common]
838 args[r'common'] = [bin(s) for s in common]
838 if head:
839 if head:
839 args[r'heads'] = [bin(s) for s in head]
840 args[r'heads'] = [bin(s) for s in head]
840 # TODO: get desired bundlecaps from command line.
841 # TODO: get desired bundlecaps from command line.
841 args[r'bundlecaps'] = None
842 args[r'bundlecaps'] = None
842 bundle = repo.getbundle('debug', **args)
843 bundle = repo.getbundle('debug', **args)
843
844
844 bundletype = opts.get('type', 'bzip2').lower()
845 bundletype = opts.get('type', 'bzip2').lower()
845 btypes = {'none': 'HG10UN',
846 btypes = {'none': 'HG10UN',
846 'bzip2': 'HG10BZ',
847 'bzip2': 'HG10BZ',
847 'gzip': 'HG10GZ',
848 'gzip': 'HG10GZ',
848 'bundle2': 'HG20'}
849 'bundle2': 'HG20'}
849 bundletype = btypes.get(bundletype)
850 bundletype = btypes.get(bundletype)
850 if bundletype not in bundle2.bundletypes:
851 if bundletype not in bundle2.bundletypes:
851 raise error.Abort(_('unknown bundle type specified with --type'))
852 raise error.Abort(_('unknown bundle type specified with --type'))
852 bundle2.writebundle(ui, bundle, bundlepath, bundletype)
853 bundle2.writebundle(ui, bundle, bundlepath, bundletype)
853
854
854 @command('debugignore', [], '[FILE]')
855 @command('debugignore', [], '[FILE]')
855 def debugignore(ui, repo, *files, **opts):
856 def debugignore(ui, repo, *files, **opts):
856 """display the combined ignore pattern and information about ignored files
857 """display the combined ignore pattern and information about ignored files
857
858
858 With no argument display the combined ignore pattern.
859 With no argument display the combined ignore pattern.
859
860
860 Given space separated file names, shows if the given file is ignored and
861 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.
862 if so, show the ignore rule (file and line number) that matched it.
862 """
863 """
863 ignore = repo.dirstate._ignore
864 ignore = repo.dirstate._ignore
864 if not files:
865 if not files:
865 # Show all the patterns
866 # Show all the patterns
866 ui.write("%s\n" % repr(ignore))
867 ui.write("%s\n" % repr(ignore))
867 else:
868 else:
868 for f in files:
869 for f in files:
869 nf = util.normpath(f)
870 nf = util.normpath(f)
870 ignored = None
871 ignored = None
871 ignoredata = None
872 ignoredata = None
872 if nf != '.':
873 if nf != '.':
873 if ignore(nf):
874 if ignore(nf):
874 ignored = nf
875 ignored = nf
875 ignoredata = repo.dirstate._ignorefileandline(nf)
876 ignoredata = repo.dirstate._ignorefileandline(nf)
876 else:
877 else:
877 for p in util.finddirs(nf):
878 for p in util.finddirs(nf):
878 if ignore(p):
879 if ignore(p):
879 ignored = p
880 ignored = p
880 ignoredata = repo.dirstate._ignorefileandline(p)
881 ignoredata = repo.dirstate._ignorefileandline(p)
881 break
882 break
882 if ignored:
883 if ignored:
883 if ignored == nf:
884 if ignored == nf:
884 ui.write(_("%s is ignored\n") % f)
885 ui.write(_("%s is ignored\n") % f)
885 else:
886 else:
886 ui.write(_("%s is ignored because of "
887 ui.write(_("%s is ignored because of "
887 "containing folder %s\n")
888 "containing folder %s\n")
888 % (f, ignored))
889 % (f, ignored))
889 ignorefile, lineno, line = ignoredata
890 ignorefile, lineno, line = ignoredata
890 ui.write(_("(ignore rule in %s, line %d: '%s')\n")
891 ui.write(_("(ignore rule in %s, line %d: '%s')\n")
891 % (ignorefile, lineno, line))
892 % (ignorefile, lineno, line))
892 else:
893 else:
893 ui.write(_("%s is not ignored\n") % f)
894 ui.write(_("%s is not ignored\n") % f)
894
895
895 @command('debugindex', cmdutil.debugrevlogopts +
896 @command('debugindex', cmdutil.debugrevlogopts +
896 [('f', 'format', 0, _('revlog format'), _('FORMAT'))],
897 [('f', 'format', 0, _('revlog format'), _('FORMAT'))],
897 _('[-f FORMAT] -c|-m|FILE'),
898 _('[-f FORMAT] -c|-m|FILE'),
898 optionalrepo=True)
899 optionalrepo=True)
899 def debugindex(ui, repo, file_=None, **opts):
900 def debugindex(ui, repo, file_=None, **opts):
900 """dump the contents of an index file"""
901 """dump the contents of an index file"""
901 opts = pycompat.byteskwargs(opts)
902 opts = pycompat.byteskwargs(opts)
902 r = cmdutil.openrevlog(repo, 'debugindex', file_, opts)
903 r = cmdutil.openrevlog(repo, 'debugindex', file_, opts)
903 format = opts.get('format', 0)
904 format = opts.get('format', 0)
904 if format not in (0, 1):
905 if format not in (0, 1):
905 raise error.Abort(_("unknown format %d") % format)
906 raise error.Abort(_("unknown format %d") % format)
906
907
907 generaldelta = r.version & revlog.FLAG_GENERALDELTA
908 generaldelta = r.version & revlog.FLAG_GENERALDELTA
908 if generaldelta:
909 if generaldelta:
909 basehdr = ' delta'
910 basehdr = ' delta'
910 else:
911 else:
911 basehdr = ' base'
912 basehdr = ' base'
912
913
913 if ui.debugflag:
914 if ui.debugflag:
914 shortfn = hex
915 shortfn = hex
915 else:
916 else:
916 shortfn = short
917 shortfn = short
917
918
918 # There might not be anything in r, so have a sane default
919 # There might not be anything in r, so have a sane default
919 idlen = 12
920 idlen = 12
920 for i in r:
921 for i in r:
921 idlen = len(shortfn(r.node(i)))
922 idlen = len(shortfn(r.node(i)))
922 break
923 break
923
924
924 if format == 0:
925 if format == 0:
925 ui.write((" rev offset length " + basehdr + " linkrev"
926 ui.write((" rev offset length " + basehdr + " linkrev"
926 " %s %s p2\n") % ("nodeid".ljust(idlen), "p1".ljust(idlen)))
927 " %s %s p2\n") % ("nodeid".ljust(idlen), "p1".ljust(idlen)))
927 elif format == 1:
928 elif format == 1:
928 ui.write((" rev flag offset length"
929 ui.write((" rev flag offset length"
929 " size " + basehdr + " link p1 p2"
930 " size " + basehdr + " link p1 p2"
930 " %s\n") % "nodeid".rjust(idlen))
931 " %s\n") % "nodeid".rjust(idlen))
931
932
932 for i in r:
933 for i in r:
933 node = r.node(i)
934 node = r.node(i)
934 if generaldelta:
935 if generaldelta:
935 base = r.deltaparent(i)
936 base = r.deltaparent(i)
936 else:
937 else:
937 base = r.chainbase(i)
938 base = r.chainbase(i)
938 if format == 0:
939 if format == 0:
939 try:
940 try:
940 pp = r.parents(node)
941 pp = r.parents(node)
941 except Exception:
942 except Exception:
942 pp = [nullid, nullid]
943 pp = [nullid, nullid]
943 ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % (
944 ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % (
944 i, r.start(i), r.length(i), base, r.linkrev(i),
945 i, r.start(i), r.length(i), base, r.linkrev(i),
945 shortfn(node), shortfn(pp[0]), shortfn(pp[1])))
946 shortfn(node), shortfn(pp[0]), shortfn(pp[1])))
946 elif format == 1:
947 elif format == 1:
947 pr = r.parentrevs(i)
948 pr = r.parentrevs(i)
948 ui.write("% 6d %04x % 8d % 8d % 8d % 6d % 6d % 6d % 6d %s\n" % (
949 ui.write("% 6d %04x % 8d % 8d % 8d % 6d % 6d % 6d % 6d %s\n" % (
949 i, r.flags(i), r.start(i), r.length(i), r.rawsize(i),
950 i, r.flags(i), r.start(i), r.length(i), r.rawsize(i),
950 base, r.linkrev(i), pr[0], pr[1], shortfn(node)))
951 base, r.linkrev(i), pr[0], pr[1], shortfn(node)))
951
952
952 @command('debugindexdot', cmdutil.debugrevlogopts,
953 @command('debugindexdot', cmdutil.debugrevlogopts,
953 _('-c|-m|FILE'), optionalrepo=True)
954 _('-c|-m|FILE'), optionalrepo=True)
954 def debugindexdot(ui, repo, file_=None, **opts):
955 def debugindexdot(ui, repo, file_=None, **opts):
955 """dump an index DAG as a graphviz dot file"""
956 """dump an index DAG as a graphviz dot file"""
956 opts = pycompat.byteskwargs(opts)
957 opts = pycompat.byteskwargs(opts)
957 r = cmdutil.openrevlog(repo, 'debugindexdot', file_, opts)
958 r = cmdutil.openrevlog(repo, 'debugindexdot', file_, opts)
958 ui.write(("digraph G {\n"))
959 ui.write(("digraph G {\n"))
959 for i in r:
960 for i in r:
960 node = r.node(i)
961 node = r.node(i)
961 pp = r.parents(node)
962 pp = r.parents(node)
962 ui.write("\t%d -> %d\n" % (r.rev(pp[0]), i))
963 ui.write("\t%d -> %d\n" % (r.rev(pp[0]), i))
963 if pp[1] != nullid:
964 if pp[1] != nullid:
964 ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i))
965 ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i))
965 ui.write("}\n")
966 ui.write("}\n")
966
967
967 @command('debuginstall', [] + cmdutil.formatteropts, '', norepo=True)
968 @command('debuginstall', [] + cmdutil.formatteropts, '', norepo=True)
968 def debuginstall(ui, **opts):
969 def debuginstall(ui, **opts):
969 '''test Mercurial installation
970 '''test Mercurial installation
970
971
971 Returns 0 on success.
972 Returns 0 on success.
972 '''
973 '''
973 opts = pycompat.byteskwargs(opts)
974 opts = pycompat.byteskwargs(opts)
974
975
975 def writetemp(contents):
976 def writetemp(contents):
976 (fd, name) = tempfile.mkstemp(prefix="hg-debuginstall-")
977 (fd, name) = tempfile.mkstemp(prefix="hg-debuginstall-")
977 f = os.fdopen(fd, pycompat.sysstr("wb"))
978 f = os.fdopen(fd, pycompat.sysstr("wb"))
978 f.write(contents)
979 f.write(contents)
979 f.close()
980 f.close()
980 return name
981 return name
981
982
982 problems = 0
983 problems = 0
983
984
984 fm = ui.formatter('debuginstall', opts)
985 fm = ui.formatter('debuginstall', opts)
985 fm.startitem()
986 fm.startitem()
986
987
987 # encoding
988 # encoding
988 fm.write('encoding', _("checking encoding (%s)...\n"), encoding.encoding)
989 fm.write('encoding', _("checking encoding (%s)...\n"), encoding.encoding)
989 err = None
990 err = None
990 try:
991 try:
991 encoding.fromlocal("test")
992 encoding.fromlocal("test")
992 except error.Abort as inst:
993 except error.Abort as inst:
993 err = inst
994 err = inst
994 problems += 1
995 problems += 1
995 fm.condwrite(err, 'encodingerror', _(" %s\n"
996 fm.condwrite(err, 'encodingerror', _(" %s\n"
996 " (check that your locale is properly set)\n"), err)
997 " (check that your locale is properly set)\n"), err)
997
998
998 # Python
999 # Python
999 fm.write('pythonexe', _("checking Python executable (%s)\n"),
1000 fm.write('pythonexe', _("checking Python executable (%s)\n"),
1000 pycompat.sysexecutable)
1001 pycompat.sysexecutable)
1001 fm.write('pythonver', _("checking Python version (%s)\n"),
1002 fm.write('pythonver', _("checking Python version (%s)\n"),
1002 ("%d.%d.%d" % sys.version_info[:3]))
1003 ("%d.%d.%d" % sys.version_info[:3]))
1003 fm.write('pythonlib', _("checking Python lib (%s)...\n"),
1004 fm.write('pythonlib', _("checking Python lib (%s)...\n"),
1004 os.path.dirname(pycompat.fsencode(os.__file__)))
1005 os.path.dirname(pycompat.fsencode(os.__file__)))
1005
1006
1006 security = set(sslutil.supportedprotocols)
1007 security = set(sslutil.supportedprotocols)
1007 if sslutil.hassni:
1008 if sslutil.hassni:
1008 security.add('sni')
1009 security.add('sni')
1009
1010
1010 fm.write('pythonsecurity', _("checking Python security support (%s)\n"),
1011 fm.write('pythonsecurity', _("checking Python security support (%s)\n"),
1011 fm.formatlist(sorted(security), name='protocol',
1012 fm.formatlist(sorted(security), name='protocol',
1012 fmt='%s', sep=','))
1013 fmt='%s', sep=','))
1013
1014
1014 # These are warnings, not errors. So don't increment problem count. This
1015 # These are warnings, not errors. So don't increment problem count. This
1015 # may change in the future.
1016 # may change in the future.
1016 if 'tls1.2' not in security:
1017 if 'tls1.2' not in security:
1017 fm.plain(_(' TLS 1.2 not supported by Python install; '
1018 fm.plain(_(' TLS 1.2 not supported by Python install; '
1018 'network connections lack modern security\n'))
1019 'network connections lack modern security\n'))
1019 if 'sni' not in security:
1020 if 'sni' not in security:
1020 fm.plain(_(' SNI not supported by Python install; may have '
1021 fm.plain(_(' SNI not supported by Python install; may have '
1021 'connectivity issues with some servers\n'))
1022 'connectivity issues with some servers\n'))
1022
1023
1023 # TODO print CA cert info
1024 # TODO print CA cert info
1024
1025
1025 # hg version
1026 # hg version
1026 hgver = util.version()
1027 hgver = util.version()
1027 fm.write('hgver', _("checking Mercurial version (%s)\n"),
1028 fm.write('hgver', _("checking Mercurial version (%s)\n"),
1028 hgver.split('+')[0])
1029 hgver.split('+')[0])
1029 fm.write('hgverextra', _("checking Mercurial custom build (%s)\n"),
1030 fm.write('hgverextra', _("checking Mercurial custom build (%s)\n"),
1030 '+'.join(hgver.split('+')[1:]))
1031 '+'.join(hgver.split('+')[1:]))
1031
1032
1032 # compiled modules
1033 # compiled modules
1033 fm.write('hgmodulepolicy', _("checking module policy (%s)\n"),
1034 fm.write('hgmodulepolicy', _("checking module policy (%s)\n"),
1034 policy.policy)
1035 policy.policy)
1035 fm.write('hgmodules', _("checking installed modules (%s)...\n"),
1036 fm.write('hgmodules', _("checking installed modules (%s)...\n"),
1036 os.path.dirname(pycompat.fsencode(__file__)))
1037 os.path.dirname(pycompat.fsencode(__file__)))
1037
1038
1038 if policy.policy in ('c', 'allow'):
1039 if policy.policy in ('c', 'allow'):
1039 err = None
1040 err = None
1040 try:
1041 try:
1041 from .cext import (
1042 from .cext import (
1042 base85,
1043 base85,
1043 bdiff,
1044 bdiff,
1044 mpatch,
1045 mpatch,
1045 osutil,
1046 osutil,
1046 )
1047 )
1047 dir(bdiff), dir(mpatch), dir(base85), dir(osutil) # quiet pyflakes
1048 dir(bdiff), dir(mpatch), dir(base85), dir(osutil) # quiet pyflakes
1048 except Exception as inst:
1049 except Exception as inst:
1049 err = inst
1050 err = inst
1050 problems += 1
1051 problems += 1
1051 fm.condwrite(err, 'extensionserror', " %s\n", err)
1052 fm.condwrite(err, 'extensionserror', " %s\n", err)
1052
1053
1053 compengines = util.compengines._engines.values()
1054 compengines = util.compengines._engines.values()
1054 fm.write('compengines', _('checking registered compression engines (%s)\n'),
1055 fm.write('compengines', _('checking registered compression engines (%s)\n'),
1055 fm.formatlist(sorted(e.name() for e in compengines),
1056 fm.formatlist(sorted(e.name() for e in compengines),
1056 name='compengine', fmt='%s', sep=', '))
1057 name='compengine', fmt='%s', sep=', '))
1057 fm.write('compenginesavail', _('checking available compression engines '
1058 fm.write('compenginesavail', _('checking available compression engines '
1058 '(%s)\n'),
1059 '(%s)\n'),
1059 fm.formatlist(sorted(e.name() for e in compengines
1060 fm.formatlist(sorted(e.name() for e in compengines
1060 if e.available()),
1061 if e.available()),
1061 name='compengine', fmt='%s', sep=', '))
1062 name='compengine', fmt='%s', sep=', '))
1062 wirecompengines = util.compengines.supportedwireengines(util.SERVERROLE)
1063 wirecompengines = util.compengines.supportedwireengines(util.SERVERROLE)
1063 fm.write('compenginesserver', _('checking available compression engines '
1064 fm.write('compenginesserver', _('checking available compression engines '
1064 'for wire protocol (%s)\n'),
1065 'for wire protocol (%s)\n'),
1065 fm.formatlist([e.name() for e in wirecompengines
1066 fm.formatlist([e.name() for e in wirecompengines
1066 if e.wireprotosupport()],
1067 if e.wireprotosupport()],
1067 name='compengine', fmt='%s', sep=', '))
1068 name='compengine', fmt='%s', sep=', '))
1068
1069
1069 # templates
1070 # templates
1070 p = templater.templatepaths()
1071 p = templater.templatepaths()
1071 fm.write('templatedirs', 'checking templates (%s)...\n', ' '.join(p))
1072 fm.write('templatedirs', 'checking templates (%s)...\n', ' '.join(p))
1072 fm.condwrite(not p, '', _(" no template directories found\n"))
1073 fm.condwrite(not p, '', _(" no template directories found\n"))
1073 if p:
1074 if p:
1074 m = templater.templatepath("map-cmdline.default")
1075 m = templater.templatepath("map-cmdline.default")
1075 if m:
1076 if m:
1076 # template found, check if it is working
1077 # template found, check if it is working
1077 err = None
1078 err = None
1078 try:
1079 try:
1079 templater.templater.frommapfile(m)
1080 templater.templater.frommapfile(m)
1080 except Exception as inst:
1081 except Exception as inst:
1081 err = inst
1082 err = inst
1082 p = None
1083 p = None
1083 fm.condwrite(err, 'defaulttemplateerror', " %s\n", err)
1084 fm.condwrite(err, 'defaulttemplateerror', " %s\n", err)
1084 else:
1085 else:
1085 p = None
1086 p = None
1086 fm.condwrite(p, 'defaulttemplate',
1087 fm.condwrite(p, 'defaulttemplate',
1087 _("checking default template (%s)\n"), m)
1088 _("checking default template (%s)\n"), m)
1088 fm.condwrite(not m, 'defaulttemplatenotfound',
1089 fm.condwrite(not m, 'defaulttemplatenotfound',
1089 _(" template '%s' not found\n"), "default")
1090 _(" template '%s' not found\n"), "default")
1090 if not p:
1091 if not p:
1091 problems += 1
1092 problems += 1
1092 fm.condwrite(not p, '',
1093 fm.condwrite(not p, '',
1093 _(" (templates seem to have been installed incorrectly)\n"))
1094 _(" (templates seem to have been installed incorrectly)\n"))
1094
1095
1095 # editor
1096 # editor
1096 editor = ui.geteditor()
1097 editor = ui.geteditor()
1097 editor = util.expandpath(editor)
1098 editor = util.expandpath(editor)
1098 fm.write('editor', _("checking commit editor... (%s)\n"), editor)
1099 fm.write('editor', _("checking commit editor... (%s)\n"), editor)
1099 cmdpath = util.findexe(pycompat.shlexsplit(editor)[0])
1100 cmdpath = util.findexe(pycompat.shlexsplit(editor)[0])
1100 fm.condwrite(not cmdpath and editor == 'vi', 'vinotfound',
1101 fm.condwrite(not cmdpath and editor == 'vi', 'vinotfound',
1101 _(" No commit editor set and can't find %s in PATH\n"
1102 _(" No commit editor set and can't find %s in PATH\n"
1102 " (specify a commit editor in your configuration"
1103 " (specify a commit editor in your configuration"
1103 " file)\n"), not cmdpath and editor == 'vi' and editor)
1104 " file)\n"), not cmdpath and editor == 'vi' and editor)
1104 fm.condwrite(not cmdpath and editor != 'vi', 'editornotfound',
1105 fm.condwrite(not cmdpath and editor != 'vi', 'editornotfound',
1105 _(" Can't find editor '%s' in PATH\n"
1106 _(" Can't find editor '%s' in PATH\n"
1106 " (specify a commit editor in your configuration"
1107 " (specify a commit editor in your configuration"
1107 " file)\n"), not cmdpath and editor)
1108 " file)\n"), not cmdpath and editor)
1108 if not cmdpath and editor != 'vi':
1109 if not cmdpath and editor != 'vi':
1109 problems += 1
1110 problems += 1
1110
1111
1111 # check username
1112 # check username
1112 username = None
1113 username = None
1113 err = None
1114 err = None
1114 try:
1115 try:
1115 username = ui.username()
1116 username = ui.username()
1116 except error.Abort as e:
1117 except error.Abort as e:
1117 err = e
1118 err = e
1118 problems += 1
1119 problems += 1
1119
1120
1120 fm.condwrite(username, 'username', _("checking username (%s)\n"), username)
1121 fm.condwrite(username, 'username', _("checking username (%s)\n"), username)
1121 fm.condwrite(err, 'usernameerror', _("checking username...\n %s\n"
1122 fm.condwrite(err, 'usernameerror', _("checking username...\n %s\n"
1122 " (specify a username in your configuration file)\n"), err)
1123 " (specify a username in your configuration file)\n"), err)
1123
1124
1124 fm.condwrite(not problems, '',
1125 fm.condwrite(not problems, '',
1125 _("no problems detected\n"))
1126 _("no problems detected\n"))
1126 if not problems:
1127 if not problems:
1127 fm.data(problems=problems)
1128 fm.data(problems=problems)
1128 fm.condwrite(problems, 'problems',
1129 fm.condwrite(problems, 'problems',
1129 _("%d problems detected,"
1130 _("%d problems detected,"
1130 " please check your install!\n"), problems)
1131 " please check your install!\n"), problems)
1131 fm.end()
1132 fm.end()
1132
1133
1133 return problems
1134 return problems
1134
1135
1135 @command('debugknown', [], _('REPO ID...'), norepo=True)
1136 @command('debugknown', [], _('REPO ID...'), norepo=True)
1136 def debugknown(ui, repopath, *ids, **opts):
1137 def debugknown(ui, repopath, *ids, **opts):
1137 """test whether node ids are known to a repo
1138 """test whether node ids are known to a repo
1138
1139
1139 Every ID must be a full-length hex node id string. Returns a list of 0s
1140 Every ID must be a full-length hex node id string. Returns a list of 0s
1140 and 1s indicating unknown/known.
1141 and 1s indicating unknown/known.
1141 """
1142 """
1142 opts = pycompat.byteskwargs(opts)
1143 opts = pycompat.byteskwargs(opts)
1143 repo = hg.peer(ui, opts, repopath)
1144 repo = hg.peer(ui, opts, repopath)
1144 if not repo.capable('known'):
1145 if not repo.capable('known'):
1145 raise error.Abort("known() not supported by target repository")
1146 raise error.Abort("known() not supported by target repository")
1146 flags = repo.known([bin(s) for s in ids])
1147 flags = repo.known([bin(s) for s in ids])
1147 ui.write("%s\n" % ("".join([f and "1" or "0" for f in flags])))
1148 ui.write("%s\n" % ("".join([f and "1" or "0" for f in flags])))
1148
1149
1149 @command('debuglabelcomplete', [], _('LABEL...'))
1150 @command('debuglabelcomplete', [], _('LABEL...'))
1150 def debuglabelcomplete(ui, repo, *args):
1151 def debuglabelcomplete(ui, repo, *args):
1151 '''backwards compatibility with old bash completion scripts (DEPRECATED)'''
1152 '''backwards compatibility with old bash completion scripts (DEPRECATED)'''
1152 debugnamecomplete(ui, repo, *args)
1153 debugnamecomplete(ui, repo, *args)
1153
1154
1154 @command('debuglocks',
1155 @command('debuglocks',
1155 [('L', 'force-lock', None, _('free the store lock (DANGEROUS)')),
1156 [('L', 'force-lock', None, _('free the store lock (DANGEROUS)')),
1156 ('W', 'force-wlock', None,
1157 ('W', 'force-wlock', None,
1157 _('free the working state lock (DANGEROUS)'))],
1158 _('free the working state lock (DANGEROUS)'))],
1158 _('[OPTION]...'))
1159 _('[OPTION]...'))
1159 def debuglocks(ui, repo, **opts):
1160 def debuglocks(ui, repo, **opts):
1160 """show or modify state of locks
1161 """show or modify state of locks
1161
1162
1162 By default, this command will show which locks are held. This
1163 By default, this command will show which locks are held. This
1163 includes the user and process holding the lock, the amount of time
1164 includes the user and process holding the lock, the amount of time
1164 the lock has been held, and the machine name where the process is
1165 the lock has been held, and the machine name where the process is
1165 running if it's not local.
1166 running if it's not local.
1166
1167
1167 Locks protect the integrity of Mercurial's data, so should be
1168 Locks protect the integrity of Mercurial's data, so should be
1168 treated with care. System crashes or other interruptions may cause
1169 treated with care. System crashes or other interruptions may cause
1169 locks to not be properly released, though Mercurial will usually
1170 locks to not be properly released, though Mercurial will usually
1170 detect and remove such stale locks automatically.
1171 detect and remove such stale locks automatically.
1171
1172
1172 However, detecting stale locks may not always be possible (for
1173 However, detecting stale locks may not always be possible (for
1173 instance, on a shared filesystem). Removing locks may also be
1174 instance, on a shared filesystem). Removing locks may also be
1174 blocked by filesystem permissions.
1175 blocked by filesystem permissions.
1175
1176
1176 Returns 0 if no locks are held.
1177 Returns 0 if no locks are held.
1177
1178
1178 """
1179 """
1179
1180
1180 if opts.get(r'force_lock'):
1181 if opts.get(r'force_lock'):
1181 repo.svfs.unlink('lock')
1182 repo.svfs.unlink('lock')
1182 if opts.get(r'force_wlock'):
1183 if opts.get(r'force_wlock'):
1183 repo.vfs.unlink('wlock')
1184 repo.vfs.unlink('wlock')
1184 if opts.get(r'force_lock') or opts.get(r'force_lock'):
1185 if opts.get(r'force_lock') or opts.get(r'force_lock'):
1185 return 0
1186 return 0
1186
1187
1187 now = time.time()
1188 now = time.time()
1188 held = 0
1189 held = 0
1189
1190
1190 def report(vfs, name, method):
1191 def report(vfs, name, method):
1191 # this causes stale locks to get reaped for more accurate reporting
1192 # this causes stale locks to get reaped for more accurate reporting
1192 try:
1193 try:
1193 l = method(False)
1194 l = method(False)
1194 except error.LockHeld:
1195 except error.LockHeld:
1195 l = None
1196 l = None
1196
1197
1197 if l:
1198 if l:
1198 l.release()
1199 l.release()
1199 else:
1200 else:
1200 try:
1201 try:
1201 stat = vfs.lstat(name)
1202 stat = vfs.lstat(name)
1202 age = now - stat.st_mtime
1203 age = now - stat.st_mtime
1203 user = util.username(stat.st_uid)
1204 user = util.username(stat.st_uid)
1204 locker = vfs.readlock(name)
1205 locker = vfs.readlock(name)
1205 if ":" in locker:
1206 if ":" in locker:
1206 host, pid = locker.split(':')
1207 host, pid = locker.split(':')
1207 if host == socket.gethostname():
1208 if host == socket.gethostname():
1208 locker = 'user %s, process %s' % (user, pid)
1209 locker = 'user %s, process %s' % (user, pid)
1209 else:
1210 else:
1210 locker = 'user %s, process %s, host %s' \
1211 locker = 'user %s, process %s, host %s' \
1211 % (user, pid, host)
1212 % (user, pid, host)
1212 ui.write(("%-6s %s (%ds)\n") % (name + ":", locker, age))
1213 ui.write(("%-6s %s (%ds)\n") % (name + ":", locker, age))
1213 return 1
1214 return 1
1214 except OSError as e:
1215 except OSError as e:
1215 if e.errno != errno.ENOENT:
1216 if e.errno != errno.ENOENT:
1216 raise
1217 raise
1217
1218
1218 ui.write(("%-6s free\n") % (name + ":"))
1219 ui.write(("%-6s free\n") % (name + ":"))
1219 return 0
1220 return 0
1220
1221
1221 held += report(repo.svfs, "lock", repo.lock)
1222 held += report(repo.svfs, "lock", repo.lock)
1222 held += report(repo.vfs, "wlock", repo.wlock)
1223 held += report(repo.vfs, "wlock", repo.wlock)
1223
1224
1224 return held
1225 return held
1225
1226
1226 @command('debugmergestate', [], '')
1227 @command('debugmergestate', [], '')
1227 def debugmergestate(ui, repo, *args):
1228 def debugmergestate(ui, repo, *args):
1228 """print merge state
1229 """print merge state
1229
1230
1230 Use --verbose to print out information about whether v1 or v2 merge state
1231 Use --verbose to print out information about whether v1 or v2 merge state
1231 was chosen."""
1232 was chosen."""
1232 def _hashornull(h):
1233 def _hashornull(h):
1233 if h == nullhex:
1234 if h == nullhex:
1234 return 'null'
1235 return 'null'
1235 else:
1236 else:
1236 return h
1237 return h
1237
1238
1238 def printrecords(version):
1239 def printrecords(version):
1239 ui.write(('* version %s records\n') % version)
1240 ui.write(('* version %s records\n') % version)
1240 if version == 1:
1241 if version == 1:
1241 records = v1records
1242 records = v1records
1242 else:
1243 else:
1243 records = v2records
1244 records = v2records
1244
1245
1245 for rtype, record in records:
1246 for rtype, record in records:
1246 # pretty print some record types
1247 # pretty print some record types
1247 if rtype == 'L':
1248 if rtype == 'L':
1248 ui.write(('local: %s\n') % record)
1249 ui.write(('local: %s\n') % record)
1249 elif rtype == 'O':
1250 elif rtype == 'O':
1250 ui.write(('other: %s\n') % record)
1251 ui.write(('other: %s\n') % record)
1251 elif rtype == 'm':
1252 elif rtype == 'm':
1252 driver, mdstate = record.split('\0', 1)
1253 driver, mdstate = record.split('\0', 1)
1253 ui.write(('merge driver: %s (state "%s")\n')
1254 ui.write(('merge driver: %s (state "%s")\n')
1254 % (driver, mdstate))
1255 % (driver, mdstate))
1255 elif rtype in 'FDC':
1256 elif rtype in 'FDC':
1256 r = record.split('\0')
1257 r = record.split('\0')
1257 f, state, hash, lfile, afile, anode, ofile = r[0:7]
1258 f, state, hash, lfile, afile, anode, ofile = r[0:7]
1258 if version == 1:
1259 if version == 1:
1259 onode = 'not stored in v1 format'
1260 onode = 'not stored in v1 format'
1260 flags = r[7]
1261 flags = r[7]
1261 else:
1262 else:
1262 onode, flags = r[7:9]
1263 onode, flags = r[7:9]
1263 ui.write(('file: %s (record type "%s", state "%s", hash %s)\n')
1264 ui.write(('file: %s (record type "%s", state "%s", hash %s)\n')
1264 % (f, rtype, state, _hashornull(hash)))
1265 % (f, rtype, state, _hashornull(hash)))
1265 ui.write((' local path: %s (flags "%s")\n') % (lfile, flags))
1266 ui.write((' local path: %s (flags "%s")\n') % (lfile, flags))
1266 ui.write((' ancestor path: %s (node %s)\n')
1267 ui.write((' ancestor path: %s (node %s)\n')
1267 % (afile, _hashornull(anode)))
1268 % (afile, _hashornull(anode)))
1268 ui.write((' other path: %s (node %s)\n')
1269 ui.write((' other path: %s (node %s)\n')
1269 % (ofile, _hashornull(onode)))
1270 % (ofile, _hashornull(onode)))
1270 elif rtype == 'f':
1271 elif rtype == 'f':
1271 filename, rawextras = record.split('\0', 1)
1272 filename, rawextras = record.split('\0', 1)
1272 extras = rawextras.split('\0')
1273 extras = rawextras.split('\0')
1273 i = 0
1274 i = 0
1274 extrastrings = []
1275 extrastrings = []
1275 while i < len(extras):
1276 while i < len(extras):
1276 extrastrings.append('%s = %s' % (extras[i], extras[i + 1]))
1277 extrastrings.append('%s = %s' % (extras[i], extras[i + 1]))
1277 i += 2
1278 i += 2
1278
1279
1279 ui.write(('file extras: %s (%s)\n')
1280 ui.write(('file extras: %s (%s)\n')
1280 % (filename, ', '.join(extrastrings)))
1281 % (filename, ', '.join(extrastrings)))
1281 elif rtype == 'l':
1282 elif rtype == 'l':
1282 labels = record.split('\0', 2)
1283 labels = record.split('\0', 2)
1283 labels = [l for l in labels if len(l) > 0]
1284 labels = [l for l in labels if len(l) > 0]
1284 ui.write(('labels:\n'))
1285 ui.write(('labels:\n'))
1285 ui.write((' local: %s\n' % labels[0]))
1286 ui.write((' local: %s\n' % labels[0]))
1286 ui.write((' other: %s\n' % labels[1]))
1287 ui.write((' other: %s\n' % labels[1]))
1287 if len(labels) > 2:
1288 if len(labels) > 2:
1288 ui.write((' base: %s\n' % labels[2]))
1289 ui.write((' base: %s\n' % labels[2]))
1289 else:
1290 else:
1290 ui.write(('unrecognized entry: %s\t%s\n')
1291 ui.write(('unrecognized entry: %s\t%s\n')
1291 % (rtype, record.replace('\0', '\t')))
1292 % (rtype, record.replace('\0', '\t')))
1292
1293
1293 # Avoid mergestate.read() since it may raise an exception for unsupported
1294 # Avoid mergestate.read() since it may raise an exception for unsupported
1294 # merge state records. We shouldn't be doing this, but this is OK since this
1295 # merge state records. We shouldn't be doing this, but this is OK since this
1295 # command is pretty low-level.
1296 # command is pretty low-level.
1296 ms = mergemod.mergestate(repo)
1297 ms = mergemod.mergestate(repo)
1297
1298
1298 # sort so that reasonable information is on top
1299 # sort so that reasonable information is on top
1299 v1records = ms._readrecordsv1()
1300 v1records = ms._readrecordsv1()
1300 v2records = ms._readrecordsv2()
1301 v2records = ms._readrecordsv2()
1301 order = 'LOml'
1302 order = 'LOml'
1302 def key(r):
1303 def key(r):
1303 idx = order.find(r[0])
1304 idx = order.find(r[0])
1304 if idx == -1:
1305 if idx == -1:
1305 return (1, r[1])
1306 return (1, r[1])
1306 else:
1307 else:
1307 return (0, idx)
1308 return (0, idx)
1308 v1records.sort(key=key)
1309 v1records.sort(key=key)
1309 v2records.sort(key=key)
1310 v2records.sort(key=key)
1310
1311
1311 if not v1records and not v2records:
1312 if not v1records and not v2records:
1312 ui.write(('no merge state found\n'))
1313 ui.write(('no merge state found\n'))
1313 elif not v2records:
1314 elif not v2records:
1314 ui.note(('no version 2 merge state\n'))
1315 ui.note(('no version 2 merge state\n'))
1315 printrecords(1)
1316 printrecords(1)
1316 elif ms._v1v2match(v1records, v2records):
1317 elif ms._v1v2match(v1records, v2records):
1317 ui.note(('v1 and v2 states match: using v2\n'))
1318 ui.note(('v1 and v2 states match: using v2\n'))
1318 printrecords(2)
1319 printrecords(2)
1319 else:
1320 else:
1320 ui.note(('v1 and v2 states mismatch: using v1\n'))
1321 ui.note(('v1 and v2 states mismatch: using v1\n'))
1321 printrecords(1)
1322 printrecords(1)
1322 if ui.verbose:
1323 if ui.verbose:
1323 printrecords(2)
1324 printrecords(2)
1324
1325
1325 @command('debugnamecomplete', [], _('NAME...'))
1326 @command('debugnamecomplete', [], _('NAME...'))
1326 def debugnamecomplete(ui, repo, *args):
1327 def debugnamecomplete(ui, repo, *args):
1327 '''complete "names" - tags, open branch names, bookmark names'''
1328 '''complete "names" - tags, open branch names, bookmark names'''
1328
1329
1329 names = set()
1330 names = set()
1330 # since we previously only listed open branches, we will handle that
1331 # since we previously only listed open branches, we will handle that
1331 # specially (after this for loop)
1332 # specially (after this for loop)
1332 for name, ns in repo.names.iteritems():
1333 for name, ns in repo.names.iteritems():
1333 if name != 'branches':
1334 if name != 'branches':
1334 names.update(ns.listnames(repo))
1335 names.update(ns.listnames(repo))
1335 names.update(tag for (tag, heads, tip, closed)
1336 names.update(tag for (tag, heads, tip, closed)
1336 in repo.branchmap().iterbranches() if not closed)
1337 in repo.branchmap().iterbranches() if not closed)
1337 completions = set()
1338 completions = set()
1338 if not args:
1339 if not args:
1339 args = ['']
1340 args = ['']
1340 for a in args:
1341 for a in args:
1341 completions.update(n for n in names if n.startswith(a))
1342 completions.update(n for n in names if n.startswith(a))
1342 ui.write('\n'.join(sorted(completions)))
1343 ui.write('\n'.join(sorted(completions)))
1343 ui.write('\n')
1344 ui.write('\n')
1344
1345
1345 @command('debugobsolete',
1346 @command('debugobsolete',
1346 [('', 'flags', 0, _('markers flag')),
1347 [('', 'flags', 0, _('markers flag')),
1347 ('', 'record-parents', False,
1348 ('', 'record-parents', False,
1348 _('record parent information for the precursor')),
1349 _('record parent information for the precursor')),
1349 ('r', 'rev', [], _('display markers relevant to REV')),
1350 ('r', 'rev', [], _('display markers relevant to REV')),
1350 ('', 'exclusive', False, _('restrict display to markers only '
1351 ('', 'exclusive', False, _('restrict display to markers only '
1351 'relevant to REV')),
1352 'relevant to REV')),
1352 ('', 'index', False, _('display index of the marker')),
1353 ('', 'index', False, _('display index of the marker')),
1353 ('', 'delete', [], _('delete markers specified by indices')),
1354 ('', 'delete', [], _('delete markers specified by indices')),
1354 ] + cmdutil.commitopts2 + cmdutil.formatteropts,
1355 ] + cmdutil.commitopts2 + cmdutil.formatteropts,
1355 _('[OBSOLETED [REPLACEMENT ...]]'))
1356 _('[OBSOLETED [REPLACEMENT ...]]'))
1356 def debugobsolete(ui, repo, precursor=None, *successors, **opts):
1357 def debugobsolete(ui, repo, precursor=None, *successors, **opts):
1357 """create arbitrary obsolete marker
1358 """create arbitrary obsolete marker
1358
1359
1359 With no arguments, displays the list of obsolescence markers."""
1360 With no arguments, displays the list of obsolescence markers."""
1360
1361
1361 opts = pycompat.byteskwargs(opts)
1362 opts = pycompat.byteskwargs(opts)
1362
1363
1363 def parsenodeid(s):
1364 def parsenodeid(s):
1364 try:
1365 try:
1365 # We do not use revsingle/revrange functions here to accept
1366 # We do not use revsingle/revrange functions here to accept
1366 # arbitrary node identifiers, possibly not present in the
1367 # arbitrary node identifiers, possibly not present in the
1367 # local repository.
1368 # local repository.
1368 n = bin(s)
1369 n = bin(s)
1369 if len(n) != len(nullid):
1370 if len(n) != len(nullid):
1370 raise TypeError()
1371 raise TypeError()
1371 return n
1372 return n
1372 except TypeError:
1373 except TypeError:
1373 raise error.Abort('changeset references must be full hexadecimal '
1374 raise error.Abort('changeset references must be full hexadecimal '
1374 'node identifiers')
1375 'node identifiers')
1375
1376
1376 if opts.get('delete'):
1377 if opts.get('delete'):
1377 indices = []
1378 indices = []
1378 for v in opts.get('delete'):
1379 for v in opts.get('delete'):
1379 try:
1380 try:
1380 indices.append(int(v))
1381 indices.append(int(v))
1381 except ValueError:
1382 except ValueError:
1382 raise error.Abort(_('invalid index value: %r') % v,
1383 raise error.Abort(_('invalid index value: %r') % v,
1383 hint=_('use integers for indices'))
1384 hint=_('use integers for indices'))
1384
1385
1385 if repo.currenttransaction():
1386 if repo.currenttransaction():
1386 raise error.Abort(_('cannot delete obsmarkers in the middle '
1387 raise error.Abort(_('cannot delete obsmarkers in the middle '
1387 'of transaction.'))
1388 'of transaction.'))
1388
1389
1389 with repo.lock():
1390 with repo.lock():
1390 n = repair.deleteobsmarkers(repo.obsstore, indices)
1391 n = repair.deleteobsmarkers(repo.obsstore, indices)
1391 ui.write(_('deleted %i obsolescence markers\n') % n)
1392 ui.write(_('deleted %i obsolescence markers\n') % n)
1392
1393
1393 return
1394 return
1394
1395
1395 if precursor is not None:
1396 if precursor is not None:
1396 if opts['rev']:
1397 if opts['rev']:
1397 raise error.Abort('cannot select revision when creating marker')
1398 raise error.Abort('cannot select revision when creating marker')
1398 metadata = {}
1399 metadata = {}
1399 metadata['user'] = opts['user'] or ui.username()
1400 metadata['user'] = opts['user'] or ui.username()
1400 succs = tuple(parsenodeid(succ) for succ in successors)
1401 succs = tuple(parsenodeid(succ) for succ in successors)
1401 l = repo.lock()
1402 l = repo.lock()
1402 try:
1403 try:
1403 tr = repo.transaction('debugobsolete')
1404 tr = repo.transaction('debugobsolete')
1404 try:
1405 try:
1405 date = opts.get('date')
1406 date = opts.get('date')
1406 if date:
1407 if date:
1407 date = util.parsedate(date)
1408 date = util.parsedate(date)
1408 else:
1409 else:
1409 date = None
1410 date = None
1410 prec = parsenodeid(precursor)
1411 prec = parsenodeid(precursor)
1411 parents = None
1412 parents = None
1412 if opts['record_parents']:
1413 if opts['record_parents']:
1413 if prec not in repo.unfiltered():
1414 if prec not in repo.unfiltered():
1414 raise error.Abort('cannot used --record-parents on '
1415 raise error.Abort('cannot used --record-parents on '
1415 'unknown changesets')
1416 'unknown changesets')
1416 parents = repo.unfiltered()[prec].parents()
1417 parents = repo.unfiltered()[prec].parents()
1417 parents = tuple(p.node() for p in parents)
1418 parents = tuple(p.node() for p in parents)
1418 repo.obsstore.create(tr, prec, succs, opts['flags'],
1419 repo.obsstore.create(tr, prec, succs, opts['flags'],
1419 parents=parents, date=date,
1420 parents=parents, date=date,
1420 metadata=metadata, ui=ui)
1421 metadata=metadata, ui=ui)
1421 tr.close()
1422 tr.close()
1422 except ValueError as exc:
1423 except ValueError as exc:
1423 raise error.Abort(_('bad obsmarker input: %s') % exc)
1424 raise error.Abort(_('bad obsmarker input: %s') % exc)
1424 finally:
1425 finally:
1425 tr.release()
1426 tr.release()
1426 finally:
1427 finally:
1427 l.release()
1428 l.release()
1428 else:
1429 else:
1429 if opts['rev']:
1430 if opts['rev']:
1430 revs = scmutil.revrange(repo, opts['rev'])
1431 revs = scmutil.revrange(repo, opts['rev'])
1431 nodes = [repo[r].node() for r in revs]
1432 nodes = [repo[r].node() for r in revs]
1432 markers = list(obsutil.getmarkers(repo, nodes=nodes,
1433 markers = list(obsutil.getmarkers(repo, nodes=nodes,
1433 exclusive=opts['exclusive']))
1434 exclusive=opts['exclusive']))
1434 markers.sort(key=lambda x: x._data)
1435 markers.sort(key=lambda x: x._data)
1435 else:
1436 else:
1436 markers = obsutil.getmarkers(repo)
1437 markers = obsutil.getmarkers(repo)
1437
1438
1438 markerstoiter = markers
1439 markerstoiter = markers
1439 isrelevant = lambda m: True
1440 isrelevant = lambda m: True
1440 if opts.get('rev') and opts.get('index'):
1441 if opts.get('rev') and opts.get('index'):
1441 markerstoiter = obsutil.getmarkers(repo)
1442 markerstoiter = obsutil.getmarkers(repo)
1442 markerset = set(markers)
1443 markerset = set(markers)
1443 isrelevant = lambda m: m in markerset
1444 isrelevant = lambda m: m in markerset
1444
1445
1445 fm = ui.formatter('debugobsolete', opts)
1446 fm = ui.formatter('debugobsolete', opts)
1446 for i, m in enumerate(markerstoiter):
1447 for i, m in enumerate(markerstoiter):
1447 if not isrelevant(m):
1448 if not isrelevant(m):
1448 # marker can be irrelevant when we're iterating over a set
1449 # marker can be irrelevant when we're iterating over a set
1449 # of markers (markerstoiter) which is bigger than the set
1450 # of markers (markerstoiter) which is bigger than the set
1450 # of markers we want to display (markers)
1451 # of markers we want to display (markers)
1451 # this can happen if both --index and --rev options are
1452 # this can happen if both --index and --rev options are
1452 # provided and thus we need to iterate over all of the markers
1453 # provided and thus we need to iterate over all of the markers
1453 # to get the correct indices, but only display the ones that
1454 # to get the correct indices, but only display the ones that
1454 # are relevant to --rev value
1455 # are relevant to --rev value
1455 continue
1456 continue
1456 fm.startitem()
1457 fm.startitem()
1457 ind = i if opts.get('index') else None
1458 ind = i if opts.get('index') else None
1458 cmdutil.showmarker(fm, m, index=ind)
1459 cmdutil.showmarker(fm, m, index=ind)
1459 fm.end()
1460 fm.end()
1460
1461
1461 @command('debugpathcomplete',
1462 @command('debugpathcomplete',
1462 [('f', 'full', None, _('complete an entire path')),
1463 [('f', 'full', None, _('complete an entire path')),
1463 ('n', 'normal', None, _('show only normal files')),
1464 ('n', 'normal', None, _('show only normal files')),
1464 ('a', 'added', None, _('show only added files')),
1465 ('a', 'added', None, _('show only added files')),
1465 ('r', 'removed', None, _('show only removed files'))],
1466 ('r', 'removed', None, _('show only removed files'))],
1466 _('FILESPEC...'))
1467 _('FILESPEC...'))
1467 def debugpathcomplete(ui, repo, *specs, **opts):
1468 def debugpathcomplete(ui, repo, *specs, **opts):
1468 '''complete part or all of a tracked path
1469 '''complete part or all of a tracked path
1469
1470
1470 This command supports shells that offer path name completion. It
1471 This command supports shells that offer path name completion. It
1471 currently completes only files already known to the dirstate.
1472 currently completes only files already known to the dirstate.
1472
1473
1473 Completion extends only to the next path segment unless
1474 Completion extends only to the next path segment unless
1474 --full is specified, in which case entire paths are used.'''
1475 --full is specified, in which case entire paths are used.'''
1475
1476
1476 def complete(path, acceptable):
1477 def complete(path, acceptable):
1477 dirstate = repo.dirstate
1478 dirstate = repo.dirstate
1478 spec = os.path.normpath(os.path.join(pycompat.getcwd(), path))
1479 spec = os.path.normpath(os.path.join(pycompat.getcwd(), path))
1479 rootdir = repo.root + pycompat.ossep
1480 rootdir = repo.root + pycompat.ossep
1480 if spec != repo.root and not spec.startswith(rootdir):
1481 if spec != repo.root and not spec.startswith(rootdir):
1481 return [], []
1482 return [], []
1482 if os.path.isdir(spec):
1483 if os.path.isdir(spec):
1483 spec += '/'
1484 spec += '/'
1484 spec = spec[len(rootdir):]
1485 spec = spec[len(rootdir):]
1485 fixpaths = pycompat.ossep != '/'
1486 fixpaths = pycompat.ossep != '/'
1486 if fixpaths:
1487 if fixpaths:
1487 spec = spec.replace(pycompat.ossep, '/')
1488 spec = spec.replace(pycompat.ossep, '/')
1488 speclen = len(spec)
1489 speclen = len(spec)
1489 fullpaths = opts[r'full']
1490 fullpaths = opts[r'full']
1490 files, dirs = set(), set()
1491 files, dirs = set(), set()
1491 adddir, addfile = dirs.add, files.add
1492 adddir, addfile = dirs.add, files.add
1492 for f, st in dirstate.iteritems():
1493 for f, st in dirstate.iteritems():
1493 if f.startswith(spec) and st[0] in acceptable:
1494 if f.startswith(spec) and st[0] in acceptable:
1494 if fixpaths:
1495 if fixpaths:
1495 f = f.replace('/', pycompat.ossep)
1496 f = f.replace('/', pycompat.ossep)
1496 if fullpaths:
1497 if fullpaths:
1497 addfile(f)
1498 addfile(f)
1498 continue
1499 continue
1499 s = f.find(pycompat.ossep, speclen)
1500 s = f.find(pycompat.ossep, speclen)
1500 if s >= 0:
1501 if s >= 0:
1501 adddir(f[:s])
1502 adddir(f[:s])
1502 else:
1503 else:
1503 addfile(f)
1504 addfile(f)
1504 return files, dirs
1505 return files, dirs
1505
1506
1506 acceptable = ''
1507 acceptable = ''
1507 if opts[r'normal']:
1508 if opts[r'normal']:
1508 acceptable += 'nm'
1509 acceptable += 'nm'
1509 if opts[r'added']:
1510 if opts[r'added']:
1510 acceptable += 'a'
1511 acceptable += 'a'
1511 if opts[r'removed']:
1512 if opts[r'removed']:
1512 acceptable += 'r'
1513 acceptable += 'r'
1513 cwd = repo.getcwd()
1514 cwd = repo.getcwd()
1514 if not specs:
1515 if not specs:
1515 specs = ['.']
1516 specs = ['.']
1516
1517
1517 files, dirs = set(), set()
1518 files, dirs = set(), set()
1518 for spec in specs:
1519 for spec in specs:
1519 f, d = complete(spec, acceptable or 'nmar')
1520 f, d = complete(spec, acceptable or 'nmar')
1520 files.update(f)
1521 files.update(f)
1521 dirs.update(d)
1522 dirs.update(d)
1522 files.update(dirs)
1523 files.update(dirs)
1523 ui.write('\n'.join(repo.pathto(p, cwd) for p in sorted(files)))
1524 ui.write('\n'.join(repo.pathto(p, cwd) for p in sorted(files)))
1524 ui.write('\n')
1525 ui.write('\n')
1525
1526
1526 @command('debugpickmergetool',
1527 @command('debugpickmergetool',
1527 [('r', 'rev', '', _('check for files in this revision'), _('REV')),
1528 [('r', 'rev', '', _('check for files in this revision'), _('REV')),
1528 ('', 'changedelete', None, _('emulate merging change and delete')),
1529 ('', 'changedelete', None, _('emulate merging change and delete')),
1529 ] + cmdutil.walkopts + cmdutil.mergetoolopts,
1530 ] + cmdutil.walkopts + cmdutil.mergetoolopts,
1530 _('[PATTERN]...'),
1531 _('[PATTERN]...'),
1531 inferrepo=True)
1532 inferrepo=True)
1532 def debugpickmergetool(ui, repo, *pats, **opts):
1533 def debugpickmergetool(ui, repo, *pats, **opts):
1533 """examine which merge tool is chosen for specified file
1534 """examine which merge tool is chosen for specified file
1534
1535
1535 As described in :hg:`help merge-tools`, Mercurial examines
1536 As described in :hg:`help merge-tools`, Mercurial examines
1536 configurations below in this order to decide which merge tool is
1537 configurations below in this order to decide which merge tool is
1537 chosen for specified file.
1538 chosen for specified file.
1538
1539
1539 1. ``--tool`` option
1540 1. ``--tool`` option
1540 2. ``HGMERGE`` environment variable
1541 2. ``HGMERGE`` environment variable
1541 3. configurations in ``merge-patterns`` section
1542 3. configurations in ``merge-patterns`` section
1542 4. configuration of ``ui.merge``
1543 4. configuration of ``ui.merge``
1543 5. configurations in ``merge-tools`` section
1544 5. configurations in ``merge-tools`` section
1544 6. ``hgmerge`` tool (for historical reason only)
1545 6. ``hgmerge`` tool (for historical reason only)
1545 7. default tool for fallback (``:merge`` or ``:prompt``)
1546 7. default tool for fallback (``:merge`` or ``:prompt``)
1546
1547
1547 This command writes out examination result in the style below::
1548 This command writes out examination result in the style below::
1548
1549
1549 FILE = MERGETOOL
1550 FILE = MERGETOOL
1550
1551
1551 By default, all files known in the first parent context of the
1552 By default, all files known in the first parent context of the
1552 working directory are examined. Use file patterns and/or -I/-X
1553 working directory are examined. Use file patterns and/or -I/-X
1553 options to limit target files. -r/--rev is also useful to examine
1554 options to limit target files. -r/--rev is also useful to examine
1554 files in another context without actual updating to it.
1555 files in another context without actual updating to it.
1555
1556
1556 With --debug, this command shows warning messages while matching
1557 With --debug, this command shows warning messages while matching
1557 against ``merge-patterns`` and so on, too. It is recommended to
1558 against ``merge-patterns`` and so on, too. It is recommended to
1558 use this option with explicit file patterns and/or -I/-X options,
1559 use this option with explicit file patterns and/or -I/-X options,
1559 because this option increases amount of output per file according
1560 because this option increases amount of output per file according
1560 to configurations in hgrc.
1561 to configurations in hgrc.
1561
1562
1562 With -v/--verbose, this command shows configurations below at
1563 With -v/--verbose, this command shows configurations below at
1563 first (only if specified).
1564 first (only if specified).
1564
1565
1565 - ``--tool`` option
1566 - ``--tool`` option
1566 - ``HGMERGE`` environment variable
1567 - ``HGMERGE`` environment variable
1567 - configuration of ``ui.merge``
1568 - configuration of ``ui.merge``
1568
1569
1569 If merge tool is chosen before matching against
1570 If merge tool is chosen before matching against
1570 ``merge-patterns``, this command can't show any helpful
1571 ``merge-patterns``, this command can't show any helpful
1571 information, even with --debug. In such case, information above is
1572 information, even with --debug. In such case, information above is
1572 useful to know why a merge tool is chosen.
1573 useful to know why a merge tool is chosen.
1573 """
1574 """
1574 opts = pycompat.byteskwargs(opts)
1575 opts = pycompat.byteskwargs(opts)
1575 overrides = {}
1576 overrides = {}
1576 if opts['tool']:
1577 if opts['tool']:
1577 overrides[('ui', 'forcemerge')] = opts['tool']
1578 overrides[('ui', 'forcemerge')] = opts['tool']
1578 ui.note(('with --tool %r\n') % (opts['tool']))
1579 ui.note(('with --tool %r\n') % (opts['tool']))
1579
1580
1580 with ui.configoverride(overrides, 'debugmergepatterns'):
1581 with ui.configoverride(overrides, 'debugmergepatterns'):
1581 hgmerge = encoding.environ.get("HGMERGE")
1582 hgmerge = encoding.environ.get("HGMERGE")
1582 if hgmerge is not None:
1583 if hgmerge is not None:
1583 ui.note(('with HGMERGE=%r\n') % (hgmerge))
1584 ui.note(('with HGMERGE=%r\n') % (hgmerge))
1584 uimerge = ui.config("ui", "merge")
1585 uimerge = ui.config("ui", "merge")
1585 if uimerge:
1586 if uimerge:
1586 ui.note(('with ui.merge=%r\n') % (uimerge))
1587 ui.note(('with ui.merge=%r\n') % (uimerge))
1587
1588
1588 ctx = scmutil.revsingle(repo, opts.get('rev'))
1589 ctx = scmutil.revsingle(repo, opts.get('rev'))
1589 m = scmutil.match(ctx, pats, opts)
1590 m = scmutil.match(ctx, pats, opts)
1590 changedelete = opts['changedelete']
1591 changedelete = opts['changedelete']
1591 for path in ctx.walk(m):
1592 for path in ctx.walk(m):
1592 fctx = ctx[path]
1593 fctx = ctx[path]
1593 try:
1594 try:
1594 if not ui.debugflag:
1595 if not ui.debugflag:
1595 ui.pushbuffer(error=True)
1596 ui.pushbuffer(error=True)
1596 tool, toolpath = filemerge._picktool(repo, ui, path,
1597 tool, toolpath = filemerge._picktool(repo, ui, path,
1597 fctx.isbinary(),
1598 fctx.isbinary(),
1598 'l' in fctx.flags(),
1599 'l' in fctx.flags(),
1599 changedelete)
1600 changedelete)
1600 finally:
1601 finally:
1601 if not ui.debugflag:
1602 if not ui.debugflag:
1602 ui.popbuffer()
1603 ui.popbuffer()
1603 ui.write(('%s = %s\n') % (path, tool))
1604 ui.write(('%s = %s\n') % (path, tool))
1604
1605
1605 @command('debugpushkey', [], _('REPO NAMESPACE [KEY OLD NEW]'), norepo=True)
1606 @command('debugpushkey', [], _('REPO NAMESPACE [KEY OLD NEW]'), norepo=True)
1606 def debugpushkey(ui, repopath, namespace, *keyinfo, **opts):
1607 def debugpushkey(ui, repopath, namespace, *keyinfo, **opts):
1607 '''access the pushkey key/value protocol
1608 '''access the pushkey key/value protocol
1608
1609
1609 With two args, list the keys in the given namespace.
1610 With two args, list the keys in the given namespace.
1610
1611
1611 With five args, set a key to new if it currently is set to old.
1612 With five args, set a key to new if it currently is set to old.
1612 Reports success or failure.
1613 Reports success or failure.
1613 '''
1614 '''
1614
1615
1615 target = hg.peer(ui, {}, repopath)
1616 target = hg.peer(ui, {}, repopath)
1616 if keyinfo:
1617 if keyinfo:
1617 key, old, new = keyinfo
1618 key, old, new = keyinfo
1618 r = target.pushkey(namespace, key, old, new)
1619 r = target.pushkey(namespace, key, old, new)
1619 ui.status(str(r) + '\n')
1620 ui.status(str(r) + '\n')
1620 return not r
1621 return not r
1621 else:
1622 else:
1622 for k, v in sorted(target.listkeys(namespace).iteritems()):
1623 for k, v in sorted(target.listkeys(namespace).iteritems()):
1623 ui.write("%s\t%s\n" % (util.escapestr(k),
1624 ui.write("%s\t%s\n" % (util.escapestr(k),
1624 util.escapestr(v)))
1625 util.escapestr(v)))
1625
1626
1626 @command('debugpvec', [], _('A B'))
1627 @command('debugpvec', [], _('A B'))
1627 def debugpvec(ui, repo, a, b=None):
1628 def debugpvec(ui, repo, a, b=None):
1628 ca = scmutil.revsingle(repo, a)
1629 ca = scmutil.revsingle(repo, a)
1629 cb = scmutil.revsingle(repo, b)
1630 cb = scmutil.revsingle(repo, b)
1630 pa = pvec.ctxpvec(ca)
1631 pa = pvec.ctxpvec(ca)
1631 pb = pvec.ctxpvec(cb)
1632 pb = pvec.ctxpvec(cb)
1632 if pa == pb:
1633 if pa == pb:
1633 rel = "="
1634 rel = "="
1634 elif pa > pb:
1635 elif pa > pb:
1635 rel = ">"
1636 rel = ">"
1636 elif pa < pb:
1637 elif pa < pb:
1637 rel = "<"
1638 rel = "<"
1638 elif pa | pb:
1639 elif pa | pb:
1639 rel = "|"
1640 rel = "|"
1640 ui.write(_("a: %s\n") % pa)
1641 ui.write(_("a: %s\n") % pa)
1641 ui.write(_("b: %s\n") % pb)
1642 ui.write(_("b: %s\n") % pb)
1642 ui.write(_("depth(a): %d depth(b): %d\n") % (pa._depth, pb._depth))
1643 ui.write(_("depth(a): %d depth(b): %d\n") % (pa._depth, pb._depth))
1643 ui.write(_("delta: %d hdist: %d distance: %d relation: %s\n") %
1644 ui.write(_("delta: %d hdist: %d distance: %d relation: %s\n") %
1644 (abs(pa._depth - pb._depth), pvec._hamming(pa._vec, pb._vec),
1645 (abs(pa._depth - pb._depth), pvec._hamming(pa._vec, pb._vec),
1645 pa.distance(pb), rel))
1646 pa.distance(pb), rel))
1646
1647
1647 @command('debugrebuilddirstate|debugrebuildstate',
1648 @command('debugrebuilddirstate|debugrebuildstate',
1648 [('r', 'rev', '', _('revision to rebuild to'), _('REV')),
1649 [('r', 'rev', '', _('revision to rebuild to'), _('REV')),
1649 ('', 'minimal', None, _('only rebuild files that are inconsistent with '
1650 ('', 'minimal', None, _('only rebuild files that are inconsistent with '
1650 'the working copy parent')),
1651 'the working copy parent')),
1651 ],
1652 ],
1652 _('[-r REV]'))
1653 _('[-r REV]'))
1653 def debugrebuilddirstate(ui, repo, rev, **opts):
1654 def debugrebuilddirstate(ui, repo, rev, **opts):
1654 """rebuild the dirstate as it would look like for the given revision
1655 """rebuild the dirstate as it would look like for the given revision
1655
1656
1656 If no revision is specified the first current parent will be used.
1657 If no revision is specified the first current parent will be used.
1657
1658
1658 The dirstate will be set to the files of the given revision.
1659 The dirstate will be set to the files of the given revision.
1659 The actual working directory content or existing dirstate
1660 The actual working directory content or existing dirstate
1660 information such as adds or removes is not considered.
1661 information such as adds or removes is not considered.
1661
1662
1662 ``minimal`` will only rebuild the dirstate status for files that claim to be
1663 ``minimal`` will only rebuild the dirstate status for files that claim to be
1663 tracked but are not in the parent manifest, or that exist in the parent
1664 tracked but are not in the parent manifest, or that exist in the parent
1664 manifest but are not in the dirstate. It will not change adds, removes, or
1665 manifest but are not in the dirstate. It will not change adds, removes, or
1665 modified files that are in the working copy parent.
1666 modified files that are in the working copy parent.
1666
1667
1667 One use of this command is to make the next :hg:`status` invocation
1668 One use of this command is to make the next :hg:`status` invocation
1668 check the actual file content.
1669 check the actual file content.
1669 """
1670 """
1670 ctx = scmutil.revsingle(repo, rev)
1671 ctx = scmutil.revsingle(repo, rev)
1671 with repo.wlock():
1672 with repo.wlock():
1672 dirstate = repo.dirstate
1673 dirstate = repo.dirstate
1673 changedfiles = None
1674 changedfiles = None
1674 # See command doc for what minimal does.
1675 # See command doc for what minimal does.
1675 if opts.get(r'minimal'):
1676 if opts.get(r'minimal'):
1676 manifestfiles = set(ctx.manifest().keys())
1677 manifestfiles = set(ctx.manifest().keys())
1677 dirstatefiles = set(dirstate)
1678 dirstatefiles = set(dirstate)
1678 manifestonly = manifestfiles - dirstatefiles
1679 manifestonly = manifestfiles - dirstatefiles
1679 dsonly = dirstatefiles - manifestfiles
1680 dsonly = dirstatefiles - manifestfiles
1680 dsnotadded = set(f for f in dsonly if dirstate[f] != 'a')
1681 dsnotadded = set(f for f in dsonly if dirstate[f] != 'a')
1681 changedfiles = manifestonly | dsnotadded
1682 changedfiles = manifestonly | dsnotadded
1682
1683
1683 dirstate.rebuild(ctx.node(), ctx.manifest(), changedfiles)
1684 dirstate.rebuild(ctx.node(), ctx.manifest(), changedfiles)
1684
1685
1685 @command('debugrebuildfncache', [], '')
1686 @command('debugrebuildfncache', [], '')
1686 def debugrebuildfncache(ui, repo):
1687 def debugrebuildfncache(ui, repo):
1687 """rebuild the fncache file"""
1688 """rebuild the fncache file"""
1688 repair.rebuildfncache(ui, repo)
1689 repair.rebuildfncache(ui, repo)
1689
1690
1690 @command('debugrename',
1691 @command('debugrename',
1691 [('r', 'rev', '', _('revision to debug'), _('REV'))],
1692 [('r', 'rev', '', _('revision to debug'), _('REV'))],
1692 _('[-r REV] FILE'))
1693 _('[-r REV] FILE'))
1693 def debugrename(ui, repo, file1, *pats, **opts):
1694 def debugrename(ui, repo, file1, *pats, **opts):
1694 """dump rename information"""
1695 """dump rename information"""
1695
1696
1696 opts = pycompat.byteskwargs(opts)
1697 opts = pycompat.byteskwargs(opts)
1697 ctx = scmutil.revsingle(repo, opts.get('rev'))
1698 ctx = scmutil.revsingle(repo, opts.get('rev'))
1698 m = scmutil.match(ctx, (file1,) + pats, opts)
1699 m = scmutil.match(ctx, (file1,) + pats, opts)
1699 for abs in ctx.walk(m):
1700 for abs in ctx.walk(m):
1700 fctx = ctx[abs]
1701 fctx = ctx[abs]
1701 o = fctx.filelog().renamed(fctx.filenode())
1702 o = fctx.filelog().renamed(fctx.filenode())
1702 rel = m.rel(abs)
1703 rel = m.rel(abs)
1703 if o:
1704 if o:
1704 ui.write(_("%s renamed from %s:%s\n") % (rel, o[0], hex(o[1])))
1705 ui.write(_("%s renamed from %s:%s\n") % (rel, o[0], hex(o[1])))
1705 else:
1706 else:
1706 ui.write(_("%s not renamed\n") % rel)
1707 ui.write(_("%s not renamed\n") % rel)
1707
1708
1708 @command('debugrevlog', cmdutil.debugrevlogopts +
1709 @command('debugrevlog', cmdutil.debugrevlogopts +
1709 [('d', 'dump', False, _('dump index data'))],
1710 [('d', 'dump', False, _('dump index data'))],
1710 _('-c|-m|FILE'),
1711 _('-c|-m|FILE'),
1711 optionalrepo=True)
1712 optionalrepo=True)
1712 def debugrevlog(ui, repo, file_=None, **opts):
1713 def debugrevlog(ui, repo, file_=None, **opts):
1713 """show data and statistics about a revlog"""
1714 """show data and statistics about a revlog"""
1714 opts = pycompat.byteskwargs(opts)
1715 opts = pycompat.byteskwargs(opts)
1715 r = cmdutil.openrevlog(repo, 'debugrevlog', file_, opts)
1716 r = cmdutil.openrevlog(repo, 'debugrevlog', file_, opts)
1716
1717
1717 if opts.get("dump"):
1718 if opts.get("dump"):
1718 numrevs = len(r)
1719 numrevs = len(r)
1719 ui.write(("# rev p1rev p2rev start end deltastart base p1 p2"
1720 ui.write(("# rev p1rev p2rev start end deltastart base p1 p2"
1720 " rawsize totalsize compression heads chainlen\n"))
1721 " rawsize totalsize compression heads chainlen\n"))
1721 ts = 0
1722 ts = 0
1722 heads = set()
1723 heads = set()
1723
1724
1724 for rev in xrange(numrevs):
1725 for rev in xrange(numrevs):
1725 dbase = r.deltaparent(rev)
1726 dbase = r.deltaparent(rev)
1726 if dbase == -1:
1727 if dbase == -1:
1727 dbase = rev
1728 dbase = rev
1728 cbase = r.chainbase(rev)
1729 cbase = r.chainbase(rev)
1729 clen = r.chainlen(rev)
1730 clen = r.chainlen(rev)
1730 p1, p2 = r.parentrevs(rev)
1731 p1, p2 = r.parentrevs(rev)
1731 rs = r.rawsize(rev)
1732 rs = r.rawsize(rev)
1732 ts = ts + rs
1733 ts = ts + rs
1733 heads -= set(r.parentrevs(rev))
1734 heads -= set(r.parentrevs(rev))
1734 heads.add(rev)
1735 heads.add(rev)
1735 try:
1736 try:
1736 compression = ts / r.end(rev)
1737 compression = ts / r.end(rev)
1737 except ZeroDivisionError:
1738 except ZeroDivisionError:
1738 compression = 0
1739 compression = 0
1739 ui.write("%5d %5d %5d %5d %5d %10d %4d %4d %4d %7d %9d "
1740 ui.write("%5d %5d %5d %5d %5d %10d %4d %4d %4d %7d %9d "
1740 "%11d %5d %8d\n" %
1741 "%11d %5d %8d\n" %
1741 (rev, p1, p2, r.start(rev), r.end(rev),
1742 (rev, p1, p2, r.start(rev), r.end(rev),
1742 r.start(dbase), r.start(cbase),
1743 r.start(dbase), r.start(cbase),
1743 r.start(p1), r.start(p2),
1744 r.start(p1), r.start(p2),
1744 rs, ts, compression, len(heads), clen))
1745 rs, ts, compression, len(heads), clen))
1745 return 0
1746 return 0
1746
1747
1747 v = r.version
1748 v = r.version
1748 format = v & 0xFFFF
1749 format = v & 0xFFFF
1749 flags = []
1750 flags = []
1750 gdelta = False
1751 gdelta = False
1751 if v & revlog.FLAG_INLINE_DATA:
1752 if v & revlog.FLAG_INLINE_DATA:
1752 flags.append('inline')
1753 flags.append('inline')
1753 if v & revlog.FLAG_GENERALDELTA:
1754 if v & revlog.FLAG_GENERALDELTA:
1754 gdelta = True
1755 gdelta = True
1755 flags.append('generaldelta')
1756 flags.append('generaldelta')
1756 if not flags:
1757 if not flags:
1757 flags = ['(none)']
1758 flags = ['(none)']
1758
1759
1759 nummerges = 0
1760 nummerges = 0
1760 numfull = 0
1761 numfull = 0
1761 numprev = 0
1762 numprev = 0
1762 nump1 = 0
1763 nump1 = 0
1763 nump2 = 0
1764 nump2 = 0
1764 numother = 0
1765 numother = 0
1765 nump1prev = 0
1766 nump1prev = 0
1766 nump2prev = 0
1767 nump2prev = 0
1767 chainlengths = []
1768 chainlengths = []
1768 chainbases = []
1769 chainbases = []
1769 chainspans = []
1770 chainspans = []
1770
1771
1771 datasize = [None, 0, 0]
1772 datasize = [None, 0, 0]
1772 fullsize = [None, 0, 0]
1773 fullsize = [None, 0, 0]
1773 deltasize = [None, 0, 0]
1774 deltasize = [None, 0, 0]
1774 chunktypecounts = {}
1775 chunktypecounts = {}
1775 chunktypesizes = {}
1776 chunktypesizes = {}
1776
1777
1777 def addsize(size, l):
1778 def addsize(size, l):
1778 if l[0] is None or size < l[0]:
1779 if l[0] is None or size < l[0]:
1779 l[0] = size
1780 l[0] = size
1780 if size > l[1]:
1781 if size > l[1]:
1781 l[1] = size
1782 l[1] = size
1782 l[2] += size
1783 l[2] += size
1783
1784
1784 numrevs = len(r)
1785 numrevs = len(r)
1785 for rev in xrange(numrevs):
1786 for rev in xrange(numrevs):
1786 p1, p2 = r.parentrevs(rev)
1787 p1, p2 = r.parentrevs(rev)
1787 delta = r.deltaparent(rev)
1788 delta = r.deltaparent(rev)
1788 if format > 0:
1789 if format > 0:
1789 addsize(r.rawsize(rev), datasize)
1790 addsize(r.rawsize(rev), datasize)
1790 if p2 != nullrev:
1791 if p2 != nullrev:
1791 nummerges += 1
1792 nummerges += 1
1792 size = r.length(rev)
1793 size = r.length(rev)
1793 if delta == nullrev:
1794 if delta == nullrev:
1794 chainlengths.append(0)
1795 chainlengths.append(0)
1795 chainbases.append(r.start(rev))
1796 chainbases.append(r.start(rev))
1796 chainspans.append(size)
1797 chainspans.append(size)
1797 numfull += 1
1798 numfull += 1
1798 addsize(size, fullsize)
1799 addsize(size, fullsize)
1799 else:
1800 else:
1800 chainlengths.append(chainlengths[delta] + 1)
1801 chainlengths.append(chainlengths[delta] + 1)
1801 baseaddr = chainbases[delta]
1802 baseaddr = chainbases[delta]
1802 revaddr = r.start(rev)
1803 revaddr = r.start(rev)
1803 chainbases.append(baseaddr)
1804 chainbases.append(baseaddr)
1804 chainspans.append((revaddr - baseaddr) + size)
1805 chainspans.append((revaddr - baseaddr) + size)
1805 addsize(size, deltasize)
1806 addsize(size, deltasize)
1806 if delta == rev - 1:
1807 if delta == rev - 1:
1807 numprev += 1
1808 numprev += 1
1808 if delta == p1:
1809 if delta == p1:
1809 nump1prev += 1
1810 nump1prev += 1
1810 elif delta == p2:
1811 elif delta == p2:
1811 nump2prev += 1
1812 nump2prev += 1
1812 elif delta == p1:
1813 elif delta == p1:
1813 nump1 += 1
1814 nump1 += 1
1814 elif delta == p2:
1815 elif delta == p2:
1815 nump2 += 1
1816 nump2 += 1
1816 elif delta != nullrev:
1817 elif delta != nullrev:
1817 numother += 1
1818 numother += 1
1818
1819
1819 # Obtain data on the raw chunks in the revlog.
1820 # Obtain data on the raw chunks in the revlog.
1820 segment = r._getsegmentforrevs(rev, rev)[1]
1821 segment = r._getsegmentforrevs(rev, rev)[1]
1821 if segment:
1822 if segment:
1822 chunktype = bytes(segment[0:1])
1823 chunktype = bytes(segment[0:1])
1823 else:
1824 else:
1824 chunktype = 'empty'
1825 chunktype = 'empty'
1825
1826
1826 if chunktype not in chunktypecounts:
1827 if chunktype not in chunktypecounts:
1827 chunktypecounts[chunktype] = 0
1828 chunktypecounts[chunktype] = 0
1828 chunktypesizes[chunktype] = 0
1829 chunktypesizes[chunktype] = 0
1829
1830
1830 chunktypecounts[chunktype] += 1
1831 chunktypecounts[chunktype] += 1
1831 chunktypesizes[chunktype] += size
1832 chunktypesizes[chunktype] += size
1832
1833
1833 # Adjust size min value for empty cases
1834 # Adjust size min value for empty cases
1834 for size in (datasize, fullsize, deltasize):
1835 for size in (datasize, fullsize, deltasize):
1835 if size[0] is None:
1836 if size[0] is None:
1836 size[0] = 0
1837 size[0] = 0
1837
1838
1838 numdeltas = numrevs - numfull
1839 numdeltas = numrevs - numfull
1839 numoprev = numprev - nump1prev - nump2prev
1840 numoprev = numprev - nump1prev - nump2prev
1840 totalrawsize = datasize[2]
1841 totalrawsize = datasize[2]
1841 datasize[2] /= numrevs
1842 datasize[2] /= numrevs
1842 fulltotal = fullsize[2]
1843 fulltotal = fullsize[2]
1843 fullsize[2] /= numfull
1844 fullsize[2] /= numfull
1844 deltatotal = deltasize[2]
1845 deltatotal = deltasize[2]
1845 if numrevs - numfull > 0:
1846 if numrevs - numfull > 0:
1846 deltasize[2] /= numrevs - numfull
1847 deltasize[2] /= numrevs - numfull
1847 totalsize = fulltotal + deltatotal
1848 totalsize = fulltotal + deltatotal
1848 avgchainlen = sum(chainlengths) / numrevs
1849 avgchainlen = sum(chainlengths) / numrevs
1849 maxchainlen = max(chainlengths)
1850 maxchainlen = max(chainlengths)
1850 maxchainspan = max(chainspans)
1851 maxchainspan = max(chainspans)
1851 compratio = 1
1852 compratio = 1
1852 if totalsize:
1853 if totalsize:
1853 compratio = totalrawsize / totalsize
1854 compratio = totalrawsize / totalsize
1854
1855
1855 basedfmtstr = '%%%dd\n'
1856 basedfmtstr = '%%%dd\n'
1856 basepcfmtstr = '%%%dd %s(%%5.2f%%%%)\n'
1857 basepcfmtstr = '%%%dd %s(%%5.2f%%%%)\n'
1857
1858
1858 def dfmtstr(max):
1859 def dfmtstr(max):
1859 return basedfmtstr % len(str(max))
1860 return basedfmtstr % len(str(max))
1860 def pcfmtstr(max, padding=0):
1861 def pcfmtstr(max, padding=0):
1861 return basepcfmtstr % (len(str(max)), ' ' * padding)
1862 return basepcfmtstr % (len(str(max)), ' ' * padding)
1862
1863
1863 def pcfmt(value, total):
1864 def pcfmt(value, total):
1864 if total:
1865 if total:
1865 return (value, 100 * float(value) / total)
1866 return (value, 100 * float(value) / total)
1866 else:
1867 else:
1867 return value, 100.0
1868 return value, 100.0
1868
1869
1869 ui.write(('format : %d\n') % format)
1870 ui.write(('format : %d\n') % format)
1870 ui.write(('flags : %s\n') % ', '.join(flags))
1871 ui.write(('flags : %s\n') % ', '.join(flags))
1871
1872
1872 ui.write('\n')
1873 ui.write('\n')
1873 fmt = pcfmtstr(totalsize)
1874 fmt = pcfmtstr(totalsize)
1874 fmt2 = dfmtstr(totalsize)
1875 fmt2 = dfmtstr(totalsize)
1875 ui.write(('revisions : ') + fmt2 % numrevs)
1876 ui.write(('revisions : ') + fmt2 % numrevs)
1876 ui.write((' merges : ') + fmt % pcfmt(nummerges, numrevs))
1877 ui.write((' merges : ') + fmt % pcfmt(nummerges, numrevs))
1877 ui.write((' normal : ') + fmt % pcfmt(numrevs - nummerges, numrevs))
1878 ui.write((' normal : ') + fmt % pcfmt(numrevs - nummerges, numrevs))
1878 ui.write(('revisions : ') + fmt2 % numrevs)
1879 ui.write(('revisions : ') + fmt2 % numrevs)
1879 ui.write((' full : ') + fmt % pcfmt(numfull, numrevs))
1880 ui.write((' full : ') + fmt % pcfmt(numfull, numrevs))
1880 ui.write((' deltas : ') + fmt % pcfmt(numdeltas, numrevs))
1881 ui.write((' deltas : ') + fmt % pcfmt(numdeltas, numrevs))
1881 ui.write(('revision size : ') + fmt2 % totalsize)
1882 ui.write(('revision size : ') + fmt2 % totalsize)
1882 ui.write((' full : ') + fmt % pcfmt(fulltotal, totalsize))
1883 ui.write((' full : ') + fmt % pcfmt(fulltotal, totalsize))
1883 ui.write((' deltas : ') + fmt % pcfmt(deltatotal, totalsize))
1884 ui.write((' deltas : ') + fmt % pcfmt(deltatotal, totalsize))
1884
1885
1885 def fmtchunktype(chunktype):
1886 def fmtchunktype(chunktype):
1886 if chunktype == 'empty':
1887 if chunktype == 'empty':
1887 return ' %s : ' % chunktype
1888 return ' %s : ' % chunktype
1888 elif chunktype in pycompat.bytestr(string.ascii_letters):
1889 elif chunktype in pycompat.bytestr(string.ascii_letters):
1889 return ' 0x%s (%s) : ' % (hex(chunktype), chunktype)
1890 return ' 0x%s (%s) : ' % (hex(chunktype), chunktype)
1890 else:
1891 else:
1891 return ' 0x%s : ' % hex(chunktype)
1892 return ' 0x%s : ' % hex(chunktype)
1892
1893
1893 ui.write('\n')
1894 ui.write('\n')
1894 ui.write(('chunks : ') + fmt2 % numrevs)
1895 ui.write(('chunks : ') + fmt2 % numrevs)
1895 for chunktype in sorted(chunktypecounts):
1896 for chunktype in sorted(chunktypecounts):
1896 ui.write(fmtchunktype(chunktype))
1897 ui.write(fmtchunktype(chunktype))
1897 ui.write(fmt % pcfmt(chunktypecounts[chunktype], numrevs))
1898 ui.write(fmt % pcfmt(chunktypecounts[chunktype], numrevs))
1898 ui.write(('chunks size : ') + fmt2 % totalsize)
1899 ui.write(('chunks size : ') + fmt2 % totalsize)
1899 for chunktype in sorted(chunktypecounts):
1900 for chunktype in sorted(chunktypecounts):
1900 ui.write(fmtchunktype(chunktype))
1901 ui.write(fmtchunktype(chunktype))
1901 ui.write(fmt % pcfmt(chunktypesizes[chunktype], totalsize))
1902 ui.write(fmt % pcfmt(chunktypesizes[chunktype], totalsize))
1902
1903
1903 ui.write('\n')
1904 ui.write('\n')
1904 fmt = dfmtstr(max(avgchainlen, maxchainlen, maxchainspan, compratio))
1905 fmt = dfmtstr(max(avgchainlen, maxchainlen, maxchainspan, compratio))
1905 ui.write(('avg chain length : ') + fmt % avgchainlen)
1906 ui.write(('avg chain length : ') + fmt % avgchainlen)
1906 ui.write(('max chain length : ') + fmt % maxchainlen)
1907 ui.write(('max chain length : ') + fmt % maxchainlen)
1907 ui.write(('max chain reach : ') + fmt % maxchainspan)
1908 ui.write(('max chain reach : ') + fmt % maxchainspan)
1908 ui.write(('compression ratio : ') + fmt % compratio)
1909 ui.write(('compression ratio : ') + fmt % compratio)
1909
1910
1910 if format > 0:
1911 if format > 0:
1911 ui.write('\n')
1912 ui.write('\n')
1912 ui.write(('uncompressed data size (min/max/avg) : %d / %d / %d\n')
1913 ui.write(('uncompressed data size (min/max/avg) : %d / %d / %d\n')
1913 % tuple(datasize))
1914 % tuple(datasize))
1914 ui.write(('full revision size (min/max/avg) : %d / %d / %d\n')
1915 ui.write(('full revision size (min/max/avg) : %d / %d / %d\n')
1915 % tuple(fullsize))
1916 % tuple(fullsize))
1916 ui.write(('delta size (min/max/avg) : %d / %d / %d\n')
1917 ui.write(('delta size (min/max/avg) : %d / %d / %d\n')
1917 % tuple(deltasize))
1918 % tuple(deltasize))
1918
1919
1919 if numdeltas > 0:
1920 if numdeltas > 0:
1920 ui.write('\n')
1921 ui.write('\n')
1921 fmt = pcfmtstr(numdeltas)
1922 fmt = pcfmtstr(numdeltas)
1922 fmt2 = pcfmtstr(numdeltas, 4)
1923 fmt2 = pcfmtstr(numdeltas, 4)
1923 ui.write(('deltas against prev : ') + fmt % pcfmt(numprev, numdeltas))
1924 ui.write(('deltas against prev : ') + fmt % pcfmt(numprev, numdeltas))
1924 if numprev > 0:
1925 if numprev > 0:
1925 ui.write((' where prev = p1 : ') + fmt2 % pcfmt(nump1prev,
1926 ui.write((' where prev = p1 : ') + fmt2 % pcfmt(nump1prev,
1926 numprev))
1927 numprev))
1927 ui.write((' where prev = p2 : ') + fmt2 % pcfmt(nump2prev,
1928 ui.write((' where prev = p2 : ') + fmt2 % pcfmt(nump2prev,
1928 numprev))
1929 numprev))
1929 ui.write((' other : ') + fmt2 % pcfmt(numoprev,
1930 ui.write((' other : ') + fmt2 % pcfmt(numoprev,
1930 numprev))
1931 numprev))
1931 if gdelta:
1932 if gdelta:
1932 ui.write(('deltas against p1 : ')
1933 ui.write(('deltas against p1 : ')
1933 + fmt % pcfmt(nump1, numdeltas))
1934 + fmt % pcfmt(nump1, numdeltas))
1934 ui.write(('deltas against p2 : ')
1935 ui.write(('deltas against p2 : ')
1935 + fmt % pcfmt(nump2, numdeltas))
1936 + fmt % pcfmt(nump2, numdeltas))
1936 ui.write(('deltas against other : ') + fmt % pcfmt(numother,
1937 ui.write(('deltas against other : ') + fmt % pcfmt(numother,
1937 numdeltas))
1938 numdeltas))
1938
1939
1939 @command('debugrevspec',
1940 @command('debugrevspec',
1940 [('', 'optimize', None,
1941 [('', 'optimize', None,
1941 _('print parsed tree after optimizing (DEPRECATED)')),
1942 _('print parsed tree after optimizing (DEPRECATED)')),
1942 ('', 'show-revs', True, _('print list of result revisions (default)')),
1943 ('', 'show-revs', True, _('print list of result revisions (default)')),
1943 ('s', 'show-set', None, _('print internal representation of result set')),
1944 ('s', 'show-set', None, _('print internal representation of result set')),
1944 ('p', 'show-stage', [],
1945 ('p', 'show-stage', [],
1945 _('print parsed tree at the given stage'), _('NAME')),
1946 _('print parsed tree at the given stage'), _('NAME')),
1946 ('', 'no-optimized', False, _('evaluate tree without optimization')),
1947 ('', 'no-optimized', False, _('evaluate tree without optimization')),
1947 ('', 'verify-optimized', False, _('verify optimized result')),
1948 ('', 'verify-optimized', False, _('verify optimized result')),
1948 ],
1949 ],
1949 ('REVSPEC'))
1950 ('REVSPEC'))
1950 def debugrevspec(ui, repo, expr, **opts):
1951 def debugrevspec(ui, repo, expr, **opts):
1951 """parse and apply a revision specification
1952 """parse and apply a revision specification
1952
1953
1953 Use -p/--show-stage option to print the parsed tree at the given stages.
1954 Use -p/--show-stage option to print the parsed tree at the given stages.
1954 Use -p all to print tree at every stage.
1955 Use -p all to print tree at every stage.
1955
1956
1956 Use --no-show-revs option with -s or -p to print only the set
1957 Use --no-show-revs option with -s or -p to print only the set
1957 representation or the parsed tree respectively.
1958 representation or the parsed tree respectively.
1958
1959
1959 Use --verify-optimized to compare the optimized result with the unoptimized
1960 Use --verify-optimized to compare the optimized result with the unoptimized
1960 one. Returns 1 if the optimized result differs.
1961 one. Returns 1 if the optimized result differs.
1961 """
1962 """
1962 opts = pycompat.byteskwargs(opts)
1963 opts = pycompat.byteskwargs(opts)
1963 aliases = ui.configitems('revsetalias')
1964 aliases = ui.configitems('revsetalias')
1964 stages = [
1965 stages = [
1965 ('parsed', lambda tree: tree),
1966 ('parsed', lambda tree: tree),
1966 ('expanded', lambda tree: revsetlang.expandaliases(tree, aliases,
1967 ('expanded', lambda tree: revsetlang.expandaliases(tree, aliases,
1967 ui.warn)),
1968 ui.warn)),
1968 ('concatenated', revsetlang.foldconcat),
1969 ('concatenated', revsetlang.foldconcat),
1969 ('analyzed', revsetlang.analyze),
1970 ('analyzed', revsetlang.analyze),
1970 ('optimized', revsetlang.optimize),
1971 ('optimized', revsetlang.optimize),
1971 ]
1972 ]
1972 if opts['no_optimized']:
1973 if opts['no_optimized']:
1973 stages = stages[:-1]
1974 stages = stages[:-1]
1974 if opts['verify_optimized'] and opts['no_optimized']:
1975 if opts['verify_optimized'] and opts['no_optimized']:
1975 raise error.Abort(_('cannot use --verify-optimized with '
1976 raise error.Abort(_('cannot use --verify-optimized with '
1976 '--no-optimized'))
1977 '--no-optimized'))
1977 stagenames = set(n for n, f in stages)
1978 stagenames = set(n for n, f in stages)
1978
1979
1979 showalways = set()
1980 showalways = set()
1980 showchanged = set()
1981 showchanged = set()
1981 if ui.verbose and not opts['show_stage']:
1982 if ui.verbose and not opts['show_stage']:
1982 # show parsed tree by --verbose (deprecated)
1983 # show parsed tree by --verbose (deprecated)
1983 showalways.add('parsed')
1984 showalways.add('parsed')
1984 showchanged.update(['expanded', 'concatenated'])
1985 showchanged.update(['expanded', 'concatenated'])
1985 if opts['optimize']:
1986 if opts['optimize']:
1986 showalways.add('optimized')
1987 showalways.add('optimized')
1987 if opts['show_stage'] and opts['optimize']:
1988 if opts['show_stage'] and opts['optimize']:
1988 raise error.Abort(_('cannot use --optimize with --show-stage'))
1989 raise error.Abort(_('cannot use --optimize with --show-stage'))
1989 if opts['show_stage'] == ['all']:
1990 if opts['show_stage'] == ['all']:
1990 showalways.update(stagenames)
1991 showalways.update(stagenames)
1991 else:
1992 else:
1992 for n in opts['show_stage']:
1993 for n in opts['show_stage']:
1993 if n not in stagenames:
1994 if n not in stagenames:
1994 raise error.Abort(_('invalid stage name: %s') % n)
1995 raise error.Abort(_('invalid stage name: %s') % n)
1995 showalways.update(opts['show_stage'])
1996 showalways.update(opts['show_stage'])
1996
1997
1997 treebystage = {}
1998 treebystage = {}
1998 printedtree = None
1999 printedtree = None
1999 tree = revsetlang.parse(expr, lookup=repo.__contains__)
2000 tree = revsetlang.parse(expr, lookup=repo.__contains__)
2000 for n, f in stages:
2001 for n, f in stages:
2001 treebystage[n] = tree = f(tree)
2002 treebystage[n] = tree = f(tree)
2002 if n in showalways or (n in showchanged and tree != printedtree):
2003 if n in showalways or (n in showchanged and tree != printedtree):
2003 if opts['show_stage'] or n != 'parsed':
2004 if opts['show_stage'] or n != 'parsed':
2004 ui.write(("* %s:\n") % n)
2005 ui.write(("* %s:\n") % n)
2005 ui.write(revsetlang.prettyformat(tree), "\n")
2006 ui.write(revsetlang.prettyformat(tree), "\n")
2006 printedtree = tree
2007 printedtree = tree
2007
2008
2008 if opts['verify_optimized']:
2009 if opts['verify_optimized']:
2009 arevs = revset.makematcher(treebystage['analyzed'])(repo)
2010 arevs = revset.makematcher(treebystage['analyzed'])(repo)
2010 brevs = revset.makematcher(treebystage['optimized'])(repo)
2011 brevs = revset.makematcher(treebystage['optimized'])(repo)
2011 if opts['show_set'] or (opts['show_set'] is None and ui.verbose):
2012 if opts['show_set'] or (opts['show_set'] is None and ui.verbose):
2012 ui.write(("* analyzed set:\n"), smartset.prettyformat(arevs), "\n")
2013 ui.write(("* analyzed set:\n"), smartset.prettyformat(arevs), "\n")
2013 ui.write(("* optimized set:\n"), smartset.prettyformat(brevs), "\n")
2014 ui.write(("* optimized set:\n"), smartset.prettyformat(brevs), "\n")
2014 arevs = list(arevs)
2015 arevs = list(arevs)
2015 brevs = list(brevs)
2016 brevs = list(brevs)
2016 if arevs == brevs:
2017 if arevs == brevs:
2017 return 0
2018 return 0
2018 ui.write(('--- analyzed\n'), label='diff.file_a')
2019 ui.write(('--- analyzed\n'), label='diff.file_a')
2019 ui.write(('+++ optimized\n'), label='diff.file_b')
2020 ui.write(('+++ optimized\n'), label='diff.file_b')
2020 sm = difflib.SequenceMatcher(None, arevs, brevs)
2021 sm = difflib.SequenceMatcher(None, arevs, brevs)
2021 for tag, alo, ahi, blo, bhi in sm.get_opcodes():
2022 for tag, alo, ahi, blo, bhi in sm.get_opcodes():
2022 if tag in ('delete', 'replace'):
2023 if tag in ('delete', 'replace'):
2023 for c in arevs[alo:ahi]:
2024 for c in arevs[alo:ahi]:
2024 ui.write('-%s\n' % c, label='diff.deleted')
2025 ui.write('-%s\n' % c, label='diff.deleted')
2025 if tag in ('insert', 'replace'):
2026 if tag in ('insert', 'replace'):
2026 for c in brevs[blo:bhi]:
2027 for c in brevs[blo:bhi]:
2027 ui.write('+%s\n' % c, label='diff.inserted')
2028 ui.write('+%s\n' % c, label='diff.inserted')
2028 if tag == 'equal':
2029 if tag == 'equal':
2029 for c in arevs[alo:ahi]:
2030 for c in arevs[alo:ahi]:
2030 ui.write(' %s\n' % c)
2031 ui.write(' %s\n' % c)
2031 return 1
2032 return 1
2032
2033
2033 func = revset.makematcher(tree)
2034 func = revset.makematcher(tree)
2034 revs = func(repo)
2035 revs = func(repo)
2035 if opts['show_set'] or (opts['show_set'] is None and ui.verbose):
2036 if opts['show_set'] or (opts['show_set'] is None and ui.verbose):
2036 ui.write(("* set:\n"), smartset.prettyformat(revs), "\n")
2037 ui.write(("* set:\n"), smartset.prettyformat(revs), "\n")
2037 if not opts['show_revs']:
2038 if not opts['show_revs']:
2038 return
2039 return
2039 for c in revs:
2040 for c in revs:
2040 ui.write("%s\n" % c)
2041 ui.write("%s\n" % c)
2041
2042
2042 @command('debugsetparents', [], _('REV1 [REV2]'))
2043 @command('debugsetparents', [], _('REV1 [REV2]'))
2043 def debugsetparents(ui, repo, rev1, rev2=None):
2044 def debugsetparents(ui, repo, rev1, rev2=None):
2044 """manually set the parents of the current working directory
2045 """manually set the parents of the current working directory
2045
2046
2046 This is useful for writing repository conversion tools, but should
2047 This is useful for writing repository conversion tools, but should
2047 be used with care. For example, neither the working directory nor the
2048 be used with care. For example, neither the working directory nor the
2048 dirstate is updated, so file status may be incorrect after running this
2049 dirstate is updated, so file status may be incorrect after running this
2049 command.
2050 command.
2050
2051
2051 Returns 0 on success.
2052 Returns 0 on success.
2052 """
2053 """
2053
2054
2054 r1 = scmutil.revsingle(repo, rev1).node()
2055 r1 = scmutil.revsingle(repo, rev1).node()
2055 r2 = scmutil.revsingle(repo, rev2, 'null').node()
2056 r2 = scmutil.revsingle(repo, rev2, 'null').node()
2056
2057
2057 with repo.wlock():
2058 with repo.wlock():
2058 repo.setparents(r1, r2)
2059 repo.setparents(r1, r2)
2059
2060
2061 @command('debugssl', [], '[SOURCE]', optionalrepo=True)
2062 def debugssl(ui, repo, source=None, **opts):
2063 '''test a secure connection to a server
2064
2065 This builds the certificate chain for the server on Windows, installing the
2066 missing intermediates and trusted root via Windows Update if necessary. It
2067 does nothing on other platforms.
2068
2069 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.
2071
2072 If the update succeeds, retry the original operation. Otherwise, the cause
2073 of the SSL error is likely another issue.
2074 '''
2075 if pycompat.osname != 'nt':
2076 raise error.Abort(_('Certificate chain building is only possible on '
2077 'Windows'))
2078
2079 if not source:
2080 source = "default"
2081 elif not repo:
2082 raise error.Abort(_("there is no Mercurial repository here, and no "
2083 "server specified"))
2084
2085 source, branches = hg.parseurl(ui.expandpath(source))
2086 url = util.url(source)
2087 addr = None
2088
2089 if url.scheme == 'https':
2090 addr = (url.host, url.port or 443)
2091 elif url.scheme == 'ssh':
2092 addr = (url.host, url.port or 22)
2093 else:
2094 raise error.Abort(_("Only https and ssh connections are supported"))
2095
2096 from . import win32
2097
2098 s = ssl.wrap_socket(socket.socket(), ssl_version=ssl.PROTOCOL_TLS,
2099 cert_reqs=ssl.CERT_NONE, ca_certs=None)
2100
2101 try:
2102 s.connect(addr)
2103 cert = s.getpeercert(True)
2104
2105 ui.status(_('Checking the certificate chain for %s.\n') % url.host)
2106
2107 complete = win32.checkcertificatechain(cert, build=False)
2108
2109 if not complete:
2110 ui.status(_('The certificate chain is incomplete. Updating... '))
2111
2112 if not win32.checkcertificatechain(cert):
2113 ui.status(_('Failed.\n'))
2114 else:
2115 ui.status(_('Done.\n'))
2116 else:
2117 ui.status(_('The full certificate chain is available.\n'))
2118 finally:
2119 s.close()
2120
2060 @command('debugsub',
2121 @command('debugsub',
2061 [('r', 'rev', '',
2122 [('r', 'rev', '',
2062 _('revision to check'), _('REV'))],
2123 _('revision to check'), _('REV'))],
2063 _('[-r REV] [REV]'))
2124 _('[-r REV] [REV]'))
2064 def debugsub(ui, repo, rev=None):
2125 def debugsub(ui, repo, rev=None):
2065 ctx = scmutil.revsingle(repo, rev, None)
2126 ctx = scmutil.revsingle(repo, rev, None)
2066 for k, v in sorted(ctx.substate.items()):
2127 for k, v in sorted(ctx.substate.items()):
2067 ui.write(('path %s\n') % k)
2128 ui.write(('path %s\n') % k)
2068 ui.write((' source %s\n') % v[0])
2129 ui.write((' source %s\n') % v[0])
2069 ui.write((' revision %s\n') % v[1])
2130 ui.write((' revision %s\n') % v[1])
2070
2131
2071 @command('debugsuccessorssets',
2132 @command('debugsuccessorssets',
2072 [('', 'closest', False, _('return closest successors sets only'))],
2133 [('', 'closest', False, _('return closest successors sets only'))],
2073 _('[REV]'))
2134 _('[REV]'))
2074 def debugsuccessorssets(ui, repo, *revs, **opts):
2135 def debugsuccessorssets(ui, repo, *revs, **opts):
2075 """show set of successors for revision
2136 """show set of successors for revision
2076
2137
2077 A successors set of changeset A is a consistent group of revisions that
2138 A successors set of changeset A is a consistent group of revisions that
2078 succeed A. It contains non-obsolete changesets only unless closests
2139 succeed A. It contains non-obsolete changesets only unless closests
2079 successors set is set.
2140 successors set is set.
2080
2141
2081 In most cases a changeset A has a single successors set containing a single
2142 In most cases a changeset A has a single successors set containing a single
2082 successor (changeset A replaced by A').
2143 successor (changeset A replaced by A').
2083
2144
2084 A changeset that is made obsolete with no successors are called "pruned".
2145 A changeset that is made obsolete with no successors are called "pruned".
2085 Such changesets have no successors sets at all.
2146 Such changesets have no successors sets at all.
2086
2147
2087 A changeset that has been "split" will have a successors set containing
2148 A changeset that has been "split" will have a successors set containing
2088 more than one successor.
2149 more than one successor.
2089
2150
2090 A changeset that has been rewritten in multiple different ways is called
2151 A changeset that has been rewritten in multiple different ways is called
2091 "divergent". Such changesets have multiple successor sets (each of which
2152 "divergent". Such changesets have multiple successor sets (each of which
2092 may also be split, i.e. have multiple successors).
2153 may also be split, i.e. have multiple successors).
2093
2154
2094 Results are displayed as follows::
2155 Results are displayed as follows::
2095
2156
2096 <rev1>
2157 <rev1>
2097 <successors-1A>
2158 <successors-1A>
2098 <rev2>
2159 <rev2>
2099 <successors-2A>
2160 <successors-2A>
2100 <successors-2B1> <successors-2B2> <successors-2B3>
2161 <successors-2B1> <successors-2B2> <successors-2B3>
2101
2162
2102 Here rev2 has two possible (i.e. divergent) successors sets. The first
2163 Here rev2 has two possible (i.e. divergent) successors sets. The first
2103 holds one element, whereas the second holds three (i.e. the changeset has
2164 holds one element, whereas the second holds three (i.e. the changeset has
2104 been split).
2165 been split).
2105 """
2166 """
2106 # passed to successorssets caching computation from one call to another
2167 # passed to successorssets caching computation from one call to another
2107 cache = {}
2168 cache = {}
2108 ctx2str = str
2169 ctx2str = str
2109 node2str = short
2170 node2str = short
2110 if ui.debug():
2171 if ui.debug():
2111 def ctx2str(ctx):
2172 def ctx2str(ctx):
2112 return ctx.hex()
2173 return ctx.hex()
2113 node2str = hex
2174 node2str = hex
2114 for rev in scmutil.revrange(repo, revs):
2175 for rev in scmutil.revrange(repo, revs):
2115 ctx = repo[rev]
2176 ctx = repo[rev]
2116 ui.write('%s\n'% ctx2str(ctx))
2177 ui.write('%s\n'% ctx2str(ctx))
2117 for succsset in obsutil.successorssets(repo, ctx.node(),
2178 for succsset in obsutil.successorssets(repo, ctx.node(),
2118 closest=opts['closest'],
2179 closest=opts['closest'],
2119 cache=cache):
2180 cache=cache):
2120 if succsset:
2181 if succsset:
2121 ui.write(' ')
2182 ui.write(' ')
2122 ui.write(node2str(succsset[0]))
2183 ui.write(node2str(succsset[0]))
2123 for node in succsset[1:]:
2184 for node in succsset[1:]:
2124 ui.write(' ')
2185 ui.write(' ')
2125 ui.write(node2str(node))
2186 ui.write(node2str(node))
2126 ui.write('\n')
2187 ui.write('\n')
2127
2188
2128 @command('debugtemplate',
2189 @command('debugtemplate',
2129 [('r', 'rev', [], _('apply template on changesets'), _('REV')),
2190 [('r', 'rev', [], _('apply template on changesets'), _('REV')),
2130 ('D', 'define', [], _('define template keyword'), _('KEY=VALUE'))],
2191 ('D', 'define', [], _('define template keyword'), _('KEY=VALUE'))],
2131 _('[-r REV]... [-D KEY=VALUE]... TEMPLATE'),
2192 _('[-r REV]... [-D KEY=VALUE]... TEMPLATE'),
2132 optionalrepo=True)
2193 optionalrepo=True)
2133 def debugtemplate(ui, repo, tmpl, **opts):
2194 def debugtemplate(ui, repo, tmpl, **opts):
2134 """parse and apply a template
2195 """parse and apply a template
2135
2196
2136 If -r/--rev is given, the template is processed as a log template and
2197 If -r/--rev is given, the template is processed as a log template and
2137 applied to the given changesets. Otherwise, it is processed as a generic
2198 applied to the given changesets. Otherwise, it is processed as a generic
2138 template.
2199 template.
2139
2200
2140 Use --verbose to print the parsed tree.
2201 Use --verbose to print the parsed tree.
2141 """
2202 """
2142 revs = None
2203 revs = None
2143 if opts[r'rev']:
2204 if opts[r'rev']:
2144 if repo is None:
2205 if repo is None:
2145 raise error.RepoError(_('there is no Mercurial repository here '
2206 raise error.RepoError(_('there is no Mercurial repository here '
2146 '(.hg not found)'))
2207 '(.hg not found)'))
2147 revs = scmutil.revrange(repo, opts[r'rev'])
2208 revs = scmutil.revrange(repo, opts[r'rev'])
2148
2209
2149 props = {}
2210 props = {}
2150 for d in opts[r'define']:
2211 for d in opts[r'define']:
2151 try:
2212 try:
2152 k, v = (e.strip() for e in d.split('=', 1))
2213 k, v = (e.strip() for e in d.split('=', 1))
2153 if not k or k == 'ui':
2214 if not k or k == 'ui':
2154 raise ValueError
2215 raise ValueError
2155 props[k] = v
2216 props[k] = v
2156 except ValueError:
2217 except ValueError:
2157 raise error.Abort(_('malformed keyword definition: %s') % d)
2218 raise error.Abort(_('malformed keyword definition: %s') % d)
2158
2219
2159 if ui.verbose:
2220 if ui.verbose:
2160 aliases = ui.configitems('templatealias')
2221 aliases = ui.configitems('templatealias')
2161 tree = templater.parse(tmpl)
2222 tree = templater.parse(tmpl)
2162 ui.note(templater.prettyformat(tree), '\n')
2223 ui.note(templater.prettyformat(tree), '\n')
2163 newtree = templater.expandaliases(tree, aliases)
2224 newtree = templater.expandaliases(tree, aliases)
2164 if newtree != tree:
2225 if newtree != tree:
2165 ui.note(("* expanded:\n"), templater.prettyformat(newtree), '\n')
2226 ui.note(("* expanded:\n"), templater.prettyformat(newtree), '\n')
2166
2227
2167 if revs is None:
2228 if revs is None:
2168 t = formatter.maketemplater(ui, tmpl)
2229 t = formatter.maketemplater(ui, tmpl)
2169 props['ui'] = ui
2230 props['ui'] = ui
2170 ui.write(t.render(props))
2231 ui.write(t.render(props))
2171 else:
2232 else:
2172 displayer = cmdutil.makelogtemplater(ui, repo, tmpl)
2233 displayer = cmdutil.makelogtemplater(ui, repo, tmpl)
2173 for r in revs:
2234 for r in revs:
2174 displayer.show(repo[r], **pycompat.strkwargs(props))
2235 displayer.show(repo[r], **pycompat.strkwargs(props))
2175 displayer.close()
2236 displayer.close()
2176
2237
2177 @command('debugupdatecaches', [])
2238 @command('debugupdatecaches', [])
2178 def debugupdatecaches(ui, repo, *pats, **opts):
2239 def debugupdatecaches(ui, repo, *pats, **opts):
2179 """warm all known caches in the repository"""
2240 """warm all known caches in the repository"""
2180 with repo.wlock(), repo.lock():
2241 with repo.wlock(), repo.lock():
2181 repo.updatecaches()
2242 repo.updatecaches()
2182
2243
2183 @command('debugupgraderepo', [
2244 @command('debugupgraderepo', [
2184 ('o', 'optimize', [], _('extra optimization to perform'), _('NAME')),
2245 ('o', 'optimize', [], _('extra optimization to perform'), _('NAME')),
2185 ('', 'run', False, _('performs an upgrade')),
2246 ('', 'run', False, _('performs an upgrade')),
2186 ])
2247 ])
2187 def debugupgraderepo(ui, repo, run=False, optimize=None):
2248 def debugupgraderepo(ui, repo, run=False, optimize=None):
2188 """upgrade a repository to use different features
2249 """upgrade a repository to use different features
2189
2250
2190 If no arguments are specified, the repository is evaluated for upgrade
2251 If no arguments are specified, the repository is evaluated for upgrade
2191 and a list of problems and potential optimizations is printed.
2252 and a list of problems and potential optimizations is printed.
2192
2253
2193 With ``--run``, a repository upgrade is performed. Behavior of the upgrade
2254 With ``--run``, a repository upgrade is performed. Behavior of the upgrade
2194 can be influenced via additional arguments. More details will be provided
2255 can be influenced via additional arguments. More details will be provided
2195 by the command output when run without ``--run``.
2256 by the command output when run without ``--run``.
2196
2257
2197 During the upgrade, the repository will be locked and no writes will be
2258 During the upgrade, the repository will be locked and no writes will be
2198 allowed.
2259 allowed.
2199
2260
2200 At the end of the upgrade, the repository may not be readable while new
2261 At the end of the upgrade, the repository may not be readable while new
2201 repository data is swapped in. This window will be as long as it takes to
2262 repository data is swapped in. This window will be as long as it takes to
2202 rename some directories inside the ``.hg`` directory. On most machines, this
2263 rename some directories inside the ``.hg`` directory. On most machines, this
2203 should complete almost instantaneously and the chances of a consumer being
2264 should complete almost instantaneously and the chances of a consumer being
2204 unable to access the repository should be low.
2265 unable to access the repository should be low.
2205 """
2266 """
2206 return upgrade.upgraderepo(ui, repo, run=run, optimize=optimize)
2267 return upgrade.upgraderepo(ui, repo, run=run, optimize=optimize)
2207
2268
2208 @command('debugwalk', cmdutil.walkopts, _('[OPTION]... [FILE]...'),
2269 @command('debugwalk', cmdutil.walkopts, _('[OPTION]... [FILE]...'),
2209 inferrepo=True)
2270 inferrepo=True)
2210 def debugwalk(ui, repo, *pats, **opts):
2271 def debugwalk(ui, repo, *pats, **opts):
2211 """show how files match on given patterns"""
2272 """show how files match on given patterns"""
2212 opts = pycompat.byteskwargs(opts)
2273 opts = pycompat.byteskwargs(opts)
2213 m = scmutil.match(repo[None], pats, opts)
2274 m = scmutil.match(repo[None], pats, opts)
2214 ui.write(('matcher: %r\n' % m))
2275 ui.write(('matcher: %r\n' % m))
2215 items = list(repo[None].walk(m))
2276 items = list(repo[None].walk(m))
2216 if not items:
2277 if not items:
2217 return
2278 return
2218 f = lambda fn: fn
2279 f = lambda fn: fn
2219 if ui.configbool('ui', 'slash') and pycompat.ossep != '/':
2280 if ui.configbool('ui', 'slash') and pycompat.ossep != '/':
2220 f = lambda fn: util.normpath(fn)
2281 f = lambda fn: util.normpath(fn)
2221 fmt = 'f %%-%ds %%-%ds %%s' % (
2282 fmt = 'f %%-%ds %%-%ds %%s' % (
2222 max([len(abs) for abs in items]),
2283 max([len(abs) for abs in items]),
2223 max([len(m.rel(abs)) for abs in items]))
2284 max([len(m.rel(abs)) for abs in items]))
2224 for abs in items:
2285 for abs in items:
2225 line = fmt % (abs, f(m.rel(abs)), m.exact(abs) and 'exact' or '')
2286 line = fmt % (abs, f(m.rel(abs)), m.exact(abs) and 'exact' or '')
2226 ui.write("%s\n" % line.rstrip())
2287 ui.write("%s\n" % line.rstrip())
2227
2288
2228 @command('debugwireargs',
2289 @command('debugwireargs',
2229 [('', 'three', '', 'three'),
2290 [('', 'three', '', 'three'),
2230 ('', 'four', '', 'four'),
2291 ('', 'four', '', 'four'),
2231 ('', 'five', '', 'five'),
2292 ('', 'five', '', 'five'),
2232 ] + cmdutil.remoteopts,
2293 ] + cmdutil.remoteopts,
2233 _('REPO [OPTIONS]... [ONE [TWO]]'),
2294 _('REPO [OPTIONS]... [ONE [TWO]]'),
2234 norepo=True)
2295 norepo=True)
2235 def debugwireargs(ui, repopath, *vals, **opts):
2296 def debugwireargs(ui, repopath, *vals, **opts):
2236 opts = pycompat.byteskwargs(opts)
2297 opts = pycompat.byteskwargs(opts)
2237 repo = hg.peer(ui, opts, repopath)
2298 repo = hg.peer(ui, opts, repopath)
2238 for opt in cmdutil.remoteopts:
2299 for opt in cmdutil.remoteopts:
2239 del opts[opt[1]]
2300 del opts[opt[1]]
2240 args = {}
2301 args = {}
2241 for k, v in opts.iteritems():
2302 for k, v in opts.iteritems():
2242 if v:
2303 if v:
2243 args[k] = v
2304 args[k] = v
2244 # run twice to check that we don't mess up the stream for the next command
2305 # run twice to check that we don't mess up the stream for the next command
2245 res1 = repo.debugwireargs(*vals, **args)
2306 res1 = repo.debugwireargs(*vals, **args)
2246 res2 = repo.debugwireargs(*vals, **args)
2307 res2 = repo.debugwireargs(*vals, **args)
2247 ui.write("%s\n" % res1)
2308 ui.write("%s\n" % res1)
2248 if res1 != res2:
2309 if res1 != res2:
2249 ui.warn("%s\n" % res2)
2310 ui.warn("%s\n" % res2)
@@ -1,381 +1,383 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 debugcheckstate
75 debugcheckstate
76 debugcolor
76 debugcolor
77 debugcommands
77 debugcommands
78 debugcomplete
78 debugcomplete
79 debugconfig
79 debugconfig
80 debugcreatestreamclonebundle
80 debugcreatestreamclonebundle
81 debugdag
81 debugdag
82 debugdata
82 debugdata
83 debugdate
83 debugdate
84 debugdeltachain
84 debugdeltachain
85 debugdirstate
85 debugdirstate
86 debugdiscovery
86 debugdiscovery
87 debugextensions
87 debugextensions
88 debugfileset
88 debugfileset
89 debugfsinfo
89 debugfsinfo
90 debuggetbundle
90 debuggetbundle
91 debugignore
91 debugignore
92 debugindex
92 debugindex
93 debugindexdot
93 debugindexdot
94 debuginstall
94 debuginstall
95 debugknown
95 debugknown
96 debuglabelcomplete
96 debuglabelcomplete
97 debuglocks
97 debuglocks
98 debugmergestate
98 debugmergestate
99 debugnamecomplete
99 debugnamecomplete
100 debugobsolete
100 debugobsolete
101 debugpathcomplete
101 debugpathcomplete
102 debugpickmergetool
102 debugpickmergetool
103 debugpushkey
103 debugpushkey
104 debugpvec
104 debugpvec
105 debugrebuilddirstate
105 debugrebuilddirstate
106 debugrebuildfncache
106 debugrebuildfncache
107 debugrename
107 debugrename
108 debugrevlog
108 debugrevlog
109 debugrevspec
109 debugrevspec
110 debugsetparents
110 debugsetparents
111 debugssl
111 debugsub
112 debugsub
112 debugsuccessorssets
113 debugsuccessorssets
113 debugtemplate
114 debugtemplate
114 debugupdatecaches
115 debugupdatecaches
115 debugupgraderepo
116 debugupgraderepo
116 debugwalk
117 debugwalk
117 debugwireargs
118 debugwireargs
118
119
119 Do not show the alias of a debug command if there are other candidates
120 Do not show the alias of a debug command if there are other candidates
120 (this should hide rawcommit)
121 (this should hide rawcommit)
121 $ hg debugcomplete r
122 $ hg debugcomplete r
122 recover
123 recover
123 remove
124 remove
124 rename
125 rename
125 resolve
126 resolve
126 revert
127 revert
127 rollback
128 rollback
128 root
129 root
129 Show the alias of a debug command if there are no other candidates
130 Show the alias of a debug command if there are no other candidates
130 $ hg debugcomplete rawc
131 $ hg debugcomplete rawc
131
132
132
133
133 Show the global options
134 Show the global options
134 $ hg debugcomplete --options | sort
135 $ hg debugcomplete --options | sort
135 --color
136 --color
136 --config
137 --config
137 --cwd
138 --cwd
138 --debug
139 --debug
139 --debugger
140 --debugger
140 --encoding
141 --encoding
141 --encodingmode
142 --encodingmode
142 --help
143 --help
143 --hidden
144 --hidden
144 --noninteractive
145 --noninteractive
145 --pager
146 --pager
146 --profile
147 --profile
147 --quiet
148 --quiet
148 --repository
149 --repository
149 --time
150 --time
150 --traceback
151 --traceback
151 --verbose
152 --verbose
152 --version
153 --version
153 -R
154 -R
154 -h
155 -h
155 -q
156 -q
156 -v
157 -v
157 -y
158 -y
158
159
159 Show the options for the "serve" command
160 Show the options for the "serve" command
160 $ hg debugcomplete --options serve | sort
161 $ hg debugcomplete --options serve | sort
161 --accesslog
162 --accesslog
162 --address
163 --address
163 --certificate
164 --certificate
164 --cmdserver
165 --cmdserver
165 --color
166 --color
166 --config
167 --config
167 --cwd
168 --cwd
168 --daemon
169 --daemon
169 --daemon-postexec
170 --daemon-postexec
170 --debug
171 --debug
171 --debugger
172 --debugger
172 --encoding
173 --encoding
173 --encodingmode
174 --encodingmode
174 --errorlog
175 --errorlog
175 --help
176 --help
176 --hidden
177 --hidden
177 --ipv6
178 --ipv6
178 --name
179 --name
179 --noninteractive
180 --noninteractive
180 --pager
181 --pager
181 --pid-file
182 --pid-file
182 --port
183 --port
183 --prefix
184 --prefix
184 --profile
185 --profile
185 --quiet
186 --quiet
186 --repository
187 --repository
187 --stdio
188 --stdio
188 --style
189 --style
189 --subrepos
190 --subrepos
190 --templates
191 --templates
191 --time
192 --time
192 --traceback
193 --traceback
193 --verbose
194 --verbose
194 --version
195 --version
195 --web-conf
196 --web-conf
196 -6
197 -6
197 -A
198 -A
198 -E
199 -E
199 -R
200 -R
200 -S
201 -S
201 -a
202 -a
202 -d
203 -d
203 -h
204 -h
204 -n
205 -n
205 -p
206 -p
206 -q
207 -q
207 -t
208 -t
208 -v
209 -v
209 -y
210 -y
210
211
211 Show an error if we use --options with an ambiguous abbreviation
212 Show an error if we use --options with an ambiguous abbreviation
212 $ hg debugcomplete --options s
213 $ hg debugcomplete --options s
213 hg: command 's' is ambiguous:
214 hg: command 's' is ambiguous:
214 serve showconfig status summary
215 serve showconfig status summary
215 [255]
216 [255]
216
217
217 Show all commands + options
218 Show all commands + options
218 $ hg debugcommands
219 $ hg debugcommands
219 add: include, exclude, subrepos, dry-run
220 add: include, exclude, subrepos, dry-run
220 annotate: rev, follow, no-follow, text, user, file, date, number, changeset, line-number, skip, ignore-all-space, ignore-space-change, ignore-blank-lines, include, exclude, template
221 annotate: rev, follow, no-follow, text, user, file, date, number, changeset, line-number, skip, ignore-all-space, ignore-space-change, ignore-blank-lines, include, exclude, template
221 clone: noupdate, updaterev, rev, branch, pull, uncompressed, ssh, remotecmd, insecure
222 clone: noupdate, updaterev, rev, branch, pull, uncompressed, ssh, remotecmd, insecure
222 commit: addremove, close-branch, amend, secret, edit, interactive, include, exclude, message, logfile, date, user, subrepos
223 commit: addremove, close-branch, amend, secret, edit, interactive, include, exclude, message, logfile, date, user, subrepos
223 diff: rev, change, text, git, binary, nodates, noprefix, show-function, reverse, ignore-all-space, ignore-space-change, ignore-blank-lines, unified, stat, root, include, exclude, subrepos
224 diff: rev, change, text, git, binary, nodates, noprefix, show-function, reverse, ignore-all-space, ignore-space-change, ignore-blank-lines, unified, stat, root, include, exclude, subrepos
224 export: output, switch-parent, rev, text, git, binary, nodates
225 export: output, switch-parent, rev, text, git, binary, nodates
225 forget: include, exclude
226 forget: include, exclude
226 init: ssh, remotecmd, insecure
227 init: ssh, remotecmd, insecure
227 log: follow, follow-first, date, copies, keyword, rev, removed, only-merges, user, only-branch, branch, prune, patch, git, limit, no-merges, stat, graph, style, template, include, exclude
228 log: follow, follow-first, date, copies, keyword, rev, removed, only-merges, user, only-branch, branch, prune, patch, git, limit, no-merges, stat, graph, style, template, include, exclude
228 merge: force, rev, preview, tool
229 merge: force, rev, preview, tool
229 pull: update, force, rev, bookmark, branch, ssh, remotecmd, insecure
230 pull: update, force, rev, bookmark, branch, ssh, remotecmd, insecure
230 push: force, rev, bookmark, branch, new-branch, ssh, remotecmd, insecure
231 push: force, rev, bookmark, branch, new-branch, ssh, remotecmd, insecure
231 remove: after, force, subrepos, include, exclude
232 remove: after, force, subrepos, include, exclude
232 serve: accesslog, daemon, daemon-postexec, errorlog, port, address, prefix, name, web-conf, webdir-conf, pid-file, stdio, cmdserver, templates, style, ipv6, certificate, subrepos
233 serve: accesslog, daemon, daemon-postexec, errorlog, port, address, prefix, name, web-conf, webdir-conf, pid-file, stdio, cmdserver, templates, style, ipv6, certificate, subrepos
233 status: all, modified, added, removed, deleted, clean, unknown, ignored, no-status, copies, print0, rev, change, include, exclude, subrepos, template
234 status: all, modified, added, removed, deleted, clean, unknown, ignored, no-status, copies, print0, rev, change, include, exclude, subrepos, template
234 summary: remote
235 summary: remote
235 update: clean, check, merge, date, rev, tool
236 update: clean, check, merge, date, rev, tool
236 addremove: similarity, subrepos, include, exclude, dry-run
237 addremove: similarity, subrepos, include, exclude, dry-run
237 archive: no-decode, prefix, rev, type, subrepos, include, exclude
238 archive: no-decode, prefix, rev, type, subrepos, include, exclude
238 backout: merge, commit, no-commit, parent, rev, edit, tool, include, exclude, message, logfile, date, user
239 backout: merge, commit, no-commit, parent, rev, edit, tool, include, exclude, message, logfile, date, user
239 bisect: reset, good, bad, skip, extend, command, noupdate
240 bisect: reset, good, bad, skip, extend, command, noupdate
240 bookmarks: force, rev, delete, rename, inactive, template
241 bookmarks: force, rev, delete, rename, inactive, template
241 branch: force, clean
242 branch: force, clean
242 branches: active, closed, template
243 branches: active, closed, template
243 bundle: force, rev, branch, base, all, type, ssh, remotecmd, insecure
244 bundle: force, rev, branch, base, all, type, ssh, remotecmd, insecure
244 cat: output, rev, decode, include, exclude, template
245 cat: output, rev, decode, include, exclude, template
245 config: untrusted, edit, local, global, template
246 config: untrusted, edit, local, global, template
246 copy: after, force, include, exclude, dry-run
247 copy: after, force, include, exclude, dry-run
247 debugancestor:
248 debugancestor:
248 debugapplystreamclonebundle:
249 debugapplystreamclonebundle:
249 debugbuilddag: mergeable-file, overwritten-file, new-file
250 debugbuilddag: mergeable-file, overwritten-file, new-file
250 debugbundle: all, part-type, spec
251 debugbundle: all, part-type, spec
251 debugcheckstate:
252 debugcheckstate:
252 debugcolor: style
253 debugcolor: style
253 debugcommands:
254 debugcommands:
254 debugcomplete: options
255 debugcomplete: options
255 debugcreatestreamclonebundle:
256 debugcreatestreamclonebundle:
256 debugdag: tags, branches, dots, spaces
257 debugdag: tags, branches, dots, spaces
257 debugdata: changelog, manifest, dir
258 debugdata: changelog, manifest, dir
258 debugdate: extended
259 debugdate: extended
259 debugdeltachain: changelog, manifest, dir, template
260 debugdeltachain: changelog, manifest, dir, template
260 debugdirstate: nodates, datesort
261 debugdirstate: nodates, datesort
261 debugdiscovery: old, nonheads, ssh, remotecmd, insecure
262 debugdiscovery: old, nonheads, ssh, remotecmd, insecure
262 debugextensions: template
263 debugextensions: template
263 debugfileset: rev
264 debugfileset: rev
264 debugfsinfo:
265 debugfsinfo:
265 debuggetbundle: head, common, type
266 debuggetbundle: head, common, type
266 debugignore:
267 debugignore:
267 debugindex: changelog, manifest, dir, format
268 debugindex: changelog, manifest, dir, format
268 debugindexdot: changelog, manifest, dir
269 debugindexdot: changelog, manifest, dir
269 debuginstall: template
270 debuginstall: template
270 debugknown:
271 debugknown:
271 debuglabelcomplete:
272 debuglabelcomplete:
272 debuglocks: force-lock, force-wlock
273 debuglocks: force-lock, force-wlock
273 debugmergestate:
274 debugmergestate:
274 debugnamecomplete:
275 debugnamecomplete:
275 debugobsolete: flags, record-parents, rev, exclusive, index, delete, date, user, template
276 debugobsolete: flags, record-parents, rev, exclusive, index, delete, date, user, template
276 debugpathcomplete: full, normal, added, removed
277 debugpathcomplete: full, normal, added, removed
277 debugpickmergetool: rev, changedelete, include, exclude, tool
278 debugpickmergetool: rev, changedelete, include, exclude, tool
278 debugpushkey:
279 debugpushkey:
279 debugpvec:
280 debugpvec:
280 debugrebuilddirstate: rev, minimal
281 debugrebuilddirstate: rev, minimal
281 debugrebuildfncache:
282 debugrebuildfncache:
282 debugrename: rev
283 debugrename: rev
283 debugrevlog: changelog, manifest, dir, dump
284 debugrevlog: changelog, manifest, dir, dump
284 debugrevspec: optimize, show-revs, show-set, show-stage, no-optimized, verify-optimized
285 debugrevspec: optimize, show-revs, show-set, show-stage, no-optimized, verify-optimized
285 debugsetparents:
286 debugsetparents:
287 debugssl:
286 debugsub: rev
288 debugsub: rev
287 debugsuccessorssets: closest
289 debugsuccessorssets: closest
288 debugtemplate: rev, define
290 debugtemplate: rev, define
289 debugupdatecaches:
291 debugupdatecaches:
290 debugupgraderepo: optimize, run
292 debugupgraderepo: optimize, run
291 debugwalk: include, exclude
293 debugwalk: include, exclude
292 debugwireargs: three, four, five, ssh, remotecmd, insecure
294 debugwireargs: three, four, five, ssh, remotecmd, insecure
293 files: rev, print0, include, exclude, template, subrepos
295 files: rev, print0, include, exclude, template, subrepos
294 graft: rev, continue, edit, log, force, currentdate, currentuser, date, user, tool, dry-run
296 graft: rev, continue, edit, log, force, currentdate, currentuser, date, user, tool, dry-run
295 grep: print0, all, text, follow, ignore-case, files-with-matches, line-number, rev, user, date, template, include, exclude
297 grep: print0, all, text, follow, ignore-case, files-with-matches, line-number, rev, user, date, template, include, exclude
296 heads: rev, topo, active, closed, style, template
298 heads: rev, topo, active, closed, style, template
297 help: extension, command, keyword, system
299 help: extension, command, keyword, system
298 identify: rev, num, id, branch, tags, bookmarks, ssh, remotecmd, insecure, template
300 identify: rev, num, id, branch, tags, bookmarks, ssh, remotecmd, insecure, template
299 import: strip, base, edit, force, no-commit, bypass, partial, exact, prefix, import-branch, message, logfile, date, user, similarity
301 import: strip, base, edit, force, no-commit, bypass, partial, exact, prefix, import-branch, message, logfile, date, user, similarity
300 incoming: force, newest-first, bundle, rev, bookmarks, branch, patch, git, limit, no-merges, stat, graph, style, template, ssh, remotecmd, insecure, subrepos
302 incoming: force, newest-first, bundle, rev, bookmarks, branch, patch, git, limit, no-merges, stat, graph, style, template, ssh, remotecmd, insecure, subrepos
301 locate: rev, print0, fullpath, include, exclude
303 locate: rev, print0, fullpath, include, exclude
302 manifest: rev, all, template
304 manifest: rev, all, template
303 outgoing: force, rev, newest-first, bookmarks, branch, patch, git, limit, no-merges, stat, graph, style, template, ssh, remotecmd, insecure, subrepos
305 outgoing: force, rev, newest-first, bookmarks, branch, patch, git, limit, no-merges, stat, graph, style, template, ssh, remotecmd, insecure, subrepos
304 parents: rev, style, template
306 parents: rev, style, template
305 paths: template
307 paths: template
306 phase: public, draft, secret, force, rev
308 phase: public, draft, secret, force, rev
307 recover:
309 recover:
308 rename: after, force, include, exclude, dry-run
310 rename: after, force, include, exclude, dry-run
309 resolve: all, list, mark, unmark, no-status, tool, include, exclude, template
311 resolve: all, list, mark, unmark, no-status, tool, include, exclude, template
310 revert: all, date, rev, no-backup, interactive, include, exclude, dry-run
312 revert: all, date, rev, no-backup, interactive, include, exclude, dry-run
311 rollback: dry-run, force
313 rollback: dry-run, force
312 root:
314 root:
313 tag: force, local, rev, remove, edit, message, date, user
315 tag: force, local, rev, remove, edit, message, date, user
314 tags: template
316 tags: template
315 tip: patch, git, style, template
317 tip: patch, git, style, template
316 unbundle: update
318 unbundle: update
317 verify:
319 verify:
318 version: template
320 version: template
319
321
320 $ hg init a
322 $ hg init a
321 $ cd a
323 $ cd a
322 $ echo fee > fee
324 $ echo fee > fee
323 $ hg ci -q -Amfee
325 $ hg ci -q -Amfee
324 $ hg tag fee
326 $ hg tag fee
325 $ mkdir fie
327 $ mkdir fie
326 $ echo dead > fie/dead
328 $ echo dead > fie/dead
327 $ echo live > fie/live
329 $ echo live > fie/live
328 $ hg bookmark fo
330 $ hg bookmark fo
329 $ hg branch -q fie
331 $ hg branch -q fie
330 $ hg ci -q -Amfie
332 $ hg ci -q -Amfie
331 $ echo fo > fo
333 $ echo fo > fo
332 $ hg branch -qf default
334 $ hg branch -qf default
333 $ hg ci -q -Amfo
335 $ hg ci -q -Amfo
334 $ echo Fum > Fum
336 $ echo Fum > Fum
335 $ hg ci -q -AmFum
337 $ hg ci -q -AmFum
336 $ hg bookmark Fum
338 $ hg bookmark Fum
337
339
338 Test debugpathcomplete
340 Test debugpathcomplete
339
341
340 $ hg debugpathcomplete f
342 $ hg debugpathcomplete f
341 fee
343 fee
342 fie
344 fie
343 fo
345 fo
344 $ hg debugpathcomplete -f f
346 $ hg debugpathcomplete -f f
345 fee
347 fee
346 fie/dead
348 fie/dead
347 fie/live
349 fie/live
348 fo
350 fo
349
351
350 $ hg rm Fum
352 $ hg rm Fum
351 $ hg debugpathcomplete -r F
353 $ hg debugpathcomplete -r F
352 Fum
354 Fum
353
355
354 Test debugnamecomplete
356 Test debugnamecomplete
355
357
356 $ hg debugnamecomplete
358 $ hg debugnamecomplete
357 Fum
359 Fum
358 default
360 default
359 fee
361 fee
360 fie
362 fie
361 fo
363 fo
362 tip
364 tip
363 $ hg debugnamecomplete f
365 $ hg debugnamecomplete f
364 fee
366 fee
365 fie
367 fie
366 fo
368 fo
367
369
368 Test debuglabelcomplete, a deprecated name for debugnamecomplete that is still
370 Test debuglabelcomplete, a deprecated name for debugnamecomplete that is still
369 used for completions in some shells.
371 used for completions in some shells.
370
372
371 $ hg debuglabelcomplete
373 $ hg debuglabelcomplete
372 Fum
374 Fum
373 default
375 default
374 fee
376 fee
375 fie
377 fie
376 fo
378 fo
377 tip
379 tip
378 $ hg debuglabelcomplete f
380 $ hg debuglabelcomplete f
379 fee
381 fee
380 fie
382 fie
381 fo
383 fo
@@ -1,3366 +1,3367 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 -U --unified NUM number of lines of context to show
556 -U --unified NUM number of lines of context to show
557 --stat output diffstat-style summary of changes
557 --stat output diffstat-style summary of changes
558 --root DIR produce diffs relative to subdirectory
558 --root DIR produce diffs relative to subdirectory
559 -I --include PATTERN [+] include names matching the given patterns
559 -I --include PATTERN [+] include names matching the given patterns
560 -X --exclude PATTERN [+] exclude names matching the given patterns
560 -X --exclude PATTERN [+] exclude names matching the given patterns
561 -S --subrepos recurse into subrepositories
561 -S --subrepos recurse into subrepositories
562
562
563 (some details hidden, use --verbose to show complete help)
563 (some details hidden, use --verbose to show complete help)
564
564
565 $ hg help status
565 $ hg help status
566 hg status [OPTION]... [FILE]...
566 hg status [OPTION]... [FILE]...
567
567
568 aliases: st
568 aliases: st
569
569
570 show changed files in the working directory
570 show changed files in the working directory
571
571
572 Show status of files in the repository. If names are given, only files
572 Show status of files in the repository. If names are given, only files
573 that match are shown. Files that are clean or ignored or the source of a
573 that match are shown. Files that are clean or ignored or the source of a
574 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
574 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
575 -C/--copies or -A/--all are given. Unless options described with "show
575 -C/--copies or -A/--all are given. Unless options described with "show
576 only ..." are given, the options -mardu are used.
576 only ..." are given, the options -mardu are used.
577
577
578 Option -q/--quiet hides untracked (unknown and ignored) files unless
578 Option -q/--quiet hides untracked (unknown and ignored) files unless
579 explicitly requested with -u/--unknown or -i/--ignored.
579 explicitly requested with -u/--unknown or -i/--ignored.
580
580
581 Note:
581 Note:
582 'hg status' may appear to disagree with diff if permissions have
582 'hg status' may appear to disagree with diff if permissions have
583 changed or a merge has occurred. The standard diff format does not
583 changed or a merge has occurred. The standard diff format does not
584 report permission changes and diff only reports changes relative to one
584 report permission changes and diff only reports changes relative to one
585 merge parent.
585 merge parent.
586
586
587 If one revision is given, it is used as the base revision. If two
587 If one revision is given, it is used as the base revision. If two
588 revisions are given, the differences between them are shown. The --change
588 revisions are given, the differences between them are shown. The --change
589 option can also be used as a shortcut to list the changed files of a
589 option can also be used as a shortcut to list the changed files of a
590 revision from its first parent.
590 revision from its first parent.
591
591
592 The codes used to show the status of files are:
592 The codes used to show the status of files are:
593
593
594 M = modified
594 M = modified
595 A = added
595 A = added
596 R = removed
596 R = removed
597 C = clean
597 C = clean
598 ! = missing (deleted by non-hg command, but still tracked)
598 ! = missing (deleted by non-hg command, but still tracked)
599 ? = not tracked
599 ? = not tracked
600 I = ignored
600 I = ignored
601 = origin of the previous file (with --copies)
601 = origin of the previous file (with --copies)
602
602
603 Returns 0 on success.
603 Returns 0 on success.
604
604
605 options ([+] can be repeated):
605 options ([+] can be repeated):
606
606
607 -A --all show status of all files
607 -A --all show status of all files
608 -m --modified show only modified files
608 -m --modified show only modified files
609 -a --added show only added files
609 -a --added show only added files
610 -r --removed show only removed files
610 -r --removed show only removed files
611 -d --deleted show only deleted (but tracked) files
611 -d --deleted show only deleted (but tracked) files
612 -c --clean show only files without changes
612 -c --clean show only files without changes
613 -u --unknown show only unknown (not tracked) files
613 -u --unknown show only unknown (not tracked) files
614 -i --ignored show only ignored files
614 -i --ignored show only ignored files
615 -n --no-status hide status prefix
615 -n --no-status hide status prefix
616 -C --copies show source of copied files
616 -C --copies show source of copied files
617 -0 --print0 end filenames with NUL, for use with xargs
617 -0 --print0 end filenames with NUL, for use with xargs
618 --rev REV [+] show difference from revision
618 --rev REV [+] show difference from revision
619 --change REV list the changed files of a revision
619 --change REV list the changed files of a revision
620 -I --include PATTERN [+] include names matching the given patterns
620 -I --include PATTERN [+] include names matching the given patterns
621 -X --exclude PATTERN [+] exclude names matching the given patterns
621 -X --exclude PATTERN [+] exclude names matching the given patterns
622 -S --subrepos recurse into subrepositories
622 -S --subrepos recurse into subrepositories
623
623
624 (some details hidden, use --verbose to show complete help)
624 (some details hidden, use --verbose to show complete help)
625
625
626 $ hg -q help status
626 $ hg -q help status
627 hg status [OPTION]... [FILE]...
627 hg status [OPTION]... [FILE]...
628
628
629 show changed files in the working directory
629 show changed files in the working directory
630
630
631 $ hg help foo
631 $ hg help foo
632 abort: no such help topic: foo
632 abort: no such help topic: foo
633 (try 'hg help --keyword foo')
633 (try 'hg help --keyword foo')
634 [255]
634 [255]
635
635
636 $ hg skjdfks
636 $ hg skjdfks
637 hg: unknown command 'skjdfks'
637 hg: unknown command 'skjdfks'
638 Mercurial Distributed SCM
638 Mercurial Distributed SCM
639
639
640 basic commands:
640 basic commands:
641
641
642 add add the specified files on the next commit
642 add add the specified files on the next commit
643 annotate show changeset information by line for each file
643 annotate show changeset information by line for each file
644 clone make a copy of an existing repository
644 clone make a copy of an existing repository
645 commit commit the specified files or all outstanding changes
645 commit commit the specified files or all outstanding changes
646 diff diff repository (or selected files)
646 diff diff repository (or selected files)
647 export dump the header and diffs for one or more changesets
647 export dump the header and diffs for one or more changesets
648 forget forget the specified files on the next commit
648 forget forget the specified files on the next commit
649 init create a new repository in the given directory
649 init create a new repository in the given directory
650 log show revision history of entire repository or files
650 log show revision history of entire repository or files
651 merge merge another revision into working directory
651 merge merge another revision into working directory
652 pull pull changes from the specified source
652 pull pull changes from the specified source
653 push push changes to the specified destination
653 push push changes to the specified destination
654 remove remove the specified files on the next commit
654 remove remove the specified files on the next commit
655 serve start stand-alone webserver
655 serve start stand-alone webserver
656 status show changed files in the working directory
656 status show changed files in the working directory
657 summary summarize working directory state
657 summary summarize working directory state
658 update update working directory (or switch revisions)
658 update update working directory (or switch revisions)
659
659
660 (use 'hg help' for the full list of commands or 'hg -v' for details)
660 (use 'hg help' for the full list of commands or 'hg -v' for details)
661 [255]
661 [255]
662
662
663 Typoed command gives suggestion
663 Typoed command gives suggestion
664 $ hg puls
664 $ hg puls
665 hg: unknown command 'puls'
665 hg: unknown command 'puls'
666 (did you mean one of pull, push?)
666 (did you mean one of pull, push?)
667 [255]
667 [255]
668
668
669 Not enabled extension gets suggested
669 Not enabled extension gets suggested
670
670
671 $ hg rebase
671 $ hg rebase
672 hg: unknown command 'rebase'
672 hg: unknown command 'rebase'
673 'rebase' is provided by the following extension:
673 'rebase' is provided by the following extension:
674
674
675 rebase command to move sets of revisions to a different ancestor
675 rebase command to move sets of revisions to a different ancestor
676
676
677 (use 'hg help extensions' for information on enabling extensions)
677 (use 'hg help extensions' for information on enabling extensions)
678 [255]
678 [255]
679
679
680 Disabled extension gets suggested
680 Disabled extension gets suggested
681 $ hg --config extensions.rebase=! rebase
681 $ hg --config extensions.rebase=! rebase
682 hg: unknown command 'rebase'
682 hg: unknown command 'rebase'
683 'rebase' is provided by the following extension:
683 'rebase' is provided by the following extension:
684
684
685 rebase command to move sets of revisions to a different ancestor
685 rebase command to move sets of revisions to a different ancestor
686
686
687 (use 'hg help extensions' for information on enabling extensions)
687 (use 'hg help extensions' for information on enabling extensions)
688 [255]
688 [255]
689
689
690 Make sure that we don't run afoul of the help system thinking that
690 Make sure that we don't run afoul of the help system thinking that
691 this is a section and erroring out weirdly.
691 this is a section and erroring out weirdly.
692
692
693 $ hg .log
693 $ hg .log
694 hg: unknown command '.log'
694 hg: unknown command '.log'
695 (did you mean log?)
695 (did you mean log?)
696 [255]
696 [255]
697
697
698 $ hg log.
698 $ hg log.
699 hg: unknown command 'log.'
699 hg: unknown command 'log.'
700 (did you mean log?)
700 (did you mean log?)
701 [255]
701 [255]
702 $ hg pu.lh
702 $ hg pu.lh
703 hg: unknown command 'pu.lh'
703 hg: unknown command 'pu.lh'
704 (did you mean one of pull, push?)
704 (did you mean one of pull, push?)
705 [255]
705 [255]
706
706
707 $ cat > helpext.py <<EOF
707 $ cat > helpext.py <<EOF
708 > import os
708 > import os
709 > from mercurial import commands, registrar
709 > from mercurial import commands, registrar
710 >
710 >
711 > cmdtable = {}
711 > cmdtable = {}
712 > command = registrar.command(cmdtable)
712 > command = registrar.command(cmdtable)
713 >
713 >
714 > @command(b'nohelp',
714 > @command(b'nohelp',
715 > [(b'', b'longdesc', 3, b'x'*90),
715 > [(b'', b'longdesc', 3, b'x'*90),
716 > (b'n', b'', None, b'normal desc'),
716 > (b'n', b'', None, b'normal desc'),
717 > (b'', b'newline', b'', b'line1\nline2')],
717 > (b'', b'newline', b'', b'line1\nline2')],
718 > b'hg nohelp',
718 > b'hg nohelp',
719 > norepo=True)
719 > norepo=True)
720 > @command(b'debugoptADV', [(b'', b'aopt', None, b'option is (ADVANCED)')])
720 > @command(b'debugoptADV', [(b'', b'aopt', None, b'option is (ADVANCED)')])
721 > @command(b'debugoptDEP', [(b'', b'dopt', None, b'option is (DEPRECATED)')])
721 > @command(b'debugoptDEP', [(b'', b'dopt', None, b'option is (DEPRECATED)')])
722 > @command(b'debugoptEXP', [(b'', b'eopt', None, b'option is (EXPERIMENTAL)')])
722 > @command(b'debugoptEXP', [(b'', b'eopt', None, b'option is (EXPERIMENTAL)')])
723 > def nohelp(ui, *args, **kwargs):
723 > def nohelp(ui, *args, **kwargs):
724 > pass
724 > pass
725 >
725 >
726 > def uisetup(ui):
726 > def uisetup(ui):
727 > ui.setconfig(b'alias', b'shellalias', b'!echo hi', b'helpext')
727 > ui.setconfig(b'alias', b'shellalias', b'!echo hi', b'helpext')
728 > ui.setconfig(b'alias', b'hgalias', b'summary', b'helpext')
728 > ui.setconfig(b'alias', b'hgalias', b'summary', b'helpext')
729 >
729 >
730 > EOF
730 > EOF
731 $ echo '[extensions]' >> $HGRCPATH
731 $ echo '[extensions]' >> $HGRCPATH
732 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
732 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
733
733
734 Test for aliases
734 Test for aliases
735
735
736 $ hg help hgalias
736 $ hg help hgalias
737 hg hgalias [--remote]
737 hg hgalias [--remote]
738
738
739 alias for: hg summary
739 alias for: hg summary
740
740
741 summarize working directory state
741 summarize working directory state
742
742
743 This generates a brief summary of the working directory state, including
743 This generates a brief summary of the working directory state, including
744 parents, branch, commit status, phase and available updates.
744 parents, branch, commit status, phase and available updates.
745
745
746 With the --remote option, this will check the default paths for incoming
746 With the --remote option, this will check the default paths for incoming
747 and outgoing changes. This can be time-consuming.
747 and outgoing changes. This can be time-consuming.
748
748
749 Returns 0 on success.
749 Returns 0 on success.
750
750
751 defined by: helpext
751 defined by: helpext
752
752
753 options:
753 options:
754
754
755 --remote check for push and pull
755 --remote check for push and pull
756
756
757 (some details hidden, use --verbose to show complete help)
757 (some details hidden, use --verbose to show complete help)
758
758
759 $ hg help shellalias
759 $ hg help shellalias
760 hg shellalias
760 hg shellalias
761
761
762 shell alias for:
762 shell alias for:
763
763
764 echo hi
764 echo hi
765
765
766 defined by: helpext
766 defined by: helpext
767
767
768 (some details hidden, use --verbose to show complete help)
768 (some details hidden, use --verbose to show complete help)
769
769
770 Test command with no help text
770 Test command with no help text
771
771
772 $ hg help nohelp
772 $ hg help nohelp
773 hg nohelp
773 hg nohelp
774
774
775 (no help text available)
775 (no help text available)
776
776
777 options:
777 options:
778
778
779 --longdesc VALUE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
779 --longdesc VALUE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
780 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (default: 3)
780 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (default: 3)
781 -n -- normal desc
781 -n -- normal desc
782 --newline VALUE line1 line2
782 --newline VALUE line1 line2
783
783
784 (some details hidden, use --verbose to show complete help)
784 (some details hidden, use --verbose to show complete help)
785
785
786 $ hg help -k nohelp
786 $ hg help -k nohelp
787 Commands:
787 Commands:
788
788
789 nohelp hg nohelp
789 nohelp hg nohelp
790
790
791 Extension Commands:
791 Extension Commands:
792
792
793 nohelp (no help text available)
793 nohelp (no help text available)
794
794
795 Test that default list of commands omits extension commands
795 Test that default list of commands omits extension commands
796
796
797 $ hg help
797 $ hg help
798 Mercurial Distributed SCM
798 Mercurial Distributed SCM
799
799
800 list of commands:
800 list of commands:
801
801
802 add add the specified files on the next commit
802 add add the specified files on the next commit
803 addremove add all new files, delete all missing files
803 addremove add all new files, delete all missing files
804 annotate show changeset information by line for each file
804 annotate show changeset information by line for each file
805 archive create an unversioned archive of a repository revision
805 archive create an unversioned archive of a repository revision
806 backout reverse effect of earlier changeset
806 backout reverse effect of earlier changeset
807 bisect subdivision search of changesets
807 bisect subdivision search of changesets
808 bookmarks create a new bookmark or list existing bookmarks
808 bookmarks create a new bookmark or list existing bookmarks
809 branch set or show the current branch name
809 branch set or show the current branch name
810 branches list repository named branches
810 branches list repository named branches
811 bundle create a bundle file
811 bundle create a bundle file
812 cat output the current or given revision of files
812 cat output the current or given revision of files
813 clone make a copy of an existing repository
813 clone make a copy of an existing repository
814 commit commit the specified files or all outstanding changes
814 commit commit the specified files or all outstanding changes
815 config show combined config settings from all hgrc files
815 config show combined config settings from all hgrc files
816 copy mark files as copied for the next commit
816 copy mark files as copied for the next commit
817 diff diff repository (or selected files)
817 diff diff repository (or selected files)
818 export dump the header and diffs for one or more changesets
818 export dump the header and diffs for one or more changesets
819 files list tracked files
819 files list tracked files
820 forget forget the specified files on the next commit
820 forget forget the specified files on the next commit
821 graft copy changes from other branches onto the current branch
821 graft copy changes from other branches onto the current branch
822 grep search revision history for a pattern in specified files
822 grep search revision history for a pattern in specified files
823 heads show branch heads
823 heads show branch heads
824 help show help for a given topic or a help overview
824 help show help for a given topic or a help overview
825 identify identify the working directory or specified revision
825 identify identify the working directory or specified revision
826 import import an ordered set of patches
826 import import an ordered set of patches
827 incoming show new changesets found in source
827 incoming show new changesets found in source
828 init create a new repository in the given directory
828 init create a new repository in the given directory
829 log show revision history of entire repository or files
829 log show revision history of entire repository or files
830 manifest output the current or given revision of the project manifest
830 manifest output the current or given revision of the project manifest
831 merge merge another revision into working directory
831 merge merge another revision into working directory
832 outgoing show changesets not found in the destination
832 outgoing show changesets not found in the destination
833 paths show aliases for remote repositories
833 paths show aliases for remote repositories
834 phase set or show the current phase name
834 phase set or show the current phase name
835 pull pull changes from the specified source
835 pull pull changes from the specified source
836 push push changes to the specified destination
836 push push changes to the specified destination
837 recover roll back an interrupted transaction
837 recover roll back an interrupted transaction
838 remove remove the specified files on the next commit
838 remove remove the specified files on the next commit
839 rename rename files; equivalent of copy + remove
839 rename rename files; equivalent of copy + remove
840 resolve redo merges or set/view the merge status of files
840 resolve redo merges or set/view the merge status of files
841 revert restore files to their checkout state
841 revert restore files to their checkout state
842 root print the root (top) of the current working directory
842 root print the root (top) of the current working directory
843 serve start stand-alone webserver
843 serve start stand-alone webserver
844 status show changed files in the working directory
844 status show changed files in the working directory
845 summary summarize working directory state
845 summary summarize working directory state
846 tag add one or more tags for the current or given revision
846 tag add one or more tags for the current or given revision
847 tags list repository tags
847 tags list repository tags
848 unbundle apply one or more bundle files
848 unbundle apply one or more bundle files
849 update update working directory (or switch revisions)
849 update update working directory (or switch revisions)
850 verify verify the integrity of the repository
850 verify verify the integrity of the repository
851 version output version and copyright information
851 version output version and copyright information
852
852
853 enabled extensions:
853 enabled extensions:
854
854
855 helpext (no help text available)
855 helpext (no help text available)
856
856
857 additional help topics:
857 additional help topics:
858
858
859 bundlespec Bundle File Formats
859 bundlespec Bundle File Formats
860 color Colorizing Outputs
860 color Colorizing Outputs
861 config Configuration Files
861 config Configuration Files
862 dates Date Formats
862 dates Date Formats
863 diffs Diff Formats
863 diffs Diff Formats
864 environment Environment Variables
864 environment Environment Variables
865 extensions Using Additional Features
865 extensions Using Additional Features
866 filesets Specifying File Sets
866 filesets Specifying File Sets
867 glossary Glossary
867 glossary Glossary
868 hgignore Syntax for Mercurial Ignore Files
868 hgignore Syntax for Mercurial Ignore Files
869 hgweb Configuring hgweb
869 hgweb Configuring hgweb
870 internals Technical implementation topics
870 internals Technical implementation topics
871 merge-tools Merge Tools
871 merge-tools Merge Tools
872 pager Pager Support
872 pager Pager Support
873 patterns File Name Patterns
873 patterns File Name Patterns
874 phases Working with Phases
874 phases Working with Phases
875 revisions Specifying Revisions
875 revisions Specifying Revisions
876 scripting Using Mercurial from scripts and automation
876 scripting Using Mercurial from scripts and automation
877 subrepos Subrepositories
877 subrepos Subrepositories
878 templating Template Usage
878 templating Template Usage
879 urls URL Paths
879 urls URL Paths
880
880
881 (use 'hg help -v' to show built-in aliases and global options)
881 (use 'hg help -v' to show built-in aliases and global options)
882
882
883
883
884 Test list of internal help commands
884 Test list of internal help commands
885
885
886 $ hg help debug
886 $ hg help debug
887 debug commands (internal and unsupported):
887 debug commands (internal and unsupported):
888
888
889 debugancestor
889 debugancestor
890 find the ancestor revision of two revisions in a given index
890 find the ancestor revision of two revisions in a given index
891 debugapplystreamclonebundle
891 debugapplystreamclonebundle
892 apply a stream clone bundle file
892 apply a stream clone bundle file
893 debugbuilddag
893 debugbuilddag
894 builds a repo with a given DAG from scratch in the current
894 builds a repo with a given DAG from scratch in the current
895 empty repo
895 empty repo
896 debugbundle lists the contents of a bundle
896 debugbundle lists the contents of a bundle
897 debugcheckstate
897 debugcheckstate
898 validate the correctness of the current dirstate
898 validate the correctness of the current dirstate
899 debugcolor show available color, effects or style
899 debugcolor show available color, effects or style
900 debugcommands
900 debugcommands
901 list all available commands and options
901 list all available commands and options
902 debugcomplete
902 debugcomplete
903 returns the completion list associated with the given command
903 returns the completion list associated with the given command
904 debugcreatestreamclonebundle
904 debugcreatestreamclonebundle
905 create a stream clone bundle file
905 create a stream clone bundle file
906 debugdag format the changelog or an index DAG as a concise textual
906 debugdag format the changelog or an index DAG as a concise textual
907 description
907 description
908 debugdata dump the contents of a data file revision
908 debugdata dump the contents of a data file revision
909 debugdate parse and display a date
909 debugdate parse and display a date
910 debugdeltachain
910 debugdeltachain
911 dump information about delta chains in a revlog
911 dump information about delta chains in a revlog
912 debugdirstate
912 debugdirstate
913 show the contents of the current dirstate
913 show the contents of the current dirstate
914 debugdiscovery
914 debugdiscovery
915 runs the changeset discovery protocol in isolation
915 runs the changeset discovery protocol in isolation
916 debugextensions
916 debugextensions
917 show information about active extensions
917 show information about active extensions
918 debugfileset parse and apply a fileset specification
918 debugfileset parse and apply a fileset specification
919 debugfsinfo show information detected about current filesystem
919 debugfsinfo show information detected about current filesystem
920 debuggetbundle
920 debuggetbundle
921 retrieves a bundle from a repo
921 retrieves a bundle from a repo
922 debugignore display the combined ignore pattern and information about
922 debugignore display the combined ignore pattern and information about
923 ignored files
923 ignored files
924 debugindex dump the contents of an index file
924 debugindex dump the contents of an index file
925 debugindexdot
925 debugindexdot
926 dump an index DAG as a graphviz dot file
926 dump an index DAG as a graphviz dot file
927 debuginstall test Mercurial installation
927 debuginstall test Mercurial installation
928 debugknown test whether node ids are known to a repo
928 debugknown test whether node ids are known to a repo
929 debuglocks show or modify state of locks
929 debuglocks show or modify state of locks
930 debugmergestate
930 debugmergestate
931 print merge state
931 print merge state
932 debugnamecomplete
932 debugnamecomplete
933 complete "names" - tags, open branch names, bookmark names
933 complete "names" - tags, open branch names, bookmark names
934 debugobsolete
934 debugobsolete
935 create arbitrary obsolete marker
935 create arbitrary obsolete marker
936 debugoptADV (no help text available)
936 debugoptADV (no help text available)
937 debugoptDEP (no help text available)
937 debugoptDEP (no help text available)
938 debugoptEXP (no help text available)
938 debugoptEXP (no help text available)
939 debugpathcomplete
939 debugpathcomplete
940 complete part or all of a tracked path
940 complete part or all of a tracked path
941 debugpickmergetool
941 debugpickmergetool
942 examine which merge tool is chosen for specified file
942 examine which merge tool is chosen for specified file
943 debugpushkey access the pushkey key/value protocol
943 debugpushkey access the pushkey key/value protocol
944 debugpvec (no help text available)
944 debugpvec (no help text available)
945 debugrebuilddirstate
945 debugrebuilddirstate
946 rebuild the dirstate as it would look like for the given
946 rebuild the dirstate as it would look like for the given
947 revision
947 revision
948 debugrebuildfncache
948 debugrebuildfncache
949 rebuild the fncache file
949 rebuild the fncache file
950 debugrename dump rename information
950 debugrename dump rename information
951 debugrevlog show data and statistics about a revlog
951 debugrevlog show data and statistics about a revlog
952 debugrevspec parse and apply a revision specification
952 debugrevspec parse and apply a revision specification
953 debugsetparents
953 debugsetparents
954 manually set the parents of the current working directory
954 manually set the parents of the current working directory
955 debugssl test a secure connection to a server
955 debugsub (no help text available)
956 debugsub (no help text available)
956 debugsuccessorssets
957 debugsuccessorssets
957 show set of successors for revision
958 show set of successors for revision
958 debugtemplate
959 debugtemplate
959 parse and apply a template
960 parse and apply a template
960 debugupdatecaches
961 debugupdatecaches
961 warm all known caches in the repository
962 warm all known caches in the repository
962 debugupgraderepo
963 debugupgraderepo
963 upgrade a repository to use different features
964 upgrade a repository to use different features
964 debugwalk show how files match on given patterns
965 debugwalk show how files match on given patterns
965 debugwireargs
966 debugwireargs
966 (no help text available)
967 (no help text available)
967
968
968 (use 'hg help -v debug' to show built-in aliases and global options)
969 (use 'hg help -v debug' to show built-in aliases and global options)
969
970
970 internals topic renders index of available sub-topics
971 internals topic renders index of available sub-topics
971
972
972 $ hg help internals
973 $ hg help internals
973 Technical implementation topics
974 Technical implementation topics
974 """""""""""""""""""""""""""""""
975 """""""""""""""""""""""""""""""
975
976
976 To access a subtopic, use "hg help internals.{subtopic-name}"
977 To access a subtopic, use "hg help internals.{subtopic-name}"
977
978
978 bundles Bundles
979 bundles Bundles
979 censor Censor
980 censor Censor
980 changegroups Changegroups
981 changegroups Changegroups
981 requirements Repository Requirements
982 requirements Repository Requirements
982 revlogs Revision Logs
983 revlogs Revision Logs
983 wireprotocol Wire Protocol
984 wireprotocol Wire Protocol
984
985
985 sub-topics can be accessed
986 sub-topics can be accessed
986
987
987 $ hg help internals.changegroups
988 $ hg help internals.changegroups
988 Changegroups
989 Changegroups
989 """"""""""""
990 """"""""""""
990
991
991 Changegroups are representations of repository revlog data, specifically
992 Changegroups are representations of repository revlog data, specifically
992 the changelog data, root/flat manifest data, treemanifest data, and
993 the changelog data, root/flat manifest data, treemanifest data, and
993 filelogs.
994 filelogs.
994
995
995 There are 3 versions of changegroups: "1", "2", and "3". From a high-
996 There are 3 versions of changegroups: "1", "2", and "3". From a high-
996 level, versions "1" and "2" are almost exactly the same, with the only
997 level, versions "1" and "2" are almost exactly the same, with the only
997 difference being an additional item in the *delta header*. Version "3"
998 difference being an additional item in the *delta header*. Version "3"
998 adds support for revlog flags in the *delta header* and optionally
999 adds support for revlog flags in the *delta header* and optionally
999 exchanging treemanifests (enabled by setting an option on the
1000 exchanging treemanifests (enabled by setting an option on the
1000 "changegroup" part in the bundle2).
1001 "changegroup" part in the bundle2).
1001
1002
1002 Changegroups when not exchanging treemanifests consist of 3 logical
1003 Changegroups when not exchanging treemanifests consist of 3 logical
1003 segments:
1004 segments:
1004
1005
1005 +---------------------------------+
1006 +---------------------------------+
1006 | | | |
1007 | | | |
1007 | changeset | manifest | filelogs |
1008 | changeset | manifest | filelogs |
1008 | | | |
1009 | | | |
1009 | | | |
1010 | | | |
1010 +---------------------------------+
1011 +---------------------------------+
1011
1012
1012 When exchanging treemanifests, there are 4 logical segments:
1013 When exchanging treemanifests, there are 4 logical segments:
1013
1014
1014 +-------------------------------------------------+
1015 +-------------------------------------------------+
1015 | | | | |
1016 | | | | |
1016 | changeset | root | treemanifests | filelogs |
1017 | changeset | root | treemanifests | filelogs |
1017 | | manifest | | |
1018 | | manifest | | |
1018 | | | | |
1019 | | | | |
1019 +-------------------------------------------------+
1020 +-------------------------------------------------+
1020
1021
1021 The principle building block of each segment is a *chunk*. A *chunk* is a
1022 The principle building block of each segment is a *chunk*. A *chunk* is a
1022 framed piece of data:
1023 framed piece of data:
1023
1024
1024 +---------------------------------------+
1025 +---------------------------------------+
1025 | | |
1026 | | |
1026 | length | data |
1027 | length | data |
1027 | (4 bytes) | (<length - 4> bytes) |
1028 | (4 bytes) | (<length - 4> bytes) |
1028 | | |
1029 | | |
1029 +---------------------------------------+
1030 +---------------------------------------+
1030
1031
1031 All integers are big-endian signed integers. Each chunk starts with a
1032 All integers are big-endian signed integers. Each chunk starts with a
1032 32-bit integer indicating the length of the entire chunk (including the
1033 32-bit integer indicating the length of the entire chunk (including the
1033 length field itself).
1034 length field itself).
1034
1035
1035 There is a special case chunk that has a value of 0 for the length
1036 There is a special case chunk that has a value of 0 for the length
1036 ("0x00000000"). We call this an *empty chunk*.
1037 ("0x00000000"). We call this an *empty chunk*.
1037
1038
1038 Delta Groups
1039 Delta Groups
1039 ============
1040 ============
1040
1041
1041 A *delta group* expresses the content of a revlog as a series of deltas,
1042 A *delta group* expresses the content of a revlog as a series of deltas,
1042 or patches against previous revisions.
1043 or patches against previous revisions.
1043
1044
1044 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
1045 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
1045 to signal the end of the delta group:
1046 to signal the end of the delta group:
1046
1047
1047 +------------------------------------------------------------------------+
1048 +------------------------------------------------------------------------+
1048 | | | | | |
1049 | | | | | |
1049 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
1050 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
1050 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
1051 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
1051 | | | | | |
1052 | | | | | |
1052 +------------------------------------------------------------------------+
1053 +------------------------------------------------------------------------+
1053
1054
1054 Each *chunk*'s data consists of the following:
1055 Each *chunk*'s data consists of the following:
1055
1056
1056 +---------------------------------------+
1057 +---------------------------------------+
1057 | | |
1058 | | |
1058 | delta header | delta data |
1059 | delta header | delta data |
1059 | (various by version) | (various) |
1060 | (various by version) | (various) |
1060 | | |
1061 | | |
1061 +---------------------------------------+
1062 +---------------------------------------+
1062
1063
1063 The *delta data* is a series of *delta*s that describe a diff from an
1064 The *delta data* is a series of *delta*s that describe a diff from an
1064 existing entry (either that the recipient already has, or previously
1065 existing entry (either that the recipient already has, or previously
1065 specified in the bundle/changegroup).
1066 specified in the bundle/changegroup).
1066
1067
1067 The *delta header* is different between versions "1", "2", and "3" of the
1068 The *delta header* is different between versions "1", "2", and "3" of the
1068 changegroup format.
1069 changegroup format.
1069
1070
1070 Version 1 (headerlen=80):
1071 Version 1 (headerlen=80):
1071
1072
1072 +------------------------------------------------------+
1073 +------------------------------------------------------+
1073 | | | | |
1074 | | | | |
1074 | node | p1 node | p2 node | link node |
1075 | node | p1 node | p2 node | link node |
1075 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1076 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1076 | | | | |
1077 | | | | |
1077 +------------------------------------------------------+
1078 +------------------------------------------------------+
1078
1079
1079 Version 2 (headerlen=100):
1080 Version 2 (headerlen=100):
1080
1081
1081 +------------------------------------------------------------------+
1082 +------------------------------------------------------------------+
1082 | | | | | |
1083 | | | | | |
1083 | node | p1 node | p2 node | base node | link node |
1084 | node | p1 node | p2 node | base node | link node |
1084 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1085 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1085 | | | | | |
1086 | | | | | |
1086 +------------------------------------------------------------------+
1087 +------------------------------------------------------------------+
1087
1088
1088 Version 3 (headerlen=102):
1089 Version 3 (headerlen=102):
1089
1090
1090 +------------------------------------------------------------------------------+
1091 +------------------------------------------------------------------------------+
1091 | | | | | | |
1092 | | | | | | |
1092 | node | p1 node | p2 node | base node | link node | flags |
1093 | node | p1 node | p2 node | base node | link node | flags |
1093 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
1094 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
1094 | | | | | | |
1095 | | | | | | |
1095 +------------------------------------------------------------------------------+
1096 +------------------------------------------------------------------------------+
1096
1097
1097 The *delta data* consists of "chunklen - 4 - headerlen" bytes, which
1098 The *delta data* consists of "chunklen - 4 - headerlen" bytes, which
1098 contain a series of *delta*s, densely packed (no separators). These deltas
1099 contain a series of *delta*s, densely packed (no separators). These deltas
1099 describe a diff from an existing entry (either that the recipient already
1100 describe a diff from an existing entry (either that the recipient already
1100 has, or previously specified in the bundle/changegroup). The format is
1101 has, or previously specified in the bundle/changegroup). The format is
1101 described more fully in "hg help internals.bdiff", but briefly:
1102 described more fully in "hg help internals.bdiff", but briefly:
1102
1103
1103 +---------------------------------------------------------------+
1104 +---------------------------------------------------------------+
1104 | | | | |
1105 | | | | |
1105 | start offset | end offset | new length | content |
1106 | start offset | end offset | new length | content |
1106 | (4 bytes) | (4 bytes) | (4 bytes) | (<new length> bytes) |
1107 | (4 bytes) | (4 bytes) | (4 bytes) | (<new length> bytes) |
1107 | | | | |
1108 | | | | |
1108 +---------------------------------------------------------------+
1109 +---------------------------------------------------------------+
1109
1110
1110 Please note that the length field in the delta data does *not* include
1111 Please note that the length field in the delta data does *not* include
1111 itself.
1112 itself.
1112
1113
1113 In version 1, the delta is always applied against the previous node from
1114 In version 1, the delta is always applied against the previous node from
1114 the changegroup or the first parent if this is the first entry in the
1115 the changegroup or the first parent if this is the first entry in the
1115 changegroup.
1116 changegroup.
1116
1117
1117 In version 2 and up, the delta base node is encoded in the entry in the
1118 In version 2 and up, the delta base node is encoded in the entry in the
1118 changegroup. This allows the delta to be expressed against any parent,
1119 changegroup. This allows the delta to be expressed against any parent,
1119 which can result in smaller deltas and more efficient encoding of data.
1120 which can result in smaller deltas and more efficient encoding of data.
1120
1121
1121 Changeset Segment
1122 Changeset Segment
1122 =================
1123 =================
1123
1124
1124 The *changeset segment* consists of a single *delta group* holding
1125 The *changeset segment* consists of a single *delta group* holding
1125 changelog data. The *empty chunk* at the end of the *delta group* denotes
1126 changelog data. The *empty chunk* at the end of the *delta group* denotes
1126 the boundary to the *manifest segment*.
1127 the boundary to the *manifest segment*.
1127
1128
1128 Manifest Segment
1129 Manifest Segment
1129 ================
1130 ================
1130
1131
1131 The *manifest segment* consists of a single *delta group* holding manifest
1132 The *manifest segment* consists of a single *delta group* holding manifest
1132 data. If treemanifests are in use, it contains only the manifest for the
1133 data. If treemanifests are in use, it contains only the manifest for the
1133 root directory of the repository. Otherwise, it contains the entire
1134 root directory of the repository. Otherwise, it contains the entire
1134 manifest data. The *empty chunk* at the end of the *delta group* denotes
1135 manifest data. The *empty chunk* at the end of the *delta group* denotes
1135 the boundary to the next segment (either the *treemanifests segment* or
1136 the boundary to the next segment (either the *treemanifests segment* or
1136 the *filelogs segment*, depending on version and the request options).
1137 the *filelogs segment*, depending on version and the request options).
1137
1138
1138 Treemanifests Segment
1139 Treemanifests Segment
1139 ---------------------
1140 ---------------------
1140
1141
1141 The *treemanifests segment* only exists in changegroup version "3", and
1142 The *treemanifests segment* only exists in changegroup version "3", and
1142 only if the 'treemanifest' param is part of the bundle2 changegroup part
1143 only if the 'treemanifest' param is part of the bundle2 changegroup part
1143 (it is not possible to use changegroup version 3 outside of bundle2).
1144 (it is not possible to use changegroup version 3 outside of bundle2).
1144 Aside from the filenames in the *treemanifests segment* containing a
1145 Aside from the filenames in the *treemanifests segment* containing a
1145 trailing "/" character, it behaves identically to the *filelogs segment*
1146 trailing "/" character, it behaves identically to the *filelogs segment*
1146 (see below). The final sub-segment is followed by an *empty chunk*
1147 (see below). The final sub-segment is followed by an *empty chunk*
1147 (logically, a sub-segment with filename size 0). This denotes the boundary
1148 (logically, a sub-segment with filename size 0). This denotes the boundary
1148 to the *filelogs segment*.
1149 to the *filelogs segment*.
1149
1150
1150 Filelogs Segment
1151 Filelogs Segment
1151 ================
1152 ================
1152
1153
1153 The *filelogs segment* consists of multiple sub-segments, each
1154 The *filelogs segment* consists of multiple sub-segments, each
1154 corresponding to an individual file whose data is being described:
1155 corresponding to an individual file whose data is being described:
1155
1156
1156 +--------------------------------------------------+
1157 +--------------------------------------------------+
1157 | | | | | |
1158 | | | | | |
1158 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
1159 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
1159 | | | | | (4 bytes) |
1160 | | | | | (4 bytes) |
1160 | | | | | |
1161 | | | | | |
1161 +--------------------------------------------------+
1162 +--------------------------------------------------+
1162
1163
1163 The final filelog sub-segment is followed by an *empty chunk* (logically,
1164 The final filelog sub-segment is followed by an *empty chunk* (logically,
1164 a sub-segment with filename size 0). This denotes the end of the segment
1165 a sub-segment with filename size 0). This denotes the end of the segment
1165 and of the overall changegroup.
1166 and of the overall changegroup.
1166
1167
1167 Each filelog sub-segment consists of the following:
1168 Each filelog sub-segment consists of the following:
1168
1169
1169 +------------------------------------------------------+
1170 +------------------------------------------------------+
1170 | | | |
1171 | | | |
1171 | filename length | filename | delta group |
1172 | filename length | filename | delta group |
1172 | (4 bytes) | (<length - 4> bytes) | (various) |
1173 | (4 bytes) | (<length - 4> bytes) | (various) |
1173 | | | |
1174 | | | |
1174 +------------------------------------------------------+
1175 +------------------------------------------------------+
1175
1176
1176 That is, a *chunk* consisting of the filename (not terminated or padded)
1177 That is, a *chunk* consisting of the filename (not terminated or padded)
1177 followed by N chunks constituting the *delta group* for this file. The
1178 followed by N chunks constituting the *delta group* for this file. The
1178 *empty chunk* at the end of each *delta group* denotes the boundary to the
1179 *empty chunk* at the end of each *delta group* denotes the boundary to the
1179 next filelog sub-segment.
1180 next filelog sub-segment.
1180
1181
1181 Test list of commands with command with no help text
1182 Test list of commands with command with no help text
1182
1183
1183 $ hg help helpext
1184 $ hg help helpext
1184 helpext extension - no help text available
1185 helpext extension - no help text available
1185
1186
1186 list of commands:
1187 list of commands:
1187
1188
1188 nohelp (no help text available)
1189 nohelp (no help text available)
1189
1190
1190 (use 'hg help -v helpext' to show built-in aliases and global options)
1191 (use 'hg help -v helpext' to show built-in aliases and global options)
1191
1192
1192
1193
1193 test advanced, deprecated and experimental options are hidden in command help
1194 test advanced, deprecated and experimental options are hidden in command help
1194 $ hg help debugoptADV
1195 $ hg help debugoptADV
1195 hg debugoptADV
1196 hg debugoptADV
1196
1197
1197 (no help text available)
1198 (no help text available)
1198
1199
1199 options:
1200 options:
1200
1201
1201 (some details hidden, use --verbose to show complete help)
1202 (some details hidden, use --verbose to show complete help)
1202 $ hg help debugoptDEP
1203 $ hg help debugoptDEP
1203 hg debugoptDEP
1204 hg debugoptDEP
1204
1205
1205 (no help text available)
1206 (no help text available)
1206
1207
1207 options:
1208 options:
1208
1209
1209 (some details hidden, use --verbose to show complete help)
1210 (some details hidden, use --verbose to show complete help)
1210
1211
1211 $ hg help debugoptEXP
1212 $ hg help debugoptEXP
1212 hg debugoptEXP
1213 hg debugoptEXP
1213
1214
1214 (no help text available)
1215 (no help text available)
1215
1216
1216 options:
1217 options:
1217
1218
1218 (some details hidden, use --verbose to show complete help)
1219 (some details hidden, use --verbose to show complete help)
1219
1220
1220 test advanced, deprecated and experimental options are shown with -v
1221 test advanced, deprecated and experimental options are shown with -v
1221 $ hg help -v debugoptADV | grep aopt
1222 $ hg help -v debugoptADV | grep aopt
1222 --aopt option is (ADVANCED)
1223 --aopt option is (ADVANCED)
1223 $ hg help -v debugoptDEP | grep dopt
1224 $ hg help -v debugoptDEP | grep dopt
1224 --dopt option is (DEPRECATED)
1225 --dopt option is (DEPRECATED)
1225 $ hg help -v debugoptEXP | grep eopt
1226 $ hg help -v debugoptEXP | grep eopt
1226 --eopt option is (EXPERIMENTAL)
1227 --eopt option is (EXPERIMENTAL)
1227
1228
1228 #if gettext
1229 #if gettext
1229 test deprecated option is hidden with translation with untranslated description
1230 test deprecated option is hidden with translation with untranslated description
1230 (use many globy for not failing on changed transaction)
1231 (use many globy for not failing on changed transaction)
1231 $ LANGUAGE=sv hg help debugoptDEP
1232 $ LANGUAGE=sv hg help debugoptDEP
1232 hg debugoptDEP
1233 hg debugoptDEP
1233
1234
1234 (*) (glob)
1235 (*) (glob)
1235
1236
1236 options:
1237 options:
1237
1238
1238 (some details hidden, use --verbose to show complete help)
1239 (some details hidden, use --verbose to show complete help)
1239 #endif
1240 #endif
1240
1241
1241 Test commands that collide with topics (issue4240)
1242 Test commands that collide with topics (issue4240)
1242
1243
1243 $ hg config -hq
1244 $ hg config -hq
1244 hg config [-u] [NAME]...
1245 hg config [-u] [NAME]...
1245
1246
1246 show combined config settings from all hgrc files
1247 show combined config settings from all hgrc files
1247 $ hg showconfig -hq
1248 $ hg showconfig -hq
1248 hg config [-u] [NAME]...
1249 hg config [-u] [NAME]...
1249
1250
1250 show combined config settings from all hgrc files
1251 show combined config settings from all hgrc files
1251
1252
1252 Test a help topic
1253 Test a help topic
1253
1254
1254 $ hg help dates
1255 $ hg help dates
1255 Date Formats
1256 Date Formats
1256 """"""""""""
1257 """"""""""""
1257
1258
1258 Some commands allow the user to specify a date, e.g.:
1259 Some commands allow the user to specify a date, e.g.:
1259
1260
1260 - backout, commit, import, tag: Specify the commit date.
1261 - backout, commit, import, tag: Specify the commit date.
1261 - log, revert, update: Select revision(s) by date.
1262 - log, revert, update: Select revision(s) by date.
1262
1263
1263 Many date formats are valid. Here are some examples:
1264 Many date formats are valid. Here are some examples:
1264
1265
1265 - "Wed Dec 6 13:18:29 2006" (local timezone assumed)
1266 - "Wed Dec 6 13:18:29 2006" (local timezone assumed)
1266 - "Dec 6 13:18 -0600" (year assumed, time offset provided)
1267 - "Dec 6 13:18 -0600" (year assumed, time offset provided)
1267 - "Dec 6 13:18 UTC" (UTC and GMT are aliases for +0000)
1268 - "Dec 6 13:18 UTC" (UTC and GMT are aliases for +0000)
1268 - "Dec 6" (midnight)
1269 - "Dec 6" (midnight)
1269 - "13:18" (today assumed)
1270 - "13:18" (today assumed)
1270 - "3:39" (3:39AM assumed)
1271 - "3:39" (3:39AM assumed)
1271 - "3:39pm" (15:39)
1272 - "3:39pm" (15:39)
1272 - "2006-12-06 13:18:29" (ISO 8601 format)
1273 - "2006-12-06 13:18:29" (ISO 8601 format)
1273 - "2006-12-6 13:18"
1274 - "2006-12-6 13:18"
1274 - "2006-12-6"
1275 - "2006-12-6"
1275 - "12-6"
1276 - "12-6"
1276 - "12/6"
1277 - "12/6"
1277 - "12/6/6" (Dec 6 2006)
1278 - "12/6/6" (Dec 6 2006)
1278 - "today" (midnight)
1279 - "today" (midnight)
1279 - "yesterday" (midnight)
1280 - "yesterday" (midnight)
1280 - "now" - right now
1281 - "now" - right now
1281
1282
1282 Lastly, there is Mercurial's internal format:
1283 Lastly, there is Mercurial's internal format:
1283
1284
1284 - "1165411109 0" (Wed Dec 6 13:18:29 2006 UTC)
1285 - "1165411109 0" (Wed Dec 6 13:18:29 2006 UTC)
1285
1286
1286 This is the internal representation format for dates. The first number is
1287 This is the internal representation format for dates. The first number is
1287 the number of seconds since the epoch (1970-01-01 00:00 UTC). The second
1288 the number of seconds since the epoch (1970-01-01 00:00 UTC). The second
1288 is the offset of the local timezone, in seconds west of UTC (negative if
1289 is the offset of the local timezone, in seconds west of UTC (negative if
1289 the timezone is east of UTC).
1290 the timezone is east of UTC).
1290
1291
1291 The log command also accepts date ranges:
1292 The log command also accepts date ranges:
1292
1293
1293 - "<DATE" - at or before a given date/time
1294 - "<DATE" - at or before a given date/time
1294 - ">DATE" - on or after a given date/time
1295 - ">DATE" - on or after a given date/time
1295 - "DATE to DATE" - a date range, inclusive
1296 - "DATE to DATE" - a date range, inclusive
1296 - "-DAYS" - within a given number of days of today
1297 - "-DAYS" - within a given number of days of today
1297
1298
1298 Test repeated config section name
1299 Test repeated config section name
1299
1300
1300 $ hg help config.host
1301 $ hg help config.host
1301 "http_proxy.host"
1302 "http_proxy.host"
1302 Host name and (optional) port of the proxy server, for example
1303 Host name and (optional) port of the proxy server, for example
1303 "myproxy:8000".
1304 "myproxy:8000".
1304
1305
1305 "smtp.host"
1306 "smtp.host"
1306 Host name of mail server, e.g. "mail.example.com".
1307 Host name of mail server, e.g. "mail.example.com".
1307
1308
1308 Unrelated trailing paragraphs shouldn't be included
1309 Unrelated trailing paragraphs shouldn't be included
1309
1310
1310 $ hg help config.extramsg | grep '^$'
1311 $ hg help config.extramsg | grep '^$'
1311
1312
1312
1313
1313 Test capitalized section name
1314 Test capitalized section name
1314
1315
1315 $ hg help scripting.HGPLAIN > /dev/null
1316 $ hg help scripting.HGPLAIN > /dev/null
1316
1317
1317 Help subsection:
1318 Help subsection:
1318
1319
1319 $ hg help config.charsets |grep "Email example:" > /dev/null
1320 $ hg help config.charsets |grep "Email example:" > /dev/null
1320 [1]
1321 [1]
1321
1322
1322 Show nested definitions
1323 Show nested definitions
1323 ("profiling.type"[break]"ls"[break]"stat"[break])
1324 ("profiling.type"[break]"ls"[break]"stat"[break])
1324
1325
1325 $ hg help config.type | egrep '^$'|wc -l
1326 $ hg help config.type | egrep '^$'|wc -l
1326 \s*3 (re)
1327 \s*3 (re)
1327
1328
1328 Separate sections from subsections
1329 Separate sections from subsections
1329
1330
1330 $ hg help config.format | egrep '^ ("|-)|^\s*$' | uniq
1331 $ hg help config.format | egrep '^ ("|-)|^\s*$' | uniq
1331 "format"
1332 "format"
1332 --------
1333 --------
1333
1334
1334 "usegeneraldelta"
1335 "usegeneraldelta"
1335
1336
1336 "dotencode"
1337 "dotencode"
1337
1338
1338 "usefncache"
1339 "usefncache"
1339
1340
1340 "usestore"
1341 "usestore"
1341
1342
1342 "profiling"
1343 "profiling"
1343 -----------
1344 -----------
1344
1345
1345 "format"
1346 "format"
1346
1347
1347 "progress"
1348 "progress"
1348 ----------
1349 ----------
1349
1350
1350 "format"
1351 "format"
1351
1352
1352
1353
1353 Last item in help config.*:
1354 Last item in help config.*:
1354
1355
1355 $ hg help config.`hg help config|grep '^ "'| \
1356 $ hg help config.`hg help config|grep '^ "'| \
1356 > tail -1|sed 's![ "]*!!g'`| \
1357 > tail -1|sed 's![ "]*!!g'`| \
1357 > grep 'hg help -c config' > /dev/null
1358 > grep 'hg help -c config' > /dev/null
1358 [1]
1359 [1]
1359
1360
1360 note to use help -c for general hg help config:
1361 note to use help -c for general hg help config:
1361
1362
1362 $ hg help config |grep 'hg help -c config' > /dev/null
1363 $ hg help config |grep 'hg help -c config' > /dev/null
1363
1364
1364 Test templating help
1365 Test templating help
1365
1366
1366 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
1367 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
1367 desc String. The text of the changeset description.
1368 desc String. The text of the changeset description.
1368 diffstat String. Statistics of changes with the following format:
1369 diffstat String. Statistics of changes with the following format:
1369 firstline Any text. Returns the first line of text.
1370 firstline Any text. Returns the first line of text.
1370 nonempty Any text. Returns '(none)' if the string is empty.
1371 nonempty Any text. Returns '(none)' if the string is empty.
1371
1372
1372 Test deprecated items
1373 Test deprecated items
1373
1374
1374 $ hg help -v templating | grep currentbookmark
1375 $ hg help -v templating | grep currentbookmark
1375 currentbookmark
1376 currentbookmark
1376 $ hg help templating | (grep currentbookmark || true)
1377 $ hg help templating | (grep currentbookmark || true)
1377
1378
1378 Test help hooks
1379 Test help hooks
1379
1380
1380 $ cat > helphook1.py <<EOF
1381 $ cat > helphook1.py <<EOF
1381 > from mercurial import help
1382 > from mercurial import help
1382 >
1383 >
1383 > def rewrite(ui, topic, doc):
1384 > def rewrite(ui, topic, doc):
1384 > return doc + '\nhelphook1\n'
1385 > return doc + '\nhelphook1\n'
1385 >
1386 >
1386 > def extsetup(ui):
1387 > def extsetup(ui):
1387 > help.addtopichook('revisions', rewrite)
1388 > help.addtopichook('revisions', rewrite)
1388 > EOF
1389 > EOF
1389 $ cat > helphook2.py <<EOF
1390 $ cat > helphook2.py <<EOF
1390 > from mercurial import help
1391 > from mercurial import help
1391 >
1392 >
1392 > def rewrite(ui, topic, doc):
1393 > def rewrite(ui, topic, doc):
1393 > return doc + '\nhelphook2\n'
1394 > return doc + '\nhelphook2\n'
1394 >
1395 >
1395 > def extsetup(ui):
1396 > def extsetup(ui):
1396 > help.addtopichook('revisions', rewrite)
1397 > help.addtopichook('revisions', rewrite)
1397 > EOF
1398 > EOF
1398 $ echo '[extensions]' >> $HGRCPATH
1399 $ echo '[extensions]' >> $HGRCPATH
1399 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
1400 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
1400 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
1401 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
1401 $ hg help revsets | grep helphook
1402 $ hg help revsets | grep helphook
1402 helphook1
1403 helphook1
1403 helphook2
1404 helphook2
1404
1405
1405 help -c should only show debug --debug
1406 help -c should only show debug --debug
1406
1407
1407 $ hg help -c --debug|egrep debug|wc -l|egrep '^\s*0\s*$'
1408 $ hg help -c --debug|egrep debug|wc -l|egrep '^\s*0\s*$'
1408 [1]
1409 [1]
1409
1410
1410 help -c should only show deprecated for -v
1411 help -c should only show deprecated for -v
1411
1412
1412 $ hg help -c -v|egrep DEPRECATED|wc -l|egrep '^\s*0\s*$'
1413 $ hg help -c -v|egrep DEPRECATED|wc -l|egrep '^\s*0\s*$'
1413 [1]
1414 [1]
1414
1415
1415 Test -s / --system
1416 Test -s / --system
1416
1417
1417 $ hg help config.files -s windows |grep 'etc/mercurial' | \
1418 $ hg help config.files -s windows |grep 'etc/mercurial' | \
1418 > wc -l | sed -e 's/ //g'
1419 > wc -l | sed -e 's/ //g'
1419 0
1420 0
1420 $ hg help config.files --system unix | grep 'USER' | \
1421 $ hg help config.files --system unix | grep 'USER' | \
1421 > wc -l | sed -e 's/ //g'
1422 > wc -l | sed -e 's/ //g'
1422 0
1423 0
1423
1424
1424 Test -e / -c / -k combinations
1425 Test -e / -c / -k combinations
1425
1426
1426 $ hg help -c|egrep '^[A-Z].*:|^ debug'
1427 $ hg help -c|egrep '^[A-Z].*:|^ debug'
1427 Commands:
1428 Commands:
1428 $ hg help -e|egrep '^[A-Z].*:|^ debug'
1429 $ hg help -e|egrep '^[A-Z].*:|^ debug'
1429 Extensions:
1430 Extensions:
1430 $ hg help -k|egrep '^[A-Z].*:|^ debug'
1431 $ hg help -k|egrep '^[A-Z].*:|^ debug'
1431 Topics:
1432 Topics:
1432 Commands:
1433 Commands:
1433 Extensions:
1434 Extensions:
1434 Extension Commands:
1435 Extension Commands:
1435 $ hg help -c schemes
1436 $ hg help -c schemes
1436 abort: no such help topic: schemes
1437 abort: no such help topic: schemes
1437 (try 'hg help --keyword schemes')
1438 (try 'hg help --keyword schemes')
1438 [255]
1439 [255]
1439 $ hg help -e schemes |head -1
1440 $ hg help -e schemes |head -1
1440 schemes extension - extend schemes with shortcuts to repository swarms
1441 schemes extension - extend schemes with shortcuts to repository swarms
1441 $ hg help -c -k dates |egrep '^(Topics|Extensions|Commands):'
1442 $ hg help -c -k dates |egrep '^(Topics|Extensions|Commands):'
1442 Commands:
1443 Commands:
1443 $ hg help -e -k a |egrep '^(Topics|Extensions|Commands):'
1444 $ hg help -e -k a |egrep '^(Topics|Extensions|Commands):'
1444 Extensions:
1445 Extensions:
1445 $ hg help -e -c -k date |egrep '^(Topics|Extensions|Commands):'
1446 $ hg help -e -c -k date |egrep '^(Topics|Extensions|Commands):'
1446 Extensions:
1447 Extensions:
1447 Commands:
1448 Commands:
1448 $ hg help -c commit > /dev/null
1449 $ hg help -c commit > /dev/null
1449 $ hg help -e -c commit > /dev/null
1450 $ hg help -e -c commit > /dev/null
1450 $ hg help -e commit > /dev/null
1451 $ hg help -e commit > /dev/null
1451 abort: no such help topic: commit
1452 abort: no such help topic: commit
1452 (try 'hg help --keyword commit')
1453 (try 'hg help --keyword commit')
1453 [255]
1454 [255]
1454
1455
1455 Test keyword search help
1456 Test keyword search help
1456
1457
1457 $ cat > prefixedname.py <<EOF
1458 $ cat > prefixedname.py <<EOF
1458 > '''matched against word "clone"
1459 > '''matched against word "clone"
1459 > '''
1460 > '''
1460 > EOF
1461 > EOF
1461 $ echo '[extensions]' >> $HGRCPATH
1462 $ echo '[extensions]' >> $HGRCPATH
1462 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
1463 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
1463 $ hg help -k clone
1464 $ hg help -k clone
1464 Topics:
1465 Topics:
1465
1466
1466 config Configuration Files
1467 config Configuration Files
1467 extensions Using Additional Features
1468 extensions Using Additional Features
1468 glossary Glossary
1469 glossary Glossary
1469 phases Working with Phases
1470 phases Working with Phases
1470 subrepos Subrepositories
1471 subrepos Subrepositories
1471 urls URL Paths
1472 urls URL Paths
1472
1473
1473 Commands:
1474 Commands:
1474
1475
1475 bookmarks create a new bookmark or list existing bookmarks
1476 bookmarks create a new bookmark or list existing bookmarks
1476 clone make a copy of an existing repository
1477 clone make a copy of an existing repository
1477 paths show aliases for remote repositories
1478 paths show aliases for remote repositories
1478 update update working directory (or switch revisions)
1479 update update working directory (or switch revisions)
1479
1480
1480 Extensions:
1481 Extensions:
1481
1482
1482 clonebundles advertise pre-generated bundles to seed clones
1483 clonebundles advertise pre-generated bundles to seed clones
1483 prefixedname matched against word "clone"
1484 prefixedname matched against word "clone"
1484 relink recreates hardlinks between repository clones
1485 relink recreates hardlinks between repository clones
1485
1486
1486 Extension Commands:
1487 Extension Commands:
1487
1488
1488 qclone clone main and patch repository at same time
1489 qclone clone main and patch repository at same time
1489
1490
1490 Test unfound topic
1491 Test unfound topic
1491
1492
1492 $ hg help nonexistingtopicthatwillneverexisteverever
1493 $ hg help nonexistingtopicthatwillneverexisteverever
1493 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
1494 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
1494 (try 'hg help --keyword nonexistingtopicthatwillneverexisteverever')
1495 (try 'hg help --keyword nonexistingtopicthatwillneverexisteverever')
1495 [255]
1496 [255]
1496
1497
1497 Test unfound keyword
1498 Test unfound keyword
1498
1499
1499 $ hg help --keyword nonexistingwordthatwillneverexisteverever
1500 $ hg help --keyword nonexistingwordthatwillneverexisteverever
1500 abort: no matches
1501 abort: no matches
1501 (try 'hg help' for a list of topics)
1502 (try 'hg help' for a list of topics)
1502 [255]
1503 [255]
1503
1504
1504 Test omit indicating for help
1505 Test omit indicating for help
1505
1506
1506 $ cat > addverboseitems.py <<EOF
1507 $ cat > addverboseitems.py <<EOF
1507 > '''extension to test omit indicating.
1508 > '''extension to test omit indicating.
1508 >
1509 >
1509 > This paragraph is never omitted (for extension)
1510 > This paragraph is never omitted (for extension)
1510 >
1511 >
1511 > .. container:: verbose
1512 > .. container:: verbose
1512 >
1513 >
1513 > This paragraph is omitted,
1514 > This paragraph is omitted,
1514 > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension)
1515 > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension)
1515 >
1516 >
1516 > This paragraph is never omitted, too (for extension)
1517 > This paragraph is never omitted, too (for extension)
1517 > '''
1518 > '''
1518 >
1519 >
1519 > from mercurial import help, commands
1520 > from mercurial import help, commands
1520 > testtopic = """This paragraph is never omitted (for topic).
1521 > testtopic = """This paragraph is never omitted (for topic).
1521 >
1522 >
1522 > .. container:: verbose
1523 > .. container:: verbose
1523 >
1524 >
1524 > This paragraph is omitted,
1525 > This paragraph is omitted,
1525 > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic)
1526 > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic)
1526 >
1527 >
1527 > This paragraph is never omitted, too (for topic)
1528 > This paragraph is never omitted, too (for topic)
1528 > """
1529 > """
1529 > def extsetup(ui):
1530 > def extsetup(ui):
1530 > help.helptable.append((["topic-containing-verbose"],
1531 > help.helptable.append((["topic-containing-verbose"],
1531 > "This is the topic to test omit indicating.",
1532 > "This is the topic to test omit indicating.",
1532 > lambda ui: testtopic))
1533 > lambda ui: testtopic))
1533 > EOF
1534 > EOF
1534 $ echo '[extensions]' >> $HGRCPATH
1535 $ echo '[extensions]' >> $HGRCPATH
1535 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1536 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1536 $ hg help addverboseitems
1537 $ hg help addverboseitems
1537 addverboseitems extension - extension to test omit indicating.
1538 addverboseitems extension - extension to test omit indicating.
1538
1539
1539 This paragraph is never omitted (for extension)
1540 This paragraph is never omitted (for extension)
1540
1541
1541 This paragraph is never omitted, too (for extension)
1542 This paragraph is never omitted, too (for extension)
1542
1543
1543 (some details hidden, use --verbose to show complete help)
1544 (some details hidden, use --verbose to show complete help)
1544
1545
1545 no commands defined
1546 no commands defined
1546 $ hg help -v addverboseitems
1547 $ hg help -v addverboseitems
1547 addverboseitems extension - extension to test omit indicating.
1548 addverboseitems extension - extension to test omit indicating.
1548
1549
1549 This paragraph is never omitted (for extension)
1550 This paragraph is never omitted (for extension)
1550
1551
1551 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1552 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1552 extension)
1553 extension)
1553
1554
1554 This paragraph is never omitted, too (for extension)
1555 This paragraph is never omitted, too (for extension)
1555
1556
1556 no commands defined
1557 no commands defined
1557 $ hg help topic-containing-verbose
1558 $ hg help topic-containing-verbose
1558 This is the topic to test omit indicating.
1559 This is the topic to test omit indicating.
1559 """"""""""""""""""""""""""""""""""""""""""
1560 """"""""""""""""""""""""""""""""""""""""""
1560
1561
1561 This paragraph is never omitted (for topic).
1562 This paragraph is never omitted (for topic).
1562
1563
1563 This paragraph is never omitted, too (for topic)
1564 This paragraph is never omitted, too (for topic)
1564
1565
1565 (some details hidden, use --verbose to show complete help)
1566 (some details hidden, use --verbose to show complete help)
1566 $ hg help -v topic-containing-verbose
1567 $ hg help -v topic-containing-verbose
1567 This is the topic to test omit indicating.
1568 This is the topic to test omit indicating.
1568 """"""""""""""""""""""""""""""""""""""""""
1569 """"""""""""""""""""""""""""""""""""""""""
1569
1570
1570 This paragraph is never omitted (for topic).
1571 This paragraph is never omitted (for topic).
1571
1572
1572 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1573 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1573 topic)
1574 topic)
1574
1575
1575 This paragraph is never omitted, too (for topic)
1576 This paragraph is never omitted, too (for topic)
1576
1577
1577 Test section lookup
1578 Test section lookup
1578
1579
1579 $ hg help revset.merge
1580 $ hg help revset.merge
1580 "merge()"
1581 "merge()"
1581 Changeset is a merge changeset.
1582 Changeset is a merge changeset.
1582
1583
1583 $ hg help glossary.dag
1584 $ hg help glossary.dag
1584 DAG
1585 DAG
1585 The repository of changesets of a distributed version control system
1586 The repository of changesets of a distributed version control system
1586 (DVCS) can be described as a directed acyclic graph (DAG), consisting
1587 (DVCS) can be described as a directed acyclic graph (DAG), consisting
1587 of nodes and edges, where nodes correspond to changesets and edges
1588 of nodes and edges, where nodes correspond to changesets and edges
1588 imply a parent -> child relation. This graph can be visualized by
1589 imply a parent -> child relation. This graph can be visualized by
1589 graphical tools such as 'hg log --graph'. In Mercurial, the DAG is
1590 graphical tools such as 'hg log --graph'. In Mercurial, the DAG is
1590 limited by the requirement for children to have at most two parents.
1591 limited by the requirement for children to have at most two parents.
1591
1592
1592
1593
1593 $ hg help hgrc.paths
1594 $ hg help hgrc.paths
1594 "paths"
1595 "paths"
1595 -------
1596 -------
1596
1597
1597 Assigns symbolic names and behavior to repositories.
1598 Assigns symbolic names and behavior to repositories.
1598
1599
1599 Options are symbolic names defining the URL or directory that is the
1600 Options are symbolic names defining the URL or directory that is the
1600 location of the repository. Example:
1601 location of the repository. Example:
1601
1602
1602 [paths]
1603 [paths]
1603 my_server = https://example.com/my_repo
1604 my_server = https://example.com/my_repo
1604 local_path = /home/me/repo
1605 local_path = /home/me/repo
1605
1606
1606 These symbolic names can be used from the command line. To pull from
1607 These symbolic names can be used from the command line. To pull from
1607 "my_server": 'hg pull my_server'. To push to "local_path": 'hg push
1608 "my_server": 'hg pull my_server'. To push to "local_path": 'hg push
1608 local_path'.
1609 local_path'.
1609
1610
1610 Options containing colons (":") denote sub-options that can influence
1611 Options containing colons (":") denote sub-options that can influence
1611 behavior for that specific path. Example:
1612 behavior for that specific path. Example:
1612
1613
1613 [paths]
1614 [paths]
1614 my_server = https://example.com/my_path
1615 my_server = https://example.com/my_path
1615 my_server:pushurl = ssh://example.com/my_path
1616 my_server:pushurl = ssh://example.com/my_path
1616
1617
1617 The following sub-options can be defined:
1618 The following sub-options can be defined:
1618
1619
1619 "pushurl"
1620 "pushurl"
1620 The URL to use for push operations. If not defined, the location
1621 The URL to use for push operations. If not defined, the location
1621 defined by the path's main entry is used.
1622 defined by the path's main entry is used.
1622
1623
1623 "pushrev"
1624 "pushrev"
1624 A revset defining which revisions to push by default.
1625 A revset defining which revisions to push by default.
1625
1626
1626 When 'hg push' is executed without a "-r" argument, the revset defined
1627 When 'hg push' is executed without a "-r" argument, the revset defined
1627 by this sub-option is evaluated to determine what to push.
1628 by this sub-option is evaluated to determine what to push.
1628
1629
1629 For example, a value of "." will push the working directory's revision
1630 For example, a value of "." will push the working directory's revision
1630 by default.
1631 by default.
1631
1632
1632 Revsets specifying bookmarks will not result in the bookmark being
1633 Revsets specifying bookmarks will not result in the bookmark being
1633 pushed.
1634 pushed.
1634
1635
1635 The following special named paths exist:
1636 The following special named paths exist:
1636
1637
1637 "default"
1638 "default"
1638 The URL or directory to use when no source or remote is specified.
1639 The URL or directory to use when no source or remote is specified.
1639
1640
1640 'hg clone' will automatically define this path to the location the
1641 'hg clone' will automatically define this path to the location the
1641 repository was cloned from.
1642 repository was cloned from.
1642
1643
1643 "default-push"
1644 "default-push"
1644 (deprecated) The URL or directory for the default 'hg push' location.
1645 (deprecated) The URL or directory for the default 'hg push' location.
1645 "default:pushurl" should be used instead.
1646 "default:pushurl" should be used instead.
1646
1647
1647 $ hg help glossary.mcguffin
1648 $ hg help glossary.mcguffin
1648 abort: help section not found: glossary.mcguffin
1649 abort: help section not found: glossary.mcguffin
1649 [255]
1650 [255]
1650
1651
1651 $ hg help glossary.mc.guffin
1652 $ hg help glossary.mc.guffin
1652 abort: help section not found: glossary.mc.guffin
1653 abort: help section not found: glossary.mc.guffin
1653 [255]
1654 [255]
1654
1655
1655 $ hg help template.files
1656 $ hg help template.files
1656 files List of strings. All files modified, added, or removed by
1657 files List of strings. All files modified, added, or removed by
1657 this changeset.
1658 this changeset.
1658 files(pattern)
1659 files(pattern)
1659 All files of the current changeset matching the pattern. See
1660 All files of the current changeset matching the pattern. See
1660 'hg help patterns'.
1661 'hg help patterns'.
1661
1662
1662 Test section lookup by translated message
1663 Test section lookup by translated message
1663
1664
1664 str.lower() instead of encoding.lower(str) on translated message might
1665 str.lower() instead of encoding.lower(str) on translated message might
1665 make message meaningless, because some encoding uses 0x41(A) - 0x5a(Z)
1666 make message meaningless, because some encoding uses 0x41(A) - 0x5a(Z)
1666 as the second or later byte of multi-byte character.
1667 as the second or later byte of multi-byte character.
1667
1668
1668 For example, "\x8bL\x98^" (translation of "record" in ja_JP.cp932)
1669 For example, "\x8bL\x98^" (translation of "record" in ja_JP.cp932)
1669 contains 0x4c (L). str.lower() replaces 0x4c(L) by 0x6c(l) and this
1670 contains 0x4c (L). str.lower() replaces 0x4c(L) by 0x6c(l) and this
1670 replacement makes message meaningless.
1671 replacement makes message meaningless.
1671
1672
1672 This tests that section lookup by translated string isn't broken by
1673 This tests that section lookup by translated string isn't broken by
1673 such str.lower().
1674 such str.lower().
1674
1675
1675 $ $PYTHON <<EOF
1676 $ $PYTHON <<EOF
1676 > def escape(s):
1677 > def escape(s):
1677 > return ''.join('\u%x' % ord(uc) for uc in s.decode('cp932'))
1678 > return ''.join('\u%x' % ord(uc) for uc in s.decode('cp932'))
1678 > # translation of "record" in ja_JP.cp932
1679 > # translation of "record" in ja_JP.cp932
1679 > upper = "\x8bL\x98^"
1680 > upper = "\x8bL\x98^"
1680 > # str.lower()-ed section name should be treated as different one
1681 > # str.lower()-ed section name should be treated as different one
1681 > lower = "\x8bl\x98^"
1682 > lower = "\x8bl\x98^"
1682 > with open('ambiguous.py', 'w') as fp:
1683 > with open('ambiguous.py', 'w') as fp:
1683 > fp.write("""# ambiguous section names in ja_JP.cp932
1684 > fp.write("""# ambiguous section names in ja_JP.cp932
1684 > u'''summary of extension
1685 > u'''summary of extension
1685 >
1686 >
1686 > %s
1687 > %s
1687 > ----
1688 > ----
1688 >
1689 >
1689 > Upper name should show only this message
1690 > Upper name should show only this message
1690 >
1691 >
1691 > %s
1692 > %s
1692 > ----
1693 > ----
1693 >
1694 >
1694 > Lower name should show only this message
1695 > Lower name should show only this message
1695 >
1696 >
1696 > subsequent section
1697 > subsequent section
1697 > ------------------
1698 > ------------------
1698 >
1699 >
1699 > This should be hidden at 'hg help ambiguous' with section name.
1700 > This should be hidden at 'hg help ambiguous' with section name.
1700 > '''
1701 > '''
1701 > """ % (escape(upper), escape(lower)))
1702 > """ % (escape(upper), escape(lower)))
1702 > EOF
1703 > EOF
1703
1704
1704 $ cat >> $HGRCPATH <<EOF
1705 $ cat >> $HGRCPATH <<EOF
1705 > [extensions]
1706 > [extensions]
1706 > ambiguous = ./ambiguous.py
1707 > ambiguous = ./ambiguous.py
1707 > EOF
1708 > EOF
1708
1709
1709 $ $PYTHON <<EOF | sh
1710 $ $PYTHON <<EOF | sh
1710 > upper = "\x8bL\x98^"
1711 > upper = "\x8bL\x98^"
1711 > print "hg --encoding cp932 help -e ambiguous.%s" % upper
1712 > print "hg --encoding cp932 help -e ambiguous.%s" % upper
1712 > EOF
1713 > EOF
1713 \x8bL\x98^ (esc)
1714 \x8bL\x98^ (esc)
1714 ----
1715 ----
1715
1716
1716 Upper name should show only this message
1717 Upper name should show only this message
1717
1718
1718
1719
1719 $ $PYTHON <<EOF | sh
1720 $ $PYTHON <<EOF | sh
1720 > lower = "\x8bl\x98^"
1721 > lower = "\x8bl\x98^"
1721 > print "hg --encoding cp932 help -e ambiguous.%s" % lower
1722 > print "hg --encoding cp932 help -e ambiguous.%s" % lower
1722 > EOF
1723 > EOF
1723 \x8bl\x98^ (esc)
1724 \x8bl\x98^ (esc)
1724 ----
1725 ----
1725
1726
1726 Lower name should show only this message
1727 Lower name should show only this message
1727
1728
1728
1729
1729 $ cat >> $HGRCPATH <<EOF
1730 $ cat >> $HGRCPATH <<EOF
1730 > [extensions]
1731 > [extensions]
1731 > ambiguous = !
1732 > ambiguous = !
1732 > EOF
1733 > EOF
1733
1734
1734 Show help content of disabled extensions
1735 Show help content of disabled extensions
1735
1736
1736 $ cat >> $HGRCPATH <<EOF
1737 $ cat >> $HGRCPATH <<EOF
1737 > [extensions]
1738 > [extensions]
1738 > ambiguous = !./ambiguous.py
1739 > ambiguous = !./ambiguous.py
1739 > EOF
1740 > EOF
1740 $ hg help -e ambiguous
1741 $ hg help -e ambiguous
1741 ambiguous extension - (no help text available)
1742 ambiguous extension - (no help text available)
1742
1743
1743 (use 'hg help extensions' for information on enabling extensions)
1744 (use 'hg help extensions' for information on enabling extensions)
1744
1745
1745 Test dynamic list of merge tools only shows up once
1746 Test dynamic list of merge tools only shows up once
1746 $ hg help merge-tools
1747 $ hg help merge-tools
1747 Merge Tools
1748 Merge Tools
1748 """""""""""
1749 """""""""""
1749
1750
1750 To merge files Mercurial uses merge tools.
1751 To merge files Mercurial uses merge tools.
1751
1752
1752 A merge tool combines two different versions of a file into a merged file.
1753 A merge tool combines two different versions of a file into a merged file.
1753 Merge tools are given the two files and the greatest common ancestor of
1754 Merge tools are given the two files and the greatest common ancestor of
1754 the two file versions, so they can determine the changes made on both
1755 the two file versions, so they can determine the changes made on both
1755 branches.
1756 branches.
1756
1757
1757 Merge tools are used both for 'hg resolve', 'hg merge', 'hg update', 'hg
1758 Merge tools are used both for 'hg resolve', 'hg merge', 'hg update', 'hg
1758 backout' and in several extensions.
1759 backout' and in several extensions.
1759
1760
1760 Usually, the merge tool tries to automatically reconcile the files by
1761 Usually, the merge tool tries to automatically reconcile the files by
1761 combining all non-overlapping changes that occurred separately in the two
1762 combining all non-overlapping changes that occurred separately in the two
1762 different evolutions of the same initial base file. Furthermore, some
1763 different evolutions of the same initial base file. Furthermore, some
1763 interactive merge programs make it easier to manually resolve conflicting
1764 interactive merge programs make it easier to manually resolve conflicting
1764 merges, either in a graphical way, or by inserting some conflict markers.
1765 merges, either in a graphical way, or by inserting some conflict markers.
1765 Mercurial does not include any interactive merge programs but relies on
1766 Mercurial does not include any interactive merge programs but relies on
1766 external tools for that.
1767 external tools for that.
1767
1768
1768 Available merge tools
1769 Available merge tools
1769 =====================
1770 =====================
1770
1771
1771 External merge tools and their properties are configured in the merge-
1772 External merge tools and their properties are configured in the merge-
1772 tools configuration section - see hgrc(5) - but they can often just be
1773 tools configuration section - see hgrc(5) - but they can often just be
1773 named by their executable.
1774 named by their executable.
1774
1775
1775 A merge tool is generally usable if its executable can be found on the
1776 A merge tool is generally usable if its executable can be found on the
1776 system and if it can handle the merge. The executable is found if it is an
1777 system and if it can handle the merge. The executable is found if it is an
1777 absolute or relative executable path or the name of an application in the
1778 absolute or relative executable path or the name of an application in the
1778 executable search path. The tool is assumed to be able to handle the merge
1779 executable search path. The tool is assumed to be able to handle the merge
1779 if it can handle symlinks if the file is a symlink, if it can handle
1780 if it can handle symlinks if the file is a symlink, if it can handle
1780 binary files if the file is binary, and if a GUI is available if the tool
1781 binary files if the file is binary, and if a GUI is available if the tool
1781 requires a GUI.
1782 requires a GUI.
1782
1783
1783 There are some internal merge tools which can be used. The internal merge
1784 There are some internal merge tools which can be used. The internal merge
1784 tools are:
1785 tools are:
1785
1786
1786 ":dump"
1787 ":dump"
1787 Creates three versions of the files to merge, containing the contents of
1788 Creates three versions of the files to merge, containing the contents of
1788 local, other and base. These files can then be used to perform a merge
1789 local, other and base. These files can then be used to perform a merge
1789 manually. If the file to be merged is named "a.txt", these files will
1790 manually. If the file to be merged is named "a.txt", these files will
1790 accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and
1791 accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and
1791 they will be placed in the same directory as "a.txt".
1792 they will be placed in the same directory as "a.txt".
1792
1793
1793 This implies permerge. Therefore, files aren't dumped, if premerge runs
1794 This implies permerge. Therefore, files aren't dumped, if premerge runs
1794 successfully. Use :forcedump to forcibly write files out.
1795 successfully. Use :forcedump to forcibly write files out.
1795
1796
1796 ":fail"
1797 ":fail"
1797 Rather than attempting to merge files that were modified on both
1798 Rather than attempting to merge files that were modified on both
1798 branches, it marks them as unresolved. The resolve command must be used
1799 branches, it marks them as unresolved. The resolve command must be used
1799 to resolve these conflicts.
1800 to resolve these conflicts.
1800
1801
1801 ":forcedump"
1802 ":forcedump"
1802 Creates three versions of the files as same as :dump, but omits
1803 Creates three versions of the files as same as :dump, but omits
1803 premerge.
1804 premerge.
1804
1805
1805 ":local"
1806 ":local"
1806 Uses the local 'p1()' version of files as the merged version.
1807 Uses the local 'p1()' version of files as the merged version.
1807
1808
1808 ":merge"
1809 ":merge"
1809 Uses the internal non-interactive simple merge algorithm for merging
1810 Uses the internal non-interactive simple merge algorithm for merging
1810 files. It will fail if there are any conflicts and leave markers in the
1811 files. It will fail if there are any conflicts and leave markers in the
1811 partially merged file. Markers will have two sections, one for each side
1812 partially merged file. Markers will have two sections, one for each side
1812 of merge.
1813 of merge.
1813
1814
1814 ":merge-local"
1815 ":merge-local"
1815 Like :merge, but resolve all conflicts non-interactively in favor of the
1816 Like :merge, but resolve all conflicts non-interactively in favor of the
1816 local 'p1()' changes.
1817 local 'p1()' changes.
1817
1818
1818 ":merge-other"
1819 ":merge-other"
1819 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
1820 other 'p2()' changes.
1821 other 'p2()' changes.
1821
1822
1822 ":merge3"
1823 ":merge3"
1823 Uses the internal non-interactive simple merge algorithm for merging
1824 Uses the internal non-interactive simple merge algorithm for merging
1824 files. It will fail if there are any conflicts and leave markers in the
1825 files. It will fail if there are any conflicts and leave markers in the
1825 partially merged file. Marker will have three sections, one from each
1826 partially merged file. Marker will have three sections, one from each
1826 side of the merge and one for the base content.
1827 side of the merge and one for the base content.
1827
1828
1828 ":other"
1829 ":other"
1829 Uses the other 'p2()' version of files as the merged version.
1830 Uses the other 'p2()' version of files as the merged version.
1830
1831
1831 ":prompt"
1832 ":prompt"
1832 Asks the user which of the local 'p1()' or the other 'p2()' version to
1833 Asks the user which of the local 'p1()' or the other 'p2()' version to
1833 keep as the merged version.
1834 keep as the merged version.
1834
1835
1835 ":tagmerge"
1836 ":tagmerge"
1836 Uses the internal tag merge algorithm (experimental).
1837 Uses the internal tag merge algorithm (experimental).
1837
1838
1838 ":union"
1839 ":union"
1839 Uses the internal non-interactive simple merge algorithm for merging
1840 Uses the internal non-interactive simple merge algorithm for merging
1840 files. It will use both left and right sides for conflict regions. No
1841 files. It will use both left and right sides for conflict regions. No
1841 markers are inserted.
1842 markers are inserted.
1842
1843
1843 Internal tools are always available and do not require a GUI but will by
1844 Internal tools are always available and do not require a GUI but will by
1844 default not handle symlinks or binary files.
1845 default not handle symlinks or binary files.
1845
1846
1846 Choosing a merge tool
1847 Choosing a merge tool
1847 =====================
1848 =====================
1848
1849
1849 Mercurial uses these rules when deciding which merge tool to use:
1850 Mercurial uses these rules when deciding which merge tool to use:
1850
1851
1851 1. If a tool has been specified with the --tool option to merge or
1852 1. If a tool has been specified with the --tool option to merge or
1852 resolve, it is used. If it is the name of a tool in the merge-tools
1853 resolve, it is used. If it is the name of a tool in the merge-tools
1853 configuration, its configuration is used. Otherwise the specified tool
1854 configuration, its configuration is used. Otherwise the specified tool
1854 must be executable by the shell.
1855 must be executable by the shell.
1855 2. If the "HGMERGE" environment variable is present, its value is used and
1856 2. If the "HGMERGE" environment variable is present, its value is used and
1856 must be executable by the shell.
1857 must be executable by the shell.
1857 3. If the filename of the file to be merged matches any of the patterns in
1858 3. If the filename of the file to be merged matches any of the patterns in
1858 the merge-patterns configuration section, the first usable merge tool
1859 the merge-patterns configuration section, the first usable merge tool
1859 corresponding to a matching pattern is used. Here, binary capabilities
1860 corresponding to a matching pattern is used. Here, binary capabilities
1860 of the merge tool are not considered.
1861 of the merge tool are not considered.
1861 4. If ui.merge is set it will be considered next. If the value is not the
1862 4. If ui.merge is set it will be considered next. If the value is not the
1862 name of a configured tool, the specified value is used and must be
1863 name of a configured tool, the specified value is used and must be
1863 executable by the shell. Otherwise the named tool is used if it is
1864 executable by the shell. Otherwise the named tool is used if it is
1864 usable.
1865 usable.
1865 5. If any usable merge tools are present in the merge-tools configuration
1866 5. If any usable merge tools are present in the merge-tools configuration
1866 section, the one with the highest priority is used.
1867 section, the one with the highest priority is used.
1867 6. If a program named "hgmerge" can be found on the system, it is used -
1868 6. If a program named "hgmerge" can be found on the system, it is used -
1868 but it will by default not be used for symlinks and binary files.
1869 but it will by default not be used for symlinks and binary files.
1869 7. If the file to be merged is not binary and is not a symlink, then
1870 7. If the file to be merged is not binary and is not a symlink, then
1870 internal ":merge" is used.
1871 internal ":merge" is used.
1871 8. Otherwise, ":prompt" is used.
1872 8. Otherwise, ":prompt" is used.
1872
1873
1873 Note:
1874 Note:
1874 After selecting a merge program, Mercurial will by default attempt to
1875 After selecting a merge program, Mercurial will by default attempt to
1875 merge the files using a simple merge algorithm first. Only if it
1876 merge the files using a simple merge algorithm first. Only if it
1876 doesn't succeed because of conflicting changes Mercurial will actually
1877 doesn't succeed because of conflicting changes Mercurial will actually
1877 execute the merge program. Whether to use the simple merge algorithm
1878 execute the merge program. Whether to use the simple merge algorithm
1878 first can be controlled by the premerge setting of the merge tool.
1879 first can be controlled by the premerge setting of the merge tool.
1879 Premerge is enabled by default unless the file is binary or a symlink.
1880 Premerge is enabled by default unless the file is binary or a symlink.
1880
1881
1881 See the merge-tools and ui sections of hgrc(5) for details on the
1882 See the merge-tools and ui sections of hgrc(5) for details on the
1882 configuration of merge tools.
1883 configuration of merge tools.
1883
1884
1884 Compression engines listed in `hg help bundlespec`
1885 Compression engines listed in `hg help bundlespec`
1885
1886
1886 $ hg help bundlespec | grep gzip
1887 $ hg help bundlespec | grep gzip
1887 "v1" bundles can only use the "gzip", "bzip2", and "none" compression
1888 "v1" bundles can only use the "gzip", "bzip2", and "none" compression
1888 An algorithm that produces smaller bundles than "gzip".
1889 An algorithm that produces smaller bundles than "gzip".
1889 This engine will likely produce smaller bundles than "gzip" but will be
1890 This engine will likely produce smaller bundles than "gzip" but will be
1890 "gzip"
1891 "gzip"
1891 better compression than "gzip". It also frequently yields better (?)
1892 better compression than "gzip". It also frequently yields better (?)
1892
1893
1893 Test usage of section marks in help documents
1894 Test usage of section marks in help documents
1894
1895
1895 $ cd "$TESTDIR"/../doc
1896 $ cd "$TESTDIR"/../doc
1896 $ $PYTHON check-seclevel.py
1897 $ $PYTHON check-seclevel.py
1897 $ cd $TESTTMP
1898 $ cd $TESTTMP
1898
1899
1899 #if serve
1900 #if serve
1900
1901
1901 Test the help pages in hgweb.
1902 Test the help pages in hgweb.
1902
1903
1903 Dish up an empty repo; serve it cold.
1904 Dish up an empty repo; serve it cold.
1904
1905
1905 $ hg init "$TESTTMP/test"
1906 $ hg init "$TESTTMP/test"
1906 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
1907 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
1907 $ cat hg.pid >> $DAEMON_PIDS
1908 $ cat hg.pid >> $DAEMON_PIDS
1908
1909
1909 $ get-with-headers.py $LOCALIP:$HGPORT "help"
1910 $ get-with-headers.py $LOCALIP:$HGPORT "help"
1910 200 Script output follows
1911 200 Script output follows
1911
1912
1912 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1913 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1913 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1914 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1914 <head>
1915 <head>
1915 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1916 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1916 <meta name="robots" content="index, nofollow" />
1917 <meta name="robots" content="index, nofollow" />
1917 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1918 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1918 <script type="text/javascript" src="/static/mercurial.js"></script>
1919 <script type="text/javascript" src="/static/mercurial.js"></script>
1919
1920
1920 <title>Help: Index</title>
1921 <title>Help: Index</title>
1921 </head>
1922 </head>
1922 <body>
1923 <body>
1923
1924
1924 <div class="container">
1925 <div class="container">
1925 <div class="menu">
1926 <div class="menu">
1926 <div class="logo">
1927 <div class="logo">
1927 <a href="https://mercurial-scm.org/">
1928 <a href="https://mercurial-scm.org/">
1928 <img src="/static/hglogo.png" alt="mercurial" /></a>
1929 <img src="/static/hglogo.png" alt="mercurial" /></a>
1929 </div>
1930 </div>
1930 <ul>
1931 <ul>
1931 <li><a href="/shortlog">log</a></li>
1932 <li><a href="/shortlog">log</a></li>
1932 <li><a href="/graph">graph</a></li>
1933 <li><a href="/graph">graph</a></li>
1933 <li><a href="/tags">tags</a></li>
1934 <li><a href="/tags">tags</a></li>
1934 <li><a href="/bookmarks">bookmarks</a></li>
1935 <li><a href="/bookmarks">bookmarks</a></li>
1935 <li><a href="/branches">branches</a></li>
1936 <li><a href="/branches">branches</a></li>
1936 </ul>
1937 </ul>
1937 <ul>
1938 <ul>
1938 <li class="active">help</li>
1939 <li class="active">help</li>
1939 </ul>
1940 </ul>
1940 </div>
1941 </div>
1941
1942
1942 <div class="main">
1943 <div class="main">
1943 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1944 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1944
1945
1945 <form class="search" action="/log">
1946 <form class="search" action="/log">
1946
1947
1947 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
1948 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
1948 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1949 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1949 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1950 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1950 </form>
1951 </form>
1951 <table class="bigtable">
1952 <table class="bigtable">
1952 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
1953 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
1953
1954
1954 <tr><td>
1955 <tr><td>
1955 <a href="/help/bundlespec">
1956 <a href="/help/bundlespec">
1956 bundlespec
1957 bundlespec
1957 </a>
1958 </a>
1958 </td><td>
1959 </td><td>
1959 Bundle File Formats
1960 Bundle File Formats
1960 </td></tr>
1961 </td></tr>
1961 <tr><td>
1962 <tr><td>
1962 <a href="/help/color">
1963 <a href="/help/color">
1963 color
1964 color
1964 </a>
1965 </a>
1965 </td><td>
1966 </td><td>
1966 Colorizing Outputs
1967 Colorizing Outputs
1967 </td></tr>
1968 </td></tr>
1968 <tr><td>
1969 <tr><td>
1969 <a href="/help/config">
1970 <a href="/help/config">
1970 config
1971 config
1971 </a>
1972 </a>
1972 </td><td>
1973 </td><td>
1973 Configuration Files
1974 Configuration Files
1974 </td></tr>
1975 </td></tr>
1975 <tr><td>
1976 <tr><td>
1976 <a href="/help/dates">
1977 <a href="/help/dates">
1977 dates
1978 dates
1978 </a>
1979 </a>
1979 </td><td>
1980 </td><td>
1980 Date Formats
1981 Date Formats
1981 </td></tr>
1982 </td></tr>
1982 <tr><td>
1983 <tr><td>
1983 <a href="/help/diffs">
1984 <a href="/help/diffs">
1984 diffs
1985 diffs
1985 </a>
1986 </a>
1986 </td><td>
1987 </td><td>
1987 Diff Formats
1988 Diff Formats
1988 </td></tr>
1989 </td></tr>
1989 <tr><td>
1990 <tr><td>
1990 <a href="/help/environment">
1991 <a href="/help/environment">
1991 environment
1992 environment
1992 </a>
1993 </a>
1993 </td><td>
1994 </td><td>
1994 Environment Variables
1995 Environment Variables
1995 </td></tr>
1996 </td></tr>
1996 <tr><td>
1997 <tr><td>
1997 <a href="/help/extensions">
1998 <a href="/help/extensions">
1998 extensions
1999 extensions
1999 </a>
2000 </a>
2000 </td><td>
2001 </td><td>
2001 Using Additional Features
2002 Using Additional Features
2002 </td></tr>
2003 </td></tr>
2003 <tr><td>
2004 <tr><td>
2004 <a href="/help/filesets">
2005 <a href="/help/filesets">
2005 filesets
2006 filesets
2006 </a>
2007 </a>
2007 </td><td>
2008 </td><td>
2008 Specifying File Sets
2009 Specifying File Sets
2009 </td></tr>
2010 </td></tr>
2010 <tr><td>
2011 <tr><td>
2011 <a href="/help/glossary">
2012 <a href="/help/glossary">
2012 glossary
2013 glossary
2013 </a>
2014 </a>
2014 </td><td>
2015 </td><td>
2015 Glossary
2016 Glossary
2016 </td></tr>
2017 </td></tr>
2017 <tr><td>
2018 <tr><td>
2018 <a href="/help/hgignore">
2019 <a href="/help/hgignore">
2019 hgignore
2020 hgignore
2020 </a>
2021 </a>
2021 </td><td>
2022 </td><td>
2022 Syntax for Mercurial Ignore Files
2023 Syntax for Mercurial Ignore Files
2023 </td></tr>
2024 </td></tr>
2024 <tr><td>
2025 <tr><td>
2025 <a href="/help/hgweb">
2026 <a href="/help/hgweb">
2026 hgweb
2027 hgweb
2027 </a>
2028 </a>
2028 </td><td>
2029 </td><td>
2029 Configuring hgweb
2030 Configuring hgweb
2030 </td></tr>
2031 </td></tr>
2031 <tr><td>
2032 <tr><td>
2032 <a href="/help/internals">
2033 <a href="/help/internals">
2033 internals
2034 internals
2034 </a>
2035 </a>
2035 </td><td>
2036 </td><td>
2036 Technical implementation topics
2037 Technical implementation topics
2037 </td></tr>
2038 </td></tr>
2038 <tr><td>
2039 <tr><td>
2039 <a href="/help/merge-tools">
2040 <a href="/help/merge-tools">
2040 merge-tools
2041 merge-tools
2041 </a>
2042 </a>
2042 </td><td>
2043 </td><td>
2043 Merge Tools
2044 Merge Tools
2044 </td></tr>
2045 </td></tr>
2045 <tr><td>
2046 <tr><td>
2046 <a href="/help/pager">
2047 <a href="/help/pager">
2047 pager
2048 pager
2048 </a>
2049 </a>
2049 </td><td>
2050 </td><td>
2050 Pager Support
2051 Pager Support
2051 </td></tr>
2052 </td></tr>
2052 <tr><td>
2053 <tr><td>
2053 <a href="/help/patterns">
2054 <a href="/help/patterns">
2054 patterns
2055 patterns
2055 </a>
2056 </a>
2056 </td><td>
2057 </td><td>
2057 File Name Patterns
2058 File Name Patterns
2058 </td></tr>
2059 </td></tr>
2059 <tr><td>
2060 <tr><td>
2060 <a href="/help/phases">
2061 <a href="/help/phases">
2061 phases
2062 phases
2062 </a>
2063 </a>
2063 </td><td>
2064 </td><td>
2064 Working with Phases
2065 Working with Phases
2065 </td></tr>
2066 </td></tr>
2066 <tr><td>
2067 <tr><td>
2067 <a href="/help/revisions">
2068 <a href="/help/revisions">
2068 revisions
2069 revisions
2069 </a>
2070 </a>
2070 </td><td>
2071 </td><td>
2071 Specifying Revisions
2072 Specifying Revisions
2072 </td></tr>
2073 </td></tr>
2073 <tr><td>
2074 <tr><td>
2074 <a href="/help/scripting">
2075 <a href="/help/scripting">
2075 scripting
2076 scripting
2076 </a>
2077 </a>
2077 </td><td>
2078 </td><td>
2078 Using Mercurial from scripts and automation
2079 Using Mercurial from scripts and automation
2079 </td></tr>
2080 </td></tr>
2080 <tr><td>
2081 <tr><td>
2081 <a href="/help/subrepos">
2082 <a href="/help/subrepos">
2082 subrepos
2083 subrepos
2083 </a>
2084 </a>
2084 </td><td>
2085 </td><td>
2085 Subrepositories
2086 Subrepositories
2086 </td></tr>
2087 </td></tr>
2087 <tr><td>
2088 <tr><td>
2088 <a href="/help/templating">
2089 <a href="/help/templating">
2089 templating
2090 templating
2090 </a>
2091 </a>
2091 </td><td>
2092 </td><td>
2092 Template Usage
2093 Template Usage
2093 </td></tr>
2094 </td></tr>
2094 <tr><td>
2095 <tr><td>
2095 <a href="/help/urls">
2096 <a href="/help/urls">
2096 urls
2097 urls
2097 </a>
2098 </a>
2098 </td><td>
2099 </td><td>
2099 URL Paths
2100 URL Paths
2100 </td></tr>
2101 </td></tr>
2101 <tr><td>
2102 <tr><td>
2102 <a href="/help/topic-containing-verbose">
2103 <a href="/help/topic-containing-verbose">
2103 topic-containing-verbose
2104 topic-containing-verbose
2104 </a>
2105 </a>
2105 </td><td>
2106 </td><td>
2106 This is the topic to test omit indicating.
2107 This is the topic to test omit indicating.
2107 </td></tr>
2108 </td></tr>
2108
2109
2109
2110
2110 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
2111 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
2111
2112
2112 <tr><td>
2113 <tr><td>
2113 <a href="/help/add">
2114 <a href="/help/add">
2114 add
2115 add
2115 </a>
2116 </a>
2116 </td><td>
2117 </td><td>
2117 add the specified files on the next commit
2118 add the specified files on the next commit
2118 </td></tr>
2119 </td></tr>
2119 <tr><td>
2120 <tr><td>
2120 <a href="/help/annotate">
2121 <a href="/help/annotate">
2121 annotate
2122 annotate
2122 </a>
2123 </a>
2123 </td><td>
2124 </td><td>
2124 show changeset information by line for each file
2125 show changeset information by line for each file
2125 </td></tr>
2126 </td></tr>
2126 <tr><td>
2127 <tr><td>
2127 <a href="/help/clone">
2128 <a href="/help/clone">
2128 clone
2129 clone
2129 </a>
2130 </a>
2130 </td><td>
2131 </td><td>
2131 make a copy of an existing repository
2132 make a copy of an existing repository
2132 </td></tr>
2133 </td></tr>
2133 <tr><td>
2134 <tr><td>
2134 <a href="/help/commit">
2135 <a href="/help/commit">
2135 commit
2136 commit
2136 </a>
2137 </a>
2137 </td><td>
2138 </td><td>
2138 commit the specified files or all outstanding changes
2139 commit the specified files or all outstanding changes
2139 </td></tr>
2140 </td></tr>
2140 <tr><td>
2141 <tr><td>
2141 <a href="/help/diff">
2142 <a href="/help/diff">
2142 diff
2143 diff
2143 </a>
2144 </a>
2144 </td><td>
2145 </td><td>
2145 diff repository (or selected files)
2146 diff repository (or selected files)
2146 </td></tr>
2147 </td></tr>
2147 <tr><td>
2148 <tr><td>
2148 <a href="/help/export">
2149 <a href="/help/export">
2149 export
2150 export
2150 </a>
2151 </a>
2151 </td><td>
2152 </td><td>
2152 dump the header and diffs for one or more changesets
2153 dump the header and diffs for one or more changesets
2153 </td></tr>
2154 </td></tr>
2154 <tr><td>
2155 <tr><td>
2155 <a href="/help/forget">
2156 <a href="/help/forget">
2156 forget
2157 forget
2157 </a>
2158 </a>
2158 </td><td>
2159 </td><td>
2159 forget the specified files on the next commit
2160 forget the specified files on the next commit
2160 </td></tr>
2161 </td></tr>
2161 <tr><td>
2162 <tr><td>
2162 <a href="/help/init">
2163 <a href="/help/init">
2163 init
2164 init
2164 </a>
2165 </a>
2165 </td><td>
2166 </td><td>
2166 create a new repository in the given directory
2167 create a new repository in the given directory
2167 </td></tr>
2168 </td></tr>
2168 <tr><td>
2169 <tr><td>
2169 <a href="/help/log">
2170 <a href="/help/log">
2170 log
2171 log
2171 </a>
2172 </a>
2172 </td><td>
2173 </td><td>
2173 show revision history of entire repository or files
2174 show revision history of entire repository or files
2174 </td></tr>
2175 </td></tr>
2175 <tr><td>
2176 <tr><td>
2176 <a href="/help/merge">
2177 <a href="/help/merge">
2177 merge
2178 merge
2178 </a>
2179 </a>
2179 </td><td>
2180 </td><td>
2180 merge another revision into working directory
2181 merge another revision into working directory
2181 </td></tr>
2182 </td></tr>
2182 <tr><td>
2183 <tr><td>
2183 <a href="/help/pull">
2184 <a href="/help/pull">
2184 pull
2185 pull
2185 </a>
2186 </a>
2186 </td><td>
2187 </td><td>
2187 pull changes from the specified source
2188 pull changes from the specified source
2188 </td></tr>
2189 </td></tr>
2189 <tr><td>
2190 <tr><td>
2190 <a href="/help/push">
2191 <a href="/help/push">
2191 push
2192 push
2192 </a>
2193 </a>
2193 </td><td>
2194 </td><td>
2194 push changes to the specified destination
2195 push changes to the specified destination
2195 </td></tr>
2196 </td></tr>
2196 <tr><td>
2197 <tr><td>
2197 <a href="/help/remove">
2198 <a href="/help/remove">
2198 remove
2199 remove
2199 </a>
2200 </a>
2200 </td><td>
2201 </td><td>
2201 remove the specified files on the next commit
2202 remove the specified files on the next commit
2202 </td></tr>
2203 </td></tr>
2203 <tr><td>
2204 <tr><td>
2204 <a href="/help/serve">
2205 <a href="/help/serve">
2205 serve
2206 serve
2206 </a>
2207 </a>
2207 </td><td>
2208 </td><td>
2208 start stand-alone webserver
2209 start stand-alone webserver
2209 </td></tr>
2210 </td></tr>
2210 <tr><td>
2211 <tr><td>
2211 <a href="/help/status">
2212 <a href="/help/status">
2212 status
2213 status
2213 </a>
2214 </a>
2214 </td><td>
2215 </td><td>
2215 show changed files in the working directory
2216 show changed files in the working directory
2216 </td></tr>
2217 </td></tr>
2217 <tr><td>
2218 <tr><td>
2218 <a href="/help/summary">
2219 <a href="/help/summary">
2219 summary
2220 summary
2220 </a>
2221 </a>
2221 </td><td>
2222 </td><td>
2222 summarize working directory state
2223 summarize working directory state
2223 </td></tr>
2224 </td></tr>
2224 <tr><td>
2225 <tr><td>
2225 <a href="/help/update">
2226 <a href="/help/update">
2226 update
2227 update
2227 </a>
2228 </a>
2228 </td><td>
2229 </td><td>
2229 update working directory (or switch revisions)
2230 update working directory (or switch revisions)
2230 </td></tr>
2231 </td></tr>
2231
2232
2232
2233
2233
2234
2234 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
2235 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
2235
2236
2236 <tr><td>
2237 <tr><td>
2237 <a href="/help/addremove">
2238 <a href="/help/addremove">
2238 addremove
2239 addremove
2239 </a>
2240 </a>
2240 </td><td>
2241 </td><td>
2241 add all new files, delete all missing files
2242 add all new files, delete all missing files
2242 </td></tr>
2243 </td></tr>
2243 <tr><td>
2244 <tr><td>
2244 <a href="/help/archive">
2245 <a href="/help/archive">
2245 archive
2246 archive
2246 </a>
2247 </a>
2247 </td><td>
2248 </td><td>
2248 create an unversioned archive of a repository revision
2249 create an unversioned archive of a repository revision
2249 </td></tr>
2250 </td></tr>
2250 <tr><td>
2251 <tr><td>
2251 <a href="/help/backout">
2252 <a href="/help/backout">
2252 backout
2253 backout
2253 </a>
2254 </a>
2254 </td><td>
2255 </td><td>
2255 reverse effect of earlier changeset
2256 reverse effect of earlier changeset
2256 </td></tr>
2257 </td></tr>
2257 <tr><td>
2258 <tr><td>
2258 <a href="/help/bisect">
2259 <a href="/help/bisect">
2259 bisect
2260 bisect
2260 </a>
2261 </a>
2261 </td><td>
2262 </td><td>
2262 subdivision search of changesets
2263 subdivision search of changesets
2263 </td></tr>
2264 </td></tr>
2264 <tr><td>
2265 <tr><td>
2265 <a href="/help/bookmarks">
2266 <a href="/help/bookmarks">
2266 bookmarks
2267 bookmarks
2267 </a>
2268 </a>
2268 </td><td>
2269 </td><td>
2269 create a new bookmark or list existing bookmarks
2270 create a new bookmark or list existing bookmarks
2270 </td></tr>
2271 </td></tr>
2271 <tr><td>
2272 <tr><td>
2272 <a href="/help/branch">
2273 <a href="/help/branch">
2273 branch
2274 branch
2274 </a>
2275 </a>
2275 </td><td>
2276 </td><td>
2276 set or show the current branch name
2277 set or show the current branch name
2277 </td></tr>
2278 </td></tr>
2278 <tr><td>
2279 <tr><td>
2279 <a href="/help/branches">
2280 <a href="/help/branches">
2280 branches
2281 branches
2281 </a>
2282 </a>
2282 </td><td>
2283 </td><td>
2283 list repository named branches
2284 list repository named branches
2284 </td></tr>
2285 </td></tr>
2285 <tr><td>
2286 <tr><td>
2286 <a href="/help/bundle">
2287 <a href="/help/bundle">
2287 bundle
2288 bundle
2288 </a>
2289 </a>
2289 </td><td>
2290 </td><td>
2290 create a bundle file
2291 create a bundle file
2291 </td></tr>
2292 </td></tr>
2292 <tr><td>
2293 <tr><td>
2293 <a href="/help/cat">
2294 <a href="/help/cat">
2294 cat
2295 cat
2295 </a>
2296 </a>
2296 </td><td>
2297 </td><td>
2297 output the current or given revision of files
2298 output the current or given revision of files
2298 </td></tr>
2299 </td></tr>
2299 <tr><td>
2300 <tr><td>
2300 <a href="/help/config">
2301 <a href="/help/config">
2301 config
2302 config
2302 </a>
2303 </a>
2303 </td><td>
2304 </td><td>
2304 show combined config settings from all hgrc files
2305 show combined config settings from all hgrc files
2305 </td></tr>
2306 </td></tr>
2306 <tr><td>
2307 <tr><td>
2307 <a href="/help/copy">
2308 <a href="/help/copy">
2308 copy
2309 copy
2309 </a>
2310 </a>
2310 </td><td>
2311 </td><td>
2311 mark files as copied for the next commit
2312 mark files as copied for the next commit
2312 </td></tr>
2313 </td></tr>
2313 <tr><td>
2314 <tr><td>
2314 <a href="/help/files">
2315 <a href="/help/files">
2315 files
2316 files
2316 </a>
2317 </a>
2317 </td><td>
2318 </td><td>
2318 list tracked files
2319 list tracked files
2319 </td></tr>
2320 </td></tr>
2320 <tr><td>
2321 <tr><td>
2321 <a href="/help/graft">
2322 <a href="/help/graft">
2322 graft
2323 graft
2323 </a>
2324 </a>
2324 </td><td>
2325 </td><td>
2325 copy changes from other branches onto the current branch
2326 copy changes from other branches onto the current branch
2326 </td></tr>
2327 </td></tr>
2327 <tr><td>
2328 <tr><td>
2328 <a href="/help/grep">
2329 <a href="/help/grep">
2329 grep
2330 grep
2330 </a>
2331 </a>
2331 </td><td>
2332 </td><td>
2332 search revision history for a pattern in specified files
2333 search revision history for a pattern in specified files
2333 </td></tr>
2334 </td></tr>
2334 <tr><td>
2335 <tr><td>
2335 <a href="/help/heads">
2336 <a href="/help/heads">
2336 heads
2337 heads
2337 </a>
2338 </a>
2338 </td><td>
2339 </td><td>
2339 show branch heads
2340 show branch heads
2340 </td></tr>
2341 </td></tr>
2341 <tr><td>
2342 <tr><td>
2342 <a href="/help/help">
2343 <a href="/help/help">
2343 help
2344 help
2344 </a>
2345 </a>
2345 </td><td>
2346 </td><td>
2346 show help for a given topic or a help overview
2347 show help for a given topic or a help overview
2347 </td></tr>
2348 </td></tr>
2348 <tr><td>
2349 <tr><td>
2349 <a href="/help/hgalias">
2350 <a href="/help/hgalias">
2350 hgalias
2351 hgalias
2351 </a>
2352 </a>
2352 </td><td>
2353 </td><td>
2353 summarize working directory state
2354 summarize working directory state
2354 </td></tr>
2355 </td></tr>
2355 <tr><td>
2356 <tr><td>
2356 <a href="/help/identify">
2357 <a href="/help/identify">
2357 identify
2358 identify
2358 </a>
2359 </a>
2359 </td><td>
2360 </td><td>
2360 identify the working directory or specified revision
2361 identify the working directory or specified revision
2361 </td></tr>
2362 </td></tr>
2362 <tr><td>
2363 <tr><td>
2363 <a href="/help/import">
2364 <a href="/help/import">
2364 import
2365 import
2365 </a>
2366 </a>
2366 </td><td>
2367 </td><td>
2367 import an ordered set of patches
2368 import an ordered set of patches
2368 </td></tr>
2369 </td></tr>
2369 <tr><td>
2370 <tr><td>
2370 <a href="/help/incoming">
2371 <a href="/help/incoming">
2371 incoming
2372 incoming
2372 </a>
2373 </a>
2373 </td><td>
2374 </td><td>
2374 show new changesets found in source
2375 show new changesets found in source
2375 </td></tr>
2376 </td></tr>
2376 <tr><td>
2377 <tr><td>
2377 <a href="/help/manifest">
2378 <a href="/help/manifest">
2378 manifest
2379 manifest
2379 </a>
2380 </a>
2380 </td><td>
2381 </td><td>
2381 output the current or given revision of the project manifest
2382 output the current or given revision of the project manifest
2382 </td></tr>
2383 </td></tr>
2383 <tr><td>
2384 <tr><td>
2384 <a href="/help/nohelp">
2385 <a href="/help/nohelp">
2385 nohelp
2386 nohelp
2386 </a>
2387 </a>
2387 </td><td>
2388 </td><td>
2388 (no help text available)
2389 (no help text available)
2389 </td></tr>
2390 </td></tr>
2390 <tr><td>
2391 <tr><td>
2391 <a href="/help/outgoing">
2392 <a href="/help/outgoing">
2392 outgoing
2393 outgoing
2393 </a>
2394 </a>
2394 </td><td>
2395 </td><td>
2395 show changesets not found in the destination
2396 show changesets not found in the destination
2396 </td></tr>
2397 </td></tr>
2397 <tr><td>
2398 <tr><td>
2398 <a href="/help/paths">
2399 <a href="/help/paths">
2399 paths
2400 paths
2400 </a>
2401 </a>
2401 </td><td>
2402 </td><td>
2402 show aliases for remote repositories
2403 show aliases for remote repositories
2403 </td></tr>
2404 </td></tr>
2404 <tr><td>
2405 <tr><td>
2405 <a href="/help/phase">
2406 <a href="/help/phase">
2406 phase
2407 phase
2407 </a>
2408 </a>
2408 </td><td>
2409 </td><td>
2409 set or show the current phase name
2410 set or show the current phase name
2410 </td></tr>
2411 </td></tr>
2411 <tr><td>
2412 <tr><td>
2412 <a href="/help/recover">
2413 <a href="/help/recover">
2413 recover
2414 recover
2414 </a>
2415 </a>
2415 </td><td>
2416 </td><td>
2416 roll back an interrupted transaction
2417 roll back an interrupted transaction
2417 </td></tr>
2418 </td></tr>
2418 <tr><td>
2419 <tr><td>
2419 <a href="/help/rename">
2420 <a href="/help/rename">
2420 rename
2421 rename
2421 </a>
2422 </a>
2422 </td><td>
2423 </td><td>
2423 rename files; equivalent of copy + remove
2424 rename files; equivalent of copy + remove
2424 </td></tr>
2425 </td></tr>
2425 <tr><td>
2426 <tr><td>
2426 <a href="/help/resolve">
2427 <a href="/help/resolve">
2427 resolve
2428 resolve
2428 </a>
2429 </a>
2429 </td><td>
2430 </td><td>
2430 redo merges or set/view the merge status of files
2431 redo merges or set/view the merge status of files
2431 </td></tr>
2432 </td></tr>
2432 <tr><td>
2433 <tr><td>
2433 <a href="/help/revert">
2434 <a href="/help/revert">
2434 revert
2435 revert
2435 </a>
2436 </a>
2436 </td><td>
2437 </td><td>
2437 restore files to their checkout state
2438 restore files to their checkout state
2438 </td></tr>
2439 </td></tr>
2439 <tr><td>
2440 <tr><td>
2440 <a href="/help/root">
2441 <a href="/help/root">
2441 root
2442 root
2442 </a>
2443 </a>
2443 </td><td>
2444 </td><td>
2444 print the root (top) of the current working directory
2445 print the root (top) of the current working directory
2445 </td></tr>
2446 </td></tr>
2446 <tr><td>
2447 <tr><td>
2447 <a href="/help/shellalias">
2448 <a href="/help/shellalias">
2448 shellalias
2449 shellalias
2449 </a>
2450 </a>
2450 </td><td>
2451 </td><td>
2451 (no help text available)
2452 (no help text available)
2452 </td></tr>
2453 </td></tr>
2453 <tr><td>
2454 <tr><td>
2454 <a href="/help/tag">
2455 <a href="/help/tag">
2455 tag
2456 tag
2456 </a>
2457 </a>
2457 </td><td>
2458 </td><td>
2458 add one or more tags for the current or given revision
2459 add one or more tags for the current or given revision
2459 </td></tr>
2460 </td></tr>
2460 <tr><td>
2461 <tr><td>
2461 <a href="/help/tags">
2462 <a href="/help/tags">
2462 tags
2463 tags
2463 </a>
2464 </a>
2464 </td><td>
2465 </td><td>
2465 list repository tags
2466 list repository tags
2466 </td></tr>
2467 </td></tr>
2467 <tr><td>
2468 <tr><td>
2468 <a href="/help/unbundle">
2469 <a href="/help/unbundle">
2469 unbundle
2470 unbundle
2470 </a>
2471 </a>
2471 </td><td>
2472 </td><td>
2472 apply one or more bundle files
2473 apply one or more bundle files
2473 </td></tr>
2474 </td></tr>
2474 <tr><td>
2475 <tr><td>
2475 <a href="/help/verify">
2476 <a href="/help/verify">
2476 verify
2477 verify
2477 </a>
2478 </a>
2478 </td><td>
2479 </td><td>
2479 verify the integrity of the repository
2480 verify the integrity of the repository
2480 </td></tr>
2481 </td></tr>
2481 <tr><td>
2482 <tr><td>
2482 <a href="/help/version">
2483 <a href="/help/version">
2483 version
2484 version
2484 </a>
2485 </a>
2485 </td><td>
2486 </td><td>
2486 output version and copyright information
2487 output version and copyright information
2487 </td></tr>
2488 </td></tr>
2488
2489
2489
2490
2490 </table>
2491 </table>
2491 </div>
2492 </div>
2492 </div>
2493 </div>
2493
2494
2494
2495
2495
2496
2496 </body>
2497 </body>
2497 </html>
2498 </html>
2498
2499
2499
2500
2500 $ get-with-headers.py $LOCALIP:$HGPORT "help/add"
2501 $ get-with-headers.py $LOCALIP:$HGPORT "help/add"
2501 200 Script output follows
2502 200 Script output follows
2502
2503
2503 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2504 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2504 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2505 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2505 <head>
2506 <head>
2506 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2507 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2507 <meta name="robots" content="index, nofollow" />
2508 <meta name="robots" content="index, nofollow" />
2508 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2509 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2509 <script type="text/javascript" src="/static/mercurial.js"></script>
2510 <script type="text/javascript" src="/static/mercurial.js"></script>
2510
2511
2511 <title>Help: add</title>
2512 <title>Help: add</title>
2512 </head>
2513 </head>
2513 <body>
2514 <body>
2514
2515
2515 <div class="container">
2516 <div class="container">
2516 <div class="menu">
2517 <div class="menu">
2517 <div class="logo">
2518 <div class="logo">
2518 <a href="https://mercurial-scm.org/">
2519 <a href="https://mercurial-scm.org/">
2519 <img src="/static/hglogo.png" alt="mercurial" /></a>
2520 <img src="/static/hglogo.png" alt="mercurial" /></a>
2520 </div>
2521 </div>
2521 <ul>
2522 <ul>
2522 <li><a href="/shortlog">log</a></li>
2523 <li><a href="/shortlog">log</a></li>
2523 <li><a href="/graph">graph</a></li>
2524 <li><a href="/graph">graph</a></li>
2524 <li><a href="/tags">tags</a></li>
2525 <li><a href="/tags">tags</a></li>
2525 <li><a href="/bookmarks">bookmarks</a></li>
2526 <li><a href="/bookmarks">bookmarks</a></li>
2526 <li><a href="/branches">branches</a></li>
2527 <li><a href="/branches">branches</a></li>
2527 </ul>
2528 </ul>
2528 <ul>
2529 <ul>
2529 <li class="active"><a href="/help">help</a></li>
2530 <li class="active"><a href="/help">help</a></li>
2530 </ul>
2531 </ul>
2531 </div>
2532 </div>
2532
2533
2533 <div class="main">
2534 <div class="main">
2534 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2535 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2535 <h3>Help: add</h3>
2536 <h3>Help: add</h3>
2536
2537
2537 <form class="search" action="/log">
2538 <form class="search" action="/log">
2538
2539
2539 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2540 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2540 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2541 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2541 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2542 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2542 </form>
2543 </form>
2543 <div id="doc">
2544 <div id="doc">
2544 <p>
2545 <p>
2545 hg add [OPTION]... [FILE]...
2546 hg add [OPTION]... [FILE]...
2546 </p>
2547 </p>
2547 <p>
2548 <p>
2548 add the specified files on the next commit
2549 add the specified files on the next commit
2549 </p>
2550 </p>
2550 <p>
2551 <p>
2551 Schedule files to be version controlled and added to the
2552 Schedule files to be version controlled and added to the
2552 repository.
2553 repository.
2553 </p>
2554 </p>
2554 <p>
2555 <p>
2555 The files will be added to the repository at the next commit. To
2556 The files will be added to the repository at the next commit. To
2556 undo an add before that, see 'hg forget'.
2557 undo an add before that, see 'hg forget'.
2557 </p>
2558 </p>
2558 <p>
2559 <p>
2559 If no names are given, add all files to the repository (except
2560 If no names are given, add all files to the repository (except
2560 files matching &quot;.hgignore&quot;).
2561 files matching &quot;.hgignore&quot;).
2561 </p>
2562 </p>
2562 <p>
2563 <p>
2563 Examples:
2564 Examples:
2564 </p>
2565 </p>
2565 <ul>
2566 <ul>
2566 <li> New (unknown) files are added automatically by 'hg add':
2567 <li> New (unknown) files are added automatically by 'hg add':
2567 <pre>
2568 <pre>
2568 \$ ls (re)
2569 \$ ls (re)
2569 foo.c
2570 foo.c
2570 \$ hg status (re)
2571 \$ hg status (re)
2571 ? foo.c
2572 ? foo.c
2572 \$ hg add (re)
2573 \$ hg add (re)
2573 adding foo.c
2574 adding foo.c
2574 \$ hg status (re)
2575 \$ hg status (re)
2575 A foo.c
2576 A foo.c
2576 </pre>
2577 </pre>
2577 <li> Specific files to be added can be specified:
2578 <li> Specific files to be added can be specified:
2578 <pre>
2579 <pre>
2579 \$ ls (re)
2580 \$ ls (re)
2580 bar.c foo.c
2581 bar.c foo.c
2581 \$ hg status (re)
2582 \$ hg status (re)
2582 ? bar.c
2583 ? bar.c
2583 ? foo.c
2584 ? foo.c
2584 \$ hg add bar.c (re)
2585 \$ hg add bar.c (re)
2585 \$ hg status (re)
2586 \$ hg status (re)
2586 A bar.c
2587 A bar.c
2587 ? foo.c
2588 ? foo.c
2588 </pre>
2589 </pre>
2589 </ul>
2590 </ul>
2590 <p>
2591 <p>
2591 Returns 0 if all files are successfully added.
2592 Returns 0 if all files are successfully added.
2592 </p>
2593 </p>
2593 <p>
2594 <p>
2594 options ([+] can be repeated):
2595 options ([+] can be repeated):
2595 </p>
2596 </p>
2596 <table>
2597 <table>
2597 <tr><td>-I</td>
2598 <tr><td>-I</td>
2598 <td>--include PATTERN [+]</td>
2599 <td>--include PATTERN [+]</td>
2599 <td>include names matching the given patterns</td></tr>
2600 <td>include names matching the given patterns</td></tr>
2600 <tr><td>-X</td>
2601 <tr><td>-X</td>
2601 <td>--exclude PATTERN [+]</td>
2602 <td>--exclude PATTERN [+]</td>
2602 <td>exclude names matching the given patterns</td></tr>
2603 <td>exclude names matching the given patterns</td></tr>
2603 <tr><td>-S</td>
2604 <tr><td>-S</td>
2604 <td>--subrepos</td>
2605 <td>--subrepos</td>
2605 <td>recurse into subrepositories</td></tr>
2606 <td>recurse into subrepositories</td></tr>
2606 <tr><td>-n</td>
2607 <tr><td>-n</td>
2607 <td>--dry-run</td>
2608 <td>--dry-run</td>
2608 <td>do not perform actions, just print output</td></tr>
2609 <td>do not perform actions, just print output</td></tr>
2609 </table>
2610 </table>
2610 <p>
2611 <p>
2611 global options ([+] can be repeated):
2612 global options ([+] can be repeated):
2612 </p>
2613 </p>
2613 <table>
2614 <table>
2614 <tr><td>-R</td>
2615 <tr><td>-R</td>
2615 <td>--repository REPO</td>
2616 <td>--repository REPO</td>
2616 <td>repository root directory or name of overlay bundle file</td></tr>
2617 <td>repository root directory or name of overlay bundle file</td></tr>
2617 <tr><td></td>
2618 <tr><td></td>
2618 <td>--cwd DIR</td>
2619 <td>--cwd DIR</td>
2619 <td>change working directory</td></tr>
2620 <td>change working directory</td></tr>
2620 <tr><td>-y</td>
2621 <tr><td>-y</td>
2621 <td>--noninteractive</td>
2622 <td>--noninteractive</td>
2622 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2623 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2623 <tr><td>-q</td>
2624 <tr><td>-q</td>
2624 <td>--quiet</td>
2625 <td>--quiet</td>
2625 <td>suppress output</td></tr>
2626 <td>suppress output</td></tr>
2626 <tr><td>-v</td>
2627 <tr><td>-v</td>
2627 <td>--verbose</td>
2628 <td>--verbose</td>
2628 <td>enable additional output</td></tr>
2629 <td>enable additional output</td></tr>
2629 <tr><td></td>
2630 <tr><td></td>
2630 <td>--color TYPE</td>
2631 <td>--color TYPE</td>
2631 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2632 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2632 <tr><td></td>
2633 <tr><td></td>
2633 <td>--config CONFIG [+]</td>
2634 <td>--config CONFIG [+]</td>
2634 <td>set/override config option (use 'section.name=value')</td></tr>
2635 <td>set/override config option (use 'section.name=value')</td></tr>
2635 <tr><td></td>
2636 <tr><td></td>
2636 <td>--debug</td>
2637 <td>--debug</td>
2637 <td>enable debugging output</td></tr>
2638 <td>enable debugging output</td></tr>
2638 <tr><td></td>
2639 <tr><td></td>
2639 <td>--debugger</td>
2640 <td>--debugger</td>
2640 <td>start debugger</td></tr>
2641 <td>start debugger</td></tr>
2641 <tr><td></td>
2642 <tr><td></td>
2642 <td>--encoding ENCODE</td>
2643 <td>--encoding ENCODE</td>
2643 <td>set the charset encoding (default: ascii)</td></tr>
2644 <td>set the charset encoding (default: ascii)</td></tr>
2644 <tr><td></td>
2645 <tr><td></td>
2645 <td>--encodingmode MODE</td>
2646 <td>--encodingmode MODE</td>
2646 <td>set the charset encoding mode (default: strict)</td></tr>
2647 <td>set the charset encoding mode (default: strict)</td></tr>
2647 <tr><td></td>
2648 <tr><td></td>
2648 <td>--traceback</td>
2649 <td>--traceback</td>
2649 <td>always print a traceback on exception</td></tr>
2650 <td>always print a traceback on exception</td></tr>
2650 <tr><td></td>
2651 <tr><td></td>
2651 <td>--time</td>
2652 <td>--time</td>
2652 <td>time how long the command takes</td></tr>
2653 <td>time how long the command takes</td></tr>
2653 <tr><td></td>
2654 <tr><td></td>
2654 <td>--profile</td>
2655 <td>--profile</td>
2655 <td>print command execution profile</td></tr>
2656 <td>print command execution profile</td></tr>
2656 <tr><td></td>
2657 <tr><td></td>
2657 <td>--version</td>
2658 <td>--version</td>
2658 <td>output version information and exit</td></tr>
2659 <td>output version information and exit</td></tr>
2659 <tr><td>-h</td>
2660 <tr><td>-h</td>
2660 <td>--help</td>
2661 <td>--help</td>
2661 <td>display help and exit</td></tr>
2662 <td>display help and exit</td></tr>
2662 <tr><td></td>
2663 <tr><td></td>
2663 <td>--hidden</td>
2664 <td>--hidden</td>
2664 <td>consider hidden changesets</td></tr>
2665 <td>consider hidden changesets</td></tr>
2665 <tr><td></td>
2666 <tr><td></td>
2666 <td>--pager TYPE</td>
2667 <td>--pager TYPE</td>
2667 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2668 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2668 </table>
2669 </table>
2669
2670
2670 </div>
2671 </div>
2671 </div>
2672 </div>
2672 </div>
2673 </div>
2673
2674
2674
2675
2675
2676
2676 </body>
2677 </body>
2677 </html>
2678 </html>
2678
2679
2679
2680
2680 $ get-with-headers.py $LOCALIP:$HGPORT "help/remove"
2681 $ get-with-headers.py $LOCALIP:$HGPORT "help/remove"
2681 200 Script output follows
2682 200 Script output follows
2682
2683
2683 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2684 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2684 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2685 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2685 <head>
2686 <head>
2686 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2687 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2687 <meta name="robots" content="index, nofollow" />
2688 <meta name="robots" content="index, nofollow" />
2688 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2689 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2689 <script type="text/javascript" src="/static/mercurial.js"></script>
2690 <script type="text/javascript" src="/static/mercurial.js"></script>
2690
2691
2691 <title>Help: remove</title>
2692 <title>Help: remove</title>
2692 </head>
2693 </head>
2693 <body>
2694 <body>
2694
2695
2695 <div class="container">
2696 <div class="container">
2696 <div class="menu">
2697 <div class="menu">
2697 <div class="logo">
2698 <div class="logo">
2698 <a href="https://mercurial-scm.org/">
2699 <a href="https://mercurial-scm.org/">
2699 <img src="/static/hglogo.png" alt="mercurial" /></a>
2700 <img src="/static/hglogo.png" alt="mercurial" /></a>
2700 </div>
2701 </div>
2701 <ul>
2702 <ul>
2702 <li><a href="/shortlog">log</a></li>
2703 <li><a href="/shortlog">log</a></li>
2703 <li><a href="/graph">graph</a></li>
2704 <li><a href="/graph">graph</a></li>
2704 <li><a href="/tags">tags</a></li>
2705 <li><a href="/tags">tags</a></li>
2705 <li><a href="/bookmarks">bookmarks</a></li>
2706 <li><a href="/bookmarks">bookmarks</a></li>
2706 <li><a href="/branches">branches</a></li>
2707 <li><a href="/branches">branches</a></li>
2707 </ul>
2708 </ul>
2708 <ul>
2709 <ul>
2709 <li class="active"><a href="/help">help</a></li>
2710 <li class="active"><a href="/help">help</a></li>
2710 </ul>
2711 </ul>
2711 </div>
2712 </div>
2712
2713
2713 <div class="main">
2714 <div class="main">
2714 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2715 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2715 <h3>Help: remove</h3>
2716 <h3>Help: remove</h3>
2716
2717
2717 <form class="search" action="/log">
2718 <form class="search" action="/log">
2718
2719
2719 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2720 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2720 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2721 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2721 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2722 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2722 </form>
2723 </form>
2723 <div id="doc">
2724 <div id="doc">
2724 <p>
2725 <p>
2725 hg remove [OPTION]... FILE...
2726 hg remove [OPTION]... FILE...
2726 </p>
2727 </p>
2727 <p>
2728 <p>
2728 aliases: rm
2729 aliases: rm
2729 </p>
2730 </p>
2730 <p>
2731 <p>
2731 remove the specified files on the next commit
2732 remove the specified files on the next commit
2732 </p>
2733 </p>
2733 <p>
2734 <p>
2734 Schedule the indicated files for removal from the current branch.
2735 Schedule the indicated files for removal from the current branch.
2735 </p>
2736 </p>
2736 <p>
2737 <p>
2737 This command schedules the files to be removed at the next commit.
2738 This command schedules the files to be removed at the next commit.
2738 To undo a remove before that, see 'hg revert'. To undo added
2739 To undo a remove before that, see 'hg revert'. To undo added
2739 files, see 'hg forget'.
2740 files, see 'hg forget'.
2740 </p>
2741 </p>
2741 <p>
2742 <p>
2742 -A/--after can be used to remove only files that have already
2743 -A/--after can be used to remove only files that have already
2743 been deleted, -f/--force can be used to force deletion, and -Af
2744 been deleted, -f/--force can be used to force deletion, and -Af
2744 can be used to remove files from the next revision without
2745 can be used to remove files from the next revision without
2745 deleting them from the working directory.
2746 deleting them from the working directory.
2746 </p>
2747 </p>
2747 <p>
2748 <p>
2748 The following table details the behavior of remove for different
2749 The following table details the behavior of remove for different
2749 file states (columns) and option combinations (rows). The file
2750 file states (columns) and option combinations (rows). The file
2750 states are Added [A], Clean [C], Modified [M] and Missing [!]
2751 states are Added [A], Clean [C], Modified [M] and Missing [!]
2751 (as reported by 'hg status'). The actions are Warn, Remove
2752 (as reported by 'hg status'). The actions are Warn, Remove
2752 (from branch) and Delete (from disk):
2753 (from branch) and Delete (from disk):
2753 </p>
2754 </p>
2754 <table>
2755 <table>
2755 <tr><td>opt/state</td>
2756 <tr><td>opt/state</td>
2756 <td>A</td>
2757 <td>A</td>
2757 <td>C</td>
2758 <td>C</td>
2758 <td>M</td>
2759 <td>M</td>
2759 <td>!</td></tr>
2760 <td>!</td></tr>
2760 <tr><td>none</td>
2761 <tr><td>none</td>
2761 <td>W</td>
2762 <td>W</td>
2762 <td>RD</td>
2763 <td>RD</td>
2763 <td>W</td>
2764 <td>W</td>
2764 <td>R</td></tr>
2765 <td>R</td></tr>
2765 <tr><td>-f</td>
2766 <tr><td>-f</td>
2766 <td>R</td>
2767 <td>R</td>
2767 <td>RD</td>
2768 <td>RD</td>
2768 <td>RD</td>
2769 <td>RD</td>
2769 <td>R</td></tr>
2770 <td>R</td></tr>
2770 <tr><td>-A</td>
2771 <tr><td>-A</td>
2771 <td>W</td>
2772 <td>W</td>
2772 <td>W</td>
2773 <td>W</td>
2773 <td>W</td>
2774 <td>W</td>
2774 <td>R</td></tr>
2775 <td>R</td></tr>
2775 <tr><td>-Af</td>
2776 <tr><td>-Af</td>
2776 <td>R</td>
2777 <td>R</td>
2777 <td>R</td>
2778 <td>R</td>
2778 <td>R</td>
2779 <td>R</td>
2779 <td>R</td></tr>
2780 <td>R</td></tr>
2780 </table>
2781 </table>
2781 <p>
2782 <p>
2782 <b>Note:</b>
2783 <b>Note:</b>
2783 </p>
2784 </p>
2784 <p>
2785 <p>
2785 'hg remove' never deletes files in Added [A] state from the
2786 'hg remove' never deletes files in Added [A] state from the
2786 working directory, not even if &quot;--force&quot; is specified.
2787 working directory, not even if &quot;--force&quot; is specified.
2787 </p>
2788 </p>
2788 <p>
2789 <p>
2789 Returns 0 on success, 1 if any warnings encountered.
2790 Returns 0 on success, 1 if any warnings encountered.
2790 </p>
2791 </p>
2791 <p>
2792 <p>
2792 options ([+] can be repeated):
2793 options ([+] can be repeated):
2793 </p>
2794 </p>
2794 <table>
2795 <table>
2795 <tr><td>-A</td>
2796 <tr><td>-A</td>
2796 <td>--after</td>
2797 <td>--after</td>
2797 <td>record delete for missing files</td></tr>
2798 <td>record delete for missing files</td></tr>
2798 <tr><td>-f</td>
2799 <tr><td>-f</td>
2799 <td>--force</td>
2800 <td>--force</td>
2800 <td>forget added files, delete modified files</td></tr>
2801 <td>forget added files, delete modified files</td></tr>
2801 <tr><td>-S</td>
2802 <tr><td>-S</td>
2802 <td>--subrepos</td>
2803 <td>--subrepos</td>
2803 <td>recurse into subrepositories</td></tr>
2804 <td>recurse into subrepositories</td></tr>
2804 <tr><td>-I</td>
2805 <tr><td>-I</td>
2805 <td>--include PATTERN [+]</td>
2806 <td>--include PATTERN [+]</td>
2806 <td>include names matching the given patterns</td></tr>
2807 <td>include names matching the given patterns</td></tr>
2807 <tr><td>-X</td>
2808 <tr><td>-X</td>
2808 <td>--exclude PATTERN [+]</td>
2809 <td>--exclude PATTERN [+]</td>
2809 <td>exclude names matching the given patterns</td></tr>
2810 <td>exclude names matching the given patterns</td></tr>
2810 </table>
2811 </table>
2811 <p>
2812 <p>
2812 global options ([+] can be repeated):
2813 global options ([+] can be repeated):
2813 </p>
2814 </p>
2814 <table>
2815 <table>
2815 <tr><td>-R</td>
2816 <tr><td>-R</td>
2816 <td>--repository REPO</td>
2817 <td>--repository REPO</td>
2817 <td>repository root directory or name of overlay bundle file</td></tr>
2818 <td>repository root directory or name of overlay bundle file</td></tr>
2818 <tr><td></td>
2819 <tr><td></td>
2819 <td>--cwd DIR</td>
2820 <td>--cwd DIR</td>
2820 <td>change working directory</td></tr>
2821 <td>change working directory</td></tr>
2821 <tr><td>-y</td>
2822 <tr><td>-y</td>
2822 <td>--noninteractive</td>
2823 <td>--noninteractive</td>
2823 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2824 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2824 <tr><td>-q</td>
2825 <tr><td>-q</td>
2825 <td>--quiet</td>
2826 <td>--quiet</td>
2826 <td>suppress output</td></tr>
2827 <td>suppress output</td></tr>
2827 <tr><td>-v</td>
2828 <tr><td>-v</td>
2828 <td>--verbose</td>
2829 <td>--verbose</td>
2829 <td>enable additional output</td></tr>
2830 <td>enable additional output</td></tr>
2830 <tr><td></td>
2831 <tr><td></td>
2831 <td>--color TYPE</td>
2832 <td>--color TYPE</td>
2832 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2833 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2833 <tr><td></td>
2834 <tr><td></td>
2834 <td>--config CONFIG [+]</td>
2835 <td>--config CONFIG [+]</td>
2835 <td>set/override config option (use 'section.name=value')</td></tr>
2836 <td>set/override config option (use 'section.name=value')</td></tr>
2836 <tr><td></td>
2837 <tr><td></td>
2837 <td>--debug</td>
2838 <td>--debug</td>
2838 <td>enable debugging output</td></tr>
2839 <td>enable debugging output</td></tr>
2839 <tr><td></td>
2840 <tr><td></td>
2840 <td>--debugger</td>
2841 <td>--debugger</td>
2841 <td>start debugger</td></tr>
2842 <td>start debugger</td></tr>
2842 <tr><td></td>
2843 <tr><td></td>
2843 <td>--encoding ENCODE</td>
2844 <td>--encoding ENCODE</td>
2844 <td>set the charset encoding (default: ascii)</td></tr>
2845 <td>set the charset encoding (default: ascii)</td></tr>
2845 <tr><td></td>
2846 <tr><td></td>
2846 <td>--encodingmode MODE</td>
2847 <td>--encodingmode MODE</td>
2847 <td>set the charset encoding mode (default: strict)</td></tr>
2848 <td>set the charset encoding mode (default: strict)</td></tr>
2848 <tr><td></td>
2849 <tr><td></td>
2849 <td>--traceback</td>
2850 <td>--traceback</td>
2850 <td>always print a traceback on exception</td></tr>
2851 <td>always print a traceback on exception</td></tr>
2851 <tr><td></td>
2852 <tr><td></td>
2852 <td>--time</td>
2853 <td>--time</td>
2853 <td>time how long the command takes</td></tr>
2854 <td>time how long the command takes</td></tr>
2854 <tr><td></td>
2855 <tr><td></td>
2855 <td>--profile</td>
2856 <td>--profile</td>
2856 <td>print command execution profile</td></tr>
2857 <td>print command execution profile</td></tr>
2857 <tr><td></td>
2858 <tr><td></td>
2858 <td>--version</td>
2859 <td>--version</td>
2859 <td>output version information and exit</td></tr>
2860 <td>output version information and exit</td></tr>
2860 <tr><td>-h</td>
2861 <tr><td>-h</td>
2861 <td>--help</td>
2862 <td>--help</td>
2862 <td>display help and exit</td></tr>
2863 <td>display help and exit</td></tr>
2863 <tr><td></td>
2864 <tr><td></td>
2864 <td>--hidden</td>
2865 <td>--hidden</td>
2865 <td>consider hidden changesets</td></tr>
2866 <td>consider hidden changesets</td></tr>
2866 <tr><td></td>
2867 <tr><td></td>
2867 <td>--pager TYPE</td>
2868 <td>--pager TYPE</td>
2868 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2869 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2869 </table>
2870 </table>
2870
2871
2871 </div>
2872 </div>
2872 </div>
2873 </div>
2873 </div>
2874 </div>
2874
2875
2875
2876
2876
2877
2877 </body>
2878 </body>
2878 </html>
2879 </html>
2879
2880
2880
2881
2881 $ get-with-headers.py $LOCALIP:$HGPORT "help/dates"
2882 $ get-with-headers.py $LOCALIP:$HGPORT "help/dates"
2882 200 Script output follows
2883 200 Script output follows
2883
2884
2884 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2885 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2885 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2886 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2886 <head>
2887 <head>
2887 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2888 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2888 <meta name="robots" content="index, nofollow" />
2889 <meta name="robots" content="index, nofollow" />
2889 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2890 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2890 <script type="text/javascript" src="/static/mercurial.js"></script>
2891 <script type="text/javascript" src="/static/mercurial.js"></script>
2891
2892
2892 <title>Help: dates</title>
2893 <title>Help: dates</title>
2893 </head>
2894 </head>
2894 <body>
2895 <body>
2895
2896
2896 <div class="container">
2897 <div class="container">
2897 <div class="menu">
2898 <div class="menu">
2898 <div class="logo">
2899 <div class="logo">
2899 <a href="https://mercurial-scm.org/">
2900 <a href="https://mercurial-scm.org/">
2900 <img src="/static/hglogo.png" alt="mercurial" /></a>
2901 <img src="/static/hglogo.png" alt="mercurial" /></a>
2901 </div>
2902 </div>
2902 <ul>
2903 <ul>
2903 <li><a href="/shortlog">log</a></li>
2904 <li><a href="/shortlog">log</a></li>
2904 <li><a href="/graph">graph</a></li>
2905 <li><a href="/graph">graph</a></li>
2905 <li><a href="/tags">tags</a></li>
2906 <li><a href="/tags">tags</a></li>
2906 <li><a href="/bookmarks">bookmarks</a></li>
2907 <li><a href="/bookmarks">bookmarks</a></li>
2907 <li><a href="/branches">branches</a></li>
2908 <li><a href="/branches">branches</a></li>
2908 </ul>
2909 </ul>
2909 <ul>
2910 <ul>
2910 <li class="active"><a href="/help">help</a></li>
2911 <li class="active"><a href="/help">help</a></li>
2911 </ul>
2912 </ul>
2912 </div>
2913 </div>
2913
2914
2914 <div class="main">
2915 <div class="main">
2915 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2916 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2916 <h3>Help: dates</h3>
2917 <h3>Help: dates</h3>
2917
2918
2918 <form class="search" action="/log">
2919 <form class="search" action="/log">
2919
2920
2920 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2921 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2921 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2922 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2922 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2923 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2923 </form>
2924 </form>
2924 <div id="doc">
2925 <div id="doc">
2925 <h1>Date Formats</h1>
2926 <h1>Date Formats</h1>
2926 <p>
2927 <p>
2927 Some commands allow the user to specify a date, e.g.:
2928 Some commands allow the user to specify a date, e.g.:
2928 </p>
2929 </p>
2929 <ul>
2930 <ul>
2930 <li> backout, commit, import, tag: Specify the commit date.
2931 <li> backout, commit, import, tag: Specify the commit date.
2931 <li> log, revert, update: Select revision(s) by date.
2932 <li> log, revert, update: Select revision(s) by date.
2932 </ul>
2933 </ul>
2933 <p>
2934 <p>
2934 Many date formats are valid. Here are some examples:
2935 Many date formats are valid. Here are some examples:
2935 </p>
2936 </p>
2936 <ul>
2937 <ul>
2937 <li> &quot;Wed Dec 6 13:18:29 2006&quot; (local timezone assumed)
2938 <li> &quot;Wed Dec 6 13:18:29 2006&quot; (local timezone assumed)
2938 <li> &quot;Dec 6 13:18 -0600&quot; (year assumed, time offset provided)
2939 <li> &quot;Dec 6 13:18 -0600&quot; (year assumed, time offset provided)
2939 <li> &quot;Dec 6 13:18 UTC&quot; (UTC and GMT are aliases for +0000)
2940 <li> &quot;Dec 6 13:18 UTC&quot; (UTC and GMT are aliases for +0000)
2940 <li> &quot;Dec 6&quot; (midnight)
2941 <li> &quot;Dec 6&quot; (midnight)
2941 <li> &quot;13:18&quot; (today assumed)
2942 <li> &quot;13:18&quot; (today assumed)
2942 <li> &quot;3:39&quot; (3:39AM assumed)
2943 <li> &quot;3:39&quot; (3:39AM assumed)
2943 <li> &quot;3:39pm&quot; (15:39)
2944 <li> &quot;3:39pm&quot; (15:39)
2944 <li> &quot;2006-12-06 13:18:29&quot; (ISO 8601 format)
2945 <li> &quot;2006-12-06 13:18:29&quot; (ISO 8601 format)
2945 <li> &quot;2006-12-6 13:18&quot;
2946 <li> &quot;2006-12-6 13:18&quot;
2946 <li> &quot;2006-12-6&quot;
2947 <li> &quot;2006-12-6&quot;
2947 <li> &quot;12-6&quot;
2948 <li> &quot;12-6&quot;
2948 <li> &quot;12/6&quot;
2949 <li> &quot;12/6&quot;
2949 <li> &quot;12/6/6&quot; (Dec 6 2006)
2950 <li> &quot;12/6/6&quot; (Dec 6 2006)
2950 <li> &quot;today&quot; (midnight)
2951 <li> &quot;today&quot; (midnight)
2951 <li> &quot;yesterday&quot; (midnight)
2952 <li> &quot;yesterday&quot; (midnight)
2952 <li> &quot;now&quot; - right now
2953 <li> &quot;now&quot; - right now
2953 </ul>
2954 </ul>
2954 <p>
2955 <p>
2955 Lastly, there is Mercurial's internal format:
2956 Lastly, there is Mercurial's internal format:
2956 </p>
2957 </p>
2957 <ul>
2958 <ul>
2958 <li> &quot;1165411109 0&quot; (Wed Dec 6 13:18:29 2006 UTC)
2959 <li> &quot;1165411109 0&quot; (Wed Dec 6 13:18:29 2006 UTC)
2959 </ul>
2960 </ul>
2960 <p>
2961 <p>
2961 This is the internal representation format for dates. The first number
2962 This is the internal representation format for dates. The first number
2962 is the number of seconds since the epoch (1970-01-01 00:00 UTC). The
2963 is the number of seconds since the epoch (1970-01-01 00:00 UTC). The
2963 second is the offset of the local timezone, in seconds west of UTC
2964 second is the offset of the local timezone, in seconds west of UTC
2964 (negative if the timezone is east of UTC).
2965 (negative if the timezone is east of UTC).
2965 </p>
2966 </p>
2966 <p>
2967 <p>
2967 The log command also accepts date ranges:
2968 The log command also accepts date ranges:
2968 </p>
2969 </p>
2969 <ul>
2970 <ul>
2970 <li> &quot;&lt;DATE&quot; - at or before a given date/time
2971 <li> &quot;&lt;DATE&quot; - at or before a given date/time
2971 <li> &quot;&gt;DATE&quot; - on or after a given date/time
2972 <li> &quot;&gt;DATE&quot; - on or after a given date/time
2972 <li> &quot;DATE to DATE&quot; - a date range, inclusive
2973 <li> &quot;DATE to DATE&quot; - a date range, inclusive
2973 <li> &quot;-DAYS&quot; - within a given number of days of today
2974 <li> &quot;-DAYS&quot; - within a given number of days of today
2974 </ul>
2975 </ul>
2975
2976
2976 </div>
2977 </div>
2977 </div>
2978 </div>
2978 </div>
2979 </div>
2979
2980
2980
2981
2981
2982
2982 </body>
2983 </body>
2983 </html>
2984 </html>
2984
2985
2985
2986
2986 Sub-topic indexes rendered properly
2987 Sub-topic indexes rendered properly
2987
2988
2988 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals"
2989 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals"
2989 200 Script output follows
2990 200 Script output follows
2990
2991
2991 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2992 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2992 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2993 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2993 <head>
2994 <head>
2994 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2995 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2995 <meta name="robots" content="index, nofollow" />
2996 <meta name="robots" content="index, nofollow" />
2996 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2997 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2997 <script type="text/javascript" src="/static/mercurial.js"></script>
2998 <script type="text/javascript" src="/static/mercurial.js"></script>
2998
2999
2999 <title>Help: internals</title>
3000 <title>Help: internals</title>
3000 </head>
3001 </head>
3001 <body>
3002 <body>
3002
3003
3003 <div class="container">
3004 <div class="container">
3004 <div class="menu">
3005 <div class="menu">
3005 <div class="logo">
3006 <div class="logo">
3006 <a href="https://mercurial-scm.org/">
3007 <a href="https://mercurial-scm.org/">
3007 <img src="/static/hglogo.png" alt="mercurial" /></a>
3008 <img src="/static/hglogo.png" alt="mercurial" /></a>
3008 </div>
3009 </div>
3009 <ul>
3010 <ul>
3010 <li><a href="/shortlog">log</a></li>
3011 <li><a href="/shortlog">log</a></li>
3011 <li><a href="/graph">graph</a></li>
3012 <li><a href="/graph">graph</a></li>
3012 <li><a href="/tags">tags</a></li>
3013 <li><a href="/tags">tags</a></li>
3013 <li><a href="/bookmarks">bookmarks</a></li>
3014 <li><a href="/bookmarks">bookmarks</a></li>
3014 <li><a href="/branches">branches</a></li>
3015 <li><a href="/branches">branches</a></li>
3015 </ul>
3016 </ul>
3016 <ul>
3017 <ul>
3017 <li><a href="/help">help</a></li>
3018 <li><a href="/help">help</a></li>
3018 </ul>
3019 </ul>
3019 </div>
3020 </div>
3020
3021
3021 <div class="main">
3022 <div class="main">
3022 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3023 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3023
3024
3024 <form class="search" action="/log">
3025 <form class="search" action="/log">
3025
3026
3026 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3027 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3027 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3028 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3028 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3029 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3029 </form>
3030 </form>
3030 <table class="bigtable">
3031 <table class="bigtable">
3031 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
3032 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
3032
3033
3033 <tr><td>
3034 <tr><td>
3034 <a href="/help/internals.bundles">
3035 <a href="/help/internals.bundles">
3035 bundles
3036 bundles
3036 </a>
3037 </a>
3037 </td><td>
3038 </td><td>
3038 Bundles
3039 Bundles
3039 </td></tr>
3040 </td></tr>
3040 <tr><td>
3041 <tr><td>
3041 <a href="/help/internals.censor">
3042 <a href="/help/internals.censor">
3042 censor
3043 censor
3043 </a>
3044 </a>
3044 </td><td>
3045 </td><td>
3045 Censor
3046 Censor
3046 </td></tr>
3047 </td></tr>
3047 <tr><td>
3048 <tr><td>
3048 <a href="/help/internals.changegroups">
3049 <a href="/help/internals.changegroups">
3049 changegroups
3050 changegroups
3050 </a>
3051 </a>
3051 </td><td>
3052 </td><td>
3052 Changegroups
3053 Changegroups
3053 </td></tr>
3054 </td></tr>
3054 <tr><td>
3055 <tr><td>
3055 <a href="/help/internals.requirements">
3056 <a href="/help/internals.requirements">
3056 requirements
3057 requirements
3057 </a>
3058 </a>
3058 </td><td>
3059 </td><td>
3059 Repository Requirements
3060 Repository Requirements
3060 </td></tr>
3061 </td></tr>
3061 <tr><td>
3062 <tr><td>
3062 <a href="/help/internals.revlogs">
3063 <a href="/help/internals.revlogs">
3063 revlogs
3064 revlogs
3064 </a>
3065 </a>
3065 </td><td>
3066 </td><td>
3066 Revision Logs
3067 Revision Logs
3067 </td></tr>
3068 </td></tr>
3068 <tr><td>
3069 <tr><td>
3069 <a href="/help/internals.wireprotocol">
3070 <a href="/help/internals.wireprotocol">
3070 wireprotocol
3071 wireprotocol
3071 </a>
3072 </a>
3072 </td><td>
3073 </td><td>
3073 Wire Protocol
3074 Wire Protocol
3074 </td></tr>
3075 </td></tr>
3075
3076
3076
3077
3077
3078
3078
3079
3079
3080
3080 </table>
3081 </table>
3081 </div>
3082 </div>
3082 </div>
3083 </div>
3083
3084
3084
3085
3085
3086
3086 </body>
3087 </body>
3087 </html>
3088 </html>
3088
3089
3089
3090
3090 Sub-topic topics rendered properly
3091 Sub-topic topics rendered properly
3091
3092
3092 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals.changegroups"
3093 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals.changegroups"
3093 200 Script output follows
3094 200 Script output follows
3094
3095
3095 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3096 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3096 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3097 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3097 <head>
3098 <head>
3098 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3099 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3099 <meta name="robots" content="index, nofollow" />
3100 <meta name="robots" content="index, nofollow" />
3100 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3101 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3101 <script type="text/javascript" src="/static/mercurial.js"></script>
3102 <script type="text/javascript" src="/static/mercurial.js"></script>
3102
3103
3103 <title>Help: internals.changegroups</title>
3104 <title>Help: internals.changegroups</title>
3104 </head>
3105 </head>
3105 <body>
3106 <body>
3106
3107
3107 <div class="container">
3108 <div class="container">
3108 <div class="menu">
3109 <div class="menu">
3109 <div class="logo">
3110 <div class="logo">
3110 <a href="https://mercurial-scm.org/">
3111 <a href="https://mercurial-scm.org/">
3111 <img src="/static/hglogo.png" alt="mercurial" /></a>
3112 <img src="/static/hglogo.png" alt="mercurial" /></a>
3112 </div>
3113 </div>
3113 <ul>
3114 <ul>
3114 <li><a href="/shortlog">log</a></li>
3115 <li><a href="/shortlog">log</a></li>
3115 <li><a href="/graph">graph</a></li>
3116 <li><a href="/graph">graph</a></li>
3116 <li><a href="/tags">tags</a></li>
3117 <li><a href="/tags">tags</a></li>
3117 <li><a href="/bookmarks">bookmarks</a></li>
3118 <li><a href="/bookmarks">bookmarks</a></li>
3118 <li><a href="/branches">branches</a></li>
3119 <li><a href="/branches">branches</a></li>
3119 </ul>
3120 </ul>
3120 <ul>
3121 <ul>
3121 <li class="active"><a href="/help">help</a></li>
3122 <li class="active"><a href="/help">help</a></li>
3122 </ul>
3123 </ul>
3123 </div>
3124 </div>
3124
3125
3125 <div class="main">
3126 <div class="main">
3126 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3127 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3127 <h3>Help: internals.changegroups</h3>
3128 <h3>Help: internals.changegroups</h3>
3128
3129
3129 <form class="search" action="/log">
3130 <form class="search" action="/log">
3130
3131
3131 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3132 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3132 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3133 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3133 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3134 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3134 </form>
3135 </form>
3135 <div id="doc">
3136 <div id="doc">
3136 <h1>Changegroups</h1>
3137 <h1>Changegroups</h1>
3137 <p>
3138 <p>
3138 Changegroups are representations of repository revlog data, specifically
3139 Changegroups are representations of repository revlog data, specifically
3139 the changelog data, root/flat manifest data, treemanifest data, and
3140 the changelog data, root/flat manifest data, treemanifest data, and
3140 filelogs.
3141 filelogs.
3141 </p>
3142 </p>
3142 <p>
3143 <p>
3143 There are 3 versions of changegroups: &quot;1&quot;, &quot;2&quot;, and &quot;3&quot;. From a
3144 There are 3 versions of changegroups: &quot;1&quot;, &quot;2&quot;, and &quot;3&quot;. From a
3144 high-level, versions &quot;1&quot; and &quot;2&quot; are almost exactly the same, with the
3145 high-level, versions &quot;1&quot; and &quot;2&quot; are almost exactly the same, with the
3145 only difference being an additional item in the *delta header*. Version
3146 only difference being an additional item in the *delta header*. Version
3146 &quot;3&quot; adds support for revlog flags in the *delta header* and optionally
3147 &quot;3&quot; adds support for revlog flags in the *delta header* and optionally
3147 exchanging treemanifests (enabled by setting an option on the
3148 exchanging treemanifests (enabled by setting an option on the
3148 &quot;changegroup&quot; part in the bundle2).
3149 &quot;changegroup&quot; part in the bundle2).
3149 </p>
3150 </p>
3150 <p>
3151 <p>
3151 Changegroups when not exchanging treemanifests consist of 3 logical
3152 Changegroups when not exchanging treemanifests consist of 3 logical
3152 segments:
3153 segments:
3153 </p>
3154 </p>
3154 <pre>
3155 <pre>
3155 +---------------------------------+
3156 +---------------------------------+
3156 | | | |
3157 | | | |
3157 | changeset | manifest | filelogs |
3158 | changeset | manifest | filelogs |
3158 | | | |
3159 | | | |
3159 | | | |
3160 | | | |
3160 +---------------------------------+
3161 +---------------------------------+
3161 </pre>
3162 </pre>
3162 <p>
3163 <p>
3163 When exchanging treemanifests, there are 4 logical segments:
3164 When exchanging treemanifests, there are 4 logical segments:
3164 </p>
3165 </p>
3165 <pre>
3166 <pre>
3166 +-------------------------------------------------+
3167 +-------------------------------------------------+
3167 | | | | |
3168 | | | | |
3168 | changeset | root | treemanifests | filelogs |
3169 | changeset | root | treemanifests | filelogs |
3169 | | manifest | | |
3170 | | manifest | | |
3170 | | | | |
3171 | | | | |
3171 +-------------------------------------------------+
3172 +-------------------------------------------------+
3172 </pre>
3173 </pre>
3173 <p>
3174 <p>
3174 The principle building block of each segment is a *chunk*. A *chunk*
3175 The principle building block of each segment is a *chunk*. A *chunk*
3175 is a framed piece of data:
3176 is a framed piece of data:
3176 </p>
3177 </p>
3177 <pre>
3178 <pre>
3178 +---------------------------------------+
3179 +---------------------------------------+
3179 | | |
3180 | | |
3180 | length | data |
3181 | length | data |
3181 | (4 bytes) | (&lt;length - 4&gt; bytes) |
3182 | (4 bytes) | (&lt;length - 4&gt; bytes) |
3182 | | |
3183 | | |
3183 +---------------------------------------+
3184 +---------------------------------------+
3184 </pre>
3185 </pre>
3185 <p>
3186 <p>
3186 All integers are big-endian signed integers. Each chunk starts with a 32-bit
3187 All integers are big-endian signed integers. Each chunk starts with a 32-bit
3187 integer indicating the length of the entire chunk (including the length field
3188 integer indicating the length of the entire chunk (including the length field
3188 itself).
3189 itself).
3189 </p>
3190 </p>
3190 <p>
3191 <p>
3191 There is a special case chunk that has a value of 0 for the length
3192 There is a special case chunk that has a value of 0 for the length
3192 (&quot;0x00000000&quot;). We call this an *empty chunk*.
3193 (&quot;0x00000000&quot;). We call this an *empty chunk*.
3193 </p>
3194 </p>
3194 <h2>Delta Groups</h2>
3195 <h2>Delta Groups</h2>
3195 <p>
3196 <p>
3196 A *delta group* expresses the content of a revlog as a series of deltas,
3197 A *delta group* expresses the content of a revlog as a series of deltas,
3197 or patches against previous revisions.
3198 or patches against previous revisions.
3198 </p>
3199 </p>
3199 <p>
3200 <p>
3200 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
3201 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
3201 to signal the end of the delta group:
3202 to signal the end of the delta group:
3202 </p>
3203 </p>
3203 <pre>
3204 <pre>
3204 +------------------------------------------------------------------------+
3205 +------------------------------------------------------------------------+
3205 | | | | | |
3206 | | | | | |
3206 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
3207 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
3207 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
3208 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
3208 | | | | | |
3209 | | | | | |
3209 +------------------------------------------------------------------------+
3210 +------------------------------------------------------------------------+
3210 </pre>
3211 </pre>
3211 <p>
3212 <p>
3212 Each *chunk*'s data consists of the following:
3213 Each *chunk*'s data consists of the following:
3213 </p>
3214 </p>
3214 <pre>
3215 <pre>
3215 +---------------------------------------+
3216 +---------------------------------------+
3216 | | |
3217 | | |
3217 | delta header | delta data |
3218 | delta header | delta data |
3218 | (various by version) | (various) |
3219 | (various by version) | (various) |
3219 | | |
3220 | | |
3220 +---------------------------------------+
3221 +---------------------------------------+
3221 </pre>
3222 </pre>
3222 <p>
3223 <p>
3223 The *delta data* is a series of *delta*s that describe a diff from an existing
3224 The *delta data* is a series of *delta*s that describe a diff from an existing
3224 entry (either that the recipient already has, or previously specified in the
3225 entry (either that the recipient already has, or previously specified in the
3225 bundle/changegroup).
3226 bundle/changegroup).
3226 </p>
3227 </p>
3227 <p>
3228 <p>
3228 The *delta header* is different between versions &quot;1&quot;, &quot;2&quot;, and
3229 The *delta header* is different between versions &quot;1&quot;, &quot;2&quot;, and
3229 &quot;3&quot; of the changegroup format.
3230 &quot;3&quot; of the changegroup format.
3230 </p>
3231 </p>
3231 <p>
3232 <p>
3232 Version 1 (headerlen=80):
3233 Version 1 (headerlen=80):
3233 </p>
3234 </p>
3234 <pre>
3235 <pre>
3235 +------------------------------------------------------+
3236 +------------------------------------------------------+
3236 | | | | |
3237 | | | | |
3237 | node | p1 node | p2 node | link node |
3238 | node | p1 node | p2 node | link node |
3238 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3239 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3239 | | | | |
3240 | | | | |
3240 +------------------------------------------------------+
3241 +------------------------------------------------------+
3241 </pre>
3242 </pre>
3242 <p>
3243 <p>
3243 Version 2 (headerlen=100):
3244 Version 2 (headerlen=100):
3244 </p>
3245 </p>
3245 <pre>
3246 <pre>
3246 +------------------------------------------------------------------+
3247 +------------------------------------------------------------------+
3247 | | | | | |
3248 | | | | | |
3248 | node | p1 node | p2 node | base node | link node |
3249 | node | p1 node | p2 node | base node | link node |
3249 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3250 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3250 | | | | | |
3251 | | | | | |
3251 +------------------------------------------------------------------+
3252 +------------------------------------------------------------------+
3252 </pre>
3253 </pre>
3253 <p>
3254 <p>
3254 Version 3 (headerlen=102):
3255 Version 3 (headerlen=102):
3255 </p>
3256 </p>
3256 <pre>
3257 <pre>
3257 +------------------------------------------------------------------------------+
3258 +------------------------------------------------------------------------------+
3258 | | | | | | |
3259 | | | | | | |
3259 | node | p1 node | p2 node | base node | link node | flags |
3260 | node | p1 node | p2 node | base node | link node | flags |
3260 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
3261 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
3261 | | | | | | |
3262 | | | | | | |
3262 +------------------------------------------------------------------------------+
3263 +------------------------------------------------------------------------------+
3263 </pre>
3264 </pre>
3264 <p>
3265 <p>
3265 The *delta data* consists of &quot;chunklen - 4 - headerlen&quot; bytes, which contain a
3266 The *delta data* consists of &quot;chunklen - 4 - headerlen&quot; bytes, which contain a
3266 series of *delta*s, densely packed (no separators). These deltas describe a diff
3267 series of *delta*s, densely packed (no separators). These deltas describe a diff
3267 from an existing entry (either that the recipient already has, or previously
3268 from an existing entry (either that the recipient already has, or previously
3268 specified in the bundle/changegroup). The format is described more fully in
3269 specified in the bundle/changegroup). The format is described more fully in
3269 &quot;hg help internals.bdiff&quot;, but briefly:
3270 &quot;hg help internals.bdiff&quot;, but briefly:
3270 </p>
3271 </p>
3271 <pre>
3272 <pre>
3272 +---------------------------------------------------------------+
3273 +---------------------------------------------------------------+
3273 | | | | |
3274 | | | | |
3274 | start offset | end offset | new length | content |
3275 | start offset | end offset | new length | content |
3275 | (4 bytes) | (4 bytes) | (4 bytes) | (&lt;new length&gt; bytes) |
3276 | (4 bytes) | (4 bytes) | (4 bytes) | (&lt;new length&gt; bytes) |
3276 | | | | |
3277 | | | | |
3277 +---------------------------------------------------------------+
3278 +---------------------------------------------------------------+
3278 </pre>
3279 </pre>
3279 <p>
3280 <p>
3280 Please note that the length field in the delta data does *not* include itself.
3281 Please note that the length field in the delta data does *not* include itself.
3281 </p>
3282 </p>
3282 <p>
3283 <p>
3283 In version 1, the delta is always applied against the previous node from
3284 In version 1, the delta is always applied against the previous node from
3284 the changegroup or the first parent if this is the first entry in the
3285 the changegroup or the first parent if this is the first entry in the
3285 changegroup.
3286 changegroup.
3286 </p>
3287 </p>
3287 <p>
3288 <p>
3288 In version 2 and up, the delta base node is encoded in the entry in the
3289 In version 2 and up, the delta base node is encoded in the entry in the
3289 changegroup. This allows the delta to be expressed against any parent,
3290 changegroup. This allows the delta to be expressed against any parent,
3290 which can result in smaller deltas and more efficient encoding of data.
3291 which can result in smaller deltas and more efficient encoding of data.
3291 </p>
3292 </p>
3292 <h2>Changeset Segment</h2>
3293 <h2>Changeset Segment</h2>
3293 <p>
3294 <p>
3294 The *changeset segment* consists of a single *delta group* holding
3295 The *changeset segment* consists of a single *delta group* holding
3295 changelog data. The *empty chunk* at the end of the *delta group* denotes
3296 changelog data. The *empty chunk* at the end of the *delta group* denotes
3296 the boundary to the *manifest segment*.
3297 the boundary to the *manifest segment*.
3297 </p>
3298 </p>
3298 <h2>Manifest Segment</h2>
3299 <h2>Manifest Segment</h2>
3299 <p>
3300 <p>
3300 The *manifest segment* consists of a single *delta group* holding manifest
3301 The *manifest segment* consists of a single *delta group* holding manifest
3301 data. If treemanifests are in use, it contains only the manifest for the
3302 data. If treemanifests are in use, it contains only the manifest for the
3302 root directory of the repository. Otherwise, it contains the entire
3303 root directory of the repository. Otherwise, it contains the entire
3303 manifest data. The *empty chunk* at the end of the *delta group* denotes
3304 manifest data. The *empty chunk* at the end of the *delta group* denotes
3304 the boundary to the next segment (either the *treemanifests segment* or the
3305 the boundary to the next segment (either the *treemanifests segment* or the
3305 *filelogs segment*, depending on version and the request options).
3306 *filelogs segment*, depending on version and the request options).
3306 </p>
3307 </p>
3307 <h3>Treemanifests Segment</h3>
3308 <h3>Treemanifests Segment</h3>
3308 <p>
3309 <p>
3309 The *treemanifests segment* only exists in changegroup version &quot;3&quot;, and
3310 The *treemanifests segment* only exists in changegroup version &quot;3&quot;, and
3310 only if the 'treemanifest' param is part of the bundle2 changegroup part
3311 only if the 'treemanifest' param is part of the bundle2 changegroup part
3311 (it is not possible to use changegroup version 3 outside of bundle2).
3312 (it is not possible to use changegroup version 3 outside of bundle2).
3312 Aside from the filenames in the *treemanifests segment* containing a
3313 Aside from the filenames in the *treemanifests segment* containing a
3313 trailing &quot;/&quot; character, it behaves identically to the *filelogs segment*
3314 trailing &quot;/&quot; character, it behaves identically to the *filelogs segment*
3314 (see below). The final sub-segment is followed by an *empty chunk* (logically,
3315 (see below). The final sub-segment is followed by an *empty chunk* (logically,
3315 a sub-segment with filename size 0). This denotes the boundary to the
3316 a sub-segment with filename size 0). This denotes the boundary to the
3316 *filelogs segment*.
3317 *filelogs segment*.
3317 </p>
3318 </p>
3318 <h2>Filelogs Segment</h2>
3319 <h2>Filelogs Segment</h2>
3319 <p>
3320 <p>
3320 The *filelogs segment* consists of multiple sub-segments, each
3321 The *filelogs segment* consists of multiple sub-segments, each
3321 corresponding to an individual file whose data is being described:
3322 corresponding to an individual file whose data is being described:
3322 </p>
3323 </p>
3323 <pre>
3324 <pre>
3324 +--------------------------------------------------+
3325 +--------------------------------------------------+
3325 | | | | | |
3326 | | | | | |
3326 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
3327 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
3327 | | | | | (4 bytes) |
3328 | | | | | (4 bytes) |
3328 | | | | | |
3329 | | | | | |
3329 +--------------------------------------------------+
3330 +--------------------------------------------------+
3330 </pre>
3331 </pre>
3331 <p>
3332 <p>
3332 The final filelog sub-segment is followed by an *empty chunk* (logically,
3333 The final filelog sub-segment is followed by an *empty chunk* (logically,
3333 a sub-segment with filename size 0). This denotes the end of the segment
3334 a sub-segment with filename size 0). This denotes the end of the segment
3334 and of the overall changegroup.
3335 and of the overall changegroup.
3335 </p>
3336 </p>
3336 <p>
3337 <p>
3337 Each filelog sub-segment consists of the following:
3338 Each filelog sub-segment consists of the following:
3338 </p>
3339 </p>
3339 <pre>
3340 <pre>
3340 +------------------------------------------------------+
3341 +------------------------------------------------------+
3341 | | | |
3342 | | | |
3342 | filename length | filename | delta group |
3343 | filename length | filename | delta group |
3343 | (4 bytes) | (&lt;length - 4&gt; bytes) | (various) |
3344 | (4 bytes) | (&lt;length - 4&gt; bytes) | (various) |
3344 | | | |
3345 | | | |
3345 +------------------------------------------------------+
3346 +------------------------------------------------------+
3346 </pre>
3347 </pre>
3347 <p>
3348 <p>
3348 That is, a *chunk* consisting of the filename (not terminated or padded)
3349 That is, a *chunk* consisting of the filename (not terminated or padded)
3349 followed by N chunks constituting the *delta group* for this file. The
3350 followed by N chunks constituting the *delta group* for this file. The
3350 *empty chunk* at the end of each *delta group* denotes the boundary to the
3351 *empty chunk* at the end of each *delta group* denotes the boundary to the
3351 next filelog sub-segment.
3352 next filelog sub-segment.
3352 </p>
3353 </p>
3353
3354
3354 </div>
3355 </div>
3355 </div>
3356 </div>
3356 </div>
3357 </div>
3357
3358
3358
3359
3359
3360
3360 </body>
3361 </body>
3361 </html>
3362 </html>
3362
3363
3363
3364
3364 $ killdaemons.py
3365 $ killdaemons.py
3365
3366
3366 #endif
3367 #endif
General Comments 0
You need to be logged in to leave comments. Login now