##// END OF EJS Templates
debugformat: add a 'debugformat' command...
Boris Feld -
r35337:c3e4f196 default
parent child Browse files
Show More
@@ -1,2368 +1,2400 b''
1 # debugcommands.py - command processing for debug* commands
1 # debugcommands.py - command processing for debug* commands
2 #
2 #
3 # Copyright 2005-2016 Matt Mackall <mpm@selenic.com>
3 # Copyright 2005-2016 Matt Mackall <mpm@selenic.com>
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 from __future__ import absolute_import
8 from __future__ import absolute_import
9
9
10 import codecs
10 import codecs
11 import collections
11 import collections
12 import difflib
12 import difflib
13 import errno
13 import errno
14 import operator
14 import operator
15 import os
15 import os
16 import random
16 import random
17 import socket
17 import socket
18 import ssl
18 import ssl
19 import string
19 import string
20 import sys
20 import sys
21 import tempfile
21 import tempfile
22 import time
22 import time
23
23
24 from .i18n import _
24 from .i18n import _
25 from .node import (
25 from .node import (
26 bin,
26 bin,
27 hex,
27 hex,
28 nullhex,
28 nullhex,
29 nullid,
29 nullid,
30 nullrev,
30 nullrev,
31 short,
31 short,
32 )
32 )
33 from . import (
33 from . import (
34 bundle2,
34 bundle2,
35 changegroup,
35 changegroup,
36 cmdutil,
36 cmdutil,
37 color,
37 color,
38 context,
38 context,
39 dagparser,
39 dagparser,
40 dagutil,
40 dagutil,
41 encoding,
41 encoding,
42 error,
42 error,
43 exchange,
43 exchange,
44 extensions,
44 extensions,
45 filemerge,
45 filemerge,
46 fileset,
46 fileset,
47 formatter,
47 formatter,
48 hg,
48 hg,
49 localrepo,
49 localrepo,
50 lock as lockmod,
50 lock as lockmod,
51 merge as mergemod,
51 merge as mergemod,
52 obsolete,
52 obsolete,
53 obsutil,
53 obsutil,
54 phases,
54 phases,
55 policy,
55 policy,
56 pvec,
56 pvec,
57 pycompat,
57 pycompat,
58 registrar,
58 registrar,
59 repair,
59 repair,
60 revlog,
60 revlog,
61 revset,
61 revset,
62 revsetlang,
62 revsetlang,
63 scmutil,
63 scmutil,
64 setdiscovery,
64 setdiscovery,
65 simplemerge,
65 simplemerge,
66 smartset,
66 smartset,
67 sslutil,
67 sslutil,
68 streamclone,
68 streamclone,
69 templater,
69 templater,
70 treediscovery,
70 treediscovery,
71 upgrade,
71 upgrade,
72 util,
72 util,
73 vfs as vfsmod,
73 vfs as vfsmod,
74 )
74 )
75
75
76 release = lockmod.release
76 release = lockmod.release
77
77
78 command = registrar.command()
78 command = registrar.command()
79
79
80 @command('debugancestor', [], _('[INDEX] REV1 REV2'), optionalrepo=True)
80 @command('debugancestor', [], _('[INDEX] REV1 REV2'), optionalrepo=True)
81 def debugancestor(ui, repo, *args):
81 def debugancestor(ui, repo, *args):
82 """find the ancestor revision of two revisions in a given index"""
82 """find the ancestor revision of two revisions in a given index"""
83 if len(args) == 3:
83 if len(args) == 3:
84 index, rev1, rev2 = args
84 index, rev1, rev2 = args
85 r = revlog.revlog(vfsmod.vfs(pycompat.getcwd(), audit=False), index)
85 r = revlog.revlog(vfsmod.vfs(pycompat.getcwd(), audit=False), index)
86 lookup = r.lookup
86 lookup = r.lookup
87 elif len(args) == 2:
87 elif len(args) == 2:
88 if not repo:
88 if not repo:
89 raise error.Abort(_('there is no Mercurial repository here '
89 raise error.Abort(_('there is no Mercurial repository here '
90 '(.hg not found)'))
90 '(.hg not found)'))
91 rev1, rev2 = args
91 rev1, rev2 = args
92 r = repo.changelog
92 r = repo.changelog
93 lookup = repo.lookup
93 lookup = repo.lookup
94 else:
94 else:
95 raise error.Abort(_('either two or three arguments required'))
95 raise error.Abort(_('either two or three arguments required'))
96 a = r.ancestor(lookup(rev1), lookup(rev2))
96 a = r.ancestor(lookup(rev1), lookup(rev2))
97 ui.write('%d:%s\n' % (r.rev(a), hex(a)))
97 ui.write('%d:%s\n' % (r.rev(a), hex(a)))
98
98
99 @command('debugapplystreamclonebundle', [], 'FILE')
99 @command('debugapplystreamclonebundle', [], 'FILE')
100 def debugapplystreamclonebundle(ui, repo, fname):
100 def debugapplystreamclonebundle(ui, repo, fname):
101 """apply a stream clone bundle file"""
101 """apply a stream clone bundle file"""
102 f = hg.openpath(ui, fname)
102 f = hg.openpath(ui, fname)
103 gen = exchange.readbundle(ui, f, fname)
103 gen = exchange.readbundle(ui, f, fname)
104 gen.apply(repo)
104 gen.apply(repo)
105
105
106 @command('debugbuilddag',
106 @command('debugbuilddag',
107 [('m', 'mergeable-file', None, _('add single file mergeable changes')),
107 [('m', 'mergeable-file', None, _('add single file mergeable changes')),
108 ('o', 'overwritten-file', None, _('add single file all revs overwrite')),
108 ('o', 'overwritten-file', None, _('add single file all revs overwrite')),
109 ('n', 'new-file', None, _('add new file at each rev'))],
109 ('n', 'new-file', None, _('add new file at each rev'))],
110 _('[OPTION]... [TEXT]'))
110 _('[OPTION]... [TEXT]'))
111 def debugbuilddag(ui, repo, text=None,
111 def debugbuilddag(ui, repo, text=None,
112 mergeable_file=False,
112 mergeable_file=False,
113 overwritten_file=False,
113 overwritten_file=False,
114 new_file=False):
114 new_file=False):
115 """builds a repo with a given DAG from scratch in the current empty repo
115 """builds a repo with a given DAG from scratch in the current empty repo
116
116
117 The description of the DAG is read from stdin if not given on the
117 The description of the DAG is read from stdin if not given on the
118 command line.
118 command line.
119
119
120 Elements:
120 Elements:
121
121
122 - "+n" is a linear run of n nodes based on the current default parent
122 - "+n" is a linear run of n nodes based on the current default parent
123 - "." is a single node based on the current default parent
123 - "." is a single node based on the current default parent
124 - "$" resets the default parent to null (implied at the start);
124 - "$" resets the default parent to null (implied at the start);
125 otherwise the default parent is always the last node created
125 otherwise the default parent is always the last node created
126 - "<p" sets the default parent to the backref p
126 - "<p" sets the default parent to the backref p
127 - "*p" is a fork at parent p, which is a backref
127 - "*p" is a fork at parent p, which is a backref
128 - "*p1/p2" is a merge of parents p1 and p2, which are backrefs
128 - "*p1/p2" is a merge of parents p1 and p2, which are backrefs
129 - "/p2" is a merge of the preceding node and p2
129 - "/p2" is a merge of the preceding node and p2
130 - ":tag" defines a local tag for the preceding node
130 - ":tag" defines a local tag for the preceding node
131 - "@branch" sets the named branch for subsequent nodes
131 - "@branch" sets the named branch for subsequent nodes
132 - "#...\\n" is a comment up to the end of the line
132 - "#...\\n" is a comment up to the end of the line
133
133
134 Whitespace between the above elements is ignored.
134 Whitespace between the above elements is ignored.
135
135
136 A backref is either
136 A backref is either
137
137
138 - a number n, which references the node curr-n, where curr is the current
138 - a number n, which references the node curr-n, where curr is the current
139 node, or
139 node, or
140 - the name of a local tag you placed earlier using ":tag", or
140 - the name of a local tag you placed earlier using ":tag", or
141 - empty to denote the default parent.
141 - empty to denote the default parent.
142
142
143 All string valued-elements are either strictly alphanumeric, or must
143 All string valued-elements are either strictly alphanumeric, or must
144 be enclosed in double quotes ("..."), with "\\" as escape character.
144 be enclosed in double quotes ("..."), with "\\" as escape character.
145 """
145 """
146
146
147 if text is None:
147 if text is None:
148 ui.status(_("reading DAG from stdin\n"))
148 ui.status(_("reading DAG from stdin\n"))
149 text = ui.fin.read()
149 text = ui.fin.read()
150
150
151 cl = repo.changelog
151 cl = repo.changelog
152 if len(cl) > 0:
152 if len(cl) > 0:
153 raise error.Abort(_('repository is not empty'))
153 raise error.Abort(_('repository is not empty'))
154
154
155 # determine number of revs in DAG
155 # determine number of revs in DAG
156 total = 0
156 total = 0
157 for type, data in dagparser.parsedag(text):
157 for type, data in dagparser.parsedag(text):
158 if type == 'n':
158 if type == 'n':
159 total += 1
159 total += 1
160
160
161 if mergeable_file:
161 if mergeable_file:
162 linesperrev = 2
162 linesperrev = 2
163 # make a file with k lines per rev
163 # make a file with k lines per rev
164 initialmergedlines = [str(i) for i in xrange(0, total * linesperrev)]
164 initialmergedlines = [str(i) for i in xrange(0, total * linesperrev)]
165 initialmergedlines.append("")
165 initialmergedlines.append("")
166
166
167 tags = []
167 tags = []
168
168
169 wlock = lock = tr = None
169 wlock = lock = tr = None
170 try:
170 try:
171 wlock = repo.wlock()
171 wlock = repo.wlock()
172 lock = repo.lock()
172 lock = repo.lock()
173 tr = repo.transaction("builddag")
173 tr = repo.transaction("builddag")
174
174
175 at = -1
175 at = -1
176 atbranch = 'default'
176 atbranch = 'default'
177 nodeids = []
177 nodeids = []
178 id = 0
178 id = 0
179 ui.progress(_('building'), id, unit=_('revisions'), total=total)
179 ui.progress(_('building'), id, unit=_('revisions'), total=total)
180 for type, data in dagparser.parsedag(text):
180 for type, data in dagparser.parsedag(text):
181 if type == 'n':
181 if type == 'n':
182 ui.note(('node %s\n' % str(data)))
182 ui.note(('node %s\n' % str(data)))
183 id, ps = data
183 id, ps = data
184
184
185 files = []
185 files = []
186 fctxs = {}
186 fctxs = {}
187
187
188 p2 = None
188 p2 = None
189 if mergeable_file:
189 if mergeable_file:
190 fn = "mf"
190 fn = "mf"
191 p1 = repo[ps[0]]
191 p1 = repo[ps[0]]
192 if len(ps) > 1:
192 if len(ps) > 1:
193 p2 = repo[ps[1]]
193 p2 = repo[ps[1]]
194 pa = p1.ancestor(p2)
194 pa = p1.ancestor(p2)
195 base, local, other = [x[fn].data() for x in (pa, p1,
195 base, local, other = [x[fn].data() for x in (pa, p1,
196 p2)]
196 p2)]
197 m3 = simplemerge.Merge3Text(base, local, other)
197 m3 = simplemerge.Merge3Text(base, local, other)
198 ml = [l.strip() for l in m3.merge_lines()]
198 ml = [l.strip() for l in m3.merge_lines()]
199 ml.append("")
199 ml.append("")
200 elif at > 0:
200 elif at > 0:
201 ml = p1[fn].data().split("\n")
201 ml = p1[fn].data().split("\n")
202 else:
202 else:
203 ml = initialmergedlines
203 ml = initialmergedlines
204 ml[id * linesperrev] += " r%i" % id
204 ml[id * linesperrev] += " r%i" % id
205 mergedtext = "\n".join(ml)
205 mergedtext = "\n".join(ml)
206 files.append(fn)
206 files.append(fn)
207 fctxs[fn] = context.memfilectx(repo, fn, mergedtext)
207 fctxs[fn] = context.memfilectx(repo, fn, mergedtext)
208
208
209 if overwritten_file:
209 if overwritten_file:
210 fn = "of"
210 fn = "of"
211 files.append(fn)
211 files.append(fn)
212 fctxs[fn] = context.memfilectx(repo, fn, "r%i\n" % id)
212 fctxs[fn] = context.memfilectx(repo, fn, "r%i\n" % id)
213
213
214 if new_file:
214 if new_file:
215 fn = "nf%i" % id
215 fn = "nf%i" % id
216 files.append(fn)
216 files.append(fn)
217 fctxs[fn] = context.memfilectx(repo, fn, "r%i\n" % id)
217 fctxs[fn] = context.memfilectx(repo, fn, "r%i\n" % id)
218 if len(ps) > 1:
218 if len(ps) > 1:
219 if not p2:
219 if not p2:
220 p2 = repo[ps[1]]
220 p2 = repo[ps[1]]
221 for fn in p2:
221 for fn in p2:
222 if fn.startswith("nf"):
222 if fn.startswith("nf"):
223 files.append(fn)
223 files.append(fn)
224 fctxs[fn] = p2[fn]
224 fctxs[fn] = p2[fn]
225
225
226 def fctxfn(repo, cx, path):
226 def fctxfn(repo, cx, path):
227 return fctxs.get(path)
227 return fctxs.get(path)
228
228
229 if len(ps) == 0 or ps[0] < 0:
229 if len(ps) == 0 or ps[0] < 0:
230 pars = [None, None]
230 pars = [None, None]
231 elif len(ps) == 1:
231 elif len(ps) == 1:
232 pars = [nodeids[ps[0]], None]
232 pars = [nodeids[ps[0]], None]
233 else:
233 else:
234 pars = [nodeids[p] for p in ps]
234 pars = [nodeids[p] for p in ps]
235 cx = context.memctx(repo, pars, "r%i" % id, files, fctxfn,
235 cx = context.memctx(repo, pars, "r%i" % id, files, fctxfn,
236 date=(id, 0),
236 date=(id, 0),
237 user="debugbuilddag",
237 user="debugbuilddag",
238 extra={'branch': atbranch})
238 extra={'branch': atbranch})
239 nodeid = repo.commitctx(cx)
239 nodeid = repo.commitctx(cx)
240 nodeids.append(nodeid)
240 nodeids.append(nodeid)
241 at = id
241 at = id
242 elif type == 'l':
242 elif type == 'l':
243 id, name = data
243 id, name = data
244 ui.note(('tag %s\n' % name))
244 ui.note(('tag %s\n' % name))
245 tags.append("%s %s\n" % (hex(repo.changelog.node(id)), name))
245 tags.append("%s %s\n" % (hex(repo.changelog.node(id)), name))
246 elif type == 'a':
246 elif type == 'a':
247 ui.note(('branch %s\n' % data))
247 ui.note(('branch %s\n' % data))
248 atbranch = data
248 atbranch = data
249 ui.progress(_('building'), id, unit=_('revisions'), total=total)
249 ui.progress(_('building'), id, unit=_('revisions'), total=total)
250 tr.close()
250 tr.close()
251
251
252 if tags:
252 if tags:
253 repo.vfs.write("localtags", "".join(tags))
253 repo.vfs.write("localtags", "".join(tags))
254 finally:
254 finally:
255 ui.progress(_('building'), None)
255 ui.progress(_('building'), None)
256 release(tr, lock, wlock)
256 release(tr, lock, wlock)
257
257
258 def _debugchangegroup(ui, gen, all=None, indent=0, **opts):
258 def _debugchangegroup(ui, gen, all=None, indent=0, **opts):
259 indent_string = ' ' * indent
259 indent_string = ' ' * indent
260 if all:
260 if all:
261 ui.write(("%sformat: id, p1, p2, cset, delta base, len(delta)\n")
261 ui.write(("%sformat: id, p1, p2, cset, delta base, len(delta)\n")
262 % indent_string)
262 % indent_string)
263
263
264 def showchunks(named):
264 def showchunks(named):
265 ui.write("\n%s%s\n" % (indent_string, named))
265 ui.write("\n%s%s\n" % (indent_string, named))
266 for deltadata in gen.deltaiter():
266 for deltadata in gen.deltaiter():
267 node, p1, p2, cs, deltabase, delta, flags = deltadata
267 node, p1, p2, cs, deltabase, delta, flags = deltadata
268 ui.write("%s%s %s %s %s %s %s\n" %
268 ui.write("%s%s %s %s %s %s %s\n" %
269 (indent_string, hex(node), hex(p1), hex(p2),
269 (indent_string, hex(node), hex(p1), hex(p2),
270 hex(cs), hex(deltabase), len(delta)))
270 hex(cs), hex(deltabase), len(delta)))
271
271
272 chunkdata = gen.changelogheader()
272 chunkdata = gen.changelogheader()
273 showchunks("changelog")
273 showchunks("changelog")
274 chunkdata = gen.manifestheader()
274 chunkdata = gen.manifestheader()
275 showchunks("manifest")
275 showchunks("manifest")
276 for chunkdata in iter(gen.filelogheader, {}):
276 for chunkdata in iter(gen.filelogheader, {}):
277 fname = chunkdata['filename']
277 fname = chunkdata['filename']
278 showchunks(fname)
278 showchunks(fname)
279 else:
279 else:
280 if isinstance(gen, bundle2.unbundle20):
280 if isinstance(gen, bundle2.unbundle20):
281 raise error.Abort(_('use debugbundle2 for this file'))
281 raise error.Abort(_('use debugbundle2 for this file'))
282 chunkdata = gen.changelogheader()
282 chunkdata = gen.changelogheader()
283 for deltadata in gen.deltaiter():
283 for deltadata in gen.deltaiter():
284 node, p1, p2, cs, deltabase, delta, flags = deltadata
284 node, p1, p2, cs, deltabase, delta, flags = deltadata
285 ui.write("%s%s\n" % (indent_string, hex(node)))
285 ui.write("%s%s\n" % (indent_string, hex(node)))
286
286
287 def _debugobsmarkers(ui, part, indent=0, **opts):
287 def _debugobsmarkers(ui, part, indent=0, **opts):
288 """display version and markers contained in 'data'"""
288 """display version and markers contained in 'data'"""
289 opts = pycompat.byteskwargs(opts)
289 opts = pycompat.byteskwargs(opts)
290 data = part.read()
290 data = part.read()
291 indent_string = ' ' * indent
291 indent_string = ' ' * indent
292 try:
292 try:
293 version, markers = obsolete._readmarkers(data)
293 version, markers = obsolete._readmarkers(data)
294 except error.UnknownVersion as exc:
294 except error.UnknownVersion as exc:
295 msg = "%sunsupported version: %s (%d bytes)\n"
295 msg = "%sunsupported version: %s (%d bytes)\n"
296 msg %= indent_string, exc.version, len(data)
296 msg %= indent_string, exc.version, len(data)
297 ui.write(msg)
297 ui.write(msg)
298 else:
298 else:
299 msg = "%sversion: %d (%d bytes)\n"
299 msg = "%sversion: %d (%d bytes)\n"
300 msg %= indent_string, version, len(data)
300 msg %= indent_string, version, len(data)
301 ui.write(msg)
301 ui.write(msg)
302 fm = ui.formatter('debugobsolete', opts)
302 fm = ui.formatter('debugobsolete', opts)
303 for rawmarker in sorted(markers):
303 for rawmarker in sorted(markers):
304 m = obsutil.marker(None, rawmarker)
304 m = obsutil.marker(None, rawmarker)
305 fm.startitem()
305 fm.startitem()
306 fm.plain(indent_string)
306 fm.plain(indent_string)
307 cmdutil.showmarker(fm, m)
307 cmdutil.showmarker(fm, m)
308 fm.end()
308 fm.end()
309
309
310 def _debugphaseheads(ui, data, indent=0):
310 def _debugphaseheads(ui, data, indent=0):
311 """display version and markers contained in 'data'"""
311 """display version and markers contained in 'data'"""
312 indent_string = ' ' * indent
312 indent_string = ' ' * indent
313 headsbyphase = phases.binarydecode(data)
313 headsbyphase = phases.binarydecode(data)
314 for phase in phases.allphases:
314 for phase in phases.allphases:
315 for head in headsbyphase[phase]:
315 for head in headsbyphase[phase]:
316 ui.write(indent_string)
316 ui.write(indent_string)
317 ui.write('%s %s\n' % (hex(head), phases.phasenames[phase]))
317 ui.write('%s %s\n' % (hex(head), phases.phasenames[phase]))
318
318
319 def _quasirepr(thing):
319 def _quasirepr(thing):
320 if isinstance(thing, (dict, util.sortdict, collections.OrderedDict)):
320 if isinstance(thing, (dict, util.sortdict, collections.OrderedDict)):
321 return '{%s}' % (
321 return '{%s}' % (
322 b', '.join(b'%s: %s' % (k, thing[k]) for k in sorted(thing)))
322 b', '.join(b'%s: %s' % (k, thing[k]) for k in sorted(thing)))
323 return pycompat.bytestr(repr(thing))
323 return pycompat.bytestr(repr(thing))
324
324
325 def _debugbundle2(ui, gen, all=None, **opts):
325 def _debugbundle2(ui, gen, all=None, **opts):
326 """lists the contents of a bundle2"""
326 """lists the contents of a bundle2"""
327 if not isinstance(gen, bundle2.unbundle20):
327 if not isinstance(gen, bundle2.unbundle20):
328 raise error.Abort(_('not a bundle2 file'))
328 raise error.Abort(_('not a bundle2 file'))
329 ui.write(('Stream params: %s\n' % _quasirepr(gen.params)))
329 ui.write(('Stream params: %s\n' % _quasirepr(gen.params)))
330 parttypes = opts.get(r'part_type', [])
330 parttypes = opts.get(r'part_type', [])
331 for part in gen.iterparts():
331 for part in gen.iterparts():
332 if parttypes and part.type not in parttypes:
332 if parttypes and part.type not in parttypes:
333 continue
333 continue
334 ui.write('%s -- %s\n' % (part.type, _quasirepr(part.params)))
334 ui.write('%s -- %s\n' % (part.type, _quasirepr(part.params)))
335 if part.type == 'changegroup':
335 if part.type == 'changegroup':
336 version = part.params.get('version', '01')
336 version = part.params.get('version', '01')
337 cg = changegroup.getunbundler(version, part, 'UN')
337 cg = changegroup.getunbundler(version, part, 'UN')
338 _debugchangegroup(ui, cg, all=all, indent=4, **opts)
338 _debugchangegroup(ui, cg, all=all, indent=4, **opts)
339 if part.type == 'obsmarkers':
339 if part.type == 'obsmarkers':
340 _debugobsmarkers(ui, part, indent=4, **opts)
340 _debugobsmarkers(ui, part, indent=4, **opts)
341 if part.type == 'phase-heads':
341 if part.type == 'phase-heads':
342 _debugphaseheads(ui, part, indent=4)
342 _debugphaseheads(ui, part, indent=4)
343
343
344 @command('debugbundle',
344 @command('debugbundle',
345 [('a', 'all', None, _('show all details')),
345 [('a', 'all', None, _('show all details')),
346 ('', 'part-type', [], _('show only the named part type')),
346 ('', 'part-type', [], _('show only the named part type')),
347 ('', 'spec', None, _('print the bundlespec of the bundle'))],
347 ('', 'spec', None, _('print the bundlespec of the bundle'))],
348 _('FILE'),
348 _('FILE'),
349 norepo=True)
349 norepo=True)
350 def debugbundle(ui, bundlepath, all=None, spec=None, **opts):
350 def debugbundle(ui, bundlepath, all=None, spec=None, **opts):
351 """lists the contents of a bundle"""
351 """lists the contents of a bundle"""
352 with hg.openpath(ui, bundlepath) as f:
352 with hg.openpath(ui, bundlepath) as f:
353 if spec:
353 if spec:
354 spec = exchange.getbundlespec(ui, f)
354 spec = exchange.getbundlespec(ui, f)
355 ui.write('%s\n' % spec)
355 ui.write('%s\n' % spec)
356 return
356 return
357
357
358 gen = exchange.readbundle(ui, f, bundlepath)
358 gen = exchange.readbundle(ui, f, bundlepath)
359 if isinstance(gen, bundle2.unbundle20):
359 if isinstance(gen, bundle2.unbundle20):
360 return _debugbundle2(ui, gen, all=all, **opts)
360 return _debugbundle2(ui, gen, all=all, **opts)
361 _debugchangegroup(ui, gen, all=all, **opts)
361 _debugchangegroup(ui, gen, all=all, **opts)
362
362
363 @command('debugcapabilities',
363 @command('debugcapabilities',
364 [], _('PATH'),
364 [], _('PATH'),
365 norepo=True)
365 norepo=True)
366 def debugcapabilities(ui, path, **opts):
366 def debugcapabilities(ui, path, **opts):
367 """lists the capabilities of a remote peer"""
367 """lists the capabilities of a remote peer"""
368 peer = hg.peer(ui, opts, path)
368 peer = hg.peer(ui, opts, path)
369 caps = peer.capabilities()
369 caps = peer.capabilities()
370 ui.write(('Main capabilities:\n'))
370 ui.write(('Main capabilities:\n'))
371 for c in sorted(caps):
371 for c in sorted(caps):
372 ui.write((' %s\n') % c)
372 ui.write((' %s\n') % c)
373 b2caps = bundle2.bundle2caps(peer)
373 b2caps = bundle2.bundle2caps(peer)
374 if b2caps:
374 if b2caps:
375 ui.write(('Bundle2 capabilities:\n'))
375 ui.write(('Bundle2 capabilities:\n'))
376 for key, values in sorted(b2caps.iteritems()):
376 for key, values in sorted(b2caps.iteritems()):
377 ui.write((' %s\n') % key)
377 ui.write((' %s\n') % key)
378 for v in values:
378 for v in values:
379 ui.write((' %s\n') % v)
379 ui.write((' %s\n') % v)
380
380
381 @command('debugcheckstate', [], '')
381 @command('debugcheckstate', [], '')
382 def debugcheckstate(ui, repo):
382 def debugcheckstate(ui, repo):
383 """validate the correctness of the current dirstate"""
383 """validate the correctness of the current dirstate"""
384 parent1, parent2 = repo.dirstate.parents()
384 parent1, parent2 = repo.dirstate.parents()
385 m1 = repo[parent1].manifest()
385 m1 = repo[parent1].manifest()
386 m2 = repo[parent2].manifest()
386 m2 = repo[parent2].manifest()
387 errors = 0
387 errors = 0
388 for f in repo.dirstate:
388 for f in repo.dirstate:
389 state = repo.dirstate[f]
389 state = repo.dirstate[f]
390 if state in "nr" and f not in m1:
390 if state in "nr" and f not in m1:
391 ui.warn(_("%s in state %s, but not in manifest1\n") % (f, state))
391 ui.warn(_("%s in state %s, but not in manifest1\n") % (f, state))
392 errors += 1
392 errors += 1
393 if state in "a" and f in m1:
393 if state in "a" and f in m1:
394 ui.warn(_("%s in state %s, but also in manifest1\n") % (f, state))
394 ui.warn(_("%s in state %s, but also in manifest1\n") % (f, state))
395 errors += 1
395 errors += 1
396 if state in "m" and f not in m1 and f not in m2:
396 if state in "m" and f not in m1 and f not in m2:
397 ui.warn(_("%s in state %s, but not in either manifest\n") %
397 ui.warn(_("%s in state %s, but not in either manifest\n") %
398 (f, state))
398 (f, state))
399 errors += 1
399 errors += 1
400 for f in m1:
400 for f in m1:
401 state = repo.dirstate[f]
401 state = repo.dirstate[f]
402 if state not in "nrm":
402 if state not in "nrm":
403 ui.warn(_("%s in manifest1, but listed as state %s") % (f, state))
403 ui.warn(_("%s in manifest1, but listed as state %s") % (f, state))
404 errors += 1
404 errors += 1
405 if errors:
405 if errors:
406 error = _(".hg/dirstate inconsistent with current parent's manifest")
406 error = _(".hg/dirstate inconsistent with current parent's manifest")
407 raise error.Abort(error)
407 raise error.Abort(error)
408
408
409 @command('debugcolor',
409 @command('debugcolor',
410 [('', 'style', None, _('show all configured styles'))],
410 [('', 'style', None, _('show all configured styles'))],
411 'hg debugcolor')
411 'hg debugcolor')
412 def debugcolor(ui, repo, **opts):
412 def debugcolor(ui, repo, **opts):
413 """show available color, effects or style"""
413 """show available color, effects or style"""
414 ui.write(('color mode: %s\n') % ui._colormode)
414 ui.write(('color mode: %s\n') % ui._colormode)
415 if opts.get(r'style'):
415 if opts.get(r'style'):
416 return _debugdisplaystyle(ui)
416 return _debugdisplaystyle(ui)
417 else:
417 else:
418 return _debugdisplaycolor(ui)
418 return _debugdisplaycolor(ui)
419
419
420 def _debugdisplaycolor(ui):
420 def _debugdisplaycolor(ui):
421 ui = ui.copy()
421 ui = ui.copy()
422 ui._styles.clear()
422 ui._styles.clear()
423 for effect in color._activeeffects(ui).keys():
423 for effect in color._activeeffects(ui).keys():
424 ui._styles[effect] = effect
424 ui._styles[effect] = effect
425 if ui._terminfoparams:
425 if ui._terminfoparams:
426 for k, v in ui.configitems('color'):
426 for k, v in ui.configitems('color'):
427 if k.startswith('color.'):
427 if k.startswith('color.'):
428 ui._styles[k] = k[6:]
428 ui._styles[k] = k[6:]
429 elif k.startswith('terminfo.'):
429 elif k.startswith('terminfo.'):
430 ui._styles[k] = k[9:]
430 ui._styles[k] = k[9:]
431 ui.write(_('available colors:\n'))
431 ui.write(_('available colors:\n'))
432 # sort label with a '_' after the other to group '_background' entry.
432 # sort label with a '_' after the other to group '_background' entry.
433 items = sorted(ui._styles.items(),
433 items = sorted(ui._styles.items(),
434 key=lambda i: ('_' in i[0], i[0], i[1]))
434 key=lambda i: ('_' in i[0], i[0], i[1]))
435 for colorname, label in items:
435 for colorname, label in items:
436 ui.write(('%s\n') % colorname, label=label)
436 ui.write(('%s\n') % colorname, label=label)
437
437
438 def _debugdisplaystyle(ui):
438 def _debugdisplaystyle(ui):
439 ui.write(_('available style:\n'))
439 ui.write(_('available style:\n'))
440 width = max(len(s) for s in ui._styles)
440 width = max(len(s) for s in ui._styles)
441 for label, effects in sorted(ui._styles.items()):
441 for label, effects in sorted(ui._styles.items()):
442 ui.write('%s' % label, label=label)
442 ui.write('%s' % label, label=label)
443 if effects:
443 if effects:
444 # 50
444 # 50
445 ui.write(': ')
445 ui.write(': ')
446 ui.write(' ' * (max(0, width - len(label))))
446 ui.write(' ' * (max(0, width - len(label))))
447 ui.write(', '.join(ui.label(e, e) for e in effects.split()))
447 ui.write(', '.join(ui.label(e, e) for e in effects.split()))
448 ui.write('\n')
448 ui.write('\n')
449
449
450 @command('debugcreatestreamclonebundle', [], 'FILE')
450 @command('debugcreatestreamclonebundle', [], 'FILE')
451 def debugcreatestreamclonebundle(ui, repo, fname):
451 def debugcreatestreamclonebundle(ui, repo, fname):
452 """create a stream clone bundle file
452 """create a stream clone bundle file
453
453
454 Stream bundles are special bundles that are essentially archives of
454 Stream bundles are special bundles that are essentially archives of
455 revlog files. They are commonly used for cloning very quickly.
455 revlog files. They are commonly used for cloning very quickly.
456 """
456 """
457 # TODO we may want to turn this into an abort when this functionality
457 # TODO we may want to turn this into an abort when this functionality
458 # is moved into `hg bundle`.
458 # is moved into `hg bundle`.
459 if phases.hassecret(repo):
459 if phases.hassecret(repo):
460 ui.warn(_('(warning: stream clone bundle will contain secret '
460 ui.warn(_('(warning: stream clone bundle will contain secret '
461 'revisions)\n'))
461 'revisions)\n'))
462
462
463 requirements, gen = streamclone.generatebundlev1(repo)
463 requirements, gen = streamclone.generatebundlev1(repo)
464 changegroup.writechunks(ui, gen, fname)
464 changegroup.writechunks(ui, gen, fname)
465
465
466 ui.write(_('bundle requirements: %s\n') % ', '.join(sorted(requirements)))
466 ui.write(_('bundle requirements: %s\n') % ', '.join(sorted(requirements)))
467
467
468 @command('debugdag',
468 @command('debugdag',
469 [('t', 'tags', None, _('use tags as labels')),
469 [('t', 'tags', None, _('use tags as labels')),
470 ('b', 'branches', None, _('annotate with branch names')),
470 ('b', 'branches', None, _('annotate with branch names')),
471 ('', 'dots', None, _('use dots for runs')),
471 ('', 'dots', None, _('use dots for runs')),
472 ('s', 'spaces', None, _('separate elements by spaces'))],
472 ('s', 'spaces', None, _('separate elements by spaces'))],
473 _('[OPTION]... [FILE [REV]...]'),
473 _('[OPTION]... [FILE [REV]...]'),
474 optionalrepo=True)
474 optionalrepo=True)
475 def debugdag(ui, repo, file_=None, *revs, **opts):
475 def debugdag(ui, repo, file_=None, *revs, **opts):
476 """format the changelog or an index DAG as a concise textual description
476 """format the changelog or an index DAG as a concise textual description
477
477
478 If you pass a revlog index, the revlog's DAG is emitted. If you list
478 If you pass a revlog index, the revlog's DAG is emitted. If you list
479 revision numbers, they get labeled in the output as rN.
479 revision numbers, they get labeled in the output as rN.
480
480
481 Otherwise, the changelog DAG of the current repo is emitted.
481 Otherwise, the changelog DAG of the current repo is emitted.
482 """
482 """
483 spaces = opts.get(r'spaces')
483 spaces = opts.get(r'spaces')
484 dots = opts.get(r'dots')
484 dots = opts.get(r'dots')
485 if file_:
485 if file_:
486 rlog = revlog.revlog(vfsmod.vfs(pycompat.getcwd(), audit=False),
486 rlog = revlog.revlog(vfsmod.vfs(pycompat.getcwd(), audit=False),
487 file_)
487 file_)
488 revs = set((int(r) for r in revs))
488 revs = set((int(r) for r in revs))
489 def events():
489 def events():
490 for r in rlog:
490 for r in rlog:
491 yield 'n', (r, list(p for p in rlog.parentrevs(r)
491 yield 'n', (r, list(p for p in rlog.parentrevs(r)
492 if p != -1))
492 if p != -1))
493 if r in revs:
493 if r in revs:
494 yield 'l', (r, "r%i" % r)
494 yield 'l', (r, "r%i" % r)
495 elif repo:
495 elif repo:
496 cl = repo.changelog
496 cl = repo.changelog
497 tags = opts.get(r'tags')
497 tags = opts.get(r'tags')
498 branches = opts.get(r'branches')
498 branches = opts.get(r'branches')
499 if tags:
499 if tags:
500 labels = {}
500 labels = {}
501 for l, n in repo.tags().items():
501 for l, n in repo.tags().items():
502 labels.setdefault(cl.rev(n), []).append(l)
502 labels.setdefault(cl.rev(n), []).append(l)
503 def events():
503 def events():
504 b = "default"
504 b = "default"
505 for r in cl:
505 for r in cl:
506 if branches:
506 if branches:
507 newb = cl.read(cl.node(r))[5]['branch']
507 newb = cl.read(cl.node(r))[5]['branch']
508 if newb != b:
508 if newb != b:
509 yield 'a', newb
509 yield 'a', newb
510 b = newb
510 b = newb
511 yield 'n', (r, list(p for p in cl.parentrevs(r)
511 yield 'n', (r, list(p for p in cl.parentrevs(r)
512 if p != -1))
512 if p != -1))
513 if tags:
513 if tags:
514 ls = labels.get(r)
514 ls = labels.get(r)
515 if ls:
515 if ls:
516 for l in ls:
516 for l in ls:
517 yield 'l', (r, l)
517 yield 'l', (r, l)
518 else:
518 else:
519 raise error.Abort(_('need repo for changelog dag'))
519 raise error.Abort(_('need repo for changelog dag'))
520
520
521 for line in dagparser.dagtextlines(events(),
521 for line in dagparser.dagtextlines(events(),
522 addspaces=spaces,
522 addspaces=spaces,
523 wraplabels=True,
523 wraplabels=True,
524 wrapannotations=True,
524 wrapannotations=True,
525 wrapnonlinear=dots,
525 wrapnonlinear=dots,
526 usedots=dots,
526 usedots=dots,
527 maxlinewidth=70):
527 maxlinewidth=70):
528 ui.write(line)
528 ui.write(line)
529 ui.write("\n")
529 ui.write("\n")
530
530
531 @command('debugdata', cmdutil.debugrevlogopts, _('-c|-m|FILE REV'))
531 @command('debugdata', cmdutil.debugrevlogopts, _('-c|-m|FILE REV'))
532 def debugdata(ui, repo, file_, rev=None, **opts):
532 def debugdata(ui, repo, file_, rev=None, **opts):
533 """dump the contents of a data file revision"""
533 """dump the contents of a data file revision"""
534 opts = pycompat.byteskwargs(opts)
534 opts = pycompat.byteskwargs(opts)
535 if opts.get('changelog') or opts.get('manifest') or opts.get('dir'):
535 if opts.get('changelog') or opts.get('manifest') or opts.get('dir'):
536 if rev is not None:
536 if rev is not None:
537 raise error.CommandError('debugdata', _('invalid arguments'))
537 raise error.CommandError('debugdata', _('invalid arguments'))
538 file_, rev = None, file_
538 file_, rev = None, file_
539 elif rev is None:
539 elif rev is None:
540 raise error.CommandError('debugdata', _('invalid arguments'))
540 raise error.CommandError('debugdata', _('invalid arguments'))
541 r = cmdutil.openrevlog(repo, 'debugdata', file_, opts)
541 r = cmdutil.openrevlog(repo, 'debugdata', file_, opts)
542 try:
542 try:
543 ui.write(r.revision(r.lookup(rev), raw=True))
543 ui.write(r.revision(r.lookup(rev), raw=True))
544 except KeyError:
544 except KeyError:
545 raise error.Abort(_('invalid revision identifier %s') % rev)
545 raise error.Abort(_('invalid revision identifier %s') % rev)
546
546
547 @command('debugdate',
547 @command('debugdate',
548 [('e', 'extended', None, _('try extended date formats'))],
548 [('e', 'extended', None, _('try extended date formats'))],
549 _('[-e] DATE [RANGE]'),
549 _('[-e] DATE [RANGE]'),
550 norepo=True, optionalrepo=True)
550 norepo=True, optionalrepo=True)
551 def debugdate(ui, date, range=None, **opts):
551 def debugdate(ui, date, range=None, **opts):
552 """parse and display a date"""
552 """parse and display a date"""
553 if opts[r"extended"]:
553 if opts[r"extended"]:
554 d = util.parsedate(date, util.extendeddateformats)
554 d = util.parsedate(date, util.extendeddateformats)
555 else:
555 else:
556 d = util.parsedate(date)
556 d = util.parsedate(date)
557 ui.write(("internal: %s %s\n") % d)
557 ui.write(("internal: %s %s\n") % d)
558 ui.write(("standard: %s\n") % util.datestr(d))
558 ui.write(("standard: %s\n") % util.datestr(d))
559 if range:
559 if range:
560 m = util.matchdate(range)
560 m = util.matchdate(range)
561 ui.write(("match: %s\n") % m(d[0]))
561 ui.write(("match: %s\n") % m(d[0]))
562
562
563 @command('debugdeltachain',
563 @command('debugdeltachain',
564 cmdutil.debugrevlogopts + cmdutil.formatteropts,
564 cmdutil.debugrevlogopts + cmdutil.formatteropts,
565 _('-c|-m|FILE'),
565 _('-c|-m|FILE'),
566 optionalrepo=True)
566 optionalrepo=True)
567 def debugdeltachain(ui, repo, file_=None, **opts):
567 def debugdeltachain(ui, repo, file_=None, **opts):
568 """dump information about delta chains in a revlog
568 """dump information about delta chains in a revlog
569
569
570 Output can be templatized. Available template keywords are:
570 Output can be templatized. Available template keywords are:
571
571
572 :``rev``: revision number
572 :``rev``: revision number
573 :``chainid``: delta chain identifier (numbered by unique base)
573 :``chainid``: delta chain identifier (numbered by unique base)
574 :``chainlen``: delta chain length to this revision
574 :``chainlen``: delta chain length to this revision
575 :``prevrev``: previous revision in delta chain
575 :``prevrev``: previous revision in delta chain
576 :``deltatype``: role of delta / how it was computed
576 :``deltatype``: role of delta / how it was computed
577 :``compsize``: compressed size of revision
577 :``compsize``: compressed size of revision
578 :``uncompsize``: uncompressed size of revision
578 :``uncompsize``: uncompressed size of revision
579 :``chainsize``: total size of compressed revisions in chain
579 :``chainsize``: total size of compressed revisions in chain
580 :``chainratio``: total chain size divided by uncompressed revision size
580 :``chainratio``: total chain size divided by uncompressed revision size
581 (new delta chains typically start at ratio 2.00)
581 (new delta chains typically start at ratio 2.00)
582 :``lindist``: linear distance from base revision in delta chain to end
582 :``lindist``: linear distance from base revision in delta chain to end
583 of this revision
583 of this revision
584 :``extradist``: total size of revisions not part of this delta chain from
584 :``extradist``: total size of revisions not part of this delta chain from
585 base of delta chain to end of this revision; a measurement
585 base of delta chain to end of this revision; a measurement
586 of how much extra data we need to read/seek across to read
586 of how much extra data we need to read/seek across to read
587 the delta chain for this revision
587 the delta chain for this revision
588 :``extraratio``: extradist divided by chainsize; another representation of
588 :``extraratio``: extradist divided by chainsize; another representation of
589 how much unrelated data is needed to load this delta chain
589 how much unrelated data is needed to load this delta chain
590
590
591 If the repository is configured to use the sparse read, additional keywords
591 If the repository is configured to use the sparse read, additional keywords
592 are available:
592 are available:
593
593
594 :``readsize``: total size of data read from the disk for a revision
594 :``readsize``: total size of data read from the disk for a revision
595 (sum of the sizes of all the blocks)
595 (sum of the sizes of all the blocks)
596 :``largestblock``: size of the largest block of data read from the disk
596 :``largestblock``: size of the largest block of data read from the disk
597 :``readdensity``: density of useful bytes in the data read from the disk
597 :``readdensity``: density of useful bytes in the data read from the disk
598
598
599 The sparse read can be enabled with experimental.sparse-read = True
599 The sparse read can be enabled with experimental.sparse-read = True
600 """
600 """
601 opts = pycompat.byteskwargs(opts)
601 opts = pycompat.byteskwargs(opts)
602 r = cmdutil.openrevlog(repo, 'debugdeltachain', file_, opts)
602 r = cmdutil.openrevlog(repo, 'debugdeltachain', file_, opts)
603 index = r.index
603 index = r.index
604 generaldelta = r.version & revlog.FLAG_GENERALDELTA
604 generaldelta = r.version & revlog.FLAG_GENERALDELTA
605 withsparseread = getattr(r, '_withsparseread', False)
605 withsparseread = getattr(r, '_withsparseread', False)
606
606
607 def revinfo(rev):
607 def revinfo(rev):
608 e = index[rev]
608 e = index[rev]
609 compsize = e[1]
609 compsize = e[1]
610 uncompsize = e[2]
610 uncompsize = e[2]
611 chainsize = 0
611 chainsize = 0
612
612
613 if generaldelta:
613 if generaldelta:
614 if e[3] == e[5]:
614 if e[3] == e[5]:
615 deltatype = 'p1'
615 deltatype = 'p1'
616 elif e[3] == e[6]:
616 elif e[3] == e[6]:
617 deltatype = 'p2'
617 deltatype = 'p2'
618 elif e[3] == rev - 1:
618 elif e[3] == rev - 1:
619 deltatype = 'prev'
619 deltatype = 'prev'
620 elif e[3] == rev:
620 elif e[3] == rev:
621 deltatype = 'base'
621 deltatype = 'base'
622 else:
622 else:
623 deltatype = 'other'
623 deltatype = 'other'
624 else:
624 else:
625 if e[3] == rev:
625 if e[3] == rev:
626 deltatype = 'base'
626 deltatype = 'base'
627 else:
627 else:
628 deltatype = 'prev'
628 deltatype = 'prev'
629
629
630 chain = r._deltachain(rev)[0]
630 chain = r._deltachain(rev)[0]
631 for iterrev in chain:
631 for iterrev in chain:
632 e = index[iterrev]
632 e = index[iterrev]
633 chainsize += e[1]
633 chainsize += e[1]
634
634
635 return compsize, uncompsize, deltatype, chain, chainsize
635 return compsize, uncompsize, deltatype, chain, chainsize
636
636
637 fm = ui.formatter('debugdeltachain', opts)
637 fm = ui.formatter('debugdeltachain', opts)
638
638
639 fm.plain(' rev chain# chainlen prev delta '
639 fm.plain(' rev chain# chainlen prev delta '
640 'size rawsize chainsize ratio lindist extradist '
640 'size rawsize chainsize ratio lindist extradist '
641 'extraratio')
641 'extraratio')
642 if withsparseread:
642 if withsparseread:
643 fm.plain(' readsize largestblk rddensity')
643 fm.plain(' readsize largestblk rddensity')
644 fm.plain('\n')
644 fm.plain('\n')
645
645
646 chainbases = {}
646 chainbases = {}
647 for rev in r:
647 for rev in r:
648 comp, uncomp, deltatype, chain, chainsize = revinfo(rev)
648 comp, uncomp, deltatype, chain, chainsize = revinfo(rev)
649 chainbase = chain[0]
649 chainbase = chain[0]
650 chainid = chainbases.setdefault(chainbase, len(chainbases) + 1)
650 chainid = chainbases.setdefault(chainbase, len(chainbases) + 1)
651 start = r.start
651 start = r.start
652 length = r.length
652 length = r.length
653 basestart = start(chainbase)
653 basestart = start(chainbase)
654 revstart = start(rev)
654 revstart = start(rev)
655 lineardist = revstart + comp - basestart
655 lineardist = revstart + comp - basestart
656 extradist = lineardist - chainsize
656 extradist = lineardist - chainsize
657 try:
657 try:
658 prevrev = chain[-2]
658 prevrev = chain[-2]
659 except IndexError:
659 except IndexError:
660 prevrev = -1
660 prevrev = -1
661
661
662 chainratio = float(chainsize) / float(uncomp)
662 chainratio = float(chainsize) / float(uncomp)
663 extraratio = float(extradist) / float(chainsize)
663 extraratio = float(extradist) / float(chainsize)
664
664
665 fm.startitem()
665 fm.startitem()
666 fm.write('rev chainid chainlen prevrev deltatype compsize '
666 fm.write('rev chainid chainlen prevrev deltatype compsize '
667 'uncompsize chainsize chainratio lindist extradist '
667 'uncompsize chainsize chainratio lindist extradist '
668 'extraratio',
668 'extraratio',
669 '%7d %7d %8d %8d %7s %10d %10d %10d %9.5f %9d %9d %10.5f',
669 '%7d %7d %8d %8d %7s %10d %10d %10d %9.5f %9d %9d %10.5f',
670 rev, chainid, len(chain), prevrev, deltatype, comp,
670 rev, chainid, len(chain), prevrev, deltatype, comp,
671 uncomp, chainsize, chainratio, lineardist, extradist,
671 uncomp, chainsize, chainratio, lineardist, extradist,
672 extraratio,
672 extraratio,
673 rev=rev, chainid=chainid, chainlen=len(chain),
673 rev=rev, chainid=chainid, chainlen=len(chain),
674 prevrev=prevrev, deltatype=deltatype, compsize=comp,
674 prevrev=prevrev, deltatype=deltatype, compsize=comp,
675 uncompsize=uncomp, chainsize=chainsize,
675 uncompsize=uncomp, chainsize=chainsize,
676 chainratio=chainratio, lindist=lineardist,
676 chainratio=chainratio, lindist=lineardist,
677 extradist=extradist, extraratio=extraratio)
677 extradist=extradist, extraratio=extraratio)
678 if withsparseread:
678 if withsparseread:
679 readsize = 0
679 readsize = 0
680 largestblock = 0
680 largestblock = 0
681 for revschunk in revlog._slicechunk(r, chain):
681 for revschunk in revlog._slicechunk(r, chain):
682 blkend = start(revschunk[-1]) + length(revschunk[-1])
682 blkend = start(revschunk[-1]) + length(revschunk[-1])
683 blksize = blkend - start(revschunk[0])
683 blksize = blkend - start(revschunk[0])
684
684
685 readsize += blksize
685 readsize += blksize
686 if largestblock < blksize:
686 if largestblock < blksize:
687 largestblock = blksize
687 largestblock = blksize
688
688
689 readdensity = float(chainsize) / float(readsize)
689 readdensity = float(chainsize) / float(readsize)
690
690
691 fm.write('readsize largestblock readdensity',
691 fm.write('readsize largestblock readdensity',
692 ' %10d %10d %9.5f',
692 ' %10d %10d %9.5f',
693 readsize, largestblock, readdensity,
693 readsize, largestblock, readdensity,
694 readsize=readsize, largestblock=largestblock,
694 readsize=readsize, largestblock=largestblock,
695 readdensity=readdensity)
695 readdensity=readdensity)
696
696
697 fm.plain('\n')
697 fm.plain('\n')
698
698
699 fm.end()
699 fm.end()
700
700
701 @command('debugdirstate|debugstate',
701 @command('debugdirstate|debugstate',
702 [('', 'nodates', None, _('do not display the saved mtime')),
702 [('', 'nodates', None, _('do not display the saved mtime')),
703 ('', 'datesort', None, _('sort by saved mtime'))],
703 ('', 'datesort', None, _('sort by saved mtime'))],
704 _('[OPTION]...'))
704 _('[OPTION]...'))
705 def debugstate(ui, repo, **opts):
705 def debugstate(ui, repo, **opts):
706 """show the contents of the current dirstate"""
706 """show the contents of the current dirstate"""
707
707
708 nodates = opts.get(r'nodates')
708 nodates = opts.get(r'nodates')
709 datesort = opts.get(r'datesort')
709 datesort = opts.get(r'datesort')
710
710
711 timestr = ""
711 timestr = ""
712 if datesort:
712 if datesort:
713 keyfunc = lambda x: (x[1][3], x[0]) # sort by mtime, then by filename
713 keyfunc = lambda x: (x[1][3], x[0]) # sort by mtime, then by filename
714 else:
714 else:
715 keyfunc = None # sort by filename
715 keyfunc = None # sort by filename
716 for file_, ent in sorted(repo.dirstate._map.iteritems(), key=keyfunc):
716 for file_, ent in sorted(repo.dirstate._map.iteritems(), key=keyfunc):
717 if ent[3] == -1:
717 if ent[3] == -1:
718 timestr = 'unset '
718 timestr = 'unset '
719 elif nodates:
719 elif nodates:
720 timestr = 'set '
720 timestr = 'set '
721 else:
721 else:
722 timestr = time.strftime(r"%Y-%m-%d %H:%M:%S ",
722 timestr = time.strftime(r"%Y-%m-%d %H:%M:%S ",
723 time.localtime(ent[3]))
723 time.localtime(ent[3]))
724 timestr = encoding.strtolocal(timestr)
724 timestr = encoding.strtolocal(timestr)
725 if ent[1] & 0o20000:
725 if ent[1] & 0o20000:
726 mode = 'lnk'
726 mode = 'lnk'
727 else:
727 else:
728 mode = '%3o' % (ent[1] & 0o777 & ~util.umask)
728 mode = '%3o' % (ent[1] & 0o777 & ~util.umask)
729 ui.write("%c %s %10d %s%s\n" % (ent[0], mode, ent[2], timestr, file_))
729 ui.write("%c %s %10d %s%s\n" % (ent[0], mode, ent[2], timestr, file_))
730 for f in repo.dirstate.copies():
730 for f in repo.dirstate.copies():
731 ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copied(f), f))
731 ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copied(f), f))
732
732
733 @command('debugdiscovery',
733 @command('debugdiscovery',
734 [('', 'old', None, _('use old-style discovery')),
734 [('', 'old', None, _('use old-style discovery')),
735 ('', 'nonheads', None,
735 ('', 'nonheads', None,
736 _('use old-style discovery with non-heads included')),
736 _('use old-style discovery with non-heads included')),
737 ('', 'rev', [], 'restrict discovery to this set of revs'),
737 ('', 'rev', [], 'restrict discovery to this set of revs'),
738 ] + cmdutil.remoteopts,
738 ] + cmdutil.remoteopts,
739 _('[-l REV] [-r REV] [-b BRANCH]... [OTHER]'))
739 _('[-l REV] [-r REV] [-b BRANCH]... [OTHER]'))
740 def debugdiscovery(ui, repo, remoteurl="default", **opts):
740 def debugdiscovery(ui, repo, remoteurl="default", **opts):
741 """runs the changeset discovery protocol in isolation"""
741 """runs the changeset discovery protocol in isolation"""
742 opts = pycompat.byteskwargs(opts)
742 opts = pycompat.byteskwargs(opts)
743 remoteurl, branches = hg.parseurl(ui.expandpath(remoteurl),
743 remoteurl, branches = hg.parseurl(ui.expandpath(remoteurl),
744 opts.get('branch'))
744 opts.get('branch'))
745 remote = hg.peer(repo, opts, remoteurl)
745 remote = hg.peer(repo, opts, remoteurl)
746 ui.status(_('comparing with %s\n') % util.hidepassword(remoteurl))
746 ui.status(_('comparing with %s\n') % util.hidepassword(remoteurl))
747
747
748 # make sure tests are repeatable
748 # make sure tests are repeatable
749 random.seed(12323)
749 random.seed(12323)
750
750
751 def doit(pushedrevs, remoteheads, remote=remote):
751 def doit(pushedrevs, remoteheads, remote=remote):
752 if opts.get('old'):
752 if opts.get('old'):
753 if not util.safehasattr(remote, 'branches'):
753 if not util.safehasattr(remote, 'branches'):
754 # enable in-client legacy support
754 # enable in-client legacy support
755 remote = localrepo.locallegacypeer(remote.local())
755 remote = localrepo.locallegacypeer(remote.local())
756 common, _in, hds = treediscovery.findcommonincoming(repo, remote,
756 common, _in, hds = treediscovery.findcommonincoming(repo, remote,
757 force=True)
757 force=True)
758 common = set(common)
758 common = set(common)
759 if not opts.get('nonheads'):
759 if not opts.get('nonheads'):
760 ui.write(("unpruned common: %s\n") %
760 ui.write(("unpruned common: %s\n") %
761 " ".join(sorted(short(n) for n in common)))
761 " ".join(sorted(short(n) for n in common)))
762 dag = dagutil.revlogdag(repo.changelog)
762 dag = dagutil.revlogdag(repo.changelog)
763 all = dag.ancestorset(dag.internalizeall(common))
763 all = dag.ancestorset(dag.internalizeall(common))
764 common = dag.externalizeall(dag.headsetofconnecteds(all))
764 common = dag.externalizeall(dag.headsetofconnecteds(all))
765 else:
765 else:
766 nodes = None
766 nodes = None
767 if pushedrevs:
767 if pushedrevs:
768 revs = scmutil.revrange(repo, pushedrevs)
768 revs = scmutil.revrange(repo, pushedrevs)
769 nodes = [repo[r].node() for r in revs]
769 nodes = [repo[r].node() for r in revs]
770 common, any, hds = setdiscovery.findcommonheads(ui, repo, remote,
770 common, any, hds = setdiscovery.findcommonheads(ui, repo, remote,
771 ancestorsof=nodes)
771 ancestorsof=nodes)
772 common = set(common)
772 common = set(common)
773 rheads = set(hds)
773 rheads = set(hds)
774 lheads = set(repo.heads())
774 lheads = set(repo.heads())
775 ui.write(("common heads: %s\n") %
775 ui.write(("common heads: %s\n") %
776 " ".join(sorted(short(n) for n in common)))
776 " ".join(sorted(short(n) for n in common)))
777 if lheads <= common:
777 if lheads <= common:
778 ui.write(("local is subset\n"))
778 ui.write(("local is subset\n"))
779 elif rheads <= common:
779 elif rheads <= common:
780 ui.write(("remote is subset\n"))
780 ui.write(("remote is subset\n"))
781
781
782 serverlogs = opts.get('serverlog')
782 serverlogs = opts.get('serverlog')
783 if serverlogs:
783 if serverlogs:
784 for filename in serverlogs:
784 for filename in serverlogs:
785 with open(filename, 'r') as logfile:
785 with open(filename, 'r') as logfile:
786 line = logfile.readline()
786 line = logfile.readline()
787 while line:
787 while line:
788 parts = line.strip().split(';')
788 parts = line.strip().split(';')
789 op = parts[1]
789 op = parts[1]
790 if op == 'cg':
790 if op == 'cg':
791 pass
791 pass
792 elif op == 'cgss':
792 elif op == 'cgss':
793 doit(parts[2].split(' '), parts[3].split(' '))
793 doit(parts[2].split(' '), parts[3].split(' '))
794 elif op == 'unb':
794 elif op == 'unb':
795 doit(parts[3].split(' '), parts[2].split(' '))
795 doit(parts[3].split(' '), parts[2].split(' '))
796 line = logfile.readline()
796 line = logfile.readline()
797 else:
797 else:
798 remoterevs, _checkout = hg.addbranchrevs(repo, remote, branches,
798 remoterevs, _checkout = hg.addbranchrevs(repo, remote, branches,
799 opts.get('remote_head'))
799 opts.get('remote_head'))
800 localrevs = opts.get('rev')
800 localrevs = opts.get('rev')
801 doit(localrevs, remoterevs)
801 doit(localrevs, remoterevs)
802
802
803 @command('debugextensions', cmdutil.formatteropts, [], norepo=True)
803 @command('debugextensions', cmdutil.formatteropts, [], norepo=True)
804 def debugextensions(ui, **opts):
804 def debugextensions(ui, **opts):
805 '''show information about active extensions'''
805 '''show information about active extensions'''
806 opts = pycompat.byteskwargs(opts)
806 opts = pycompat.byteskwargs(opts)
807 exts = extensions.extensions(ui)
807 exts = extensions.extensions(ui)
808 hgver = util.version()
808 hgver = util.version()
809 fm = ui.formatter('debugextensions', opts)
809 fm = ui.formatter('debugextensions', opts)
810 for extname, extmod in sorted(exts, key=operator.itemgetter(0)):
810 for extname, extmod in sorted(exts, key=operator.itemgetter(0)):
811 isinternal = extensions.ismoduleinternal(extmod)
811 isinternal = extensions.ismoduleinternal(extmod)
812 extsource = pycompat.fsencode(extmod.__file__)
812 extsource = pycompat.fsencode(extmod.__file__)
813 if isinternal:
813 if isinternal:
814 exttestedwith = [] # never expose magic string to users
814 exttestedwith = [] # never expose magic string to users
815 else:
815 else:
816 exttestedwith = getattr(extmod, 'testedwith', '').split()
816 exttestedwith = getattr(extmod, 'testedwith', '').split()
817 extbuglink = getattr(extmod, 'buglink', None)
817 extbuglink = getattr(extmod, 'buglink', None)
818
818
819 fm.startitem()
819 fm.startitem()
820
820
821 if ui.quiet or ui.verbose:
821 if ui.quiet or ui.verbose:
822 fm.write('name', '%s\n', extname)
822 fm.write('name', '%s\n', extname)
823 else:
823 else:
824 fm.write('name', '%s', extname)
824 fm.write('name', '%s', extname)
825 if isinternal or hgver in exttestedwith:
825 if isinternal or hgver in exttestedwith:
826 fm.plain('\n')
826 fm.plain('\n')
827 elif not exttestedwith:
827 elif not exttestedwith:
828 fm.plain(_(' (untested!)\n'))
828 fm.plain(_(' (untested!)\n'))
829 else:
829 else:
830 lasttestedversion = exttestedwith[-1]
830 lasttestedversion = exttestedwith[-1]
831 fm.plain(' (%s!)\n' % lasttestedversion)
831 fm.plain(' (%s!)\n' % lasttestedversion)
832
832
833 fm.condwrite(ui.verbose and extsource, 'source',
833 fm.condwrite(ui.verbose and extsource, 'source',
834 _(' location: %s\n'), extsource or "")
834 _(' location: %s\n'), extsource or "")
835
835
836 if ui.verbose:
836 if ui.verbose:
837 fm.plain(_(' bundled: %s\n') % ['no', 'yes'][isinternal])
837 fm.plain(_(' bundled: %s\n') % ['no', 'yes'][isinternal])
838 fm.data(bundled=isinternal)
838 fm.data(bundled=isinternal)
839
839
840 fm.condwrite(ui.verbose and exttestedwith, 'testedwith',
840 fm.condwrite(ui.verbose and exttestedwith, 'testedwith',
841 _(' tested with: %s\n'),
841 _(' tested with: %s\n'),
842 fm.formatlist(exttestedwith, name='ver'))
842 fm.formatlist(exttestedwith, name='ver'))
843
843
844 fm.condwrite(ui.verbose and extbuglink, 'buglink',
844 fm.condwrite(ui.verbose and extbuglink, 'buglink',
845 _(' bug reporting: %s\n'), extbuglink or "")
845 _(' bug reporting: %s\n'), extbuglink or "")
846
846
847 fm.end()
847 fm.end()
848
848
849 @command('debugfileset',
849 @command('debugfileset',
850 [('r', 'rev', '', _('apply the filespec on this revision'), _('REV'))],
850 [('r', 'rev', '', _('apply the filespec on this revision'), _('REV'))],
851 _('[-r REV] FILESPEC'))
851 _('[-r REV] FILESPEC'))
852 def debugfileset(ui, repo, expr, **opts):
852 def debugfileset(ui, repo, expr, **opts):
853 '''parse and apply a fileset specification'''
853 '''parse and apply a fileset specification'''
854 ctx = scmutil.revsingle(repo, opts.get(r'rev'), None)
854 ctx = scmutil.revsingle(repo, opts.get(r'rev'), None)
855 if ui.verbose:
855 if ui.verbose:
856 tree = fileset.parse(expr)
856 tree = fileset.parse(expr)
857 ui.note(fileset.prettyformat(tree), "\n")
857 ui.note(fileset.prettyformat(tree), "\n")
858
858
859 for f in ctx.getfileset(expr):
859 for f in ctx.getfileset(expr):
860 ui.write("%s\n" % f)
860 ui.write("%s\n" % f)
861
861
862 @command('debugformat',
863 [] + cmdutil.formatteropts,
864 _(''))
865 def debugformat(ui, repo, **opts):
866 """display format information about the current repository"""
867 maxvariantlength = max(len(fv.name) for fv in upgrade.allformatvariant)
868 maxvariantlength = max(len('format-variant'), maxvariantlength)
869
870 def makeformatname(name):
871 return '%s:' + (' ' * (maxvariantlength - len(name)))
872
873 def formatvalue(value):
874 if value:
875 return 'yes'
876 else:
877 return 'no'
878
879 fm = ui.formatter('debugformat', opts)
880 fm.plain('format-variant')
881 fm.plain(' ' * (maxvariantlength - len('format-variant')))
882 fm.plain(' repo')
883 fm.plain('\n')
884 fm.startitem()
885 for fv in upgrade.allformatvariant:
886 repovalue = fv.fromrepo(repo)
887
888 fm.write('name', makeformatname(fv.name), fv.name,
889 label='formatvariant.name')
890 fm.write('repo', ' %3s', formatvalue(repovalue),
891 label='formatvariant.repo')
892 fm.plain('\n')
893
862 @command('debugfsinfo', [], _('[PATH]'), norepo=True)
894 @command('debugfsinfo', [], _('[PATH]'), norepo=True)
863 def debugfsinfo(ui, path="."):
895 def debugfsinfo(ui, path="."):
864 """show information detected about current filesystem"""
896 """show information detected about current filesystem"""
865 ui.write(('exec: %s\n') % (util.checkexec(path) and 'yes' or 'no'))
897 ui.write(('exec: %s\n') % (util.checkexec(path) and 'yes' or 'no'))
866 ui.write(('fstype: %s\n') % (util.getfstype(path) or '(unknown)'))
898 ui.write(('fstype: %s\n') % (util.getfstype(path) or '(unknown)'))
867 ui.write(('symlink: %s\n') % (util.checklink(path) and 'yes' or 'no'))
899 ui.write(('symlink: %s\n') % (util.checklink(path) and 'yes' or 'no'))
868 ui.write(('hardlink: %s\n') % (util.checknlink(path) and 'yes' or 'no'))
900 ui.write(('hardlink: %s\n') % (util.checknlink(path) and 'yes' or 'no'))
869 casesensitive = '(unknown)'
901 casesensitive = '(unknown)'
870 try:
902 try:
871 with tempfile.NamedTemporaryFile(prefix='.debugfsinfo', dir=path) as f:
903 with tempfile.NamedTemporaryFile(prefix='.debugfsinfo', dir=path) as f:
872 casesensitive = util.fscasesensitive(f.name) and 'yes' or 'no'
904 casesensitive = util.fscasesensitive(f.name) and 'yes' or 'no'
873 except OSError:
905 except OSError:
874 pass
906 pass
875 ui.write(('case-sensitive: %s\n') % casesensitive)
907 ui.write(('case-sensitive: %s\n') % casesensitive)
876
908
877 @command('debuggetbundle',
909 @command('debuggetbundle',
878 [('H', 'head', [], _('id of head node'), _('ID')),
910 [('H', 'head', [], _('id of head node'), _('ID')),
879 ('C', 'common', [], _('id of common node'), _('ID')),
911 ('C', 'common', [], _('id of common node'), _('ID')),
880 ('t', 'type', 'bzip2', _('bundle compression type to use'), _('TYPE'))],
912 ('t', 'type', 'bzip2', _('bundle compression type to use'), _('TYPE'))],
881 _('REPO FILE [-H|-C ID]...'),
913 _('REPO FILE [-H|-C ID]...'),
882 norepo=True)
914 norepo=True)
883 def debuggetbundle(ui, repopath, bundlepath, head=None, common=None, **opts):
915 def debuggetbundle(ui, repopath, bundlepath, head=None, common=None, **opts):
884 """retrieves a bundle from a repo
916 """retrieves a bundle from a repo
885
917
886 Every ID must be a full-length hex node id string. Saves the bundle to the
918 Every ID must be a full-length hex node id string. Saves the bundle to the
887 given file.
919 given file.
888 """
920 """
889 opts = pycompat.byteskwargs(opts)
921 opts = pycompat.byteskwargs(opts)
890 repo = hg.peer(ui, opts, repopath)
922 repo = hg.peer(ui, opts, repopath)
891 if not repo.capable('getbundle'):
923 if not repo.capable('getbundle'):
892 raise error.Abort("getbundle() not supported by target repository")
924 raise error.Abort("getbundle() not supported by target repository")
893 args = {}
925 args = {}
894 if common:
926 if common:
895 args[r'common'] = [bin(s) for s in common]
927 args[r'common'] = [bin(s) for s in common]
896 if head:
928 if head:
897 args[r'heads'] = [bin(s) for s in head]
929 args[r'heads'] = [bin(s) for s in head]
898 # TODO: get desired bundlecaps from command line.
930 # TODO: get desired bundlecaps from command line.
899 args[r'bundlecaps'] = None
931 args[r'bundlecaps'] = None
900 bundle = repo.getbundle('debug', **args)
932 bundle = repo.getbundle('debug', **args)
901
933
902 bundletype = opts.get('type', 'bzip2').lower()
934 bundletype = opts.get('type', 'bzip2').lower()
903 btypes = {'none': 'HG10UN',
935 btypes = {'none': 'HG10UN',
904 'bzip2': 'HG10BZ',
936 'bzip2': 'HG10BZ',
905 'gzip': 'HG10GZ',
937 'gzip': 'HG10GZ',
906 'bundle2': 'HG20'}
938 'bundle2': 'HG20'}
907 bundletype = btypes.get(bundletype)
939 bundletype = btypes.get(bundletype)
908 if bundletype not in bundle2.bundletypes:
940 if bundletype not in bundle2.bundletypes:
909 raise error.Abort(_('unknown bundle type specified with --type'))
941 raise error.Abort(_('unknown bundle type specified with --type'))
910 bundle2.writebundle(ui, bundle, bundlepath, bundletype)
942 bundle2.writebundle(ui, bundle, bundlepath, bundletype)
911
943
912 @command('debugignore', [], '[FILE]')
944 @command('debugignore', [], '[FILE]')
913 def debugignore(ui, repo, *files, **opts):
945 def debugignore(ui, repo, *files, **opts):
914 """display the combined ignore pattern and information about ignored files
946 """display the combined ignore pattern and information about ignored files
915
947
916 With no argument display the combined ignore pattern.
948 With no argument display the combined ignore pattern.
917
949
918 Given space separated file names, shows if the given file is ignored and
950 Given space separated file names, shows if the given file is ignored and
919 if so, show the ignore rule (file and line number) that matched it.
951 if so, show the ignore rule (file and line number) that matched it.
920 """
952 """
921 ignore = repo.dirstate._ignore
953 ignore = repo.dirstate._ignore
922 if not files:
954 if not files:
923 # Show all the patterns
955 # Show all the patterns
924 ui.write("%s\n" % repr(ignore))
956 ui.write("%s\n" % repr(ignore))
925 else:
957 else:
926 m = scmutil.match(repo[None], pats=files)
958 m = scmutil.match(repo[None], pats=files)
927 for f in m.files():
959 for f in m.files():
928 nf = util.normpath(f)
960 nf = util.normpath(f)
929 ignored = None
961 ignored = None
930 ignoredata = None
962 ignoredata = None
931 if nf != '.':
963 if nf != '.':
932 if ignore(nf):
964 if ignore(nf):
933 ignored = nf
965 ignored = nf
934 ignoredata = repo.dirstate._ignorefileandline(nf)
966 ignoredata = repo.dirstate._ignorefileandline(nf)
935 else:
967 else:
936 for p in util.finddirs(nf):
968 for p in util.finddirs(nf):
937 if ignore(p):
969 if ignore(p):
938 ignored = p
970 ignored = p
939 ignoredata = repo.dirstate._ignorefileandline(p)
971 ignoredata = repo.dirstate._ignorefileandline(p)
940 break
972 break
941 if ignored:
973 if ignored:
942 if ignored == nf:
974 if ignored == nf:
943 ui.write(_("%s is ignored\n") % m.uipath(f))
975 ui.write(_("%s is ignored\n") % m.uipath(f))
944 else:
976 else:
945 ui.write(_("%s is ignored because of "
977 ui.write(_("%s is ignored because of "
946 "containing folder %s\n")
978 "containing folder %s\n")
947 % (m.uipath(f), ignored))
979 % (m.uipath(f), ignored))
948 ignorefile, lineno, line = ignoredata
980 ignorefile, lineno, line = ignoredata
949 ui.write(_("(ignore rule in %s, line %d: '%s')\n")
981 ui.write(_("(ignore rule in %s, line %d: '%s')\n")
950 % (ignorefile, lineno, line))
982 % (ignorefile, lineno, line))
951 else:
983 else:
952 ui.write(_("%s is not ignored\n") % m.uipath(f))
984 ui.write(_("%s is not ignored\n") % m.uipath(f))
953
985
954 @command('debugindex', cmdutil.debugrevlogopts +
986 @command('debugindex', cmdutil.debugrevlogopts +
955 [('f', 'format', 0, _('revlog format'), _('FORMAT'))],
987 [('f', 'format', 0, _('revlog format'), _('FORMAT'))],
956 _('[-f FORMAT] -c|-m|FILE'),
988 _('[-f FORMAT] -c|-m|FILE'),
957 optionalrepo=True)
989 optionalrepo=True)
958 def debugindex(ui, repo, file_=None, **opts):
990 def debugindex(ui, repo, file_=None, **opts):
959 """dump the contents of an index file"""
991 """dump the contents of an index file"""
960 opts = pycompat.byteskwargs(opts)
992 opts = pycompat.byteskwargs(opts)
961 r = cmdutil.openrevlog(repo, 'debugindex', file_, opts)
993 r = cmdutil.openrevlog(repo, 'debugindex', file_, opts)
962 format = opts.get('format', 0)
994 format = opts.get('format', 0)
963 if format not in (0, 1):
995 if format not in (0, 1):
964 raise error.Abort(_("unknown format %d") % format)
996 raise error.Abort(_("unknown format %d") % format)
965
997
966 generaldelta = r.version & revlog.FLAG_GENERALDELTA
998 generaldelta = r.version & revlog.FLAG_GENERALDELTA
967 if generaldelta:
999 if generaldelta:
968 basehdr = ' delta'
1000 basehdr = ' delta'
969 else:
1001 else:
970 basehdr = ' base'
1002 basehdr = ' base'
971
1003
972 if ui.debugflag:
1004 if ui.debugflag:
973 shortfn = hex
1005 shortfn = hex
974 else:
1006 else:
975 shortfn = short
1007 shortfn = short
976
1008
977 # There might not be anything in r, so have a sane default
1009 # There might not be anything in r, so have a sane default
978 idlen = 12
1010 idlen = 12
979 for i in r:
1011 for i in r:
980 idlen = len(shortfn(r.node(i)))
1012 idlen = len(shortfn(r.node(i)))
981 break
1013 break
982
1014
983 if format == 0:
1015 if format == 0:
984 ui.write((" rev offset length " + basehdr + " linkrev"
1016 ui.write((" rev offset length " + basehdr + " linkrev"
985 " %s %s p2\n") % ("nodeid".ljust(idlen), "p1".ljust(idlen)))
1017 " %s %s p2\n") % ("nodeid".ljust(idlen), "p1".ljust(idlen)))
986 elif format == 1:
1018 elif format == 1:
987 ui.write((" rev flag offset length"
1019 ui.write((" rev flag offset length"
988 " size " + basehdr + " link p1 p2"
1020 " size " + basehdr + " link p1 p2"
989 " %s\n") % "nodeid".rjust(idlen))
1021 " %s\n") % "nodeid".rjust(idlen))
990
1022
991 for i in r:
1023 for i in r:
992 node = r.node(i)
1024 node = r.node(i)
993 if generaldelta:
1025 if generaldelta:
994 base = r.deltaparent(i)
1026 base = r.deltaparent(i)
995 else:
1027 else:
996 base = r.chainbase(i)
1028 base = r.chainbase(i)
997 if format == 0:
1029 if format == 0:
998 try:
1030 try:
999 pp = r.parents(node)
1031 pp = r.parents(node)
1000 except Exception:
1032 except Exception:
1001 pp = [nullid, nullid]
1033 pp = [nullid, nullid]
1002 ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % (
1034 ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % (
1003 i, r.start(i), r.length(i), base, r.linkrev(i),
1035 i, r.start(i), r.length(i), base, r.linkrev(i),
1004 shortfn(node), shortfn(pp[0]), shortfn(pp[1])))
1036 shortfn(node), shortfn(pp[0]), shortfn(pp[1])))
1005 elif format == 1:
1037 elif format == 1:
1006 pr = r.parentrevs(i)
1038 pr = r.parentrevs(i)
1007 ui.write("% 6d %04x % 8d % 8d % 8d % 6d % 6d % 6d % 6d %s\n" % (
1039 ui.write("% 6d %04x % 8d % 8d % 8d % 6d % 6d % 6d % 6d %s\n" % (
1008 i, r.flags(i), r.start(i), r.length(i), r.rawsize(i),
1040 i, r.flags(i), r.start(i), r.length(i), r.rawsize(i),
1009 base, r.linkrev(i), pr[0], pr[1], shortfn(node)))
1041 base, r.linkrev(i), pr[0], pr[1], shortfn(node)))
1010
1042
1011 @command('debugindexdot', cmdutil.debugrevlogopts,
1043 @command('debugindexdot', cmdutil.debugrevlogopts,
1012 _('-c|-m|FILE'), optionalrepo=True)
1044 _('-c|-m|FILE'), optionalrepo=True)
1013 def debugindexdot(ui, repo, file_=None, **opts):
1045 def debugindexdot(ui, repo, file_=None, **opts):
1014 """dump an index DAG as a graphviz dot file"""
1046 """dump an index DAG as a graphviz dot file"""
1015 opts = pycompat.byteskwargs(opts)
1047 opts = pycompat.byteskwargs(opts)
1016 r = cmdutil.openrevlog(repo, 'debugindexdot', file_, opts)
1048 r = cmdutil.openrevlog(repo, 'debugindexdot', file_, opts)
1017 ui.write(("digraph G {\n"))
1049 ui.write(("digraph G {\n"))
1018 for i in r:
1050 for i in r:
1019 node = r.node(i)
1051 node = r.node(i)
1020 pp = r.parents(node)
1052 pp = r.parents(node)
1021 ui.write("\t%d -> %d\n" % (r.rev(pp[0]), i))
1053 ui.write("\t%d -> %d\n" % (r.rev(pp[0]), i))
1022 if pp[1] != nullid:
1054 if pp[1] != nullid:
1023 ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i))
1055 ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i))
1024 ui.write("}\n")
1056 ui.write("}\n")
1025
1057
1026 @command('debuginstall', [] + cmdutil.formatteropts, '', norepo=True)
1058 @command('debuginstall', [] + cmdutil.formatteropts, '', norepo=True)
1027 def debuginstall(ui, **opts):
1059 def debuginstall(ui, **opts):
1028 '''test Mercurial installation
1060 '''test Mercurial installation
1029
1061
1030 Returns 0 on success.
1062 Returns 0 on success.
1031 '''
1063 '''
1032 opts = pycompat.byteskwargs(opts)
1064 opts = pycompat.byteskwargs(opts)
1033
1065
1034 def writetemp(contents):
1066 def writetemp(contents):
1035 (fd, name) = tempfile.mkstemp(prefix="hg-debuginstall-")
1067 (fd, name) = tempfile.mkstemp(prefix="hg-debuginstall-")
1036 f = os.fdopen(fd, pycompat.sysstr("wb"))
1068 f = os.fdopen(fd, pycompat.sysstr("wb"))
1037 f.write(contents)
1069 f.write(contents)
1038 f.close()
1070 f.close()
1039 return name
1071 return name
1040
1072
1041 problems = 0
1073 problems = 0
1042
1074
1043 fm = ui.formatter('debuginstall', opts)
1075 fm = ui.formatter('debuginstall', opts)
1044 fm.startitem()
1076 fm.startitem()
1045
1077
1046 # encoding
1078 # encoding
1047 fm.write('encoding', _("checking encoding (%s)...\n"), encoding.encoding)
1079 fm.write('encoding', _("checking encoding (%s)...\n"), encoding.encoding)
1048 err = None
1080 err = None
1049 try:
1081 try:
1050 codecs.lookup(pycompat.sysstr(encoding.encoding))
1082 codecs.lookup(pycompat.sysstr(encoding.encoding))
1051 except LookupError as inst:
1083 except LookupError as inst:
1052 err = util.forcebytestr(inst)
1084 err = util.forcebytestr(inst)
1053 problems += 1
1085 problems += 1
1054 fm.condwrite(err, 'encodingerror', _(" %s\n"
1086 fm.condwrite(err, 'encodingerror', _(" %s\n"
1055 " (check that your locale is properly set)\n"), err)
1087 " (check that your locale is properly set)\n"), err)
1056
1088
1057 # Python
1089 # Python
1058 fm.write('pythonexe', _("checking Python executable (%s)\n"),
1090 fm.write('pythonexe', _("checking Python executable (%s)\n"),
1059 pycompat.sysexecutable)
1091 pycompat.sysexecutable)
1060 fm.write('pythonver', _("checking Python version (%s)\n"),
1092 fm.write('pythonver', _("checking Python version (%s)\n"),
1061 ("%d.%d.%d" % sys.version_info[:3]))
1093 ("%d.%d.%d" % sys.version_info[:3]))
1062 fm.write('pythonlib', _("checking Python lib (%s)...\n"),
1094 fm.write('pythonlib', _("checking Python lib (%s)...\n"),
1063 os.path.dirname(pycompat.fsencode(os.__file__)))
1095 os.path.dirname(pycompat.fsencode(os.__file__)))
1064
1096
1065 security = set(sslutil.supportedprotocols)
1097 security = set(sslutil.supportedprotocols)
1066 if sslutil.hassni:
1098 if sslutil.hassni:
1067 security.add('sni')
1099 security.add('sni')
1068
1100
1069 fm.write('pythonsecurity', _("checking Python security support (%s)\n"),
1101 fm.write('pythonsecurity', _("checking Python security support (%s)\n"),
1070 fm.formatlist(sorted(security), name='protocol',
1102 fm.formatlist(sorted(security), name='protocol',
1071 fmt='%s', sep=','))
1103 fmt='%s', sep=','))
1072
1104
1073 # These are warnings, not errors. So don't increment problem count. This
1105 # These are warnings, not errors. So don't increment problem count. This
1074 # may change in the future.
1106 # may change in the future.
1075 if 'tls1.2' not in security:
1107 if 'tls1.2' not in security:
1076 fm.plain(_(' TLS 1.2 not supported by Python install; '
1108 fm.plain(_(' TLS 1.2 not supported by Python install; '
1077 'network connections lack modern security\n'))
1109 'network connections lack modern security\n'))
1078 if 'sni' not in security:
1110 if 'sni' not in security:
1079 fm.plain(_(' SNI not supported by Python install; may have '
1111 fm.plain(_(' SNI not supported by Python install; may have '
1080 'connectivity issues with some servers\n'))
1112 'connectivity issues with some servers\n'))
1081
1113
1082 # TODO print CA cert info
1114 # TODO print CA cert info
1083
1115
1084 # hg version
1116 # hg version
1085 hgver = util.version()
1117 hgver = util.version()
1086 fm.write('hgver', _("checking Mercurial version (%s)\n"),
1118 fm.write('hgver', _("checking Mercurial version (%s)\n"),
1087 hgver.split('+')[0])
1119 hgver.split('+')[0])
1088 fm.write('hgverextra', _("checking Mercurial custom build (%s)\n"),
1120 fm.write('hgverextra', _("checking Mercurial custom build (%s)\n"),
1089 '+'.join(hgver.split('+')[1:]))
1121 '+'.join(hgver.split('+')[1:]))
1090
1122
1091 # compiled modules
1123 # compiled modules
1092 fm.write('hgmodulepolicy', _("checking module policy (%s)\n"),
1124 fm.write('hgmodulepolicy', _("checking module policy (%s)\n"),
1093 policy.policy)
1125 policy.policy)
1094 fm.write('hgmodules', _("checking installed modules (%s)...\n"),
1126 fm.write('hgmodules', _("checking installed modules (%s)...\n"),
1095 os.path.dirname(pycompat.fsencode(__file__)))
1127 os.path.dirname(pycompat.fsencode(__file__)))
1096
1128
1097 if policy.policy in ('c', 'allow'):
1129 if policy.policy in ('c', 'allow'):
1098 err = None
1130 err = None
1099 try:
1131 try:
1100 from .cext import (
1132 from .cext import (
1101 base85,
1133 base85,
1102 bdiff,
1134 bdiff,
1103 mpatch,
1135 mpatch,
1104 osutil,
1136 osutil,
1105 )
1137 )
1106 dir(bdiff), dir(mpatch), dir(base85), dir(osutil) # quiet pyflakes
1138 dir(bdiff), dir(mpatch), dir(base85), dir(osutil) # quiet pyflakes
1107 except Exception as inst:
1139 except Exception as inst:
1108 err = util.forcebytestr(inst)
1140 err = util.forcebytestr(inst)
1109 problems += 1
1141 problems += 1
1110 fm.condwrite(err, 'extensionserror', " %s\n", err)
1142 fm.condwrite(err, 'extensionserror', " %s\n", err)
1111
1143
1112 compengines = util.compengines._engines.values()
1144 compengines = util.compengines._engines.values()
1113 fm.write('compengines', _('checking registered compression engines (%s)\n'),
1145 fm.write('compengines', _('checking registered compression engines (%s)\n'),
1114 fm.formatlist(sorted(e.name() for e in compengines),
1146 fm.formatlist(sorted(e.name() for e in compengines),
1115 name='compengine', fmt='%s', sep=', '))
1147 name='compengine', fmt='%s', sep=', '))
1116 fm.write('compenginesavail', _('checking available compression engines '
1148 fm.write('compenginesavail', _('checking available compression engines '
1117 '(%s)\n'),
1149 '(%s)\n'),
1118 fm.formatlist(sorted(e.name() for e in compengines
1150 fm.formatlist(sorted(e.name() for e in compengines
1119 if e.available()),
1151 if e.available()),
1120 name='compengine', fmt='%s', sep=', '))
1152 name='compengine', fmt='%s', sep=', '))
1121 wirecompengines = util.compengines.supportedwireengines(util.SERVERROLE)
1153 wirecompengines = util.compengines.supportedwireengines(util.SERVERROLE)
1122 fm.write('compenginesserver', _('checking available compression engines '
1154 fm.write('compenginesserver', _('checking available compression engines '
1123 'for wire protocol (%s)\n'),
1155 'for wire protocol (%s)\n'),
1124 fm.formatlist([e.name() for e in wirecompengines
1156 fm.formatlist([e.name() for e in wirecompengines
1125 if e.wireprotosupport()],
1157 if e.wireprotosupport()],
1126 name='compengine', fmt='%s', sep=', '))
1158 name='compengine', fmt='%s', sep=', '))
1127
1159
1128 # templates
1160 # templates
1129 p = templater.templatepaths()
1161 p = templater.templatepaths()
1130 fm.write('templatedirs', 'checking templates (%s)...\n', ' '.join(p))
1162 fm.write('templatedirs', 'checking templates (%s)...\n', ' '.join(p))
1131 fm.condwrite(not p, '', _(" no template directories found\n"))
1163 fm.condwrite(not p, '', _(" no template directories found\n"))
1132 if p:
1164 if p:
1133 m = templater.templatepath("map-cmdline.default")
1165 m = templater.templatepath("map-cmdline.default")
1134 if m:
1166 if m:
1135 # template found, check if it is working
1167 # template found, check if it is working
1136 err = None
1168 err = None
1137 try:
1169 try:
1138 templater.templater.frommapfile(m)
1170 templater.templater.frommapfile(m)
1139 except Exception as inst:
1171 except Exception as inst:
1140 err = util.forcebytestr(inst)
1172 err = util.forcebytestr(inst)
1141 p = None
1173 p = None
1142 fm.condwrite(err, 'defaulttemplateerror', " %s\n", err)
1174 fm.condwrite(err, 'defaulttemplateerror', " %s\n", err)
1143 else:
1175 else:
1144 p = None
1176 p = None
1145 fm.condwrite(p, 'defaulttemplate',
1177 fm.condwrite(p, 'defaulttemplate',
1146 _("checking default template (%s)\n"), m)
1178 _("checking default template (%s)\n"), m)
1147 fm.condwrite(not m, 'defaulttemplatenotfound',
1179 fm.condwrite(not m, 'defaulttemplatenotfound',
1148 _(" template '%s' not found\n"), "default")
1180 _(" template '%s' not found\n"), "default")
1149 if not p:
1181 if not p:
1150 problems += 1
1182 problems += 1
1151 fm.condwrite(not p, '',
1183 fm.condwrite(not p, '',
1152 _(" (templates seem to have been installed incorrectly)\n"))
1184 _(" (templates seem to have been installed incorrectly)\n"))
1153
1185
1154 # editor
1186 # editor
1155 editor = ui.geteditor()
1187 editor = ui.geteditor()
1156 editor = util.expandpath(editor)
1188 editor = util.expandpath(editor)
1157 fm.write('editor', _("checking commit editor... (%s)\n"), editor)
1189 fm.write('editor', _("checking commit editor... (%s)\n"), editor)
1158 cmdpath = util.findexe(pycompat.shlexsplit(editor)[0])
1190 cmdpath = util.findexe(pycompat.shlexsplit(editor)[0])
1159 fm.condwrite(not cmdpath and editor == 'vi', 'vinotfound',
1191 fm.condwrite(not cmdpath and editor == 'vi', 'vinotfound',
1160 _(" No commit editor set and can't find %s in PATH\n"
1192 _(" No commit editor set and can't find %s in PATH\n"
1161 " (specify a commit editor in your configuration"
1193 " (specify a commit editor in your configuration"
1162 " file)\n"), not cmdpath and editor == 'vi' and editor)
1194 " file)\n"), not cmdpath and editor == 'vi' and editor)
1163 fm.condwrite(not cmdpath and editor != 'vi', 'editornotfound',
1195 fm.condwrite(not cmdpath and editor != 'vi', 'editornotfound',
1164 _(" Can't find editor '%s' in PATH\n"
1196 _(" Can't find editor '%s' in PATH\n"
1165 " (specify a commit editor in your configuration"
1197 " (specify a commit editor in your configuration"
1166 " file)\n"), not cmdpath and editor)
1198 " file)\n"), not cmdpath and editor)
1167 if not cmdpath and editor != 'vi':
1199 if not cmdpath and editor != 'vi':
1168 problems += 1
1200 problems += 1
1169
1201
1170 # check username
1202 # check username
1171 username = None
1203 username = None
1172 err = None
1204 err = None
1173 try:
1205 try:
1174 username = ui.username()
1206 username = ui.username()
1175 except error.Abort as e:
1207 except error.Abort as e:
1176 err = util.forcebytestr(e)
1208 err = util.forcebytestr(e)
1177 problems += 1
1209 problems += 1
1178
1210
1179 fm.condwrite(username, 'username', _("checking username (%s)\n"), username)
1211 fm.condwrite(username, 'username', _("checking username (%s)\n"), username)
1180 fm.condwrite(err, 'usernameerror', _("checking username...\n %s\n"
1212 fm.condwrite(err, 'usernameerror', _("checking username...\n %s\n"
1181 " (specify a username in your configuration file)\n"), err)
1213 " (specify a username in your configuration file)\n"), err)
1182
1214
1183 fm.condwrite(not problems, '',
1215 fm.condwrite(not problems, '',
1184 _("no problems detected\n"))
1216 _("no problems detected\n"))
1185 if not problems:
1217 if not problems:
1186 fm.data(problems=problems)
1218 fm.data(problems=problems)
1187 fm.condwrite(problems, 'problems',
1219 fm.condwrite(problems, 'problems',
1188 _("%d problems detected,"
1220 _("%d problems detected,"
1189 " please check your install!\n"), problems)
1221 " please check your install!\n"), problems)
1190 fm.end()
1222 fm.end()
1191
1223
1192 return problems
1224 return problems
1193
1225
1194 @command('debugknown', [], _('REPO ID...'), norepo=True)
1226 @command('debugknown', [], _('REPO ID...'), norepo=True)
1195 def debugknown(ui, repopath, *ids, **opts):
1227 def debugknown(ui, repopath, *ids, **opts):
1196 """test whether node ids are known to a repo
1228 """test whether node ids are known to a repo
1197
1229
1198 Every ID must be a full-length hex node id string. Returns a list of 0s
1230 Every ID must be a full-length hex node id string. Returns a list of 0s
1199 and 1s indicating unknown/known.
1231 and 1s indicating unknown/known.
1200 """
1232 """
1201 opts = pycompat.byteskwargs(opts)
1233 opts = pycompat.byteskwargs(opts)
1202 repo = hg.peer(ui, opts, repopath)
1234 repo = hg.peer(ui, opts, repopath)
1203 if not repo.capable('known'):
1235 if not repo.capable('known'):
1204 raise error.Abort("known() not supported by target repository")
1236 raise error.Abort("known() not supported by target repository")
1205 flags = repo.known([bin(s) for s in ids])
1237 flags = repo.known([bin(s) for s in ids])
1206 ui.write("%s\n" % ("".join([f and "1" or "0" for f in flags])))
1238 ui.write("%s\n" % ("".join([f and "1" or "0" for f in flags])))
1207
1239
1208 @command('debuglabelcomplete', [], _('LABEL...'))
1240 @command('debuglabelcomplete', [], _('LABEL...'))
1209 def debuglabelcomplete(ui, repo, *args):
1241 def debuglabelcomplete(ui, repo, *args):
1210 '''backwards compatibility with old bash completion scripts (DEPRECATED)'''
1242 '''backwards compatibility with old bash completion scripts (DEPRECATED)'''
1211 debugnamecomplete(ui, repo, *args)
1243 debugnamecomplete(ui, repo, *args)
1212
1244
1213 @command('debuglocks',
1245 @command('debuglocks',
1214 [('L', 'force-lock', None, _('free the store lock (DANGEROUS)')),
1246 [('L', 'force-lock', None, _('free the store lock (DANGEROUS)')),
1215 ('W', 'force-wlock', None,
1247 ('W', 'force-wlock', None,
1216 _('free the working state lock (DANGEROUS)'))],
1248 _('free the working state lock (DANGEROUS)'))],
1217 _('[OPTION]...'))
1249 _('[OPTION]...'))
1218 def debuglocks(ui, repo, **opts):
1250 def debuglocks(ui, repo, **opts):
1219 """show or modify state of locks
1251 """show or modify state of locks
1220
1252
1221 By default, this command will show which locks are held. This
1253 By default, this command will show which locks are held. This
1222 includes the user and process holding the lock, the amount of time
1254 includes the user and process holding the lock, the amount of time
1223 the lock has been held, and the machine name where the process is
1255 the lock has been held, and the machine name where the process is
1224 running if it's not local.
1256 running if it's not local.
1225
1257
1226 Locks protect the integrity of Mercurial's data, so should be
1258 Locks protect the integrity of Mercurial's data, so should be
1227 treated with care. System crashes or other interruptions may cause
1259 treated with care. System crashes or other interruptions may cause
1228 locks to not be properly released, though Mercurial will usually
1260 locks to not be properly released, though Mercurial will usually
1229 detect and remove such stale locks automatically.
1261 detect and remove such stale locks automatically.
1230
1262
1231 However, detecting stale locks may not always be possible (for
1263 However, detecting stale locks may not always be possible (for
1232 instance, on a shared filesystem). Removing locks may also be
1264 instance, on a shared filesystem). Removing locks may also be
1233 blocked by filesystem permissions.
1265 blocked by filesystem permissions.
1234
1266
1235 Returns 0 if no locks are held.
1267 Returns 0 if no locks are held.
1236
1268
1237 """
1269 """
1238
1270
1239 if opts.get(r'force_lock'):
1271 if opts.get(r'force_lock'):
1240 repo.svfs.unlink('lock')
1272 repo.svfs.unlink('lock')
1241 if opts.get(r'force_wlock'):
1273 if opts.get(r'force_wlock'):
1242 repo.vfs.unlink('wlock')
1274 repo.vfs.unlink('wlock')
1243 if opts.get(r'force_lock') or opts.get(r'force_lock'):
1275 if opts.get(r'force_lock') or opts.get(r'force_lock'):
1244 return 0
1276 return 0
1245
1277
1246 now = time.time()
1278 now = time.time()
1247 held = 0
1279 held = 0
1248
1280
1249 def report(vfs, name, method):
1281 def report(vfs, name, method):
1250 # this causes stale locks to get reaped for more accurate reporting
1282 # this causes stale locks to get reaped for more accurate reporting
1251 try:
1283 try:
1252 l = method(False)
1284 l = method(False)
1253 except error.LockHeld:
1285 except error.LockHeld:
1254 l = None
1286 l = None
1255
1287
1256 if l:
1288 if l:
1257 l.release()
1289 l.release()
1258 else:
1290 else:
1259 try:
1291 try:
1260 stat = vfs.lstat(name)
1292 stat = vfs.lstat(name)
1261 age = now - stat.st_mtime
1293 age = now - stat.st_mtime
1262 user = util.username(stat.st_uid)
1294 user = util.username(stat.st_uid)
1263 locker = vfs.readlock(name)
1295 locker = vfs.readlock(name)
1264 if ":" in locker:
1296 if ":" in locker:
1265 host, pid = locker.split(':')
1297 host, pid = locker.split(':')
1266 if host == socket.gethostname():
1298 if host == socket.gethostname():
1267 locker = 'user %s, process %s' % (user, pid)
1299 locker = 'user %s, process %s' % (user, pid)
1268 else:
1300 else:
1269 locker = 'user %s, process %s, host %s' \
1301 locker = 'user %s, process %s, host %s' \
1270 % (user, pid, host)
1302 % (user, pid, host)
1271 ui.write(("%-6s %s (%ds)\n") % (name + ":", locker, age))
1303 ui.write(("%-6s %s (%ds)\n") % (name + ":", locker, age))
1272 return 1
1304 return 1
1273 except OSError as e:
1305 except OSError as e:
1274 if e.errno != errno.ENOENT:
1306 if e.errno != errno.ENOENT:
1275 raise
1307 raise
1276
1308
1277 ui.write(("%-6s free\n") % (name + ":"))
1309 ui.write(("%-6s free\n") % (name + ":"))
1278 return 0
1310 return 0
1279
1311
1280 held += report(repo.svfs, "lock", repo.lock)
1312 held += report(repo.svfs, "lock", repo.lock)
1281 held += report(repo.vfs, "wlock", repo.wlock)
1313 held += report(repo.vfs, "wlock", repo.wlock)
1282
1314
1283 return held
1315 return held
1284
1316
1285 @command('debugmergestate', [], '')
1317 @command('debugmergestate', [], '')
1286 def debugmergestate(ui, repo, *args):
1318 def debugmergestate(ui, repo, *args):
1287 """print merge state
1319 """print merge state
1288
1320
1289 Use --verbose to print out information about whether v1 or v2 merge state
1321 Use --verbose to print out information about whether v1 or v2 merge state
1290 was chosen."""
1322 was chosen."""
1291 def _hashornull(h):
1323 def _hashornull(h):
1292 if h == nullhex:
1324 if h == nullhex:
1293 return 'null'
1325 return 'null'
1294 else:
1326 else:
1295 return h
1327 return h
1296
1328
1297 def printrecords(version):
1329 def printrecords(version):
1298 ui.write(('* version %s records\n') % version)
1330 ui.write(('* version %s records\n') % version)
1299 if version == 1:
1331 if version == 1:
1300 records = v1records
1332 records = v1records
1301 else:
1333 else:
1302 records = v2records
1334 records = v2records
1303
1335
1304 for rtype, record in records:
1336 for rtype, record in records:
1305 # pretty print some record types
1337 # pretty print some record types
1306 if rtype == 'L':
1338 if rtype == 'L':
1307 ui.write(('local: %s\n') % record)
1339 ui.write(('local: %s\n') % record)
1308 elif rtype == 'O':
1340 elif rtype == 'O':
1309 ui.write(('other: %s\n') % record)
1341 ui.write(('other: %s\n') % record)
1310 elif rtype == 'm':
1342 elif rtype == 'm':
1311 driver, mdstate = record.split('\0', 1)
1343 driver, mdstate = record.split('\0', 1)
1312 ui.write(('merge driver: %s (state "%s")\n')
1344 ui.write(('merge driver: %s (state "%s")\n')
1313 % (driver, mdstate))
1345 % (driver, mdstate))
1314 elif rtype in 'FDC':
1346 elif rtype in 'FDC':
1315 r = record.split('\0')
1347 r = record.split('\0')
1316 f, state, hash, lfile, afile, anode, ofile = r[0:7]
1348 f, state, hash, lfile, afile, anode, ofile = r[0:7]
1317 if version == 1:
1349 if version == 1:
1318 onode = 'not stored in v1 format'
1350 onode = 'not stored in v1 format'
1319 flags = r[7]
1351 flags = r[7]
1320 else:
1352 else:
1321 onode, flags = r[7:9]
1353 onode, flags = r[7:9]
1322 ui.write(('file: %s (record type "%s", state "%s", hash %s)\n')
1354 ui.write(('file: %s (record type "%s", state "%s", hash %s)\n')
1323 % (f, rtype, state, _hashornull(hash)))
1355 % (f, rtype, state, _hashornull(hash)))
1324 ui.write((' local path: %s (flags "%s")\n') % (lfile, flags))
1356 ui.write((' local path: %s (flags "%s")\n') % (lfile, flags))
1325 ui.write((' ancestor path: %s (node %s)\n')
1357 ui.write((' ancestor path: %s (node %s)\n')
1326 % (afile, _hashornull(anode)))
1358 % (afile, _hashornull(anode)))
1327 ui.write((' other path: %s (node %s)\n')
1359 ui.write((' other path: %s (node %s)\n')
1328 % (ofile, _hashornull(onode)))
1360 % (ofile, _hashornull(onode)))
1329 elif rtype == 'f':
1361 elif rtype == 'f':
1330 filename, rawextras = record.split('\0', 1)
1362 filename, rawextras = record.split('\0', 1)
1331 extras = rawextras.split('\0')
1363 extras = rawextras.split('\0')
1332 i = 0
1364 i = 0
1333 extrastrings = []
1365 extrastrings = []
1334 while i < len(extras):
1366 while i < len(extras):
1335 extrastrings.append('%s = %s' % (extras[i], extras[i + 1]))
1367 extrastrings.append('%s = %s' % (extras[i], extras[i + 1]))
1336 i += 2
1368 i += 2
1337
1369
1338 ui.write(('file extras: %s (%s)\n')
1370 ui.write(('file extras: %s (%s)\n')
1339 % (filename, ', '.join(extrastrings)))
1371 % (filename, ', '.join(extrastrings)))
1340 elif rtype == 'l':
1372 elif rtype == 'l':
1341 labels = record.split('\0', 2)
1373 labels = record.split('\0', 2)
1342 labels = [l for l in labels if len(l) > 0]
1374 labels = [l for l in labels if len(l) > 0]
1343 ui.write(('labels:\n'))
1375 ui.write(('labels:\n'))
1344 ui.write((' local: %s\n' % labels[0]))
1376 ui.write((' local: %s\n' % labels[0]))
1345 ui.write((' other: %s\n' % labels[1]))
1377 ui.write((' other: %s\n' % labels[1]))
1346 if len(labels) > 2:
1378 if len(labels) > 2:
1347 ui.write((' base: %s\n' % labels[2]))
1379 ui.write((' base: %s\n' % labels[2]))
1348 else:
1380 else:
1349 ui.write(('unrecognized entry: %s\t%s\n')
1381 ui.write(('unrecognized entry: %s\t%s\n')
1350 % (rtype, record.replace('\0', '\t')))
1382 % (rtype, record.replace('\0', '\t')))
1351
1383
1352 # Avoid mergestate.read() since it may raise an exception for unsupported
1384 # Avoid mergestate.read() since it may raise an exception for unsupported
1353 # merge state records. We shouldn't be doing this, but this is OK since this
1385 # merge state records. We shouldn't be doing this, but this is OK since this
1354 # command is pretty low-level.
1386 # command is pretty low-level.
1355 ms = mergemod.mergestate(repo)
1387 ms = mergemod.mergestate(repo)
1356
1388
1357 # sort so that reasonable information is on top
1389 # sort so that reasonable information is on top
1358 v1records = ms._readrecordsv1()
1390 v1records = ms._readrecordsv1()
1359 v2records = ms._readrecordsv2()
1391 v2records = ms._readrecordsv2()
1360 order = 'LOml'
1392 order = 'LOml'
1361 def key(r):
1393 def key(r):
1362 idx = order.find(r[0])
1394 idx = order.find(r[0])
1363 if idx == -1:
1395 if idx == -1:
1364 return (1, r[1])
1396 return (1, r[1])
1365 else:
1397 else:
1366 return (0, idx)
1398 return (0, idx)
1367 v1records.sort(key=key)
1399 v1records.sort(key=key)
1368 v2records.sort(key=key)
1400 v2records.sort(key=key)
1369
1401
1370 if not v1records and not v2records:
1402 if not v1records and not v2records:
1371 ui.write(('no merge state found\n'))
1403 ui.write(('no merge state found\n'))
1372 elif not v2records:
1404 elif not v2records:
1373 ui.note(('no version 2 merge state\n'))
1405 ui.note(('no version 2 merge state\n'))
1374 printrecords(1)
1406 printrecords(1)
1375 elif ms._v1v2match(v1records, v2records):
1407 elif ms._v1v2match(v1records, v2records):
1376 ui.note(('v1 and v2 states match: using v2\n'))
1408 ui.note(('v1 and v2 states match: using v2\n'))
1377 printrecords(2)
1409 printrecords(2)
1378 else:
1410 else:
1379 ui.note(('v1 and v2 states mismatch: using v1\n'))
1411 ui.note(('v1 and v2 states mismatch: using v1\n'))
1380 printrecords(1)
1412 printrecords(1)
1381 if ui.verbose:
1413 if ui.verbose:
1382 printrecords(2)
1414 printrecords(2)
1383
1415
1384 @command('debugnamecomplete', [], _('NAME...'))
1416 @command('debugnamecomplete', [], _('NAME...'))
1385 def debugnamecomplete(ui, repo, *args):
1417 def debugnamecomplete(ui, repo, *args):
1386 '''complete "names" - tags, open branch names, bookmark names'''
1418 '''complete "names" - tags, open branch names, bookmark names'''
1387
1419
1388 names = set()
1420 names = set()
1389 # since we previously only listed open branches, we will handle that
1421 # since we previously only listed open branches, we will handle that
1390 # specially (after this for loop)
1422 # specially (after this for loop)
1391 for name, ns in repo.names.iteritems():
1423 for name, ns in repo.names.iteritems():
1392 if name != 'branches':
1424 if name != 'branches':
1393 names.update(ns.listnames(repo))
1425 names.update(ns.listnames(repo))
1394 names.update(tag for (tag, heads, tip, closed)
1426 names.update(tag for (tag, heads, tip, closed)
1395 in repo.branchmap().iterbranches() if not closed)
1427 in repo.branchmap().iterbranches() if not closed)
1396 completions = set()
1428 completions = set()
1397 if not args:
1429 if not args:
1398 args = ['']
1430 args = ['']
1399 for a in args:
1431 for a in args:
1400 completions.update(n for n in names if n.startswith(a))
1432 completions.update(n for n in names if n.startswith(a))
1401 ui.write('\n'.join(sorted(completions)))
1433 ui.write('\n'.join(sorted(completions)))
1402 ui.write('\n')
1434 ui.write('\n')
1403
1435
1404 @command('debugobsolete',
1436 @command('debugobsolete',
1405 [('', 'flags', 0, _('markers flag')),
1437 [('', 'flags', 0, _('markers flag')),
1406 ('', 'record-parents', False,
1438 ('', 'record-parents', False,
1407 _('record parent information for the precursor')),
1439 _('record parent information for the precursor')),
1408 ('r', 'rev', [], _('display markers relevant to REV')),
1440 ('r', 'rev', [], _('display markers relevant to REV')),
1409 ('', 'exclusive', False, _('restrict display to markers only '
1441 ('', 'exclusive', False, _('restrict display to markers only '
1410 'relevant to REV')),
1442 'relevant to REV')),
1411 ('', 'index', False, _('display index of the marker')),
1443 ('', 'index', False, _('display index of the marker')),
1412 ('', 'delete', [], _('delete markers specified by indices')),
1444 ('', 'delete', [], _('delete markers specified by indices')),
1413 ] + cmdutil.commitopts2 + cmdutil.formatteropts,
1445 ] + cmdutil.commitopts2 + cmdutil.formatteropts,
1414 _('[OBSOLETED [REPLACEMENT ...]]'))
1446 _('[OBSOLETED [REPLACEMENT ...]]'))
1415 def debugobsolete(ui, repo, precursor=None, *successors, **opts):
1447 def debugobsolete(ui, repo, precursor=None, *successors, **opts):
1416 """create arbitrary obsolete marker
1448 """create arbitrary obsolete marker
1417
1449
1418 With no arguments, displays the list of obsolescence markers."""
1450 With no arguments, displays the list of obsolescence markers."""
1419
1451
1420 opts = pycompat.byteskwargs(opts)
1452 opts = pycompat.byteskwargs(opts)
1421
1453
1422 def parsenodeid(s):
1454 def parsenodeid(s):
1423 try:
1455 try:
1424 # We do not use revsingle/revrange functions here to accept
1456 # We do not use revsingle/revrange functions here to accept
1425 # arbitrary node identifiers, possibly not present in the
1457 # arbitrary node identifiers, possibly not present in the
1426 # local repository.
1458 # local repository.
1427 n = bin(s)
1459 n = bin(s)
1428 if len(n) != len(nullid):
1460 if len(n) != len(nullid):
1429 raise TypeError()
1461 raise TypeError()
1430 return n
1462 return n
1431 except TypeError:
1463 except TypeError:
1432 raise error.Abort('changeset references must be full hexadecimal '
1464 raise error.Abort('changeset references must be full hexadecimal '
1433 'node identifiers')
1465 'node identifiers')
1434
1466
1435 if opts.get('delete'):
1467 if opts.get('delete'):
1436 indices = []
1468 indices = []
1437 for v in opts.get('delete'):
1469 for v in opts.get('delete'):
1438 try:
1470 try:
1439 indices.append(int(v))
1471 indices.append(int(v))
1440 except ValueError:
1472 except ValueError:
1441 raise error.Abort(_('invalid index value: %r') % v,
1473 raise error.Abort(_('invalid index value: %r') % v,
1442 hint=_('use integers for indices'))
1474 hint=_('use integers for indices'))
1443
1475
1444 if repo.currenttransaction():
1476 if repo.currenttransaction():
1445 raise error.Abort(_('cannot delete obsmarkers in the middle '
1477 raise error.Abort(_('cannot delete obsmarkers in the middle '
1446 'of transaction.'))
1478 'of transaction.'))
1447
1479
1448 with repo.lock():
1480 with repo.lock():
1449 n = repair.deleteobsmarkers(repo.obsstore, indices)
1481 n = repair.deleteobsmarkers(repo.obsstore, indices)
1450 ui.write(_('deleted %i obsolescence markers\n') % n)
1482 ui.write(_('deleted %i obsolescence markers\n') % n)
1451
1483
1452 return
1484 return
1453
1485
1454 if precursor is not None:
1486 if precursor is not None:
1455 if opts['rev']:
1487 if opts['rev']:
1456 raise error.Abort('cannot select revision when creating marker')
1488 raise error.Abort('cannot select revision when creating marker')
1457 metadata = {}
1489 metadata = {}
1458 metadata['user'] = opts['user'] or ui.username()
1490 metadata['user'] = opts['user'] or ui.username()
1459 succs = tuple(parsenodeid(succ) for succ in successors)
1491 succs = tuple(parsenodeid(succ) for succ in successors)
1460 l = repo.lock()
1492 l = repo.lock()
1461 try:
1493 try:
1462 tr = repo.transaction('debugobsolete')
1494 tr = repo.transaction('debugobsolete')
1463 try:
1495 try:
1464 date = opts.get('date')
1496 date = opts.get('date')
1465 if date:
1497 if date:
1466 date = util.parsedate(date)
1498 date = util.parsedate(date)
1467 else:
1499 else:
1468 date = None
1500 date = None
1469 prec = parsenodeid(precursor)
1501 prec = parsenodeid(precursor)
1470 parents = None
1502 parents = None
1471 if opts['record_parents']:
1503 if opts['record_parents']:
1472 if prec not in repo.unfiltered():
1504 if prec not in repo.unfiltered():
1473 raise error.Abort('cannot used --record-parents on '
1505 raise error.Abort('cannot used --record-parents on '
1474 'unknown changesets')
1506 'unknown changesets')
1475 parents = repo.unfiltered()[prec].parents()
1507 parents = repo.unfiltered()[prec].parents()
1476 parents = tuple(p.node() for p in parents)
1508 parents = tuple(p.node() for p in parents)
1477 repo.obsstore.create(tr, prec, succs, opts['flags'],
1509 repo.obsstore.create(tr, prec, succs, opts['flags'],
1478 parents=parents, date=date,
1510 parents=parents, date=date,
1479 metadata=metadata, ui=ui)
1511 metadata=metadata, ui=ui)
1480 tr.close()
1512 tr.close()
1481 except ValueError as exc:
1513 except ValueError as exc:
1482 raise error.Abort(_('bad obsmarker input: %s') % exc)
1514 raise error.Abort(_('bad obsmarker input: %s') % exc)
1483 finally:
1515 finally:
1484 tr.release()
1516 tr.release()
1485 finally:
1517 finally:
1486 l.release()
1518 l.release()
1487 else:
1519 else:
1488 if opts['rev']:
1520 if opts['rev']:
1489 revs = scmutil.revrange(repo, opts['rev'])
1521 revs = scmutil.revrange(repo, opts['rev'])
1490 nodes = [repo[r].node() for r in revs]
1522 nodes = [repo[r].node() for r in revs]
1491 markers = list(obsutil.getmarkers(repo, nodes=nodes,
1523 markers = list(obsutil.getmarkers(repo, nodes=nodes,
1492 exclusive=opts['exclusive']))
1524 exclusive=opts['exclusive']))
1493 markers.sort(key=lambda x: x._data)
1525 markers.sort(key=lambda x: x._data)
1494 else:
1526 else:
1495 markers = obsutil.getmarkers(repo)
1527 markers = obsutil.getmarkers(repo)
1496
1528
1497 markerstoiter = markers
1529 markerstoiter = markers
1498 isrelevant = lambda m: True
1530 isrelevant = lambda m: True
1499 if opts.get('rev') and opts.get('index'):
1531 if opts.get('rev') and opts.get('index'):
1500 markerstoiter = obsutil.getmarkers(repo)
1532 markerstoiter = obsutil.getmarkers(repo)
1501 markerset = set(markers)
1533 markerset = set(markers)
1502 isrelevant = lambda m: m in markerset
1534 isrelevant = lambda m: m in markerset
1503
1535
1504 fm = ui.formatter('debugobsolete', opts)
1536 fm = ui.formatter('debugobsolete', opts)
1505 for i, m in enumerate(markerstoiter):
1537 for i, m in enumerate(markerstoiter):
1506 if not isrelevant(m):
1538 if not isrelevant(m):
1507 # marker can be irrelevant when we're iterating over a set
1539 # marker can be irrelevant when we're iterating over a set
1508 # of markers (markerstoiter) which is bigger than the set
1540 # of markers (markerstoiter) which is bigger than the set
1509 # of markers we want to display (markers)
1541 # of markers we want to display (markers)
1510 # this can happen if both --index and --rev options are
1542 # this can happen if both --index and --rev options are
1511 # provided and thus we need to iterate over all of the markers
1543 # provided and thus we need to iterate over all of the markers
1512 # to get the correct indices, but only display the ones that
1544 # to get the correct indices, but only display the ones that
1513 # are relevant to --rev value
1545 # are relevant to --rev value
1514 continue
1546 continue
1515 fm.startitem()
1547 fm.startitem()
1516 ind = i if opts.get('index') else None
1548 ind = i if opts.get('index') else None
1517 cmdutil.showmarker(fm, m, index=ind)
1549 cmdutil.showmarker(fm, m, index=ind)
1518 fm.end()
1550 fm.end()
1519
1551
1520 @command('debugpathcomplete',
1552 @command('debugpathcomplete',
1521 [('f', 'full', None, _('complete an entire path')),
1553 [('f', 'full', None, _('complete an entire path')),
1522 ('n', 'normal', None, _('show only normal files')),
1554 ('n', 'normal', None, _('show only normal files')),
1523 ('a', 'added', None, _('show only added files')),
1555 ('a', 'added', None, _('show only added files')),
1524 ('r', 'removed', None, _('show only removed files'))],
1556 ('r', 'removed', None, _('show only removed files'))],
1525 _('FILESPEC...'))
1557 _('FILESPEC...'))
1526 def debugpathcomplete(ui, repo, *specs, **opts):
1558 def debugpathcomplete(ui, repo, *specs, **opts):
1527 '''complete part or all of a tracked path
1559 '''complete part or all of a tracked path
1528
1560
1529 This command supports shells that offer path name completion. It
1561 This command supports shells that offer path name completion. It
1530 currently completes only files already known to the dirstate.
1562 currently completes only files already known to the dirstate.
1531
1563
1532 Completion extends only to the next path segment unless
1564 Completion extends only to the next path segment unless
1533 --full is specified, in which case entire paths are used.'''
1565 --full is specified, in which case entire paths are used.'''
1534
1566
1535 def complete(path, acceptable):
1567 def complete(path, acceptable):
1536 dirstate = repo.dirstate
1568 dirstate = repo.dirstate
1537 spec = os.path.normpath(os.path.join(pycompat.getcwd(), path))
1569 spec = os.path.normpath(os.path.join(pycompat.getcwd(), path))
1538 rootdir = repo.root + pycompat.ossep
1570 rootdir = repo.root + pycompat.ossep
1539 if spec != repo.root and not spec.startswith(rootdir):
1571 if spec != repo.root and not spec.startswith(rootdir):
1540 return [], []
1572 return [], []
1541 if os.path.isdir(spec):
1573 if os.path.isdir(spec):
1542 spec += '/'
1574 spec += '/'
1543 spec = spec[len(rootdir):]
1575 spec = spec[len(rootdir):]
1544 fixpaths = pycompat.ossep != '/'
1576 fixpaths = pycompat.ossep != '/'
1545 if fixpaths:
1577 if fixpaths:
1546 spec = spec.replace(pycompat.ossep, '/')
1578 spec = spec.replace(pycompat.ossep, '/')
1547 speclen = len(spec)
1579 speclen = len(spec)
1548 fullpaths = opts[r'full']
1580 fullpaths = opts[r'full']
1549 files, dirs = set(), set()
1581 files, dirs = set(), set()
1550 adddir, addfile = dirs.add, files.add
1582 adddir, addfile = dirs.add, files.add
1551 for f, st in dirstate.iteritems():
1583 for f, st in dirstate.iteritems():
1552 if f.startswith(spec) and st[0] in acceptable:
1584 if f.startswith(spec) and st[0] in acceptable:
1553 if fixpaths:
1585 if fixpaths:
1554 f = f.replace('/', pycompat.ossep)
1586 f = f.replace('/', pycompat.ossep)
1555 if fullpaths:
1587 if fullpaths:
1556 addfile(f)
1588 addfile(f)
1557 continue
1589 continue
1558 s = f.find(pycompat.ossep, speclen)
1590 s = f.find(pycompat.ossep, speclen)
1559 if s >= 0:
1591 if s >= 0:
1560 adddir(f[:s])
1592 adddir(f[:s])
1561 else:
1593 else:
1562 addfile(f)
1594 addfile(f)
1563 return files, dirs
1595 return files, dirs
1564
1596
1565 acceptable = ''
1597 acceptable = ''
1566 if opts[r'normal']:
1598 if opts[r'normal']:
1567 acceptable += 'nm'
1599 acceptable += 'nm'
1568 if opts[r'added']:
1600 if opts[r'added']:
1569 acceptable += 'a'
1601 acceptable += 'a'
1570 if opts[r'removed']:
1602 if opts[r'removed']:
1571 acceptable += 'r'
1603 acceptable += 'r'
1572 cwd = repo.getcwd()
1604 cwd = repo.getcwd()
1573 if not specs:
1605 if not specs:
1574 specs = ['.']
1606 specs = ['.']
1575
1607
1576 files, dirs = set(), set()
1608 files, dirs = set(), set()
1577 for spec in specs:
1609 for spec in specs:
1578 f, d = complete(spec, acceptable or 'nmar')
1610 f, d = complete(spec, acceptable or 'nmar')
1579 files.update(f)
1611 files.update(f)
1580 dirs.update(d)
1612 dirs.update(d)
1581 files.update(dirs)
1613 files.update(dirs)
1582 ui.write('\n'.join(repo.pathto(p, cwd) for p in sorted(files)))
1614 ui.write('\n'.join(repo.pathto(p, cwd) for p in sorted(files)))
1583 ui.write('\n')
1615 ui.write('\n')
1584
1616
1585 @command('debugpickmergetool',
1617 @command('debugpickmergetool',
1586 [('r', 'rev', '', _('check for files in this revision'), _('REV')),
1618 [('r', 'rev', '', _('check for files in this revision'), _('REV')),
1587 ('', 'changedelete', None, _('emulate merging change and delete')),
1619 ('', 'changedelete', None, _('emulate merging change and delete')),
1588 ] + cmdutil.walkopts + cmdutil.mergetoolopts,
1620 ] + cmdutil.walkopts + cmdutil.mergetoolopts,
1589 _('[PATTERN]...'),
1621 _('[PATTERN]...'),
1590 inferrepo=True)
1622 inferrepo=True)
1591 def debugpickmergetool(ui, repo, *pats, **opts):
1623 def debugpickmergetool(ui, repo, *pats, **opts):
1592 """examine which merge tool is chosen for specified file
1624 """examine which merge tool is chosen for specified file
1593
1625
1594 As described in :hg:`help merge-tools`, Mercurial examines
1626 As described in :hg:`help merge-tools`, Mercurial examines
1595 configurations below in this order to decide which merge tool is
1627 configurations below in this order to decide which merge tool is
1596 chosen for specified file.
1628 chosen for specified file.
1597
1629
1598 1. ``--tool`` option
1630 1. ``--tool`` option
1599 2. ``HGMERGE`` environment variable
1631 2. ``HGMERGE`` environment variable
1600 3. configurations in ``merge-patterns`` section
1632 3. configurations in ``merge-patterns`` section
1601 4. configuration of ``ui.merge``
1633 4. configuration of ``ui.merge``
1602 5. configurations in ``merge-tools`` section
1634 5. configurations in ``merge-tools`` section
1603 6. ``hgmerge`` tool (for historical reason only)
1635 6. ``hgmerge`` tool (for historical reason only)
1604 7. default tool for fallback (``:merge`` or ``:prompt``)
1636 7. default tool for fallback (``:merge`` or ``:prompt``)
1605
1637
1606 This command writes out examination result in the style below::
1638 This command writes out examination result in the style below::
1607
1639
1608 FILE = MERGETOOL
1640 FILE = MERGETOOL
1609
1641
1610 By default, all files known in the first parent context of the
1642 By default, all files known in the first parent context of the
1611 working directory are examined. Use file patterns and/or -I/-X
1643 working directory are examined. Use file patterns and/or -I/-X
1612 options to limit target files. -r/--rev is also useful to examine
1644 options to limit target files. -r/--rev is also useful to examine
1613 files in another context without actual updating to it.
1645 files in another context without actual updating to it.
1614
1646
1615 With --debug, this command shows warning messages while matching
1647 With --debug, this command shows warning messages while matching
1616 against ``merge-patterns`` and so on, too. It is recommended to
1648 against ``merge-patterns`` and so on, too. It is recommended to
1617 use this option with explicit file patterns and/or -I/-X options,
1649 use this option with explicit file patterns and/or -I/-X options,
1618 because this option increases amount of output per file according
1650 because this option increases amount of output per file according
1619 to configurations in hgrc.
1651 to configurations in hgrc.
1620
1652
1621 With -v/--verbose, this command shows configurations below at
1653 With -v/--verbose, this command shows configurations below at
1622 first (only if specified).
1654 first (only if specified).
1623
1655
1624 - ``--tool`` option
1656 - ``--tool`` option
1625 - ``HGMERGE`` environment variable
1657 - ``HGMERGE`` environment variable
1626 - configuration of ``ui.merge``
1658 - configuration of ``ui.merge``
1627
1659
1628 If merge tool is chosen before matching against
1660 If merge tool is chosen before matching against
1629 ``merge-patterns``, this command can't show any helpful
1661 ``merge-patterns``, this command can't show any helpful
1630 information, even with --debug. In such case, information above is
1662 information, even with --debug. In such case, information above is
1631 useful to know why a merge tool is chosen.
1663 useful to know why a merge tool is chosen.
1632 """
1664 """
1633 opts = pycompat.byteskwargs(opts)
1665 opts = pycompat.byteskwargs(opts)
1634 overrides = {}
1666 overrides = {}
1635 if opts['tool']:
1667 if opts['tool']:
1636 overrides[('ui', 'forcemerge')] = opts['tool']
1668 overrides[('ui', 'forcemerge')] = opts['tool']
1637 ui.note(('with --tool %r\n') % (opts['tool']))
1669 ui.note(('with --tool %r\n') % (opts['tool']))
1638
1670
1639 with ui.configoverride(overrides, 'debugmergepatterns'):
1671 with ui.configoverride(overrides, 'debugmergepatterns'):
1640 hgmerge = encoding.environ.get("HGMERGE")
1672 hgmerge = encoding.environ.get("HGMERGE")
1641 if hgmerge is not None:
1673 if hgmerge is not None:
1642 ui.note(('with HGMERGE=%r\n') % (hgmerge))
1674 ui.note(('with HGMERGE=%r\n') % (hgmerge))
1643 uimerge = ui.config("ui", "merge")
1675 uimerge = ui.config("ui", "merge")
1644 if uimerge:
1676 if uimerge:
1645 ui.note(('with ui.merge=%r\n') % (uimerge))
1677 ui.note(('with ui.merge=%r\n') % (uimerge))
1646
1678
1647 ctx = scmutil.revsingle(repo, opts.get('rev'))
1679 ctx = scmutil.revsingle(repo, opts.get('rev'))
1648 m = scmutil.match(ctx, pats, opts)
1680 m = scmutil.match(ctx, pats, opts)
1649 changedelete = opts['changedelete']
1681 changedelete = opts['changedelete']
1650 for path in ctx.walk(m):
1682 for path in ctx.walk(m):
1651 fctx = ctx[path]
1683 fctx = ctx[path]
1652 try:
1684 try:
1653 if not ui.debugflag:
1685 if not ui.debugflag:
1654 ui.pushbuffer(error=True)
1686 ui.pushbuffer(error=True)
1655 tool, toolpath = filemerge._picktool(repo, ui, path,
1687 tool, toolpath = filemerge._picktool(repo, ui, path,
1656 fctx.isbinary(),
1688 fctx.isbinary(),
1657 'l' in fctx.flags(),
1689 'l' in fctx.flags(),
1658 changedelete)
1690 changedelete)
1659 finally:
1691 finally:
1660 if not ui.debugflag:
1692 if not ui.debugflag:
1661 ui.popbuffer()
1693 ui.popbuffer()
1662 ui.write(('%s = %s\n') % (path, tool))
1694 ui.write(('%s = %s\n') % (path, tool))
1663
1695
1664 @command('debugpushkey', [], _('REPO NAMESPACE [KEY OLD NEW]'), norepo=True)
1696 @command('debugpushkey', [], _('REPO NAMESPACE [KEY OLD NEW]'), norepo=True)
1665 def debugpushkey(ui, repopath, namespace, *keyinfo, **opts):
1697 def debugpushkey(ui, repopath, namespace, *keyinfo, **opts):
1666 '''access the pushkey key/value protocol
1698 '''access the pushkey key/value protocol
1667
1699
1668 With two args, list the keys in the given namespace.
1700 With two args, list the keys in the given namespace.
1669
1701
1670 With five args, set a key to new if it currently is set to old.
1702 With five args, set a key to new if it currently is set to old.
1671 Reports success or failure.
1703 Reports success or failure.
1672 '''
1704 '''
1673
1705
1674 target = hg.peer(ui, {}, repopath)
1706 target = hg.peer(ui, {}, repopath)
1675 if keyinfo:
1707 if keyinfo:
1676 key, old, new = keyinfo
1708 key, old, new = keyinfo
1677 r = target.pushkey(namespace, key, old, new)
1709 r = target.pushkey(namespace, key, old, new)
1678 ui.status(str(r) + '\n')
1710 ui.status(str(r) + '\n')
1679 return not r
1711 return not r
1680 else:
1712 else:
1681 for k, v in sorted(target.listkeys(namespace).iteritems()):
1713 for k, v in sorted(target.listkeys(namespace).iteritems()):
1682 ui.write("%s\t%s\n" % (util.escapestr(k),
1714 ui.write("%s\t%s\n" % (util.escapestr(k),
1683 util.escapestr(v)))
1715 util.escapestr(v)))
1684
1716
1685 @command('debugpvec', [], _('A B'))
1717 @command('debugpvec', [], _('A B'))
1686 def debugpvec(ui, repo, a, b=None):
1718 def debugpvec(ui, repo, a, b=None):
1687 ca = scmutil.revsingle(repo, a)
1719 ca = scmutil.revsingle(repo, a)
1688 cb = scmutil.revsingle(repo, b)
1720 cb = scmutil.revsingle(repo, b)
1689 pa = pvec.ctxpvec(ca)
1721 pa = pvec.ctxpvec(ca)
1690 pb = pvec.ctxpvec(cb)
1722 pb = pvec.ctxpvec(cb)
1691 if pa == pb:
1723 if pa == pb:
1692 rel = "="
1724 rel = "="
1693 elif pa > pb:
1725 elif pa > pb:
1694 rel = ">"
1726 rel = ">"
1695 elif pa < pb:
1727 elif pa < pb:
1696 rel = "<"
1728 rel = "<"
1697 elif pa | pb:
1729 elif pa | pb:
1698 rel = "|"
1730 rel = "|"
1699 ui.write(_("a: %s\n") % pa)
1731 ui.write(_("a: %s\n") % pa)
1700 ui.write(_("b: %s\n") % pb)
1732 ui.write(_("b: %s\n") % pb)
1701 ui.write(_("depth(a): %d depth(b): %d\n") % (pa._depth, pb._depth))
1733 ui.write(_("depth(a): %d depth(b): %d\n") % (pa._depth, pb._depth))
1702 ui.write(_("delta: %d hdist: %d distance: %d relation: %s\n") %
1734 ui.write(_("delta: %d hdist: %d distance: %d relation: %s\n") %
1703 (abs(pa._depth - pb._depth), pvec._hamming(pa._vec, pb._vec),
1735 (abs(pa._depth - pb._depth), pvec._hamming(pa._vec, pb._vec),
1704 pa.distance(pb), rel))
1736 pa.distance(pb), rel))
1705
1737
1706 @command('debugrebuilddirstate|debugrebuildstate',
1738 @command('debugrebuilddirstate|debugrebuildstate',
1707 [('r', 'rev', '', _('revision to rebuild to'), _('REV')),
1739 [('r', 'rev', '', _('revision to rebuild to'), _('REV')),
1708 ('', 'minimal', None, _('only rebuild files that are inconsistent with '
1740 ('', 'minimal', None, _('only rebuild files that are inconsistent with '
1709 'the working copy parent')),
1741 'the working copy parent')),
1710 ],
1742 ],
1711 _('[-r REV]'))
1743 _('[-r REV]'))
1712 def debugrebuilddirstate(ui, repo, rev, **opts):
1744 def debugrebuilddirstate(ui, repo, rev, **opts):
1713 """rebuild the dirstate as it would look like for the given revision
1745 """rebuild the dirstate as it would look like for the given revision
1714
1746
1715 If no revision is specified the first current parent will be used.
1747 If no revision is specified the first current parent will be used.
1716
1748
1717 The dirstate will be set to the files of the given revision.
1749 The dirstate will be set to the files of the given revision.
1718 The actual working directory content or existing dirstate
1750 The actual working directory content or existing dirstate
1719 information such as adds or removes is not considered.
1751 information such as adds or removes is not considered.
1720
1752
1721 ``minimal`` will only rebuild the dirstate status for files that claim to be
1753 ``minimal`` will only rebuild the dirstate status for files that claim to be
1722 tracked but are not in the parent manifest, or that exist in the parent
1754 tracked but are not in the parent manifest, or that exist in the parent
1723 manifest but are not in the dirstate. It will not change adds, removes, or
1755 manifest but are not in the dirstate. It will not change adds, removes, or
1724 modified files that are in the working copy parent.
1756 modified files that are in the working copy parent.
1725
1757
1726 One use of this command is to make the next :hg:`status` invocation
1758 One use of this command is to make the next :hg:`status` invocation
1727 check the actual file content.
1759 check the actual file content.
1728 """
1760 """
1729 ctx = scmutil.revsingle(repo, rev)
1761 ctx = scmutil.revsingle(repo, rev)
1730 with repo.wlock():
1762 with repo.wlock():
1731 dirstate = repo.dirstate
1763 dirstate = repo.dirstate
1732 changedfiles = None
1764 changedfiles = None
1733 # See command doc for what minimal does.
1765 # See command doc for what minimal does.
1734 if opts.get(r'minimal'):
1766 if opts.get(r'minimal'):
1735 manifestfiles = set(ctx.manifest().keys())
1767 manifestfiles = set(ctx.manifest().keys())
1736 dirstatefiles = set(dirstate)
1768 dirstatefiles = set(dirstate)
1737 manifestonly = manifestfiles - dirstatefiles
1769 manifestonly = manifestfiles - dirstatefiles
1738 dsonly = dirstatefiles - manifestfiles
1770 dsonly = dirstatefiles - manifestfiles
1739 dsnotadded = set(f for f in dsonly if dirstate[f] != 'a')
1771 dsnotadded = set(f for f in dsonly if dirstate[f] != 'a')
1740 changedfiles = manifestonly | dsnotadded
1772 changedfiles = manifestonly | dsnotadded
1741
1773
1742 dirstate.rebuild(ctx.node(), ctx.manifest(), changedfiles)
1774 dirstate.rebuild(ctx.node(), ctx.manifest(), changedfiles)
1743
1775
1744 @command('debugrebuildfncache', [], '')
1776 @command('debugrebuildfncache', [], '')
1745 def debugrebuildfncache(ui, repo):
1777 def debugrebuildfncache(ui, repo):
1746 """rebuild the fncache file"""
1778 """rebuild the fncache file"""
1747 repair.rebuildfncache(ui, repo)
1779 repair.rebuildfncache(ui, repo)
1748
1780
1749 @command('debugrename',
1781 @command('debugrename',
1750 [('r', 'rev', '', _('revision to debug'), _('REV'))],
1782 [('r', 'rev', '', _('revision to debug'), _('REV'))],
1751 _('[-r REV] FILE'))
1783 _('[-r REV] FILE'))
1752 def debugrename(ui, repo, file1, *pats, **opts):
1784 def debugrename(ui, repo, file1, *pats, **opts):
1753 """dump rename information"""
1785 """dump rename information"""
1754
1786
1755 opts = pycompat.byteskwargs(opts)
1787 opts = pycompat.byteskwargs(opts)
1756 ctx = scmutil.revsingle(repo, opts.get('rev'))
1788 ctx = scmutil.revsingle(repo, opts.get('rev'))
1757 m = scmutil.match(ctx, (file1,) + pats, opts)
1789 m = scmutil.match(ctx, (file1,) + pats, opts)
1758 for abs in ctx.walk(m):
1790 for abs in ctx.walk(m):
1759 fctx = ctx[abs]
1791 fctx = ctx[abs]
1760 o = fctx.filelog().renamed(fctx.filenode())
1792 o = fctx.filelog().renamed(fctx.filenode())
1761 rel = m.rel(abs)
1793 rel = m.rel(abs)
1762 if o:
1794 if o:
1763 ui.write(_("%s renamed from %s:%s\n") % (rel, o[0], hex(o[1])))
1795 ui.write(_("%s renamed from %s:%s\n") % (rel, o[0], hex(o[1])))
1764 else:
1796 else:
1765 ui.write(_("%s not renamed\n") % rel)
1797 ui.write(_("%s not renamed\n") % rel)
1766
1798
1767 @command('debugrevlog', cmdutil.debugrevlogopts +
1799 @command('debugrevlog', cmdutil.debugrevlogopts +
1768 [('d', 'dump', False, _('dump index data'))],
1800 [('d', 'dump', False, _('dump index data'))],
1769 _('-c|-m|FILE'),
1801 _('-c|-m|FILE'),
1770 optionalrepo=True)
1802 optionalrepo=True)
1771 def debugrevlog(ui, repo, file_=None, **opts):
1803 def debugrevlog(ui, repo, file_=None, **opts):
1772 """show data and statistics about a revlog"""
1804 """show data and statistics about a revlog"""
1773 opts = pycompat.byteskwargs(opts)
1805 opts = pycompat.byteskwargs(opts)
1774 r = cmdutil.openrevlog(repo, 'debugrevlog', file_, opts)
1806 r = cmdutil.openrevlog(repo, 'debugrevlog', file_, opts)
1775
1807
1776 if opts.get("dump"):
1808 if opts.get("dump"):
1777 numrevs = len(r)
1809 numrevs = len(r)
1778 ui.write(("# rev p1rev p2rev start end deltastart base p1 p2"
1810 ui.write(("# rev p1rev p2rev start end deltastart base p1 p2"
1779 " rawsize totalsize compression heads chainlen\n"))
1811 " rawsize totalsize compression heads chainlen\n"))
1780 ts = 0
1812 ts = 0
1781 heads = set()
1813 heads = set()
1782
1814
1783 for rev in xrange(numrevs):
1815 for rev in xrange(numrevs):
1784 dbase = r.deltaparent(rev)
1816 dbase = r.deltaparent(rev)
1785 if dbase == -1:
1817 if dbase == -1:
1786 dbase = rev
1818 dbase = rev
1787 cbase = r.chainbase(rev)
1819 cbase = r.chainbase(rev)
1788 clen = r.chainlen(rev)
1820 clen = r.chainlen(rev)
1789 p1, p2 = r.parentrevs(rev)
1821 p1, p2 = r.parentrevs(rev)
1790 rs = r.rawsize(rev)
1822 rs = r.rawsize(rev)
1791 ts = ts + rs
1823 ts = ts + rs
1792 heads -= set(r.parentrevs(rev))
1824 heads -= set(r.parentrevs(rev))
1793 heads.add(rev)
1825 heads.add(rev)
1794 try:
1826 try:
1795 compression = ts / r.end(rev)
1827 compression = ts / r.end(rev)
1796 except ZeroDivisionError:
1828 except ZeroDivisionError:
1797 compression = 0
1829 compression = 0
1798 ui.write("%5d %5d %5d %5d %5d %10d %4d %4d %4d %7d %9d "
1830 ui.write("%5d %5d %5d %5d %5d %10d %4d %4d %4d %7d %9d "
1799 "%11d %5d %8d\n" %
1831 "%11d %5d %8d\n" %
1800 (rev, p1, p2, r.start(rev), r.end(rev),
1832 (rev, p1, p2, r.start(rev), r.end(rev),
1801 r.start(dbase), r.start(cbase),
1833 r.start(dbase), r.start(cbase),
1802 r.start(p1), r.start(p2),
1834 r.start(p1), r.start(p2),
1803 rs, ts, compression, len(heads), clen))
1835 rs, ts, compression, len(heads), clen))
1804 return 0
1836 return 0
1805
1837
1806 v = r.version
1838 v = r.version
1807 format = v & 0xFFFF
1839 format = v & 0xFFFF
1808 flags = []
1840 flags = []
1809 gdelta = False
1841 gdelta = False
1810 if v & revlog.FLAG_INLINE_DATA:
1842 if v & revlog.FLAG_INLINE_DATA:
1811 flags.append('inline')
1843 flags.append('inline')
1812 if v & revlog.FLAG_GENERALDELTA:
1844 if v & revlog.FLAG_GENERALDELTA:
1813 gdelta = True
1845 gdelta = True
1814 flags.append('generaldelta')
1846 flags.append('generaldelta')
1815 if not flags:
1847 if not flags:
1816 flags = ['(none)']
1848 flags = ['(none)']
1817
1849
1818 nummerges = 0
1850 nummerges = 0
1819 numfull = 0
1851 numfull = 0
1820 numprev = 0
1852 numprev = 0
1821 nump1 = 0
1853 nump1 = 0
1822 nump2 = 0
1854 nump2 = 0
1823 numother = 0
1855 numother = 0
1824 nump1prev = 0
1856 nump1prev = 0
1825 nump2prev = 0
1857 nump2prev = 0
1826 chainlengths = []
1858 chainlengths = []
1827 chainbases = []
1859 chainbases = []
1828 chainspans = []
1860 chainspans = []
1829
1861
1830 datasize = [None, 0, 0]
1862 datasize = [None, 0, 0]
1831 fullsize = [None, 0, 0]
1863 fullsize = [None, 0, 0]
1832 deltasize = [None, 0, 0]
1864 deltasize = [None, 0, 0]
1833 chunktypecounts = {}
1865 chunktypecounts = {}
1834 chunktypesizes = {}
1866 chunktypesizes = {}
1835
1867
1836 def addsize(size, l):
1868 def addsize(size, l):
1837 if l[0] is None or size < l[0]:
1869 if l[0] is None or size < l[0]:
1838 l[0] = size
1870 l[0] = size
1839 if size > l[1]:
1871 if size > l[1]:
1840 l[1] = size
1872 l[1] = size
1841 l[2] += size
1873 l[2] += size
1842
1874
1843 numrevs = len(r)
1875 numrevs = len(r)
1844 for rev in xrange(numrevs):
1876 for rev in xrange(numrevs):
1845 p1, p2 = r.parentrevs(rev)
1877 p1, p2 = r.parentrevs(rev)
1846 delta = r.deltaparent(rev)
1878 delta = r.deltaparent(rev)
1847 if format > 0:
1879 if format > 0:
1848 addsize(r.rawsize(rev), datasize)
1880 addsize(r.rawsize(rev), datasize)
1849 if p2 != nullrev:
1881 if p2 != nullrev:
1850 nummerges += 1
1882 nummerges += 1
1851 size = r.length(rev)
1883 size = r.length(rev)
1852 if delta == nullrev:
1884 if delta == nullrev:
1853 chainlengths.append(0)
1885 chainlengths.append(0)
1854 chainbases.append(r.start(rev))
1886 chainbases.append(r.start(rev))
1855 chainspans.append(size)
1887 chainspans.append(size)
1856 numfull += 1
1888 numfull += 1
1857 addsize(size, fullsize)
1889 addsize(size, fullsize)
1858 else:
1890 else:
1859 chainlengths.append(chainlengths[delta] + 1)
1891 chainlengths.append(chainlengths[delta] + 1)
1860 baseaddr = chainbases[delta]
1892 baseaddr = chainbases[delta]
1861 revaddr = r.start(rev)
1893 revaddr = r.start(rev)
1862 chainbases.append(baseaddr)
1894 chainbases.append(baseaddr)
1863 chainspans.append((revaddr - baseaddr) + size)
1895 chainspans.append((revaddr - baseaddr) + size)
1864 addsize(size, deltasize)
1896 addsize(size, deltasize)
1865 if delta == rev - 1:
1897 if delta == rev - 1:
1866 numprev += 1
1898 numprev += 1
1867 if delta == p1:
1899 if delta == p1:
1868 nump1prev += 1
1900 nump1prev += 1
1869 elif delta == p2:
1901 elif delta == p2:
1870 nump2prev += 1
1902 nump2prev += 1
1871 elif delta == p1:
1903 elif delta == p1:
1872 nump1 += 1
1904 nump1 += 1
1873 elif delta == p2:
1905 elif delta == p2:
1874 nump2 += 1
1906 nump2 += 1
1875 elif delta != nullrev:
1907 elif delta != nullrev:
1876 numother += 1
1908 numother += 1
1877
1909
1878 # Obtain data on the raw chunks in the revlog.
1910 # Obtain data on the raw chunks in the revlog.
1879 segment = r._getsegmentforrevs(rev, rev)[1]
1911 segment = r._getsegmentforrevs(rev, rev)[1]
1880 if segment:
1912 if segment:
1881 chunktype = bytes(segment[0:1])
1913 chunktype = bytes(segment[0:1])
1882 else:
1914 else:
1883 chunktype = 'empty'
1915 chunktype = 'empty'
1884
1916
1885 if chunktype not in chunktypecounts:
1917 if chunktype not in chunktypecounts:
1886 chunktypecounts[chunktype] = 0
1918 chunktypecounts[chunktype] = 0
1887 chunktypesizes[chunktype] = 0
1919 chunktypesizes[chunktype] = 0
1888
1920
1889 chunktypecounts[chunktype] += 1
1921 chunktypecounts[chunktype] += 1
1890 chunktypesizes[chunktype] += size
1922 chunktypesizes[chunktype] += size
1891
1923
1892 # Adjust size min value for empty cases
1924 # Adjust size min value for empty cases
1893 for size in (datasize, fullsize, deltasize):
1925 for size in (datasize, fullsize, deltasize):
1894 if size[0] is None:
1926 if size[0] is None:
1895 size[0] = 0
1927 size[0] = 0
1896
1928
1897 numdeltas = numrevs - numfull
1929 numdeltas = numrevs - numfull
1898 numoprev = numprev - nump1prev - nump2prev
1930 numoprev = numprev - nump1prev - nump2prev
1899 totalrawsize = datasize[2]
1931 totalrawsize = datasize[2]
1900 datasize[2] /= numrevs
1932 datasize[2] /= numrevs
1901 fulltotal = fullsize[2]
1933 fulltotal = fullsize[2]
1902 fullsize[2] /= numfull
1934 fullsize[2] /= numfull
1903 deltatotal = deltasize[2]
1935 deltatotal = deltasize[2]
1904 if numrevs - numfull > 0:
1936 if numrevs - numfull > 0:
1905 deltasize[2] /= numrevs - numfull
1937 deltasize[2] /= numrevs - numfull
1906 totalsize = fulltotal + deltatotal
1938 totalsize = fulltotal + deltatotal
1907 avgchainlen = sum(chainlengths) / numrevs
1939 avgchainlen = sum(chainlengths) / numrevs
1908 maxchainlen = max(chainlengths)
1940 maxchainlen = max(chainlengths)
1909 maxchainspan = max(chainspans)
1941 maxchainspan = max(chainspans)
1910 compratio = 1
1942 compratio = 1
1911 if totalsize:
1943 if totalsize:
1912 compratio = totalrawsize / totalsize
1944 compratio = totalrawsize / totalsize
1913
1945
1914 basedfmtstr = '%%%dd\n'
1946 basedfmtstr = '%%%dd\n'
1915 basepcfmtstr = '%%%dd %s(%%5.2f%%%%)\n'
1947 basepcfmtstr = '%%%dd %s(%%5.2f%%%%)\n'
1916
1948
1917 def dfmtstr(max):
1949 def dfmtstr(max):
1918 return basedfmtstr % len(str(max))
1950 return basedfmtstr % len(str(max))
1919 def pcfmtstr(max, padding=0):
1951 def pcfmtstr(max, padding=0):
1920 return basepcfmtstr % (len(str(max)), ' ' * padding)
1952 return basepcfmtstr % (len(str(max)), ' ' * padding)
1921
1953
1922 def pcfmt(value, total):
1954 def pcfmt(value, total):
1923 if total:
1955 if total:
1924 return (value, 100 * float(value) / total)
1956 return (value, 100 * float(value) / total)
1925 else:
1957 else:
1926 return value, 100.0
1958 return value, 100.0
1927
1959
1928 ui.write(('format : %d\n') % format)
1960 ui.write(('format : %d\n') % format)
1929 ui.write(('flags : %s\n') % ', '.join(flags))
1961 ui.write(('flags : %s\n') % ', '.join(flags))
1930
1962
1931 ui.write('\n')
1963 ui.write('\n')
1932 fmt = pcfmtstr(totalsize)
1964 fmt = pcfmtstr(totalsize)
1933 fmt2 = dfmtstr(totalsize)
1965 fmt2 = dfmtstr(totalsize)
1934 ui.write(('revisions : ') + fmt2 % numrevs)
1966 ui.write(('revisions : ') + fmt2 % numrevs)
1935 ui.write((' merges : ') + fmt % pcfmt(nummerges, numrevs))
1967 ui.write((' merges : ') + fmt % pcfmt(nummerges, numrevs))
1936 ui.write((' normal : ') + fmt % pcfmt(numrevs - nummerges, numrevs))
1968 ui.write((' normal : ') + fmt % pcfmt(numrevs - nummerges, numrevs))
1937 ui.write(('revisions : ') + fmt2 % numrevs)
1969 ui.write(('revisions : ') + fmt2 % numrevs)
1938 ui.write((' full : ') + fmt % pcfmt(numfull, numrevs))
1970 ui.write((' full : ') + fmt % pcfmt(numfull, numrevs))
1939 ui.write((' deltas : ') + fmt % pcfmt(numdeltas, numrevs))
1971 ui.write((' deltas : ') + fmt % pcfmt(numdeltas, numrevs))
1940 ui.write(('revision size : ') + fmt2 % totalsize)
1972 ui.write(('revision size : ') + fmt2 % totalsize)
1941 ui.write((' full : ') + fmt % pcfmt(fulltotal, totalsize))
1973 ui.write((' full : ') + fmt % pcfmt(fulltotal, totalsize))
1942 ui.write((' deltas : ') + fmt % pcfmt(deltatotal, totalsize))
1974 ui.write((' deltas : ') + fmt % pcfmt(deltatotal, totalsize))
1943
1975
1944 def fmtchunktype(chunktype):
1976 def fmtchunktype(chunktype):
1945 if chunktype == 'empty':
1977 if chunktype == 'empty':
1946 return ' %s : ' % chunktype
1978 return ' %s : ' % chunktype
1947 elif chunktype in pycompat.bytestr(string.ascii_letters):
1979 elif chunktype in pycompat.bytestr(string.ascii_letters):
1948 return ' 0x%s (%s) : ' % (hex(chunktype), chunktype)
1980 return ' 0x%s (%s) : ' % (hex(chunktype), chunktype)
1949 else:
1981 else:
1950 return ' 0x%s : ' % hex(chunktype)
1982 return ' 0x%s : ' % hex(chunktype)
1951
1983
1952 ui.write('\n')
1984 ui.write('\n')
1953 ui.write(('chunks : ') + fmt2 % numrevs)
1985 ui.write(('chunks : ') + fmt2 % numrevs)
1954 for chunktype in sorted(chunktypecounts):
1986 for chunktype in sorted(chunktypecounts):
1955 ui.write(fmtchunktype(chunktype))
1987 ui.write(fmtchunktype(chunktype))
1956 ui.write(fmt % pcfmt(chunktypecounts[chunktype], numrevs))
1988 ui.write(fmt % pcfmt(chunktypecounts[chunktype], numrevs))
1957 ui.write(('chunks size : ') + fmt2 % totalsize)
1989 ui.write(('chunks size : ') + fmt2 % totalsize)
1958 for chunktype in sorted(chunktypecounts):
1990 for chunktype in sorted(chunktypecounts):
1959 ui.write(fmtchunktype(chunktype))
1991 ui.write(fmtchunktype(chunktype))
1960 ui.write(fmt % pcfmt(chunktypesizes[chunktype], totalsize))
1992 ui.write(fmt % pcfmt(chunktypesizes[chunktype], totalsize))
1961
1993
1962 ui.write('\n')
1994 ui.write('\n')
1963 fmt = dfmtstr(max(avgchainlen, maxchainlen, maxchainspan, compratio))
1995 fmt = dfmtstr(max(avgchainlen, maxchainlen, maxchainspan, compratio))
1964 ui.write(('avg chain length : ') + fmt % avgchainlen)
1996 ui.write(('avg chain length : ') + fmt % avgchainlen)
1965 ui.write(('max chain length : ') + fmt % maxchainlen)
1997 ui.write(('max chain length : ') + fmt % maxchainlen)
1966 ui.write(('max chain reach : ') + fmt % maxchainspan)
1998 ui.write(('max chain reach : ') + fmt % maxchainspan)
1967 ui.write(('compression ratio : ') + fmt % compratio)
1999 ui.write(('compression ratio : ') + fmt % compratio)
1968
2000
1969 if format > 0:
2001 if format > 0:
1970 ui.write('\n')
2002 ui.write('\n')
1971 ui.write(('uncompressed data size (min/max/avg) : %d / %d / %d\n')
2003 ui.write(('uncompressed data size (min/max/avg) : %d / %d / %d\n')
1972 % tuple(datasize))
2004 % tuple(datasize))
1973 ui.write(('full revision size (min/max/avg) : %d / %d / %d\n')
2005 ui.write(('full revision size (min/max/avg) : %d / %d / %d\n')
1974 % tuple(fullsize))
2006 % tuple(fullsize))
1975 ui.write(('delta size (min/max/avg) : %d / %d / %d\n')
2007 ui.write(('delta size (min/max/avg) : %d / %d / %d\n')
1976 % tuple(deltasize))
2008 % tuple(deltasize))
1977
2009
1978 if numdeltas > 0:
2010 if numdeltas > 0:
1979 ui.write('\n')
2011 ui.write('\n')
1980 fmt = pcfmtstr(numdeltas)
2012 fmt = pcfmtstr(numdeltas)
1981 fmt2 = pcfmtstr(numdeltas, 4)
2013 fmt2 = pcfmtstr(numdeltas, 4)
1982 ui.write(('deltas against prev : ') + fmt % pcfmt(numprev, numdeltas))
2014 ui.write(('deltas against prev : ') + fmt % pcfmt(numprev, numdeltas))
1983 if numprev > 0:
2015 if numprev > 0:
1984 ui.write((' where prev = p1 : ') + fmt2 % pcfmt(nump1prev,
2016 ui.write((' where prev = p1 : ') + fmt2 % pcfmt(nump1prev,
1985 numprev))
2017 numprev))
1986 ui.write((' where prev = p2 : ') + fmt2 % pcfmt(nump2prev,
2018 ui.write((' where prev = p2 : ') + fmt2 % pcfmt(nump2prev,
1987 numprev))
2019 numprev))
1988 ui.write((' other : ') + fmt2 % pcfmt(numoprev,
2020 ui.write((' other : ') + fmt2 % pcfmt(numoprev,
1989 numprev))
2021 numprev))
1990 if gdelta:
2022 if gdelta:
1991 ui.write(('deltas against p1 : ')
2023 ui.write(('deltas against p1 : ')
1992 + fmt % pcfmt(nump1, numdeltas))
2024 + fmt % pcfmt(nump1, numdeltas))
1993 ui.write(('deltas against p2 : ')
2025 ui.write(('deltas against p2 : ')
1994 + fmt % pcfmt(nump2, numdeltas))
2026 + fmt % pcfmt(nump2, numdeltas))
1995 ui.write(('deltas against other : ') + fmt % pcfmt(numother,
2027 ui.write(('deltas against other : ') + fmt % pcfmt(numother,
1996 numdeltas))
2028 numdeltas))
1997
2029
1998 @command('debugrevspec',
2030 @command('debugrevspec',
1999 [('', 'optimize', None,
2031 [('', 'optimize', None,
2000 _('print parsed tree after optimizing (DEPRECATED)')),
2032 _('print parsed tree after optimizing (DEPRECATED)')),
2001 ('', 'show-revs', True, _('print list of result revisions (default)')),
2033 ('', 'show-revs', True, _('print list of result revisions (default)')),
2002 ('s', 'show-set', None, _('print internal representation of result set')),
2034 ('s', 'show-set', None, _('print internal representation of result set')),
2003 ('p', 'show-stage', [],
2035 ('p', 'show-stage', [],
2004 _('print parsed tree at the given stage'), _('NAME')),
2036 _('print parsed tree at the given stage'), _('NAME')),
2005 ('', 'no-optimized', False, _('evaluate tree without optimization')),
2037 ('', 'no-optimized', False, _('evaluate tree without optimization')),
2006 ('', 'verify-optimized', False, _('verify optimized result')),
2038 ('', 'verify-optimized', False, _('verify optimized result')),
2007 ],
2039 ],
2008 ('REVSPEC'))
2040 ('REVSPEC'))
2009 def debugrevspec(ui, repo, expr, **opts):
2041 def debugrevspec(ui, repo, expr, **opts):
2010 """parse and apply a revision specification
2042 """parse and apply a revision specification
2011
2043
2012 Use -p/--show-stage option to print the parsed tree at the given stages.
2044 Use -p/--show-stage option to print the parsed tree at the given stages.
2013 Use -p all to print tree at every stage.
2045 Use -p all to print tree at every stage.
2014
2046
2015 Use --no-show-revs option with -s or -p to print only the set
2047 Use --no-show-revs option with -s or -p to print only the set
2016 representation or the parsed tree respectively.
2048 representation or the parsed tree respectively.
2017
2049
2018 Use --verify-optimized to compare the optimized result with the unoptimized
2050 Use --verify-optimized to compare the optimized result with the unoptimized
2019 one. Returns 1 if the optimized result differs.
2051 one. Returns 1 if the optimized result differs.
2020 """
2052 """
2021 opts = pycompat.byteskwargs(opts)
2053 opts = pycompat.byteskwargs(opts)
2022 aliases = ui.configitems('revsetalias')
2054 aliases = ui.configitems('revsetalias')
2023 stages = [
2055 stages = [
2024 ('parsed', lambda tree: tree),
2056 ('parsed', lambda tree: tree),
2025 ('expanded', lambda tree: revsetlang.expandaliases(tree, aliases,
2057 ('expanded', lambda tree: revsetlang.expandaliases(tree, aliases,
2026 ui.warn)),
2058 ui.warn)),
2027 ('concatenated', revsetlang.foldconcat),
2059 ('concatenated', revsetlang.foldconcat),
2028 ('analyzed', revsetlang.analyze),
2060 ('analyzed', revsetlang.analyze),
2029 ('optimized', revsetlang.optimize),
2061 ('optimized', revsetlang.optimize),
2030 ]
2062 ]
2031 if opts['no_optimized']:
2063 if opts['no_optimized']:
2032 stages = stages[:-1]
2064 stages = stages[:-1]
2033 if opts['verify_optimized'] and opts['no_optimized']:
2065 if opts['verify_optimized'] and opts['no_optimized']:
2034 raise error.Abort(_('cannot use --verify-optimized with '
2066 raise error.Abort(_('cannot use --verify-optimized with '
2035 '--no-optimized'))
2067 '--no-optimized'))
2036 stagenames = set(n for n, f in stages)
2068 stagenames = set(n for n, f in stages)
2037
2069
2038 showalways = set()
2070 showalways = set()
2039 showchanged = set()
2071 showchanged = set()
2040 if ui.verbose and not opts['show_stage']:
2072 if ui.verbose and not opts['show_stage']:
2041 # show parsed tree by --verbose (deprecated)
2073 # show parsed tree by --verbose (deprecated)
2042 showalways.add('parsed')
2074 showalways.add('parsed')
2043 showchanged.update(['expanded', 'concatenated'])
2075 showchanged.update(['expanded', 'concatenated'])
2044 if opts['optimize']:
2076 if opts['optimize']:
2045 showalways.add('optimized')
2077 showalways.add('optimized')
2046 if opts['show_stage'] and opts['optimize']:
2078 if opts['show_stage'] and opts['optimize']:
2047 raise error.Abort(_('cannot use --optimize with --show-stage'))
2079 raise error.Abort(_('cannot use --optimize with --show-stage'))
2048 if opts['show_stage'] == ['all']:
2080 if opts['show_stage'] == ['all']:
2049 showalways.update(stagenames)
2081 showalways.update(stagenames)
2050 else:
2082 else:
2051 for n in opts['show_stage']:
2083 for n in opts['show_stage']:
2052 if n not in stagenames:
2084 if n not in stagenames:
2053 raise error.Abort(_('invalid stage name: %s') % n)
2085 raise error.Abort(_('invalid stage name: %s') % n)
2054 showalways.update(opts['show_stage'])
2086 showalways.update(opts['show_stage'])
2055
2087
2056 treebystage = {}
2088 treebystage = {}
2057 printedtree = None
2089 printedtree = None
2058 tree = revsetlang.parse(expr, lookup=repo.__contains__)
2090 tree = revsetlang.parse(expr, lookup=repo.__contains__)
2059 for n, f in stages:
2091 for n, f in stages:
2060 treebystage[n] = tree = f(tree)
2092 treebystage[n] = tree = f(tree)
2061 if n in showalways or (n in showchanged and tree != printedtree):
2093 if n in showalways or (n in showchanged and tree != printedtree):
2062 if opts['show_stage'] or n != 'parsed':
2094 if opts['show_stage'] or n != 'parsed':
2063 ui.write(("* %s:\n") % n)
2095 ui.write(("* %s:\n") % n)
2064 ui.write(revsetlang.prettyformat(tree), "\n")
2096 ui.write(revsetlang.prettyformat(tree), "\n")
2065 printedtree = tree
2097 printedtree = tree
2066
2098
2067 if opts['verify_optimized']:
2099 if opts['verify_optimized']:
2068 arevs = revset.makematcher(treebystage['analyzed'])(repo)
2100 arevs = revset.makematcher(treebystage['analyzed'])(repo)
2069 brevs = revset.makematcher(treebystage['optimized'])(repo)
2101 brevs = revset.makematcher(treebystage['optimized'])(repo)
2070 if opts['show_set'] or (opts['show_set'] is None and ui.verbose):
2102 if opts['show_set'] or (opts['show_set'] is None and ui.verbose):
2071 ui.write(("* analyzed set:\n"), smartset.prettyformat(arevs), "\n")
2103 ui.write(("* analyzed set:\n"), smartset.prettyformat(arevs), "\n")
2072 ui.write(("* optimized set:\n"), smartset.prettyformat(brevs), "\n")
2104 ui.write(("* optimized set:\n"), smartset.prettyformat(brevs), "\n")
2073 arevs = list(arevs)
2105 arevs = list(arevs)
2074 brevs = list(brevs)
2106 brevs = list(brevs)
2075 if arevs == brevs:
2107 if arevs == brevs:
2076 return 0
2108 return 0
2077 ui.write(('--- analyzed\n'), label='diff.file_a')
2109 ui.write(('--- analyzed\n'), label='diff.file_a')
2078 ui.write(('+++ optimized\n'), label='diff.file_b')
2110 ui.write(('+++ optimized\n'), label='diff.file_b')
2079 sm = difflib.SequenceMatcher(None, arevs, brevs)
2111 sm = difflib.SequenceMatcher(None, arevs, brevs)
2080 for tag, alo, ahi, blo, bhi in sm.get_opcodes():
2112 for tag, alo, ahi, blo, bhi in sm.get_opcodes():
2081 if tag in ('delete', 'replace'):
2113 if tag in ('delete', 'replace'):
2082 for c in arevs[alo:ahi]:
2114 for c in arevs[alo:ahi]:
2083 ui.write('-%s\n' % c, label='diff.deleted')
2115 ui.write('-%s\n' % c, label='diff.deleted')
2084 if tag in ('insert', 'replace'):
2116 if tag in ('insert', 'replace'):
2085 for c in brevs[blo:bhi]:
2117 for c in brevs[blo:bhi]:
2086 ui.write('+%s\n' % c, label='diff.inserted')
2118 ui.write('+%s\n' % c, label='diff.inserted')
2087 if tag == 'equal':
2119 if tag == 'equal':
2088 for c in arevs[alo:ahi]:
2120 for c in arevs[alo:ahi]:
2089 ui.write(' %s\n' % c)
2121 ui.write(' %s\n' % c)
2090 return 1
2122 return 1
2091
2123
2092 func = revset.makematcher(tree)
2124 func = revset.makematcher(tree)
2093 revs = func(repo)
2125 revs = func(repo)
2094 if opts['show_set'] or (opts['show_set'] is None and ui.verbose):
2126 if opts['show_set'] or (opts['show_set'] is None and ui.verbose):
2095 ui.write(("* set:\n"), smartset.prettyformat(revs), "\n")
2127 ui.write(("* set:\n"), smartset.prettyformat(revs), "\n")
2096 if not opts['show_revs']:
2128 if not opts['show_revs']:
2097 return
2129 return
2098 for c in revs:
2130 for c in revs:
2099 ui.write("%s\n" % c)
2131 ui.write("%s\n" % c)
2100
2132
2101 @command('debugsetparents', [], _('REV1 [REV2]'))
2133 @command('debugsetparents', [], _('REV1 [REV2]'))
2102 def debugsetparents(ui, repo, rev1, rev2=None):
2134 def debugsetparents(ui, repo, rev1, rev2=None):
2103 """manually set the parents of the current working directory
2135 """manually set the parents of the current working directory
2104
2136
2105 This is useful for writing repository conversion tools, but should
2137 This is useful for writing repository conversion tools, but should
2106 be used with care. For example, neither the working directory nor the
2138 be used with care. For example, neither the working directory nor the
2107 dirstate is updated, so file status may be incorrect after running this
2139 dirstate is updated, so file status may be incorrect after running this
2108 command.
2140 command.
2109
2141
2110 Returns 0 on success.
2142 Returns 0 on success.
2111 """
2143 """
2112
2144
2113 r1 = scmutil.revsingle(repo, rev1).node()
2145 r1 = scmutil.revsingle(repo, rev1).node()
2114 r2 = scmutil.revsingle(repo, rev2, 'null').node()
2146 r2 = scmutil.revsingle(repo, rev2, 'null').node()
2115
2147
2116 with repo.wlock():
2148 with repo.wlock():
2117 repo.setparents(r1, r2)
2149 repo.setparents(r1, r2)
2118
2150
2119 @command('debugssl', [], '[SOURCE]', optionalrepo=True)
2151 @command('debugssl', [], '[SOURCE]', optionalrepo=True)
2120 def debugssl(ui, repo, source=None, **opts):
2152 def debugssl(ui, repo, source=None, **opts):
2121 '''test a secure connection to a server
2153 '''test a secure connection to a server
2122
2154
2123 This builds the certificate chain for the server on Windows, installing the
2155 This builds the certificate chain for the server on Windows, installing the
2124 missing intermediates and trusted root via Windows Update if necessary. It
2156 missing intermediates and trusted root via Windows Update if necessary. It
2125 does nothing on other platforms.
2157 does nothing on other platforms.
2126
2158
2127 If SOURCE is omitted, the 'default' path will be used. If a URL is given,
2159 If SOURCE is omitted, the 'default' path will be used. If a URL is given,
2128 that server is used. See :hg:`help urls` for more information.
2160 that server is used. See :hg:`help urls` for more information.
2129
2161
2130 If the update succeeds, retry the original operation. Otherwise, the cause
2162 If the update succeeds, retry the original operation. Otherwise, the cause
2131 of the SSL error is likely another issue.
2163 of the SSL error is likely another issue.
2132 '''
2164 '''
2133 if not pycompat.iswindows:
2165 if not pycompat.iswindows:
2134 raise error.Abort(_('certificate chain building is only possible on '
2166 raise error.Abort(_('certificate chain building is only possible on '
2135 'Windows'))
2167 'Windows'))
2136
2168
2137 if not source:
2169 if not source:
2138 if not repo:
2170 if not repo:
2139 raise error.Abort(_("there is no Mercurial repository here, and no "
2171 raise error.Abort(_("there is no Mercurial repository here, and no "
2140 "server specified"))
2172 "server specified"))
2141 source = "default"
2173 source = "default"
2142
2174
2143 source, branches = hg.parseurl(ui.expandpath(source))
2175 source, branches = hg.parseurl(ui.expandpath(source))
2144 url = util.url(source)
2176 url = util.url(source)
2145 addr = None
2177 addr = None
2146
2178
2147 if url.scheme == 'https':
2179 if url.scheme == 'https':
2148 addr = (url.host, url.port or 443)
2180 addr = (url.host, url.port or 443)
2149 elif url.scheme == 'ssh':
2181 elif url.scheme == 'ssh':
2150 addr = (url.host, url.port or 22)
2182 addr = (url.host, url.port or 22)
2151 else:
2183 else:
2152 raise error.Abort(_("only https and ssh connections are supported"))
2184 raise error.Abort(_("only https and ssh connections are supported"))
2153
2185
2154 from . import win32
2186 from . import win32
2155
2187
2156 s = ssl.wrap_socket(socket.socket(), ssl_version=ssl.PROTOCOL_TLS,
2188 s = ssl.wrap_socket(socket.socket(), ssl_version=ssl.PROTOCOL_TLS,
2157 cert_reqs=ssl.CERT_NONE, ca_certs=None)
2189 cert_reqs=ssl.CERT_NONE, ca_certs=None)
2158
2190
2159 try:
2191 try:
2160 s.connect(addr)
2192 s.connect(addr)
2161 cert = s.getpeercert(True)
2193 cert = s.getpeercert(True)
2162
2194
2163 ui.status(_('checking the certificate chain for %s\n') % url.host)
2195 ui.status(_('checking the certificate chain for %s\n') % url.host)
2164
2196
2165 complete = win32.checkcertificatechain(cert, build=False)
2197 complete = win32.checkcertificatechain(cert, build=False)
2166
2198
2167 if not complete:
2199 if not complete:
2168 ui.status(_('certificate chain is incomplete, updating... '))
2200 ui.status(_('certificate chain is incomplete, updating... '))
2169
2201
2170 if not win32.checkcertificatechain(cert):
2202 if not win32.checkcertificatechain(cert):
2171 ui.status(_('failed.\n'))
2203 ui.status(_('failed.\n'))
2172 else:
2204 else:
2173 ui.status(_('done.\n'))
2205 ui.status(_('done.\n'))
2174 else:
2206 else:
2175 ui.status(_('full certificate chain is available\n'))
2207 ui.status(_('full certificate chain is available\n'))
2176 finally:
2208 finally:
2177 s.close()
2209 s.close()
2178
2210
2179 @command('debugsub',
2211 @command('debugsub',
2180 [('r', 'rev', '',
2212 [('r', 'rev', '',
2181 _('revision to check'), _('REV'))],
2213 _('revision to check'), _('REV'))],
2182 _('[-r REV] [REV]'))
2214 _('[-r REV] [REV]'))
2183 def debugsub(ui, repo, rev=None):
2215 def debugsub(ui, repo, rev=None):
2184 ctx = scmutil.revsingle(repo, rev, None)
2216 ctx = scmutil.revsingle(repo, rev, None)
2185 for k, v in sorted(ctx.substate.items()):
2217 for k, v in sorted(ctx.substate.items()):
2186 ui.write(('path %s\n') % k)
2218 ui.write(('path %s\n') % k)
2187 ui.write((' source %s\n') % v[0])
2219 ui.write((' source %s\n') % v[0])
2188 ui.write((' revision %s\n') % v[1])
2220 ui.write((' revision %s\n') % v[1])
2189
2221
2190 @command('debugsuccessorssets',
2222 @command('debugsuccessorssets',
2191 [('', 'closest', False, _('return closest successors sets only'))],
2223 [('', 'closest', False, _('return closest successors sets only'))],
2192 _('[REV]'))
2224 _('[REV]'))
2193 def debugsuccessorssets(ui, repo, *revs, **opts):
2225 def debugsuccessorssets(ui, repo, *revs, **opts):
2194 """show set of successors for revision
2226 """show set of successors for revision
2195
2227
2196 A successors set of changeset A is a consistent group of revisions that
2228 A successors set of changeset A is a consistent group of revisions that
2197 succeed A. It contains non-obsolete changesets only unless closests
2229 succeed A. It contains non-obsolete changesets only unless closests
2198 successors set is set.
2230 successors set is set.
2199
2231
2200 In most cases a changeset A has a single successors set containing a single
2232 In most cases a changeset A has a single successors set containing a single
2201 successor (changeset A replaced by A').
2233 successor (changeset A replaced by A').
2202
2234
2203 A changeset that is made obsolete with no successors are called "pruned".
2235 A changeset that is made obsolete with no successors are called "pruned".
2204 Such changesets have no successors sets at all.
2236 Such changesets have no successors sets at all.
2205
2237
2206 A changeset that has been "split" will have a successors set containing
2238 A changeset that has been "split" will have a successors set containing
2207 more than one successor.
2239 more than one successor.
2208
2240
2209 A changeset that has been rewritten in multiple different ways is called
2241 A changeset that has been rewritten in multiple different ways is called
2210 "divergent". Such changesets have multiple successor sets (each of which
2242 "divergent". Such changesets have multiple successor sets (each of which
2211 may also be split, i.e. have multiple successors).
2243 may also be split, i.e. have multiple successors).
2212
2244
2213 Results are displayed as follows::
2245 Results are displayed as follows::
2214
2246
2215 <rev1>
2247 <rev1>
2216 <successors-1A>
2248 <successors-1A>
2217 <rev2>
2249 <rev2>
2218 <successors-2A>
2250 <successors-2A>
2219 <successors-2B1> <successors-2B2> <successors-2B3>
2251 <successors-2B1> <successors-2B2> <successors-2B3>
2220
2252
2221 Here rev2 has two possible (i.e. divergent) successors sets. The first
2253 Here rev2 has two possible (i.e. divergent) successors sets. The first
2222 holds one element, whereas the second holds three (i.e. the changeset has
2254 holds one element, whereas the second holds three (i.e. the changeset has
2223 been split).
2255 been split).
2224 """
2256 """
2225 # passed to successorssets caching computation from one call to another
2257 # passed to successorssets caching computation from one call to another
2226 cache = {}
2258 cache = {}
2227 ctx2str = str
2259 ctx2str = str
2228 node2str = short
2260 node2str = short
2229 if ui.debug():
2261 if ui.debug():
2230 def ctx2str(ctx):
2262 def ctx2str(ctx):
2231 return ctx.hex()
2263 return ctx.hex()
2232 node2str = hex
2264 node2str = hex
2233 for rev in scmutil.revrange(repo, revs):
2265 for rev in scmutil.revrange(repo, revs):
2234 ctx = repo[rev]
2266 ctx = repo[rev]
2235 ui.write('%s\n'% ctx2str(ctx))
2267 ui.write('%s\n'% ctx2str(ctx))
2236 for succsset in obsutil.successorssets(repo, ctx.node(),
2268 for succsset in obsutil.successorssets(repo, ctx.node(),
2237 closest=opts['closest'],
2269 closest=opts['closest'],
2238 cache=cache):
2270 cache=cache):
2239 if succsset:
2271 if succsset:
2240 ui.write(' ')
2272 ui.write(' ')
2241 ui.write(node2str(succsset[0]))
2273 ui.write(node2str(succsset[0]))
2242 for node in succsset[1:]:
2274 for node in succsset[1:]:
2243 ui.write(' ')
2275 ui.write(' ')
2244 ui.write(node2str(node))
2276 ui.write(node2str(node))
2245 ui.write('\n')
2277 ui.write('\n')
2246
2278
2247 @command('debugtemplate',
2279 @command('debugtemplate',
2248 [('r', 'rev', [], _('apply template on changesets'), _('REV')),
2280 [('r', 'rev', [], _('apply template on changesets'), _('REV')),
2249 ('D', 'define', [], _('define template keyword'), _('KEY=VALUE'))],
2281 ('D', 'define', [], _('define template keyword'), _('KEY=VALUE'))],
2250 _('[-r REV]... [-D KEY=VALUE]... TEMPLATE'),
2282 _('[-r REV]... [-D KEY=VALUE]... TEMPLATE'),
2251 optionalrepo=True)
2283 optionalrepo=True)
2252 def debugtemplate(ui, repo, tmpl, **opts):
2284 def debugtemplate(ui, repo, tmpl, **opts):
2253 """parse and apply a template
2285 """parse and apply a template
2254
2286
2255 If -r/--rev is given, the template is processed as a log template and
2287 If -r/--rev is given, the template is processed as a log template and
2256 applied to the given changesets. Otherwise, it is processed as a generic
2288 applied to the given changesets. Otherwise, it is processed as a generic
2257 template.
2289 template.
2258
2290
2259 Use --verbose to print the parsed tree.
2291 Use --verbose to print the parsed tree.
2260 """
2292 """
2261 revs = None
2293 revs = None
2262 if opts[r'rev']:
2294 if opts[r'rev']:
2263 if repo is None:
2295 if repo is None:
2264 raise error.RepoError(_('there is no Mercurial repository here '
2296 raise error.RepoError(_('there is no Mercurial repository here '
2265 '(.hg not found)'))
2297 '(.hg not found)'))
2266 revs = scmutil.revrange(repo, opts[r'rev'])
2298 revs = scmutil.revrange(repo, opts[r'rev'])
2267
2299
2268 props = {}
2300 props = {}
2269 for d in opts[r'define']:
2301 for d in opts[r'define']:
2270 try:
2302 try:
2271 k, v = (e.strip() for e in d.split('=', 1))
2303 k, v = (e.strip() for e in d.split('=', 1))
2272 if not k or k == 'ui':
2304 if not k or k == 'ui':
2273 raise ValueError
2305 raise ValueError
2274 props[k] = v
2306 props[k] = v
2275 except ValueError:
2307 except ValueError:
2276 raise error.Abort(_('malformed keyword definition: %s') % d)
2308 raise error.Abort(_('malformed keyword definition: %s') % d)
2277
2309
2278 if ui.verbose:
2310 if ui.verbose:
2279 aliases = ui.configitems('templatealias')
2311 aliases = ui.configitems('templatealias')
2280 tree = templater.parse(tmpl)
2312 tree = templater.parse(tmpl)
2281 ui.note(templater.prettyformat(tree), '\n')
2313 ui.note(templater.prettyformat(tree), '\n')
2282 newtree = templater.expandaliases(tree, aliases)
2314 newtree = templater.expandaliases(tree, aliases)
2283 if newtree != tree:
2315 if newtree != tree:
2284 ui.note(("* expanded:\n"), templater.prettyformat(newtree), '\n')
2316 ui.note(("* expanded:\n"), templater.prettyformat(newtree), '\n')
2285
2317
2286 if revs is None:
2318 if revs is None:
2287 t = formatter.maketemplater(ui, tmpl)
2319 t = formatter.maketemplater(ui, tmpl)
2288 props['ui'] = ui
2320 props['ui'] = ui
2289 ui.write(t.render(props))
2321 ui.write(t.render(props))
2290 else:
2322 else:
2291 displayer = cmdutil.makelogtemplater(ui, repo, tmpl)
2323 displayer = cmdutil.makelogtemplater(ui, repo, tmpl)
2292 for r in revs:
2324 for r in revs:
2293 displayer.show(repo[r], **pycompat.strkwargs(props))
2325 displayer.show(repo[r], **pycompat.strkwargs(props))
2294 displayer.close()
2326 displayer.close()
2295
2327
2296 @command('debugupdatecaches', [])
2328 @command('debugupdatecaches', [])
2297 def debugupdatecaches(ui, repo, *pats, **opts):
2329 def debugupdatecaches(ui, repo, *pats, **opts):
2298 """warm all known caches in the repository"""
2330 """warm all known caches in the repository"""
2299 with repo.wlock(), repo.lock():
2331 with repo.wlock(), repo.lock():
2300 repo.updatecaches()
2332 repo.updatecaches()
2301
2333
2302 @command('debugupgraderepo', [
2334 @command('debugupgraderepo', [
2303 ('o', 'optimize', [], _('extra optimization to perform'), _('NAME')),
2335 ('o', 'optimize', [], _('extra optimization to perform'), _('NAME')),
2304 ('', 'run', False, _('performs an upgrade')),
2336 ('', 'run', False, _('performs an upgrade')),
2305 ])
2337 ])
2306 def debugupgraderepo(ui, repo, run=False, optimize=None):
2338 def debugupgraderepo(ui, repo, run=False, optimize=None):
2307 """upgrade a repository to use different features
2339 """upgrade a repository to use different features
2308
2340
2309 If no arguments are specified, the repository is evaluated for upgrade
2341 If no arguments are specified, the repository is evaluated for upgrade
2310 and a list of problems and potential optimizations is printed.
2342 and a list of problems and potential optimizations is printed.
2311
2343
2312 With ``--run``, a repository upgrade is performed. Behavior of the upgrade
2344 With ``--run``, a repository upgrade is performed. Behavior of the upgrade
2313 can be influenced via additional arguments. More details will be provided
2345 can be influenced via additional arguments. More details will be provided
2314 by the command output when run without ``--run``.
2346 by the command output when run without ``--run``.
2315
2347
2316 During the upgrade, the repository will be locked and no writes will be
2348 During the upgrade, the repository will be locked and no writes will be
2317 allowed.
2349 allowed.
2318
2350
2319 At the end of the upgrade, the repository may not be readable while new
2351 At the end of the upgrade, the repository may not be readable while new
2320 repository data is swapped in. This window will be as long as it takes to
2352 repository data is swapped in. This window will be as long as it takes to
2321 rename some directories inside the ``.hg`` directory. On most machines, this
2353 rename some directories inside the ``.hg`` directory. On most machines, this
2322 should complete almost instantaneously and the chances of a consumer being
2354 should complete almost instantaneously and the chances of a consumer being
2323 unable to access the repository should be low.
2355 unable to access the repository should be low.
2324 """
2356 """
2325 return upgrade.upgraderepo(ui, repo, run=run, optimize=optimize)
2357 return upgrade.upgraderepo(ui, repo, run=run, optimize=optimize)
2326
2358
2327 @command('debugwalk', cmdutil.walkopts, _('[OPTION]... [FILE]...'),
2359 @command('debugwalk', cmdutil.walkopts, _('[OPTION]... [FILE]...'),
2328 inferrepo=True)
2360 inferrepo=True)
2329 def debugwalk(ui, repo, *pats, **opts):
2361 def debugwalk(ui, repo, *pats, **opts):
2330 """show how files match on given patterns"""
2362 """show how files match on given patterns"""
2331 opts = pycompat.byteskwargs(opts)
2363 opts = pycompat.byteskwargs(opts)
2332 m = scmutil.match(repo[None], pats, opts)
2364 m = scmutil.match(repo[None], pats, opts)
2333 ui.write(('matcher: %r\n' % m))
2365 ui.write(('matcher: %r\n' % m))
2334 items = list(repo[None].walk(m))
2366 items = list(repo[None].walk(m))
2335 if not items:
2367 if not items:
2336 return
2368 return
2337 f = lambda fn: fn
2369 f = lambda fn: fn
2338 if ui.configbool('ui', 'slash') and pycompat.ossep != '/':
2370 if ui.configbool('ui', 'slash') and pycompat.ossep != '/':
2339 f = lambda fn: util.normpath(fn)
2371 f = lambda fn: util.normpath(fn)
2340 fmt = 'f %%-%ds %%-%ds %%s' % (
2372 fmt = 'f %%-%ds %%-%ds %%s' % (
2341 max([len(abs) for abs in items]),
2373 max([len(abs) for abs in items]),
2342 max([len(m.rel(abs)) for abs in items]))
2374 max([len(m.rel(abs)) for abs in items]))
2343 for abs in items:
2375 for abs in items:
2344 line = fmt % (abs, f(m.rel(abs)), m.exact(abs) and 'exact' or '')
2376 line = fmt % (abs, f(m.rel(abs)), m.exact(abs) and 'exact' or '')
2345 ui.write("%s\n" % line.rstrip())
2377 ui.write("%s\n" % line.rstrip())
2346
2378
2347 @command('debugwireargs',
2379 @command('debugwireargs',
2348 [('', 'three', '', 'three'),
2380 [('', 'three', '', 'three'),
2349 ('', 'four', '', 'four'),
2381 ('', 'four', '', 'four'),
2350 ('', 'five', '', 'five'),
2382 ('', 'five', '', 'five'),
2351 ] + cmdutil.remoteopts,
2383 ] + cmdutil.remoteopts,
2352 _('REPO [OPTIONS]... [ONE [TWO]]'),
2384 _('REPO [OPTIONS]... [ONE [TWO]]'),
2353 norepo=True)
2385 norepo=True)
2354 def debugwireargs(ui, repopath, *vals, **opts):
2386 def debugwireargs(ui, repopath, *vals, **opts):
2355 opts = pycompat.byteskwargs(opts)
2387 opts = pycompat.byteskwargs(opts)
2356 repo = hg.peer(ui, opts, repopath)
2388 repo = hg.peer(ui, opts, repopath)
2357 for opt in cmdutil.remoteopts:
2389 for opt in cmdutil.remoteopts:
2358 del opts[opt[1]]
2390 del opts[opt[1]]
2359 args = {}
2391 args = {}
2360 for k, v in opts.iteritems():
2392 for k, v in opts.iteritems():
2361 if v:
2393 if v:
2362 args[k] = v
2394 args[k] = v
2363 # run twice to check that we don't mess up the stream for the next command
2395 # run twice to check that we don't mess up the stream for the next command
2364 res1 = repo.debugwireargs(*vals, **args)
2396 res1 = repo.debugwireargs(*vals, **args)
2365 res2 = repo.debugwireargs(*vals, **args)
2397 res2 = repo.debugwireargs(*vals, **args)
2366 ui.write("%s\n" % res1)
2398 ui.write("%s\n" % res1)
2367 if res1 != res2:
2399 if res1 != res2:
2368 ui.warn("%s\n" % res2)
2400 ui.warn("%s\n" % res2)
@@ -1,385 +1,387 b''
1 Show all commands except debug commands
1 Show all commands except debug commands
2 $ hg debugcomplete
2 $ hg debugcomplete
3 add
3 add
4 addremove
4 addremove
5 annotate
5 annotate
6 archive
6 archive
7 backout
7 backout
8 bisect
8 bisect
9 bookmarks
9 bookmarks
10 branch
10 branch
11 branches
11 branches
12 bundle
12 bundle
13 cat
13 cat
14 clone
14 clone
15 commit
15 commit
16 config
16 config
17 copy
17 copy
18 diff
18 diff
19 export
19 export
20 files
20 files
21 forget
21 forget
22 graft
22 graft
23 grep
23 grep
24 heads
24 heads
25 help
25 help
26 identify
26 identify
27 import
27 import
28 incoming
28 incoming
29 init
29 init
30 locate
30 locate
31 log
31 log
32 manifest
32 manifest
33 merge
33 merge
34 outgoing
34 outgoing
35 parents
35 parents
36 paths
36 paths
37 phase
37 phase
38 pull
38 pull
39 push
39 push
40 recover
40 recover
41 remove
41 remove
42 rename
42 rename
43 resolve
43 resolve
44 revert
44 revert
45 rollback
45 rollback
46 root
46 root
47 serve
47 serve
48 status
48 status
49 summary
49 summary
50 tag
50 tag
51 tags
51 tags
52 tip
52 tip
53 unbundle
53 unbundle
54 update
54 update
55 verify
55 verify
56 version
56 version
57
57
58 Show all commands that start with "a"
58 Show all commands that start with "a"
59 $ hg debugcomplete a
59 $ hg debugcomplete a
60 add
60 add
61 addremove
61 addremove
62 annotate
62 annotate
63 archive
63 archive
64
64
65 Do not show debug commands if there are other candidates
65 Do not show debug commands if there are other candidates
66 $ hg debugcomplete d
66 $ hg debugcomplete d
67 diff
67 diff
68
68
69 Show debug commands if there are no other candidates
69 Show debug commands if there are no other candidates
70 $ hg debugcomplete debug
70 $ hg debugcomplete debug
71 debugancestor
71 debugancestor
72 debugapplystreamclonebundle
72 debugapplystreamclonebundle
73 debugbuilddag
73 debugbuilddag
74 debugbundle
74 debugbundle
75 debugcapabilities
75 debugcapabilities
76 debugcheckstate
76 debugcheckstate
77 debugcolor
77 debugcolor
78 debugcommands
78 debugcommands
79 debugcomplete
79 debugcomplete
80 debugconfig
80 debugconfig
81 debugcreatestreamclonebundle
81 debugcreatestreamclonebundle
82 debugdag
82 debugdag
83 debugdata
83 debugdata
84 debugdate
84 debugdate
85 debugdeltachain
85 debugdeltachain
86 debugdirstate
86 debugdirstate
87 debugdiscovery
87 debugdiscovery
88 debugextensions
88 debugextensions
89 debugfileset
89 debugfileset
90 debugformat
90 debugfsinfo
91 debugfsinfo
91 debuggetbundle
92 debuggetbundle
92 debugignore
93 debugignore
93 debugindex
94 debugindex
94 debugindexdot
95 debugindexdot
95 debuginstall
96 debuginstall
96 debugknown
97 debugknown
97 debuglabelcomplete
98 debuglabelcomplete
98 debuglocks
99 debuglocks
99 debugmergestate
100 debugmergestate
100 debugnamecomplete
101 debugnamecomplete
101 debugobsolete
102 debugobsolete
102 debugpathcomplete
103 debugpathcomplete
103 debugpickmergetool
104 debugpickmergetool
104 debugpushkey
105 debugpushkey
105 debugpvec
106 debugpvec
106 debugrebuilddirstate
107 debugrebuilddirstate
107 debugrebuildfncache
108 debugrebuildfncache
108 debugrename
109 debugrename
109 debugrevlog
110 debugrevlog
110 debugrevspec
111 debugrevspec
111 debugsetparents
112 debugsetparents
112 debugssl
113 debugssl
113 debugsub
114 debugsub
114 debugsuccessorssets
115 debugsuccessorssets
115 debugtemplate
116 debugtemplate
116 debugupdatecaches
117 debugupdatecaches
117 debugupgraderepo
118 debugupgraderepo
118 debugwalk
119 debugwalk
119 debugwireargs
120 debugwireargs
120
121
121 Do not show the alias of a debug command if there are other candidates
122 Do not show the alias of a debug command if there are other candidates
122 (this should hide rawcommit)
123 (this should hide rawcommit)
123 $ hg debugcomplete r
124 $ hg debugcomplete r
124 recover
125 recover
125 remove
126 remove
126 rename
127 rename
127 resolve
128 resolve
128 revert
129 revert
129 rollback
130 rollback
130 root
131 root
131 Show the alias of a debug command if there are no other candidates
132 Show the alias of a debug command if there are no other candidates
132 $ hg debugcomplete rawc
133 $ hg debugcomplete rawc
133
134
134
135
135 Show the global options
136 Show the global options
136 $ hg debugcomplete --options | sort
137 $ hg debugcomplete --options | sort
137 --color
138 --color
138 --config
139 --config
139 --cwd
140 --cwd
140 --debug
141 --debug
141 --debugger
142 --debugger
142 --encoding
143 --encoding
143 --encodingmode
144 --encodingmode
144 --help
145 --help
145 --hidden
146 --hidden
146 --noninteractive
147 --noninteractive
147 --pager
148 --pager
148 --profile
149 --profile
149 --quiet
150 --quiet
150 --repository
151 --repository
151 --time
152 --time
152 --traceback
153 --traceback
153 --verbose
154 --verbose
154 --version
155 --version
155 -R
156 -R
156 -h
157 -h
157 -q
158 -q
158 -v
159 -v
159 -y
160 -y
160
161
161 Show the options for the "serve" command
162 Show the options for the "serve" command
162 $ hg debugcomplete --options serve | sort
163 $ hg debugcomplete --options serve | sort
163 --accesslog
164 --accesslog
164 --address
165 --address
165 --certificate
166 --certificate
166 --cmdserver
167 --cmdserver
167 --color
168 --color
168 --config
169 --config
169 --cwd
170 --cwd
170 --daemon
171 --daemon
171 --daemon-postexec
172 --daemon-postexec
172 --debug
173 --debug
173 --debugger
174 --debugger
174 --encoding
175 --encoding
175 --encodingmode
176 --encodingmode
176 --errorlog
177 --errorlog
177 --help
178 --help
178 --hidden
179 --hidden
179 --ipv6
180 --ipv6
180 --name
181 --name
181 --noninteractive
182 --noninteractive
182 --pager
183 --pager
183 --pid-file
184 --pid-file
184 --port
185 --port
185 --prefix
186 --prefix
186 --profile
187 --profile
187 --quiet
188 --quiet
188 --repository
189 --repository
189 --stdio
190 --stdio
190 --style
191 --style
191 --subrepos
192 --subrepos
192 --templates
193 --templates
193 --time
194 --time
194 --traceback
195 --traceback
195 --verbose
196 --verbose
196 --version
197 --version
197 --web-conf
198 --web-conf
198 -6
199 -6
199 -A
200 -A
200 -E
201 -E
201 -R
202 -R
202 -S
203 -S
203 -a
204 -a
204 -d
205 -d
205 -h
206 -h
206 -n
207 -n
207 -p
208 -p
208 -q
209 -q
209 -t
210 -t
210 -v
211 -v
211 -y
212 -y
212
213
213 Show an error if we use --options with an ambiguous abbreviation
214 Show an error if we use --options with an ambiguous abbreviation
214 $ hg debugcomplete --options s
215 $ hg debugcomplete --options s
215 hg: command 's' is ambiguous:
216 hg: command 's' is ambiguous:
216 serve showconfig status summary
217 serve showconfig status summary
217 [255]
218 [255]
218
219
219 Show all commands + options
220 Show all commands + options
220 $ hg debugcommands
221 $ hg debugcommands
221 add: include, exclude, subrepos, dry-run
222 add: include, exclude, subrepos, dry-run
222 annotate: rev, follow, no-follow, text, user, file, date, number, changeset, line-number, skip, ignore-all-space, ignore-space-change, ignore-blank-lines, ignore-space-at-eol, include, exclude, template
223 annotate: rev, follow, no-follow, text, user, file, date, number, changeset, line-number, skip, ignore-all-space, ignore-space-change, ignore-blank-lines, ignore-space-at-eol, include, exclude, template
223 clone: noupdate, updaterev, rev, branch, pull, uncompressed, stream, ssh, remotecmd, insecure
224 clone: noupdate, updaterev, rev, branch, pull, uncompressed, stream, ssh, remotecmd, insecure
224 commit: addremove, close-branch, amend, secret, edit, interactive, include, exclude, message, logfile, date, user, subrepos
225 commit: addremove, close-branch, amend, secret, edit, interactive, include, exclude, message, logfile, date, user, subrepos
225 diff: rev, change, text, git, binary, nodates, noprefix, show-function, reverse, ignore-all-space, ignore-space-change, ignore-blank-lines, ignore-space-at-eol, unified, stat, root, include, exclude, subrepos
226 diff: rev, change, text, git, binary, nodates, noprefix, show-function, reverse, ignore-all-space, ignore-space-change, ignore-blank-lines, ignore-space-at-eol, unified, stat, root, include, exclude, subrepos
226 export: output, switch-parent, rev, text, git, binary, nodates
227 export: output, switch-parent, rev, text, git, binary, nodates
227 forget: include, exclude
228 forget: include, exclude
228 init: ssh, remotecmd, insecure
229 init: ssh, remotecmd, insecure
229 log: follow, follow-first, date, copies, keyword, rev, line-range, removed, only-merges, user, only-branch, branch, prune, patch, git, limit, no-merges, stat, graph, style, template, include, exclude
230 log: follow, follow-first, date, copies, keyword, rev, line-range, removed, only-merges, user, only-branch, branch, prune, patch, git, limit, no-merges, stat, graph, style, template, include, exclude
230 merge: force, rev, preview, tool
231 merge: force, rev, preview, tool
231 pull: update, force, rev, bookmark, branch, ssh, remotecmd, insecure
232 pull: update, force, rev, bookmark, branch, ssh, remotecmd, insecure
232 push: force, rev, bookmark, branch, new-branch, pushvars, ssh, remotecmd, insecure
233 push: force, rev, bookmark, branch, new-branch, pushvars, ssh, remotecmd, insecure
233 remove: after, force, subrepos, include, exclude
234 remove: after, force, subrepos, include, exclude
234 serve: accesslog, daemon, daemon-postexec, errorlog, port, address, prefix, name, web-conf, webdir-conf, pid-file, stdio, cmdserver, templates, style, ipv6, certificate, subrepos
235 serve: accesslog, daemon, daemon-postexec, errorlog, port, address, prefix, name, web-conf, webdir-conf, pid-file, stdio, cmdserver, templates, style, ipv6, certificate, subrepos
235 status: all, modified, added, removed, deleted, clean, unknown, ignored, no-status, terse, copies, print0, rev, change, include, exclude, subrepos, template
236 status: all, modified, added, removed, deleted, clean, unknown, ignored, no-status, terse, copies, print0, rev, change, include, exclude, subrepos, template
236 summary: remote
237 summary: remote
237 update: clean, check, merge, date, rev, tool
238 update: clean, check, merge, date, rev, tool
238 addremove: similarity, subrepos, include, exclude, dry-run
239 addremove: similarity, subrepos, include, exclude, dry-run
239 archive: no-decode, prefix, rev, type, subrepos, include, exclude
240 archive: no-decode, prefix, rev, type, subrepos, include, exclude
240 backout: merge, commit, no-commit, parent, rev, edit, tool, include, exclude, message, logfile, date, user
241 backout: merge, commit, no-commit, parent, rev, edit, tool, include, exclude, message, logfile, date, user
241 bisect: reset, good, bad, skip, extend, command, noupdate
242 bisect: reset, good, bad, skip, extend, command, noupdate
242 bookmarks: force, rev, delete, rename, inactive, template
243 bookmarks: force, rev, delete, rename, inactive, template
243 branch: force, clean
244 branch: force, clean
244 branches: active, closed, template
245 branches: active, closed, template
245 bundle: force, rev, branch, base, all, type, ssh, remotecmd, insecure
246 bundle: force, rev, branch, base, all, type, ssh, remotecmd, insecure
246 cat: output, rev, decode, include, exclude, template
247 cat: output, rev, decode, include, exclude, template
247 config: untrusted, edit, local, global, template
248 config: untrusted, edit, local, global, template
248 copy: after, force, include, exclude, dry-run
249 copy: after, force, include, exclude, dry-run
249 debugancestor:
250 debugancestor:
250 debugapplystreamclonebundle:
251 debugapplystreamclonebundle:
251 debugbuilddag: mergeable-file, overwritten-file, new-file
252 debugbuilddag: mergeable-file, overwritten-file, new-file
252 debugbundle: all, part-type, spec
253 debugbundle: all, part-type, spec
253 debugcapabilities:
254 debugcapabilities:
254 debugcheckstate:
255 debugcheckstate:
255 debugcolor: style
256 debugcolor: style
256 debugcommands:
257 debugcommands:
257 debugcomplete: options
258 debugcomplete: options
258 debugcreatestreamclonebundle:
259 debugcreatestreamclonebundle:
259 debugdag: tags, branches, dots, spaces
260 debugdag: tags, branches, dots, spaces
260 debugdata: changelog, manifest, dir
261 debugdata: changelog, manifest, dir
261 debugdate: extended
262 debugdate: extended
262 debugdeltachain: changelog, manifest, dir, template
263 debugdeltachain: changelog, manifest, dir, template
263 debugdirstate: nodates, datesort
264 debugdirstate: nodates, datesort
264 debugdiscovery: old, nonheads, rev, ssh, remotecmd, insecure
265 debugdiscovery: old, nonheads, rev, ssh, remotecmd, insecure
265 debugextensions: template
266 debugextensions: template
266 debugfileset: rev
267 debugfileset: rev
268 debugformat: template
267 debugfsinfo:
269 debugfsinfo:
268 debuggetbundle: head, common, type
270 debuggetbundle: head, common, type
269 debugignore:
271 debugignore:
270 debugindex: changelog, manifest, dir, format
272 debugindex: changelog, manifest, dir, format
271 debugindexdot: changelog, manifest, dir
273 debugindexdot: changelog, manifest, dir
272 debuginstall: template
274 debuginstall: template
273 debugknown:
275 debugknown:
274 debuglabelcomplete:
276 debuglabelcomplete:
275 debuglocks: force-lock, force-wlock
277 debuglocks: force-lock, force-wlock
276 debugmergestate:
278 debugmergestate:
277 debugnamecomplete:
279 debugnamecomplete:
278 debugobsolete: flags, record-parents, rev, exclusive, index, delete, date, user, template
280 debugobsolete: flags, record-parents, rev, exclusive, index, delete, date, user, template
279 debugpathcomplete: full, normal, added, removed
281 debugpathcomplete: full, normal, added, removed
280 debugpickmergetool: rev, changedelete, include, exclude, tool
282 debugpickmergetool: rev, changedelete, include, exclude, tool
281 debugpushkey:
283 debugpushkey:
282 debugpvec:
284 debugpvec:
283 debugrebuilddirstate: rev, minimal
285 debugrebuilddirstate: rev, minimal
284 debugrebuildfncache:
286 debugrebuildfncache:
285 debugrename: rev
287 debugrename: rev
286 debugrevlog: changelog, manifest, dir, dump
288 debugrevlog: changelog, manifest, dir, dump
287 debugrevspec: optimize, show-revs, show-set, show-stage, no-optimized, verify-optimized
289 debugrevspec: optimize, show-revs, show-set, show-stage, no-optimized, verify-optimized
288 debugsetparents:
290 debugsetparents:
289 debugssl:
291 debugssl:
290 debugsub: rev
292 debugsub: rev
291 debugsuccessorssets: closest
293 debugsuccessorssets: closest
292 debugtemplate: rev, define
294 debugtemplate: rev, define
293 debugupdatecaches:
295 debugupdatecaches:
294 debugupgraderepo: optimize, run
296 debugupgraderepo: optimize, run
295 debugwalk: include, exclude
297 debugwalk: include, exclude
296 debugwireargs: three, four, five, ssh, remotecmd, insecure
298 debugwireargs: three, four, five, ssh, remotecmd, insecure
297 files: rev, print0, include, exclude, template, subrepos
299 files: rev, print0, include, exclude, template, subrepos
298 graft: rev, continue, edit, log, force, currentdate, currentuser, date, user, tool, dry-run
300 graft: rev, continue, edit, log, force, currentdate, currentuser, date, user, tool, dry-run
299 grep: print0, all, text, follow, ignore-case, files-with-matches, line-number, rev, user, date, template, include, exclude
301 grep: print0, all, text, follow, ignore-case, files-with-matches, line-number, rev, user, date, template, include, exclude
300 heads: rev, topo, active, closed, style, template
302 heads: rev, topo, active, closed, style, template
301 help: extension, command, keyword, system
303 help: extension, command, keyword, system
302 identify: rev, num, id, branch, tags, bookmarks, ssh, remotecmd, insecure, template
304 identify: rev, num, id, branch, tags, bookmarks, ssh, remotecmd, insecure, template
303 import: strip, base, edit, force, no-commit, bypass, partial, exact, prefix, import-branch, message, logfile, date, user, similarity
305 import: strip, base, edit, force, no-commit, bypass, partial, exact, prefix, import-branch, message, logfile, date, user, similarity
304 incoming: force, newest-first, bundle, rev, bookmarks, branch, patch, git, limit, no-merges, stat, graph, style, template, ssh, remotecmd, insecure, subrepos
306 incoming: force, newest-first, bundle, rev, bookmarks, branch, patch, git, limit, no-merges, stat, graph, style, template, ssh, remotecmd, insecure, subrepos
305 locate: rev, print0, fullpath, include, exclude
307 locate: rev, print0, fullpath, include, exclude
306 manifest: rev, all, template
308 manifest: rev, all, template
307 outgoing: force, rev, newest-first, bookmarks, branch, patch, git, limit, no-merges, stat, graph, style, template, ssh, remotecmd, insecure, subrepos
309 outgoing: force, rev, newest-first, bookmarks, branch, patch, git, limit, no-merges, stat, graph, style, template, ssh, remotecmd, insecure, subrepos
308 parents: rev, style, template
310 parents: rev, style, template
309 paths: template
311 paths: template
310 phase: public, draft, secret, force, rev
312 phase: public, draft, secret, force, rev
311 recover:
313 recover:
312 rename: after, force, include, exclude, dry-run
314 rename: after, force, include, exclude, dry-run
313 resolve: all, list, mark, unmark, no-status, tool, include, exclude, template
315 resolve: all, list, mark, unmark, no-status, tool, include, exclude, template
314 revert: all, date, rev, no-backup, interactive, include, exclude, dry-run
316 revert: all, date, rev, no-backup, interactive, include, exclude, dry-run
315 rollback: dry-run, force
317 rollback: dry-run, force
316 root:
318 root:
317 tag: force, local, rev, remove, edit, message, date, user
319 tag: force, local, rev, remove, edit, message, date, user
318 tags: template
320 tags: template
319 tip: patch, git, style, template
321 tip: patch, git, style, template
320 unbundle: update
322 unbundle: update
321 verify:
323 verify:
322 version: template
324 version: template
323
325
324 $ hg init a
326 $ hg init a
325 $ cd a
327 $ cd a
326 $ echo fee > fee
328 $ echo fee > fee
327 $ hg ci -q -Amfee
329 $ hg ci -q -Amfee
328 $ hg tag fee
330 $ hg tag fee
329 $ mkdir fie
331 $ mkdir fie
330 $ echo dead > fie/dead
332 $ echo dead > fie/dead
331 $ echo live > fie/live
333 $ echo live > fie/live
332 $ hg bookmark fo
334 $ hg bookmark fo
333 $ hg branch -q fie
335 $ hg branch -q fie
334 $ hg ci -q -Amfie
336 $ hg ci -q -Amfie
335 $ echo fo > fo
337 $ echo fo > fo
336 $ hg branch -qf default
338 $ hg branch -qf default
337 $ hg ci -q -Amfo
339 $ hg ci -q -Amfo
338 $ echo Fum > Fum
340 $ echo Fum > Fum
339 $ hg ci -q -AmFum
341 $ hg ci -q -AmFum
340 $ hg bookmark Fum
342 $ hg bookmark Fum
341
343
342 Test debugpathcomplete
344 Test debugpathcomplete
343
345
344 $ hg debugpathcomplete f
346 $ hg debugpathcomplete f
345 fee
347 fee
346 fie
348 fie
347 fo
349 fo
348 $ hg debugpathcomplete -f f
350 $ hg debugpathcomplete -f f
349 fee
351 fee
350 fie/dead
352 fie/dead
351 fie/live
353 fie/live
352 fo
354 fo
353
355
354 $ hg rm Fum
356 $ hg rm Fum
355 $ hg debugpathcomplete -r F
357 $ hg debugpathcomplete -r F
356 Fum
358 Fum
357
359
358 Test debugnamecomplete
360 Test debugnamecomplete
359
361
360 $ hg debugnamecomplete
362 $ hg debugnamecomplete
361 Fum
363 Fum
362 default
364 default
363 fee
365 fee
364 fie
366 fie
365 fo
367 fo
366 tip
368 tip
367 $ hg debugnamecomplete f
369 $ hg debugnamecomplete f
368 fee
370 fee
369 fie
371 fie
370 fo
372 fo
371
373
372 Test debuglabelcomplete, a deprecated name for debugnamecomplete that is still
374 Test debuglabelcomplete, a deprecated name for debugnamecomplete that is still
373 used for completions in some shells.
375 used for completions in some shells.
374
376
375 $ hg debuglabelcomplete
377 $ hg debuglabelcomplete
376 Fum
378 Fum
377 default
379 default
378 fee
380 fee
379 fie
381 fie
380 fo
382 fo
381 tip
383 tip
382 $ hg debuglabelcomplete f
384 $ hg debuglabelcomplete f
383 fee
385 fee
384 fie
386 fie
385 fo
387 fo
@@ -1,3388 +1,3389 b''
1 Short help:
1 Short help:
2
2
3 $ hg
3 $ hg
4 Mercurial Distributed SCM
4 Mercurial Distributed SCM
5
5
6 basic commands:
6 basic commands:
7
7
8 add add the specified files on the next commit
8 add add the specified files on the next commit
9 annotate show changeset information by line for each file
9 annotate show changeset information by line for each file
10 clone make a copy of an existing repository
10 clone make a copy of an existing repository
11 commit commit the specified files or all outstanding changes
11 commit commit the specified files or all outstanding changes
12 diff diff repository (or selected files)
12 diff diff repository (or selected files)
13 export dump the header and diffs for one or more changesets
13 export dump the header and diffs for one or more changesets
14 forget forget the specified files on the next commit
14 forget forget the specified files on the next commit
15 init create a new repository in the given directory
15 init create a new repository in the given directory
16 log show revision history of entire repository or files
16 log show revision history of entire repository or files
17 merge merge another revision into working directory
17 merge merge another revision into working directory
18 pull pull changes from the specified source
18 pull pull changes from the specified source
19 push push changes to the specified destination
19 push push changes to the specified destination
20 remove remove the specified files on the next commit
20 remove remove the specified files on the next commit
21 serve start stand-alone webserver
21 serve start stand-alone webserver
22 status show changed files in the working directory
22 status show changed files in the working directory
23 summary summarize working directory state
23 summary summarize working directory state
24 update update working directory (or switch revisions)
24 update update working directory (or switch revisions)
25
25
26 (use 'hg help' for the full list of commands or 'hg -v' for details)
26 (use 'hg help' for the full list of commands or 'hg -v' for details)
27
27
28 $ hg -q
28 $ hg -q
29 add add the specified files on the next commit
29 add add the specified files on the next commit
30 annotate show changeset information by line for each file
30 annotate show changeset information by line for each file
31 clone make a copy of an existing repository
31 clone make a copy of an existing repository
32 commit commit the specified files or all outstanding changes
32 commit commit the specified files or all outstanding changes
33 diff diff repository (or selected files)
33 diff diff repository (or selected files)
34 export dump the header and diffs for one or more changesets
34 export dump the header and diffs for one or more changesets
35 forget forget the specified files on the next commit
35 forget forget the specified files on the next commit
36 init create a new repository in the given directory
36 init create a new repository in the given directory
37 log show revision history of entire repository or files
37 log show revision history of entire repository or files
38 merge merge another revision into working directory
38 merge merge another revision into working directory
39 pull pull changes from the specified source
39 pull pull changes from the specified source
40 push push changes to the specified destination
40 push push changes to the specified destination
41 remove remove the specified files on the next commit
41 remove remove the specified files on the next commit
42 serve start stand-alone webserver
42 serve start stand-alone webserver
43 status show changed files in the working directory
43 status show changed files in the working directory
44 summary summarize working directory state
44 summary summarize working directory state
45 update update working directory (or switch revisions)
45 update update working directory (or switch revisions)
46
46
47 $ hg help
47 $ hg help
48 Mercurial Distributed SCM
48 Mercurial Distributed SCM
49
49
50 list of commands:
50 list of commands:
51
51
52 add add the specified files on the next commit
52 add add the specified files on the next commit
53 addremove add all new files, delete all missing files
53 addremove add all new files, delete all missing files
54 annotate show changeset information by line for each file
54 annotate show changeset information by line for each file
55 archive create an unversioned archive of a repository revision
55 archive create an unversioned archive of a repository revision
56 backout reverse effect of earlier changeset
56 backout reverse effect of earlier changeset
57 bisect subdivision search of changesets
57 bisect subdivision search of changesets
58 bookmarks create a new bookmark or list existing bookmarks
58 bookmarks create a new bookmark or list existing bookmarks
59 branch set or show the current branch name
59 branch set or show the current branch name
60 branches list repository named branches
60 branches list repository named branches
61 bundle create a bundle file
61 bundle create a bundle file
62 cat output the current or given revision of files
62 cat output the current or given revision of files
63 clone make a copy of an existing repository
63 clone make a copy of an existing repository
64 commit commit the specified files or all outstanding changes
64 commit commit the specified files or all outstanding changes
65 config show combined config settings from all hgrc files
65 config show combined config settings from all hgrc files
66 copy mark files as copied for the next commit
66 copy mark files as copied for the next commit
67 diff diff repository (or selected files)
67 diff diff repository (or selected files)
68 export dump the header and diffs for one or more changesets
68 export dump the header and diffs for one or more changesets
69 files list tracked files
69 files list tracked files
70 forget forget the specified files on the next commit
70 forget forget the specified files on the next commit
71 graft copy changes from other branches onto the current branch
71 graft copy changes from other branches onto the current branch
72 grep search revision history for a pattern in specified files
72 grep search revision history for a pattern in specified files
73 heads show branch heads
73 heads show branch heads
74 help show help for a given topic or a help overview
74 help show help for a given topic or a help overview
75 identify identify the working directory or specified revision
75 identify identify the working directory or specified revision
76 import import an ordered set of patches
76 import import an ordered set of patches
77 incoming show new changesets found in source
77 incoming show new changesets found in source
78 init create a new repository in the given directory
78 init create a new repository in the given directory
79 log show revision history of entire repository or files
79 log show revision history of entire repository or files
80 manifest output the current or given revision of the project manifest
80 manifest output the current or given revision of the project manifest
81 merge merge another revision into working directory
81 merge merge another revision into working directory
82 outgoing show changesets not found in the destination
82 outgoing show changesets not found in the destination
83 paths show aliases for remote repositories
83 paths show aliases for remote repositories
84 phase set or show the current phase name
84 phase set or show the current phase name
85 pull pull changes from the specified source
85 pull pull changes from the specified source
86 push push changes to the specified destination
86 push push changes to the specified destination
87 recover roll back an interrupted transaction
87 recover roll back an interrupted transaction
88 remove remove the specified files on the next commit
88 remove remove the specified files on the next commit
89 rename rename files; equivalent of copy + remove
89 rename rename files; equivalent of copy + remove
90 resolve redo merges or set/view the merge status of files
90 resolve redo merges or set/view the merge status of files
91 revert restore files to their checkout state
91 revert restore files to their checkout state
92 root print the root (top) of the current working directory
92 root print the root (top) of the current working directory
93 serve start stand-alone webserver
93 serve start stand-alone webserver
94 status show changed files in the working directory
94 status show changed files in the working directory
95 summary summarize working directory state
95 summary summarize working directory state
96 tag add one or more tags for the current or given revision
96 tag add one or more tags for the current or given revision
97 tags list repository tags
97 tags list repository tags
98 unbundle apply one or more bundle files
98 unbundle apply one or more bundle files
99 update update working directory (or switch revisions)
99 update update working directory (or switch revisions)
100 verify verify the integrity of the repository
100 verify verify the integrity of the repository
101 version output version and copyright information
101 version output version and copyright information
102
102
103 additional help topics:
103 additional help topics:
104
104
105 bundlespec Bundle File Formats
105 bundlespec Bundle File Formats
106 color Colorizing Outputs
106 color Colorizing Outputs
107 config Configuration Files
107 config Configuration Files
108 dates Date Formats
108 dates Date Formats
109 diffs Diff Formats
109 diffs Diff Formats
110 environment Environment Variables
110 environment Environment Variables
111 extensions Using Additional Features
111 extensions Using Additional Features
112 filesets Specifying File Sets
112 filesets Specifying File Sets
113 flags Command-line flags
113 flags Command-line flags
114 glossary Glossary
114 glossary Glossary
115 hgignore Syntax for Mercurial Ignore Files
115 hgignore Syntax for Mercurial Ignore Files
116 hgweb Configuring hgweb
116 hgweb Configuring hgweb
117 internals Technical implementation topics
117 internals Technical implementation topics
118 merge-tools Merge Tools
118 merge-tools Merge Tools
119 pager Pager Support
119 pager Pager Support
120 patterns File Name Patterns
120 patterns File Name Patterns
121 phases Working with Phases
121 phases Working with Phases
122 revisions Specifying Revisions
122 revisions Specifying Revisions
123 scripting Using Mercurial from scripts and automation
123 scripting Using Mercurial from scripts and automation
124 subrepos Subrepositories
124 subrepos Subrepositories
125 templating Template Usage
125 templating Template Usage
126 urls URL Paths
126 urls URL Paths
127
127
128 (use 'hg help -v' to show built-in aliases and global options)
128 (use 'hg help -v' to show built-in aliases and global options)
129
129
130 $ hg -q help
130 $ hg -q help
131 add add the specified files on the next commit
131 add add the specified files on the next commit
132 addremove add all new files, delete all missing files
132 addremove add all new files, delete all missing files
133 annotate show changeset information by line for each file
133 annotate show changeset information by line for each file
134 archive create an unversioned archive of a repository revision
134 archive create an unversioned archive of a repository revision
135 backout reverse effect of earlier changeset
135 backout reverse effect of earlier changeset
136 bisect subdivision search of changesets
136 bisect subdivision search of changesets
137 bookmarks create a new bookmark or list existing bookmarks
137 bookmarks create a new bookmark or list existing bookmarks
138 branch set or show the current branch name
138 branch set or show the current branch name
139 branches list repository named branches
139 branches list repository named branches
140 bundle create a bundle file
140 bundle create a bundle file
141 cat output the current or given revision of files
141 cat output the current or given revision of files
142 clone make a copy of an existing repository
142 clone make a copy of an existing repository
143 commit commit the specified files or all outstanding changes
143 commit commit the specified files or all outstanding changes
144 config show combined config settings from all hgrc files
144 config show combined config settings from all hgrc files
145 copy mark files as copied for the next commit
145 copy mark files as copied for the next commit
146 diff diff repository (or selected files)
146 diff diff repository (or selected files)
147 export dump the header and diffs for one or more changesets
147 export dump the header and diffs for one or more changesets
148 files list tracked files
148 files list tracked files
149 forget forget the specified files on the next commit
149 forget forget the specified files on the next commit
150 graft copy changes from other branches onto the current branch
150 graft copy changes from other branches onto the current branch
151 grep search revision history for a pattern in specified files
151 grep search revision history for a pattern in specified files
152 heads show branch heads
152 heads show branch heads
153 help show help for a given topic or a help overview
153 help show help for a given topic or a help overview
154 identify identify the working directory or specified revision
154 identify identify the working directory or specified revision
155 import import an ordered set of patches
155 import import an ordered set of patches
156 incoming show new changesets found in source
156 incoming show new changesets found in source
157 init create a new repository in the given directory
157 init create a new repository in the given directory
158 log show revision history of entire repository or files
158 log show revision history of entire repository or files
159 manifest output the current or given revision of the project manifest
159 manifest output the current or given revision of the project manifest
160 merge merge another revision into working directory
160 merge merge another revision into working directory
161 outgoing show changesets not found in the destination
161 outgoing show changesets not found in the destination
162 paths show aliases for remote repositories
162 paths show aliases for remote repositories
163 phase set or show the current phase name
163 phase set or show the current phase name
164 pull pull changes from the specified source
164 pull pull changes from the specified source
165 push push changes to the specified destination
165 push push changes to the specified destination
166 recover roll back an interrupted transaction
166 recover roll back an interrupted transaction
167 remove remove the specified files on the next commit
167 remove remove the specified files on the next commit
168 rename rename files; equivalent of copy + remove
168 rename rename files; equivalent of copy + remove
169 resolve redo merges or set/view the merge status of files
169 resolve redo merges or set/view the merge status of files
170 revert restore files to their checkout state
170 revert restore files to their checkout state
171 root print the root (top) of the current working directory
171 root print the root (top) of the current working directory
172 serve start stand-alone webserver
172 serve start stand-alone webserver
173 status show changed files in the working directory
173 status show changed files in the working directory
174 summary summarize working directory state
174 summary summarize working directory state
175 tag add one or more tags for the current or given revision
175 tag add one or more tags for the current or given revision
176 tags list repository tags
176 tags list repository tags
177 unbundle apply one or more bundle files
177 unbundle apply one or more bundle files
178 update update working directory (or switch revisions)
178 update update working directory (or switch revisions)
179 verify verify the integrity of the repository
179 verify verify the integrity of the repository
180 version output version and copyright information
180 version output version and copyright information
181
181
182 additional help topics:
182 additional help topics:
183
183
184 bundlespec Bundle File Formats
184 bundlespec Bundle File Formats
185 color Colorizing Outputs
185 color Colorizing Outputs
186 config Configuration Files
186 config Configuration Files
187 dates Date Formats
187 dates Date Formats
188 diffs Diff Formats
188 diffs Diff Formats
189 environment Environment Variables
189 environment Environment Variables
190 extensions Using Additional Features
190 extensions Using Additional Features
191 filesets Specifying File Sets
191 filesets Specifying File Sets
192 flags Command-line flags
192 flags Command-line flags
193 glossary Glossary
193 glossary Glossary
194 hgignore Syntax for Mercurial Ignore Files
194 hgignore Syntax for Mercurial Ignore Files
195 hgweb Configuring hgweb
195 hgweb Configuring hgweb
196 internals Technical implementation topics
196 internals Technical implementation topics
197 merge-tools Merge Tools
197 merge-tools Merge Tools
198 pager Pager Support
198 pager Pager Support
199 patterns File Name Patterns
199 patterns File Name Patterns
200 phases Working with Phases
200 phases Working with Phases
201 revisions Specifying Revisions
201 revisions Specifying Revisions
202 scripting Using Mercurial from scripts and automation
202 scripting Using Mercurial from scripts and automation
203 subrepos Subrepositories
203 subrepos Subrepositories
204 templating Template Usage
204 templating Template Usage
205 urls URL Paths
205 urls URL Paths
206
206
207 Test extension help:
207 Test extension help:
208 $ hg help extensions --config extensions.rebase= --config extensions.children=
208 $ hg help extensions --config extensions.rebase= --config extensions.children=
209 Using Additional Features
209 Using Additional Features
210 """""""""""""""""""""""""
210 """""""""""""""""""""""""
211
211
212 Mercurial has the ability to add new features through the use of
212 Mercurial has the ability to add new features through the use of
213 extensions. Extensions may add new commands, add options to existing
213 extensions. Extensions may add new commands, add options to existing
214 commands, change the default behavior of commands, or implement hooks.
214 commands, change the default behavior of commands, or implement hooks.
215
215
216 To enable the "foo" extension, either shipped with Mercurial or in the
216 To enable the "foo" extension, either shipped with Mercurial or in the
217 Python search path, create an entry for it in your configuration file,
217 Python search path, create an entry for it in your configuration file,
218 like this:
218 like this:
219
219
220 [extensions]
220 [extensions]
221 foo =
221 foo =
222
222
223 You may also specify the full path to an extension:
223 You may also specify the full path to an extension:
224
224
225 [extensions]
225 [extensions]
226 myfeature = ~/.hgext/myfeature.py
226 myfeature = ~/.hgext/myfeature.py
227
227
228 See 'hg help config' for more information on configuration files.
228 See 'hg help config' for more information on configuration files.
229
229
230 Extensions are not loaded by default for a variety of reasons: they can
230 Extensions are not loaded by default for a variety of reasons: they can
231 increase startup overhead; they may be meant for advanced usage only; they
231 increase startup overhead; they may be meant for advanced usage only; they
232 may provide potentially dangerous abilities (such as letting you destroy
232 may provide potentially dangerous abilities (such as letting you destroy
233 or modify history); they might not be ready for prime time; or they may
233 or modify history); they might not be ready for prime time; or they may
234 alter some usual behaviors of stock Mercurial. It is thus up to the user
234 alter some usual behaviors of stock Mercurial. It is thus up to the user
235 to activate extensions as needed.
235 to activate extensions as needed.
236
236
237 To explicitly disable an extension enabled in a configuration file of
237 To explicitly disable an extension enabled in a configuration file of
238 broader scope, prepend its path with !:
238 broader scope, prepend its path with !:
239
239
240 [extensions]
240 [extensions]
241 # disabling extension bar residing in /path/to/extension/bar.py
241 # disabling extension bar residing in /path/to/extension/bar.py
242 bar = !/path/to/extension/bar.py
242 bar = !/path/to/extension/bar.py
243 # ditto, but no path was supplied for extension baz
243 # ditto, but no path was supplied for extension baz
244 baz = !
244 baz = !
245
245
246 enabled extensions:
246 enabled extensions:
247
247
248 children command to display child changesets (DEPRECATED)
248 children command to display child changesets (DEPRECATED)
249 rebase command to move sets of revisions to a different ancestor
249 rebase command to move sets of revisions to a different ancestor
250
250
251 disabled extensions:
251 disabled extensions:
252
252
253 acl hooks for controlling repository access
253 acl hooks for controlling repository access
254 blackbox log repository events to a blackbox for debugging
254 blackbox log repository events to a blackbox for debugging
255 bugzilla hooks for integrating with the Bugzilla bug tracker
255 bugzilla hooks for integrating with the Bugzilla bug tracker
256 censor erase file content at a given revision
256 censor erase file content at a given revision
257 churn command to display statistics about repository history
257 churn command to display statistics about repository history
258 clonebundles advertise pre-generated bundles to seed clones
258 clonebundles advertise pre-generated bundles to seed clones
259 convert import revisions from foreign VCS repositories into
259 convert import revisions from foreign VCS repositories into
260 Mercurial
260 Mercurial
261 eol automatically manage newlines in repository files
261 eol automatically manage newlines in repository files
262 extdiff command to allow external programs to compare revisions
262 extdiff command to allow external programs to compare revisions
263 factotum http authentication with factotum
263 factotum http authentication with factotum
264 gpg commands to sign and verify changesets
264 gpg commands to sign and verify changesets
265 hgk browse the repository in a graphical way
265 hgk browse the repository in a graphical way
266 highlight syntax highlighting for hgweb (requires Pygments)
266 highlight syntax highlighting for hgweb (requires Pygments)
267 histedit interactive history editing
267 histedit interactive history editing
268 keyword expand keywords in tracked files
268 keyword expand keywords in tracked files
269 largefiles track large binary files
269 largefiles track large binary files
270 mq manage a stack of patches
270 mq manage a stack of patches
271 notify hooks for sending email push notifications
271 notify hooks for sending email push notifications
272 patchbomb command to send changesets as (a series of) patch emails
272 patchbomb command to send changesets as (a series of) patch emails
273 purge command to delete untracked files from the working
273 purge command to delete untracked files from the working
274 directory
274 directory
275 relink recreates hardlinks between repository clones
275 relink recreates hardlinks between repository clones
276 schemes extend schemes with shortcuts to repository swarms
276 schemes extend schemes with shortcuts to repository swarms
277 share share a common history between several working directories
277 share share a common history between several working directories
278 shelve save and restore changes to the working directory
278 shelve save and restore changes to the working directory
279 strip strip changesets and their descendants from history
279 strip strip changesets and their descendants from history
280 transplant command to transplant changesets from another branch
280 transplant command to transplant changesets from another branch
281 win32mbcs allow the use of MBCS paths with problematic encodings
281 win32mbcs allow the use of MBCS paths with problematic encodings
282 zeroconf discover and advertise repositories on the local network
282 zeroconf discover and advertise repositories on the local network
283
283
284 Verify that extension keywords appear in help templates
284 Verify that extension keywords appear in help templates
285
285
286 $ hg help --config extensions.transplant= templating|grep transplant > /dev/null
286 $ hg help --config extensions.transplant= templating|grep transplant > /dev/null
287
287
288 Test short command list with verbose option
288 Test short command list with verbose option
289
289
290 $ hg -v help shortlist
290 $ hg -v help shortlist
291 Mercurial Distributed SCM
291 Mercurial Distributed SCM
292
292
293 basic commands:
293 basic commands:
294
294
295 add add the specified files on the next commit
295 add add the specified files on the next commit
296 annotate, blame
296 annotate, blame
297 show changeset information by line for each file
297 show changeset information by line for each file
298 clone make a copy of an existing repository
298 clone make a copy of an existing repository
299 commit, ci commit the specified files or all outstanding changes
299 commit, ci commit the specified files or all outstanding changes
300 diff diff repository (or selected files)
300 diff diff repository (or selected files)
301 export dump the header and diffs for one or more changesets
301 export dump the header and diffs for one or more changesets
302 forget forget the specified files on the next commit
302 forget forget the specified files on the next commit
303 init create a new repository in the given directory
303 init create a new repository in the given directory
304 log, history show revision history of entire repository or files
304 log, history show revision history of entire repository or files
305 merge merge another revision into working directory
305 merge merge another revision into working directory
306 pull pull changes from the specified source
306 pull pull changes from the specified source
307 push push changes to the specified destination
307 push push changes to the specified destination
308 remove, rm remove the specified files on the next commit
308 remove, rm remove the specified files on the next commit
309 serve start stand-alone webserver
309 serve start stand-alone webserver
310 status, st show changed files in the working directory
310 status, st show changed files in the working directory
311 summary, sum summarize working directory state
311 summary, sum summarize working directory state
312 update, up, checkout, co
312 update, up, checkout, co
313 update working directory (or switch revisions)
313 update working directory (or switch revisions)
314
314
315 global options ([+] can be repeated):
315 global options ([+] can be repeated):
316
316
317 -R --repository REPO repository root directory or name of overlay bundle
317 -R --repository REPO repository root directory or name of overlay bundle
318 file
318 file
319 --cwd DIR change working directory
319 --cwd DIR change working directory
320 -y --noninteractive do not prompt, automatically pick the first choice for
320 -y --noninteractive do not prompt, automatically pick the first choice for
321 all prompts
321 all prompts
322 -q --quiet suppress output
322 -q --quiet suppress output
323 -v --verbose enable additional output
323 -v --verbose enable additional output
324 --color TYPE when to colorize (boolean, always, auto, never, or
324 --color TYPE when to colorize (boolean, always, auto, never, or
325 debug)
325 debug)
326 --config CONFIG [+] set/override config option (use 'section.name=value')
326 --config CONFIG [+] set/override config option (use 'section.name=value')
327 --debug enable debugging output
327 --debug enable debugging output
328 --debugger start debugger
328 --debugger start debugger
329 --encoding ENCODE set the charset encoding (default: ascii)
329 --encoding ENCODE set the charset encoding (default: ascii)
330 --encodingmode MODE set the charset encoding mode (default: strict)
330 --encodingmode MODE set the charset encoding mode (default: strict)
331 --traceback always print a traceback on exception
331 --traceback always print a traceback on exception
332 --time time how long the command takes
332 --time time how long the command takes
333 --profile print command execution profile
333 --profile print command execution profile
334 --version output version information and exit
334 --version output version information and exit
335 -h --help display help and exit
335 -h --help display help and exit
336 --hidden consider hidden changesets
336 --hidden consider hidden changesets
337 --pager TYPE when to paginate (boolean, always, auto, or never)
337 --pager TYPE when to paginate (boolean, always, auto, or never)
338 (default: auto)
338 (default: auto)
339
339
340 (use 'hg help' for the full list of commands)
340 (use 'hg help' for the full list of commands)
341
341
342 $ hg add -h
342 $ hg add -h
343 hg add [OPTION]... [FILE]...
343 hg add [OPTION]... [FILE]...
344
344
345 add the specified files on the next commit
345 add the specified files on the next commit
346
346
347 Schedule files to be version controlled and added to the repository.
347 Schedule files to be version controlled and added to the repository.
348
348
349 The files will be added to the repository at the next commit. To undo an
349 The files will be added to the repository at the next commit. To undo an
350 add before that, see 'hg forget'.
350 add before that, see 'hg forget'.
351
351
352 If no names are given, add all files to the repository (except files
352 If no names are given, add all files to the repository (except files
353 matching ".hgignore").
353 matching ".hgignore").
354
354
355 Returns 0 if all files are successfully added.
355 Returns 0 if all files are successfully added.
356
356
357 options ([+] can be repeated):
357 options ([+] can be repeated):
358
358
359 -I --include PATTERN [+] include names matching the given patterns
359 -I --include PATTERN [+] include names matching the given patterns
360 -X --exclude PATTERN [+] exclude names matching the given patterns
360 -X --exclude PATTERN [+] exclude names matching the given patterns
361 -S --subrepos recurse into subrepositories
361 -S --subrepos recurse into subrepositories
362 -n --dry-run do not perform actions, just print output
362 -n --dry-run do not perform actions, just print output
363
363
364 (some details hidden, use --verbose to show complete help)
364 (some details hidden, use --verbose to show complete help)
365
365
366 Verbose help for add
366 Verbose help for add
367
367
368 $ hg add -hv
368 $ hg add -hv
369 hg add [OPTION]... [FILE]...
369 hg add [OPTION]... [FILE]...
370
370
371 add the specified files on the next commit
371 add the specified files on the next commit
372
372
373 Schedule files to be version controlled and added to the repository.
373 Schedule files to be version controlled and added to the repository.
374
374
375 The files will be added to the repository at the next commit. To undo an
375 The files will be added to the repository at the next commit. To undo an
376 add before that, see 'hg forget'.
376 add before that, see 'hg forget'.
377
377
378 If no names are given, add all files to the repository (except files
378 If no names are given, add all files to the repository (except files
379 matching ".hgignore").
379 matching ".hgignore").
380
380
381 Examples:
381 Examples:
382
382
383 - New (unknown) files are added automatically by 'hg add':
383 - New (unknown) files are added automatically by 'hg add':
384
384
385 $ ls
385 $ ls
386 foo.c
386 foo.c
387 $ hg status
387 $ hg status
388 ? foo.c
388 ? foo.c
389 $ hg add
389 $ hg add
390 adding foo.c
390 adding foo.c
391 $ hg status
391 $ hg status
392 A foo.c
392 A foo.c
393
393
394 - Specific files to be added can be specified:
394 - Specific files to be added can be specified:
395
395
396 $ ls
396 $ ls
397 bar.c foo.c
397 bar.c foo.c
398 $ hg status
398 $ hg status
399 ? bar.c
399 ? bar.c
400 ? foo.c
400 ? foo.c
401 $ hg add bar.c
401 $ hg add bar.c
402 $ hg status
402 $ hg status
403 A bar.c
403 A bar.c
404 ? foo.c
404 ? foo.c
405
405
406 Returns 0 if all files are successfully added.
406 Returns 0 if all files are successfully added.
407
407
408 options ([+] can be repeated):
408 options ([+] can be repeated):
409
409
410 -I --include PATTERN [+] include names matching the given patterns
410 -I --include PATTERN [+] include names matching the given patterns
411 -X --exclude PATTERN [+] exclude names matching the given patterns
411 -X --exclude PATTERN [+] exclude names matching the given patterns
412 -S --subrepos recurse into subrepositories
412 -S --subrepos recurse into subrepositories
413 -n --dry-run do not perform actions, just print output
413 -n --dry-run do not perform actions, just print output
414
414
415 global options ([+] can be repeated):
415 global options ([+] can be repeated):
416
416
417 -R --repository REPO repository root directory or name of overlay bundle
417 -R --repository REPO repository root directory or name of overlay bundle
418 file
418 file
419 --cwd DIR change working directory
419 --cwd DIR change working directory
420 -y --noninteractive do not prompt, automatically pick the first choice for
420 -y --noninteractive do not prompt, automatically pick the first choice for
421 all prompts
421 all prompts
422 -q --quiet suppress output
422 -q --quiet suppress output
423 -v --verbose enable additional output
423 -v --verbose enable additional output
424 --color TYPE when to colorize (boolean, always, auto, never, or
424 --color TYPE when to colorize (boolean, always, auto, never, or
425 debug)
425 debug)
426 --config CONFIG [+] set/override config option (use 'section.name=value')
426 --config CONFIG [+] set/override config option (use 'section.name=value')
427 --debug enable debugging output
427 --debug enable debugging output
428 --debugger start debugger
428 --debugger start debugger
429 --encoding ENCODE set the charset encoding (default: ascii)
429 --encoding ENCODE set the charset encoding (default: ascii)
430 --encodingmode MODE set the charset encoding mode (default: strict)
430 --encodingmode MODE set the charset encoding mode (default: strict)
431 --traceback always print a traceback on exception
431 --traceback always print a traceback on exception
432 --time time how long the command takes
432 --time time how long the command takes
433 --profile print command execution profile
433 --profile print command execution profile
434 --version output version information and exit
434 --version output version information and exit
435 -h --help display help and exit
435 -h --help display help and exit
436 --hidden consider hidden changesets
436 --hidden consider hidden changesets
437 --pager TYPE when to paginate (boolean, always, auto, or never)
437 --pager TYPE when to paginate (boolean, always, auto, or never)
438 (default: auto)
438 (default: auto)
439
439
440 Test the textwidth config option
440 Test the textwidth config option
441
441
442 $ hg root -h --config ui.textwidth=50
442 $ hg root -h --config ui.textwidth=50
443 hg root
443 hg root
444
444
445 print the root (top) of the current working
445 print the root (top) of the current working
446 directory
446 directory
447
447
448 Print the root directory of the current
448 Print the root directory of the current
449 repository.
449 repository.
450
450
451 Returns 0 on success.
451 Returns 0 on success.
452
452
453 (some details hidden, use --verbose to show
453 (some details hidden, use --verbose to show
454 complete help)
454 complete help)
455
455
456 Test help option with version option
456 Test help option with version option
457
457
458 $ hg add -h --version
458 $ hg add -h --version
459 Mercurial Distributed SCM (version *) (glob)
459 Mercurial Distributed SCM (version *) (glob)
460 (see https://mercurial-scm.org for more information)
460 (see https://mercurial-scm.org for more information)
461
461
462 Copyright (C) 2005-* Matt Mackall and others (glob)
462 Copyright (C) 2005-* Matt Mackall and others (glob)
463 This is free software; see the source for copying conditions. There is NO
463 This is free software; see the source for copying conditions. There is NO
464 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
464 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
465
465
466 $ hg add --skjdfks
466 $ hg add --skjdfks
467 hg add: option --skjdfks not recognized
467 hg add: option --skjdfks not recognized
468 hg add [OPTION]... [FILE]...
468 hg add [OPTION]... [FILE]...
469
469
470 add the specified files on the next commit
470 add the specified files on the next commit
471
471
472 options ([+] can be repeated):
472 options ([+] can be repeated):
473
473
474 -I --include PATTERN [+] include names matching the given patterns
474 -I --include PATTERN [+] include names matching the given patterns
475 -X --exclude PATTERN [+] exclude names matching the given patterns
475 -X --exclude PATTERN [+] exclude names matching the given patterns
476 -S --subrepos recurse into subrepositories
476 -S --subrepos recurse into subrepositories
477 -n --dry-run do not perform actions, just print output
477 -n --dry-run do not perform actions, just print output
478
478
479 (use 'hg add -h' to show more help)
479 (use 'hg add -h' to show more help)
480 [255]
480 [255]
481
481
482 Test ambiguous command help
482 Test ambiguous command help
483
483
484 $ hg help ad
484 $ hg help ad
485 list of commands:
485 list of commands:
486
486
487 add add the specified files on the next commit
487 add add the specified files on the next commit
488 addremove add all new files, delete all missing files
488 addremove add all new files, delete all missing files
489
489
490 (use 'hg help -v ad' to show built-in aliases and global options)
490 (use 'hg help -v ad' to show built-in aliases and global options)
491
491
492 Test command without options
492 Test command without options
493
493
494 $ hg help verify
494 $ hg help verify
495 hg verify
495 hg verify
496
496
497 verify the integrity of the repository
497 verify the integrity of the repository
498
498
499 Verify the integrity of the current repository.
499 Verify the integrity of the current repository.
500
500
501 This will perform an extensive check of the repository's integrity,
501 This will perform an extensive check of the repository's integrity,
502 validating the hashes and checksums of each entry in the changelog,
502 validating the hashes and checksums of each entry in the changelog,
503 manifest, and tracked files, as well as the integrity of their crosslinks
503 manifest, and tracked files, as well as the integrity of their crosslinks
504 and indices.
504 and indices.
505
505
506 Please see https://mercurial-scm.org/wiki/RepositoryCorruption for more
506 Please see https://mercurial-scm.org/wiki/RepositoryCorruption for more
507 information about recovery from corruption of the repository.
507 information about recovery from corruption of the repository.
508
508
509 Returns 0 on success, 1 if errors are encountered.
509 Returns 0 on success, 1 if errors are encountered.
510
510
511 (some details hidden, use --verbose to show complete help)
511 (some details hidden, use --verbose to show complete help)
512
512
513 $ hg help diff
513 $ hg help diff
514 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
514 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
515
515
516 diff repository (or selected files)
516 diff repository (or selected files)
517
517
518 Show differences between revisions for the specified files.
518 Show differences between revisions for the specified files.
519
519
520 Differences between files are shown using the unified diff format.
520 Differences between files are shown using the unified diff format.
521
521
522 Note:
522 Note:
523 'hg diff' may generate unexpected results for merges, as it will
523 'hg diff' may generate unexpected results for merges, as it will
524 default to comparing against the working directory's first parent
524 default to comparing against the working directory's first parent
525 changeset if no revisions are specified.
525 changeset if no revisions are specified.
526
526
527 When two revision arguments are given, then changes are shown between
527 When two revision arguments are given, then changes are shown between
528 those revisions. If only one revision is specified then that revision is
528 those revisions. If only one revision is specified then that revision is
529 compared to the working directory, and, when no revisions are specified,
529 compared to the working directory, and, when no revisions are specified,
530 the working directory files are compared to its first parent.
530 the working directory files are compared to its first parent.
531
531
532 Alternatively you can specify -c/--change with a revision to see the
532 Alternatively you can specify -c/--change with a revision to see the
533 changes in that changeset relative to its first parent.
533 changes in that changeset relative to its first parent.
534
534
535 Without the -a/--text option, diff will avoid generating diffs of files it
535 Without the -a/--text option, diff will avoid generating diffs of files it
536 detects as binary. With -a, diff will generate a diff anyway, probably
536 detects as binary. With -a, diff will generate a diff anyway, probably
537 with undesirable results.
537 with undesirable results.
538
538
539 Use the -g/--git option to generate diffs in the git extended diff format.
539 Use the -g/--git option to generate diffs in the git extended diff format.
540 For more information, read 'hg help diffs'.
540 For more information, read 'hg help diffs'.
541
541
542 Returns 0 on success.
542 Returns 0 on success.
543
543
544 options ([+] can be repeated):
544 options ([+] can be repeated):
545
545
546 -r --rev REV [+] revision
546 -r --rev REV [+] revision
547 -c --change REV change made by revision
547 -c --change REV change made by revision
548 -a --text treat all files as text
548 -a --text treat all files as text
549 -g --git use git extended diff format
549 -g --git use git extended diff format
550 --binary generate binary diffs in git mode (default)
550 --binary generate binary diffs in git mode (default)
551 --nodates omit dates from diff headers
551 --nodates omit dates from diff headers
552 --noprefix omit a/ and b/ prefixes from filenames
552 --noprefix omit a/ and b/ prefixes from filenames
553 -p --show-function show which function each change is in
553 -p --show-function show which function each change is in
554 --reverse produce a diff that undoes the changes
554 --reverse produce a diff that undoes the changes
555 -w --ignore-all-space ignore white space when comparing lines
555 -w --ignore-all-space ignore white space when comparing lines
556 -b --ignore-space-change ignore changes in the amount of white space
556 -b --ignore-space-change ignore changes in the amount of white space
557 -B --ignore-blank-lines ignore changes whose lines are all blank
557 -B --ignore-blank-lines ignore changes whose lines are all blank
558 -Z --ignore-space-at-eol ignore changes in whitespace at EOL
558 -Z --ignore-space-at-eol ignore changes in whitespace at EOL
559 -U --unified NUM number of lines of context to show
559 -U --unified NUM number of lines of context to show
560 --stat output diffstat-style summary of changes
560 --stat output diffstat-style summary of changes
561 --root DIR produce diffs relative to subdirectory
561 --root DIR produce diffs relative to subdirectory
562 -I --include PATTERN [+] include names matching the given patterns
562 -I --include PATTERN [+] include names matching the given patterns
563 -X --exclude PATTERN [+] exclude names matching the given patterns
563 -X --exclude PATTERN [+] exclude names matching the given patterns
564 -S --subrepos recurse into subrepositories
564 -S --subrepos recurse into subrepositories
565
565
566 (some details hidden, use --verbose to show complete help)
566 (some details hidden, use --verbose to show complete help)
567
567
568 $ hg help status
568 $ hg help status
569 hg status [OPTION]... [FILE]...
569 hg status [OPTION]... [FILE]...
570
570
571 aliases: st
571 aliases: st
572
572
573 show changed files in the working directory
573 show changed files in the working directory
574
574
575 Show status of files in the repository. If names are given, only files
575 Show status of files in the repository. If names are given, only files
576 that match are shown. Files that are clean or ignored or the source of a
576 that match are shown. Files that are clean or ignored or the source of a
577 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
577 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
578 -C/--copies or -A/--all are given. Unless options described with "show
578 -C/--copies or -A/--all are given. Unless options described with "show
579 only ..." are given, the options -mardu are used.
579 only ..." are given, the options -mardu are used.
580
580
581 Option -q/--quiet hides untracked (unknown and ignored) files unless
581 Option -q/--quiet hides untracked (unknown and ignored) files unless
582 explicitly requested with -u/--unknown or -i/--ignored.
582 explicitly requested with -u/--unknown or -i/--ignored.
583
583
584 Note:
584 Note:
585 'hg status' may appear to disagree with diff if permissions have
585 'hg status' may appear to disagree with diff if permissions have
586 changed or a merge has occurred. The standard diff format does not
586 changed or a merge has occurred. The standard diff format does not
587 report permission changes and diff only reports changes relative to one
587 report permission changes and diff only reports changes relative to one
588 merge parent.
588 merge parent.
589
589
590 If one revision is given, it is used as the base revision. If two
590 If one revision is given, it is used as the base revision. If two
591 revisions are given, the differences between them are shown. The --change
591 revisions are given, the differences between them are shown. The --change
592 option can also be used as a shortcut to list the changed files of a
592 option can also be used as a shortcut to list the changed files of a
593 revision from its first parent.
593 revision from its first parent.
594
594
595 The codes used to show the status of files are:
595 The codes used to show the status of files are:
596
596
597 M = modified
597 M = modified
598 A = added
598 A = added
599 R = removed
599 R = removed
600 C = clean
600 C = clean
601 ! = missing (deleted by non-hg command, but still tracked)
601 ! = missing (deleted by non-hg command, but still tracked)
602 ? = not tracked
602 ? = not tracked
603 I = ignored
603 I = ignored
604 = origin of the previous file (with --copies)
604 = origin of the previous file (with --copies)
605
605
606 Returns 0 on success.
606 Returns 0 on success.
607
607
608 options ([+] can be repeated):
608 options ([+] can be repeated):
609
609
610 -A --all show status of all files
610 -A --all show status of all files
611 -m --modified show only modified files
611 -m --modified show only modified files
612 -a --added show only added files
612 -a --added show only added files
613 -r --removed show only removed files
613 -r --removed show only removed files
614 -d --deleted show only deleted (but tracked) files
614 -d --deleted show only deleted (but tracked) files
615 -c --clean show only files without changes
615 -c --clean show only files without changes
616 -u --unknown show only unknown (not tracked) files
616 -u --unknown show only unknown (not tracked) files
617 -i --ignored show only ignored files
617 -i --ignored show only ignored files
618 -n --no-status hide status prefix
618 -n --no-status hide status prefix
619 -C --copies show source of copied files
619 -C --copies show source of copied files
620 -0 --print0 end filenames with NUL, for use with xargs
620 -0 --print0 end filenames with NUL, for use with xargs
621 --rev REV [+] show difference from revision
621 --rev REV [+] show difference from revision
622 --change REV list the changed files of a revision
622 --change REV list the changed files of a revision
623 -I --include PATTERN [+] include names matching the given patterns
623 -I --include PATTERN [+] include names matching the given patterns
624 -X --exclude PATTERN [+] exclude names matching the given patterns
624 -X --exclude PATTERN [+] exclude names matching the given patterns
625 -S --subrepos recurse into subrepositories
625 -S --subrepos recurse into subrepositories
626
626
627 (some details hidden, use --verbose to show complete help)
627 (some details hidden, use --verbose to show complete help)
628
628
629 $ hg -q help status
629 $ hg -q help status
630 hg status [OPTION]... [FILE]...
630 hg status [OPTION]... [FILE]...
631
631
632 show changed files in the working directory
632 show changed files in the working directory
633
633
634 $ hg help foo
634 $ hg help foo
635 abort: no such help topic: foo
635 abort: no such help topic: foo
636 (try 'hg help --keyword foo')
636 (try 'hg help --keyword foo')
637 [255]
637 [255]
638
638
639 $ hg skjdfks
639 $ hg skjdfks
640 hg: unknown command 'skjdfks'
640 hg: unknown command 'skjdfks'
641 Mercurial Distributed SCM
641 Mercurial Distributed SCM
642
642
643 basic commands:
643 basic commands:
644
644
645 add add the specified files on the next commit
645 add add the specified files on the next commit
646 annotate show changeset information by line for each file
646 annotate show changeset information by line for each file
647 clone make a copy of an existing repository
647 clone make a copy of an existing repository
648 commit commit the specified files or all outstanding changes
648 commit commit the specified files or all outstanding changes
649 diff diff repository (or selected files)
649 diff diff repository (or selected files)
650 export dump the header and diffs for one or more changesets
650 export dump the header and diffs for one or more changesets
651 forget forget the specified files on the next commit
651 forget forget the specified files on the next commit
652 init create a new repository in the given directory
652 init create a new repository in the given directory
653 log show revision history of entire repository or files
653 log show revision history of entire repository or files
654 merge merge another revision into working directory
654 merge merge another revision into working directory
655 pull pull changes from the specified source
655 pull pull changes from the specified source
656 push push changes to the specified destination
656 push push changes to the specified destination
657 remove remove the specified files on the next commit
657 remove remove the specified files on the next commit
658 serve start stand-alone webserver
658 serve start stand-alone webserver
659 status show changed files in the working directory
659 status show changed files in the working directory
660 summary summarize working directory state
660 summary summarize working directory state
661 update update working directory (or switch revisions)
661 update update working directory (or switch revisions)
662
662
663 (use 'hg help' for the full list of commands or 'hg -v' for details)
663 (use 'hg help' for the full list of commands or 'hg -v' for details)
664 [255]
664 [255]
665
665
666 Typoed command gives suggestion
666 Typoed command gives suggestion
667 $ hg puls
667 $ hg puls
668 hg: unknown command 'puls'
668 hg: unknown command 'puls'
669 (did you mean one of pull, push?)
669 (did you mean one of pull, push?)
670 [255]
670 [255]
671
671
672 Not enabled extension gets suggested
672 Not enabled extension gets suggested
673
673
674 $ hg rebase
674 $ hg rebase
675 hg: unknown command 'rebase'
675 hg: unknown command 'rebase'
676 'rebase' is provided by the following extension:
676 'rebase' is provided by the following extension:
677
677
678 rebase command to move sets of revisions to a different ancestor
678 rebase command to move sets of revisions to a different ancestor
679
679
680 (use 'hg help extensions' for information on enabling extensions)
680 (use 'hg help extensions' for information on enabling extensions)
681 [255]
681 [255]
682
682
683 Disabled extension gets suggested
683 Disabled extension gets suggested
684 $ hg --config extensions.rebase=! rebase
684 $ hg --config extensions.rebase=! rebase
685 hg: unknown command 'rebase'
685 hg: unknown command 'rebase'
686 'rebase' is provided by the following extension:
686 'rebase' is provided by the following extension:
687
687
688 rebase command to move sets of revisions to a different ancestor
688 rebase command to move sets of revisions to a different ancestor
689
689
690 (use 'hg help extensions' for information on enabling extensions)
690 (use 'hg help extensions' for information on enabling extensions)
691 [255]
691 [255]
692
692
693 Make sure that we don't run afoul of the help system thinking that
693 Make sure that we don't run afoul of the help system thinking that
694 this is a section and erroring out weirdly.
694 this is a section and erroring out weirdly.
695
695
696 $ hg .log
696 $ hg .log
697 hg: unknown command '.log'
697 hg: unknown command '.log'
698 (did you mean log?)
698 (did you mean log?)
699 [255]
699 [255]
700
700
701 $ hg log.
701 $ hg log.
702 hg: unknown command 'log.'
702 hg: unknown command 'log.'
703 (did you mean log?)
703 (did you mean log?)
704 [255]
704 [255]
705 $ hg pu.lh
705 $ hg pu.lh
706 hg: unknown command 'pu.lh'
706 hg: unknown command 'pu.lh'
707 (did you mean one of pull, push?)
707 (did you mean one of pull, push?)
708 [255]
708 [255]
709
709
710 $ cat > helpext.py <<EOF
710 $ cat > helpext.py <<EOF
711 > import os
711 > import os
712 > from mercurial import commands, registrar
712 > from mercurial import commands, registrar
713 >
713 >
714 > cmdtable = {}
714 > cmdtable = {}
715 > command = registrar.command(cmdtable)
715 > command = registrar.command(cmdtable)
716 >
716 >
717 > @command(b'nohelp',
717 > @command(b'nohelp',
718 > [(b'', b'longdesc', 3, b'x'*90),
718 > [(b'', b'longdesc', 3, b'x'*90),
719 > (b'n', b'', None, b'normal desc'),
719 > (b'n', b'', None, b'normal desc'),
720 > (b'', b'newline', b'', b'line1\nline2')],
720 > (b'', b'newline', b'', b'line1\nline2')],
721 > b'hg nohelp',
721 > b'hg nohelp',
722 > norepo=True)
722 > norepo=True)
723 > @command(b'debugoptADV', [(b'', b'aopt', None, b'option is (ADVANCED)')])
723 > @command(b'debugoptADV', [(b'', b'aopt', None, b'option is (ADVANCED)')])
724 > @command(b'debugoptDEP', [(b'', b'dopt', None, b'option is (DEPRECATED)')])
724 > @command(b'debugoptDEP', [(b'', b'dopt', None, b'option is (DEPRECATED)')])
725 > @command(b'debugoptEXP', [(b'', b'eopt', None, b'option is (EXPERIMENTAL)')])
725 > @command(b'debugoptEXP', [(b'', b'eopt', None, b'option is (EXPERIMENTAL)')])
726 > def nohelp(ui, *args, **kwargs):
726 > def nohelp(ui, *args, **kwargs):
727 > pass
727 > pass
728 >
728 >
729 > def uisetup(ui):
729 > def uisetup(ui):
730 > ui.setconfig(b'alias', b'shellalias', b'!echo hi', b'helpext')
730 > ui.setconfig(b'alias', b'shellalias', b'!echo hi', b'helpext')
731 > ui.setconfig(b'alias', b'hgalias', b'summary', b'helpext')
731 > ui.setconfig(b'alias', b'hgalias', b'summary', b'helpext')
732 >
732 >
733 > EOF
733 > EOF
734 $ echo '[extensions]' >> $HGRCPATH
734 $ echo '[extensions]' >> $HGRCPATH
735 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
735 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
736
736
737 Test for aliases
737 Test for aliases
738
738
739 $ hg help hgalias
739 $ hg help hgalias
740 hg hgalias [--remote]
740 hg hgalias [--remote]
741
741
742 alias for: hg summary
742 alias for: hg summary
743
743
744 summarize working directory state
744 summarize working directory state
745
745
746 This generates a brief summary of the working directory state, including
746 This generates a brief summary of the working directory state, including
747 parents, branch, commit status, phase and available updates.
747 parents, branch, commit status, phase and available updates.
748
748
749 With the --remote option, this will check the default paths for incoming
749 With the --remote option, this will check the default paths for incoming
750 and outgoing changes. This can be time-consuming.
750 and outgoing changes. This can be time-consuming.
751
751
752 Returns 0 on success.
752 Returns 0 on success.
753
753
754 defined by: helpext
754 defined by: helpext
755
755
756 options:
756 options:
757
757
758 --remote check for push and pull
758 --remote check for push and pull
759
759
760 (some details hidden, use --verbose to show complete help)
760 (some details hidden, use --verbose to show complete help)
761
761
762 $ hg help shellalias
762 $ hg help shellalias
763 hg shellalias
763 hg shellalias
764
764
765 shell alias for:
765 shell alias for:
766
766
767 echo hi
767 echo hi
768
768
769 defined by: helpext
769 defined by: helpext
770
770
771 (some details hidden, use --verbose to show complete help)
771 (some details hidden, use --verbose to show complete help)
772
772
773 Test command with no help text
773 Test command with no help text
774
774
775 $ hg help nohelp
775 $ hg help nohelp
776 hg nohelp
776 hg nohelp
777
777
778 (no help text available)
778 (no help text available)
779
779
780 options:
780 options:
781
781
782 --longdesc VALUE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
782 --longdesc VALUE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
783 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (default: 3)
783 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (default: 3)
784 -n -- normal desc
784 -n -- normal desc
785 --newline VALUE line1 line2
785 --newline VALUE line1 line2
786
786
787 (some details hidden, use --verbose to show complete help)
787 (some details hidden, use --verbose to show complete help)
788
788
789 $ hg help -k nohelp
789 $ hg help -k nohelp
790 Commands:
790 Commands:
791
791
792 nohelp hg nohelp
792 nohelp hg nohelp
793
793
794 Extension Commands:
794 Extension Commands:
795
795
796 nohelp (no help text available)
796 nohelp (no help text available)
797
797
798 Test that default list of commands omits extension commands
798 Test that default list of commands omits extension commands
799
799
800 $ hg help
800 $ hg help
801 Mercurial Distributed SCM
801 Mercurial Distributed SCM
802
802
803 list of commands:
803 list of commands:
804
804
805 add add the specified files on the next commit
805 add add the specified files on the next commit
806 addremove add all new files, delete all missing files
806 addremove add all new files, delete all missing files
807 annotate show changeset information by line for each file
807 annotate show changeset information by line for each file
808 archive create an unversioned archive of a repository revision
808 archive create an unversioned archive of a repository revision
809 backout reverse effect of earlier changeset
809 backout reverse effect of earlier changeset
810 bisect subdivision search of changesets
810 bisect subdivision search of changesets
811 bookmarks create a new bookmark or list existing bookmarks
811 bookmarks create a new bookmark or list existing bookmarks
812 branch set or show the current branch name
812 branch set or show the current branch name
813 branches list repository named branches
813 branches list repository named branches
814 bundle create a bundle file
814 bundle create a bundle file
815 cat output the current or given revision of files
815 cat output the current or given revision of files
816 clone make a copy of an existing repository
816 clone make a copy of an existing repository
817 commit commit the specified files or all outstanding changes
817 commit commit the specified files or all outstanding changes
818 config show combined config settings from all hgrc files
818 config show combined config settings from all hgrc files
819 copy mark files as copied for the next commit
819 copy mark files as copied for the next commit
820 diff diff repository (or selected files)
820 diff diff repository (or selected files)
821 export dump the header and diffs for one or more changesets
821 export dump the header and diffs for one or more changesets
822 files list tracked files
822 files list tracked files
823 forget forget the specified files on the next commit
823 forget forget the specified files on the next commit
824 graft copy changes from other branches onto the current branch
824 graft copy changes from other branches onto the current branch
825 grep search revision history for a pattern in specified files
825 grep search revision history for a pattern in specified files
826 heads show branch heads
826 heads show branch heads
827 help show help for a given topic or a help overview
827 help show help for a given topic or a help overview
828 identify identify the working directory or specified revision
828 identify identify the working directory or specified revision
829 import import an ordered set of patches
829 import import an ordered set of patches
830 incoming show new changesets found in source
830 incoming show new changesets found in source
831 init create a new repository in the given directory
831 init create a new repository in the given directory
832 log show revision history of entire repository or files
832 log show revision history of entire repository or files
833 manifest output the current or given revision of the project manifest
833 manifest output the current or given revision of the project manifest
834 merge merge another revision into working directory
834 merge merge another revision into working directory
835 outgoing show changesets not found in the destination
835 outgoing show changesets not found in the destination
836 paths show aliases for remote repositories
836 paths show aliases for remote repositories
837 phase set or show the current phase name
837 phase set or show the current phase name
838 pull pull changes from the specified source
838 pull pull changes from the specified source
839 push push changes to the specified destination
839 push push changes to the specified destination
840 recover roll back an interrupted transaction
840 recover roll back an interrupted transaction
841 remove remove the specified files on the next commit
841 remove remove the specified files on the next commit
842 rename rename files; equivalent of copy + remove
842 rename rename files; equivalent of copy + remove
843 resolve redo merges or set/view the merge status of files
843 resolve redo merges or set/view the merge status of files
844 revert restore files to their checkout state
844 revert restore files to their checkout state
845 root print the root (top) of the current working directory
845 root print the root (top) of the current working directory
846 serve start stand-alone webserver
846 serve start stand-alone webserver
847 status show changed files in the working directory
847 status show changed files in the working directory
848 summary summarize working directory state
848 summary summarize working directory state
849 tag add one or more tags for the current or given revision
849 tag add one or more tags for the current or given revision
850 tags list repository tags
850 tags list repository tags
851 unbundle apply one or more bundle files
851 unbundle apply one or more bundle files
852 update update working directory (or switch revisions)
852 update update working directory (or switch revisions)
853 verify verify the integrity of the repository
853 verify verify the integrity of the repository
854 version output version and copyright information
854 version output version and copyright information
855
855
856 enabled extensions:
856 enabled extensions:
857
857
858 helpext (no help text available)
858 helpext (no help text available)
859
859
860 additional help topics:
860 additional help topics:
861
861
862 bundlespec Bundle File Formats
862 bundlespec Bundle File Formats
863 color Colorizing Outputs
863 color Colorizing Outputs
864 config Configuration Files
864 config Configuration Files
865 dates Date Formats
865 dates Date Formats
866 diffs Diff Formats
866 diffs Diff Formats
867 environment Environment Variables
867 environment Environment Variables
868 extensions Using Additional Features
868 extensions Using Additional Features
869 filesets Specifying File Sets
869 filesets Specifying File Sets
870 flags Command-line flags
870 flags Command-line flags
871 glossary Glossary
871 glossary Glossary
872 hgignore Syntax for Mercurial Ignore Files
872 hgignore Syntax for Mercurial Ignore Files
873 hgweb Configuring hgweb
873 hgweb Configuring hgweb
874 internals Technical implementation topics
874 internals Technical implementation topics
875 merge-tools Merge Tools
875 merge-tools Merge Tools
876 pager Pager Support
876 pager Pager Support
877 patterns File Name Patterns
877 patterns File Name Patterns
878 phases Working with Phases
878 phases Working with Phases
879 revisions Specifying Revisions
879 revisions Specifying Revisions
880 scripting Using Mercurial from scripts and automation
880 scripting Using Mercurial from scripts and automation
881 subrepos Subrepositories
881 subrepos Subrepositories
882 templating Template Usage
882 templating Template Usage
883 urls URL Paths
883 urls URL Paths
884
884
885 (use 'hg help -v' to show built-in aliases and global options)
885 (use 'hg help -v' to show built-in aliases and global options)
886
886
887
887
888 Test list of internal help commands
888 Test list of internal help commands
889
889
890 $ hg help debug
890 $ hg help debug
891 debug commands (internal and unsupported):
891 debug commands (internal and unsupported):
892
892
893 debugancestor
893 debugancestor
894 find the ancestor revision of two revisions in a given index
894 find the ancestor revision of two revisions in a given index
895 debugapplystreamclonebundle
895 debugapplystreamclonebundle
896 apply a stream clone bundle file
896 apply a stream clone bundle file
897 debugbuilddag
897 debugbuilddag
898 builds a repo with a given DAG from scratch in the current
898 builds a repo with a given DAG from scratch in the current
899 empty repo
899 empty repo
900 debugbundle lists the contents of a bundle
900 debugbundle lists the contents of a bundle
901 debugcapabilities
901 debugcapabilities
902 lists the capabilities of a remote peer
902 lists the capabilities of a remote peer
903 debugcheckstate
903 debugcheckstate
904 validate the correctness of the current dirstate
904 validate the correctness of the current dirstate
905 debugcolor show available color, effects or style
905 debugcolor show available color, effects or style
906 debugcommands
906 debugcommands
907 list all available commands and options
907 list all available commands and options
908 debugcomplete
908 debugcomplete
909 returns the completion list associated with the given command
909 returns the completion list associated with the given command
910 debugcreatestreamclonebundle
910 debugcreatestreamclonebundle
911 create a stream clone bundle file
911 create a stream clone bundle file
912 debugdag format the changelog or an index DAG as a concise textual
912 debugdag format the changelog or an index DAG as a concise textual
913 description
913 description
914 debugdata dump the contents of a data file revision
914 debugdata dump the contents of a data file revision
915 debugdate parse and display a date
915 debugdate parse and display a date
916 debugdeltachain
916 debugdeltachain
917 dump information about delta chains in a revlog
917 dump information about delta chains in a revlog
918 debugdirstate
918 debugdirstate
919 show the contents of the current dirstate
919 show the contents of the current dirstate
920 debugdiscovery
920 debugdiscovery
921 runs the changeset discovery protocol in isolation
921 runs the changeset discovery protocol in isolation
922 debugextensions
922 debugextensions
923 show information about active extensions
923 show information about active extensions
924 debugfileset parse and apply a fileset specification
924 debugfileset parse and apply a fileset specification
925 debugformat display format information about the current repository
925 debugfsinfo show information detected about current filesystem
926 debugfsinfo show information detected about current filesystem
926 debuggetbundle
927 debuggetbundle
927 retrieves a bundle from a repo
928 retrieves a bundle from a repo
928 debugignore display the combined ignore pattern and information about
929 debugignore display the combined ignore pattern and information about
929 ignored files
930 ignored files
930 debugindex dump the contents of an index file
931 debugindex dump the contents of an index file
931 debugindexdot
932 debugindexdot
932 dump an index DAG as a graphviz dot file
933 dump an index DAG as a graphviz dot file
933 debuginstall test Mercurial installation
934 debuginstall test Mercurial installation
934 debugknown test whether node ids are known to a repo
935 debugknown test whether node ids are known to a repo
935 debuglocks show or modify state of locks
936 debuglocks show or modify state of locks
936 debugmergestate
937 debugmergestate
937 print merge state
938 print merge state
938 debugnamecomplete
939 debugnamecomplete
939 complete "names" - tags, open branch names, bookmark names
940 complete "names" - tags, open branch names, bookmark names
940 debugobsolete
941 debugobsolete
941 create arbitrary obsolete marker
942 create arbitrary obsolete marker
942 debugoptADV (no help text available)
943 debugoptADV (no help text available)
943 debugoptDEP (no help text available)
944 debugoptDEP (no help text available)
944 debugoptEXP (no help text available)
945 debugoptEXP (no help text available)
945 debugpathcomplete
946 debugpathcomplete
946 complete part or all of a tracked path
947 complete part or all of a tracked path
947 debugpickmergetool
948 debugpickmergetool
948 examine which merge tool is chosen for specified file
949 examine which merge tool is chosen for specified file
949 debugpushkey access the pushkey key/value protocol
950 debugpushkey access the pushkey key/value protocol
950 debugpvec (no help text available)
951 debugpvec (no help text available)
951 debugrebuilddirstate
952 debugrebuilddirstate
952 rebuild the dirstate as it would look like for the given
953 rebuild the dirstate as it would look like for the given
953 revision
954 revision
954 debugrebuildfncache
955 debugrebuildfncache
955 rebuild the fncache file
956 rebuild the fncache file
956 debugrename dump rename information
957 debugrename dump rename information
957 debugrevlog show data and statistics about a revlog
958 debugrevlog show data and statistics about a revlog
958 debugrevspec parse and apply a revision specification
959 debugrevspec parse and apply a revision specification
959 debugsetparents
960 debugsetparents
960 manually set the parents of the current working directory
961 manually set the parents of the current working directory
961 debugssl test a secure connection to a server
962 debugssl test a secure connection to a server
962 debugsub (no help text available)
963 debugsub (no help text available)
963 debugsuccessorssets
964 debugsuccessorssets
964 show set of successors for revision
965 show set of successors for revision
965 debugtemplate
966 debugtemplate
966 parse and apply a template
967 parse and apply a template
967 debugupdatecaches
968 debugupdatecaches
968 warm all known caches in the repository
969 warm all known caches in the repository
969 debugupgraderepo
970 debugupgraderepo
970 upgrade a repository to use different features
971 upgrade a repository to use different features
971 debugwalk show how files match on given patterns
972 debugwalk show how files match on given patterns
972 debugwireargs
973 debugwireargs
973 (no help text available)
974 (no help text available)
974
975
975 (use 'hg help -v debug' to show built-in aliases and global options)
976 (use 'hg help -v debug' to show built-in aliases and global options)
976
977
977 internals topic renders index of available sub-topics
978 internals topic renders index of available sub-topics
978
979
979 $ hg help internals
980 $ hg help internals
980 Technical implementation topics
981 Technical implementation topics
981 """""""""""""""""""""""""""""""
982 """""""""""""""""""""""""""""""
982
983
983 To access a subtopic, use "hg help internals.{subtopic-name}"
984 To access a subtopic, use "hg help internals.{subtopic-name}"
984
985
985 bundles Bundles
986 bundles Bundles
986 censor Censor
987 censor Censor
987 changegroups Changegroups
988 changegroups Changegroups
988 config Config Registrar
989 config Config Registrar
989 requirements Repository Requirements
990 requirements Repository Requirements
990 revlogs Revision Logs
991 revlogs Revision Logs
991 wireprotocol Wire Protocol
992 wireprotocol Wire Protocol
992
993
993 sub-topics can be accessed
994 sub-topics can be accessed
994
995
995 $ hg help internals.changegroups
996 $ hg help internals.changegroups
996 Changegroups
997 Changegroups
997 """"""""""""
998 """"""""""""
998
999
999 Changegroups are representations of repository revlog data, specifically
1000 Changegroups are representations of repository revlog data, specifically
1000 the changelog data, root/flat manifest data, treemanifest data, and
1001 the changelog data, root/flat manifest data, treemanifest data, and
1001 filelogs.
1002 filelogs.
1002
1003
1003 There are 3 versions of changegroups: "1", "2", and "3". From a high-
1004 There are 3 versions of changegroups: "1", "2", and "3". From a high-
1004 level, versions "1" and "2" are almost exactly the same, with the only
1005 level, versions "1" and "2" are almost exactly the same, with the only
1005 difference being an additional item in the *delta header*. Version "3"
1006 difference being an additional item in the *delta header*. Version "3"
1006 adds support for revlog flags in the *delta header* and optionally
1007 adds support for revlog flags in the *delta header* and optionally
1007 exchanging treemanifests (enabled by setting an option on the
1008 exchanging treemanifests (enabled by setting an option on the
1008 "changegroup" part in the bundle2).
1009 "changegroup" part in the bundle2).
1009
1010
1010 Changegroups when not exchanging treemanifests consist of 3 logical
1011 Changegroups when not exchanging treemanifests consist of 3 logical
1011 segments:
1012 segments:
1012
1013
1013 +---------------------------------+
1014 +---------------------------------+
1014 | | | |
1015 | | | |
1015 | changeset | manifest | filelogs |
1016 | changeset | manifest | filelogs |
1016 | | | |
1017 | | | |
1017 | | | |
1018 | | | |
1018 +---------------------------------+
1019 +---------------------------------+
1019
1020
1020 When exchanging treemanifests, there are 4 logical segments:
1021 When exchanging treemanifests, there are 4 logical segments:
1021
1022
1022 +-------------------------------------------------+
1023 +-------------------------------------------------+
1023 | | | | |
1024 | | | | |
1024 | changeset | root | treemanifests | filelogs |
1025 | changeset | root | treemanifests | filelogs |
1025 | | manifest | | |
1026 | | manifest | | |
1026 | | | | |
1027 | | | | |
1027 +-------------------------------------------------+
1028 +-------------------------------------------------+
1028
1029
1029 The principle building block of each segment is a *chunk*. A *chunk* is a
1030 The principle building block of each segment is a *chunk*. A *chunk* is a
1030 framed piece of data:
1031 framed piece of data:
1031
1032
1032 +---------------------------------------+
1033 +---------------------------------------+
1033 | | |
1034 | | |
1034 | length | data |
1035 | length | data |
1035 | (4 bytes) | (<length - 4> bytes) |
1036 | (4 bytes) | (<length - 4> bytes) |
1036 | | |
1037 | | |
1037 +---------------------------------------+
1038 +---------------------------------------+
1038
1039
1039 All integers are big-endian signed integers. Each chunk starts with a
1040 All integers are big-endian signed integers. Each chunk starts with a
1040 32-bit integer indicating the length of the entire chunk (including the
1041 32-bit integer indicating the length of the entire chunk (including the
1041 length field itself).
1042 length field itself).
1042
1043
1043 There is a special case chunk that has a value of 0 for the length
1044 There is a special case chunk that has a value of 0 for the length
1044 ("0x00000000"). We call this an *empty chunk*.
1045 ("0x00000000"). We call this an *empty chunk*.
1045
1046
1046 Delta Groups
1047 Delta Groups
1047 ============
1048 ============
1048
1049
1049 A *delta group* expresses the content of a revlog as a series of deltas,
1050 A *delta group* expresses the content of a revlog as a series of deltas,
1050 or patches against previous revisions.
1051 or patches against previous revisions.
1051
1052
1052 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
1053 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
1053 to signal the end of the delta group:
1054 to signal the end of the delta group:
1054
1055
1055 +------------------------------------------------------------------------+
1056 +------------------------------------------------------------------------+
1056 | | | | | |
1057 | | | | | |
1057 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
1058 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
1058 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
1059 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
1059 | | | | | |
1060 | | | | | |
1060 +------------------------------------------------------------------------+
1061 +------------------------------------------------------------------------+
1061
1062
1062 Each *chunk*'s data consists of the following:
1063 Each *chunk*'s data consists of the following:
1063
1064
1064 +---------------------------------------+
1065 +---------------------------------------+
1065 | | |
1066 | | |
1066 | delta header | delta data |
1067 | delta header | delta data |
1067 | (various by version) | (various) |
1068 | (various by version) | (various) |
1068 | | |
1069 | | |
1069 +---------------------------------------+
1070 +---------------------------------------+
1070
1071
1071 The *delta data* is a series of *delta*s that describe a diff from an
1072 The *delta data* is a series of *delta*s that describe a diff from an
1072 existing entry (either that the recipient already has, or previously
1073 existing entry (either that the recipient already has, or previously
1073 specified in the bundle/changegroup).
1074 specified in the bundle/changegroup).
1074
1075
1075 The *delta header* is different between versions "1", "2", and "3" of the
1076 The *delta header* is different between versions "1", "2", and "3" of the
1076 changegroup format.
1077 changegroup format.
1077
1078
1078 Version 1 (headerlen=80):
1079 Version 1 (headerlen=80):
1079
1080
1080 +------------------------------------------------------+
1081 +------------------------------------------------------+
1081 | | | | |
1082 | | | | |
1082 | node | p1 node | p2 node | link node |
1083 | node | p1 node | p2 node | link node |
1083 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1084 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1084 | | | | |
1085 | | | | |
1085 +------------------------------------------------------+
1086 +------------------------------------------------------+
1086
1087
1087 Version 2 (headerlen=100):
1088 Version 2 (headerlen=100):
1088
1089
1089 +------------------------------------------------------------------+
1090 +------------------------------------------------------------------+
1090 | | | | | |
1091 | | | | | |
1091 | node | p1 node | p2 node | base node | link node |
1092 | node | p1 node | p2 node | base node | link node |
1092 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1093 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1093 | | | | | |
1094 | | | | | |
1094 +------------------------------------------------------------------+
1095 +------------------------------------------------------------------+
1095
1096
1096 Version 3 (headerlen=102):
1097 Version 3 (headerlen=102):
1097
1098
1098 +------------------------------------------------------------------------------+
1099 +------------------------------------------------------------------------------+
1099 | | | | | | |
1100 | | | | | | |
1100 | node | p1 node | p2 node | base node | link node | flags |
1101 | node | p1 node | p2 node | base node | link node | flags |
1101 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
1102 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
1102 | | | | | | |
1103 | | | | | | |
1103 +------------------------------------------------------------------------------+
1104 +------------------------------------------------------------------------------+
1104
1105
1105 The *delta data* consists of "chunklen - 4 - headerlen" bytes, which
1106 The *delta data* consists of "chunklen - 4 - headerlen" bytes, which
1106 contain a series of *delta*s, densely packed (no separators). These deltas
1107 contain a series of *delta*s, densely packed (no separators). These deltas
1107 describe a diff from an existing entry (either that the recipient already
1108 describe a diff from an existing entry (either that the recipient already
1108 has, or previously specified in the bundle/changegroup). The format is
1109 has, or previously specified in the bundle/changegroup). The format is
1109 described more fully in "hg help internals.bdiff", but briefly:
1110 described more fully in "hg help internals.bdiff", but briefly:
1110
1111
1111 +---------------------------------------------------------------+
1112 +---------------------------------------------------------------+
1112 | | | | |
1113 | | | | |
1113 | start offset | end offset | new length | content |
1114 | start offset | end offset | new length | content |
1114 | (4 bytes) | (4 bytes) | (4 bytes) | (<new length> bytes) |
1115 | (4 bytes) | (4 bytes) | (4 bytes) | (<new length> bytes) |
1115 | | | | |
1116 | | | | |
1116 +---------------------------------------------------------------+
1117 +---------------------------------------------------------------+
1117
1118
1118 Please note that the length field in the delta data does *not* include
1119 Please note that the length field in the delta data does *not* include
1119 itself.
1120 itself.
1120
1121
1121 In version 1, the delta is always applied against the previous node from
1122 In version 1, the delta is always applied against the previous node from
1122 the changegroup or the first parent if this is the first entry in the
1123 the changegroup or the first parent if this is the first entry in the
1123 changegroup.
1124 changegroup.
1124
1125
1125 In version 2 and up, the delta base node is encoded in the entry in the
1126 In version 2 and up, the delta base node is encoded in the entry in the
1126 changegroup. This allows the delta to be expressed against any parent,
1127 changegroup. This allows the delta to be expressed against any parent,
1127 which can result in smaller deltas and more efficient encoding of data.
1128 which can result in smaller deltas and more efficient encoding of data.
1128
1129
1129 Changeset Segment
1130 Changeset Segment
1130 =================
1131 =================
1131
1132
1132 The *changeset segment* consists of a single *delta group* holding
1133 The *changeset segment* consists of a single *delta group* holding
1133 changelog data. The *empty chunk* at the end of the *delta group* denotes
1134 changelog data. The *empty chunk* at the end of the *delta group* denotes
1134 the boundary to the *manifest segment*.
1135 the boundary to the *manifest segment*.
1135
1136
1136 Manifest Segment
1137 Manifest Segment
1137 ================
1138 ================
1138
1139
1139 The *manifest segment* consists of a single *delta group* holding manifest
1140 The *manifest segment* consists of a single *delta group* holding manifest
1140 data. If treemanifests are in use, it contains only the manifest for the
1141 data. If treemanifests are in use, it contains only the manifest for the
1141 root directory of the repository. Otherwise, it contains the entire
1142 root directory of the repository. Otherwise, it contains the entire
1142 manifest data. The *empty chunk* at the end of the *delta group* denotes
1143 manifest data. The *empty chunk* at the end of the *delta group* denotes
1143 the boundary to the next segment (either the *treemanifests segment* or
1144 the boundary to the next segment (either the *treemanifests segment* or
1144 the *filelogs segment*, depending on version and the request options).
1145 the *filelogs segment*, depending on version and the request options).
1145
1146
1146 Treemanifests Segment
1147 Treemanifests Segment
1147 ---------------------
1148 ---------------------
1148
1149
1149 The *treemanifests segment* only exists in changegroup version "3", and
1150 The *treemanifests segment* only exists in changegroup version "3", and
1150 only if the 'treemanifest' param is part of the bundle2 changegroup part
1151 only if the 'treemanifest' param is part of the bundle2 changegroup part
1151 (it is not possible to use changegroup version 3 outside of bundle2).
1152 (it is not possible to use changegroup version 3 outside of bundle2).
1152 Aside from the filenames in the *treemanifests segment* containing a
1153 Aside from the filenames in the *treemanifests segment* containing a
1153 trailing "/" character, it behaves identically to the *filelogs segment*
1154 trailing "/" character, it behaves identically to the *filelogs segment*
1154 (see below). The final sub-segment is followed by an *empty chunk*
1155 (see below). The final sub-segment is followed by an *empty chunk*
1155 (logically, a sub-segment with filename size 0). This denotes the boundary
1156 (logically, a sub-segment with filename size 0). This denotes the boundary
1156 to the *filelogs segment*.
1157 to the *filelogs segment*.
1157
1158
1158 Filelogs Segment
1159 Filelogs Segment
1159 ================
1160 ================
1160
1161
1161 The *filelogs segment* consists of multiple sub-segments, each
1162 The *filelogs segment* consists of multiple sub-segments, each
1162 corresponding to an individual file whose data is being described:
1163 corresponding to an individual file whose data is being described:
1163
1164
1164 +--------------------------------------------------+
1165 +--------------------------------------------------+
1165 | | | | | |
1166 | | | | | |
1166 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
1167 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
1167 | | | | | (4 bytes) |
1168 | | | | | (4 bytes) |
1168 | | | | | |
1169 | | | | | |
1169 +--------------------------------------------------+
1170 +--------------------------------------------------+
1170
1171
1171 The final filelog sub-segment is followed by an *empty chunk* (logically,
1172 The final filelog sub-segment is followed by an *empty chunk* (logically,
1172 a sub-segment with filename size 0). This denotes the end of the segment
1173 a sub-segment with filename size 0). This denotes the end of the segment
1173 and of the overall changegroup.
1174 and of the overall changegroup.
1174
1175
1175 Each filelog sub-segment consists of the following:
1176 Each filelog sub-segment consists of the following:
1176
1177
1177 +------------------------------------------------------+
1178 +------------------------------------------------------+
1178 | | | |
1179 | | | |
1179 | filename length | filename | delta group |
1180 | filename length | filename | delta group |
1180 | (4 bytes) | (<length - 4> bytes) | (various) |
1181 | (4 bytes) | (<length - 4> bytes) | (various) |
1181 | | | |
1182 | | | |
1182 +------------------------------------------------------+
1183 +------------------------------------------------------+
1183
1184
1184 That is, a *chunk* consisting of the filename (not terminated or padded)
1185 That is, a *chunk* consisting of the filename (not terminated or padded)
1185 followed by N chunks constituting the *delta group* for this file. The
1186 followed by N chunks constituting the *delta group* for this file. The
1186 *empty chunk* at the end of each *delta group* denotes the boundary to the
1187 *empty chunk* at the end of each *delta group* denotes the boundary to the
1187 next filelog sub-segment.
1188 next filelog sub-segment.
1188
1189
1189 Test list of commands with command with no help text
1190 Test list of commands with command with no help text
1190
1191
1191 $ hg help helpext
1192 $ hg help helpext
1192 helpext extension - no help text available
1193 helpext extension - no help text available
1193
1194
1194 list of commands:
1195 list of commands:
1195
1196
1196 nohelp (no help text available)
1197 nohelp (no help text available)
1197
1198
1198 (use 'hg help -v helpext' to show built-in aliases and global options)
1199 (use 'hg help -v helpext' to show built-in aliases and global options)
1199
1200
1200
1201
1201 test advanced, deprecated and experimental options are hidden in command help
1202 test advanced, deprecated and experimental options are hidden in command help
1202 $ hg help debugoptADV
1203 $ hg help debugoptADV
1203 hg debugoptADV
1204 hg debugoptADV
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 $ hg help debugoptDEP
1211 $ hg help debugoptDEP
1211 hg debugoptDEP
1212 hg debugoptDEP
1212
1213
1213 (no help text available)
1214 (no help text available)
1214
1215
1215 options:
1216 options:
1216
1217
1217 (some details hidden, use --verbose to show complete help)
1218 (some details hidden, use --verbose to show complete help)
1218
1219
1219 $ hg help debugoptEXP
1220 $ hg help debugoptEXP
1220 hg debugoptEXP
1221 hg debugoptEXP
1221
1222
1222 (no help text available)
1223 (no help text available)
1223
1224
1224 options:
1225 options:
1225
1226
1226 (some details hidden, use --verbose to show complete help)
1227 (some details hidden, use --verbose to show complete help)
1227
1228
1228 test advanced, deprecated and experimental options are shown with -v
1229 test advanced, deprecated and experimental options are shown with -v
1229 $ hg help -v debugoptADV | grep aopt
1230 $ hg help -v debugoptADV | grep aopt
1230 --aopt option is (ADVANCED)
1231 --aopt option is (ADVANCED)
1231 $ hg help -v debugoptDEP | grep dopt
1232 $ hg help -v debugoptDEP | grep dopt
1232 --dopt option is (DEPRECATED)
1233 --dopt option is (DEPRECATED)
1233 $ hg help -v debugoptEXP | grep eopt
1234 $ hg help -v debugoptEXP | grep eopt
1234 --eopt option is (EXPERIMENTAL)
1235 --eopt option is (EXPERIMENTAL)
1235
1236
1236 #if gettext
1237 #if gettext
1237 test deprecated option is hidden with translation with untranslated description
1238 test deprecated option is hidden with translation with untranslated description
1238 (use many globy for not failing on changed transaction)
1239 (use many globy for not failing on changed transaction)
1239 $ LANGUAGE=sv hg help debugoptDEP
1240 $ LANGUAGE=sv hg help debugoptDEP
1240 hg debugoptDEP
1241 hg debugoptDEP
1241
1242
1242 (*) (glob)
1243 (*) (glob)
1243
1244
1244 options:
1245 options:
1245
1246
1246 (some details hidden, use --verbose to show complete help)
1247 (some details hidden, use --verbose to show complete help)
1247 #endif
1248 #endif
1248
1249
1249 Test commands that collide with topics (issue4240)
1250 Test commands that collide with topics (issue4240)
1250
1251
1251 $ hg config -hq
1252 $ hg config -hq
1252 hg config [-u] [NAME]...
1253 hg config [-u] [NAME]...
1253
1254
1254 show combined config settings from all hgrc files
1255 show combined config settings from all hgrc files
1255 $ hg showconfig -hq
1256 $ hg showconfig -hq
1256 hg config [-u] [NAME]...
1257 hg config [-u] [NAME]...
1257
1258
1258 show combined config settings from all hgrc files
1259 show combined config settings from all hgrc files
1259
1260
1260 Test a help topic
1261 Test a help topic
1261
1262
1262 $ hg help dates
1263 $ hg help dates
1263 Date Formats
1264 Date Formats
1264 """"""""""""
1265 """"""""""""
1265
1266
1266 Some commands allow the user to specify a date, e.g.:
1267 Some commands allow the user to specify a date, e.g.:
1267
1268
1268 - backout, commit, import, tag: Specify the commit date.
1269 - backout, commit, import, tag: Specify the commit date.
1269 - log, revert, update: Select revision(s) by date.
1270 - log, revert, update: Select revision(s) by date.
1270
1271
1271 Many date formats are valid. Here are some examples:
1272 Many date formats are valid. Here are some examples:
1272
1273
1273 - "Wed Dec 6 13:18:29 2006" (local timezone assumed)
1274 - "Wed Dec 6 13:18:29 2006" (local timezone assumed)
1274 - "Dec 6 13:18 -0600" (year assumed, time offset provided)
1275 - "Dec 6 13:18 -0600" (year assumed, time offset provided)
1275 - "Dec 6 13:18 UTC" (UTC and GMT are aliases for +0000)
1276 - "Dec 6 13:18 UTC" (UTC and GMT are aliases for +0000)
1276 - "Dec 6" (midnight)
1277 - "Dec 6" (midnight)
1277 - "13:18" (today assumed)
1278 - "13:18" (today assumed)
1278 - "3:39" (3:39AM assumed)
1279 - "3:39" (3:39AM assumed)
1279 - "3:39pm" (15:39)
1280 - "3:39pm" (15:39)
1280 - "2006-12-06 13:18:29" (ISO 8601 format)
1281 - "2006-12-06 13:18:29" (ISO 8601 format)
1281 - "2006-12-6 13:18"
1282 - "2006-12-6 13:18"
1282 - "2006-12-6"
1283 - "2006-12-6"
1283 - "12-6"
1284 - "12-6"
1284 - "12/6"
1285 - "12/6"
1285 - "12/6/6" (Dec 6 2006)
1286 - "12/6/6" (Dec 6 2006)
1286 - "today" (midnight)
1287 - "today" (midnight)
1287 - "yesterday" (midnight)
1288 - "yesterday" (midnight)
1288 - "now" - right now
1289 - "now" - right now
1289
1290
1290 Lastly, there is Mercurial's internal format:
1291 Lastly, there is Mercurial's internal format:
1291
1292
1292 - "1165411109 0" (Wed Dec 6 13:18:29 2006 UTC)
1293 - "1165411109 0" (Wed Dec 6 13:18:29 2006 UTC)
1293
1294
1294 This is the internal representation format for dates. The first number is
1295 This is the internal representation format for dates. The first number is
1295 the number of seconds since the epoch (1970-01-01 00:00 UTC). The second
1296 the number of seconds since the epoch (1970-01-01 00:00 UTC). The second
1296 is the offset of the local timezone, in seconds west of UTC (negative if
1297 is the offset of the local timezone, in seconds west of UTC (negative if
1297 the timezone is east of UTC).
1298 the timezone is east of UTC).
1298
1299
1299 The log command also accepts date ranges:
1300 The log command also accepts date ranges:
1300
1301
1301 - "<DATE" - at or before a given date/time
1302 - "<DATE" - at or before a given date/time
1302 - ">DATE" - on or after a given date/time
1303 - ">DATE" - on or after a given date/time
1303 - "DATE to DATE" - a date range, inclusive
1304 - "DATE to DATE" - a date range, inclusive
1304 - "-DAYS" - within a given number of days of today
1305 - "-DAYS" - within a given number of days of today
1305
1306
1306 Test repeated config section name
1307 Test repeated config section name
1307
1308
1308 $ hg help config.host
1309 $ hg help config.host
1309 "http_proxy.host"
1310 "http_proxy.host"
1310 Host name and (optional) port of the proxy server, for example
1311 Host name and (optional) port of the proxy server, for example
1311 "myproxy:8000".
1312 "myproxy:8000".
1312
1313
1313 "smtp.host"
1314 "smtp.host"
1314 Host name of mail server, e.g. "mail.example.com".
1315 Host name of mail server, e.g. "mail.example.com".
1315
1316
1316 Unrelated trailing paragraphs shouldn't be included
1317 Unrelated trailing paragraphs shouldn't be included
1317
1318
1318 $ hg help config.extramsg | grep '^$'
1319 $ hg help config.extramsg | grep '^$'
1319
1320
1320
1321
1321 Test capitalized section name
1322 Test capitalized section name
1322
1323
1323 $ hg help scripting.HGPLAIN > /dev/null
1324 $ hg help scripting.HGPLAIN > /dev/null
1324
1325
1325 Help subsection:
1326 Help subsection:
1326
1327
1327 $ hg help config.charsets |grep "Email example:" > /dev/null
1328 $ hg help config.charsets |grep "Email example:" > /dev/null
1328 [1]
1329 [1]
1329
1330
1330 Show nested definitions
1331 Show nested definitions
1331 ("profiling.type"[break]"ls"[break]"stat"[break])
1332 ("profiling.type"[break]"ls"[break]"stat"[break])
1332
1333
1333 $ hg help config.type | egrep '^$'|wc -l
1334 $ hg help config.type | egrep '^$'|wc -l
1334 \s*3 (re)
1335 \s*3 (re)
1335
1336
1336 Separate sections from subsections
1337 Separate sections from subsections
1337
1338
1338 $ hg help config.format | egrep '^ ("|-)|^\s*$' | uniq
1339 $ hg help config.format | egrep '^ ("|-)|^\s*$' | uniq
1339 "format"
1340 "format"
1340 --------
1341 --------
1341
1342
1342 "usegeneraldelta"
1343 "usegeneraldelta"
1343
1344
1344 "dotencode"
1345 "dotencode"
1345
1346
1346 "usefncache"
1347 "usefncache"
1347
1348
1348 "usestore"
1349 "usestore"
1349
1350
1350 "profiling"
1351 "profiling"
1351 -----------
1352 -----------
1352
1353
1353 "format"
1354 "format"
1354
1355
1355 "progress"
1356 "progress"
1356 ----------
1357 ----------
1357
1358
1358 "format"
1359 "format"
1359
1360
1360
1361
1361 Last item in help config.*:
1362 Last item in help config.*:
1362
1363
1363 $ hg help config.`hg help config|grep '^ "'| \
1364 $ hg help config.`hg help config|grep '^ "'| \
1364 > tail -1|sed 's![ "]*!!g'`| \
1365 > tail -1|sed 's![ "]*!!g'`| \
1365 > grep 'hg help -c config' > /dev/null
1366 > grep 'hg help -c config' > /dev/null
1366 [1]
1367 [1]
1367
1368
1368 note to use help -c for general hg help config:
1369 note to use help -c for general hg help config:
1369
1370
1370 $ hg help config |grep 'hg help -c config' > /dev/null
1371 $ hg help config |grep 'hg help -c config' > /dev/null
1371
1372
1372 Test templating help
1373 Test templating help
1373
1374
1374 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
1375 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
1375 desc String. The text of the changeset description.
1376 desc String. The text of the changeset description.
1376 diffstat String. Statistics of changes with the following format:
1377 diffstat String. Statistics of changes with the following format:
1377 firstline Any text. Returns the first line of text.
1378 firstline Any text. Returns the first line of text.
1378 nonempty Any text. Returns '(none)' if the string is empty.
1379 nonempty Any text. Returns '(none)' if the string is empty.
1379
1380
1380 Test deprecated items
1381 Test deprecated items
1381
1382
1382 $ hg help -v templating | grep currentbookmark
1383 $ hg help -v templating | grep currentbookmark
1383 currentbookmark
1384 currentbookmark
1384 $ hg help templating | (grep currentbookmark || true)
1385 $ hg help templating | (grep currentbookmark || true)
1385
1386
1386 Test help hooks
1387 Test help hooks
1387
1388
1388 $ cat > helphook1.py <<EOF
1389 $ cat > helphook1.py <<EOF
1389 > from mercurial import help
1390 > from mercurial import help
1390 >
1391 >
1391 > def rewrite(ui, topic, doc):
1392 > def rewrite(ui, topic, doc):
1392 > return doc + '\nhelphook1\n'
1393 > return doc + '\nhelphook1\n'
1393 >
1394 >
1394 > def extsetup(ui):
1395 > def extsetup(ui):
1395 > help.addtopichook('revisions', rewrite)
1396 > help.addtopichook('revisions', rewrite)
1396 > EOF
1397 > EOF
1397 $ cat > helphook2.py <<EOF
1398 $ cat > helphook2.py <<EOF
1398 > from mercurial import help
1399 > from mercurial import help
1399 >
1400 >
1400 > def rewrite(ui, topic, doc):
1401 > def rewrite(ui, topic, doc):
1401 > return doc + '\nhelphook2\n'
1402 > return doc + '\nhelphook2\n'
1402 >
1403 >
1403 > def extsetup(ui):
1404 > def extsetup(ui):
1404 > help.addtopichook('revisions', rewrite)
1405 > help.addtopichook('revisions', rewrite)
1405 > EOF
1406 > EOF
1406 $ echo '[extensions]' >> $HGRCPATH
1407 $ echo '[extensions]' >> $HGRCPATH
1407 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
1408 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
1408 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
1409 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
1409 $ hg help revsets | grep helphook
1410 $ hg help revsets | grep helphook
1410 helphook1
1411 helphook1
1411 helphook2
1412 helphook2
1412
1413
1413 help -c should only show debug --debug
1414 help -c should only show debug --debug
1414
1415
1415 $ hg help -c --debug|egrep debug|wc -l|egrep '^\s*0\s*$'
1416 $ hg help -c --debug|egrep debug|wc -l|egrep '^\s*0\s*$'
1416 [1]
1417 [1]
1417
1418
1418 help -c should only show deprecated for -v
1419 help -c should only show deprecated for -v
1419
1420
1420 $ hg help -c -v|egrep DEPRECATED|wc -l|egrep '^\s*0\s*$'
1421 $ hg help -c -v|egrep DEPRECATED|wc -l|egrep '^\s*0\s*$'
1421 [1]
1422 [1]
1422
1423
1423 Test -s / --system
1424 Test -s / --system
1424
1425
1425 $ hg help config.files -s windows |grep 'etc/mercurial' | \
1426 $ hg help config.files -s windows |grep 'etc/mercurial' | \
1426 > wc -l | sed -e 's/ //g'
1427 > wc -l | sed -e 's/ //g'
1427 0
1428 0
1428 $ hg help config.files --system unix | grep 'USER' | \
1429 $ hg help config.files --system unix | grep 'USER' | \
1429 > wc -l | sed -e 's/ //g'
1430 > wc -l | sed -e 's/ //g'
1430 0
1431 0
1431
1432
1432 Test -e / -c / -k combinations
1433 Test -e / -c / -k combinations
1433
1434
1434 $ hg help -c|egrep '^[A-Z].*:|^ debug'
1435 $ hg help -c|egrep '^[A-Z].*:|^ debug'
1435 Commands:
1436 Commands:
1436 $ hg help -e|egrep '^[A-Z].*:|^ debug'
1437 $ hg help -e|egrep '^[A-Z].*:|^ debug'
1437 Extensions:
1438 Extensions:
1438 $ hg help -k|egrep '^[A-Z].*:|^ debug'
1439 $ hg help -k|egrep '^[A-Z].*:|^ debug'
1439 Topics:
1440 Topics:
1440 Commands:
1441 Commands:
1441 Extensions:
1442 Extensions:
1442 Extension Commands:
1443 Extension Commands:
1443 $ hg help -c schemes
1444 $ hg help -c schemes
1444 abort: no such help topic: schemes
1445 abort: no such help topic: schemes
1445 (try 'hg help --keyword schemes')
1446 (try 'hg help --keyword schemes')
1446 [255]
1447 [255]
1447 $ hg help -e schemes |head -1
1448 $ hg help -e schemes |head -1
1448 schemes extension - extend schemes with shortcuts to repository swarms
1449 schemes extension - extend schemes with shortcuts to repository swarms
1449 $ hg help -c -k dates |egrep '^(Topics|Extensions|Commands):'
1450 $ hg help -c -k dates |egrep '^(Topics|Extensions|Commands):'
1450 Commands:
1451 Commands:
1451 $ hg help -e -k a |egrep '^(Topics|Extensions|Commands):'
1452 $ hg help -e -k a |egrep '^(Topics|Extensions|Commands):'
1452 Extensions:
1453 Extensions:
1453 $ hg help -e -c -k date |egrep '^(Topics|Extensions|Commands):'
1454 $ hg help -e -c -k date |egrep '^(Topics|Extensions|Commands):'
1454 Extensions:
1455 Extensions:
1455 Commands:
1456 Commands:
1456 $ hg help -c commit > /dev/null
1457 $ hg help -c commit > /dev/null
1457 $ hg help -e -c commit > /dev/null
1458 $ hg help -e -c commit > /dev/null
1458 $ hg help -e commit > /dev/null
1459 $ hg help -e commit > /dev/null
1459 abort: no such help topic: commit
1460 abort: no such help topic: commit
1460 (try 'hg help --keyword commit')
1461 (try 'hg help --keyword commit')
1461 [255]
1462 [255]
1462
1463
1463 Test keyword search help
1464 Test keyword search help
1464
1465
1465 $ cat > prefixedname.py <<EOF
1466 $ cat > prefixedname.py <<EOF
1466 > '''matched against word "clone"
1467 > '''matched against word "clone"
1467 > '''
1468 > '''
1468 > EOF
1469 > EOF
1469 $ echo '[extensions]' >> $HGRCPATH
1470 $ echo '[extensions]' >> $HGRCPATH
1470 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
1471 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
1471 $ hg help -k clone
1472 $ hg help -k clone
1472 Topics:
1473 Topics:
1473
1474
1474 config Configuration Files
1475 config Configuration Files
1475 extensions Using Additional Features
1476 extensions Using Additional Features
1476 glossary Glossary
1477 glossary Glossary
1477 phases Working with Phases
1478 phases Working with Phases
1478 subrepos Subrepositories
1479 subrepos Subrepositories
1479 urls URL Paths
1480 urls URL Paths
1480
1481
1481 Commands:
1482 Commands:
1482
1483
1483 bookmarks create a new bookmark or list existing bookmarks
1484 bookmarks create a new bookmark or list existing bookmarks
1484 clone make a copy of an existing repository
1485 clone make a copy of an existing repository
1485 paths show aliases for remote repositories
1486 paths show aliases for remote repositories
1486 update update working directory (or switch revisions)
1487 update update working directory (or switch revisions)
1487
1488
1488 Extensions:
1489 Extensions:
1489
1490
1490 clonebundles advertise pre-generated bundles to seed clones
1491 clonebundles advertise pre-generated bundles to seed clones
1491 prefixedname matched against word "clone"
1492 prefixedname matched against word "clone"
1492 relink recreates hardlinks between repository clones
1493 relink recreates hardlinks between repository clones
1493
1494
1494 Extension Commands:
1495 Extension Commands:
1495
1496
1496 qclone clone main and patch repository at same time
1497 qclone clone main and patch repository at same time
1497
1498
1498 Test unfound topic
1499 Test unfound topic
1499
1500
1500 $ hg help nonexistingtopicthatwillneverexisteverever
1501 $ hg help nonexistingtopicthatwillneverexisteverever
1501 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
1502 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
1502 (try 'hg help --keyword nonexistingtopicthatwillneverexisteverever')
1503 (try 'hg help --keyword nonexistingtopicthatwillneverexisteverever')
1503 [255]
1504 [255]
1504
1505
1505 Test unfound keyword
1506 Test unfound keyword
1506
1507
1507 $ hg help --keyword nonexistingwordthatwillneverexisteverever
1508 $ hg help --keyword nonexistingwordthatwillneverexisteverever
1508 abort: no matches
1509 abort: no matches
1509 (try 'hg help' for a list of topics)
1510 (try 'hg help' for a list of topics)
1510 [255]
1511 [255]
1511
1512
1512 Test omit indicating for help
1513 Test omit indicating for help
1513
1514
1514 $ cat > addverboseitems.py <<EOF
1515 $ cat > addverboseitems.py <<EOF
1515 > '''extension to test omit indicating.
1516 > '''extension to test omit indicating.
1516 >
1517 >
1517 > This paragraph is never omitted (for extension)
1518 > This paragraph is never omitted (for extension)
1518 >
1519 >
1519 > .. container:: verbose
1520 > .. container:: verbose
1520 >
1521 >
1521 > This paragraph is omitted,
1522 > This paragraph is omitted,
1522 > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension)
1523 > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension)
1523 >
1524 >
1524 > This paragraph is never omitted, too (for extension)
1525 > This paragraph is never omitted, too (for extension)
1525 > '''
1526 > '''
1526 > from __future__ import absolute_import
1527 > from __future__ import absolute_import
1527 > from mercurial import commands, help
1528 > from mercurial import commands, help
1528 > testtopic = """This paragraph is never omitted (for topic).
1529 > testtopic = """This paragraph is never omitted (for topic).
1529 >
1530 >
1530 > .. container:: verbose
1531 > .. container:: verbose
1531 >
1532 >
1532 > This paragraph is omitted,
1533 > This paragraph is omitted,
1533 > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic)
1534 > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic)
1534 >
1535 >
1535 > This paragraph is never omitted, too (for topic)
1536 > This paragraph is never omitted, too (for topic)
1536 > """
1537 > """
1537 > def extsetup(ui):
1538 > def extsetup(ui):
1538 > help.helptable.append((["topic-containing-verbose"],
1539 > help.helptable.append((["topic-containing-verbose"],
1539 > "This is the topic to test omit indicating.",
1540 > "This is the topic to test omit indicating.",
1540 > lambda ui: testtopic))
1541 > lambda ui: testtopic))
1541 > EOF
1542 > EOF
1542 $ echo '[extensions]' >> $HGRCPATH
1543 $ echo '[extensions]' >> $HGRCPATH
1543 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1544 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1544 $ hg help addverboseitems
1545 $ hg help addverboseitems
1545 addverboseitems extension - extension to test omit indicating.
1546 addverboseitems extension - extension to test omit indicating.
1546
1547
1547 This paragraph is never omitted (for extension)
1548 This paragraph is never omitted (for extension)
1548
1549
1549 This paragraph is never omitted, too (for extension)
1550 This paragraph is never omitted, too (for extension)
1550
1551
1551 (some details hidden, use --verbose to show complete help)
1552 (some details hidden, use --verbose to show complete help)
1552
1553
1553 no commands defined
1554 no commands defined
1554 $ hg help -v addverboseitems
1555 $ hg help -v addverboseitems
1555 addverboseitems extension - extension to test omit indicating.
1556 addverboseitems extension - extension to test omit indicating.
1556
1557
1557 This paragraph is never omitted (for extension)
1558 This paragraph is never omitted (for extension)
1558
1559
1559 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1560 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1560 extension)
1561 extension)
1561
1562
1562 This paragraph is never omitted, too (for extension)
1563 This paragraph is never omitted, too (for extension)
1563
1564
1564 no commands defined
1565 no commands defined
1565 $ hg help topic-containing-verbose
1566 $ hg help topic-containing-verbose
1566 This is the topic to test omit indicating.
1567 This is the topic to test omit indicating.
1567 """"""""""""""""""""""""""""""""""""""""""
1568 """"""""""""""""""""""""""""""""""""""""""
1568
1569
1569 This paragraph is never omitted (for topic).
1570 This paragraph is never omitted (for topic).
1570
1571
1571 This paragraph is never omitted, too (for topic)
1572 This paragraph is never omitted, too (for topic)
1572
1573
1573 (some details hidden, use --verbose to show complete help)
1574 (some details hidden, use --verbose to show complete help)
1574 $ hg help -v topic-containing-verbose
1575 $ hg help -v topic-containing-verbose
1575 This is the topic to test omit indicating.
1576 This is the topic to test omit indicating.
1576 """"""""""""""""""""""""""""""""""""""""""
1577 """"""""""""""""""""""""""""""""""""""""""
1577
1578
1578 This paragraph is never omitted (for topic).
1579 This paragraph is never omitted (for topic).
1579
1580
1580 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1581 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1581 topic)
1582 topic)
1582
1583
1583 This paragraph is never omitted, too (for topic)
1584 This paragraph is never omitted, too (for topic)
1584
1585
1585 Test section lookup
1586 Test section lookup
1586
1587
1587 $ hg help revset.merge
1588 $ hg help revset.merge
1588 "merge()"
1589 "merge()"
1589 Changeset is a merge changeset.
1590 Changeset is a merge changeset.
1590
1591
1591 $ hg help glossary.dag
1592 $ hg help glossary.dag
1592 DAG
1593 DAG
1593 The repository of changesets of a distributed version control system
1594 The repository of changesets of a distributed version control system
1594 (DVCS) can be described as a directed acyclic graph (DAG), consisting
1595 (DVCS) can be described as a directed acyclic graph (DAG), consisting
1595 of nodes and edges, where nodes correspond to changesets and edges
1596 of nodes and edges, where nodes correspond to changesets and edges
1596 imply a parent -> child relation. This graph can be visualized by
1597 imply a parent -> child relation. This graph can be visualized by
1597 graphical tools such as 'hg log --graph'. In Mercurial, the DAG is
1598 graphical tools such as 'hg log --graph'. In Mercurial, the DAG is
1598 limited by the requirement for children to have at most two parents.
1599 limited by the requirement for children to have at most two parents.
1599
1600
1600
1601
1601 $ hg help hgrc.paths
1602 $ hg help hgrc.paths
1602 "paths"
1603 "paths"
1603 -------
1604 -------
1604
1605
1605 Assigns symbolic names and behavior to repositories.
1606 Assigns symbolic names and behavior to repositories.
1606
1607
1607 Options are symbolic names defining the URL or directory that is the
1608 Options are symbolic names defining the URL or directory that is the
1608 location of the repository. Example:
1609 location of the repository. Example:
1609
1610
1610 [paths]
1611 [paths]
1611 my_server = https://example.com/my_repo
1612 my_server = https://example.com/my_repo
1612 local_path = /home/me/repo
1613 local_path = /home/me/repo
1613
1614
1614 These symbolic names can be used from the command line. To pull from
1615 These symbolic names can be used from the command line. To pull from
1615 "my_server": 'hg pull my_server'. To push to "local_path": 'hg push
1616 "my_server": 'hg pull my_server'. To push to "local_path": 'hg push
1616 local_path'.
1617 local_path'.
1617
1618
1618 Options containing colons (":") denote sub-options that can influence
1619 Options containing colons (":") denote sub-options that can influence
1619 behavior for that specific path. Example:
1620 behavior for that specific path. Example:
1620
1621
1621 [paths]
1622 [paths]
1622 my_server = https://example.com/my_path
1623 my_server = https://example.com/my_path
1623 my_server:pushurl = ssh://example.com/my_path
1624 my_server:pushurl = ssh://example.com/my_path
1624
1625
1625 The following sub-options can be defined:
1626 The following sub-options can be defined:
1626
1627
1627 "pushurl"
1628 "pushurl"
1628 The URL to use for push operations. If not defined, the location
1629 The URL to use for push operations. If not defined, the location
1629 defined by the path's main entry is used.
1630 defined by the path's main entry is used.
1630
1631
1631 "pushrev"
1632 "pushrev"
1632 A revset defining which revisions to push by default.
1633 A revset defining which revisions to push by default.
1633
1634
1634 When 'hg push' is executed without a "-r" argument, the revset defined
1635 When 'hg push' is executed without a "-r" argument, the revset defined
1635 by this sub-option is evaluated to determine what to push.
1636 by this sub-option is evaluated to determine what to push.
1636
1637
1637 For example, a value of "." will push the working directory's revision
1638 For example, a value of "." will push the working directory's revision
1638 by default.
1639 by default.
1639
1640
1640 Revsets specifying bookmarks will not result in the bookmark being
1641 Revsets specifying bookmarks will not result in the bookmark being
1641 pushed.
1642 pushed.
1642
1643
1643 The following special named paths exist:
1644 The following special named paths exist:
1644
1645
1645 "default"
1646 "default"
1646 The URL or directory to use when no source or remote is specified.
1647 The URL or directory to use when no source or remote is specified.
1647
1648
1648 'hg clone' will automatically define this path to the location the
1649 'hg clone' will automatically define this path to the location the
1649 repository was cloned from.
1650 repository was cloned from.
1650
1651
1651 "default-push"
1652 "default-push"
1652 (deprecated) The URL or directory for the default 'hg push' location.
1653 (deprecated) The URL or directory for the default 'hg push' location.
1653 "default:pushurl" should be used instead.
1654 "default:pushurl" should be used instead.
1654
1655
1655 $ hg help glossary.mcguffin
1656 $ hg help glossary.mcguffin
1656 abort: help section not found: glossary.mcguffin
1657 abort: help section not found: glossary.mcguffin
1657 [255]
1658 [255]
1658
1659
1659 $ hg help glossary.mc.guffin
1660 $ hg help glossary.mc.guffin
1660 abort: help section not found: glossary.mc.guffin
1661 abort: help section not found: glossary.mc.guffin
1661 [255]
1662 [255]
1662
1663
1663 $ hg help template.files
1664 $ hg help template.files
1664 files List of strings. All files modified, added, or removed by
1665 files List of strings. All files modified, added, or removed by
1665 this changeset.
1666 this changeset.
1666 files(pattern)
1667 files(pattern)
1667 All files of the current changeset matching the pattern. See
1668 All files of the current changeset matching the pattern. See
1668 'hg help patterns'.
1669 'hg help patterns'.
1669
1670
1670 Test section lookup by translated message
1671 Test section lookup by translated message
1671
1672
1672 str.lower() instead of encoding.lower(str) on translated message might
1673 str.lower() instead of encoding.lower(str) on translated message might
1673 make message meaningless, because some encoding uses 0x41(A) - 0x5a(Z)
1674 make message meaningless, because some encoding uses 0x41(A) - 0x5a(Z)
1674 as the second or later byte of multi-byte character.
1675 as the second or later byte of multi-byte character.
1675
1676
1676 For example, "\x8bL\x98^" (translation of "record" in ja_JP.cp932)
1677 For example, "\x8bL\x98^" (translation of "record" in ja_JP.cp932)
1677 contains 0x4c (L). str.lower() replaces 0x4c(L) by 0x6c(l) and this
1678 contains 0x4c (L). str.lower() replaces 0x4c(L) by 0x6c(l) and this
1678 replacement makes message meaningless.
1679 replacement makes message meaningless.
1679
1680
1680 This tests that section lookup by translated string isn't broken by
1681 This tests that section lookup by translated string isn't broken by
1681 such str.lower().
1682 such str.lower().
1682
1683
1683 $ $PYTHON <<EOF
1684 $ $PYTHON <<EOF
1684 > def escape(s):
1685 > def escape(s):
1685 > return ''.join('\u%x' % ord(uc) for uc in s.decode('cp932'))
1686 > return ''.join('\u%x' % ord(uc) for uc in s.decode('cp932'))
1686 > # translation of "record" in ja_JP.cp932
1687 > # translation of "record" in ja_JP.cp932
1687 > upper = "\x8bL\x98^"
1688 > upper = "\x8bL\x98^"
1688 > # str.lower()-ed section name should be treated as different one
1689 > # str.lower()-ed section name should be treated as different one
1689 > lower = "\x8bl\x98^"
1690 > lower = "\x8bl\x98^"
1690 > with open('ambiguous.py', 'w') as fp:
1691 > with open('ambiguous.py', 'w') as fp:
1691 > fp.write("""# ambiguous section names in ja_JP.cp932
1692 > fp.write("""# ambiguous section names in ja_JP.cp932
1692 > u'''summary of extension
1693 > u'''summary of extension
1693 >
1694 >
1694 > %s
1695 > %s
1695 > ----
1696 > ----
1696 >
1697 >
1697 > Upper name should show only this message
1698 > Upper name should show only this message
1698 >
1699 >
1699 > %s
1700 > %s
1700 > ----
1701 > ----
1701 >
1702 >
1702 > Lower name should show only this message
1703 > Lower name should show only this message
1703 >
1704 >
1704 > subsequent section
1705 > subsequent section
1705 > ------------------
1706 > ------------------
1706 >
1707 >
1707 > This should be hidden at 'hg help ambiguous' with section name.
1708 > This should be hidden at 'hg help ambiguous' with section name.
1708 > '''
1709 > '''
1709 > """ % (escape(upper), escape(lower)))
1710 > """ % (escape(upper), escape(lower)))
1710 > EOF
1711 > EOF
1711
1712
1712 $ cat >> $HGRCPATH <<EOF
1713 $ cat >> $HGRCPATH <<EOF
1713 > [extensions]
1714 > [extensions]
1714 > ambiguous = ./ambiguous.py
1715 > ambiguous = ./ambiguous.py
1715 > EOF
1716 > EOF
1716
1717
1717 $ $PYTHON <<EOF | sh
1718 $ $PYTHON <<EOF | sh
1718 > upper = "\x8bL\x98^"
1719 > upper = "\x8bL\x98^"
1719 > print("hg --encoding cp932 help -e ambiguous.%s" % upper)
1720 > print("hg --encoding cp932 help -e ambiguous.%s" % upper)
1720 > EOF
1721 > EOF
1721 \x8bL\x98^ (esc)
1722 \x8bL\x98^ (esc)
1722 ----
1723 ----
1723
1724
1724 Upper name should show only this message
1725 Upper name should show only this message
1725
1726
1726
1727
1727 $ $PYTHON <<EOF | sh
1728 $ $PYTHON <<EOF | sh
1728 > lower = "\x8bl\x98^"
1729 > lower = "\x8bl\x98^"
1729 > print("hg --encoding cp932 help -e ambiguous.%s" % lower)
1730 > print("hg --encoding cp932 help -e ambiguous.%s" % lower)
1730 > EOF
1731 > EOF
1731 \x8bl\x98^ (esc)
1732 \x8bl\x98^ (esc)
1732 ----
1733 ----
1733
1734
1734 Lower name should show only this message
1735 Lower name should show only this message
1735
1736
1736
1737
1737 $ cat >> $HGRCPATH <<EOF
1738 $ cat >> $HGRCPATH <<EOF
1738 > [extensions]
1739 > [extensions]
1739 > ambiguous = !
1740 > ambiguous = !
1740 > EOF
1741 > EOF
1741
1742
1742 Show help content of disabled extensions
1743 Show help content of disabled extensions
1743
1744
1744 $ cat >> $HGRCPATH <<EOF
1745 $ cat >> $HGRCPATH <<EOF
1745 > [extensions]
1746 > [extensions]
1746 > ambiguous = !./ambiguous.py
1747 > ambiguous = !./ambiguous.py
1747 > EOF
1748 > EOF
1748 $ hg help -e ambiguous
1749 $ hg help -e ambiguous
1749 ambiguous extension - (no help text available)
1750 ambiguous extension - (no help text available)
1750
1751
1751 (use 'hg help extensions' for information on enabling extensions)
1752 (use 'hg help extensions' for information on enabling extensions)
1752
1753
1753 Test dynamic list of merge tools only shows up once
1754 Test dynamic list of merge tools only shows up once
1754 $ hg help merge-tools
1755 $ hg help merge-tools
1755 Merge Tools
1756 Merge Tools
1756 """""""""""
1757 """""""""""
1757
1758
1758 To merge files Mercurial uses merge tools.
1759 To merge files Mercurial uses merge tools.
1759
1760
1760 A merge tool combines two different versions of a file into a merged file.
1761 A merge tool combines two different versions of a file into a merged file.
1761 Merge tools are given the two files and the greatest common ancestor of
1762 Merge tools are given the two files and the greatest common ancestor of
1762 the two file versions, so they can determine the changes made on both
1763 the two file versions, so they can determine the changes made on both
1763 branches.
1764 branches.
1764
1765
1765 Merge tools are used both for 'hg resolve', 'hg merge', 'hg update', 'hg
1766 Merge tools are used both for 'hg resolve', 'hg merge', 'hg update', 'hg
1766 backout' and in several extensions.
1767 backout' and in several extensions.
1767
1768
1768 Usually, the merge tool tries to automatically reconcile the files by
1769 Usually, the merge tool tries to automatically reconcile the files by
1769 combining all non-overlapping changes that occurred separately in the two
1770 combining all non-overlapping changes that occurred separately in the two
1770 different evolutions of the same initial base file. Furthermore, some
1771 different evolutions of the same initial base file. Furthermore, some
1771 interactive merge programs make it easier to manually resolve conflicting
1772 interactive merge programs make it easier to manually resolve conflicting
1772 merges, either in a graphical way, or by inserting some conflict markers.
1773 merges, either in a graphical way, or by inserting some conflict markers.
1773 Mercurial does not include any interactive merge programs but relies on
1774 Mercurial does not include any interactive merge programs but relies on
1774 external tools for that.
1775 external tools for that.
1775
1776
1776 Available merge tools
1777 Available merge tools
1777 =====================
1778 =====================
1778
1779
1779 External merge tools and their properties are configured in the merge-
1780 External merge tools and their properties are configured in the merge-
1780 tools configuration section - see hgrc(5) - but they can often just be
1781 tools configuration section - see hgrc(5) - but they can often just be
1781 named by their executable.
1782 named by their executable.
1782
1783
1783 A merge tool is generally usable if its executable can be found on the
1784 A merge tool is generally usable if its executable can be found on the
1784 system and if it can handle the merge. The executable is found if it is an
1785 system and if it can handle the merge. The executable is found if it is an
1785 absolute or relative executable path or the name of an application in the
1786 absolute or relative executable path or the name of an application in the
1786 executable search path. The tool is assumed to be able to handle the merge
1787 executable search path. The tool is assumed to be able to handle the merge
1787 if it can handle symlinks if the file is a symlink, if it can handle
1788 if it can handle symlinks if the file is a symlink, if it can handle
1788 binary files if the file is binary, and if a GUI is available if the tool
1789 binary files if the file is binary, and if a GUI is available if the tool
1789 requires a GUI.
1790 requires a GUI.
1790
1791
1791 There are some internal merge tools which can be used. The internal merge
1792 There are some internal merge tools which can be used. The internal merge
1792 tools are:
1793 tools are:
1793
1794
1794 ":dump"
1795 ":dump"
1795 Creates three versions of the files to merge, containing the contents of
1796 Creates three versions of the files to merge, containing the contents of
1796 local, other and base. These files can then be used to perform a merge
1797 local, other and base. These files can then be used to perform a merge
1797 manually. If the file to be merged is named "a.txt", these files will
1798 manually. If the file to be merged is named "a.txt", these files will
1798 accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and
1799 accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and
1799 they will be placed in the same directory as "a.txt".
1800 they will be placed in the same directory as "a.txt".
1800
1801
1801 This implies premerge. Therefore, files aren't dumped, if premerge runs
1802 This implies premerge. Therefore, files aren't dumped, if premerge runs
1802 successfully. Use :forcedump to forcibly write files out.
1803 successfully. Use :forcedump to forcibly write files out.
1803
1804
1804 ":fail"
1805 ":fail"
1805 Rather than attempting to merge files that were modified on both
1806 Rather than attempting to merge files that were modified on both
1806 branches, it marks them as unresolved. The resolve command must be used
1807 branches, it marks them as unresolved. The resolve command must be used
1807 to resolve these conflicts.
1808 to resolve these conflicts.
1808
1809
1809 ":forcedump"
1810 ":forcedump"
1810 Creates three versions of the files as same as :dump, but omits
1811 Creates three versions of the files as same as :dump, but omits
1811 premerge.
1812 premerge.
1812
1813
1813 ":local"
1814 ":local"
1814 Uses the local 'p1()' version of files as the merged version.
1815 Uses the local 'p1()' version of files as the merged version.
1815
1816
1816 ":merge"
1817 ":merge"
1817 Uses the internal non-interactive simple merge algorithm for merging
1818 Uses the internal non-interactive simple merge algorithm for merging
1818 files. It will fail if there are any conflicts and leave markers in the
1819 files. It will fail if there are any conflicts and leave markers in the
1819 partially merged file. Markers will have two sections, one for each side
1820 partially merged file. Markers will have two sections, one for each side
1820 of merge.
1821 of merge.
1821
1822
1822 ":merge-local"
1823 ":merge-local"
1823 Like :merge, but resolve all conflicts non-interactively in favor of the
1824 Like :merge, but resolve all conflicts non-interactively in favor of the
1824 local 'p1()' changes.
1825 local 'p1()' changes.
1825
1826
1826 ":merge-other"
1827 ":merge-other"
1827 Like :merge, but resolve all conflicts non-interactively in favor of the
1828 Like :merge, but resolve all conflicts non-interactively in favor of the
1828 other 'p2()' changes.
1829 other 'p2()' changes.
1829
1830
1830 ":merge3"
1831 ":merge3"
1831 Uses the internal non-interactive simple merge algorithm for merging
1832 Uses the internal non-interactive simple merge algorithm for merging
1832 files. It will fail if there are any conflicts and leave markers in the
1833 files. It will fail if there are any conflicts and leave markers in the
1833 partially merged file. Marker will have three sections, one from each
1834 partially merged file. Marker will have three sections, one from each
1834 side of the merge and one for the base content.
1835 side of the merge and one for the base content.
1835
1836
1836 ":other"
1837 ":other"
1837 Uses the other 'p2()' version of files as the merged version.
1838 Uses the other 'p2()' version of files as the merged version.
1838
1839
1839 ":prompt"
1840 ":prompt"
1840 Asks the user which of the local 'p1()' or the other 'p2()' version to
1841 Asks the user which of the local 'p1()' or the other 'p2()' version to
1841 keep as the merged version.
1842 keep as the merged version.
1842
1843
1843 ":tagmerge"
1844 ":tagmerge"
1844 Uses the internal tag merge algorithm (experimental).
1845 Uses the internal tag merge algorithm (experimental).
1845
1846
1846 ":union"
1847 ":union"
1847 Uses the internal non-interactive simple merge algorithm for merging
1848 Uses the internal non-interactive simple merge algorithm for merging
1848 files. It will use both left and right sides for conflict regions. No
1849 files. It will use both left and right sides for conflict regions. No
1849 markers are inserted.
1850 markers are inserted.
1850
1851
1851 Internal tools are always available and do not require a GUI but will by
1852 Internal tools are always available and do not require a GUI but will by
1852 default not handle symlinks or binary files.
1853 default not handle symlinks or binary files.
1853
1854
1854 Choosing a merge tool
1855 Choosing a merge tool
1855 =====================
1856 =====================
1856
1857
1857 Mercurial uses these rules when deciding which merge tool to use:
1858 Mercurial uses these rules when deciding which merge tool to use:
1858
1859
1859 1. If a tool has been specified with the --tool option to merge or
1860 1. If a tool has been specified with the --tool option to merge or
1860 resolve, it is used. If it is the name of a tool in the merge-tools
1861 resolve, it is used. If it is the name of a tool in the merge-tools
1861 configuration, its configuration is used. Otherwise the specified tool
1862 configuration, its configuration is used. Otherwise the specified tool
1862 must be executable by the shell.
1863 must be executable by the shell.
1863 2. If the "HGMERGE" environment variable is present, its value is used and
1864 2. If the "HGMERGE" environment variable is present, its value is used and
1864 must be executable by the shell.
1865 must be executable by the shell.
1865 3. If the filename of the file to be merged matches any of the patterns in
1866 3. If the filename of the file to be merged matches any of the patterns in
1866 the merge-patterns configuration section, the first usable merge tool
1867 the merge-patterns configuration section, the first usable merge tool
1867 corresponding to a matching pattern is used. Here, binary capabilities
1868 corresponding to a matching pattern is used. Here, binary capabilities
1868 of the merge tool are not considered.
1869 of the merge tool are not considered.
1869 4. If ui.merge is set it will be considered next. If the value is not the
1870 4. If ui.merge is set it will be considered next. If the value is not the
1870 name of a configured tool, the specified value is used and must be
1871 name of a configured tool, the specified value is used and must be
1871 executable by the shell. Otherwise the named tool is used if it is
1872 executable by the shell. Otherwise the named tool is used if it is
1872 usable.
1873 usable.
1873 5. If any usable merge tools are present in the merge-tools configuration
1874 5. If any usable merge tools are present in the merge-tools configuration
1874 section, the one with the highest priority is used.
1875 section, the one with the highest priority is used.
1875 6. If a program named "hgmerge" can be found on the system, it is used -
1876 6. If a program named "hgmerge" can be found on the system, it is used -
1876 but it will by default not be used for symlinks and binary files.
1877 but it will by default not be used for symlinks and binary files.
1877 7. If the file to be merged is not binary and is not a symlink, then
1878 7. If the file to be merged is not binary and is not a symlink, then
1878 internal ":merge" is used.
1879 internal ":merge" is used.
1879 8. Otherwise, ":prompt" is used.
1880 8. Otherwise, ":prompt" is used.
1880
1881
1881 Note:
1882 Note:
1882 After selecting a merge program, Mercurial will by default attempt to
1883 After selecting a merge program, Mercurial will by default attempt to
1883 merge the files using a simple merge algorithm first. Only if it
1884 merge the files using a simple merge algorithm first. Only if it
1884 doesn't succeed because of conflicting changes will Mercurial actually
1885 doesn't succeed because of conflicting changes will Mercurial actually
1885 execute the merge program. Whether to use the simple merge algorithm
1886 execute the merge program. Whether to use the simple merge algorithm
1886 first can be controlled by the premerge setting of the merge tool.
1887 first can be controlled by the premerge setting of the merge tool.
1887 Premerge is enabled by default unless the file is binary or a symlink.
1888 Premerge is enabled by default unless the file is binary or a symlink.
1888
1889
1889 See the merge-tools and ui sections of hgrc(5) for details on the
1890 See the merge-tools and ui sections of hgrc(5) for details on the
1890 configuration of merge tools.
1891 configuration of merge tools.
1891
1892
1892 Compression engines listed in `hg help bundlespec`
1893 Compression engines listed in `hg help bundlespec`
1893
1894
1894 $ hg help bundlespec | grep gzip
1895 $ hg help bundlespec | grep gzip
1895 "v1" bundles can only use the "gzip", "bzip2", and "none" compression
1896 "v1" bundles can only use the "gzip", "bzip2", and "none" compression
1896 An algorithm that produces smaller bundles than "gzip".
1897 An algorithm that produces smaller bundles than "gzip".
1897 This engine will likely produce smaller bundles than "gzip" but will be
1898 This engine will likely produce smaller bundles than "gzip" but will be
1898 "gzip"
1899 "gzip"
1899 better compression than "gzip". It also frequently yields better (?)
1900 better compression than "gzip". It also frequently yields better (?)
1900
1901
1901 Test usage of section marks in help documents
1902 Test usage of section marks in help documents
1902
1903
1903 $ cd "$TESTDIR"/../doc
1904 $ cd "$TESTDIR"/../doc
1904 $ $PYTHON check-seclevel.py
1905 $ $PYTHON check-seclevel.py
1905 $ cd $TESTTMP
1906 $ cd $TESTTMP
1906
1907
1907 #if serve
1908 #if serve
1908
1909
1909 Test the help pages in hgweb.
1910 Test the help pages in hgweb.
1910
1911
1911 Dish up an empty repo; serve it cold.
1912 Dish up an empty repo; serve it cold.
1912
1913
1913 $ hg init "$TESTTMP/test"
1914 $ hg init "$TESTTMP/test"
1914 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
1915 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
1915 $ cat hg.pid >> $DAEMON_PIDS
1916 $ cat hg.pid >> $DAEMON_PIDS
1916
1917
1917 $ get-with-headers.py $LOCALIP:$HGPORT "help"
1918 $ get-with-headers.py $LOCALIP:$HGPORT "help"
1918 200 Script output follows
1919 200 Script output follows
1919
1920
1920 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1921 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1921 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1922 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1922 <head>
1923 <head>
1923 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1924 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1924 <meta name="robots" content="index, nofollow" />
1925 <meta name="robots" content="index, nofollow" />
1925 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1926 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1926 <script type="text/javascript" src="/static/mercurial.js"></script>
1927 <script type="text/javascript" src="/static/mercurial.js"></script>
1927
1928
1928 <title>Help: Index</title>
1929 <title>Help: Index</title>
1929 </head>
1930 </head>
1930 <body>
1931 <body>
1931
1932
1932 <div class="container">
1933 <div class="container">
1933 <div class="menu">
1934 <div class="menu">
1934 <div class="logo">
1935 <div class="logo">
1935 <a href="https://mercurial-scm.org/">
1936 <a href="https://mercurial-scm.org/">
1936 <img src="/static/hglogo.png" alt="mercurial" /></a>
1937 <img src="/static/hglogo.png" alt="mercurial" /></a>
1937 </div>
1938 </div>
1938 <ul>
1939 <ul>
1939 <li><a href="/shortlog">log</a></li>
1940 <li><a href="/shortlog">log</a></li>
1940 <li><a href="/graph">graph</a></li>
1941 <li><a href="/graph">graph</a></li>
1941 <li><a href="/tags">tags</a></li>
1942 <li><a href="/tags">tags</a></li>
1942 <li><a href="/bookmarks">bookmarks</a></li>
1943 <li><a href="/bookmarks">bookmarks</a></li>
1943 <li><a href="/branches">branches</a></li>
1944 <li><a href="/branches">branches</a></li>
1944 </ul>
1945 </ul>
1945 <ul>
1946 <ul>
1946 <li class="active">help</li>
1947 <li class="active">help</li>
1947 </ul>
1948 </ul>
1948 </div>
1949 </div>
1949
1950
1950 <div class="main">
1951 <div class="main">
1951 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1952 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1952
1953
1953 <form class="search" action="/log">
1954 <form class="search" action="/log">
1954
1955
1955 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
1956 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
1956 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1957 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1957 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1958 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1958 </form>
1959 </form>
1959 <table class="bigtable">
1960 <table class="bigtable">
1960 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
1961 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
1961
1962
1962 <tr><td>
1963 <tr><td>
1963 <a href="/help/bundlespec">
1964 <a href="/help/bundlespec">
1964 bundlespec
1965 bundlespec
1965 </a>
1966 </a>
1966 </td><td>
1967 </td><td>
1967 Bundle File Formats
1968 Bundle File Formats
1968 </td></tr>
1969 </td></tr>
1969 <tr><td>
1970 <tr><td>
1970 <a href="/help/color">
1971 <a href="/help/color">
1971 color
1972 color
1972 </a>
1973 </a>
1973 </td><td>
1974 </td><td>
1974 Colorizing Outputs
1975 Colorizing Outputs
1975 </td></tr>
1976 </td></tr>
1976 <tr><td>
1977 <tr><td>
1977 <a href="/help/config">
1978 <a href="/help/config">
1978 config
1979 config
1979 </a>
1980 </a>
1980 </td><td>
1981 </td><td>
1981 Configuration Files
1982 Configuration Files
1982 </td></tr>
1983 </td></tr>
1983 <tr><td>
1984 <tr><td>
1984 <a href="/help/dates">
1985 <a href="/help/dates">
1985 dates
1986 dates
1986 </a>
1987 </a>
1987 </td><td>
1988 </td><td>
1988 Date Formats
1989 Date Formats
1989 </td></tr>
1990 </td></tr>
1990 <tr><td>
1991 <tr><td>
1991 <a href="/help/diffs">
1992 <a href="/help/diffs">
1992 diffs
1993 diffs
1993 </a>
1994 </a>
1994 </td><td>
1995 </td><td>
1995 Diff Formats
1996 Diff Formats
1996 </td></tr>
1997 </td></tr>
1997 <tr><td>
1998 <tr><td>
1998 <a href="/help/environment">
1999 <a href="/help/environment">
1999 environment
2000 environment
2000 </a>
2001 </a>
2001 </td><td>
2002 </td><td>
2002 Environment Variables
2003 Environment Variables
2003 </td></tr>
2004 </td></tr>
2004 <tr><td>
2005 <tr><td>
2005 <a href="/help/extensions">
2006 <a href="/help/extensions">
2006 extensions
2007 extensions
2007 </a>
2008 </a>
2008 </td><td>
2009 </td><td>
2009 Using Additional Features
2010 Using Additional Features
2010 </td></tr>
2011 </td></tr>
2011 <tr><td>
2012 <tr><td>
2012 <a href="/help/filesets">
2013 <a href="/help/filesets">
2013 filesets
2014 filesets
2014 </a>
2015 </a>
2015 </td><td>
2016 </td><td>
2016 Specifying File Sets
2017 Specifying File Sets
2017 </td></tr>
2018 </td></tr>
2018 <tr><td>
2019 <tr><td>
2019 <a href="/help/flags">
2020 <a href="/help/flags">
2020 flags
2021 flags
2021 </a>
2022 </a>
2022 </td><td>
2023 </td><td>
2023 Command-line flags
2024 Command-line flags
2024 </td></tr>
2025 </td></tr>
2025 <tr><td>
2026 <tr><td>
2026 <a href="/help/glossary">
2027 <a href="/help/glossary">
2027 glossary
2028 glossary
2028 </a>
2029 </a>
2029 </td><td>
2030 </td><td>
2030 Glossary
2031 Glossary
2031 </td></tr>
2032 </td></tr>
2032 <tr><td>
2033 <tr><td>
2033 <a href="/help/hgignore">
2034 <a href="/help/hgignore">
2034 hgignore
2035 hgignore
2035 </a>
2036 </a>
2036 </td><td>
2037 </td><td>
2037 Syntax for Mercurial Ignore Files
2038 Syntax for Mercurial Ignore Files
2038 </td></tr>
2039 </td></tr>
2039 <tr><td>
2040 <tr><td>
2040 <a href="/help/hgweb">
2041 <a href="/help/hgweb">
2041 hgweb
2042 hgweb
2042 </a>
2043 </a>
2043 </td><td>
2044 </td><td>
2044 Configuring hgweb
2045 Configuring hgweb
2045 </td></tr>
2046 </td></tr>
2046 <tr><td>
2047 <tr><td>
2047 <a href="/help/internals">
2048 <a href="/help/internals">
2048 internals
2049 internals
2049 </a>
2050 </a>
2050 </td><td>
2051 </td><td>
2051 Technical implementation topics
2052 Technical implementation topics
2052 </td></tr>
2053 </td></tr>
2053 <tr><td>
2054 <tr><td>
2054 <a href="/help/merge-tools">
2055 <a href="/help/merge-tools">
2055 merge-tools
2056 merge-tools
2056 </a>
2057 </a>
2057 </td><td>
2058 </td><td>
2058 Merge Tools
2059 Merge Tools
2059 </td></tr>
2060 </td></tr>
2060 <tr><td>
2061 <tr><td>
2061 <a href="/help/pager">
2062 <a href="/help/pager">
2062 pager
2063 pager
2063 </a>
2064 </a>
2064 </td><td>
2065 </td><td>
2065 Pager Support
2066 Pager Support
2066 </td></tr>
2067 </td></tr>
2067 <tr><td>
2068 <tr><td>
2068 <a href="/help/patterns">
2069 <a href="/help/patterns">
2069 patterns
2070 patterns
2070 </a>
2071 </a>
2071 </td><td>
2072 </td><td>
2072 File Name Patterns
2073 File Name Patterns
2073 </td></tr>
2074 </td></tr>
2074 <tr><td>
2075 <tr><td>
2075 <a href="/help/phases">
2076 <a href="/help/phases">
2076 phases
2077 phases
2077 </a>
2078 </a>
2078 </td><td>
2079 </td><td>
2079 Working with Phases
2080 Working with Phases
2080 </td></tr>
2081 </td></tr>
2081 <tr><td>
2082 <tr><td>
2082 <a href="/help/revisions">
2083 <a href="/help/revisions">
2083 revisions
2084 revisions
2084 </a>
2085 </a>
2085 </td><td>
2086 </td><td>
2086 Specifying Revisions
2087 Specifying Revisions
2087 </td></tr>
2088 </td></tr>
2088 <tr><td>
2089 <tr><td>
2089 <a href="/help/scripting">
2090 <a href="/help/scripting">
2090 scripting
2091 scripting
2091 </a>
2092 </a>
2092 </td><td>
2093 </td><td>
2093 Using Mercurial from scripts and automation
2094 Using Mercurial from scripts and automation
2094 </td></tr>
2095 </td></tr>
2095 <tr><td>
2096 <tr><td>
2096 <a href="/help/subrepos">
2097 <a href="/help/subrepos">
2097 subrepos
2098 subrepos
2098 </a>
2099 </a>
2099 </td><td>
2100 </td><td>
2100 Subrepositories
2101 Subrepositories
2101 </td></tr>
2102 </td></tr>
2102 <tr><td>
2103 <tr><td>
2103 <a href="/help/templating">
2104 <a href="/help/templating">
2104 templating
2105 templating
2105 </a>
2106 </a>
2106 </td><td>
2107 </td><td>
2107 Template Usage
2108 Template Usage
2108 </td></tr>
2109 </td></tr>
2109 <tr><td>
2110 <tr><td>
2110 <a href="/help/urls">
2111 <a href="/help/urls">
2111 urls
2112 urls
2112 </a>
2113 </a>
2113 </td><td>
2114 </td><td>
2114 URL Paths
2115 URL Paths
2115 </td></tr>
2116 </td></tr>
2116 <tr><td>
2117 <tr><td>
2117 <a href="/help/topic-containing-verbose">
2118 <a href="/help/topic-containing-verbose">
2118 topic-containing-verbose
2119 topic-containing-verbose
2119 </a>
2120 </a>
2120 </td><td>
2121 </td><td>
2121 This is the topic to test omit indicating.
2122 This is the topic to test omit indicating.
2122 </td></tr>
2123 </td></tr>
2123
2124
2124
2125
2125 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
2126 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
2126
2127
2127 <tr><td>
2128 <tr><td>
2128 <a href="/help/add">
2129 <a href="/help/add">
2129 add
2130 add
2130 </a>
2131 </a>
2131 </td><td>
2132 </td><td>
2132 add the specified files on the next commit
2133 add the specified files on the next commit
2133 </td></tr>
2134 </td></tr>
2134 <tr><td>
2135 <tr><td>
2135 <a href="/help/annotate">
2136 <a href="/help/annotate">
2136 annotate
2137 annotate
2137 </a>
2138 </a>
2138 </td><td>
2139 </td><td>
2139 show changeset information by line for each file
2140 show changeset information by line for each file
2140 </td></tr>
2141 </td></tr>
2141 <tr><td>
2142 <tr><td>
2142 <a href="/help/clone">
2143 <a href="/help/clone">
2143 clone
2144 clone
2144 </a>
2145 </a>
2145 </td><td>
2146 </td><td>
2146 make a copy of an existing repository
2147 make a copy of an existing repository
2147 </td></tr>
2148 </td></tr>
2148 <tr><td>
2149 <tr><td>
2149 <a href="/help/commit">
2150 <a href="/help/commit">
2150 commit
2151 commit
2151 </a>
2152 </a>
2152 </td><td>
2153 </td><td>
2153 commit the specified files or all outstanding changes
2154 commit the specified files or all outstanding changes
2154 </td></tr>
2155 </td></tr>
2155 <tr><td>
2156 <tr><td>
2156 <a href="/help/diff">
2157 <a href="/help/diff">
2157 diff
2158 diff
2158 </a>
2159 </a>
2159 </td><td>
2160 </td><td>
2160 diff repository (or selected files)
2161 diff repository (or selected files)
2161 </td></tr>
2162 </td></tr>
2162 <tr><td>
2163 <tr><td>
2163 <a href="/help/export">
2164 <a href="/help/export">
2164 export
2165 export
2165 </a>
2166 </a>
2166 </td><td>
2167 </td><td>
2167 dump the header and diffs for one or more changesets
2168 dump the header and diffs for one or more changesets
2168 </td></tr>
2169 </td></tr>
2169 <tr><td>
2170 <tr><td>
2170 <a href="/help/forget">
2171 <a href="/help/forget">
2171 forget
2172 forget
2172 </a>
2173 </a>
2173 </td><td>
2174 </td><td>
2174 forget the specified files on the next commit
2175 forget the specified files on the next commit
2175 </td></tr>
2176 </td></tr>
2176 <tr><td>
2177 <tr><td>
2177 <a href="/help/init">
2178 <a href="/help/init">
2178 init
2179 init
2179 </a>
2180 </a>
2180 </td><td>
2181 </td><td>
2181 create a new repository in the given directory
2182 create a new repository in the given directory
2182 </td></tr>
2183 </td></tr>
2183 <tr><td>
2184 <tr><td>
2184 <a href="/help/log">
2185 <a href="/help/log">
2185 log
2186 log
2186 </a>
2187 </a>
2187 </td><td>
2188 </td><td>
2188 show revision history of entire repository or files
2189 show revision history of entire repository or files
2189 </td></tr>
2190 </td></tr>
2190 <tr><td>
2191 <tr><td>
2191 <a href="/help/merge">
2192 <a href="/help/merge">
2192 merge
2193 merge
2193 </a>
2194 </a>
2194 </td><td>
2195 </td><td>
2195 merge another revision into working directory
2196 merge another revision into working directory
2196 </td></tr>
2197 </td></tr>
2197 <tr><td>
2198 <tr><td>
2198 <a href="/help/pull">
2199 <a href="/help/pull">
2199 pull
2200 pull
2200 </a>
2201 </a>
2201 </td><td>
2202 </td><td>
2202 pull changes from the specified source
2203 pull changes from the specified source
2203 </td></tr>
2204 </td></tr>
2204 <tr><td>
2205 <tr><td>
2205 <a href="/help/push">
2206 <a href="/help/push">
2206 push
2207 push
2207 </a>
2208 </a>
2208 </td><td>
2209 </td><td>
2209 push changes to the specified destination
2210 push changes to the specified destination
2210 </td></tr>
2211 </td></tr>
2211 <tr><td>
2212 <tr><td>
2212 <a href="/help/remove">
2213 <a href="/help/remove">
2213 remove
2214 remove
2214 </a>
2215 </a>
2215 </td><td>
2216 </td><td>
2216 remove the specified files on the next commit
2217 remove the specified files on the next commit
2217 </td></tr>
2218 </td></tr>
2218 <tr><td>
2219 <tr><td>
2219 <a href="/help/serve">
2220 <a href="/help/serve">
2220 serve
2221 serve
2221 </a>
2222 </a>
2222 </td><td>
2223 </td><td>
2223 start stand-alone webserver
2224 start stand-alone webserver
2224 </td></tr>
2225 </td></tr>
2225 <tr><td>
2226 <tr><td>
2226 <a href="/help/status">
2227 <a href="/help/status">
2227 status
2228 status
2228 </a>
2229 </a>
2229 </td><td>
2230 </td><td>
2230 show changed files in the working directory
2231 show changed files in the working directory
2231 </td></tr>
2232 </td></tr>
2232 <tr><td>
2233 <tr><td>
2233 <a href="/help/summary">
2234 <a href="/help/summary">
2234 summary
2235 summary
2235 </a>
2236 </a>
2236 </td><td>
2237 </td><td>
2237 summarize working directory state
2238 summarize working directory state
2238 </td></tr>
2239 </td></tr>
2239 <tr><td>
2240 <tr><td>
2240 <a href="/help/update">
2241 <a href="/help/update">
2241 update
2242 update
2242 </a>
2243 </a>
2243 </td><td>
2244 </td><td>
2244 update working directory (or switch revisions)
2245 update working directory (or switch revisions)
2245 </td></tr>
2246 </td></tr>
2246
2247
2247
2248
2248
2249
2249 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
2250 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
2250
2251
2251 <tr><td>
2252 <tr><td>
2252 <a href="/help/addremove">
2253 <a href="/help/addremove">
2253 addremove
2254 addremove
2254 </a>
2255 </a>
2255 </td><td>
2256 </td><td>
2256 add all new files, delete all missing files
2257 add all new files, delete all missing files
2257 </td></tr>
2258 </td></tr>
2258 <tr><td>
2259 <tr><td>
2259 <a href="/help/archive">
2260 <a href="/help/archive">
2260 archive
2261 archive
2261 </a>
2262 </a>
2262 </td><td>
2263 </td><td>
2263 create an unversioned archive of a repository revision
2264 create an unversioned archive of a repository revision
2264 </td></tr>
2265 </td></tr>
2265 <tr><td>
2266 <tr><td>
2266 <a href="/help/backout">
2267 <a href="/help/backout">
2267 backout
2268 backout
2268 </a>
2269 </a>
2269 </td><td>
2270 </td><td>
2270 reverse effect of earlier changeset
2271 reverse effect of earlier changeset
2271 </td></tr>
2272 </td></tr>
2272 <tr><td>
2273 <tr><td>
2273 <a href="/help/bisect">
2274 <a href="/help/bisect">
2274 bisect
2275 bisect
2275 </a>
2276 </a>
2276 </td><td>
2277 </td><td>
2277 subdivision search of changesets
2278 subdivision search of changesets
2278 </td></tr>
2279 </td></tr>
2279 <tr><td>
2280 <tr><td>
2280 <a href="/help/bookmarks">
2281 <a href="/help/bookmarks">
2281 bookmarks
2282 bookmarks
2282 </a>
2283 </a>
2283 </td><td>
2284 </td><td>
2284 create a new bookmark or list existing bookmarks
2285 create a new bookmark or list existing bookmarks
2285 </td></tr>
2286 </td></tr>
2286 <tr><td>
2287 <tr><td>
2287 <a href="/help/branch">
2288 <a href="/help/branch">
2288 branch
2289 branch
2289 </a>
2290 </a>
2290 </td><td>
2291 </td><td>
2291 set or show the current branch name
2292 set or show the current branch name
2292 </td></tr>
2293 </td></tr>
2293 <tr><td>
2294 <tr><td>
2294 <a href="/help/branches">
2295 <a href="/help/branches">
2295 branches
2296 branches
2296 </a>
2297 </a>
2297 </td><td>
2298 </td><td>
2298 list repository named branches
2299 list repository named branches
2299 </td></tr>
2300 </td></tr>
2300 <tr><td>
2301 <tr><td>
2301 <a href="/help/bundle">
2302 <a href="/help/bundle">
2302 bundle
2303 bundle
2303 </a>
2304 </a>
2304 </td><td>
2305 </td><td>
2305 create a bundle file
2306 create a bundle file
2306 </td></tr>
2307 </td></tr>
2307 <tr><td>
2308 <tr><td>
2308 <a href="/help/cat">
2309 <a href="/help/cat">
2309 cat
2310 cat
2310 </a>
2311 </a>
2311 </td><td>
2312 </td><td>
2312 output the current or given revision of files
2313 output the current or given revision of files
2313 </td></tr>
2314 </td></tr>
2314 <tr><td>
2315 <tr><td>
2315 <a href="/help/config">
2316 <a href="/help/config">
2316 config
2317 config
2317 </a>
2318 </a>
2318 </td><td>
2319 </td><td>
2319 show combined config settings from all hgrc files
2320 show combined config settings from all hgrc files
2320 </td></tr>
2321 </td></tr>
2321 <tr><td>
2322 <tr><td>
2322 <a href="/help/copy">
2323 <a href="/help/copy">
2323 copy
2324 copy
2324 </a>
2325 </a>
2325 </td><td>
2326 </td><td>
2326 mark files as copied for the next commit
2327 mark files as copied for the next commit
2327 </td></tr>
2328 </td></tr>
2328 <tr><td>
2329 <tr><td>
2329 <a href="/help/files">
2330 <a href="/help/files">
2330 files
2331 files
2331 </a>
2332 </a>
2332 </td><td>
2333 </td><td>
2333 list tracked files
2334 list tracked files
2334 </td></tr>
2335 </td></tr>
2335 <tr><td>
2336 <tr><td>
2336 <a href="/help/graft">
2337 <a href="/help/graft">
2337 graft
2338 graft
2338 </a>
2339 </a>
2339 </td><td>
2340 </td><td>
2340 copy changes from other branches onto the current branch
2341 copy changes from other branches onto the current branch
2341 </td></tr>
2342 </td></tr>
2342 <tr><td>
2343 <tr><td>
2343 <a href="/help/grep">
2344 <a href="/help/grep">
2344 grep
2345 grep
2345 </a>
2346 </a>
2346 </td><td>
2347 </td><td>
2347 search revision history for a pattern in specified files
2348 search revision history for a pattern in specified files
2348 </td></tr>
2349 </td></tr>
2349 <tr><td>
2350 <tr><td>
2350 <a href="/help/heads">
2351 <a href="/help/heads">
2351 heads
2352 heads
2352 </a>
2353 </a>
2353 </td><td>
2354 </td><td>
2354 show branch heads
2355 show branch heads
2355 </td></tr>
2356 </td></tr>
2356 <tr><td>
2357 <tr><td>
2357 <a href="/help/help">
2358 <a href="/help/help">
2358 help
2359 help
2359 </a>
2360 </a>
2360 </td><td>
2361 </td><td>
2361 show help for a given topic or a help overview
2362 show help for a given topic or a help overview
2362 </td></tr>
2363 </td></tr>
2363 <tr><td>
2364 <tr><td>
2364 <a href="/help/hgalias">
2365 <a href="/help/hgalias">
2365 hgalias
2366 hgalias
2366 </a>
2367 </a>
2367 </td><td>
2368 </td><td>
2368 summarize working directory state
2369 summarize working directory state
2369 </td></tr>
2370 </td></tr>
2370 <tr><td>
2371 <tr><td>
2371 <a href="/help/identify">
2372 <a href="/help/identify">
2372 identify
2373 identify
2373 </a>
2374 </a>
2374 </td><td>
2375 </td><td>
2375 identify the working directory or specified revision
2376 identify the working directory or specified revision
2376 </td></tr>
2377 </td></tr>
2377 <tr><td>
2378 <tr><td>
2378 <a href="/help/import">
2379 <a href="/help/import">
2379 import
2380 import
2380 </a>
2381 </a>
2381 </td><td>
2382 </td><td>
2382 import an ordered set of patches
2383 import an ordered set of patches
2383 </td></tr>
2384 </td></tr>
2384 <tr><td>
2385 <tr><td>
2385 <a href="/help/incoming">
2386 <a href="/help/incoming">
2386 incoming
2387 incoming
2387 </a>
2388 </a>
2388 </td><td>
2389 </td><td>
2389 show new changesets found in source
2390 show new changesets found in source
2390 </td></tr>
2391 </td></tr>
2391 <tr><td>
2392 <tr><td>
2392 <a href="/help/manifest">
2393 <a href="/help/manifest">
2393 manifest
2394 manifest
2394 </a>
2395 </a>
2395 </td><td>
2396 </td><td>
2396 output the current or given revision of the project manifest
2397 output the current or given revision of the project manifest
2397 </td></tr>
2398 </td></tr>
2398 <tr><td>
2399 <tr><td>
2399 <a href="/help/nohelp">
2400 <a href="/help/nohelp">
2400 nohelp
2401 nohelp
2401 </a>
2402 </a>
2402 </td><td>
2403 </td><td>
2403 (no help text available)
2404 (no help text available)
2404 </td></tr>
2405 </td></tr>
2405 <tr><td>
2406 <tr><td>
2406 <a href="/help/outgoing">
2407 <a href="/help/outgoing">
2407 outgoing
2408 outgoing
2408 </a>
2409 </a>
2409 </td><td>
2410 </td><td>
2410 show changesets not found in the destination
2411 show changesets not found in the destination
2411 </td></tr>
2412 </td></tr>
2412 <tr><td>
2413 <tr><td>
2413 <a href="/help/paths">
2414 <a href="/help/paths">
2414 paths
2415 paths
2415 </a>
2416 </a>
2416 </td><td>
2417 </td><td>
2417 show aliases for remote repositories
2418 show aliases for remote repositories
2418 </td></tr>
2419 </td></tr>
2419 <tr><td>
2420 <tr><td>
2420 <a href="/help/phase">
2421 <a href="/help/phase">
2421 phase
2422 phase
2422 </a>
2423 </a>
2423 </td><td>
2424 </td><td>
2424 set or show the current phase name
2425 set or show the current phase name
2425 </td></tr>
2426 </td></tr>
2426 <tr><td>
2427 <tr><td>
2427 <a href="/help/recover">
2428 <a href="/help/recover">
2428 recover
2429 recover
2429 </a>
2430 </a>
2430 </td><td>
2431 </td><td>
2431 roll back an interrupted transaction
2432 roll back an interrupted transaction
2432 </td></tr>
2433 </td></tr>
2433 <tr><td>
2434 <tr><td>
2434 <a href="/help/rename">
2435 <a href="/help/rename">
2435 rename
2436 rename
2436 </a>
2437 </a>
2437 </td><td>
2438 </td><td>
2438 rename files; equivalent of copy + remove
2439 rename files; equivalent of copy + remove
2439 </td></tr>
2440 </td></tr>
2440 <tr><td>
2441 <tr><td>
2441 <a href="/help/resolve">
2442 <a href="/help/resolve">
2442 resolve
2443 resolve
2443 </a>
2444 </a>
2444 </td><td>
2445 </td><td>
2445 redo merges or set/view the merge status of files
2446 redo merges or set/view the merge status of files
2446 </td></tr>
2447 </td></tr>
2447 <tr><td>
2448 <tr><td>
2448 <a href="/help/revert">
2449 <a href="/help/revert">
2449 revert
2450 revert
2450 </a>
2451 </a>
2451 </td><td>
2452 </td><td>
2452 restore files to their checkout state
2453 restore files to their checkout state
2453 </td></tr>
2454 </td></tr>
2454 <tr><td>
2455 <tr><td>
2455 <a href="/help/root">
2456 <a href="/help/root">
2456 root
2457 root
2457 </a>
2458 </a>
2458 </td><td>
2459 </td><td>
2459 print the root (top) of the current working directory
2460 print the root (top) of the current working directory
2460 </td></tr>
2461 </td></tr>
2461 <tr><td>
2462 <tr><td>
2462 <a href="/help/shellalias">
2463 <a href="/help/shellalias">
2463 shellalias
2464 shellalias
2464 </a>
2465 </a>
2465 </td><td>
2466 </td><td>
2466 (no help text available)
2467 (no help text available)
2467 </td></tr>
2468 </td></tr>
2468 <tr><td>
2469 <tr><td>
2469 <a href="/help/tag">
2470 <a href="/help/tag">
2470 tag
2471 tag
2471 </a>
2472 </a>
2472 </td><td>
2473 </td><td>
2473 add one or more tags for the current or given revision
2474 add one or more tags for the current or given revision
2474 </td></tr>
2475 </td></tr>
2475 <tr><td>
2476 <tr><td>
2476 <a href="/help/tags">
2477 <a href="/help/tags">
2477 tags
2478 tags
2478 </a>
2479 </a>
2479 </td><td>
2480 </td><td>
2480 list repository tags
2481 list repository tags
2481 </td></tr>
2482 </td></tr>
2482 <tr><td>
2483 <tr><td>
2483 <a href="/help/unbundle">
2484 <a href="/help/unbundle">
2484 unbundle
2485 unbundle
2485 </a>
2486 </a>
2486 </td><td>
2487 </td><td>
2487 apply one or more bundle files
2488 apply one or more bundle files
2488 </td></tr>
2489 </td></tr>
2489 <tr><td>
2490 <tr><td>
2490 <a href="/help/verify">
2491 <a href="/help/verify">
2491 verify
2492 verify
2492 </a>
2493 </a>
2493 </td><td>
2494 </td><td>
2494 verify the integrity of the repository
2495 verify the integrity of the repository
2495 </td></tr>
2496 </td></tr>
2496 <tr><td>
2497 <tr><td>
2497 <a href="/help/version">
2498 <a href="/help/version">
2498 version
2499 version
2499 </a>
2500 </a>
2500 </td><td>
2501 </td><td>
2501 output version and copyright information
2502 output version and copyright information
2502 </td></tr>
2503 </td></tr>
2503
2504
2504
2505
2505 </table>
2506 </table>
2506 </div>
2507 </div>
2507 </div>
2508 </div>
2508
2509
2509
2510
2510
2511
2511 </body>
2512 </body>
2512 </html>
2513 </html>
2513
2514
2514
2515
2515 $ get-with-headers.py $LOCALIP:$HGPORT "help/add"
2516 $ get-with-headers.py $LOCALIP:$HGPORT "help/add"
2516 200 Script output follows
2517 200 Script output follows
2517
2518
2518 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2519 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2519 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2520 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2520 <head>
2521 <head>
2521 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2522 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2522 <meta name="robots" content="index, nofollow" />
2523 <meta name="robots" content="index, nofollow" />
2523 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2524 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2524 <script type="text/javascript" src="/static/mercurial.js"></script>
2525 <script type="text/javascript" src="/static/mercurial.js"></script>
2525
2526
2526 <title>Help: add</title>
2527 <title>Help: add</title>
2527 </head>
2528 </head>
2528 <body>
2529 <body>
2529
2530
2530 <div class="container">
2531 <div class="container">
2531 <div class="menu">
2532 <div class="menu">
2532 <div class="logo">
2533 <div class="logo">
2533 <a href="https://mercurial-scm.org/">
2534 <a href="https://mercurial-scm.org/">
2534 <img src="/static/hglogo.png" alt="mercurial" /></a>
2535 <img src="/static/hglogo.png" alt="mercurial" /></a>
2535 </div>
2536 </div>
2536 <ul>
2537 <ul>
2537 <li><a href="/shortlog">log</a></li>
2538 <li><a href="/shortlog">log</a></li>
2538 <li><a href="/graph">graph</a></li>
2539 <li><a href="/graph">graph</a></li>
2539 <li><a href="/tags">tags</a></li>
2540 <li><a href="/tags">tags</a></li>
2540 <li><a href="/bookmarks">bookmarks</a></li>
2541 <li><a href="/bookmarks">bookmarks</a></li>
2541 <li><a href="/branches">branches</a></li>
2542 <li><a href="/branches">branches</a></li>
2542 </ul>
2543 </ul>
2543 <ul>
2544 <ul>
2544 <li class="active"><a href="/help">help</a></li>
2545 <li class="active"><a href="/help">help</a></li>
2545 </ul>
2546 </ul>
2546 </div>
2547 </div>
2547
2548
2548 <div class="main">
2549 <div class="main">
2549 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2550 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2550 <h3>Help: add</h3>
2551 <h3>Help: add</h3>
2551
2552
2552 <form class="search" action="/log">
2553 <form class="search" action="/log">
2553
2554
2554 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2555 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2555 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2556 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2556 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2557 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2557 </form>
2558 </form>
2558 <div id="doc">
2559 <div id="doc">
2559 <p>
2560 <p>
2560 hg add [OPTION]... [FILE]...
2561 hg add [OPTION]... [FILE]...
2561 </p>
2562 </p>
2562 <p>
2563 <p>
2563 add the specified files on the next commit
2564 add the specified files on the next commit
2564 </p>
2565 </p>
2565 <p>
2566 <p>
2566 Schedule files to be version controlled and added to the
2567 Schedule files to be version controlled and added to the
2567 repository.
2568 repository.
2568 </p>
2569 </p>
2569 <p>
2570 <p>
2570 The files will be added to the repository at the next commit. To
2571 The files will be added to the repository at the next commit. To
2571 undo an add before that, see 'hg forget'.
2572 undo an add before that, see 'hg forget'.
2572 </p>
2573 </p>
2573 <p>
2574 <p>
2574 If no names are given, add all files to the repository (except
2575 If no names are given, add all files to the repository (except
2575 files matching &quot;.hgignore&quot;).
2576 files matching &quot;.hgignore&quot;).
2576 </p>
2577 </p>
2577 <p>
2578 <p>
2578 Examples:
2579 Examples:
2579 </p>
2580 </p>
2580 <ul>
2581 <ul>
2581 <li> New (unknown) files are added automatically by 'hg add':
2582 <li> New (unknown) files are added automatically by 'hg add':
2582 <pre>
2583 <pre>
2583 \$ ls (re)
2584 \$ ls (re)
2584 foo.c
2585 foo.c
2585 \$ hg status (re)
2586 \$ hg status (re)
2586 ? foo.c
2587 ? foo.c
2587 \$ hg add (re)
2588 \$ hg add (re)
2588 adding foo.c
2589 adding foo.c
2589 \$ hg status (re)
2590 \$ hg status (re)
2590 A foo.c
2591 A foo.c
2591 </pre>
2592 </pre>
2592 <li> Specific files to be added can be specified:
2593 <li> Specific files to be added can be specified:
2593 <pre>
2594 <pre>
2594 \$ ls (re)
2595 \$ ls (re)
2595 bar.c foo.c
2596 bar.c foo.c
2596 \$ hg status (re)
2597 \$ hg status (re)
2597 ? bar.c
2598 ? bar.c
2598 ? foo.c
2599 ? foo.c
2599 \$ hg add bar.c (re)
2600 \$ hg add bar.c (re)
2600 \$ hg status (re)
2601 \$ hg status (re)
2601 A bar.c
2602 A bar.c
2602 ? foo.c
2603 ? foo.c
2603 </pre>
2604 </pre>
2604 </ul>
2605 </ul>
2605 <p>
2606 <p>
2606 Returns 0 if all files are successfully added.
2607 Returns 0 if all files are successfully added.
2607 </p>
2608 </p>
2608 <p>
2609 <p>
2609 options ([+] can be repeated):
2610 options ([+] can be repeated):
2610 </p>
2611 </p>
2611 <table>
2612 <table>
2612 <tr><td>-I</td>
2613 <tr><td>-I</td>
2613 <td>--include PATTERN [+]</td>
2614 <td>--include PATTERN [+]</td>
2614 <td>include names matching the given patterns</td></tr>
2615 <td>include names matching the given patterns</td></tr>
2615 <tr><td>-X</td>
2616 <tr><td>-X</td>
2616 <td>--exclude PATTERN [+]</td>
2617 <td>--exclude PATTERN [+]</td>
2617 <td>exclude names matching the given patterns</td></tr>
2618 <td>exclude names matching the given patterns</td></tr>
2618 <tr><td>-S</td>
2619 <tr><td>-S</td>
2619 <td>--subrepos</td>
2620 <td>--subrepos</td>
2620 <td>recurse into subrepositories</td></tr>
2621 <td>recurse into subrepositories</td></tr>
2621 <tr><td>-n</td>
2622 <tr><td>-n</td>
2622 <td>--dry-run</td>
2623 <td>--dry-run</td>
2623 <td>do not perform actions, just print output</td></tr>
2624 <td>do not perform actions, just print output</td></tr>
2624 </table>
2625 </table>
2625 <p>
2626 <p>
2626 global options ([+] can be repeated):
2627 global options ([+] can be repeated):
2627 </p>
2628 </p>
2628 <table>
2629 <table>
2629 <tr><td>-R</td>
2630 <tr><td>-R</td>
2630 <td>--repository REPO</td>
2631 <td>--repository REPO</td>
2631 <td>repository root directory or name of overlay bundle file</td></tr>
2632 <td>repository root directory or name of overlay bundle file</td></tr>
2632 <tr><td></td>
2633 <tr><td></td>
2633 <td>--cwd DIR</td>
2634 <td>--cwd DIR</td>
2634 <td>change working directory</td></tr>
2635 <td>change working directory</td></tr>
2635 <tr><td>-y</td>
2636 <tr><td>-y</td>
2636 <td>--noninteractive</td>
2637 <td>--noninteractive</td>
2637 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2638 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2638 <tr><td>-q</td>
2639 <tr><td>-q</td>
2639 <td>--quiet</td>
2640 <td>--quiet</td>
2640 <td>suppress output</td></tr>
2641 <td>suppress output</td></tr>
2641 <tr><td>-v</td>
2642 <tr><td>-v</td>
2642 <td>--verbose</td>
2643 <td>--verbose</td>
2643 <td>enable additional output</td></tr>
2644 <td>enable additional output</td></tr>
2644 <tr><td></td>
2645 <tr><td></td>
2645 <td>--color TYPE</td>
2646 <td>--color TYPE</td>
2646 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2647 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2647 <tr><td></td>
2648 <tr><td></td>
2648 <td>--config CONFIG [+]</td>
2649 <td>--config CONFIG [+]</td>
2649 <td>set/override config option (use 'section.name=value')</td></tr>
2650 <td>set/override config option (use 'section.name=value')</td></tr>
2650 <tr><td></td>
2651 <tr><td></td>
2651 <td>--debug</td>
2652 <td>--debug</td>
2652 <td>enable debugging output</td></tr>
2653 <td>enable debugging output</td></tr>
2653 <tr><td></td>
2654 <tr><td></td>
2654 <td>--debugger</td>
2655 <td>--debugger</td>
2655 <td>start debugger</td></tr>
2656 <td>start debugger</td></tr>
2656 <tr><td></td>
2657 <tr><td></td>
2657 <td>--encoding ENCODE</td>
2658 <td>--encoding ENCODE</td>
2658 <td>set the charset encoding (default: ascii)</td></tr>
2659 <td>set the charset encoding (default: ascii)</td></tr>
2659 <tr><td></td>
2660 <tr><td></td>
2660 <td>--encodingmode MODE</td>
2661 <td>--encodingmode MODE</td>
2661 <td>set the charset encoding mode (default: strict)</td></tr>
2662 <td>set the charset encoding mode (default: strict)</td></tr>
2662 <tr><td></td>
2663 <tr><td></td>
2663 <td>--traceback</td>
2664 <td>--traceback</td>
2664 <td>always print a traceback on exception</td></tr>
2665 <td>always print a traceback on exception</td></tr>
2665 <tr><td></td>
2666 <tr><td></td>
2666 <td>--time</td>
2667 <td>--time</td>
2667 <td>time how long the command takes</td></tr>
2668 <td>time how long the command takes</td></tr>
2668 <tr><td></td>
2669 <tr><td></td>
2669 <td>--profile</td>
2670 <td>--profile</td>
2670 <td>print command execution profile</td></tr>
2671 <td>print command execution profile</td></tr>
2671 <tr><td></td>
2672 <tr><td></td>
2672 <td>--version</td>
2673 <td>--version</td>
2673 <td>output version information and exit</td></tr>
2674 <td>output version information and exit</td></tr>
2674 <tr><td>-h</td>
2675 <tr><td>-h</td>
2675 <td>--help</td>
2676 <td>--help</td>
2676 <td>display help and exit</td></tr>
2677 <td>display help and exit</td></tr>
2677 <tr><td></td>
2678 <tr><td></td>
2678 <td>--hidden</td>
2679 <td>--hidden</td>
2679 <td>consider hidden changesets</td></tr>
2680 <td>consider hidden changesets</td></tr>
2680 <tr><td></td>
2681 <tr><td></td>
2681 <td>--pager TYPE</td>
2682 <td>--pager TYPE</td>
2682 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2683 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2683 </table>
2684 </table>
2684
2685
2685 </div>
2686 </div>
2686 </div>
2687 </div>
2687 </div>
2688 </div>
2688
2689
2689
2690
2690
2691
2691 </body>
2692 </body>
2692 </html>
2693 </html>
2693
2694
2694
2695
2695 $ get-with-headers.py $LOCALIP:$HGPORT "help/remove"
2696 $ get-with-headers.py $LOCALIP:$HGPORT "help/remove"
2696 200 Script output follows
2697 200 Script output follows
2697
2698
2698 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2699 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2699 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2700 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2700 <head>
2701 <head>
2701 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2702 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2702 <meta name="robots" content="index, nofollow" />
2703 <meta name="robots" content="index, nofollow" />
2703 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2704 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2704 <script type="text/javascript" src="/static/mercurial.js"></script>
2705 <script type="text/javascript" src="/static/mercurial.js"></script>
2705
2706
2706 <title>Help: remove</title>
2707 <title>Help: remove</title>
2707 </head>
2708 </head>
2708 <body>
2709 <body>
2709
2710
2710 <div class="container">
2711 <div class="container">
2711 <div class="menu">
2712 <div class="menu">
2712 <div class="logo">
2713 <div class="logo">
2713 <a href="https://mercurial-scm.org/">
2714 <a href="https://mercurial-scm.org/">
2714 <img src="/static/hglogo.png" alt="mercurial" /></a>
2715 <img src="/static/hglogo.png" alt="mercurial" /></a>
2715 </div>
2716 </div>
2716 <ul>
2717 <ul>
2717 <li><a href="/shortlog">log</a></li>
2718 <li><a href="/shortlog">log</a></li>
2718 <li><a href="/graph">graph</a></li>
2719 <li><a href="/graph">graph</a></li>
2719 <li><a href="/tags">tags</a></li>
2720 <li><a href="/tags">tags</a></li>
2720 <li><a href="/bookmarks">bookmarks</a></li>
2721 <li><a href="/bookmarks">bookmarks</a></li>
2721 <li><a href="/branches">branches</a></li>
2722 <li><a href="/branches">branches</a></li>
2722 </ul>
2723 </ul>
2723 <ul>
2724 <ul>
2724 <li class="active"><a href="/help">help</a></li>
2725 <li class="active"><a href="/help">help</a></li>
2725 </ul>
2726 </ul>
2726 </div>
2727 </div>
2727
2728
2728 <div class="main">
2729 <div class="main">
2729 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2730 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2730 <h3>Help: remove</h3>
2731 <h3>Help: remove</h3>
2731
2732
2732 <form class="search" action="/log">
2733 <form class="search" action="/log">
2733
2734
2734 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2735 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2735 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2736 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2736 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2737 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2737 </form>
2738 </form>
2738 <div id="doc">
2739 <div id="doc">
2739 <p>
2740 <p>
2740 hg remove [OPTION]... FILE...
2741 hg remove [OPTION]... FILE...
2741 </p>
2742 </p>
2742 <p>
2743 <p>
2743 aliases: rm
2744 aliases: rm
2744 </p>
2745 </p>
2745 <p>
2746 <p>
2746 remove the specified files on the next commit
2747 remove the specified files on the next commit
2747 </p>
2748 </p>
2748 <p>
2749 <p>
2749 Schedule the indicated files for removal from the current branch.
2750 Schedule the indicated files for removal from the current branch.
2750 </p>
2751 </p>
2751 <p>
2752 <p>
2752 This command schedules the files to be removed at the next commit.
2753 This command schedules the files to be removed at the next commit.
2753 To undo a remove before that, see 'hg revert'. To undo added
2754 To undo a remove before that, see 'hg revert'. To undo added
2754 files, see 'hg forget'.
2755 files, see 'hg forget'.
2755 </p>
2756 </p>
2756 <p>
2757 <p>
2757 -A/--after can be used to remove only files that have already
2758 -A/--after can be used to remove only files that have already
2758 been deleted, -f/--force can be used to force deletion, and -Af
2759 been deleted, -f/--force can be used to force deletion, and -Af
2759 can be used to remove files from the next revision without
2760 can be used to remove files from the next revision without
2760 deleting them from the working directory.
2761 deleting them from the working directory.
2761 </p>
2762 </p>
2762 <p>
2763 <p>
2763 The following table details the behavior of remove for different
2764 The following table details the behavior of remove for different
2764 file states (columns) and option combinations (rows). The file
2765 file states (columns) and option combinations (rows). The file
2765 states are Added [A], Clean [C], Modified [M] and Missing [!]
2766 states are Added [A], Clean [C], Modified [M] and Missing [!]
2766 (as reported by 'hg status'). The actions are Warn, Remove
2767 (as reported by 'hg status'). The actions are Warn, Remove
2767 (from branch) and Delete (from disk):
2768 (from branch) and Delete (from disk):
2768 </p>
2769 </p>
2769 <table>
2770 <table>
2770 <tr><td>opt/state</td>
2771 <tr><td>opt/state</td>
2771 <td>A</td>
2772 <td>A</td>
2772 <td>C</td>
2773 <td>C</td>
2773 <td>M</td>
2774 <td>M</td>
2774 <td>!</td></tr>
2775 <td>!</td></tr>
2775 <tr><td>none</td>
2776 <tr><td>none</td>
2776 <td>W</td>
2777 <td>W</td>
2777 <td>RD</td>
2778 <td>RD</td>
2778 <td>W</td>
2779 <td>W</td>
2779 <td>R</td></tr>
2780 <td>R</td></tr>
2780 <tr><td>-f</td>
2781 <tr><td>-f</td>
2781 <td>R</td>
2782 <td>R</td>
2782 <td>RD</td>
2783 <td>RD</td>
2783 <td>RD</td>
2784 <td>RD</td>
2784 <td>R</td></tr>
2785 <td>R</td></tr>
2785 <tr><td>-A</td>
2786 <tr><td>-A</td>
2786 <td>W</td>
2787 <td>W</td>
2787 <td>W</td>
2788 <td>W</td>
2788 <td>W</td>
2789 <td>W</td>
2789 <td>R</td></tr>
2790 <td>R</td></tr>
2790 <tr><td>-Af</td>
2791 <tr><td>-Af</td>
2791 <td>R</td>
2792 <td>R</td>
2792 <td>R</td>
2793 <td>R</td>
2793 <td>R</td>
2794 <td>R</td>
2794 <td>R</td></tr>
2795 <td>R</td></tr>
2795 </table>
2796 </table>
2796 <p>
2797 <p>
2797 <b>Note:</b>
2798 <b>Note:</b>
2798 </p>
2799 </p>
2799 <p>
2800 <p>
2800 'hg remove' never deletes files in Added [A] state from the
2801 'hg remove' never deletes files in Added [A] state from the
2801 working directory, not even if &quot;--force&quot; is specified.
2802 working directory, not even if &quot;--force&quot; is specified.
2802 </p>
2803 </p>
2803 <p>
2804 <p>
2804 Returns 0 on success, 1 if any warnings encountered.
2805 Returns 0 on success, 1 if any warnings encountered.
2805 </p>
2806 </p>
2806 <p>
2807 <p>
2807 options ([+] can be repeated):
2808 options ([+] can be repeated):
2808 </p>
2809 </p>
2809 <table>
2810 <table>
2810 <tr><td>-A</td>
2811 <tr><td>-A</td>
2811 <td>--after</td>
2812 <td>--after</td>
2812 <td>record delete for missing files</td></tr>
2813 <td>record delete for missing files</td></tr>
2813 <tr><td>-f</td>
2814 <tr><td>-f</td>
2814 <td>--force</td>
2815 <td>--force</td>
2815 <td>forget added files, delete modified files</td></tr>
2816 <td>forget added files, delete modified files</td></tr>
2816 <tr><td>-S</td>
2817 <tr><td>-S</td>
2817 <td>--subrepos</td>
2818 <td>--subrepos</td>
2818 <td>recurse into subrepositories</td></tr>
2819 <td>recurse into subrepositories</td></tr>
2819 <tr><td>-I</td>
2820 <tr><td>-I</td>
2820 <td>--include PATTERN [+]</td>
2821 <td>--include PATTERN [+]</td>
2821 <td>include names matching the given patterns</td></tr>
2822 <td>include names matching the given patterns</td></tr>
2822 <tr><td>-X</td>
2823 <tr><td>-X</td>
2823 <td>--exclude PATTERN [+]</td>
2824 <td>--exclude PATTERN [+]</td>
2824 <td>exclude names matching the given patterns</td></tr>
2825 <td>exclude names matching the given patterns</td></tr>
2825 </table>
2826 </table>
2826 <p>
2827 <p>
2827 global options ([+] can be repeated):
2828 global options ([+] can be repeated):
2828 </p>
2829 </p>
2829 <table>
2830 <table>
2830 <tr><td>-R</td>
2831 <tr><td>-R</td>
2831 <td>--repository REPO</td>
2832 <td>--repository REPO</td>
2832 <td>repository root directory or name of overlay bundle file</td></tr>
2833 <td>repository root directory or name of overlay bundle file</td></tr>
2833 <tr><td></td>
2834 <tr><td></td>
2834 <td>--cwd DIR</td>
2835 <td>--cwd DIR</td>
2835 <td>change working directory</td></tr>
2836 <td>change working directory</td></tr>
2836 <tr><td>-y</td>
2837 <tr><td>-y</td>
2837 <td>--noninteractive</td>
2838 <td>--noninteractive</td>
2838 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2839 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2839 <tr><td>-q</td>
2840 <tr><td>-q</td>
2840 <td>--quiet</td>
2841 <td>--quiet</td>
2841 <td>suppress output</td></tr>
2842 <td>suppress output</td></tr>
2842 <tr><td>-v</td>
2843 <tr><td>-v</td>
2843 <td>--verbose</td>
2844 <td>--verbose</td>
2844 <td>enable additional output</td></tr>
2845 <td>enable additional output</td></tr>
2845 <tr><td></td>
2846 <tr><td></td>
2846 <td>--color TYPE</td>
2847 <td>--color TYPE</td>
2847 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2848 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2848 <tr><td></td>
2849 <tr><td></td>
2849 <td>--config CONFIG [+]</td>
2850 <td>--config CONFIG [+]</td>
2850 <td>set/override config option (use 'section.name=value')</td></tr>
2851 <td>set/override config option (use 'section.name=value')</td></tr>
2851 <tr><td></td>
2852 <tr><td></td>
2852 <td>--debug</td>
2853 <td>--debug</td>
2853 <td>enable debugging output</td></tr>
2854 <td>enable debugging output</td></tr>
2854 <tr><td></td>
2855 <tr><td></td>
2855 <td>--debugger</td>
2856 <td>--debugger</td>
2856 <td>start debugger</td></tr>
2857 <td>start debugger</td></tr>
2857 <tr><td></td>
2858 <tr><td></td>
2858 <td>--encoding ENCODE</td>
2859 <td>--encoding ENCODE</td>
2859 <td>set the charset encoding (default: ascii)</td></tr>
2860 <td>set the charset encoding (default: ascii)</td></tr>
2860 <tr><td></td>
2861 <tr><td></td>
2861 <td>--encodingmode MODE</td>
2862 <td>--encodingmode MODE</td>
2862 <td>set the charset encoding mode (default: strict)</td></tr>
2863 <td>set the charset encoding mode (default: strict)</td></tr>
2863 <tr><td></td>
2864 <tr><td></td>
2864 <td>--traceback</td>
2865 <td>--traceback</td>
2865 <td>always print a traceback on exception</td></tr>
2866 <td>always print a traceback on exception</td></tr>
2866 <tr><td></td>
2867 <tr><td></td>
2867 <td>--time</td>
2868 <td>--time</td>
2868 <td>time how long the command takes</td></tr>
2869 <td>time how long the command takes</td></tr>
2869 <tr><td></td>
2870 <tr><td></td>
2870 <td>--profile</td>
2871 <td>--profile</td>
2871 <td>print command execution profile</td></tr>
2872 <td>print command execution profile</td></tr>
2872 <tr><td></td>
2873 <tr><td></td>
2873 <td>--version</td>
2874 <td>--version</td>
2874 <td>output version information and exit</td></tr>
2875 <td>output version information and exit</td></tr>
2875 <tr><td>-h</td>
2876 <tr><td>-h</td>
2876 <td>--help</td>
2877 <td>--help</td>
2877 <td>display help and exit</td></tr>
2878 <td>display help and exit</td></tr>
2878 <tr><td></td>
2879 <tr><td></td>
2879 <td>--hidden</td>
2880 <td>--hidden</td>
2880 <td>consider hidden changesets</td></tr>
2881 <td>consider hidden changesets</td></tr>
2881 <tr><td></td>
2882 <tr><td></td>
2882 <td>--pager TYPE</td>
2883 <td>--pager TYPE</td>
2883 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2884 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2884 </table>
2885 </table>
2885
2886
2886 </div>
2887 </div>
2887 </div>
2888 </div>
2888 </div>
2889 </div>
2889
2890
2890
2891
2891
2892
2892 </body>
2893 </body>
2893 </html>
2894 </html>
2894
2895
2895
2896
2896 $ get-with-headers.py $LOCALIP:$HGPORT "help/dates"
2897 $ get-with-headers.py $LOCALIP:$HGPORT "help/dates"
2897 200 Script output follows
2898 200 Script output follows
2898
2899
2899 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2900 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2900 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2901 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2901 <head>
2902 <head>
2902 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2903 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2903 <meta name="robots" content="index, nofollow" />
2904 <meta name="robots" content="index, nofollow" />
2904 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2905 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2905 <script type="text/javascript" src="/static/mercurial.js"></script>
2906 <script type="text/javascript" src="/static/mercurial.js"></script>
2906
2907
2907 <title>Help: dates</title>
2908 <title>Help: dates</title>
2908 </head>
2909 </head>
2909 <body>
2910 <body>
2910
2911
2911 <div class="container">
2912 <div class="container">
2912 <div class="menu">
2913 <div class="menu">
2913 <div class="logo">
2914 <div class="logo">
2914 <a href="https://mercurial-scm.org/">
2915 <a href="https://mercurial-scm.org/">
2915 <img src="/static/hglogo.png" alt="mercurial" /></a>
2916 <img src="/static/hglogo.png" alt="mercurial" /></a>
2916 </div>
2917 </div>
2917 <ul>
2918 <ul>
2918 <li><a href="/shortlog">log</a></li>
2919 <li><a href="/shortlog">log</a></li>
2919 <li><a href="/graph">graph</a></li>
2920 <li><a href="/graph">graph</a></li>
2920 <li><a href="/tags">tags</a></li>
2921 <li><a href="/tags">tags</a></li>
2921 <li><a href="/bookmarks">bookmarks</a></li>
2922 <li><a href="/bookmarks">bookmarks</a></li>
2922 <li><a href="/branches">branches</a></li>
2923 <li><a href="/branches">branches</a></li>
2923 </ul>
2924 </ul>
2924 <ul>
2925 <ul>
2925 <li class="active"><a href="/help">help</a></li>
2926 <li class="active"><a href="/help">help</a></li>
2926 </ul>
2927 </ul>
2927 </div>
2928 </div>
2928
2929
2929 <div class="main">
2930 <div class="main">
2930 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2931 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2931 <h3>Help: dates</h3>
2932 <h3>Help: dates</h3>
2932
2933
2933 <form class="search" action="/log">
2934 <form class="search" action="/log">
2934
2935
2935 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2936 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2936 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2937 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2937 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2938 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2938 </form>
2939 </form>
2939 <div id="doc">
2940 <div id="doc">
2940 <h1>Date Formats</h1>
2941 <h1>Date Formats</h1>
2941 <p>
2942 <p>
2942 Some commands allow the user to specify a date, e.g.:
2943 Some commands allow the user to specify a date, e.g.:
2943 </p>
2944 </p>
2944 <ul>
2945 <ul>
2945 <li> backout, commit, import, tag: Specify the commit date.
2946 <li> backout, commit, import, tag: Specify the commit date.
2946 <li> log, revert, update: Select revision(s) by date.
2947 <li> log, revert, update: Select revision(s) by date.
2947 </ul>
2948 </ul>
2948 <p>
2949 <p>
2949 Many date formats are valid. Here are some examples:
2950 Many date formats are valid. Here are some examples:
2950 </p>
2951 </p>
2951 <ul>
2952 <ul>
2952 <li> &quot;Wed Dec 6 13:18:29 2006&quot; (local timezone assumed)
2953 <li> &quot;Wed Dec 6 13:18:29 2006&quot; (local timezone assumed)
2953 <li> &quot;Dec 6 13:18 -0600&quot; (year assumed, time offset provided)
2954 <li> &quot;Dec 6 13:18 -0600&quot; (year assumed, time offset provided)
2954 <li> &quot;Dec 6 13:18 UTC&quot; (UTC and GMT are aliases for +0000)
2955 <li> &quot;Dec 6 13:18 UTC&quot; (UTC and GMT are aliases for +0000)
2955 <li> &quot;Dec 6&quot; (midnight)
2956 <li> &quot;Dec 6&quot; (midnight)
2956 <li> &quot;13:18&quot; (today assumed)
2957 <li> &quot;13:18&quot; (today assumed)
2957 <li> &quot;3:39&quot; (3:39AM assumed)
2958 <li> &quot;3:39&quot; (3:39AM assumed)
2958 <li> &quot;3:39pm&quot; (15:39)
2959 <li> &quot;3:39pm&quot; (15:39)
2959 <li> &quot;2006-12-06 13:18:29&quot; (ISO 8601 format)
2960 <li> &quot;2006-12-06 13:18:29&quot; (ISO 8601 format)
2960 <li> &quot;2006-12-6 13:18&quot;
2961 <li> &quot;2006-12-6 13:18&quot;
2961 <li> &quot;2006-12-6&quot;
2962 <li> &quot;2006-12-6&quot;
2962 <li> &quot;12-6&quot;
2963 <li> &quot;12-6&quot;
2963 <li> &quot;12/6&quot;
2964 <li> &quot;12/6&quot;
2964 <li> &quot;12/6/6&quot; (Dec 6 2006)
2965 <li> &quot;12/6/6&quot; (Dec 6 2006)
2965 <li> &quot;today&quot; (midnight)
2966 <li> &quot;today&quot; (midnight)
2966 <li> &quot;yesterday&quot; (midnight)
2967 <li> &quot;yesterday&quot; (midnight)
2967 <li> &quot;now&quot; - right now
2968 <li> &quot;now&quot; - right now
2968 </ul>
2969 </ul>
2969 <p>
2970 <p>
2970 Lastly, there is Mercurial's internal format:
2971 Lastly, there is Mercurial's internal format:
2971 </p>
2972 </p>
2972 <ul>
2973 <ul>
2973 <li> &quot;1165411109 0&quot; (Wed Dec 6 13:18:29 2006 UTC)
2974 <li> &quot;1165411109 0&quot; (Wed Dec 6 13:18:29 2006 UTC)
2974 </ul>
2975 </ul>
2975 <p>
2976 <p>
2976 This is the internal representation format for dates. The first number
2977 This is the internal representation format for dates. The first number
2977 is the number of seconds since the epoch (1970-01-01 00:00 UTC). The
2978 is the number of seconds since the epoch (1970-01-01 00:00 UTC). The
2978 second is the offset of the local timezone, in seconds west of UTC
2979 second is the offset of the local timezone, in seconds west of UTC
2979 (negative if the timezone is east of UTC).
2980 (negative if the timezone is east of UTC).
2980 </p>
2981 </p>
2981 <p>
2982 <p>
2982 The log command also accepts date ranges:
2983 The log command also accepts date ranges:
2983 </p>
2984 </p>
2984 <ul>
2985 <ul>
2985 <li> &quot;&lt;DATE&quot; - at or before a given date/time
2986 <li> &quot;&lt;DATE&quot; - at or before a given date/time
2986 <li> &quot;&gt;DATE&quot; - on or after a given date/time
2987 <li> &quot;&gt;DATE&quot; - on or after a given date/time
2987 <li> &quot;DATE to DATE&quot; - a date range, inclusive
2988 <li> &quot;DATE to DATE&quot; - a date range, inclusive
2988 <li> &quot;-DAYS&quot; - within a given number of days of today
2989 <li> &quot;-DAYS&quot; - within a given number of days of today
2989 </ul>
2990 </ul>
2990
2991
2991 </div>
2992 </div>
2992 </div>
2993 </div>
2993 </div>
2994 </div>
2994
2995
2995
2996
2996
2997
2997 </body>
2998 </body>
2998 </html>
2999 </html>
2999
3000
3000
3001
3001 Sub-topic indexes rendered properly
3002 Sub-topic indexes rendered properly
3002
3003
3003 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals"
3004 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals"
3004 200 Script output follows
3005 200 Script output follows
3005
3006
3006 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3007 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3007 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3008 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3008 <head>
3009 <head>
3009 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3010 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3010 <meta name="robots" content="index, nofollow" />
3011 <meta name="robots" content="index, nofollow" />
3011 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3012 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3012 <script type="text/javascript" src="/static/mercurial.js"></script>
3013 <script type="text/javascript" src="/static/mercurial.js"></script>
3013
3014
3014 <title>Help: internals</title>
3015 <title>Help: internals</title>
3015 </head>
3016 </head>
3016 <body>
3017 <body>
3017
3018
3018 <div class="container">
3019 <div class="container">
3019 <div class="menu">
3020 <div class="menu">
3020 <div class="logo">
3021 <div class="logo">
3021 <a href="https://mercurial-scm.org/">
3022 <a href="https://mercurial-scm.org/">
3022 <img src="/static/hglogo.png" alt="mercurial" /></a>
3023 <img src="/static/hglogo.png" alt="mercurial" /></a>
3023 </div>
3024 </div>
3024 <ul>
3025 <ul>
3025 <li><a href="/shortlog">log</a></li>
3026 <li><a href="/shortlog">log</a></li>
3026 <li><a href="/graph">graph</a></li>
3027 <li><a href="/graph">graph</a></li>
3027 <li><a href="/tags">tags</a></li>
3028 <li><a href="/tags">tags</a></li>
3028 <li><a href="/bookmarks">bookmarks</a></li>
3029 <li><a href="/bookmarks">bookmarks</a></li>
3029 <li><a href="/branches">branches</a></li>
3030 <li><a href="/branches">branches</a></li>
3030 </ul>
3031 </ul>
3031 <ul>
3032 <ul>
3032 <li><a href="/help">help</a></li>
3033 <li><a href="/help">help</a></li>
3033 </ul>
3034 </ul>
3034 </div>
3035 </div>
3035
3036
3036 <div class="main">
3037 <div class="main">
3037 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3038 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3038
3039
3039 <form class="search" action="/log">
3040 <form class="search" action="/log">
3040
3041
3041 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3042 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3042 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3043 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3043 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3044 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3044 </form>
3045 </form>
3045 <table class="bigtable">
3046 <table class="bigtable">
3046 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
3047 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
3047
3048
3048 <tr><td>
3049 <tr><td>
3049 <a href="/help/internals.bundles">
3050 <a href="/help/internals.bundles">
3050 bundles
3051 bundles
3051 </a>
3052 </a>
3052 </td><td>
3053 </td><td>
3053 Bundles
3054 Bundles
3054 </td></tr>
3055 </td></tr>
3055 <tr><td>
3056 <tr><td>
3056 <a href="/help/internals.censor">
3057 <a href="/help/internals.censor">
3057 censor
3058 censor
3058 </a>
3059 </a>
3059 </td><td>
3060 </td><td>
3060 Censor
3061 Censor
3061 </td></tr>
3062 </td></tr>
3062 <tr><td>
3063 <tr><td>
3063 <a href="/help/internals.changegroups">
3064 <a href="/help/internals.changegroups">
3064 changegroups
3065 changegroups
3065 </a>
3066 </a>
3066 </td><td>
3067 </td><td>
3067 Changegroups
3068 Changegroups
3068 </td></tr>
3069 </td></tr>
3069 <tr><td>
3070 <tr><td>
3070 <a href="/help/internals.config">
3071 <a href="/help/internals.config">
3071 config
3072 config
3072 </a>
3073 </a>
3073 </td><td>
3074 </td><td>
3074 Config Registrar
3075 Config Registrar
3075 </td></tr>
3076 </td></tr>
3076 <tr><td>
3077 <tr><td>
3077 <a href="/help/internals.requirements">
3078 <a href="/help/internals.requirements">
3078 requirements
3079 requirements
3079 </a>
3080 </a>
3080 </td><td>
3081 </td><td>
3081 Repository Requirements
3082 Repository Requirements
3082 </td></tr>
3083 </td></tr>
3083 <tr><td>
3084 <tr><td>
3084 <a href="/help/internals.revlogs">
3085 <a href="/help/internals.revlogs">
3085 revlogs
3086 revlogs
3086 </a>
3087 </a>
3087 </td><td>
3088 </td><td>
3088 Revision Logs
3089 Revision Logs
3089 </td></tr>
3090 </td></tr>
3090 <tr><td>
3091 <tr><td>
3091 <a href="/help/internals.wireprotocol">
3092 <a href="/help/internals.wireprotocol">
3092 wireprotocol
3093 wireprotocol
3093 </a>
3094 </a>
3094 </td><td>
3095 </td><td>
3095 Wire Protocol
3096 Wire Protocol
3096 </td></tr>
3097 </td></tr>
3097
3098
3098
3099
3099
3100
3100
3101
3101
3102
3102 </table>
3103 </table>
3103 </div>
3104 </div>
3104 </div>
3105 </div>
3105
3106
3106
3107
3107
3108
3108 </body>
3109 </body>
3109 </html>
3110 </html>
3110
3111
3111
3112
3112 Sub-topic topics rendered properly
3113 Sub-topic topics rendered properly
3113
3114
3114 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals.changegroups"
3115 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals.changegroups"
3115 200 Script output follows
3116 200 Script output follows
3116
3117
3117 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3118 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3118 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3119 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3119 <head>
3120 <head>
3120 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3121 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3121 <meta name="robots" content="index, nofollow" />
3122 <meta name="robots" content="index, nofollow" />
3122 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3123 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3123 <script type="text/javascript" src="/static/mercurial.js"></script>
3124 <script type="text/javascript" src="/static/mercurial.js"></script>
3124
3125
3125 <title>Help: internals.changegroups</title>
3126 <title>Help: internals.changegroups</title>
3126 </head>
3127 </head>
3127 <body>
3128 <body>
3128
3129
3129 <div class="container">
3130 <div class="container">
3130 <div class="menu">
3131 <div class="menu">
3131 <div class="logo">
3132 <div class="logo">
3132 <a href="https://mercurial-scm.org/">
3133 <a href="https://mercurial-scm.org/">
3133 <img src="/static/hglogo.png" alt="mercurial" /></a>
3134 <img src="/static/hglogo.png" alt="mercurial" /></a>
3134 </div>
3135 </div>
3135 <ul>
3136 <ul>
3136 <li><a href="/shortlog">log</a></li>
3137 <li><a href="/shortlog">log</a></li>
3137 <li><a href="/graph">graph</a></li>
3138 <li><a href="/graph">graph</a></li>
3138 <li><a href="/tags">tags</a></li>
3139 <li><a href="/tags">tags</a></li>
3139 <li><a href="/bookmarks">bookmarks</a></li>
3140 <li><a href="/bookmarks">bookmarks</a></li>
3140 <li><a href="/branches">branches</a></li>
3141 <li><a href="/branches">branches</a></li>
3141 </ul>
3142 </ul>
3142 <ul>
3143 <ul>
3143 <li class="active"><a href="/help">help</a></li>
3144 <li class="active"><a href="/help">help</a></li>
3144 </ul>
3145 </ul>
3145 </div>
3146 </div>
3146
3147
3147 <div class="main">
3148 <div class="main">
3148 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3149 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3149 <h3>Help: internals.changegroups</h3>
3150 <h3>Help: internals.changegroups</h3>
3150
3151
3151 <form class="search" action="/log">
3152 <form class="search" action="/log">
3152
3153
3153 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3154 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3154 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3155 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3155 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3156 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3156 </form>
3157 </form>
3157 <div id="doc">
3158 <div id="doc">
3158 <h1>Changegroups</h1>
3159 <h1>Changegroups</h1>
3159 <p>
3160 <p>
3160 Changegroups are representations of repository revlog data, specifically
3161 Changegroups are representations of repository revlog data, specifically
3161 the changelog data, root/flat manifest data, treemanifest data, and
3162 the changelog data, root/flat manifest data, treemanifest data, and
3162 filelogs.
3163 filelogs.
3163 </p>
3164 </p>
3164 <p>
3165 <p>
3165 There are 3 versions of changegroups: &quot;1&quot;, &quot;2&quot;, and &quot;3&quot;. From a
3166 There are 3 versions of changegroups: &quot;1&quot;, &quot;2&quot;, and &quot;3&quot;. From a
3166 high-level, versions &quot;1&quot; and &quot;2&quot; are almost exactly the same, with the
3167 high-level, versions &quot;1&quot; and &quot;2&quot; are almost exactly the same, with the
3167 only difference being an additional item in the *delta header*. Version
3168 only difference being an additional item in the *delta header*. Version
3168 &quot;3&quot; adds support for revlog flags in the *delta header* and optionally
3169 &quot;3&quot; adds support for revlog flags in the *delta header* and optionally
3169 exchanging treemanifests (enabled by setting an option on the
3170 exchanging treemanifests (enabled by setting an option on the
3170 &quot;changegroup&quot; part in the bundle2).
3171 &quot;changegroup&quot; part in the bundle2).
3171 </p>
3172 </p>
3172 <p>
3173 <p>
3173 Changegroups when not exchanging treemanifests consist of 3 logical
3174 Changegroups when not exchanging treemanifests consist of 3 logical
3174 segments:
3175 segments:
3175 </p>
3176 </p>
3176 <pre>
3177 <pre>
3177 +---------------------------------+
3178 +---------------------------------+
3178 | | | |
3179 | | | |
3179 | changeset | manifest | filelogs |
3180 | changeset | manifest | filelogs |
3180 | | | |
3181 | | | |
3181 | | | |
3182 | | | |
3182 +---------------------------------+
3183 +---------------------------------+
3183 </pre>
3184 </pre>
3184 <p>
3185 <p>
3185 When exchanging treemanifests, there are 4 logical segments:
3186 When exchanging treemanifests, there are 4 logical segments:
3186 </p>
3187 </p>
3187 <pre>
3188 <pre>
3188 +-------------------------------------------------+
3189 +-------------------------------------------------+
3189 | | | | |
3190 | | | | |
3190 | changeset | root | treemanifests | filelogs |
3191 | changeset | root | treemanifests | filelogs |
3191 | | manifest | | |
3192 | | manifest | | |
3192 | | | | |
3193 | | | | |
3193 +-------------------------------------------------+
3194 +-------------------------------------------------+
3194 </pre>
3195 </pre>
3195 <p>
3196 <p>
3196 The principle building block of each segment is a *chunk*. A *chunk*
3197 The principle building block of each segment is a *chunk*. A *chunk*
3197 is a framed piece of data:
3198 is a framed piece of data:
3198 </p>
3199 </p>
3199 <pre>
3200 <pre>
3200 +---------------------------------------+
3201 +---------------------------------------+
3201 | | |
3202 | | |
3202 | length | data |
3203 | length | data |
3203 | (4 bytes) | (&lt;length - 4&gt; bytes) |
3204 | (4 bytes) | (&lt;length - 4&gt; bytes) |
3204 | | |
3205 | | |
3205 +---------------------------------------+
3206 +---------------------------------------+
3206 </pre>
3207 </pre>
3207 <p>
3208 <p>
3208 All integers are big-endian signed integers. Each chunk starts with a 32-bit
3209 All integers are big-endian signed integers. Each chunk starts with a 32-bit
3209 integer indicating the length of the entire chunk (including the length field
3210 integer indicating the length of the entire chunk (including the length field
3210 itself).
3211 itself).
3211 </p>
3212 </p>
3212 <p>
3213 <p>
3213 There is a special case chunk that has a value of 0 for the length
3214 There is a special case chunk that has a value of 0 for the length
3214 (&quot;0x00000000&quot;). We call this an *empty chunk*.
3215 (&quot;0x00000000&quot;). We call this an *empty chunk*.
3215 </p>
3216 </p>
3216 <h2>Delta Groups</h2>
3217 <h2>Delta Groups</h2>
3217 <p>
3218 <p>
3218 A *delta group* expresses the content of a revlog as a series of deltas,
3219 A *delta group* expresses the content of a revlog as a series of deltas,
3219 or patches against previous revisions.
3220 or patches against previous revisions.
3220 </p>
3221 </p>
3221 <p>
3222 <p>
3222 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
3223 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
3223 to signal the end of the delta group:
3224 to signal the end of the delta group:
3224 </p>
3225 </p>
3225 <pre>
3226 <pre>
3226 +------------------------------------------------------------------------+
3227 +------------------------------------------------------------------------+
3227 | | | | | |
3228 | | | | | |
3228 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
3229 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
3229 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
3230 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
3230 | | | | | |
3231 | | | | | |
3231 +------------------------------------------------------------------------+
3232 +------------------------------------------------------------------------+
3232 </pre>
3233 </pre>
3233 <p>
3234 <p>
3234 Each *chunk*'s data consists of the following:
3235 Each *chunk*'s data consists of the following:
3235 </p>
3236 </p>
3236 <pre>
3237 <pre>
3237 +---------------------------------------+
3238 +---------------------------------------+
3238 | | |
3239 | | |
3239 | delta header | delta data |
3240 | delta header | delta data |
3240 | (various by version) | (various) |
3241 | (various by version) | (various) |
3241 | | |
3242 | | |
3242 +---------------------------------------+
3243 +---------------------------------------+
3243 </pre>
3244 </pre>
3244 <p>
3245 <p>
3245 The *delta data* is a series of *delta*s that describe a diff from an existing
3246 The *delta data* is a series of *delta*s that describe a diff from an existing
3246 entry (either that the recipient already has, or previously specified in the
3247 entry (either that the recipient already has, or previously specified in the
3247 bundle/changegroup).
3248 bundle/changegroup).
3248 </p>
3249 </p>
3249 <p>
3250 <p>
3250 The *delta header* is different between versions &quot;1&quot;, &quot;2&quot;, and
3251 The *delta header* is different between versions &quot;1&quot;, &quot;2&quot;, and
3251 &quot;3&quot; of the changegroup format.
3252 &quot;3&quot; of the changegroup format.
3252 </p>
3253 </p>
3253 <p>
3254 <p>
3254 Version 1 (headerlen=80):
3255 Version 1 (headerlen=80):
3255 </p>
3256 </p>
3256 <pre>
3257 <pre>
3257 +------------------------------------------------------+
3258 +------------------------------------------------------+
3258 | | | | |
3259 | | | | |
3259 | node | p1 node | p2 node | link node |
3260 | node | p1 node | p2 node | link node |
3260 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3261 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3261 | | | | |
3262 | | | | |
3262 +------------------------------------------------------+
3263 +------------------------------------------------------+
3263 </pre>
3264 </pre>
3264 <p>
3265 <p>
3265 Version 2 (headerlen=100):
3266 Version 2 (headerlen=100):
3266 </p>
3267 </p>
3267 <pre>
3268 <pre>
3268 +------------------------------------------------------------------+
3269 +------------------------------------------------------------------+
3269 | | | | | |
3270 | | | | | |
3270 | node | p1 node | p2 node | base node | link node |
3271 | node | p1 node | p2 node | base node | link node |
3271 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3272 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3272 | | | | | |
3273 | | | | | |
3273 +------------------------------------------------------------------+
3274 +------------------------------------------------------------------+
3274 </pre>
3275 </pre>
3275 <p>
3276 <p>
3276 Version 3 (headerlen=102):
3277 Version 3 (headerlen=102):
3277 </p>
3278 </p>
3278 <pre>
3279 <pre>
3279 +------------------------------------------------------------------------------+
3280 +------------------------------------------------------------------------------+
3280 | | | | | | |
3281 | | | | | | |
3281 | node | p1 node | p2 node | base node | link node | flags |
3282 | node | p1 node | p2 node | base node | link node | flags |
3282 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
3283 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
3283 | | | | | | |
3284 | | | | | | |
3284 +------------------------------------------------------------------------------+
3285 +------------------------------------------------------------------------------+
3285 </pre>
3286 </pre>
3286 <p>
3287 <p>
3287 The *delta data* consists of &quot;chunklen - 4 - headerlen&quot; bytes, which contain a
3288 The *delta data* consists of &quot;chunklen - 4 - headerlen&quot; bytes, which contain a
3288 series of *delta*s, densely packed (no separators). These deltas describe a diff
3289 series of *delta*s, densely packed (no separators). These deltas describe a diff
3289 from an existing entry (either that the recipient already has, or previously
3290 from an existing entry (either that the recipient already has, or previously
3290 specified in the bundle/changegroup). The format is described more fully in
3291 specified in the bundle/changegroup). The format is described more fully in
3291 &quot;hg help internals.bdiff&quot;, but briefly:
3292 &quot;hg help internals.bdiff&quot;, but briefly:
3292 </p>
3293 </p>
3293 <pre>
3294 <pre>
3294 +---------------------------------------------------------------+
3295 +---------------------------------------------------------------+
3295 | | | | |
3296 | | | | |
3296 | start offset | end offset | new length | content |
3297 | start offset | end offset | new length | content |
3297 | (4 bytes) | (4 bytes) | (4 bytes) | (&lt;new length&gt; bytes) |
3298 | (4 bytes) | (4 bytes) | (4 bytes) | (&lt;new length&gt; bytes) |
3298 | | | | |
3299 | | | | |
3299 +---------------------------------------------------------------+
3300 +---------------------------------------------------------------+
3300 </pre>
3301 </pre>
3301 <p>
3302 <p>
3302 Please note that the length field in the delta data does *not* include itself.
3303 Please note that the length field in the delta data does *not* include itself.
3303 </p>
3304 </p>
3304 <p>
3305 <p>
3305 In version 1, the delta is always applied against the previous node from
3306 In version 1, the delta is always applied against the previous node from
3306 the changegroup or the first parent if this is the first entry in the
3307 the changegroup or the first parent if this is the first entry in the
3307 changegroup.
3308 changegroup.
3308 </p>
3309 </p>
3309 <p>
3310 <p>
3310 In version 2 and up, the delta base node is encoded in the entry in the
3311 In version 2 and up, the delta base node is encoded in the entry in the
3311 changegroup. This allows the delta to be expressed against any parent,
3312 changegroup. This allows the delta to be expressed against any parent,
3312 which can result in smaller deltas and more efficient encoding of data.
3313 which can result in smaller deltas and more efficient encoding of data.
3313 </p>
3314 </p>
3314 <h2>Changeset Segment</h2>
3315 <h2>Changeset Segment</h2>
3315 <p>
3316 <p>
3316 The *changeset segment* consists of a single *delta group* holding
3317 The *changeset segment* consists of a single *delta group* holding
3317 changelog data. The *empty chunk* at the end of the *delta group* denotes
3318 changelog data. The *empty chunk* at the end of the *delta group* denotes
3318 the boundary to the *manifest segment*.
3319 the boundary to the *manifest segment*.
3319 </p>
3320 </p>
3320 <h2>Manifest Segment</h2>
3321 <h2>Manifest Segment</h2>
3321 <p>
3322 <p>
3322 The *manifest segment* consists of a single *delta group* holding manifest
3323 The *manifest segment* consists of a single *delta group* holding manifest
3323 data. If treemanifests are in use, it contains only the manifest for the
3324 data. If treemanifests are in use, it contains only the manifest for the
3324 root directory of the repository. Otherwise, it contains the entire
3325 root directory of the repository. Otherwise, it contains the entire
3325 manifest data. The *empty chunk* at the end of the *delta group* denotes
3326 manifest data. The *empty chunk* at the end of the *delta group* denotes
3326 the boundary to the next segment (either the *treemanifests segment* or the
3327 the boundary to the next segment (either the *treemanifests segment* or the
3327 *filelogs segment*, depending on version and the request options).
3328 *filelogs segment*, depending on version and the request options).
3328 </p>
3329 </p>
3329 <h3>Treemanifests Segment</h3>
3330 <h3>Treemanifests Segment</h3>
3330 <p>
3331 <p>
3331 The *treemanifests segment* only exists in changegroup version &quot;3&quot;, and
3332 The *treemanifests segment* only exists in changegroup version &quot;3&quot;, and
3332 only if the 'treemanifest' param is part of the bundle2 changegroup part
3333 only if the 'treemanifest' param is part of the bundle2 changegroup part
3333 (it is not possible to use changegroup version 3 outside of bundle2).
3334 (it is not possible to use changegroup version 3 outside of bundle2).
3334 Aside from the filenames in the *treemanifests segment* containing a
3335 Aside from the filenames in the *treemanifests segment* containing a
3335 trailing &quot;/&quot; character, it behaves identically to the *filelogs segment*
3336 trailing &quot;/&quot; character, it behaves identically to the *filelogs segment*
3336 (see below). The final sub-segment is followed by an *empty chunk* (logically,
3337 (see below). The final sub-segment is followed by an *empty chunk* (logically,
3337 a sub-segment with filename size 0). This denotes the boundary to the
3338 a sub-segment with filename size 0). This denotes the boundary to the
3338 *filelogs segment*.
3339 *filelogs segment*.
3339 </p>
3340 </p>
3340 <h2>Filelogs Segment</h2>
3341 <h2>Filelogs Segment</h2>
3341 <p>
3342 <p>
3342 The *filelogs segment* consists of multiple sub-segments, each
3343 The *filelogs segment* consists of multiple sub-segments, each
3343 corresponding to an individual file whose data is being described:
3344 corresponding to an individual file whose data is being described:
3344 </p>
3345 </p>
3345 <pre>
3346 <pre>
3346 +--------------------------------------------------+
3347 +--------------------------------------------------+
3347 | | | | | |
3348 | | | | | |
3348 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
3349 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
3349 | | | | | (4 bytes) |
3350 | | | | | (4 bytes) |
3350 | | | | | |
3351 | | | | | |
3351 +--------------------------------------------------+
3352 +--------------------------------------------------+
3352 </pre>
3353 </pre>
3353 <p>
3354 <p>
3354 The final filelog sub-segment is followed by an *empty chunk* (logically,
3355 The final filelog sub-segment is followed by an *empty chunk* (logically,
3355 a sub-segment with filename size 0). This denotes the end of the segment
3356 a sub-segment with filename size 0). This denotes the end of the segment
3356 and of the overall changegroup.
3357 and of the overall changegroup.
3357 </p>
3358 </p>
3358 <p>
3359 <p>
3359 Each filelog sub-segment consists of the following:
3360 Each filelog sub-segment consists of the following:
3360 </p>
3361 </p>
3361 <pre>
3362 <pre>
3362 +------------------------------------------------------+
3363 +------------------------------------------------------+
3363 | | | |
3364 | | | |
3364 | filename length | filename | delta group |
3365 | filename length | filename | delta group |
3365 | (4 bytes) | (&lt;length - 4&gt; bytes) | (various) |
3366 | (4 bytes) | (&lt;length - 4&gt; bytes) | (various) |
3366 | | | |
3367 | | | |
3367 +------------------------------------------------------+
3368 +------------------------------------------------------+
3368 </pre>
3369 </pre>
3369 <p>
3370 <p>
3370 That is, a *chunk* consisting of the filename (not terminated or padded)
3371 That is, a *chunk* consisting of the filename (not terminated or padded)
3371 followed by N chunks constituting the *delta group* for this file. The
3372 followed by N chunks constituting the *delta group* for this file. The
3372 *empty chunk* at the end of each *delta group* denotes the boundary to the
3373 *empty chunk* at the end of each *delta group* denotes the boundary to the
3373 next filelog sub-segment.
3374 next filelog sub-segment.
3374 </p>
3375 </p>
3375
3376
3376 </div>
3377 </div>
3377 </div>
3378 </div>
3378 </div>
3379 </div>
3379
3380
3380
3381
3381
3382
3382 </body>
3383 </body>
3383 </html>
3384 </html>
3384
3385
3385
3386
3386 $ killdaemons.py
3387 $ killdaemons.py
3387
3388
3388 #endif
3389 #endif
@@ -1,413 +1,425 b''
1 $ cat >> $HGRCPATH << EOF
1 $ cat >> $HGRCPATH << EOF
2 > [extensions]
2 > [extensions]
3 > share =
3 > share =
4 > EOF
4 > EOF
5
5
6 store and revlogv1 are required in source
6 store and revlogv1 are required in source
7
7
8 $ hg --config format.usestore=false init no-store
8 $ hg --config format.usestore=false init no-store
9 $ hg -R no-store debugupgraderepo
9 $ hg -R no-store debugupgraderepo
10 abort: cannot upgrade repository; requirement missing: store
10 abort: cannot upgrade repository; requirement missing: store
11 [255]
11 [255]
12
12
13 $ hg init no-revlogv1
13 $ hg init no-revlogv1
14 $ cat > no-revlogv1/.hg/requires << EOF
14 $ cat > no-revlogv1/.hg/requires << EOF
15 > dotencode
15 > dotencode
16 > fncache
16 > fncache
17 > generaldelta
17 > generaldelta
18 > store
18 > store
19 > EOF
19 > EOF
20
20
21 $ hg -R no-revlogv1 debugupgraderepo
21 $ hg -R no-revlogv1 debugupgraderepo
22 abort: cannot upgrade repository; requirement missing: revlogv1
22 abort: cannot upgrade repository; requirement missing: revlogv1
23 [255]
23 [255]
24
24
25 Cannot upgrade shared repositories
25 Cannot upgrade shared repositories
26
26
27 $ hg init share-parent
27 $ hg init share-parent
28 $ hg -q share share-parent share-child
28 $ hg -q share share-parent share-child
29
29
30 $ hg -R share-child debugupgraderepo
30 $ hg -R share-child debugupgraderepo
31 abort: cannot upgrade repository; unsupported source requirement: shared
31 abort: cannot upgrade repository; unsupported source requirement: shared
32 [255]
32 [255]
33
33
34 Do not yet support upgrading manifestv2 and treemanifest repos
34 Do not yet support upgrading manifestv2 and treemanifest repos
35
35
36 $ hg --config experimental.manifestv2=true init manifestv2
36 $ hg --config experimental.manifestv2=true init manifestv2
37 $ hg -R manifestv2 debugupgraderepo
37 $ hg -R manifestv2 debugupgraderepo
38 abort: cannot upgrade repository; unsupported source requirement: manifestv2
38 abort: cannot upgrade repository; unsupported source requirement: manifestv2
39 [255]
39 [255]
40
40
41 $ hg --config experimental.treemanifest=true init treemanifest
41 $ hg --config experimental.treemanifest=true init treemanifest
42 $ hg -R treemanifest debugupgraderepo
42 $ hg -R treemanifest debugupgraderepo
43 abort: cannot upgrade repository; unsupported source requirement: treemanifest
43 abort: cannot upgrade repository; unsupported source requirement: treemanifest
44 [255]
44 [255]
45
45
46 Cannot add manifestv2 or treemanifest requirement during upgrade
46 Cannot add manifestv2 or treemanifest requirement during upgrade
47
47
48 $ hg init disallowaddedreq
48 $ hg init disallowaddedreq
49 $ hg -R disallowaddedreq --config experimental.manifestv2=true --config experimental.treemanifest=true debugupgraderepo
49 $ hg -R disallowaddedreq --config experimental.manifestv2=true --config experimental.treemanifest=true debugupgraderepo
50 abort: cannot upgrade repository; do not support adding requirement: manifestv2, treemanifest
50 abort: cannot upgrade repository; do not support adding requirement: manifestv2, treemanifest
51 [255]
51 [255]
52
52
53 An upgrade of a repository created with recommended settings only suggests optimizations
53 An upgrade of a repository created with recommended settings only suggests optimizations
54
54
55 $ hg init empty
55 $ hg init empty
56 $ cd empty
56 $ cd empty
57 $ hg debugformat
58 format-variant repo
59 fncache: yes
60 dotencode: yes
61 generaldelta: yes
62 plain-cl-delta: yes
57 $ hg debugupgraderepo
63 $ hg debugupgraderepo
58 (no feature deficiencies found in existing repository)
64 (no feature deficiencies found in existing repository)
59 performing an upgrade with "--run" will make the following changes:
65 performing an upgrade with "--run" will make the following changes:
60
66
61 requirements
67 requirements
62 preserved: dotencode, fncache, generaldelta, revlogv1, store
68 preserved: dotencode, fncache, generaldelta, revlogv1, store
63
69
64 additional optimizations are available by specifying "--optimize <name>":
70 additional optimizations are available by specifying "--optimize <name>":
65
71
66 redeltaparent
72 redeltaparent
67 deltas within internal storage will be recalculated to choose an optimal base revision where this was not already done; the size of the repository may shrink and various operations may become faster; the first time this optimization is performed could slow down upgrade execution considerably; subsequent invocations should not run noticeably slower
73 deltas within internal storage will be recalculated to choose an optimal base revision where this was not already done; the size of the repository may shrink and various operations may become faster; the first time this optimization is performed could slow down upgrade execution considerably; subsequent invocations should not run noticeably slower
68
74
69 redeltamultibase
75 redeltamultibase
70 deltas within internal storage will be recalculated against multiple base revision and the smallest difference will be used; the size of the repository may shrink significantly when there are many merges; this optimization will slow down execution in proportion to the number of merges in the repository and the amount of files in the repository; this slow down should not be significant unless there are tens of thousands of files and thousands of merges
76 deltas within internal storage will be recalculated against multiple base revision and the smallest difference will be used; the size of the repository may shrink significantly when there are many merges; this optimization will slow down execution in proportion to the number of merges in the repository and the amount of files in the repository; this slow down should not be significant unless there are tens of thousands of files and thousands of merges
71
77
72 redeltaall
78 redeltaall
73 deltas within internal storage will always be recalculated without reusing prior deltas; this will likely make execution run several times slower; this optimization is typically not needed
79 deltas within internal storage will always be recalculated without reusing prior deltas; this will likely make execution run several times slower; this optimization is typically not needed
74
80
75
81
76 --optimize can be used to add optimizations
82 --optimize can be used to add optimizations
77
83
78 $ hg debugupgrade --optimize redeltaparent
84 $ hg debugupgrade --optimize redeltaparent
79 (no feature deficiencies found in existing repository)
85 (no feature deficiencies found in existing repository)
80 performing an upgrade with "--run" will make the following changes:
86 performing an upgrade with "--run" will make the following changes:
81
87
82 requirements
88 requirements
83 preserved: dotencode, fncache, generaldelta, revlogv1, store
89 preserved: dotencode, fncache, generaldelta, revlogv1, store
84
90
85 redeltaparent
91 redeltaparent
86 deltas within internal storage will choose a new base revision if needed
92 deltas within internal storage will choose a new base revision if needed
87
93
88 additional optimizations are available by specifying "--optimize <name>":
94 additional optimizations are available by specifying "--optimize <name>":
89
95
90 redeltamultibase
96 redeltamultibase
91 deltas within internal storage will be recalculated against multiple base revision and the smallest difference will be used; the size of the repository may shrink significantly when there are many merges; this optimization will slow down execution in proportion to the number of merges in the repository and the amount of files in the repository; this slow down should not be significant unless there are tens of thousands of files and thousands of merges
97 deltas within internal storage will be recalculated against multiple base revision and the smallest difference will be used; the size of the repository may shrink significantly when there are many merges; this optimization will slow down execution in proportion to the number of merges in the repository and the amount of files in the repository; this slow down should not be significant unless there are tens of thousands of files and thousands of merges
92
98
93 redeltaall
99 redeltaall
94 deltas within internal storage will always be recalculated without reusing prior deltas; this will likely make execution run several times slower; this optimization is typically not needed
100 deltas within internal storage will always be recalculated without reusing prior deltas; this will likely make execution run several times slower; this optimization is typically not needed
95
101
96
102
97 Various sub-optimal detections work
103 Various sub-optimal detections work
98
104
99 $ cat > .hg/requires << EOF
105 $ cat > .hg/requires << EOF
100 > revlogv1
106 > revlogv1
101 > store
107 > store
102 > EOF
108 > EOF
103
109
110 $ hg debugformat
111 format-variant repo
112 fncache: no
113 dotencode: no
114 generaldelta: no
115 plain-cl-delta: yes
104 $ hg debugupgraderepo
116 $ hg debugupgraderepo
105 repository lacks features recommended by current config options:
117 repository lacks features recommended by current config options:
106
118
107 fncache
119 fncache
108 long and reserved filenames may not work correctly; repository performance is sub-optimal
120 long and reserved filenames may not work correctly; repository performance is sub-optimal
109
121
110 dotencode
122 dotencode
111 storage of filenames beginning with a period or space may not work correctly
123 storage of filenames beginning with a period or space may not work correctly
112
124
113 generaldelta
125 generaldelta
114 deltas within internal storage are unable to choose optimal revisions; repository is larger and slower than it could be; interaction with other repositories may require extra network and CPU resources, making "hg push" and "hg pull" slower
126 deltas within internal storage are unable to choose optimal revisions; repository is larger and slower than it could be; interaction with other repositories may require extra network and CPU resources, making "hg push" and "hg pull" slower
115
127
116
128
117 performing an upgrade with "--run" will make the following changes:
129 performing an upgrade with "--run" will make the following changes:
118
130
119 requirements
131 requirements
120 preserved: revlogv1, store
132 preserved: revlogv1, store
121 added: dotencode, fncache, generaldelta
133 added: dotencode, fncache, generaldelta
122
134
123 fncache
135 fncache
124 repository will be more resilient to storing certain paths and performance of certain operations should be improved
136 repository will be more resilient to storing certain paths and performance of certain operations should be improved
125
137
126 dotencode
138 dotencode
127 repository will be better able to store files beginning with a space or period
139 repository will be better able to store files beginning with a space or period
128
140
129 generaldelta
141 generaldelta
130 repository storage will be able to create optimal deltas; new repository data will be smaller and read times should decrease; interacting with other repositories using this storage model should require less network and CPU resources, making "hg push" and "hg pull" faster
142 repository storage will be able to create optimal deltas; new repository data will be smaller and read times should decrease; interacting with other repositories using this storage model should require less network and CPU resources, making "hg push" and "hg pull" faster
131
143
132 additional optimizations are available by specifying "--optimize <name>":
144 additional optimizations are available by specifying "--optimize <name>":
133
145
134 redeltaparent
146 redeltaparent
135 deltas within internal storage will be recalculated to choose an optimal base revision where this was not already done; the size of the repository may shrink and various operations may become faster; the first time this optimization is performed could slow down upgrade execution considerably; subsequent invocations should not run noticeably slower
147 deltas within internal storage will be recalculated to choose an optimal base revision where this was not already done; the size of the repository may shrink and various operations may become faster; the first time this optimization is performed could slow down upgrade execution considerably; subsequent invocations should not run noticeably slower
136
148
137 redeltamultibase
149 redeltamultibase
138 deltas within internal storage will be recalculated against multiple base revision and the smallest difference will be used; the size of the repository may shrink significantly when there are many merges; this optimization will slow down execution in proportion to the number of merges in the repository and the amount of files in the repository; this slow down should not be significant unless there are tens of thousands of files and thousands of merges
150 deltas within internal storage will be recalculated against multiple base revision and the smallest difference will be used; the size of the repository may shrink significantly when there are many merges; this optimization will slow down execution in proportion to the number of merges in the repository and the amount of files in the repository; this slow down should not be significant unless there are tens of thousands of files and thousands of merges
139
151
140 redeltaall
152 redeltaall
141 deltas within internal storage will always be recalculated without reusing prior deltas; this will likely make execution run several times slower; this optimization is typically not needed
153 deltas within internal storage will always be recalculated without reusing prior deltas; this will likely make execution run several times slower; this optimization is typically not needed
142
154
143
155
144 $ hg --config format.dotencode=false debugupgraderepo
156 $ hg --config format.dotencode=false debugupgraderepo
145 repository lacks features recommended by current config options:
157 repository lacks features recommended by current config options:
146
158
147 fncache
159 fncache
148 long and reserved filenames may not work correctly; repository performance is sub-optimal
160 long and reserved filenames may not work correctly; repository performance is sub-optimal
149
161
150 generaldelta
162 generaldelta
151 deltas within internal storage are unable to choose optimal revisions; repository is larger and slower than it could be; interaction with other repositories may require extra network and CPU resources, making "hg push" and "hg pull" slower
163 deltas within internal storage are unable to choose optimal revisions; repository is larger and slower than it could be; interaction with other repositories may require extra network and CPU resources, making "hg push" and "hg pull" slower
152
164
153 repository lacks features used by the default config options:
165 repository lacks features used by the default config options:
154
166
155 dotencode
167 dotencode
156 storage of filenames beginning with a period or space may not work correctly
168 storage of filenames beginning with a period or space may not work correctly
157
169
158
170
159 performing an upgrade with "--run" will make the following changes:
171 performing an upgrade with "--run" will make the following changes:
160
172
161 requirements
173 requirements
162 preserved: revlogv1, store
174 preserved: revlogv1, store
163 added: fncache, generaldelta
175 added: fncache, generaldelta
164
176
165 fncache
177 fncache
166 repository will be more resilient to storing certain paths and performance of certain operations should be improved
178 repository will be more resilient to storing certain paths and performance of certain operations should be improved
167
179
168 generaldelta
180 generaldelta
169 repository storage will be able to create optimal deltas; new repository data will be smaller and read times should decrease; interacting with other repositories using this storage model should require less network and CPU resources, making "hg push" and "hg pull" faster
181 repository storage will be able to create optimal deltas; new repository data will be smaller and read times should decrease; interacting with other repositories using this storage model should require less network and CPU resources, making "hg push" and "hg pull" faster
170
182
171 additional optimizations are available by specifying "--optimize <name>":
183 additional optimizations are available by specifying "--optimize <name>":
172
184
173 redeltaparent
185 redeltaparent
174 deltas within internal storage will be recalculated to choose an optimal base revision where this was not already done; the size of the repository may shrink and various operations may become faster; the first time this optimization is performed could slow down upgrade execution considerably; subsequent invocations should not run noticeably slower
186 deltas within internal storage will be recalculated to choose an optimal base revision where this was not already done; the size of the repository may shrink and various operations may become faster; the first time this optimization is performed could slow down upgrade execution considerably; subsequent invocations should not run noticeably slower
175
187
176 redeltamultibase
188 redeltamultibase
177 deltas within internal storage will be recalculated against multiple base revision and the smallest difference will be used; the size of the repository may shrink significantly when there are many merges; this optimization will slow down execution in proportion to the number of merges in the repository and the amount of files in the repository; this slow down should not be significant unless there are tens of thousands of files and thousands of merges
189 deltas within internal storage will be recalculated against multiple base revision and the smallest difference will be used; the size of the repository may shrink significantly when there are many merges; this optimization will slow down execution in proportion to the number of merges in the repository and the amount of files in the repository; this slow down should not be significant unless there are tens of thousands of files and thousands of merges
178
190
179 redeltaall
191 redeltaall
180 deltas within internal storage will always be recalculated without reusing prior deltas; this will likely make execution run several times slower; this optimization is typically not needed
192 deltas within internal storage will always be recalculated without reusing prior deltas; this will likely make execution run several times slower; this optimization is typically not needed
181
193
182
194
183 $ cd ..
195 $ cd ..
184
196
185 Upgrading a repository that is already modern essentially no-ops
197 Upgrading a repository that is already modern essentially no-ops
186
198
187 $ hg init modern
199 $ hg init modern
188 $ hg -R modern debugupgraderepo --run
200 $ hg -R modern debugupgraderepo --run
189 upgrade will perform the following actions:
201 upgrade will perform the following actions:
190
202
191 requirements
203 requirements
192 preserved: dotencode, fncache, generaldelta, revlogv1, store
204 preserved: dotencode, fncache, generaldelta, revlogv1, store
193
205
194 beginning upgrade...
206 beginning upgrade...
195 repository locked and read-only
207 repository locked and read-only
196 creating temporary repository to stage migrated data: $TESTTMP/modern/.hg/upgrade.* (glob)
208 creating temporary repository to stage migrated data: $TESTTMP/modern/.hg/upgrade.* (glob)
197 (it is safe to interrupt this process any time before data migration completes)
209 (it is safe to interrupt this process any time before data migration completes)
198 data fully migrated to temporary repository
210 data fully migrated to temporary repository
199 marking source repository as being upgraded; clients will be unable to read from repository
211 marking source repository as being upgraded; clients will be unable to read from repository
200 starting in-place swap of repository data
212 starting in-place swap of repository data
201 replaced files will be backed up at $TESTTMP/modern/.hg/upgradebackup.* (glob)
213 replaced files will be backed up at $TESTTMP/modern/.hg/upgradebackup.* (glob)
202 replacing store...
214 replacing store...
203 store replacement complete; repository was inconsistent for *s (glob)
215 store replacement complete; repository was inconsistent for *s (glob)
204 finalizing requirements file and making repository readable again
216 finalizing requirements file and making repository readable again
205 removing temporary repository $TESTTMP/modern/.hg/upgrade.* (glob)
217 removing temporary repository $TESTTMP/modern/.hg/upgrade.* (glob)
206 copy of old repository backed up at $TESTTMP/modern/.hg/upgradebackup.* (glob)
218 copy of old repository backed up at $TESTTMP/modern/.hg/upgradebackup.* (glob)
207 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
219 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
208
220
209 Upgrading a repository to generaldelta works
221 Upgrading a repository to generaldelta works
210
222
211 $ hg --config format.usegeneraldelta=false init upgradegd
223 $ hg --config format.usegeneraldelta=false init upgradegd
212 $ cd upgradegd
224 $ cd upgradegd
213 $ touch f0
225 $ touch f0
214 $ hg -q commit -A -m initial
226 $ hg -q commit -A -m initial
215 $ touch f1
227 $ touch f1
216 $ hg -q commit -A -m 'add f1'
228 $ hg -q commit -A -m 'add f1'
217 $ hg -q up -r 0
229 $ hg -q up -r 0
218 $ touch f2
230 $ touch f2
219 $ hg -q commit -A -m 'add f2'
231 $ hg -q commit -A -m 'add f2'
220
232
221 $ hg debugupgraderepo --run
233 $ hg debugupgraderepo --run
222 upgrade will perform the following actions:
234 upgrade will perform the following actions:
223
235
224 requirements
236 requirements
225 preserved: dotencode, fncache, revlogv1, store
237 preserved: dotencode, fncache, revlogv1, store
226 added: generaldelta
238 added: generaldelta
227
239
228 generaldelta
240 generaldelta
229 repository storage will be able to create optimal deltas; new repository data will be smaller and read times should decrease; interacting with other repositories using this storage model should require less network and CPU resources, making "hg push" and "hg pull" faster
241 repository storage will be able to create optimal deltas; new repository data will be smaller and read times should decrease; interacting with other repositories using this storage model should require less network and CPU resources, making "hg push" and "hg pull" faster
230
242
231 beginning upgrade...
243 beginning upgrade...
232 repository locked and read-only
244 repository locked and read-only
233 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
245 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
234 (it is safe to interrupt this process any time before data migration completes)
246 (it is safe to interrupt this process any time before data migration completes)
235 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
247 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
236 migrating 341 bytes in store; 401 bytes tracked data
248 migrating 341 bytes in store; 401 bytes tracked data
237 migrating 3 filelogs containing 3 revisions (0 bytes in store; 0 bytes tracked data)
249 migrating 3 filelogs containing 3 revisions (0 bytes in store; 0 bytes tracked data)
238 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
250 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
239 migrating 1 manifests containing 3 revisions (157 bytes in store; 220 bytes tracked data)
251 migrating 1 manifests containing 3 revisions (157 bytes in store; 220 bytes tracked data)
240 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
252 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
241 migrating changelog containing 3 revisions (184 bytes in store; 181 bytes tracked data)
253 migrating changelog containing 3 revisions (184 bytes in store; 181 bytes tracked data)
242 finished migrating 3 changelog revisions; change in size: 0 bytes
254 finished migrating 3 changelog revisions; change in size: 0 bytes
243 finished migrating 9 total revisions; total change in store size: 0 bytes
255 finished migrating 9 total revisions; total change in store size: 0 bytes
244 copying phaseroots
256 copying phaseroots
245 data fully migrated to temporary repository
257 data fully migrated to temporary repository
246 marking source repository as being upgraded; clients will be unable to read from repository
258 marking source repository as being upgraded; clients will be unable to read from repository
247 starting in-place swap of repository data
259 starting in-place swap of repository data
248 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
260 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
249 replacing store...
261 replacing store...
250 store replacement complete; repository was inconsistent for *s (glob)
262 store replacement complete; repository was inconsistent for *s (glob)
251 finalizing requirements file and making repository readable again
263 finalizing requirements file and making repository readable again
252 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
264 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
253 copy of old repository backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
265 copy of old repository backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
254 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
266 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
255
267
256 Original requirements backed up
268 Original requirements backed up
257
269
258 $ cat .hg/upgradebackup.*/requires
270 $ cat .hg/upgradebackup.*/requires
259 dotencode
271 dotencode
260 fncache
272 fncache
261 revlogv1
273 revlogv1
262 store
274 store
263
275
264 generaldelta added to original requirements files
276 generaldelta added to original requirements files
265
277
266 $ cat .hg/requires
278 $ cat .hg/requires
267 dotencode
279 dotencode
268 fncache
280 fncache
269 generaldelta
281 generaldelta
270 revlogv1
282 revlogv1
271 store
283 store
272
284
273 store directory has files we expect
285 store directory has files we expect
274
286
275 $ ls .hg/store
287 $ ls .hg/store
276 00changelog.i
288 00changelog.i
277 00manifest.i
289 00manifest.i
278 data
290 data
279 fncache
291 fncache
280 phaseroots
292 phaseroots
281 undo
293 undo
282 undo.backupfiles
294 undo.backupfiles
283 undo.phaseroots
295 undo.phaseroots
284
296
285 manifest should be generaldelta
297 manifest should be generaldelta
286
298
287 $ hg debugrevlog -m | grep flags
299 $ hg debugrevlog -m | grep flags
288 flags : inline, generaldelta
300 flags : inline, generaldelta
289
301
290 verify should be happy
302 verify should be happy
291
303
292 $ hg verify
304 $ hg verify
293 checking changesets
305 checking changesets
294 checking manifests
306 checking manifests
295 crosschecking files in changesets and manifests
307 crosschecking files in changesets and manifests
296 checking files
308 checking files
297 3 files, 3 changesets, 3 total revisions
309 3 files, 3 changesets, 3 total revisions
298
310
299 old store should be backed up
311 old store should be backed up
300
312
301 $ ls .hg/upgradebackup.*/store
313 $ ls .hg/upgradebackup.*/store
302 00changelog.i
314 00changelog.i
303 00manifest.i
315 00manifest.i
304 data
316 data
305 fncache
317 fncache
306 phaseroots
318 phaseroots
307 undo
319 undo
308 undo.backup.fncache
320 undo.backup.fncache
309 undo.backupfiles
321 undo.backupfiles
310 undo.phaseroots
322 undo.phaseroots
311
323
312 $ cd ..
324 $ cd ..
313
325
314 store files with special filenames aren't encoded during copy
326 store files with special filenames aren't encoded during copy
315
327
316 $ hg init store-filenames
328 $ hg init store-filenames
317 $ cd store-filenames
329 $ cd store-filenames
318 $ touch foo
330 $ touch foo
319 $ hg -q commit -A -m initial
331 $ hg -q commit -A -m initial
320 $ touch .hg/store/.XX_special_filename
332 $ touch .hg/store/.XX_special_filename
321
333
322 $ hg debugupgraderepo --run
334 $ hg debugupgraderepo --run
323 upgrade will perform the following actions:
335 upgrade will perform the following actions:
324
336
325 requirements
337 requirements
326 preserved: dotencode, fncache, generaldelta, revlogv1, store
338 preserved: dotencode, fncache, generaldelta, revlogv1, store
327
339
328 beginning upgrade...
340 beginning upgrade...
329 repository locked and read-only
341 repository locked and read-only
330 creating temporary repository to stage migrated data: $TESTTMP/store-filenames/.hg/upgrade.* (glob)
342 creating temporary repository to stage migrated data: $TESTTMP/store-filenames/.hg/upgrade.* (glob)
331 (it is safe to interrupt this process any time before data migration completes)
343 (it is safe to interrupt this process any time before data migration completes)
332 migrating 3 total revisions (1 in filelogs, 1 in manifests, 1 in changelog)
344 migrating 3 total revisions (1 in filelogs, 1 in manifests, 1 in changelog)
333 migrating 109 bytes in store; 107 bytes tracked data
345 migrating 109 bytes in store; 107 bytes tracked data
334 migrating 1 filelogs containing 1 revisions (0 bytes in store; 0 bytes tracked data)
346 migrating 1 filelogs containing 1 revisions (0 bytes in store; 0 bytes tracked data)
335 finished migrating 1 filelog revisions across 1 filelogs; change in size: 0 bytes
347 finished migrating 1 filelog revisions across 1 filelogs; change in size: 0 bytes
336 migrating 1 manifests containing 1 revisions (46 bytes in store; 45 bytes tracked data)
348 migrating 1 manifests containing 1 revisions (46 bytes in store; 45 bytes tracked data)
337 finished migrating 1 manifest revisions across 1 manifests; change in size: 0 bytes
349 finished migrating 1 manifest revisions across 1 manifests; change in size: 0 bytes
338 migrating changelog containing 1 revisions (63 bytes in store; 62 bytes tracked data)
350 migrating changelog containing 1 revisions (63 bytes in store; 62 bytes tracked data)
339 finished migrating 1 changelog revisions; change in size: 0 bytes
351 finished migrating 1 changelog revisions; change in size: 0 bytes
340 finished migrating 3 total revisions; total change in store size: 0 bytes
352 finished migrating 3 total revisions; total change in store size: 0 bytes
341 copying .XX_special_filename
353 copying .XX_special_filename
342 copying phaseroots
354 copying phaseroots
343 data fully migrated to temporary repository
355 data fully migrated to temporary repository
344 marking source repository as being upgraded; clients will be unable to read from repository
356 marking source repository as being upgraded; clients will be unable to read from repository
345 starting in-place swap of repository data
357 starting in-place swap of repository data
346 replaced files will be backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
358 replaced files will be backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
347 replacing store...
359 replacing store...
348 store replacement complete; repository was inconsistent for *s (glob)
360 store replacement complete; repository was inconsistent for *s (glob)
349 finalizing requirements file and making repository readable again
361 finalizing requirements file and making repository readable again
350 removing temporary repository $TESTTMP/store-filenames/.hg/upgrade.* (glob)
362 removing temporary repository $TESTTMP/store-filenames/.hg/upgrade.* (glob)
351 copy of old repository backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
363 copy of old repository backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
352 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
364 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
353
365
354 $ cd ..
366 $ cd ..
355
367
356 Check upgrading a large file repository
368 Check upgrading a large file repository
357 ---------------------------------------
369 ---------------------------------------
358
370
359 $ hg init largefilesrepo
371 $ hg init largefilesrepo
360 $ cat << EOF >> largefilesrepo/.hg/hgrc
372 $ cat << EOF >> largefilesrepo/.hg/hgrc
361 > [extensions]
373 > [extensions]
362 > largefiles =
374 > largefiles =
363 > EOF
375 > EOF
364
376
365 $ cd largefilesrepo
377 $ cd largefilesrepo
366 $ touch foo
378 $ touch foo
367 $ hg add --large foo
379 $ hg add --large foo
368 $ hg -q commit -m initial
380 $ hg -q commit -m initial
369 $ cat .hg/requires
381 $ cat .hg/requires
370 dotencode
382 dotencode
371 fncache
383 fncache
372 generaldelta
384 generaldelta
373 largefiles
385 largefiles
374 revlogv1
386 revlogv1
375 store
387 store
376
388
377 $ hg debugupgraderepo --run
389 $ hg debugupgraderepo --run
378 upgrade will perform the following actions:
390 upgrade will perform the following actions:
379
391
380 requirements
392 requirements
381 preserved: dotencode, fncache, generaldelta, largefiles, revlogv1, store
393 preserved: dotencode, fncache, generaldelta, largefiles, revlogv1, store
382
394
383 beginning upgrade...
395 beginning upgrade...
384 repository locked and read-only
396 repository locked and read-only
385 creating temporary repository to stage migrated data: $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
397 creating temporary repository to stage migrated data: $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
386 (it is safe to interrupt this process any time before data migration completes)
398 (it is safe to interrupt this process any time before data migration completes)
387 migrating 3 total revisions (1 in filelogs, 1 in manifests, 1 in changelog)
399 migrating 3 total revisions (1 in filelogs, 1 in manifests, 1 in changelog)
388 migrating 163 bytes in store; 160 bytes tracked data
400 migrating 163 bytes in store; 160 bytes tracked data
389 migrating 1 filelogs containing 1 revisions (42 bytes in store; 41 bytes tracked data)
401 migrating 1 filelogs containing 1 revisions (42 bytes in store; 41 bytes tracked data)
390 finished migrating 1 filelog revisions across 1 filelogs; change in size: 0 bytes
402 finished migrating 1 filelog revisions across 1 filelogs; change in size: 0 bytes
391 migrating 1 manifests containing 1 revisions (52 bytes in store; 51 bytes tracked data)
403 migrating 1 manifests containing 1 revisions (52 bytes in store; 51 bytes tracked data)
392 finished migrating 1 manifest revisions across 1 manifests; change in size: 0 bytes
404 finished migrating 1 manifest revisions across 1 manifests; change in size: 0 bytes
393 migrating changelog containing 1 revisions (69 bytes in store; 68 bytes tracked data)
405 migrating changelog containing 1 revisions (69 bytes in store; 68 bytes tracked data)
394 finished migrating 1 changelog revisions; change in size: 0 bytes
406 finished migrating 1 changelog revisions; change in size: 0 bytes
395 finished migrating 3 total revisions; total change in store size: 0 bytes
407 finished migrating 3 total revisions; total change in store size: 0 bytes
396 copying phaseroots
408 copying phaseroots
397 data fully migrated to temporary repository
409 data fully migrated to temporary repository
398 marking source repository as being upgraded; clients will be unable to read from repository
410 marking source repository as being upgraded; clients will be unable to read from repository
399 starting in-place swap of repository data
411 starting in-place swap of repository data
400 replaced files will be backed up at $TESTTMP/largefilesrepo/.hg/upgradebackup.* (glob)
412 replaced files will be backed up at $TESTTMP/largefilesrepo/.hg/upgradebackup.* (glob)
401 replacing store...
413 replacing store...
402 store replacement complete; repository was inconsistent for 0.0s
414 store replacement complete; repository was inconsistent for 0.0s
403 finalizing requirements file and making repository readable again
415 finalizing requirements file and making repository readable again
404 removing temporary repository $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
416 removing temporary repository $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
405 copy of old repository backed up at $TESTTMP/largefilesrepo/.hg/upgradebackup.* (glob)
417 copy of old repository backed up at $TESTTMP/largefilesrepo/.hg/upgradebackup.* (glob)
406 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
418 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
407 $ cat .hg/requires
419 $ cat .hg/requires
408 dotencode
420 dotencode
409 fncache
421 fncache
410 generaldelta
422 generaldelta
411 largefiles
423 largefiles
412 revlogv1
424 revlogv1
413 store
425 store
General Comments 0
You need to be logged in to leave comments. Login now