##// END OF EJS Templates
help: assigning topic categories...
Rodrigo Damazio -
r40330:fabbf931 default
parent child Browse files
Show More
@@ -1,229 +1,230 b''
1 1 #!/usr/bin/env python
2 2 """usage: %s DOC ...
3 3
4 4 where DOC is the name of a document
5 5 """
6 6
7 7 from __future__ import absolute_import
8 8
9 9 import os
10 10 import sys
11 11 import textwrap
12 12
13 13 # This script is executed during installs and may not have C extensions
14 14 # available. Relax C module requirements.
15 15 os.environ['HGMODULEPOLICY'] = 'allow'
16 16 # import from the live mercurial repo
17 17 sys.path.insert(0, "..")
18 18 from mercurial import demandimport; demandimport.enable()
19 19 # Load util so that the locale path is set by i18n.setdatapath() before
20 20 # calling _().
21 21 from mercurial import util
22 22 util.datapath
23 23 from mercurial import (
24 24 commands,
25 25 extensions,
26 26 help,
27 27 minirst,
28 28 ui as uimod,
29 29 )
30 30 from mercurial.i18n import (
31 31 gettext,
32 32 _,
33 33 )
34 34
35 35 table = commands.table
36 36 globalopts = commands.globalopts
37 37 helptable = help.helptable
38 38 loaddoc = help.loaddoc
39 39
40 40 def get_desc(docstr):
41 41 if not docstr:
42 42 return "", ""
43 43 # sanitize
44 44 docstr = docstr.strip("\n")
45 45 docstr = docstr.rstrip()
46 46 shortdesc = docstr.splitlines()[0].strip()
47 47
48 48 i = docstr.find("\n")
49 49 if i != -1:
50 50 desc = docstr[i + 2:]
51 51 else:
52 52 desc = shortdesc
53 53
54 54 desc = textwrap.dedent(desc)
55 55
56 56 return (shortdesc, desc)
57 57
58 58 def get_opts(opts):
59 59 for opt in opts:
60 60 if len(opt) == 5:
61 61 shortopt, longopt, default, desc, optlabel = opt
62 62 else:
63 63 shortopt, longopt, default, desc = opt
64 64 optlabel = _("VALUE")
65 65 allopts = []
66 66 if shortopt:
67 67 allopts.append("-%s" % shortopt)
68 68 if longopt:
69 69 allopts.append("--%s" % longopt)
70 70 if isinstance(default, list):
71 71 allopts[-1] += " <%s[+]>" % optlabel
72 72 elif (default is not None) and not isinstance(default, bool):
73 73 allopts[-1] += " <%s>" % optlabel
74 74 if '\n' in desc:
75 75 # only remove line breaks and indentation
76 76 desc = ' '.join(l.lstrip() for l in desc.split('\n'))
77 77 desc += default and _(" (default: %s)") % default or ""
78 78 yield (", ".join(allopts), desc)
79 79
80 80 def get_cmd(cmd, cmdtable):
81 81 d = {}
82 82 attr = cmdtable[cmd]
83 83 cmds = cmd.lstrip("^").split("|")
84 84
85 85 d['cmd'] = cmds[0]
86 86 d['aliases'] = cmd.split("|")[1:]
87 87 d['desc'] = get_desc(gettext(attr[0].__doc__))
88 88 d['opts'] = list(get_opts(attr[1]))
89 89
90 90 s = 'hg ' + cmds[0]
91 91 if len(attr) > 2:
92 92 if not attr[2].startswith('hg'):
93 93 s += ' ' + attr[2]
94 94 else:
95 95 s = attr[2]
96 96 d['synopsis'] = s.strip()
97 97
98 98 return d
99 99
100 100 def showdoc(ui):
101 101 # print options
102 102 ui.write(minirst.section(_("Options")))
103 103 multioccur = False
104 104 for optstr, desc in get_opts(globalopts):
105 105 ui.write("%s\n %s\n\n" % (optstr, desc))
106 106 if optstr.endswith("[+]>"):
107 107 multioccur = True
108 108 if multioccur:
109 109 ui.write(_("\n[+] marked option can be specified multiple times\n"))
110 110 ui.write("\n")
111 111
112 112 # print cmds
113 113 ui.write(minirst.section(_("Commands")))
114 114 commandprinter(ui, table, minirst.subsection)
115 115
116 116 # print help topics
117 117 # The config help topic is included in the hgrc.5 man page.
118 118 helpprinter(ui, helptable, minirst.section, exclude=['config'])
119 119
120 120 ui.write(minirst.section(_("Extensions")))
121 121 ui.write(_("This section contains help for extensions that are "
122 122 "distributed together with Mercurial. Help for other "
123 123 "extensions is available in the help system."))
124 124 ui.write(("\n\n"
125 125 ".. contents::\n"
126 126 " :class: htmlonly\n"
127 127 " :local:\n"
128 128 " :depth: 1\n\n"))
129 129
130 130 for extensionname in sorted(allextensionnames()):
131 131 mod = extensions.load(ui, extensionname, None)
132 132 ui.write(minirst.subsection(extensionname))
133 133 ui.write("%s\n\n" % gettext(mod.__doc__))
134 134 cmdtable = getattr(mod, 'cmdtable', None)
135 135 if cmdtable:
136 136 ui.write(minirst.subsubsection(_('Commands')))
137 137 commandprinter(ui, cmdtable, minirst.subsubsubsection)
138 138
139 139 def showtopic(ui, topic):
140 140 extrahelptable = [
141 (["common"], '', loaddoc('common')),
142 (["hg.1"], '', loaddoc('hg.1')),
143 (["hg-ssh.8"], '', loaddoc('hg-ssh.8')),
144 (["hgignore.5"], '', loaddoc('hgignore.5')),
145 (["hgrc.5"], '', loaddoc('hgrc.5')),
146 (["hgignore.5.gendoc"], '', loaddoc('hgignore')),
147 (["hgrc.5.gendoc"], '', loaddoc('config')),
141 (["common"], '', loaddoc('common'), help.TOPIC_CATEGORY_MISC),
142 (["hg.1"], '', loaddoc('hg.1'), help.TOPIC_CATEGORY_CONFIG),
143 (["hg-ssh.8"], '', loaddoc('hg-ssh.8'), help.TOPIC_CATEGORY_CONFIG),
144 (["hgignore.5"], '', loaddoc('hgignore.5'), help.TOPIC_CATEGORY_CONFIG),
145 (["hgrc.5"], '', loaddoc('hgrc.5'), help.TOPIC_CATEGORY_CONFIG),
146 (["hgignore.5.gendoc"], '', loaddoc('hgignore'),
147 help.TOPIC_CATEGORY_CONFIG),
148 (["hgrc.5.gendoc"], '', loaddoc('config'), help.TOPIC_CATEGORY_CONFIG),
148 149 ]
149 150 helpprinter(ui, helptable + extrahelptable, None, include=[topic])
150 151
151 152 def helpprinter(ui, helptable, sectionfunc, include=[], exclude=[]):
152 153 for h in helptable:
153 154 names, sec, doc = h[0:3]
154 155 if exclude and names[0] in exclude:
155 156 continue
156 157 if include and names[0] not in include:
157 158 continue
158 159 for name in names:
159 160 ui.write(".. _%s:\n" % name)
160 161 ui.write("\n")
161 162 if sectionfunc:
162 163 ui.write(sectionfunc(sec))
163 164 if callable(doc):
164 165 doc = doc(ui)
165 166 ui.write(doc)
166 167 ui.write("\n")
167 168
168 169 def commandprinter(ui, cmdtable, sectionfunc):
169 170 h = {}
170 171 for c, attr in cmdtable.items():
171 172 f = c.split("|")[0]
172 173 f = f.lstrip("^")
173 174 h[f] = c
174 175 cmds = h.keys()
175 176 cmds.sort()
176 177
177 178 for f in cmds:
178 179 if f.startswith("debug"):
179 180 continue
180 181 d = get_cmd(h[f], cmdtable)
181 182 ui.write(sectionfunc(d['cmd']))
182 183 # short description
183 184 ui.write(d['desc'][0])
184 185 # synopsis
185 186 ui.write("::\n\n")
186 187 synopsislines = d['synopsis'].splitlines()
187 188 for line in synopsislines:
188 189 # some commands (such as rebase) have a multi-line
189 190 # synopsis
190 191 ui.write(" %s\n" % line)
191 192 ui.write('\n')
192 193 # description
193 194 ui.write("%s\n\n" % d['desc'][1])
194 195 # options
195 196 opt_output = list(d['opts'])
196 197 if opt_output:
197 198 opts_len = max([len(line[0]) for line in opt_output])
198 199 ui.write(_("Options:\n\n"))
199 200 multioccur = False
200 201 for optstr, desc in opt_output:
201 202 if desc:
202 203 s = "%-*s %s" % (opts_len, optstr, desc)
203 204 else:
204 205 s = optstr
205 206 ui.write("%s\n" % s)
206 207 if optstr.endswith("[+]>"):
207 208 multioccur = True
208 209 if multioccur:
209 210 ui.write(_("\n[+] marked option can be specified"
210 211 " multiple times\n"))
211 212 ui.write("\n")
212 213 # aliases
213 214 if d['aliases']:
214 215 ui.write(_(" aliases: %s\n\n") % " ".join(d['aliases']))
215 216
216 217
217 218 def allextensionnames():
218 219 return extensions.enabled().keys() + extensions.disabled().keys()
219 220
220 221 if __name__ == "__main__":
221 222 doc = 'hg.1.gendoc'
222 223 if len(sys.argv) > 1:
223 224 doc = sys.argv[1]
224 225
225 226 ui = uimod.ui.load()
226 227 if doc == 'hg.1.gendoc':
227 228 showdoc(ui)
228 229 else:
229 230 showtopic(ui, sys.argv[1])
@@ -1,803 +1,830 b''
1 1 # help.py - help data for mercurial
2 2 #
3 3 # Copyright 2006 Matt Mackall <mpm@selenic.com>
4 4 #
5 5 # This software may be used and distributed according to the terms of the
6 6 # GNU General Public License version 2 or any later version.
7 7
8 8 from __future__ import absolute_import
9 9
10 10 import itertools
11 11 import os
12 12 import textwrap
13 13
14 14 from .i18n import (
15 15 _,
16 16 gettext,
17 17 )
18 18 from . import (
19 19 cmdutil,
20 20 encoding,
21 21 error,
22 22 extensions,
23 23 fancyopts,
24 24 filemerge,
25 25 fileset,
26 26 minirst,
27 27 pycompat,
28 28 registrar,
29 29 revset,
30 30 templatefilters,
31 31 templatefuncs,
32 32 templatekw,
33 33 util,
34 34 )
35 35 from .hgweb import (
36 36 webcommands,
37 37 )
38 38
39 39 _exclkeywords = {
40 40 "(ADVANCED)",
41 41 "(DEPRECATED)",
42 42 "(EXPERIMENTAL)",
43 43 # i18n: "(ADVANCED)" is a keyword, must be translated consistently
44 44 _("(ADVANCED)"),
45 45 # i18n: "(DEPRECATED)" is a keyword, must be translated consistently
46 46 _("(DEPRECATED)"),
47 47 # i18n: "(EXPERIMENTAL)" is a keyword, must be translated consistently
48 48 _("(EXPERIMENTAL)"),
49 49 }
50 50
51 51 # The order in which command categories will be displayed.
52 52 # Extensions with custom categories should insert them into this list
53 53 # after/before the appropriate item, rather than replacing the list or
54 54 # assuming absolute positions.
55 55 CATEGORY_ORDER = [
56 56 registrar.command.CATEGORY_REPO_CREATION,
57 57 registrar.command.CATEGORY_REMOTE_REPO_MANAGEMENT,
58 58 registrar.command.CATEGORY_COMMITTING,
59 59 registrar.command.CATEGORY_CHANGE_MANAGEMENT,
60 60 registrar.command.CATEGORY_CHANGE_ORGANIZATION,
61 61 registrar.command.CATEGORY_FILE_CONTENTS,
62 62 registrar.command.CATEGORY_CHANGE_NAVIGATION ,
63 63 registrar.command.CATEGORY_WORKING_DIRECTORY,
64 64 registrar.command.CATEGORY_IMPORT_EXPORT,
65 65 registrar.command.CATEGORY_MAINTENANCE,
66 66 registrar.command.CATEGORY_HELP,
67 67 registrar.command.CATEGORY_MISC,
68 68 registrar.command.CATEGORY_NONE,
69 69 ]
70 70
71 71 # Human-readable category names. These are translated.
72 72 # Extensions with custom categories should add their names here.
73 73 CATEGORY_NAMES = {
74 74 registrar.command.CATEGORY_REPO_CREATION: 'Repository creation',
75 75 registrar.command.CATEGORY_REMOTE_REPO_MANAGEMENT:
76 76 'Remote repository management',
77 77 registrar.command.CATEGORY_COMMITTING: 'Change creation',
78 78 registrar.command.CATEGORY_CHANGE_NAVIGATION: 'Change navigation',
79 79 registrar.command.CATEGORY_CHANGE_MANAGEMENT: 'Change manipulation',
80 80 registrar.command.CATEGORY_CHANGE_ORGANIZATION: 'Change organization',
81 81 registrar.command.CATEGORY_WORKING_DIRECTORY:
82 82 'Working directory management',
83 83 registrar.command.CATEGORY_FILE_CONTENTS: 'File content management',
84 84 registrar.command.CATEGORY_IMPORT_EXPORT: 'Change import/export',
85 85 registrar.command.CATEGORY_MAINTENANCE: 'Repository maintenance',
86 86 registrar.command.CATEGORY_HELP: 'Help',
87 87 registrar.command.CATEGORY_MISC: 'Miscellaneous commands',
88 88 registrar.command.CATEGORY_NONE: 'Uncategorized commands',
89 89 }
90 90
91 91 # Topic categories.
92 TOPIC_CATEGORY_IDS = 'ids'
93 TOPIC_CATEGORY_OUTPUT = 'output'
94 TOPIC_CATEGORY_CONFIG = 'config'
95 TOPIC_CATEGORY_CONCEPTS = 'concepts'
96 TOPIC_CATEGORY_MISC = 'misc'
92 97 TOPIC_CATEGORY_NONE = 'none'
93 98
94 99 # The order in which topic categories will be displayed.
95 100 # Extensions with custom categories should insert them into this list
96 101 # after/before the appropriate item, rather than replacing the list or
97 102 # assuming absolute positions.
98 103 TOPIC_CATEGORY_ORDER = [
104 TOPIC_CATEGORY_IDS,
105 TOPIC_CATEGORY_OUTPUT,
106 TOPIC_CATEGORY_CONFIG,
107 TOPIC_CATEGORY_CONCEPTS,
108 TOPIC_CATEGORY_MISC,
99 109 TOPIC_CATEGORY_NONE,
100 110 ]
101 111
102 112 # Human-readable topic category names. These are translated.
103 113 TOPIC_CATEGORY_NAMES = {
114 TOPIC_CATEGORY_IDS: 'Mercurial identifiers',
115 TOPIC_CATEGORY_OUTPUT: 'Mercurial output',
116 TOPIC_CATEGORY_CONFIG: 'Mercurial configuration',
117 TOPIC_CATEGORY_CONCEPTS: 'Concepts',
118 TOPIC_CATEGORY_MISC: 'Miscellaneous',
119 TOPIC_CATEGORY_NONE: 'Uncategorized topics',
104 120 TOPIC_CATEGORY_NONE: 'Uncategorized topics',
105 121 }
106 122
107 123 def listexts(header, exts, indent=1, showdeprecated=False):
108 124 '''return a text listing of the given extensions'''
109 125 rst = []
110 126 if exts:
111 127 for name, desc in sorted(exts.iteritems()):
112 128 if not showdeprecated and any(w in desc for w in _exclkeywords):
113 129 continue
114 130 rst.append('%s:%s: %s\n' % (' ' * indent, name, desc))
115 131 if rst:
116 132 rst.insert(0, '\n%s\n\n' % header)
117 133 return rst
118 134
119 135 def extshelp(ui):
120 136 rst = loaddoc('extensions')(ui).splitlines(True)
121 137 rst.extend(listexts(
122 138 _('enabled extensions:'), extensions.enabled(), showdeprecated=True))
123 139 rst.extend(listexts(_('disabled extensions:'), extensions.disabled(),
124 140 showdeprecated=ui.verbose))
125 141 doc = ''.join(rst)
126 142 return doc
127 143
128 144 def optrst(header, options, verbose):
129 145 data = []
130 146 multioccur = False
131 147 for option in options:
132 148 if len(option) == 5:
133 149 shortopt, longopt, default, desc, optlabel = option
134 150 else:
135 151 shortopt, longopt, default, desc = option
136 152 optlabel = _("VALUE") # default label
137 153
138 154 if not verbose and any(w in desc for w in _exclkeywords):
139 155 continue
140 156
141 157 so = ''
142 158 if shortopt:
143 159 so = '-' + shortopt
144 160 lo = '--' + longopt
145 161
146 162 if isinstance(default, fancyopts.customopt):
147 163 default = default.getdefaultvalue()
148 164 if default and not callable(default):
149 165 # default is of unknown type, and in Python 2 we abused
150 166 # the %s-shows-repr property to handle integers etc. To
151 167 # match that behavior on Python 3, we do str(default) and
152 168 # then convert it to bytes.
153 169 desc += _(" (default: %s)") % pycompat.bytestr(default)
154 170
155 171 if isinstance(default, list):
156 172 lo += " %s [+]" % optlabel
157 173 multioccur = True
158 174 elif (default is not None) and not isinstance(default, bool):
159 175 lo += " %s" % optlabel
160 176
161 177 data.append((so, lo, desc))
162 178
163 179 if multioccur:
164 180 header += (_(" ([+] can be repeated)"))
165 181
166 182 rst = ['\n%s:\n\n' % header]
167 183 rst.extend(minirst.maketable(data, 1))
168 184
169 185 return ''.join(rst)
170 186
171 187 def indicateomitted(rst, omitted, notomitted=None):
172 188 rst.append('\n\n.. container:: omitted\n\n %s\n\n' % omitted)
173 189 if notomitted:
174 190 rst.append('\n\n.. container:: notomitted\n\n %s\n\n' % notomitted)
175 191
176 192 def filtercmd(ui, cmd, kw, doc):
177 193 if not ui.debugflag and cmd.startswith("debug") and kw != "debug":
178 194 return True
179 195 if not ui.verbose and doc and any(w in doc for w in _exclkeywords):
180 196 return True
181 197 return False
182 198
183 199 def topicmatch(ui, commands, kw):
184 200 """Return help topics matching kw.
185 201
186 202 Returns {'section': [(name, summary), ...], ...} where section is
187 203 one of topics, commands, extensions, or extensioncommands.
188 204 """
189 205 kw = encoding.lower(kw)
190 206 def lowercontains(container):
191 207 return kw in encoding.lower(container) # translated in helptable
192 208 results = {'topics': [],
193 209 'commands': [],
194 210 'extensions': [],
195 211 'extensioncommands': [],
196 212 }
197 213 for topic in helptable:
198 214 names, header, doc = topic[0:3]
199 215 # Old extensions may use a str as doc.
200 216 if (sum(map(lowercontains, names))
201 217 or lowercontains(header)
202 218 or (callable(doc) and lowercontains(doc(ui)))):
203 219 results['topics'].append((names[0], header))
204 220 for cmd, entry in commands.table.iteritems():
205 221 if len(entry) == 3:
206 222 summary = entry[2]
207 223 else:
208 224 summary = ''
209 225 # translate docs *before* searching there
210 226 docs = _(pycompat.getdoc(entry[0])) or ''
211 227 if kw in cmd or lowercontains(summary) or lowercontains(docs):
212 228 doclines = docs.splitlines()
213 229 if doclines:
214 230 summary = doclines[0]
215 231 cmdname = cmdutil.parsealiases(cmd)[0]
216 232 if filtercmd(ui, cmdname, kw, docs):
217 233 continue
218 234 results['commands'].append((cmdname, summary))
219 235 for name, docs in itertools.chain(
220 236 extensions.enabled(False).iteritems(),
221 237 extensions.disabled().iteritems()):
222 238 if not docs:
223 239 continue
224 240 name = name.rpartition('.')[-1]
225 241 if lowercontains(name) or lowercontains(docs):
226 242 # extension docs are already translated
227 243 results['extensions'].append((name, docs.splitlines()[0]))
228 244 try:
229 245 mod = extensions.load(ui, name, '')
230 246 except ImportError:
231 247 # debug message would be printed in extensions.load()
232 248 continue
233 249 for cmd, entry in getattr(mod, 'cmdtable', {}).iteritems():
234 250 if kw in cmd or (len(entry) > 2 and lowercontains(entry[2])):
235 251 cmdname = cmdutil.parsealiases(cmd)[0]
236 252 cmddoc = pycompat.getdoc(entry[0])
237 253 if cmddoc:
238 254 cmddoc = gettext(cmddoc).splitlines()[0]
239 255 else:
240 256 cmddoc = _('(no help text available)')
241 257 if filtercmd(ui, cmdname, kw, cmddoc):
242 258 continue
243 259 results['extensioncommands'].append((cmdname, cmddoc))
244 260 return results
245 261
246 262 def loaddoc(topic, subdir=None):
247 263 """Return a delayed loader for help/topic.txt."""
248 264
249 265 def loader(ui):
250 266 docdir = os.path.join(util.datapath, 'help')
251 267 if subdir:
252 268 docdir = os.path.join(docdir, subdir)
253 269 path = os.path.join(docdir, topic + ".txt")
254 270 doc = gettext(util.readfile(path))
255 271 for rewriter in helphooks.get(topic, []):
256 272 doc = rewriter(ui, topic, doc)
257 273 return doc
258 274
259 275 return loader
260 276
261 277 internalstable = sorted([
262 278 (['bundle2'], _('Bundle2'),
263 279 loaddoc('bundle2', subdir='internals')),
264 280 (['bundles'], _('Bundles'),
265 281 loaddoc('bundles', subdir='internals')),
266 282 (['cbor'], _('CBOR'),
267 283 loaddoc('cbor', subdir='internals')),
268 284 (['censor'], _('Censor'),
269 285 loaddoc('censor', subdir='internals')),
270 286 (['changegroups'], _('Changegroups'),
271 287 loaddoc('changegroups', subdir='internals')),
272 288 (['config'], _('Config Registrar'),
273 289 loaddoc('config', subdir='internals')),
274 290 (['requirements'], _('Repository Requirements'),
275 291 loaddoc('requirements', subdir='internals')),
276 292 (['revlogs'], _('Revision Logs'),
277 293 loaddoc('revlogs', subdir='internals')),
278 294 (['wireprotocol'], _('Wire Protocol'),
279 295 loaddoc('wireprotocol', subdir='internals')),
280 296 (['wireprotocolrpc'], _('Wire Protocol RPC'),
281 297 loaddoc('wireprotocolrpc', subdir='internals')),
282 298 (['wireprotocolv2'], _('Wire Protocol Version 2'),
283 299 loaddoc('wireprotocolv2', subdir='internals')),
284 300 ])
285 301
286 302 def internalshelp(ui):
287 303 """Generate the index for the "internals" topic."""
288 304 lines = ['To access a subtopic, use "hg help internals.{subtopic-name}"\n',
289 305 '\n']
290 306 for names, header, doc in internalstable:
291 307 lines.append(' :%s: %s\n' % (names[0], header))
292 308
293 309 return ''.join(lines)
294 310
295 311 helptable = sorted([
296 (['bundlespec'], _("Bundle File Formats"), loaddoc('bundlespec')),
297 (['color'], _("Colorizing Outputs"), loaddoc('color')),
298 (["config", "hgrc"], _("Configuration Files"), loaddoc('config')),
299 (['deprecated'], _("Deprecated Features"), loaddoc('deprecated')),
300 (["dates"], _("Date Formats"), loaddoc('dates')),
301 (["flags"], _("Command-line flags"), loaddoc('flags')),
302 (["patterns"], _("File Name Patterns"), loaddoc('patterns')),
312 (['bundlespec'], _("Bundle File Formats"), loaddoc('bundlespec'),
313 TOPIC_CATEGORY_CONCEPTS),
314 (['color'], _("Colorizing Outputs"), loaddoc('color'),
315 TOPIC_CATEGORY_OUTPUT),
316 (["config", "hgrc"], _("Configuration Files"), loaddoc('config'),
317 TOPIC_CATEGORY_CONFIG),
318 (['deprecated'], _("Deprecated Features"), loaddoc('deprecated'),
319 TOPIC_CATEGORY_MISC),
320 (["dates"], _("Date Formats"), loaddoc('dates'), TOPIC_CATEGORY_OUTPUT),
321 (["flags"], _("Command-line flags"), loaddoc('flags'),
322 TOPIC_CATEGORY_CONFIG),
323 (["patterns"], _("File Name Patterns"), loaddoc('patterns'),
324 TOPIC_CATEGORY_IDS),
303 325 (['environment', 'env'], _('Environment Variables'),
304 loaddoc('environment')),
326 loaddoc('environment'), TOPIC_CATEGORY_CONFIG),
305 327 (['revisions', 'revs', 'revsets', 'revset', 'multirevs', 'mrevs'],
306 _('Specifying Revisions'), loaddoc('revisions')),
307 (['filesets', 'fileset'], _("Specifying File Sets"), loaddoc('filesets')),
308 (['diffs'], _('Diff Formats'), loaddoc('diffs')),
328 _('Specifying Revisions'), loaddoc('revisions'), TOPIC_CATEGORY_IDS),
329 (['filesets', 'fileset'], _("Specifying File Sets"), loaddoc('filesets'),
330 TOPIC_CATEGORY_IDS),
331 (['diffs'], _('Diff Formats'), loaddoc('diffs'), TOPIC_CATEGORY_OUTPUT),
309 332 (['merge-tools', 'mergetools', 'mergetool'], _('Merge Tools'),
310 loaddoc('merge-tools')),
333 loaddoc('merge-tools'), TOPIC_CATEGORY_CONFIG),
311 334 (['templating', 'templates', 'template', 'style'], _('Template Usage'),
312 loaddoc('templates')),
313 (['urls'], _('URL Paths'), loaddoc('urls')),
314 (["extensions"], _("Using Additional Features"), extshelp),
315 (["subrepos", "subrepo"], _("Subrepositories"), loaddoc('subrepos')),
316 (["hgweb"], _("Configuring hgweb"), loaddoc('hgweb')),
317 (["glossary"], _("Glossary"), loaddoc('glossary')),
335 loaddoc('templates'), TOPIC_CATEGORY_OUTPUT),
336 (['urls'], _('URL Paths'), loaddoc('urls'), TOPIC_CATEGORY_IDS),
337 (["extensions"], _("Using Additional Features"), extshelp,
338 TOPIC_CATEGORY_CONFIG),
339 (["subrepos", "subrepo"], _("Subrepositories"), loaddoc('subrepos'),
340 TOPIC_CATEGORY_CONCEPTS),
341 (["hgweb"], _("Configuring hgweb"), loaddoc('hgweb'),
342 TOPIC_CATEGORY_CONFIG),
343 (["glossary"], _("Glossary"), loaddoc('glossary'), TOPIC_CATEGORY_CONCEPTS),
318 344 (["hgignore", "ignore"], _("Syntax for Mercurial Ignore Files"),
319 loaddoc('hgignore')),
320 (["phases"], _("Working with Phases"), loaddoc('phases')),
345 loaddoc('hgignore'), TOPIC_CATEGORY_IDS),
346 (["phases"], _("Working with Phases"), loaddoc('phases'),
347 TOPIC_CATEGORY_CONCEPTS),
321 348 (['scripting'], _('Using Mercurial from scripts and automation'),
322 loaddoc('scripting')),
323 (['internals'], _("Technical implementation topics"),
324 internalshelp),
325 (['pager'], _("Pager Support"), loaddoc('pager')),
349 loaddoc('scripting'), TOPIC_CATEGORY_MISC),
350 (['internals'], _("Technical implementation topics"), internalshelp,
351 TOPIC_CATEGORY_MISC),
352 (['pager'], _("Pager Support"), loaddoc('pager'), TOPIC_CATEGORY_CONFIG),
326 353 ])
327 354
328 355 # Maps topics with sub-topics to a list of their sub-topics.
329 356 subtopics = {
330 357 'internals': internalstable,
331 358 }
332 359
333 360 # Map topics to lists of callable taking the current topic help and
334 361 # returning the updated version
335 362 helphooks = {}
336 363
337 364 def addtopichook(topic, rewriter):
338 365 helphooks.setdefault(topic, []).append(rewriter)
339 366
340 367 def makeitemsdoc(ui, topic, doc, marker, items, dedent=False):
341 368 """Extract docstring from the items key to function mapping, build a
342 369 single documentation block and use it to overwrite the marker in doc.
343 370 """
344 371 entries = []
345 372 for name in sorted(items):
346 373 text = (pycompat.getdoc(items[name]) or '').rstrip()
347 374 if (not text
348 375 or not ui.verbose and any(w in text for w in _exclkeywords)):
349 376 continue
350 377 text = gettext(text)
351 378 if dedent:
352 379 # Abuse latin1 to use textwrap.dedent() on bytes.
353 380 text = textwrap.dedent(text.decode('latin1')).encode('latin1')
354 381 lines = text.splitlines()
355 382 doclines = [(lines[0])]
356 383 for l in lines[1:]:
357 384 # Stop once we find some Python doctest
358 385 if l.strip().startswith('>>>'):
359 386 break
360 387 if dedent:
361 388 doclines.append(l.rstrip())
362 389 else:
363 390 doclines.append(' ' + l.strip())
364 391 entries.append('\n'.join(doclines))
365 392 entries = '\n\n'.join(entries)
366 393 return doc.replace(marker, entries)
367 394
368 395 def addtopicsymbols(topic, marker, symbols, dedent=False):
369 396 def add(ui, topic, doc):
370 397 return makeitemsdoc(ui, topic, doc, marker, symbols, dedent=dedent)
371 398 addtopichook(topic, add)
372 399
373 400 addtopicsymbols('bundlespec', '.. bundlecompressionmarker',
374 401 util.bundlecompressiontopics())
375 402 addtopicsymbols('filesets', '.. predicatesmarker', fileset.symbols)
376 403 addtopicsymbols('merge-tools', '.. internaltoolsmarker',
377 404 filemerge.internalsdoc)
378 405 addtopicsymbols('revisions', '.. predicatesmarker', revset.symbols)
379 406 addtopicsymbols('templates', '.. keywordsmarker', templatekw.keywords)
380 407 addtopicsymbols('templates', '.. filtersmarker', templatefilters.filters)
381 408 addtopicsymbols('templates', '.. functionsmarker', templatefuncs.funcs)
382 409 addtopicsymbols('hgweb', '.. webcommandsmarker', webcommands.commands,
383 410 dedent=True)
384 411
385 412 def help_(ui, commands, name, unknowncmd=False, full=True, subtopic=None,
386 413 **opts):
387 414 '''
388 415 Generate the help for 'name' as unformatted restructured text. If
389 416 'name' is None, describe the commands available.
390 417 '''
391 418
392 419 opts = pycompat.byteskwargs(opts)
393 420
394 421 def helpcmd(name, subtopic=None):
395 422 try:
396 423 aliases, entry = cmdutil.findcmd(name, commands.table,
397 424 strict=unknowncmd)
398 425 except error.AmbiguousCommand as inst:
399 426 # py3 fix: except vars can't be used outside the scope of the
400 427 # except block, nor can be used inside a lambda. python issue4617
401 428 prefix = inst.args[0]
402 429 select = lambda c: cmdutil.parsealiases(c)[0].startswith(prefix)
403 430 rst = helplist(select)
404 431 return rst
405 432
406 433 rst = []
407 434
408 435 # check if it's an invalid alias and display its error if it is
409 436 if getattr(entry[0], 'badalias', None):
410 437 rst.append(entry[0].badalias + '\n')
411 438 if entry[0].unknowncmd:
412 439 try:
413 440 rst.extend(helpextcmd(entry[0].cmdname))
414 441 except error.UnknownCommand:
415 442 pass
416 443 return rst
417 444
418 445 # synopsis
419 446 if len(entry) > 2:
420 447 if entry[2].startswith('hg'):
421 448 rst.append("%s\n" % entry[2])
422 449 else:
423 450 rst.append('hg %s %s\n' % (aliases[0], entry[2]))
424 451 else:
425 452 rst.append('hg %s\n' % aliases[0])
426 453 # aliases
427 454 if full and not ui.quiet and len(aliases) > 1:
428 455 rst.append(_("\naliases: %s\n") % ', '.join(aliases[1:]))
429 456 rst.append('\n')
430 457
431 458 # description
432 459 doc = gettext(pycompat.getdoc(entry[0]))
433 460 if not doc:
434 461 doc = _("(no help text available)")
435 462 if util.safehasattr(entry[0], 'definition'): # aliased command
436 463 source = entry[0].source
437 464 if entry[0].definition.startswith('!'): # shell alias
438 465 doc = (_('shell alias for: %s\n\n%s\n\ndefined by: %s\n') %
439 466 (entry[0].definition[1:], doc, source))
440 467 else:
441 468 doc = (_('alias for: hg %s\n\n%s\n\ndefined by: %s\n') %
442 469 (entry[0].definition, doc, source))
443 470 doc = doc.splitlines(True)
444 471 if ui.quiet or not full:
445 472 rst.append(doc[0])
446 473 else:
447 474 rst.extend(doc)
448 475 rst.append('\n')
449 476
450 477 # check if this command shadows a non-trivial (multi-line)
451 478 # extension help text
452 479 try:
453 480 mod = extensions.find(name)
454 481 doc = gettext(pycompat.getdoc(mod)) or ''
455 482 if '\n' in doc.strip():
456 483 msg = _("(use 'hg help -e %s' to show help for "
457 484 "the %s extension)") % (name, name)
458 485 rst.append('\n%s\n' % msg)
459 486 except KeyError:
460 487 pass
461 488
462 489 # options
463 490 if not ui.quiet and entry[1]:
464 491 rst.append(optrst(_("options"), entry[1], ui.verbose))
465 492
466 493 if ui.verbose:
467 494 rst.append(optrst(_("global options"),
468 495 commands.globalopts, ui.verbose))
469 496
470 497 if not ui.verbose:
471 498 if not full:
472 499 rst.append(_("\n(use 'hg %s -h' to show more help)\n")
473 500 % name)
474 501 elif not ui.quiet:
475 502 rst.append(_('\n(some details hidden, use --verbose '
476 503 'to show complete help)'))
477 504
478 505 return rst
479 506
480 507 def helplist(select=None, **opts):
481 508 # Category -> list of commands
482 509 cats = {}
483 510 # Command -> short description
484 511 h = {}
485 512 # Command -> string showing synonyms
486 513 syns = {}
487 514 for c, e in commands.table.iteritems():
488 515 fs = cmdutil.parsealiases(c)
489 516 f = fs[0]
490 517 syns[f] = ', '.join(fs)
491 518 func = e[0]
492 519 p = ''
493 520 if c.startswith("^"):
494 521 p = '^'
495 522 if select and not select(p + f):
496 523 continue
497 524 if (not select and name != 'shortlist' and
498 525 func.__module__ != commands.__name__):
499 526 continue
500 527 if name == "shortlist" and not p:
501 528 continue
502 529 doc = pycompat.getdoc(func)
503 530 if filtercmd(ui, f, name, doc):
504 531 continue
505 532 doc = gettext(doc)
506 533 if not doc:
507 534 doc = _("(no help text available)")
508 535 h[f] = doc.splitlines()[0].rstrip()
509 536
510 537 cat = getattr(func, 'helpcategory', None) or (
511 538 registrar.command.CATEGORY_NONE)
512 539 cats.setdefault(cat, []).append(f)
513 540
514 541 rst = []
515 542 if not h:
516 543 if not ui.quiet:
517 544 rst.append(_('no commands defined\n'))
518 545 return rst
519 546
520 547 # Output top header.
521 548 if not ui.quiet:
522 549 if name == "shortlist":
523 550 rst.append(_('basic commands:\n\n'))
524 551 elif name == "debug":
525 552 rst.append(_('debug commands (internal and unsupported):\n\n'))
526 553 else:
527 554 rst.append(_('list of commands:\n'))
528 555
529 556 def appendcmds(cmds):
530 557 cmds = sorted(cmds)
531 558 for c in cmds:
532 559 if ui.verbose:
533 560 rst.append(" :%s: %s\n" % (syns[c], h[c]))
534 561 else:
535 562 rst.append(' :%s: %s\n' % (c, h[c]))
536 563
537 564 if name in ('shortlist', 'debug'):
538 565 # List without categories.
539 566 appendcmds(h)
540 567 else:
541 568 # Check that all categories have an order.
542 569 missing_order = set(cats.keys()) - set(CATEGORY_ORDER)
543 570 if missing_order:
544 571 ui.develwarn('help categories missing from CATEGORY_ORDER: %s' %
545 572 missing_order)
546 573
547 574 # List per category.
548 575 for cat in CATEGORY_ORDER:
549 576 catfns = cats.get(cat, [])
550 577 if catfns:
551 578 if len(cats) > 1:
552 579 catname = gettext(CATEGORY_NAMES[cat])
553 580 rst.append("\n%s:\n" % catname)
554 581 rst.append("\n")
555 582 appendcmds(catfns)
556 583
557 584 ex = opts.get
558 585 anyopts = (ex(r'keyword') or not (ex(r'command') or ex(r'extension')))
559 586 if not name and anyopts:
560 587 exts = listexts(_('enabled extensions:'), extensions.enabled())
561 588 if exts:
562 589 rst.append('\n')
563 590 rst.extend(exts)
564 591
565 592 rst.append(_("\nadditional help topics:\n"))
566 593 # Group commands by category.
567 594 topiccats = {}
568 595 for topic in helptable:
569 596 names, header, doc = topic[0:3]
570 597 if len(topic) > 3 and topic[3]:
571 598 category = topic[3]
572 599 else:
573 600 category = TOPIC_CATEGORY_NONE
574 601
575 602 topiccats.setdefault(category, []).append((names[0], header))
576 603
577 604 # Check that all categories have an order.
578 605 missing_order = set(topiccats.keys()) - set(TOPIC_CATEGORY_ORDER)
579 606 if missing_order:
580 607 ui.develwarn(
581 608 'help categories missing from TOPIC_CATEGORY_ORDER: %s' %
582 609 missing_order)
583 610
584 611 # Output topics per category.
585 612 for cat in TOPIC_CATEGORY_ORDER:
586 613 topics = topiccats.get(cat, [])
587 614 if topics:
588 615 if len(topiccats) > 1:
589 616 catname = gettext(TOPIC_CATEGORY_NAMES[cat])
590 617 rst.append("\n%s:\n" % catname)
591 618 rst.append("\n")
592 619 for t, desc in topics:
593 620 rst.append(" :%s: %s\n" % (t, desc))
594 621
595 622 if ui.quiet:
596 623 pass
597 624 elif ui.verbose:
598 625 rst.append('\n%s\n' % optrst(_("global options"),
599 626 commands.globalopts, ui.verbose))
600 627 if name == 'shortlist':
601 628 rst.append(_("\n(use 'hg help' for the full list "
602 629 "of commands)\n"))
603 630 else:
604 631 if name == 'shortlist':
605 632 rst.append(_("\n(use 'hg help' for the full list of commands "
606 633 "or 'hg -v' for details)\n"))
607 634 elif name and not full:
608 635 rst.append(_("\n(use 'hg help %s' to show the full help "
609 636 "text)\n") % name)
610 637 elif name and syns and name in syns.keys():
611 638 rst.append(_("\n(use 'hg help -v -e %s' to show built-in "
612 639 "aliases and global options)\n") % name)
613 640 else:
614 641 rst.append(_("\n(use 'hg help -v%s' to show built-in aliases "
615 642 "and global options)\n")
616 643 % (name and " " + name or ""))
617 644 return rst
618 645
619 646 def helptopic(name, subtopic=None):
620 647 # Look for sub-topic entry first.
621 648 header, doc = None, None
622 649 if subtopic and name in subtopics:
623 650 for names, header, doc in subtopics[name]:
624 651 if subtopic in names:
625 652 break
626 653
627 654 if not header:
628 655 for topic in helptable:
629 656 names, header, doc = topic[0:3]
630 657 if name in names:
631 658 break
632 659 else:
633 660 raise error.UnknownCommand(name)
634 661
635 662 rst = [minirst.section(header)]
636 663
637 664 # description
638 665 if not doc:
639 666 rst.append(" %s\n" % _("(no help text available)"))
640 667 if callable(doc):
641 668 rst += [" %s\n" % l for l in doc(ui).splitlines()]
642 669
643 670 if not ui.verbose:
644 671 omitted = _('(some details hidden, use --verbose'
645 672 ' to show complete help)')
646 673 indicateomitted(rst, omitted)
647 674
648 675 try:
649 676 cmdutil.findcmd(name, commands.table)
650 677 rst.append(_("\nuse 'hg help -c %s' to see help for "
651 678 "the %s command\n") % (name, name))
652 679 except error.UnknownCommand:
653 680 pass
654 681 return rst
655 682
656 683 def helpext(name, subtopic=None):
657 684 try:
658 685 mod = extensions.find(name)
659 686 doc = gettext(pycompat.getdoc(mod)) or _('no help text available')
660 687 except KeyError:
661 688 mod = None
662 689 doc = extensions.disabledext(name)
663 690 if not doc:
664 691 raise error.UnknownCommand(name)
665 692
666 693 if '\n' not in doc:
667 694 head, tail = doc, ""
668 695 else:
669 696 head, tail = doc.split('\n', 1)
670 697 rst = [_('%s extension - %s\n\n') % (name.rpartition('.')[-1], head)]
671 698 if tail:
672 699 rst.extend(tail.splitlines(True))
673 700 rst.append('\n')
674 701
675 702 if not ui.verbose:
676 703 omitted = _('(some details hidden, use --verbose'
677 704 ' to show complete help)')
678 705 indicateomitted(rst, omitted)
679 706
680 707 if mod:
681 708 try:
682 709 ct = mod.cmdtable
683 710 except AttributeError:
684 711 ct = {}
685 712 modcmds = set([c.partition('|')[0] for c in ct])
686 713 rst.extend(helplist(modcmds.__contains__))
687 714 else:
688 715 rst.append(_("(use 'hg help extensions' for information on enabling"
689 716 " extensions)\n"))
690 717 return rst
691 718
692 719 def helpextcmd(name, subtopic=None):
693 720 cmd, ext, doc = extensions.disabledcmd(ui, name,
694 721 ui.configbool('ui', 'strict'))
695 722 doc = doc.splitlines()[0]
696 723
697 724 rst = listexts(_("'%s' is provided by the following "
698 725 "extension:") % cmd, {ext: doc}, indent=4,
699 726 showdeprecated=True)
700 727 rst.append('\n')
701 728 rst.append(_("(use 'hg help extensions' for information on enabling "
702 729 "extensions)\n"))
703 730 return rst
704 731
705 732
706 733 rst = []
707 734 kw = opts.get('keyword')
708 735 if kw or name is None and any(opts[o] for o in opts):
709 736 matches = topicmatch(ui, commands, name or '')
710 737 helpareas = []
711 738 if opts.get('extension'):
712 739 helpareas += [('extensions', _('Extensions'))]
713 740 if opts.get('command'):
714 741 helpareas += [('commands', _('Commands'))]
715 742 if not helpareas:
716 743 helpareas = [('topics', _('Topics')),
717 744 ('commands', _('Commands')),
718 745 ('extensions', _('Extensions')),
719 746 ('extensioncommands', _('Extension Commands'))]
720 747 for t, title in helpareas:
721 748 if matches[t]:
722 749 rst.append('%s:\n\n' % title)
723 750 rst.extend(minirst.maketable(sorted(matches[t]), 1))
724 751 rst.append('\n')
725 752 if not rst:
726 753 msg = _('no matches')
727 754 hint = _("try 'hg help' for a list of topics")
728 755 raise error.Abort(msg, hint=hint)
729 756 elif name and name != 'shortlist':
730 757 queries = []
731 758 if unknowncmd:
732 759 queries += [helpextcmd]
733 760 if opts.get('extension'):
734 761 queries += [helpext]
735 762 if opts.get('command'):
736 763 queries += [helpcmd]
737 764 if not queries:
738 765 queries = (helptopic, helpcmd, helpext, helpextcmd)
739 766 for f in queries:
740 767 try:
741 768 rst = f(name, subtopic)
742 769 break
743 770 except error.UnknownCommand:
744 771 pass
745 772 else:
746 773 if unknowncmd:
747 774 raise error.UnknownCommand(name)
748 775 else:
749 776 msg = _('no such help topic: %s') % name
750 777 hint = _("try 'hg help --keyword %s'") % name
751 778 raise error.Abort(msg, hint=hint)
752 779 else:
753 780 # program name
754 781 if not ui.quiet:
755 782 rst = [_("Mercurial Distributed SCM\n"), '\n']
756 783 rst.extend(helplist(None, **pycompat.strkwargs(opts)))
757 784
758 785 return ''.join(rst)
759 786
760 787 def formattedhelp(ui, commands, fullname, keep=None, unknowncmd=False,
761 788 full=True, **opts):
762 789 """get help for a given topic (as a dotted name) as rendered rst
763 790
764 791 Either returns the rendered help text or raises an exception.
765 792 """
766 793 if keep is None:
767 794 keep = []
768 795 else:
769 796 keep = list(keep) # make a copy so we can mutate this later
770 797
771 798 # <fullname> := <name>[.<subtopic][.<section>]
772 799 name = subtopic = section = None
773 800 if fullname is not None:
774 801 nameparts = fullname.split('.')
775 802 name = nameparts.pop(0)
776 803 if nameparts and name in subtopics:
777 804 subtopic = nameparts.pop(0)
778 805 if nameparts:
779 806 section = encoding.lower('.'.join(nameparts))
780 807
781 808 textwidth = ui.configint('ui', 'textwidth')
782 809 termwidth = ui.termwidth() - 2
783 810 if textwidth <= 0 or termwidth < textwidth:
784 811 textwidth = termwidth
785 812 text = help_(ui, commands, name,
786 813 subtopic=subtopic, unknowncmd=unknowncmd, full=full, **opts)
787 814
788 815 blocks, pruned = minirst.parse(text, keep=keep)
789 816 if 'verbose' in pruned:
790 817 keep.append('omitted')
791 818 else:
792 819 keep.append('notomitted')
793 820 blocks, pruned = minirst.parse(text, keep=keep)
794 821 if section:
795 822 blocks = minirst.filtersections(blocks, section)
796 823
797 824 # We could have been given a weird ".foo" section without a name
798 825 # to look for, or we could have simply failed to found "foo.bar"
799 826 # because bar isn't a section of foo
800 827 if section and not (blocks and name):
801 828 raise error.Abort(_("help section not found: %s") % fullname)
802 829
803 830 return minirst.formatplain(blocks, textwidth)
@@ -1,530 +1,558 b''
1 1 $ hg init a
2 2 $ cd a
3 3 $ echo a > a
4 4 $ hg ci -A -d'1 0' -m a
5 5 adding a
6 6
7 7 $ cd ..
8 8
9 9 $ hg init b
10 10 $ cd b
11 11 $ echo b > b
12 12 $ hg ci -A -d'1 0' -m b
13 13 adding b
14 14
15 15 $ cd ..
16 16
17 17 $ hg clone a c
18 18 updating to branch default
19 19 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
20 20 $ cd c
21 21 $ cat >> .hg/hgrc <<EOF
22 22 > [paths]
23 23 > relative = ../a
24 24 > EOF
25 25 $ hg pull -f ../b
26 26 pulling from ../b
27 27 searching for changes
28 28 warning: repository is unrelated
29 29 requesting all changes
30 30 adding changesets
31 31 adding manifests
32 32 adding file changes
33 33 added 1 changesets with 1 changes to 1 files (+1 heads)
34 34 new changesets b6c483daf290
35 35 (run 'hg heads' to see heads, 'hg merge' to merge)
36 36 $ hg merge
37 37 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
38 38 (branch merge, don't forget to commit)
39 39
40 40 $ cd ..
41 41
42 42 Testing -R/--repository:
43 43
44 44 $ hg -R a tip
45 45 changeset: 0:8580ff50825a
46 46 tag: tip
47 47 user: test
48 48 date: Thu Jan 01 00:00:01 1970 +0000
49 49 summary: a
50 50
51 51 $ hg --repository b tip
52 52 changeset: 0:b6c483daf290
53 53 tag: tip
54 54 user: test
55 55 date: Thu Jan 01 00:00:01 1970 +0000
56 56 summary: b
57 57
58 58
59 59 -R with a URL:
60 60
61 61 $ hg -R file:a identify
62 62 8580ff50825a tip
63 63 $ hg -R file://localhost/`pwd`/a/ identify
64 64 8580ff50825a tip
65 65
66 66 -R with path aliases:
67 67
68 68 $ cd c
69 69 $ hg -R default identify
70 70 8580ff50825a tip
71 71 $ hg -R relative identify
72 72 8580ff50825a tip
73 73 $ echo '[paths]' >> $HGRCPATH
74 74 $ echo 'relativetohome = a' >> $HGRCPATH
75 75 $ HOME=`pwd`/../ hg -R relativetohome identify
76 76 8580ff50825a tip
77 77 $ cd ..
78 78
79 79 #if no-outer-repo
80 80
81 81 Implicit -R:
82 82
83 83 $ hg ann a/a
84 84 0: a
85 85 $ hg ann a/a a/a
86 86 0: a
87 87 $ hg ann a/a b/b
88 88 abort: no repository found in '$TESTTMP' (.hg not found)!
89 89 [255]
90 90 $ hg -R b ann a/a
91 91 abort: a/a not under root '$TESTTMP/b'
92 92 (consider using '--cwd b')
93 93 [255]
94 94 $ hg log
95 95 abort: no repository found in '$TESTTMP' (.hg not found)!
96 96 [255]
97 97
98 98 #endif
99 99
100 100 Abbreviation of long option:
101 101
102 102 $ hg --repo c tip
103 103 changeset: 1:b6c483daf290
104 104 tag: tip
105 105 parent: -1:000000000000
106 106 user: test
107 107 date: Thu Jan 01 00:00:01 1970 +0000
108 108 summary: b
109 109
110 110
111 111 earlygetopt with duplicate options (36d23de02da1):
112 112
113 113 $ hg --cwd a --cwd b --cwd c tip
114 114 changeset: 1:b6c483daf290
115 115 tag: tip
116 116 parent: -1:000000000000
117 117 user: test
118 118 date: Thu Jan 01 00:00:01 1970 +0000
119 119 summary: b
120 120
121 121 $ hg --repo c --repository b -R a tip
122 122 changeset: 0:8580ff50825a
123 123 tag: tip
124 124 user: test
125 125 date: Thu Jan 01 00:00:01 1970 +0000
126 126 summary: a
127 127
128 128
129 129 earlygetopt short option without following space:
130 130
131 131 $ hg -q -Rb tip
132 132 0:b6c483daf290
133 133
134 134 earlygetopt with illegal abbreviations:
135 135
136 136 $ hg --confi "foo.bar=baz"
137 137 abort: option --config may not be abbreviated!
138 138 [255]
139 139 $ hg --cw a tip
140 140 abort: option --cwd may not be abbreviated!
141 141 [255]
142 142 $ hg --rep a tip
143 143 abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo!
144 144 [255]
145 145 $ hg --repositor a tip
146 146 abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo!
147 147 [255]
148 148 $ hg -qR a tip
149 149 abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo!
150 150 [255]
151 151 $ hg -qRa tip
152 152 abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo!
153 153 [255]
154 154
155 155 Testing --cwd:
156 156
157 157 $ hg --cwd a parents
158 158 changeset: 0:8580ff50825a
159 159 tag: tip
160 160 user: test
161 161 date: Thu Jan 01 00:00:01 1970 +0000
162 162 summary: a
163 163
164 164
165 165 Testing -y/--noninteractive - just be sure it is parsed:
166 166
167 167 $ hg --cwd a tip -q --noninteractive
168 168 0:8580ff50825a
169 169 $ hg --cwd a tip -q -y
170 170 0:8580ff50825a
171 171
172 172 Testing -q/--quiet:
173 173
174 174 $ hg -R a -q tip
175 175 0:8580ff50825a
176 176 $ hg -R b -q tip
177 177 0:b6c483daf290
178 178 $ hg -R c --quiet parents
179 179 0:8580ff50825a
180 180 1:b6c483daf290
181 181
182 182 Testing -v/--verbose:
183 183
184 184 $ hg --cwd c head -v
185 185 changeset: 1:b6c483daf290
186 186 tag: tip
187 187 parent: -1:000000000000
188 188 user: test
189 189 date: Thu Jan 01 00:00:01 1970 +0000
190 190 files: b
191 191 description:
192 192 b
193 193
194 194
195 195 changeset: 0:8580ff50825a
196 196 user: test
197 197 date: Thu Jan 01 00:00:01 1970 +0000
198 198 files: a
199 199 description:
200 200 a
201 201
202 202
203 203 $ hg --cwd b tip --verbose
204 204 changeset: 0:b6c483daf290
205 205 tag: tip
206 206 user: test
207 207 date: Thu Jan 01 00:00:01 1970 +0000
208 208 files: b
209 209 description:
210 210 b
211 211
212 212
213 213
214 214 Testing --config:
215 215
216 216 $ hg --cwd c --config paths.quuxfoo=bar paths | grep quuxfoo > /dev/null && echo quuxfoo
217 217 quuxfoo
218 218 $ hg --cwd c --config '' tip -q
219 219 abort: malformed --config option: '' (use --config section.name=value)
220 220 [255]
221 221 $ hg --cwd c --config a.b tip -q
222 222 abort: malformed --config option: 'a.b' (use --config section.name=value)
223 223 [255]
224 224 $ hg --cwd c --config a tip -q
225 225 abort: malformed --config option: 'a' (use --config section.name=value)
226 226 [255]
227 227 $ hg --cwd c --config a.= tip -q
228 228 abort: malformed --config option: 'a.=' (use --config section.name=value)
229 229 [255]
230 230 $ hg --cwd c --config .b= tip -q
231 231 abort: malformed --config option: '.b=' (use --config section.name=value)
232 232 [255]
233 233
234 234 Testing --debug:
235 235
236 236 $ hg --cwd c log --debug
237 237 changeset: 1:b6c483daf2907ce5825c0bb50f5716226281cc1a
238 238 tag: tip
239 239 phase: public
240 240 parent: -1:0000000000000000000000000000000000000000
241 241 parent: -1:0000000000000000000000000000000000000000
242 242 manifest: 1:23226e7a252cacdc2d99e4fbdc3653441056de49
243 243 user: test
244 244 date: Thu Jan 01 00:00:01 1970 +0000
245 245 files+: b
246 246 extra: branch=default
247 247 description:
248 248 b
249 249
250 250
251 251 changeset: 0:8580ff50825a50c8f716709acdf8de0deddcd6ab
252 252 phase: public
253 253 parent: -1:0000000000000000000000000000000000000000
254 254 parent: -1:0000000000000000000000000000000000000000
255 255 manifest: 0:a0c8bcbbb45c63b90b70ad007bf38961f64f2af0
256 256 user: test
257 257 date: Thu Jan 01 00:00:01 1970 +0000
258 258 files+: a
259 259 extra: branch=default
260 260 description:
261 261 a
262 262
263 263
264 264
265 265 Testing --traceback:
266 266
267 267 #if no-chg
268 268 $ hg --cwd c --config x --traceback id 2>&1 | grep -i 'traceback'
269 269 Traceback (most recent call last):
270 270 Traceback (most recent call last): (py3 !)
271 271 #else
272 272 Traceback for '--config' errors not supported with chg.
273 273 $ hg --cwd c --config x --traceback id 2>&1 | grep -i 'traceback'
274 274 [1]
275 275 #endif
276 276
277 277 Testing --time:
278 278
279 279 $ hg --cwd a --time id
280 280 8580ff50825a tip
281 281 time: real * (glob)
282 282
283 283 Testing --version:
284 284
285 285 $ hg --version -q
286 286 Mercurial Distributed SCM * (glob)
287 287
288 288 hide outer repo
289 289 $ hg init
290 290
291 291 Testing -h/--help:
292 292
293 293 #if no-extraextensions
294 294
295 295 $ hg -h
296 296 Mercurial Distributed SCM
297 297
298 298 list of commands:
299 299
300 300 Repository creation:
301 301
302 302 clone make a copy of an existing repository
303 303 init create a new repository in the given directory
304 304
305 305 Remote repository management:
306 306
307 307 incoming show new changesets found in source
308 308 outgoing show changesets not found in the destination
309 309 paths show aliases for remote repositories
310 310 pull pull changes from the specified source
311 311 push push changes to the specified destination
312 312 serve start stand-alone webserver
313 313
314 314 Change creation:
315 315
316 316 commit commit the specified files or all outstanding changes
317 317
318 318 Change manipulation:
319 319
320 320 backout reverse effect of earlier changeset
321 321 graft copy changes from other branches onto the current branch
322 322 merge merge another revision into working directory
323 323
324 324 Change organization:
325 325
326 326 bookmarks create a new bookmark or list existing bookmarks
327 327 branch set or show the current branch name
328 328 branches list repository named branches
329 329 phase set or show the current phase name
330 330 tag add one or more tags for the current or given revision
331 331 tags list repository tags
332 332
333 333 File content management:
334 334
335 335 annotate show changeset information by line for each file
336 336 cat output the current or given revision of files
337 337 copy mark files as copied for the next commit
338 338 diff diff repository (or selected files)
339 339 grep search revision history for a pattern in specified files
340 340
341 341 Change navigation:
342 342
343 343 bisect subdivision search of changesets
344 344 heads show branch heads
345 345 identify identify the working directory or specified revision
346 346 log show revision history of entire repository or files
347 347
348 348 Working directory management:
349 349
350 350 add add the specified files on the next commit
351 351 addremove add all new files, delete all missing files
352 352 files list tracked files
353 353 forget forget the specified files on the next commit
354 354 remove remove the specified files on the next commit
355 355 rename rename files; equivalent of copy + remove
356 356 resolve redo merges or set/view the merge status of files
357 357 revert restore files to their checkout state
358 358 root print the root (top) of the current working directory
359 359 status show changed files in the working directory
360 360 summary summarize working directory state
361 361 update update working directory (or switch revisions)
362 362
363 363 Change import/export:
364 364
365 365 archive create an unversioned archive of a repository revision
366 366 bundle create a bundle file
367 367 export dump the header and diffs for one or more changesets
368 368 import import an ordered set of patches
369 369 unbundle apply one or more bundle files
370 370
371 371 Repository maintenance:
372 372
373 373 manifest output the current or given revision of the project manifest
374 374 recover roll back an interrupted transaction
375 375 verify verify the integrity of the repository
376 376
377 377 Help:
378 378
379 379 config show combined config settings from all hgrc files
380 380 help show help for a given topic or a help overview
381 381 version output version and copyright information
382 382
383 383 additional help topics:
384 384
385 bundlespec Bundle File Formats
385 Mercurial identifiers:
386
387 filesets Specifying File Sets
388 hgignore Syntax for Mercurial Ignore Files
389 patterns File Name Patterns
390 revisions Specifying Revisions
391 urls URL Paths
392
393 Mercurial output:
394
386 395 color Colorizing Outputs
396 dates Date Formats
397 diffs Diff Formats
398 templating Template Usage
399
400 Mercurial configuration:
401
387 402 config Configuration Files
388 dates Date Formats
389 deprecated Deprecated Features
390 diffs Diff Formats
391 403 environment Environment Variables
392 404 extensions Using Additional Features
393 filesets Specifying File Sets
394 405 flags Command-line flags
395 glossary Glossary
396 hgignore Syntax for Mercurial Ignore Files
397 406 hgweb Configuring hgweb
398 internals Technical implementation topics
399 407 merge-tools Merge Tools
400 408 pager Pager Support
401 patterns File Name Patterns
409
410 Concepts:
411
412 bundlespec Bundle File Formats
413 glossary Glossary
402 414 phases Working with Phases
403 revisions Specifying Revisions
415 subrepos Subrepositories
416
417 Miscellaneous:
418
419 deprecated Deprecated Features
420 internals Technical implementation topics
404 421 scripting Using Mercurial from scripts and automation
405 subrepos Subrepositories
406 templating Template Usage
407 urls URL Paths
408 422
409 423 (use 'hg help -v' to show built-in aliases and global options)
410 424
411 425 $ hg --help
412 426 Mercurial Distributed SCM
413 427
414 428 list of commands:
415 429
416 430 Repository creation:
417 431
418 432 clone make a copy of an existing repository
419 433 init create a new repository in the given directory
420 434
421 435 Remote repository management:
422 436
423 437 incoming show new changesets found in source
424 438 outgoing show changesets not found in the destination
425 439 paths show aliases for remote repositories
426 440 pull pull changes from the specified source
427 441 push push changes to the specified destination
428 442 serve start stand-alone webserver
429 443
430 444 Change creation:
431 445
432 446 commit commit the specified files or all outstanding changes
433 447
434 448 Change manipulation:
435 449
436 450 backout reverse effect of earlier changeset
437 451 graft copy changes from other branches onto the current branch
438 452 merge merge another revision into working directory
439 453
440 454 Change organization:
441 455
442 456 bookmarks create a new bookmark or list existing bookmarks
443 457 branch set or show the current branch name
444 458 branches list repository named branches
445 459 phase set or show the current phase name
446 460 tag add one or more tags for the current or given revision
447 461 tags list repository tags
448 462
449 463 File content management:
450 464
451 465 annotate show changeset information by line for each file
452 466 cat output the current or given revision of files
453 467 copy mark files as copied for the next commit
454 468 diff diff repository (or selected files)
455 469 grep search revision history for a pattern in specified files
456 470
457 471 Change navigation:
458 472
459 473 bisect subdivision search of changesets
460 474 heads show branch heads
461 475 identify identify the working directory or specified revision
462 476 log show revision history of entire repository or files
463 477
464 478 Working directory management:
465 479
466 480 add add the specified files on the next commit
467 481 addremove add all new files, delete all missing files
468 482 files list tracked files
469 483 forget forget the specified files on the next commit
470 484 remove remove the specified files on the next commit
471 485 rename rename files; equivalent of copy + remove
472 486 resolve redo merges or set/view the merge status of files
473 487 revert restore files to their checkout state
474 488 root print the root (top) of the current working directory
475 489 status show changed files in the working directory
476 490 summary summarize working directory state
477 491 update update working directory (or switch revisions)
478 492
479 493 Change import/export:
480 494
481 495 archive create an unversioned archive of a repository revision
482 496 bundle create a bundle file
483 497 export dump the header and diffs for one or more changesets
484 498 import import an ordered set of patches
485 499 unbundle apply one or more bundle files
486 500
487 501 Repository maintenance:
488 502
489 503 manifest output the current or given revision of the project manifest
490 504 recover roll back an interrupted transaction
491 505 verify verify the integrity of the repository
492 506
493 507 Help:
494 508
495 509 config show combined config settings from all hgrc files
496 510 help show help for a given topic or a help overview
497 511 version output version and copyright information
498 512
499 513 additional help topics:
500 514
501 bundlespec Bundle File Formats
515 Mercurial identifiers:
516
517 filesets Specifying File Sets
518 hgignore Syntax for Mercurial Ignore Files
519 patterns File Name Patterns
520 revisions Specifying Revisions
521 urls URL Paths
522
523 Mercurial output:
524
502 525 color Colorizing Outputs
526 dates Date Formats
527 diffs Diff Formats
528 templating Template Usage
529
530 Mercurial configuration:
531
503 532 config Configuration Files
504 dates Date Formats
505 deprecated Deprecated Features
506 diffs Diff Formats
507 533 environment Environment Variables
508 534 extensions Using Additional Features
509 filesets Specifying File Sets
510 535 flags Command-line flags
511 glossary Glossary
512 hgignore Syntax for Mercurial Ignore Files
513 536 hgweb Configuring hgweb
514 internals Technical implementation topics
515 537 merge-tools Merge Tools
516 538 pager Pager Support
517 patterns File Name Patterns
539
540 Concepts:
541
542 bundlespec Bundle File Formats
543 glossary Glossary
518 544 phases Working with Phases
519 revisions Specifying Revisions
545 subrepos Subrepositories
546
547 Miscellaneous:
548
549 deprecated Deprecated Features
550 internals Technical implementation topics
520 551 scripting Using Mercurial from scripts and automation
521 subrepos Subrepositories
522 templating Template Usage
523 urls URL Paths
524 552
525 553 (use 'hg help -v' to show built-in aliases and global options)
526 554
527 555 #endif
528 556
529 557 Not tested: --debugger
530 558
@@ -1,3860 +1,3902 b''
1 1 Short help:
2 2
3 3 $ hg
4 4 Mercurial Distributed SCM
5 5
6 6 basic commands:
7 7
8 8 add add the specified files on the next commit
9 9 annotate show changeset information by line for each file
10 10 clone make a copy of an existing repository
11 11 commit commit the specified files or all outstanding changes
12 12 diff diff repository (or selected files)
13 13 export dump the header and diffs for one or more changesets
14 14 forget forget the specified files on the next commit
15 15 init create a new repository in the given directory
16 16 log show revision history of entire repository or files
17 17 merge merge another revision into working directory
18 18 pull pull changes from the specified source
19 19 push push changes to the specified destination
20 20 remove remove the specified files on the next commit
21 21 serve start stand-alone webserver
22 22 status show changed files in the working directory
23 23 summary summarize working directory state
24 24 update update working directory (or switch revisions)
25 25
26 26 (use 'hg help' for the full list of commands or 'hg -v' for details)
27 27
28 28 $ hg -q
29 29 add add the specified files on the next commit
30 30 annotate show changeset information by line for each file
31 31 clone make a copy of an existing repository
32 32 commit commit the specified files or all outstanding changes
33 33 diff diff repository (or selected files)
34 34 export dump the header and diffs for one or more changesets
35 35 forget forget the specified files on the next commit
36 36 init create a new repository in the given directory
37 37 log show revision history of entire repository or files
38 38 merge merge another revision into working directory
39 39 pull pull changes from the specified source
40 40 push push changes to the specified destination
41 41 remove remove the specified files on the next commit
42 42 serve start stand-alone webserver
43 43 status show changed files in the working directory
44 44 summary summarize working directory state
45 45 update update working directory (or switch revisions)
46 46
47 47 Extra extensions will be printed in help output in a non-reliable order since
48 48 the extension is unknown.
49 49 #if no-extraextensions
50 50
51 51 $ hg help
52 52 Mercurial Distributed SCM
53 53
54 54 list of commands:
55 55
56 56 Repository creation:
57 57
58 58 clone make a copy of an existing repository
59 59 init create a new repository in the given directory
60 60
61 61 Remote repository management:
62 62
63 63 incoming show new changesets found in source
64 64 outgoing show changesets not found in the destination
65 65 paths show aliases for remote repositories
66 66 pull pull changes from the specified source
67 67 push push changes to the specified destination
68 68 serve start stand-alone webserver
69 69
70 70 Change creation:
71 71
72 72 commit commit the specified files or all outstanding changes
73 73
74 74 Change manipulation:
75 75
76 76 backout reverse effect of earlier changeset
77 77 graft copy changes from other branches onto the current branch
78 78 merge merge another revision into working directory
79 79
80 80 Change organization:
81 81
82 82 bookmarks create a new bookmark or list existing bookmarks
83 83 branch set or show the current branch name
84 84 branches list repository named branches
85 85 phase set or show the current phase name
86 86 tag add one or more tags for the current or given revision
87 87 tags list repository tags
88 88
89 89 File content management:
90 90
91 91 annotate show changeset information by line for each file
92 92 cat output the current or given revision of files
93 93 copy mark files as copied for the next commit
94 94 diff diff repository (or selected files)
95 95 grep search revision history for a pattern in specified files
96 96
97 97 Change navigation:
98 98
99 99 bisect subdivision search of changesets
100 100 heads show branch heads
101 101 identify identify the working directory or specified revision
102 102 log show revision history of entire repository or files
103 103
104 104 Working directory management:
105 105
106 106 add add the specified files on the next commit
107 107 addremove add all new files, delete all missing files
108 108 files list tracked files
109 109 forget forget the specified files on the next commit
110 110 remove remove the specified files on the next commit
111 111 rename rename files; equivalent of copy + remove
112 112 resolve redo merges or set/view the merge status of files
113 113 revert restore files to their checkout state
114 114 root print the root (top) of the current working directory
115 115 status show changed files in the working directory
116 116 summary summarize working directory state
117 117 update update working directory (or switch revisions)
118 118
119 119 Change import/export:
120 120
121 121 archive create an unversioned archive of a repository revision
122 122 bundle create a bundle file
123 123 export dump the header and diffs for one or more changesets
124 124 import import an ordered set of patches
125 125 unbundle apply one or more bundle files
126 126
127 127 Repository maintenance:
128 128
129 129 manifest output the current or given revision of the project manifest
130 130 recover roll back an interrupted transaction
131 131 verify verify the integrity of the repository
132 132
133 133 Help:
134 134
135 135 config show combined config settings from all hgrc files
136 136 help show help for a given topic or a help overview
137 137 version output version and copyright information
138 138
139 139 additional help topics:
140 140
141 bundlespec Bundle File Formats
141 Mercurial identifiers:
142
143 filesets Specifying File Sets
144 hgignore Syntax for Mercurial Ignore Files
145 patterns File Name Patterns
146 revisions Specifying Revisions
147 urls URL Paths
148
149 Mercurial output:
150
142 151 color Colorizing Outputs
152 dates Date Formats
153 diffs Diff Formats
154 templating Template Usage
155
156 Mercurial configuration:
157
143 158 config Configuration Files
144 dates Date Formats
145 deprecated Deprecated Features
146 diffs Diff Formats
147 159 environment Environment Variables
148 160 extensions Using Additional Features
149 filesets Specifying File Sets
150 161 flags Command-line flags
151 glossary Glossary
152 hgignore Syntax for Mercurial Ignore Files
153 162 hgweb Configuring hgweb
154 internals Technical implementation topics
155 163 merge-tools Merge Tools
156 164 pager Pager Support
157 patterns File Name Patterns
165
166 Concepts:
167
168 bundlespec Bundle File Formats
169 glossary Glossary
158 170 phases Working with Phases
159 revisions Specifying Revisions
171 subrepos Subrepositories
172
173 Miscellaneous:
174
175 deprecated Deprecated Features
176 internals Technical implementation topics
160 177 scripting Using Mercurial from scripts and automation
161 subrepos Subrepositories
162 templating Template Usage
163 urls URL Paths
164 178
165 179 (use 'hg help -v' to show built-in aliases and global options)
166 180
167 181 $ hg -q help
168 182 Repository creation:
169 183
170 184 clone make a copy of an existing repository
171 185 init create a new repository in the given directory
172 186
173 187 Remote repository management:
174 188
175 189 incoming show new changesets found in source
176 190 outgoing show changesets not found in the destination
177 191 paths show aliases for remote repositories
178 192 pull pull changes from the specified source
179 193 push push changes to the specified destination
180 194 serve start stand-alone webserver
181 195
182 196 Change creation:
183 197
184 198 commit commit the specified files or all outstanding changes
185 199
186 200 Change manipulation:
187 201
188 202 backout reverse effect of earlier changeset
189 203 graft copy changes from other branches onto the current branch
190 204 merge merge another revision into working directory
191 205
192 206 Change organization:
193 207
194 208 bookmarks create a new bookmark or list existing bookmarks
195 209 branch set or show the current branch name
196 210 branches list repository named branches
197 211 phase set or show the current phase name
198 212 tag add one or more tags for the current or given revision
199 213 tags list repository tags
200 214
201 215 File content management:
202 216
203 217 annotate show changeset information by line for each file
204 218 cat output the current or given revision of files
205 219 copy mark files as copied for the next commit
206 220 diff diff repository (or selected files)
207 221 grep search revision history for a pattern in specified files
208 222
209 223 Change navigation:
210 224
211 225 bisect subdivision search of changesets
212 226 heads show branch heads
213 227 identify identify the working directory or specified revision
214 228 log show revision history of entire repository or files
215 229
216 230 Working directory management:
217 231
218 232 add add the specified files on the next commit
219 233 addremove add all new files, delete all missing files
220 234 files list tracked files
221 235 forget forget the specified files on the next commit
222 236 remove remove the specified files on the next commit
223 237 rename rename files; equivalent of copy + remove
224 238 resolve redo merges or set/view the merge status of files
225 239 revert restore files to their checkout state
226 240 root print the root (top) of the current working directory
227 241 status show changed files in the working directory
228 242 summary summarize working directory state
229 243 update update working directory (or switch revisions)
230 244
231 245 Change import/export:
232 246
233 247 archive create an unversioned archive of a repository revision
234 248 bundle create a bundle file
235 249 export dump the header and diffs for one or more changesets
236 250 import import an ordered set of patches
237 251 unbundle apply one or more bundle files
238 252
239 253 Repository maintenance:
240 254
241 255 manifest output the current or given revision of the project manifest
242 256 recover roll back an interrupted transaction
243 257 verify verify the integrity of the repository
244 258
245 259 Help:
246 260
247 261 config show combined config settings from all hgrc files
248 262 help show help for a given topic or a help overview
249 263 version output version and copyright information
250 264
251 265 additional help topics:
252 266
253 bundlespec Bundle File Formats
267 Mercurial identifiers:
268
269 filesets Specifying File Sets
270 hgignore Syntax for Mercurial Ignore Files
271 patterns File Name Patterns
272 revisions Specifying Revisions
273 urls URL Paths
274
275 Mercurial output:
276
254 277 color Colorizing Outputs
278 dates Date Formats
279 diffs Diff Formats
280 templating Template Usage
281
282 Mercurial configuration:
283
255 284 config Configuration Files
256 dates Date Formats
257 deprecated Deprecated Features
258 diffs Diff Formats
259 285 environment Environment Variables
260 286 extensions Using Additional Features
261 filesets Specifying File Sets
262 287 flags Command-line flags
263 glossary Glossary
264 hgignore Syntax for Mercurial Ignore Files
265 288 hgweb Configuring hgweb
266 internals Technical implementation topics
267 289 merge-tools Merge Tools
268 290 pager Pager Support
269 patterns File Name Patterns
291
292 Concepts:
293
294 bundlespec Bundle File Formats
295 glossary Glossary
270 296 phases Working with Phases
271 revisions Specifying Revisions
297 subrepos Subrepositories
298
299 Miscellaneous:
300
301 deprecated Deprecated Features
302 internals Technical implementation topics
272 303 scripting Using Mercurial from scripts and automation
273 subrepos Subrepositories
274 templating Template Usage
275 urls URL Paths
276 304
277 305 Test extension help:
278 306 $ hg help extensions --config extensions.rebase= --config extensions.children=
279 307 Using Additional Features
280 308 """""""""""""""""""""""""
281 309
282 310 Mercurial has the ability to add new features through the use of
283 311 extensions. Extensions may add new commands, add options to existing
284 312 commands, change the default behavior of commands, or implement hooks.
285 313
286 314 To enable the "foo" extension, either shipped with Mercurial or in the
287 315 Python search path, create an entry for it in your configuration file,
288 316 like this:
289 317
290 318 [extensions]
291 319 foo =
292 320
293 321 You may also specify the full path to an extension:
294 322
295 323 [extensions]
296 324 myfeature = ~/.hgext/myfeature.py
297 325
298 326 See 'hg help config' for more information on configuration files.
299 327
300 328 Extensions are not loaded by default for a variety of reasons: they can
301 329 increase startup overhead; they may be meant for advanced usage only; they
302 330 may provide potentially dangerous abilities (such as letting you destroy
303 331 or modify history); they might not be ready for prime time; or they may
304 332 alter some usual behaviors of stock Mercurial. It is thus up to the user
305 333 to activate extensions as needed.
306 334
307 335 To explicitly disable an extension enabled in a configuration file of
308 336 broader scope, prepend its path with !:
309 337
310 338 [extensions]
311 339 # disabling extension bar residing in /path/to/extension/bar.py
312 340 bar = !/path/to/extension/bar.py
313 341 # ditto, but no path was supplied for extension baz
314 342 baz = !
315 343
316 344 enabled extensions:
317 345
318 346 children command to display child changesets (DEPRECATED)
319 347 rebase command to move sets of revisions to a different ancestor
320 348
321 349 disabled extensions:
322 350
323 351 acl hooks for controlling repository access
324 352 blackbox log repository events to a blackbox for debugging
325 353 bugzilla hooks for integrating with the Bugzilla bug tracker
326 354 censor erase file content at a given revision
327 355 churn command to display statistics about repository history
328 356 clonebundles advertise pre-generated bundles to seed clones
329 357 closehead close arbitrary heads without checking them out first
330 358 convert import revisions from foreign VCS repositories into
331 359 Mercurial
332 360 eol automatically manage newlines in repository files
333 361 extdiff command to allow external programs to compare revisions
334 362 factotum http authentication with factotum
335 363 githelp try mapping git commands to Mercurial commands
336 364 gpg commands to sign and verify changesets
337 365 hgk browse the repository in a graphical way
338 366 highlight syntax highlighting for hgweb (requires Pygments)
339 367 histedit interactive history editing
340 368 keyword expand keywords in tracked files
341 369 largefiles track large binary files
342 370 mq manage a stack of patches
343 371 notify hooks for sending email push notifications
344 372 patchbomb command to send changesets as (a series of) patch emails
345 373 purge command to delete untracked files from the working
346 374 directory
347 375 relink recreates hardlinks between repository clones
348 376 schemes extend schemes with shortcuts to repository swarms
349 377 share share a common history between several working directories
350 378 shelve save and restore changes to the working directory
351 379 strip strip changesets and their descendants from history
352 380 transplant command to transplant changesets from another branch
353 381 win32mbcs allow the use of MBCS paths with problematic encodings
354 382 zeroconf discover and advertise repositories on the local network
355 383
356 384 #endif
357 385
358 386 Verify that deprecated extensions are included if --verbose:
359 387
360 388 $ hg -v help extensions | grep children
361 389 children command to display child changesets (DEPRECATED)
362 390
363 391 Verify that extension keywords appear in help templates
364 392
365 393 $ hg help --config extensions.transplant= templating|grep transplant > /dev/null
366 394
367 395 Test short command list with verbose option
368 396
369 397 $ hg -v help shortlist
370 398 Mercurial Distributed SCM
371 399
372 400 basic commands:
373 401
374 402 add add the specified files on the next commit
375 403 annotate, blame
376 404 show changeset information by line for each file
377 405 clone make a copy of an existing repository
378 406 commit, ci commit the specified files or all outstanding changes
379 407 diff diff repository (or selected files)
380 408 export dump the header and diffs for one or more changesets
381 409 forget forget the specified files on the next commit
382 410 init create a new repository in the given directory
383 411 log, history show revision history of entire repository or files
384 412 merge merge another revision into working directory
385 413 pull pull changes from the specified source
386 414 push push changes to the specified destination
387 415 remove, rm remove the specified files on the next commit
388 416 serve start stand-alone webserver
389 417 status, st show changed files in the working directory
390 418 summary, sum summarize working directory state
391 419 update, up, checkout, co
392 420 update working directory (or switch revisions)
393 421
394 422 global options ([+] can be repeated):
395 423
396 424 -R --repository REPO repository root directory or name of overlay bundle
397 425 file
398 426 --cwd DIR change working directory
399 427 -y --noninteractive do not prompt, automatically pick the first choice for
400 428 all prompts
401 429 -q --quiet suppress output
402 430 -v --verbose enable additional output
403 431 --color TYPE when to colorize (boolean, always, auto, never, or
404 432 debug)
405 433 --config CONFIG [+] set/override config option (use 'section.name=value')
406 434 --debug enable debugging output
407 435 --debugger start debugger
408 436 --encoding ENCODE set the charset encoding (default: ascii)
409 437 --encodingmode MODE set the charset encoding mode (default: strict)
410 438 --traceback always print a traceback on exception
411 439 --time time how long the command takes
412 440 --profile print command execution profile
413 441 --version output version information and exit
414 442 -h --help display help and exit
415 443 --hidden consider hidden changesets
416 444 --pager TYPE when to paginate (boolean, always, auto, or never)
417 445 (default: auto)
418 446
419 447 (use 'hg help' for the full list of commands)
420 448
421 449 $ hg add -h
422 450 hg add [OPTION]... [FILE]...
423 451
424 452 add the specified files on the next commit
425 453
426 454 Schedule files to be version controlled and added to the repository.
427 455
428 456 The files will be added to the repository at the next commit. To undo an
429 457 add before that, see 'hg forget'.
430 458
431 459 If no names are given, add all files to the repository (except files
432 460 matching ".hgignore").
433 461
434 462 Returns 0 if all files are successfully added.
435 463
436 464 options ([+] can be repeated):
437 465
438 466 -I --include PATTERN [+] include names matching the given patterns
439 467 -X --exclude PATTERN [+] exclude names matching the given patterns
440 468 -S --subrepos recurse into subrepositories
441 469 -n --dry-run do not perform actions, just print output
442 470
443 471 (some details hidden, use --verbose to show complete help)
444 472
445 473 Verbose help for add
446 474
447 475 $ hg add -hv
448 476 hg add [OPTION]... [FILE]...
449 477
450 478 add the specified files on the next commit
451 479
452 480 Schedule files to be version controlled and added to the repository.
453 481
454 482 The files will be added to the repository at the next commit. To undo an
455 483 add before that, see 'hg forget'.
456 484
457 485 If no names are given, add all files to the repository (except files
458 486 matching ".hgignore").
459 487
460 488 Examples:
461 489
462 490 - New (unknown) files are added automatically by 'hg add':
463 491
464 492 $ ls
465 493 foo.c
466 494 $ hg status
467 495 ? foo.c
468 496 $ hg add
469 497 adding foo.c
470 498 $ hg status
471 499 A foo.c
472 500
473 501 - Specific files to be added can be specified:
474 502
475 503 $ ls
476 504 bar.c foo.c
477 505 $ hg status
478 506 ? bar.c
479 507 ? foo.c
480 508 $ hg add bar.c
481 509 $ hg status
482 510 A bar.c
483 511 ? foo.c
484 512
485 513 Returns 0 if all files are successfully added.
486 514
487 515 options ([+] can be repeated):
488 516
489 517 -I --include PATTERN [+] include names matching the given patterns
490 518 -X --exclude PATTERN [+] exclude names matching the given patterns
491 519 -S --subrepos recurse into subrepositories
492 520 -n --dry-run do not perform actions, just print output
493 521
494 522 global options ([+] can be repeated):
495 523
496 524 -R --repository REPO repository root directory or name of overlay bundle
497 525 file
498 526 --cwd DIR change working directory
499 527 -y --noninteractive do not prompt, automatically pick the first choice for
500 528 all prompts
501 529 -q --quiet suppress output
502 530 -v --verbose enable additional output
503 531 --color TYPE when to colorize (boolean, always, auto, never, or
504 532 debug)
505 533 --config CONFIG [+] set/override config option (use 'section.name=value')
506 534 --debug enable debugging output
507 535 --debugger start debugger
508 536 --encoding ENCODE set the charset encoding (default: ascii)
509 537 --encodingmode MODE set the charset encoding mode (default: strict)
510 538 --traceback always print a traceback on exception
511 539 --time time how long the command takes
512 540 --profile print command execution profile
513 541 --version output version information and exit
514 542 -h --help display help and exit
515 543 --hidden consider hidden changesets
516 544 --pager TYPE when to paginate (boolean, always, auto, or never)
517 545 (default: auto)
518 546
519 547 Test the textwidth config option
520 548
521 549 $ hg root -h --config ui.textwidth=50
522 550 hg root
523 551
524 552 print the root (top) of the current working
525 553 directory
526 554
527 555 Print the root directory of the current
528 556 repository.
529 557
530 558 Returns 0 on success.
531 559
532 560 (some details hidden, use --verbose to show
533 561 complete help)
534 562
535 563 Test help option with version option
536 564
537 565 $ hg add -h --version
538 566 Mercurial Distributed SCM (version *) (glob)
539 567 (see https://mercurial-scm.org for more information)
540 568
541 569 Copyright (C) 2005-* Matt Mackall and others (glob)
542 570 This is free software; see the source for copying conditions. There is NO
543 571 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
544 572
545 573 $ hg add --skjdfks
546 574 hg add: option --skjdfks not recognized
547 575 hg add [OPTION]... [FILE]...
548 576
549 577 add the specified files on the next commit
550 578
551 579 options ([+] can be repeated):
552 580
553 581 -I --include PATTERN [+] include names matching the given patterns
554 582 -X --exclude PATTERN [+] exclude names matching the given patterns
555 583 -S --subrepos recurse into subrepositories
556 584 -n --dry-run do not perform actions, just print output
557 585
558 586 (use 'hg add -h' to show more help)
559 587 [255]
560 588
561 589 Test ambiguous command help
562 590
563 591 $ hg help ad
564 592 list of commands:
565 593
566 594 add add the specified files on the next commit
567 595 addremove add all new files, delete all missing files
568 596
569 597 (use 'hg help -v ad' to show built-in aliases and global options)
570 598
571 599 Test command without options
572 600
573 601 $ hg help verify
574 602 hg verify
575 603
576 604 verify the integrity of the repository
577 605
578 606 Verify the integrity of the current repository.
579 607
580 608 This will perform an extensive check of the repository's integrity,
581 609 validating the hashes and checksums of each entry in the changelog,
582 610 manifest, and tracked files, as well as the integrity of their crosslinks
583 611 and indices.
584 612
585 613 Please see https://mercurial-scm.org/wiki/RepositoryCorruption for more
586 614 information about recovery from corruption of the repository.
587 615
588 616 Returns 0 on success, 1 if errors are encountered.
589 617
590 618 (some details hidden, use --verbose to show complete help)
591 619
592 620 $ hg help diff
593 621 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
594 622
595 623 diff repository (or selected files)
596 624
597 625 Show differences between revisions for the specified files.
598 626
599 627 Differences between files are shown using the unified diff format.
600 628
601 629 Note:
602 630 'hg diff' may generate unexpected results for merges, as it will
603 631 default to comparing against the working directory's first parent
604 632 changeset if no revisions are specified.
605 633
606 634 When two revision arguments are given, then changes are shown between
607 635 those revisions. If only one revision is specified then that revision is
608 636 compared to the working directory, and, when no revisions are specified,
609 637 the working directory files are compared to its first parent.
610 638
611 639 Alternatively you can specify -c/--change with a revision to see the
612 640 changes in that changeset relative to its first parent.
613 641
614 642 Without the -a/--text option, diff will avoid generating diffs of files it
615 643 detects as binary. With -a, diff will generate a diff anyway, probably
616 644 with undesirable results.
617 645
618 646 Use the -g/--git option to generate diffs in the git extended diff format.
619 647 For more information, read 'hg help diffs'.
620 648
621 649 Returns 0 on success.
622 650
623 651 options ([+] can be repeated):
624 652
625 653 -r --rev REV [+] revision
626 654 -c --change REV change made by revision
627 655 -a --text treat all files as text
628 656 -g --git use git extended diff format
629 657 --binary generate binary diffs in git mode (default)
630 658 --nodates omit dates from diff headers
631 659 --noprefix omit a/ and b/ prefixes from filenames
632 660 -p --show-function show which function each change is in
633 661 --reverse produce a diff that undoes the changes
634 662 -w --ignore-all-space ignore white space when comparing lines
635 663 -b --ignore-space-change ignore changes in the amount of white space
636 664 -B --ignore-blank-lines ignore changes whose lines are all blank
637 665 -Z --ignore-space-at-eol ignore changes in whitespace at EOL
638 666 -U --unified NUM number of lines of context to show
639 667 --stat output diffstat-style summary of changes
640 668 --root DIR produce diffs relative to subdirectory
641 669 -I --include PATTERN [+] include names matching the given patterns
642 670 -X --exclude PATTERN [+] exclude names matching the given patterns
643 671 -S --subrepos recurse into subrepositories
644 672
645 673 (some details hidden, use --verbose to show complete help)
646 674
647 675 $ hg help status
648 676 hg status [OPTION]... [FILE]...
649 677
650 678 aliases: st
651 679
652 680 show changed files in the working directory
653 681
654 682 Show status of files in the repository. If names are given, only files
655 683 that match are shown. Files that are clean or ignored or the source of a
656 684 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
657 685 -C/--copies or -A/--all are given. Unless options described with "show
658 686 only ..." are given, the options -mardu are used.
659 687
660 688 Option -q/--quiet hides untracked (unknown and ignored) files unless
661 689 explicitly requested with -u/--unknown or -i/--ignored.
662 690
663 691 Note:
664 692 'hg status' may appear to disagree with diff if permissions have
665 693 changed or a merge has occurred. The standard diff format does not
666 694 report permission changes and diff only reports changes relative to one
667 695 merge parent.
668 696
669 697 If one revision is given, it is used as the base revision. If two
670 698 revisions are given, the differences between them are shown. The --change
671 699 option can also be used as a shortcut to list the changed files of a
672 700 revision from its first parent.
673 701
674 702 The codes used to show the status of files are:
675 703
676 704 M = modified
677 705 A = added
678 706 R = removed
679 707 C = clean
680 708 ! = missing (deleted by non-hg command, but still tracked)
681 709 ? = not tracked
682 710 I = ignored
683 711 = origin of the previous file (with --copies)
684 712
685 713 Returns 0 on success.
686 714
687 715 options ([+] can be repeated):
688 716
689 717 -A --all show status of all files
690 718 -m --modified show only modified files
691 719 -a --added show only added files
692 720 -r --removed show only removed files
693 721 -d --deleted show only deleted (but tracked) files
694 722 -c --clean show only files without changes
695 723 -u --unknown show only unknown (not tracked) files
696 724 -i --ignored show only ignored files
697 725 -n --no-status hide status prefix
698 726 -C --copies show source of copied files
699 727 -0 --print0 end filenames with NUL, for use with xargs
700 728 --rev REV [+] show difference from revision
701 729 --change REV list the changed files of a revision
702 730 -I --include PATTERN [+] include names matching the given patterns
703 731 -X --exclude PATTERN [+] exclude names matching the given patterns
704 732 -S --subrepos recurse into subrepositories
705 733 -T --template TEMPLATE display with template
706 734
707 735 (some details hidden, use --verbose to show complete help)
708 736
709 737 $ hg -q help status
710 738 hg status [OPTION]... [FILE]...
711 739
712 740 show changed files in the working directory
713 741
714 742 $ hg help foo
715 743 abort: no such help topic: foo
716 744 (try 'hg help --keyword foo')
717 745 [255]
718 746
719 747 $ hg skjdfks
720 748 hg: unknown command 'skjdfks'
721 749 (use 'hg help' for a list of commands)
722 750 [255]
723 751
724 752 Typoed command gives suggestion
725 753 $ hg puls
726 754 hg: unknown command 'puls'
727 755 (did you mean one of pull, push?)
728 756 [255]
729 757
730 758 Not enabled extension gets suggested
731 759
732 760 $ hg rebase
733 761 hg: unknown command 'rebase'
734 762 'rebase' is provided by the following extension:
735 763
736 764 rebase command to move sets of revisions to a different ancestor
737 765
738 766 (use 'hg help extensions' for information on enabling extensions)
739 767 [255]
740 768
741 769 Disabled extension gets suggested
742 770 $ hg --config extensions.rebase=! rebase
743 771 hg: unknown command 'rebase'
744 772 'rebase' is provided by the following extension:
745 773
746 774 rebase command to move sets of revisions to a different ancestor
747 775
748 776 (use 'hg help extensions' for information on enabling extensions)
749 777 [255]
750 778
751 779 Make sure that we don't run afoul of the help system thinking that
752 780 this is a section and erroring out weirdly.
753 781
754 782 $ hg .log
755 783 hg: unknown command '.log'
756 784 (did you mean log?)
757 785 [255]
758 786
759 787 $ hg log.
760 788 hg: unknown command 'log.'
761 789 (did you mean log?)
762 790 [255]
763 791 $ hg pu.lh
764 792 hg: unknown command 'pu.lh'
765 793 (did you mean one of pull, push?)
766 794 [255]
767 795
768 796 $ cat > helpext.py <<EOF
769 797 > import os
770 798 > from mercurial import commands, fancyopts, registrar
771 799 >
772 800 > def func(arg):
773 801 > return '%sfoo' % arg
774 802 > class customopt(fancyopts.customopt):
775 803 > def newstate(self, oldstate, newparam, abort):
776 804 > return '%sbar' % oldstate
777 805 > cmdtable = {}
778 806 > command = registrar.command(cmdtable)
779 807 >
780 808 > @command(b'nohelp',
781 809 > [(b'', b'longdesc', 3, b'x'*67),
782 810 > (b'n', b'', None, b'normal desc'),
783 811 > (b'', b'newline', b'', b'line1\nline2'),
784 812 > (b'', b'callableopt', func, b'adds foo'),
785 813 > (b'', b'customopt', customopt(''), b'adds bar'),
786 814 > (b'', b'customopt-withdefault', customopt('foo'), b'adds bar')],
787 815 > b'hg nohelp',
788 816 > norepo=True)
789 817 > @command(b'debugoptADV', [(b'', b'aopt', None, b'option is (ADVANCED)')])
790 818 > @command(b'debugoptDEP', [(b'', b'dopt', None, b'option is (DEPRECATED)')])
791 819 > @command(b'debugoptEXP', [(b'', b'eopt', None, b'option is (EXPERIMENTAL)')])
792 820 > def nohelp(ui, *args, **kwargs):
793 821 > pass
794 822 >
795 823 > def uisetup(ui):
796 824 > ui.setconfig(b'alias', b'shellalias', b'!echo hi', b'helpext')
797 825 > ui.setconfig(b'alias', b'hgalias', b'summary', b'helpext')
798 826 >
799 827 > EOF
800 828 $ echo '[extensions]' >> $HGRCPATH
801 829 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
802 830
803 831 Test for aliases
804 832
805 833 $ hg help hgalias
806 834 hg hgalias [--remote]
807 835
808 836 alias for: hg summary
809 837
810 838 summarize working directory state
811 839
812 840 This generates a brief summary of the working directory state, including
813 841 parents, branch, commit status, phase and available updates.
814 842
815 843 With the --remote option, this will check the default paths for incoming
816 844 and outgoing changes. This can be time-consuming.
817 845
818 846 Returns 0 on success.
819 847
820 848 defined by: helpext
821 849
822 850 options:
823 851
824 852 --remote check for push and pull
825 853
826 854 (some details hidden, use --verbose to show complete help)
827 855
828 856 $ hg help shellalias
829 857 hg shellalias
830 858
831 859 shell alias for: echo hi
832 860
833 861 (no help text available)
834 862
835 863 defined by: helpext
836 864
837 865 (some details hidden, use --verbose to show complete help)
838 866
839 867 Test command with no help text
840 868
841 869 $ hg help nohelp
842 870 hg nohelp
843 871
844 872 (no help text available)
845 873
846 874 options:
847 875
848 876 --longdesc VALUE
849 877 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
850 878 xxxxxxxxxxxxxxxxxxxxxxx (default: 3)
851 879 -n -- normal desc
852 880 --newline VALUE line1 line2
853 881 --callableopt VALUE adds foo
854 882 --customopt VALUE adds bar
855 883 --customopt-withdefault VALUE adds bar (default: foo)
856 884
857 885 (some details hidden, use --verbose to show complete help)
858 886
859 887 $ hg help -k nohelp
860 888 Commands:
861 889
862 890 nohelp hg nohelp
863 891
864 892 Extension Commands:
865 893
866 894 nohelp (no help text available)
867 895
868 896 Test that default list of commands omits extension commands
869 897
870 898 #if no-extraextensions
871 899
872 900 $ hg help
873 901 Mercurial Distributed SCM
874 902
875 903 list of commands:
876 904
877 905 Repository creation:
878 906
879 907 clone make a copy of an existing repository
880 908 init create a new repository in the given directory
881 909
882 910 Remote repository management:
883 911
884 912 incoming show new changesets found in source
885 913 outgoing show changesets not found in the destination
886 914 paths show aliases for remote repositories
887 915 pull pull changes from the specified source
888 916 push push changes to the specified destination
889 917 serve start stand-alone webserver
890 918
891 919 Change creation:
892 920
893 921 commit commit the specified files or all outstanding changes
894 922
895 923 Change manipulation:
896 924
897 925 backout reverse effect of earlier changeset
898 926 graft copy changes from other branches onto the current branch
899 927 merge merge another revision into working directory
900 928
901 929 Change organization:
902 930
903 931 bookmarks create a new bookmark or list existing bookmarks
904 932 branch set or show the current branch name
905 933 branches list repository named branches
906 934 phase set or show the current phase name
907 935 tag add one or more tags for the current or given revision
908 936 tags list repository tags
909 937
910 938 File content management:
911 939
912 940 annotate show changeset information by line for each file
913 941 cat output the current or given revision of files
914 942 copy mark files as copied for the next commit
915 943 diff diff repository (or selected files)
916 944 grep search revision history for a pattern in specified files
917 945
918 946 Change navigation:
919 947
920 948 bisect subdivision search of changesets
921 949 heads show branch heads
922 950 identify identify the working directory or specified revision
923 951 log show revision history of entire repository or files
924 952
925 953 Working directory management:
926 954
927 955 add add the specified files on the next commit
928 956 addremove add all new files, delete all missing files
929 957 files list tracked files
930 958 forget forget the specified files on the next commit
931 959 remove remove the specified files on the next commit
932 960 rename rename files; equivalent of copy + remove
933 961 resolve redo merges or set/view the merge status of files
934 962 revert restore files to their checkout state
935 963 root print the root (top) of the current working directory
936 964 status show changed files in the working directory
937 965 summary summarize working directory state
938 966 update update working directory (or switch revisions)
939 967
940 968 Change import/export:
941 969
942 970 archive create an unversioned archive of a repository revision
943 971 bundle create a bundle file
944 972 export dump the header and diffs for one or more changesets
945 973 import import an ordered set of patches
946 974 unbundle apply one or more bundle files
947 975
948 976 Repository maintenance:
949 977
950 978 manifest output the current or given revision of the project manifest
951 979 recover roll back an interrupted transaction
952 980 verify verify the integrity of the repository
953 981
954 982 Help:
955 983
956 984 config show combined config settings from all hgrc files
957 985 help show help for a given topic or a help overview
958 986 version output version and copyright information
959 987
960 988 enabled extensions:
961 989
962 990 helpext (no help text available)
963 991
964 992 additional help topics:
965 993
966 bundlespec Bundle File Formats
994 Mercurial identifiers:
995
996 filesets Specifying File Sets
997 hgignore Syntax for Mercurial Ignore Files
998 patterns File Name Patterns
999 revisions Specifying Revisions
1000 urls URL Paths
1001
1002 Mercurial output:
1003
967 1004 color Colorizing Outputs
1005 dates Date Formats
1006 diffs Diff Formats
1007 templating Template Usage
1008
1009 Mercurial configuration:
1010
968 1011 config Configuration Files
969 dates Date Formats
970 deprecated Deprecated Features
971 diffs Diff Formats
972 1012 environment Environment Variables
973 1013 extensions Using Additional Features
974 filesets Specifying File Sets
975 1014 flags Command-line flags
976 glossary Glossary
977 hgignore Syntax for Mercurial Ignore Files
978 1015 hgweb Configuring hgweb
979 internals Technical implementation topics
980 1016 merge-tools Merge Tools
981 1017 pager Pager Support
982 patterns File Name Patterns
1018
1019 Concepts:
1020
1021 bundlespec Bundle File Formats
1022 glossary Glossary
983 1023 phases Working with Phases
984 revisions Specifying Revisions
1024 subrepos Subrepositories
1025
1026 Miscellaneous:
1027
1028 deprecated Deprecated Features
1029 internals Technical implementation topics
985 1030 scripting Using Mercurial from scripts and automation
986 subrepos Subrepositories
987 templating Template Usage
988 urls URL Paths
989 1031
990 1032 (use 'hg help -v' to show built-in aliases and global options)
991 1033
992 1034 #endif
993 1035
994 1036 Test list of internal help commands
995 1037
996 1038 $ hg help debug
997 1039 debug commands (internal and unsupported):
998 1040
999 1041 debugancestor
1000 1042 find the ancestor revision of two revisions in a given index
1001 1043 debugapplystreamclonebundle
1002 1044 apply a stream clone bundle file
1003 1045 debugbuilddag
1004 1046 builds a repo with a given DAG from scratch in the current
1005 1047 empty repo
1006 1048 debugbundle lists the contents of a bundle
1007 1049 debugcapabilities
1008 1050 lists the capabilities of a remote peer
1009 1051 debugcheckstate
1010 1052 validate the correctness of the current dirstate
1011 1053 debugcolor show available color, effects or style
1012 1054 debugcommands
1013 1055 list all available commands and options
1014 1056 debugcomplete
1015 1057 returns the completion list associated with the given command
1016 1058 debugcreatestreamclonebundle
1017 1059 create a stream clone bundle file
1018 1060 debugdag format the changelog or an index DAG as a concise textual
1019 1061 description
1020 1062 debugdata dump the contents of a data file revision
1021 1063 debugdate parse and display a date
1022 1064 debugdeltachain
1023 1065 dump information about delta chains in a revlog
1024 1066 debugdirstate
1025 1067 show the contents of the current dirstate
1026 1068 debugdiscovery
1027 1069 runs the changeset discovery protocol in isolation
1028 1070 debugdownload
1029 1071 download a resource using Mercurial logic and config
1030 1072 debugextensions
1031 1073 show information about active extensions
1032 1074 debugfileset parse and apply a fileset specification
1033 1075 debugformat display format information about the current repository
1034 1076 debugfsinfo show information detected about current filesystem
1035 1077 debuggetbundle
1036 1078 retrieves a bundle from a repo
1037 1079 debugignore display the combined ignore pattern and information about
1038 1080 ignored files
1039 1081 debugindex dump index data for a storage primitive
1040 1082 debugindexdot
1041 1083 dump an index DAG as a graphviz dot file
1042 1084 debugindexstats
1043 1085 show stats related to the changelog index
1044 1086 debuginstall test Mercurial installation
1045 1087 debugknown test whether node ids are known to a repo
1046 1088 debuglocks show or modify state of locks
1047 1089 debugmanifestfulltextcache
1048 1090 show, clear or amend the contents of the manifest fulltext
1049 1091 cache
1050 1092 debugmergestate
1051 1093 print merge state
1052 1094 debugnamecomplete
1053 1095 complete "names" - tags, open branch names, bookmark names
1054 1096 debugobsolete
1055 1097 create arbitrary obsolete marker
1056 1098 debugoptADV (no help text available)
1057 1099 debugoptDEP (no help text available)
1058 1100 debugoptEXP (no help text available)
1059 1101 debugpathcomplete
1060 1102 complete part or all of a tracked path
1061 1103 debugpeer establish a connection to a peer repository
1062 1104 debugpickmergetool
1063 1105 examine which merge tool is chosen for specified file
1064 1106 debugpushkey access the pushkey key/value protocol
1065 1107 debugpvec (no help text available)
1066 1108 debugrebuilddirstate
1067 1109 rebuild the dirstate as it would look like for the given
1068 1110 revision
1069 1111 debugrebuildfncache
1070 1112 rebuild the fncache file
1071 1113 debugrename dump rename information
1072 1114 debugrevlog show data and statistics about a revlog
1073 1115 debugrevlogindex
1074 1116 dump the contents of a revlog index
1075 1117 debugrevspec parse and apply a revision specification
1076 1118 debugserve run a server with advanced settings
1077 1119 debugsetparents
1078 1120 manually set the parents of the current working directory
1079 1121 debugssl test a secure connection to a server
1080 1122 debugsub (no help text available)
1081 1123 debugsuccessorssets
1082 1124 show set of successors for revision
1083 1125 debugtemplate
1084 1126 parse and apply a template
1085 1127 debuguigetpass
1086 1128 show prompt to type password
1087 1129 debuguiprompt
1088 1130 show plain prompt
1089 1131 debugupdatecaches
1090 1132 warm all known caches in the repository
1091 1133 debugupgraderepo
1092 1134 upgrade a repository to use different features
1093 1135 debugwalk show how files match on given patterns
1094 1136 debugwhyunstable
1095 1137 explain instabilities of a changeset
1096 1138 debugwireargs
1097 1139 (no help text available)
1098 1140 debugwireproto
1099 1141 send wire protocol commands to a server
1100 1142
1101 1143 (use 'hg help -v debug' to show built-in aliases and global options)
1102 1144
1103 1145 internals topic renders index of available sub-topics
1104 1146
1105 1147 $ hg help internals
1106 1148 Technical implementation topics
1107 1149 """""""""""""""""""""""""""""""
1108 1150
1109 1151 To access a subtopic, use "hg help internals.{subtopic-name}"
1110 1152
1111 1153 bundle2 Bundle2
1112 1154 bundles Bundles
1113 1155 cbor CBOR
1114 1156 censor Censor
1115 1157 changegroups Changegroups
1116 1158 config Config Registrar
1117 1159 requirements Repository Requirements
1118 1160 revlogs Revision Logs
1119 1161 wireprotocol Wire Protocol
1120 1162 wireprotocolrpc
1121 1163 Wire Protocol RPC
1122 1164 wireprotocolv2
1123 1165 Wire Protocol Version 2
1124 1166
1125 1167 sub-topics can be accessed
1126 1168
1127 1169 $ hg help internals.changegroups
1128 1170 Changegroups
1129 1171 """"""""""""
1130 1172
1131 1173 Changegroups are representations of repository revlog data, specifically
1132 1174 the changelog data, root/flat manifest data, treemanifest data, and
1133 1175 filelogs.
1134 1176
1135 1177 There are 3 versions of changegroups: "1", "2", and "3". From a high-
1136 1178 level, versions "1" and "2" are almost exactly the same, with the only
1137 1179 difference being an additional item in the *delta header*. Version "3"
1138 1180 adds support for storage flags in the *delta header* and optionally
1139 1181 exchanging treemanifests (enabled by setting an option on the
1140 1182 "changegroup" part in the bundle2).
1141 1183
1142 1184 Changegroups when not exchanging treemanifests consist of 3 logical
1143 1185 segments:
1144 1186
1145 1187 +---------------------------------+
1146 1188 | | | |
1147 1189 | changeset | manifest | filelogs |
1148 1190 | | | |
1149 1191 | | | |
1150 1192 +---------------------------------+
1151 1193
1152 1194 When exchanging treemanifests, there are 4 logical segments:
1153 1195
1154 1196 +-------------------------------------------------+
1155 1197 | | | | |
1156 1198 | changeset | root | treemanifests | filelogs |
1157 1199 | | manifest | | |
1158 1200 | | | | |
1159 1201 +-------------------------------------------------+
1160 1202
1161 1203 The principle building block of each segment is a *chunk*. A *chunk* is a
1162 1204 framed piece of data:
1163 1205
1164 1206 +---------------------------------------+
1165 1207 | | |
1166 1208 | length | data |
1167 1209 | (4 bytes) | (<length - 4> bytes) |
1168 1210 | | |
1169 1211 +---------------------------------------+
1170 1212
1171 1213 All integers are big-endian signed integers. Each chunk starts with a
1172 1214 32-bit integer indicating the length of the entire chunk (including the
1173 1215 length field itself).
1174 1216
1175 1217 There is a special case chunk that has a value of 0 for the length
1176 1218 ("0x00000000"). We call this an *empty chunk*.
1177 1219
1178 1220 Delta Groups
1179 1221 ============
1180 1222
1181 1223 A *delta group* expresses the content of a revlog as a series of deltas,
1182 1224 or patches against previous revisions.
1183 1225
1184 1226 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
1185 1227 to signal the end of the delta group:
1186 1228
1187 1229 +------------------------------------------------------------------------+
1188 1230 | | | | | |
1189 1231 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
1190 1232 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
1191 1233 | | | | | |
1192 1234 +------------------------------------------------------------------------+
1193 1235
1194 1236 Each *chunk*'s data consists of the following:
1195 1237
1196 1238 +---------------------------------------+
1197 1239 | | |
1198 1240 | delta header | delta data |
1199 1241 | (various by version) | (various) |
1200 1242 | | |
1201 1243 +---------------------------------------+
1202 1244
1203 1245 The *delta data* is a series of *delta*s that describe a diff from an
1204 1246 existing entry (either that the recipient already has, or previously
1205 1247 specified in the bundle/changegroup).
1206 1248
1207 1249 The *delta header* is different between versions "1", "2", and "3" of the
1208 1250 changegroup format.
1209 1251
1210 1252 Version 1 (headerlen=80):
1211 1253
1212 1254 +------------------------------------------------------+
1213 1255 | | | | |
1214 1256 | node | p1 node | p2 node | link node |
1215 1257 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1216 1258 | | | | |
1217 1259 +------------------------------------------------------+
1218 1260
1219 1261 Version 2 (headerlen=100):
1220 1262
1221 1263 +------------------------------------------------------------------+
1222 1264 | | | | | |
1223 1265 | node | p1 node | p2 node | base node | link node |
1224 1266 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1225 1267 | | | | | |
1226 1268 +------------------------------------------------------------------+
1227 1269
1228 1270 Version 3 (headerlen=102):
1229 1271
1230 1272 +------------------------------------------------------------------------------+
1231 1273 | | | | | | |
1232 1274 | node | p1 node | p2 node | base node | link node | flags |
1233 1275 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
1234 1276 | | | | | | |
1235 1277 +------------------------------------------------------------------------------+
1236 1278
1237 1279 The *delta data* consists of "chunklen - 4 - headerlen" bytes, which
1238 1280 contain a series of *delta*s, densely packed (no separators). These deltas
1239 1281 describe a diff from an existing entry (either that the recipient already
1240 1282 has, or previously specified in the bundle/changegroup). The format is
1241 1283 described more fully in "hg help internals.bdiff", but briefly:
1242 1284
1243 1285 +---------------------------------------------------------------+
1244 1286 | | | | |
1245 1287 | start offset | end offset | new length | content |
1246 1288 | (4 bytes) | (4 bytes) | (4 bytes) | (<new length> bytes) |
1247 1289 | | | | |
1248 1290 +---------------------------------------------------------------+
1249 1291
1250 1292 Please note that the length field in the delta data does *not* include
1251 1293 itself.
1252 1294
1253 1295 In version 1, the delta is always applied against the previous node from
1254 1296 the changegroup or the first parent if this is the first entry in the
1255 1297 changegroup.
1256 1298
1257 1299 In version 2 and up, the delta base node is encoded in the entry in the
1258 1300 changegroup. This allows the delta to be expressed against any parent,
1259 1301 which can result in smaller deltas and more efficient encoding of data.
1260 1302
1261 1303 The *flags* field holds bitwise flags affecting the processing of revision
1262 1304 data. The following flags are defined:
1263 1305
1264 1306 32768
1265 1307 Censored revision. The revision's fulltext has been replaced by censor
1266 1308 metadata. May only occur on file revisions.
1267 1309
1268 1310 16384
1269 1311 Ellipsis revision. Revision hash does not match data (likely due to
1270 1312 rewritten parents).
1271 1313
1272 1314 8192
1273 1315 Externally stored. The revision fulltext contains "key:value" "\n"
1274 1316 delimited metadata defining an object stored elsewhere. Used by the LFS
1275 1317 extension.
1276 1318
1277 1319 For historical reasons, the integer values are identical to revlog version
1278 1320 1 per-revision storage flags and correspond to bits being set in this
1279 1321 2-byte field. Bits were allocated starting from the most-significant bit,
1280 1322 hence the reverse ordering and allocation of these flags.
1281 1323
1282 1324 Changeset Segment
1283 1325 =================
1284 1326
1285 1327 The *changeset segment* consists of a single *delta group* holding
1286 1328 changelog data. The *empty chunk* at the end of the *delta group* denotes
1287 1329 the boundary to the *manifest segment*.
1288 1330
1289 1331 Manifest Segment
1290 1332 ================
1291 1333
1292 1334 The *manifest segment* consists of a single *delta group* holding manifest
1293 1335 data. If treemanifests are in use, it contains only the manifest for the
1294 1336 root directory of the repository. Otherwise, it contains the entire
1295 1337 manifest data. The *empty chunk* at the end of the *delta group* denotes
1296 1338 the boundary to the next segment (either the *treemanifests segment* or
1297 1339 the *filelogs segment*, depending on version and the request options).
1298 1340
1299 1341 Treemanifests Segment
1300 1342 ---------------------
1301 1343
1302 1344 The *treemanifests segment* only exists in changegroup version "3", and
1303 1345 only if the 'treemanifest' param is part of the bundle2 changegroup part
1304 1346 (it is not possible to use changegroup version 3 outside of bundle2).
1305 1347 Aside from the filenames in the *treemanifests segment* containing a
1306 1348 trailing "/" character, it behaves identically to the *filelogs segment*
1307 1349 (see below). The final sub-segment is followed by an *empty chunk*
1308 1350 (logically, a sub-segment with filename size 0). This denotes the boundary
1309 1351 to the *filelogs segment*.
1310 1352
1311 1353 Filelogs Segment
1312 1354 ================
1313 1355
1314 1356 The *filelogs segment* consists of multiple sub-segments, each
1315 1357 corresponding to an individual file whose data is being described:
1316 1358
1317 1359 +--------------------------------------------------+
1318 1360 | | | | | |
1319 1361 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
1320 1362 | | | | | (4 bytes) |
1321 1363 | | | | | |
1322 1364 +--------------------------------------------------+
1323 1365
1324 1366 The final filelog sub-segment is followed by an *empty chunk* (logically,
1325 1367 a sub-segment with filename size 0). This denotes the end of the segment
1326 1368 and of the overall changegroup.
1327 1369
1328 1370 Each filelog sub-segment consists of the following:
1329 1371
1330 1372 +------------------------------------------------------+
1331 1373 | | | |
1332 1374 | filename length | filename | delta group |
1333 1375 | (4 bytes) | (<length - 4> bytes) | (various) |
1334 1376 | | | |
1335 1377 +------------------------------------------------------+
1336 1378
1337 1379 That is, a *chunk* consisting of the filename (not terminated or padded)
1338 1380 followed by N chunks constituting the *delta group* for this file. The
1339 1381 *empty chunk* at the end of each *delta group* denotes the boundary to the
1340 1382 next filelog sub-segment.
1341 1383
1342 1384 Test list of commands with command with no help text
1343 1385
1344 1386 $ hg help helpext
1345 1387 helpext extension - no help text available
1346 1388
1347 1389 list of commands:
1348 1390
1349 1391 nohelp (no help text available)
1350 1392
1351 1393 (use 'hg help -v helpext' to show built-in aliases and global options)
1352 1394
1353 1395
1354 1396 test advanced, deprecated and experimental options are hidden in command help
1355 1397 $ hg help debugoptADV
1356 1398 hg debugoptADV
1357 1399
1358 1400 (no help text available)
1359 1401
1360 1402 options:
1361 1403
1362 1404 (some details hidden, use --verbose to show complete help)
1363 1405 $ hg help debugoptDEP
1364 1406 hg debugoptDEP
1365 1407
1366 1408 (no help text available)
1367 1409
1368 1410 options:
1369 1411
1370 1412 (some details hidden, use --verbose to show complete help)
1371 1413
1372 1414 $ hg help debugoptEXP
1373 1415 hg debugoptEXP
1374 1416
1375 1417 (no help text available)
1376 1418
1377 1419 options:
1378 1420
1379 1421 (some details hidden, use --verbose to show complete help)
1380 1422
1381 1423 test advanced, deprecated and experimental options are shown with -v
1382 1424 $ hg help -v debugoptADV | grep aopt
1383 1425 --aopt option is (ADVANCED)
1384 1426 $ hg help -v debugoptDEP | grep dopt
1385 1427 --dopt option is (DEPRECATED)
1386 1428 $ hg help -v debugoptEXP | grep eopt
1387 1429 --eopt option is (EXPERIMENTAL)
1388 1430
1389 1431 #if gettext
1390 1432 test deprecated option is hidden with translation with untranslated description
1391 1433 (use many globy for not failing on changed transaction)
1392 1434 $ LANGUAGE=sv hg help debugoptDEP
1393 1435 hg debugoptDEP
1394 1436
1395 1437 (*) (glob)
1396 1438
1397 1439 options:
1398 1440
1399 1441 (some details hidden, use --verbose to show complete help)
1400 1442 #endif
1401 1443
1402 1444 Test commands that collide with topics (issue4240)
1403 1445
1404 1446 $ hg config -hq
1405 1447 hg config [-u] [NAME]...
1406 1448
1407 1449 show combined config settings from all hgrc files
1408 1450 $ hg showconfig -hq
1409 1451 hg config [-u] [NAME]...
1410 1452
1411 1453 show combined config settings from all hgrc files
1412 1454
1413 1455 Test a help topic
1414 1456
1415 1457 $ hg help dates
1416 1458 Date Formats
1417 1459 """"""""""""
1418 1460
1419 1461 Some commands allow the user to specify a date, e.g.:
1420 1462
1421 1463 - backout, commit, import, tag: Specify the commit date.
1422 1464 - log, revert, update: Select revision(s) by date.
1423 1465
1424 1466 Many date formats are valid. Here are some examples:
1425 1467
1426 1468 - "Wed Dec 6 13:18:29 2006" (local timezone assumed)
1427 1469 - "Dec 6 13:18 -0600" (year assumed, time offset provided)
1428 1470 - "Dec 6 13:18 UTC" (UTC and GMT are aliases for +0000)
1429 1471 - "Dec 6" (midnight)
1430 1472 - "13:18" (today assumed)
1431 1473 - "3:39" (3:39AM assumed)
1432 1474 - "3:39pm" (15:39)
1433 1475 - "2006-12-06 13:18:29" (ISO 8601 format)
1434 1476 - "2006-12-6 13:18"
1435 1477 - "2006-12-6"
1436 1478 - "12-6"
1437 1479 - "12/6"
1438 1480 - "12/6/6" (Dec 6 2006)
1439 1481 - "today" (midnight)
1440 1482 - "yesterday" (midnight)
1441 1483 - "now" - right now
1442 1484
1443 1485 Lastly, there is Mercurial's internal format:
1444 1486
1445 1487 - "1165411109 0" (Wed Dec 6 13:18:29 2006 UTC)
1446 1488
1447 1489 This is the internal representation format for dates. The first number is
1448 1490 the number of seconds since the epoch (1970-01-01 00:00 UTC). The second
1449 1491 is the offset of the local timezone, in seconds west of UTC (negative if
1450 1492 the timezone is east of UTC).
1451 1493
1452 1494 The log command also accepts date ranges:
1453 1495
1454 1496 - "<DATE" - at or before a given date/time
1455 1497 - ">DATE" - on or after a given date/time
1456 1498 - "DATE to DATE" - a date range, inclusive
1457 1499 - "-DAYS" - within a given number of days of today
1458 1500
1459 1501 Test repeated config section name
1460 1502
1461 1503 $ hg help config.host
1462 1504 "http_proxy.host"
1463 1505 Host name and (optional) port of the proxy server, for example
1464 1506 "myproxy:8000".
1465 1507
1466 1508 "smtp.host"
1467 1509 Host name of mail server, e.g. "mail.example.com".
1468 1510
1469 1511
1470 1512 Test section name with dot
1471 1513
1472 1514 $ hg help config.ui.username
1473 1515 "ui.username"
1474 1516 The committer of a changeset created when running "commit". Typically
1475 1517 a person's name and email address, e.g. "Fred Widget
1476 1518 <fred@example.com>". Environment variables in the username are
1477 1519 expanded.
1478 1520
1479 1521 (default: "$EMAIL" or "username@hostname". If the username in hgrc is
1480 1522 empty, e.g. if the system admin set "username =" in the system hgrc,
1481 1523 it has to be specified manually or in a different hgrc file)
1482 1524
1483 1525
1484 1526 $ hg help config.annotate.git
1485 1527 abort: help section not found: config.annotate.git
1486 1528 [255]
1487 1529
1488 1530 $ hg help config.update.check
1489 1531 "commands.update.check"
1490 1532 Determines what level of checking 'hg update' will perform before
1491 1533 moving to a destination revision. Valid values are "abort", "none",
1492 1534 "linear", and "noconflict". "abort" always fails if the working
1493 1535 directory has uncommitted changes. "none" performs no checking, and
1494 1536 may result in a merge with uncommitted changes. "linear" allows any
1495 1537 update as long as it follows a straight line in the revision history,
1496 1538 and may trigger a merge with uncommitted changes. "noconflict" will
1497 1539 allow any update which would not trigger a merge with uncommitted
1498 1540 changes, if any are present. (default: "linear")
1499 1541
1500 1542
1501 1543 $ hg help config.commands.update.check
1502 1544 "commands.update.check"
1503 1545 Determines what level of checking 'hg update' will perform before
1504 1546 moving to a destination revision. Valid values are "abort", "none",
1505 1547 "linear", and "noconflict". "abort" always fails if the working
1506 1548 directory has uncommitted changes. "none" performs no checking, and
1507 1549 may result in a merge with uncommitted changes. "linear" allows any
1508 1550 update as long as it follows a straight line in the revision history,
1509 1551 and may trigger a merge with uncommitted changes. "noconflict" will
1510 1552 allow any update which would not trigger a merge with uncommitted
1511 1553 changes, if any are present. (default: "linear")
1512 1554
1513 1555
1514 1556 $ hg help config.ommands.update.check
1515 1557 abort: help section not found: config.ommands.update.check
1516 1558 [255]
1517 1559
1518 1560 Unrelated trailing paragraphs shouldn't be included
1519 1561
1520 1562 $ hg help config.extramsg | grep '^$'
1521 1563
1522 1564
1523 1565 Test capitalized section name
1524 1566
1525 1567 $ hg help scripting.HGPLAIN > /dev/null
1526 1568
1527 1569 Help subsection:
1528 1570
1529 1571 $ hg help config.charsets |grep "Email example:" > /dev/null
1530 1572 [1]
1531 1573
1532 1574 Show nested definitions
1533 1575 ("profiling.type"[break]"ls"[break]"stat"[break])
1534 1576
1535 1577 $ hg help config.type | egrep '^$'|wc -l
1536 1578 \s*3 (re)
1537 1579
1538 1580 $ hg help config.profiling.type.ls
1539 1581 "profiling.type.ls"
1540 1582 Use Python's built-in instrumenting profiler. This profiler works on
1541 1583 all platforms, but each line number it reports is the first line of
1542 1584 a function. This restriction makes it difficult to identify the
1543 1585 expensive parts of a non-trivial function.
1544 1586
1545 1587
1546 1588 Separate sections from subsections
1547 1589
1548 1590 $ hg help config.format | egrep '^ ("|-)|^\s*$' | uniq
1549 1591 "format"
1550 1592 --------
1551 1593
1552 1594 "usegeneraldelta"
1553 1595
1554 1596 "dotencode"
1555 1597
1556 1598 "usefncache"
1557 1599
1558 1600 "usestore"
1559 1601
1560 1602 "profiling"
1561 1603 -----------
1562 1604
1563 1605 "format"
1564 1606
1565 1607 "progress"
1566 1608 ----------
1567 1609
1568 1610 "format"
1569 1611
1570 1612
1571 1613 Last item in help config.*:
1572 1614
1573 1615 $ hg help config.`hg help config|grep '^ "'| \
1574 1616 > tail -1|sed 's![ "]*!!g'`| \
1575 1617 > grep 'hg help -c config' > /dev/null
1576 1618 [1]
1577 1619
1578 1620 note to use help -c for general hg help config:
1579 1621
1580 1622 $ hg help config |grep 'hg help -c config' > /dev/null
1581 1623
1582 1624 Test templating help
1583 1625
1584 1626 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
1585 1627 desc String. The text of the changeset description.
1586 1628 diffstat String. Statistics of changes with the following format:
1587 1629 firstline Any text. Returns the first line of text.
1588 1630 nonempty Any text. Returns '(none)' if the string is empty.
1589 1631
1590 1632 Test deprecated items
1591 1633
1592 1634 $ hg help -v templating | grep currentbookmark
1593 1635 currentbookmark
1594 1636 $ hg help templating | (grep currentbookmark || true)
1595 1637
1596 1638 Test help hooks
1597 1639
1598 1640 $ cat > helphook1.py <<EOF
1599 1641 > from mercurial import help
1600 1642 >
1601 1643 > def rewrite(ui, topic, doc):
1602 1644 > return doc + b'\nhelphook1\n'
1603 1645 >
1604 1646 > def extsetup(ui):
1605 1647 > help.addtopichook(b'revisions', rewrite)
1606 1648 > EOF
1607 1649 $ cat > helphook2.py <<EOF
1608 1650 > from mercurial import help
1609 1651 >
1610 1652 > def rewrite(ui, topic, doc):
1611 1653 > return doc + b'\nhelphook2\n'
1612 1654 >
1613 1655 > def extsetup(ui):
1614 1656 > help.addtopichook(b'revisions', rewrite)
1615 1657 > EOF
1616 1658 $ echo '[extensions]' >> $HGRCPATH
1617 1659 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
1618 1660 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
1619 1661 $ hg help revsets | grep helphook
1620 1662 helphook1
1621 1663 helphook2
1622 1664
1623 1665 help -c should only show debug --debug
1624 1666
1625 1667 $ hg help -c --debug|egrep debug|wc -l|egrep '^\s*0\s*$'
1626 1668 [1]
1627 1669
1628 1670 help -c should only show deprecated for -v
1629 1671
1630 1672 $ hg help -c -v|egrep DEPRECATED|wc -l|egrep '^\s*0\s*$'
1631 1673 [1]
1632 1674
1633 1675 Test -s / --system
1634 1676
1635 1677 $ hg help config.files -s windows |grep 'etc/mercurial' | \
1636 1678 > wc -l | sed -e 's/ //g'
1637 1679 0
1638 1680 $ hg help config.files --system unix | grep 'USER' | \
1639 1681 > wc -l | sed -e 's/ //g'
1640 1682 0
1641 1683
1642 1684 Test -e / -c / -k combinations
1643 1685
1644 1686 $ hg help -c|egrep '^[A-Z].*:|^ debug'
1645 1687 Commands:
1646 1688 $ hg help -e|egrep '^[A-Z].*:|^ debug'
1647 1689 Extensions:
1648 1690 $ hg help -k|egrep '^[A-Z].*:|^ debug'
1649 1691 Topics:
1650 1692 Commands:
1651 1693 Extensions:
1652 1694 Extension Commands:
1653 1695 $ hg help -c schemes
1654 1696 abort: no such help topic: schemes
1655 1697 (try 'hg help --keyword schemes')
1656 1698 [255]
1657 1699 $ hg help -e schemes |head -1
1658 1700 schemes extension - extend schemes with shortcuts to repository swarms
1659 1701 $ hg help -c -k dates |egrep '^(Topics|Extensions|Commands):'
1660 1702 Commands:
1661 1703 $ hg help -e -k a |egrep '^(Topics|Extensions|Commands):'
1662 1704 Extensions:
1663 1705 $ hg help -e -c -k date |egrep '^(Topics|Extensions|Commands):'
1664 1706 Extensions:
1665 1707 Commands:
1666 1708 $ hg help -c commit > /dev/null
1667 1709 $ hg help -e -c commit > /dev/null
1668 1710 $ hg help -e commit
1669 1711 abort: no such help topic: commit
1670 1712 (try 'hg help --keyword commit')
1671 1713 [255]
1672 1714
1673 1715 Test keyword search help
1674 1716
1675 1717 $ cat > prefixedname.py <<EOF
1676 1718 > '''matched against word "clone"
1677 1719 > '''
1678 1720 > EOF
1679 1721 $ echo '[extensions]' >> $HGRCPATH
1680 1722 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
1681 1723 $ hg help -k clone
1682 1724 Topics:
1683 1725
1684 1726 config Configuration Files
1685 1727 extensions Using Additional Features
1686 1728 glossary Glossary
1687 1729 phases Working with Phases
1688 1730 subrepos Subrepositories
1689 1731 urls URL Paths
1690 1732
1691 1733 Commands:
1692 1734
1693 1735 bookmarks create a new bookmark or list existing bookmarks
1694 1736 clone make a copy of an existing repository
1695 1737 paths show aliases for remote repositories
1696 1738 pull pull changes from the specified source
1697 1739 update update working directory (or switch revisions)
1698 1740
1699 1741 Extensions:
1700 1742
1701 1743 clonebundles advertise pre-generated bundles to seed clones
1702 1744 narrow create clones which fetch history data for subset of files
1703 1745 (EXPERIMENTAL)
1704 1746 prefixedname matched against word "clone"
1705 1747 relink recreates hardlinks between repository clones
1706 1748
1707 1749 Extension Commands:
1708 1750
1709 1751 qclone clone main and patch repository at same time
1710 1752
1711 1753 Test unfound topic
1712 1754
1713 1755 $ hg help nonexistingtopicthatwillneverexisteverever
1714 1756 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
1715 1757 (try 'hg help --keyword nonexistingtopicthatwillneverexisteverever')
1716 1758 [255]
1717 1759
1718 1760 Test unfound keyword
1719 1761
1720 1762 $ hg help --keyword nonexistingwordthatwillneverexisteverever
1721 1763 abort: no matches
1722 1764 (try 'hg help' for a list of topics)
1723 1765 [255]
1724 1766
1725 1767 Test omit indicating for help
1726 1768
1727 1769 $ cat > addverboseitems.py <<EOF
1728 1770 > '''extension to test omit indicating.
1729 1771 >
1730 1772 > This paragraph is never omitted (for extension)
1731 1773 >
1732 1774 > .. container:: verbose
1733 1775 >
1734 1776 > This paragraph is omitted,
1735 1777 > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension)
1736 1778 >
1737 1779 > This paragraph is never omitted, too (for extension)
1738 1780 > '''
1739 1781 > from __future__ import absolute_import
1740 1782 > from mercurial import commands, help
1741 1783 > testtopic = b"""This paragraph is never omitted (for topic).
1742 1784 >
1743 1785 > .. container:: verbose
1744 1786 >
1745 1787 > This paragraph is omitted,
1746 1788 > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic)
1747 1789 >
1748 1790 > This paragraph is never omitted, too (for topic)
1749 1791 > """
1750 1792 > def extsetup(ui):
1751 1793 > help.helptable.append(([b"topic-containing-verbose"],
1752 1794 > b"This is the topic to test omit indicating.",
1753 1795 > lambda ui: testtopic))
1754 1796 > EOF
1755 1797 $ echo '[extensions]' >> $HGRCPATH
1756 1798 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1757 1799 $ hg help addverboseitems
1758 1800 addverboseitems extension - extension to test omit indicating.
1759 1801
1760 1802 This paragraph is never omitted (for extension)
1761 1803
1762 1804 This paragraph is never omitted, too (for extension)
1763 1805
1764 1806 (some details hidden, use --verbose to show complete help)
1765 1807
1766 1808 no commands defined
1767 1809 $ hg help -v addverboseitems
1768 1810 addverboseitems extension - extension to test omit indicating.
1769 1811
1770 1812 This paragraph is never omitted (for extension)
1771 1813
1772 1814 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1773 1815 extension)
1774 1816
1775 1817 This paragraph is never omitted, too (for extension)
1776 1818
1777 1819 no commands defined
1778 1820 $ hg help topic-containing-verbose
1779 1821 This is the topic to test omit indicating.
1780 1822 """"""""""""""""""""""""""""""""""""""""""
1781 1823
1782 1824 This paragraph is never omitted (for topic).
1783 1825
1784 1826 This paragraph is never omitted, too (for topic)
1785 1827
1786 1828 (some details hidden, use --verbose to show complete help)
1787 1829 $ hg help -v topic-containing-verbose
1788 1830 This is the topic to test omit indicating.
1789 1831 """"""""""""""""""""""""""""""""""""""""""
1790 1832
1791 1833 This paragraph is never omitted (for topic).
1792 1834
1793 1835 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1794 1836 topic)
1795 1837
1796 1838 This paragraph is never omitted, too (for topic)
1797 1839
1798 1840 Test section lookup
1799 1841
1800 1842 $ hg help revset.merge
1801 1843 "merge()"
1802 1844 Changeset is a merge changeset.
1803 1845
1804 1846 $ hg help glossary.dag
1805 1847 DAG
1806 1848 The repository of changesets of a distributed version control system
1807 1849 (DVCS) can be described as a directed acyclic graph (DAG), consisting
1808 1850 of nodes and edges, where nodes correspond to changesets and edges
1809 1851 imply a parent -> child relation. This graph can be visualized by
1810 1852 graphical tools such as 'hg log --graph'. In Mercurial, the DAG is
1811 1853 limited by the requirement for children to have at most two parents.
1812 1854
1813 1855
1814 1856 $ hg help hgrc.paths
1815 1857 "paths"
1816 1858 -------
1817 1859
1818 1860 Assigns symbolic names and behavior to repositories.
1819 1861
1820 1862 Options are symbolic names defining the URL or directory that is the
1821 1863 location of the repository. Example:
1822 1864
1823 1865 [paths]
1824 1866 my_server = https://example.com/my_repo
1825 1867 local_path = /home/me/repo
1826 1868
1827 1869 These symbolic names can be used from the command line. To pull from
1828 1870 "my_server": 'hg pull my_server'. To push to "local_path": 'hg push
1829 1871 local_path'.
1830 1872
1831 1873 Options containing colons (":") denote sub-options that can influence
1832 1874 behavior for that specific path. Example:
1833 1875
1834 1876 [paths]
1835 1877 my_server = https://example.com/my_path
1836 1878 my_server:pushurl = ssh://example.com/my_path
1837 1879
1838 1880 The following sub-options can be defined:
1839 1881
1840 1882 "pushurl"
1841 1883 The URL to use for push operations. If not defined, the location
1842 1884 defined by the path's main entry is used.
1843 1885
1844 1886 "pushrev"
1845 1887 A revset defining which revisions to push by default.
1846 1888
1847 1889 When 'hg push' is executed without a "-r" argument, the revset defined
1848 1890 by this sub-option is evaluated to determine what to push.
1849 1891
1850 1892 For example, a value of "." will push the working directory's revision
1851 1893 by default.
1852 1894
1853 1895 Revsets specifying bookmarks will not result in the bookmark being
1854 1896 pushed.
1855 1897
1856 1898 The following special named paths exist:
1857 1899
1858 1900 "default"
1859 1901 The URL or directory to use when no source or remote is specified.
1860 1902
1861 1903 'hg clone' will automatically define this path to the location the
1862 1904 repository was cloned from.
1863 1905
1864 1906 "default-push"
1865 1907 (deprecated) The URL or directory for the default 'hg push' location.
1866 1908 "default:pushurl" should be used instead.
1867 1909
1868 1910 $ hg help glossary.mcguffin
1869 1911 abort: help section not found: glossary.mcguffin
1870 1912 [255]
1871 1913
1872 1914 $ hg help glossary.mc.guffin
1873 1915 abort: help section not found: glossary.mc.guffin
1874 1916 [255]
1875 1917
1876 1918 $ hg help template.files
1877 1919 files List of strings. All files modified, added, or removed by
1878 1920 this changeset.
1879 1921 files(pattern)
1880 1922 All files of the current changeset matching the pattern. See
1881 1923 'hg help patterns'.
1882 1924
1883 1925 Test section lookup by translated message
1884 1926
1885 1927 str.lower() instead of encoding.lower(str) on translated message might
1886 1928 make message meaningless, because some encoding uses 0x41(A) - 0x5a(Z)
1887 1929 as the second or later byte of multi-byte character.
1888 1930
1889 1931 For example, "\x8bL\x98^" (translation of "record" in ja_JP.cp932)
1890 1932 contains 0x4c (L). str.lower() replaces 0x4c(L) by 0x6c(l) and this
1891 1933 replacement makes message meaningless.
1892 1934
1893 1935 This tests that section lookup by translated string isn't broken by
1894 1936 such str.lower().
1895 1937
1896 1938 $ "$PYTHON" <<EOF
1897 1939 > def escape(s):
1898 1940 > return b''.join(b'\\u%x' % ord(uc) for uc in s.decode('cp932'))
1899 1941 > # translation of "record" in ja_JP.cp932
1900 1942 > upper = b"\x8bL\x98^"
1901 1943 > # str.lower()-ed section name should be treated as different one
1902 1944 > lower = b"\x8bl\x98^"
1903 1945 > with open('ambiguous.py', 'wb') as fp:
1904 1946 > fp.write(b"""# ambiguous section names in ja_JP.cp932
1905 1947 > u'''summary of extension
1906 1948 >
1907 1949 > %s
1908 1950 > ----
1909 1951 >
1910 1952 > Upper name should show only this message
1911 1953 >
1912 1954 > %s
1913 1955 > ----
1914 1956 >
1915 1957 > Lower name should show only this message
1916 1958 >
1917 1959 > subsequent section
1918 1960 > ------------------
1919 1961 >
1920 1962 > This should be hidden at 'hg help ambiguous' with section name.
1921 1963 > '''
1922 1964 > """ % (escape(upper), escape(lower)))
1923 1965 > EOF
1924 1966
1925 1967 $ cat >> $HGRCPATH <<EOF
1926 1968 > [extensions]
1927 1969 > ambiguous = ./ambiguous.py
1928 1970 > EOF
1929 1971
1930 1972 $ "$PYTHON" <<EOF | sh
1931 1973 > from mercurial import pycompat
1932 1974 > upper = b"\x8bL\x98^"
1933 1975 > pycompat.stdout.write(b"hg --encoding cp932 help -e ambiguous.%s\n" % upper)
1934 1976 > EOF
1935 1977 \x8bL\x98^ (esc)
1936 1978 ----
1937 1979
1938 1980 Upper name should show only this message
1939 1981
1940 1982
1941 1983 $ "$PYTHON" <<EOF | sh
1942 1984 > from mercurial import pycompat
1943 1985 > lower = b"\x8bl\x98^"
1944 1986 > pycompat.stdout.write(b"hg --encoding cp932 help -e ambiguous.%s\n" % lower)
1945 1987 > EOF
1946 1988 \x8bl\x98^ (esc)
1947 1989 ----
1948 1990
1949 1991 Lower name should show only this message
1950 1992
1951 1993
1952 1994 $ cat >> $HGRCPATH <<EOF
1953 1995 > [extensions]
1954 1996 > ambiguous = !
1955 1997 > EOF
1956 1998
1957 1999 Show help content of disabled extensions
1958 2000
1959 2001 $ cat >> $HGRCPATH <<EOF
1960 2002 > [extensions]
1961 2003 > ambiguous = !./ambiguous.py
1962 2004 > EOF
1963 2005 $ hg help -e ambiguous
1964 2006 ambiguous extension - (no help text available)
1965 2007
1966 2008 (use 'hg help extensions' for information on enabling extensions)
1967 2009
1968 2010 Test dynamic list of merge tools only shows up once
1969 2011 $ hg help merge-tools
1970 2012 Merge Tools
1971 2013 """""""""""
1972 2014
1973 2015 To merge files Mercurial uses merge tools.
1974 2016
1975 2017 A merge tool combines two different versions of a file into a merged file.
1976 2018 Merge tools are given the two files and the greatest common ancestor of
1977 2019 the two file versions, so they can determine the changes made on both
1978 2020 branches.
1979 2021
1980 2022 Merge tools are used both for 'hg resolve', 'hg merge', 'hg update', 'hg
1981 2023 backout' and in several extensions.
1982 2024
1983 2025 Usually, the merge tool tries to automatically reconcile the files by
1984 2026 combining all non-overlapping changes that occurred separately in the two
1985 2027 different evolutions of the same initial base file. Furthermore, some
1986 2028 interactive merge programs make it easier to manually resolve conflicting
1987 2029 merges, either in a graphical way, or by inserting some conflict markers.
1988 2030 Mercurial does not include any interactive merge programs but relies on
1989 2031 external tools for that.
1990 2032
1991 2033 Available merge tools
1992 2034 =====================
1993 2035
1994 2036 External merge tools and their properties are configured in the merge-
1995 2037 tools configuration section - see hgrc(5) - but they can often just be
1996 2038 named by their executable.
1997 2039
1998 2040 A merge tool is generally usable if its executable can be found on the
1999 2041 system and if it can handle the merge. The executable is found if it is an
2000 2042 absolute or relative executable path or the name of an application in the
2001 2043 executable search path. The tool is assumed to be able to handle the merge
2002 2044 if it can handle symlinks if the file is a symlink, if it can handle
2003 2045 binary files if the file is binary, and if a GUI is available if the tool
2004 2046 requires a GUI.
2005 2047
2006 2048 There are some internal merge tools which can be used. The internal merge
2007 2049 tools are:
2008 2050
2009 2051 ":dump"
2010 2052 Creates three versions of the files to merge, containing the contents of
2011 2053 local, other and base. These files can then be used to perform a merge
2012 2054 manually. If the file to be merged is named "a.txt", these files will
2013 2055 accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and
2014 2056 they will be placed in the same directory as "a.txt".
2015 2057
2016 2058 This implies premerge. Therefore, files aren't dumped, if premerge runs
2017 2059 successfully. Use :forcedump to forcibly write files out.
2018 2060
2019 2061 (actual capabilities: binary, symlink)
2020 2062
2021 2063 ":fail"
2022 2064 Rather than attempting to merge files that were modified on both
2023 2065 branches, it marks them as unresolved. The resolve command must be used
2024 2066 to resolve these conflicts.
2025 2067
2026 2068 (actual capabilities: binary, symlink)
2027 2069
2028 2070 ":forcedump"
2029 2071 Creates three versions of the files as same as :dump, but omits
2030 2072 premerge.
2031 2073
2032 2074 (actual capabilities: binary, symlink)
2033 2075
2034 2076 ":local"
2035 2077 Uses the local 'p1()' version of files as the merged version.
2036 2078
2037 2079 (actual capabilities: binary, symlink)
2038 2080
2039 2081 ":merge"
2040 2082 Uses the internal non-interactive simple merge algorithm for merging
2041 2083 files. It will fail if there are any conflicts and leave markers in the
2042 2084 partially merged file. Markers will have two sections, one for each side
2043 2085 of merge.
2044 2086
2045 2087 ":merge-local"
2046 2088 Like :merge, but resolve all conflicts non-interactively in favor of the
2047 2089 local 'p1()' changes.
2048 2090
2049 2091 ":merge-other"
2050 2092 Like :merge, but resolve all conflicts non-interactively in favor of the
2051 2093 other 'p2()' changes.
2052 2094
2053 2095 ":merge3"
2054 2096 Uses the internal non-interactive simple merge algorithm for merging
2055 2097 files. It will fail if there are any conflicts and leave markers in the
2056 2098 partially merged file. Marker will have three sections, one from each
2057 2099 side of the merge and one for the base content.
2058 2100
2059 2101 ":other"
2060 2102 Uses the other 'p2()' version of files as the merged version.
2061 2103
2062 2104 (actual capabilities: binary, symlink)
2063 2105
2064 2106 ":prompt"
2065 2107 Asks the user which of the local 'p1()' or the other 'p2()' version to
2066 2108 keep as the merged version.
2067 2109
2068 2110 (actual capabilities: binary, symlink)
2069 2111
2070 2112 ":tagmerge"
2071 2113 Uses the internal tag merge algorithm (experimental).
2072 2114
2073 2115 ":union"
2074 2116 Uses the internal non-interactive simple merge algorithm for merging
2075 2117 files. It will use both left and right sides for conflict regions. No
2076 2118 markers are inserted.
2077 2119
2078 2120 Internal tools are always available and do not require a GUI but will by
2079 2121 default not handle symlinks or binary files. See next section for detail
2080 2122 about "actual capabilities" described above.
2081 2123
2082 2124 Choosing a merge tool
2083 2125 =====================
2084 2126
2085 2127 Mercurial uses these rules when deciding which merge tool to use:
2086 2128
2087 2129 1. If a tool has been specified with the --tool option to merge or
2088 2130 resolve, it is used. If it is the name of a tool in the merge-tools
2089 2131 configuration, its configuration is used. Otherwise the specified tool
2090 2132 must be executable by the shell.
2091 2133 2. If the "HGMERGE" environment variable is present, its value is used and
2092 2134 must be executable by the shell.
2093 2135 3. If the filename of the file to be merged matches any of the patterns in
2094 2136 the merge-patterns configuration section, the first usable merge tool
2095 2137 corresponding to a matching pattern is used.
2096 2138 4. If ui.merge is set it will be considered next. If the value is not the
2097 2139 name of a configured tool, the specified value is used and must be
2098 2140 executable by the shell. Otherwise the named tool is used if it is
2099 2141 usable.
2100 2142 5. If any usable merge tools are present in the merge-tools configuration
2101 2143 section, the one with the highest priority is used.
2102 2144 6. If a program named "hgmerge" can be found on the system, it is used -
2103 2145 but it will by default not be used for symlinks and binary files.
2104 2146 7. If the file to be merged is not binary and is not a symlink, then
2105 2147 internal ":merge" is used.
2106 2148 8. Otherwise, ":prompt" is used.
2107 2149
2108 2150 For historical reason, Mercurial treats merge tools as below while
2109 2151 examining rules above.
2110 2152
2111 2153 step specified via binary symlink
2112 2154 ----------------------------------
2113 2155 1. --tool o/o o/o
2114 2156 2. HGMERGE o/o o/o
2115 2157 3. merge-patterns o/o(*) x/?(*)
2116 2158 4. ui.merge x/?(*) x/?(*)
2117 2159
2118 2160 Each capability column indicates Mercurial behavior for internal/external
2119 2161 merge tools at examining each rule.
2120 2162
2121 2163 - "o": "assume that a tool has capability"
2122 2164 - "x": "assume that a tool does not have capability"
2123 2165 - "?": "check actual capability of a tool"
2124 2166
2125 2167 If "merge.strict-capability-check" configuration is true, Mercurial checks
2126 2168 capabilities of merge tools strictly in (*) cases above (= each capability
2127 2169 column becomes "?/?"). It is false by default for backward compatibility.
2128 2170
2129 2171 Note:
2130 2172 After selecting a merge program, Mercurial will by default attempt to
2131 2173 merge the files using a simple merge algorithm first. Only if it
2132 2174 doesn't succeed because of conflicting changes will Mercurial actually
2133 2175 execute the merge program. Whether to use the simple merge algorithm
2134 2176 first can be controlled by the premerge setting of the merge tool.
2135 2177 Premerge is enabled by default unless the file is binary or a symlink.
2136 2178
2137 2179 See the merge-tools and ui sections of hgrc(5) for details on the
2138 2180 configuration of merge tools.
2139 2181
2140 2182 Compression engines listed in `hg help bundlespec`
2141 2183
2142 2184 $ hg help bundlespec | grep gzip
2143 2185 "v1" bundles can only use the "gzip", "bzip2", and "none" compression
2144 2186 An algorithm that produces smaller bundles than "gzip".
2145 2187 This engine will likely produce smaller bundles than "gzip" but will be
2146 2188 "gzip"
2147 2189 better compression than "gzip". It also frequently yields better (?)
2148 2190
2149 2191 Test usage of section marks in help documents
2150 2192
2151 2193 $ cd "$TESTDIR"/../doc
2152 2194 $ "$PYTHON" check-seclevel.py
2153 2195 $ cd $TESTTMP
2154 2196
2155 2197 #if serve
2156 2198
2157 2199 Test the help pages in hgweb.
2158 2200
2159 2201 Dish up an empty repo; serve it cold.
2160 2202
2161 2203 $ hg init "$TESTTMP/test"
2162 2204 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
2163 2205 $ cat hg.pid >> $DAEMON_PIDS
2164 2206
2165 2207 $ get-with-headers.py $LOCALIP:$HGPORT "help"
2166 2208 200 Script output follows
2167 2209
2168 2210 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2169 2211 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2170 2212 <head>
2171 2213 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2172 2214 <meta name="robots" content="index, nofollow" />
2173 2215 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2174 2216 <script type="text/javascript" src="/static/mercurial.js"></script>
2175 2217
2176 2218 <title>Help: Index</title>
2177 2219 </head>
2178 2220 <body>
2179 2221
2180 2222 <div class="container">
2181 2223 <div class="menu">
2182 2224 <div class="logo">
2183 2225 <a href="https://mercurial-scm.org/">
2184 2226 <img src="/static/hglogo.png" alt="mercurial" /></a>
2185 2227 </div>
2186 2228 <ul>
2187 2229 <li><a href="/shortlog">log</a></li>
2188 2230 <li><a href="/graph">graph</a></li>
2189 2231 <li><a href="/tags">tags</a></li>
2190 2232 <li><a href="/bookmarks">bookmarks</a></li>
2191 2233 <li><a href="/branches">branches</a></li>
2192 2234 </ul>
2193 2235 <ul>
2194 2236 <li class="active">help</li>
2195 2237 </ul>
2196 2238 </div>
2197 2239
2198 2240 <div class="main">
2199 2241 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2200 2242
2201 2243 <form class="search" action="/log">
2202 2244
2203 2245 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2204 2246 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2205 2247 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2206 2248 </form>
2207 2249 <table class="bigtable">
2208 2250 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
2209 2251
2210 2252 <tr><td>
2211 2253 <a href="/help/bundlespec">
2212 2254 bundlespec
2213 2255 </a>
2214 2256 </td><td>
2215 2257 Bundle File Formats
2216 2258 </td></tr>
2217 2259 <tr><td>
2218 2260 <a href="/help/color">
2219 2261 color
2220 2262 </a>
2221 2263 </td><td>
2222 2264 Colorizing Outputs
2223 2265 </td></tr>
2224 2266 <tr><td>
2225 2267 <a href="/help/config">
2226 2268 config
2227 2269 </a>
2228 2270 </td><td>
2229 2271 Configuration Files
2230 2272 </td></tr>
2231 2273 <tr><td>
2232 2274 <a href="/help/dates">
2233 2275 dates
2234 2276 </a>
2235 2277 </td><td>
2236 2278 Date Formats
2237 2279 </td></tr>
2238 2280 <tr><td>
2239 2281 <a href="/help/deprecated">
2240 2282 deprecated
2241 2283 </a>
2242 2284 </td><td>
2243 2285 Deprecated Features
2244 2286 </td></tr>
2245 2287 <tr><td>
2246 2288 <a href="/help/diffs">
2247 2289 diffs
2248 2290 </a>
2249 2291 </td><td>
2250 2292 Diff Formats
2251 2293 </td></tr>
2252 2294 <tr><td>
2253 2295 <a href="/help/environment">
2254 2296 environment
2255 2297 </a>
2256 2298 </td><td>
2257 2299 Environment Variables
2258 2300 </td></tr>
2259 2301 <tr><td>
2260 2302 <a href="/help/extensions">
2261 2303 extensions
2262 2304 </a>
2263 2305 </td><td>
2264 2306 Using Additional Features
2265 2307 </td></tr>
2266 2308 <tr><td>
2267 2309 <a href="/help/filesets">
2268 2310 filesets
2269 2311 </a>
2270 2312 </td><td>
2271 2313 Specifying File Sets
2272 2314 </td></tr>
2273 2315 <tr><td>
2274 2316 <a href="/help/flags">
2275 2317 flags
2276 2318 </a>
2277 2319 </td><td>
2278 2320 Command-line flags
2279 2321 </td></tr>
2280 2322 <tr><td>
2281 2323 <a href="/help/glossary">
2282 2324 glossary
2283 2325 </a>
2284 2326 </td><td>
2285 2327 Glossary
2286 2328 </td></tr>
2287 2329 <tr><td>
2288 2330 <a href="/help/hgignore">
2289 2331 hgignore
2290 2332 </a>
2291 2333 </td><td>
2292 2334 Syntax for Mercurial Ignore Files
2293 2335 </td></tr>
2294 2336 <tr><td>
2295 2337 <a href="/help/hgweb">
2296 2338 hgweb
2297 2339 </a>
2298 2340 </td><td>
2299 2341 Configuring hgweb
2300 2342 </td></tr>
2301 2343 <tr><td>
2302 2344 <a href="/help/internals">
2303 2345 internals
2304 2346 </a>
2305 2347 </td><td>
2306 2348 Technical implementation topics
2307 2349 </td></tr>
2308 2350 <tr><td>
2309 2351 <a href="/help/merge-tools">
2310 2352 merge-tools
2311 2353 </a>
2312 2354 </td><td>
2313 2355 Merge Tools
2314 2356 </td></tr>
2315 2357 <tr><td>
2316 2358 <a href="/help/pager">
2317 2359 pager
2318 2360 </a>
2319 2361 </td><td>
2320 2362 Pager Support
2321 2363 </td></tr>
2322 2364 <tr><td>
2323 2365 <a href="/help/patterns">
2324 2366 patterns
2325 2367 </a>
2326 2368 </td><td>
2327 2369 File Name Patterns
2328 2370 </td></tr>
2329 2371 <tr><td>
2330 2372 <a href="/help/phases">
2331 2373 phases
2332 2374 </a>
2333 2375 </td><td>
2334 2376 Working with Phases
2335 2377 </td></tr>
2336 2378 <tr><td>
2337 2379 <a href="/help/revisions">
2338 2380 revisions
2339 2381 </a>
2340 2382 </td><td>
2341 2383 Specifying Revisions
2342 2384 </td></tr>
2343 2385 <tr><td>
2344 2386 <a href="/help/scripting">
2345 2387 scripting
2346 2388 </a>
2347 2389 </td><td>
2348 2390 Using Mercurial from scripts and automation
2349 2391 </td></tr>
2350 2392 <tr><td>
2351 2393 <a href="/help/subrepos">
2352 2394 subrepos
2353 2395 </a>
2354 2396 </td><td>
2355 2397 Subrepositories
2356 2398 </td></tr>
2357 2399 <tr><td>
2358 2400 <a href="/help/templating">
2359 2401 templating
2360 2402 </a>
2361 2403 </td><td>
2362 2404 Template Usage
2363 2405 </td></tr>
2364 2406 <tr><td>
2365 2407 <a href="/help/urls">
2366 2408 urls
2367 2409 </a>
2368 2410 </td><td>
2369 2411 URL Paths
2370 2412 </td></tr>
2371 2413 <tr><td>
2372 2414 <a href="/help/topic-containing-verbose">
2373 2415 topic-containing-verbose
2374 2416 </a>
2375 2417 </td><td>
2376 2418 This is the topic to test omit indicating.
2377 2419 </td></tr>
2378 2420
2379 2421
2380 2422 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
2381 2423
2382 2424 <tr><td>
2383 2425 <a href="/help/add">
2384 2426 add
2385 2427 </a>
2386 2428 </td><td>
2387 2429 add the specified files on the next commit
2388 2430 </td></tr>
2389 2431 <tr><td>
2390 2432 <a href="/help/annotate">
2391 2433 annotate
2392 2434 </a>
2393 2435 </td><td>
2394 2436 show changeset information by line for each file
2395 2437 </td></tr>
2396 2438 <tr><td>
2397 2439 <a href="/help/clone">
2398 2440 clone
2399 2441 </a>
2400 2442 </td><td>
2401 2443 make a copy of an existing repository
2402 2444 </td></tr>
2403 2445 <tr><td>
2404 2446 <a href="/help/commit">
2405 2447 commit
2406 2448 </a>
2407 2449 </td><td>
2408 2450 commit the specified files or all outstanding changes
2409 2451 </td></tr>
2410 2452 <tr><td>
2411 2453 <a href="/help/diff">
2412 2454 diff
2413 2455 </a>
2414 2456 </td><td>
2415 2457 diff repository (or selected files)
2416 2458 </td></tr>
2417 2459 <tr><td>
2418 2460 <a href="/help/export">
2419 2461 export
2420 2462 </a>
2421 2463 </td><td>
2422 2464 dump the header and diffs for one or more changesets
2423 2465 </td></tr>
2424 2466 <tr><td>
2425 2467 <a href="/help/forget">
2426 2468 forget
2427 2469 </a>
2428 2470 </td><td>
2429 2471 forget the specified files on the next commit
2430 2472 </td></tr>
2431 2473 <tr><td>
2432 2474 <a href="/help/init">
2433 2475 init
2434 2476 </a>
2435 2477 </td><td>
2436 2478 create a new repository in the given directory
2437 2479 </td></tr>
2438 2480 <tr><td>
2439 2481 <a href="/help/log">
2440 2482 log
2441 2483 </a>
2442 2484 </td><td>
2443 2485 show revision history of entire repository or files
2444 2486 </td></tr>
2445 2487 <tr><td>
2446 2488 <a href="/help/merge">
2447 2489 merge
2448 2490 </a>
2449 2491 </td><td>
2450 2492 merge another revision into working directory
2451 2493 </td></tr>
2452 2494 <tr><td>
2453 2495 <a href="/help/pull">
2454 2496 pull
2455 2497 </a>
2456 2498 </td><td>
2457 2499 pull changes from the specified source
2458 2500 </td></tr>
2459 2501 <tr><td>
2460 2502 <a href="/help/push">
2461 2503 push
2462 2504 </a>
2463 2505 </td><td>
2464 2506 push changes to the specified destination
2465 2507 </td></tr>
2466 2508 <tr><td>
2467 2509 <a href="/help/remove">
2468 2510 remove
2469 2511 </a>
2470 2512 </td><td>
2471 2513 remove the specified files on the next commit
2472 2514 </td></tr>
2473 2515 <tr><td>
2474 2516 <a href="/help/serve">
2475 2517 serve
2476 2518 </a>
2477 2519 </td><td>
2478 2520 start stand-alone webserver
2479 2521 </td></tr>
2480 2522 <tr><td>
2481 2523 <a href="/help/status">
2482 2524 status
2483 2525 </a>
2484 2526 </td><td>
2485 2527 show changed files in the working directory
2486 2528 </td></tr>
2487 2529 <tr><td>
2488 2530 <a href="/help/summary">
2489 2531 summary
2490 2532 </a>
2491 2533 </td><td>
2492 2534 summarize working directory state
2493 2535 </td></tr>
2494 2536 <tr><td>
2495 2537 <a href="/help/update">
2496 2538 update
2497 2539 </a>
2498 2540 </td><td>
2499 2541 update working directory (or switch revisions)
2500 2542 </td></tr>
2501 2543
2502 2544
2503 2545
2504 2546 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
2505 2547
2506 2548 <tr><td>
2507 2549 <a href="/help/addremove">
2508 2550 addremove
2509 2551 </a>
2510 2552 </td><td>
2511 2553 add all new files, delete all missing files
2512 2554 </td></tr>
2513 2555 <tr><td>
2514 2556 <a href="/help/archive">
2515 2557 archive
2516 2558 </a>
2517 2559 </td><td>
2518 2560 create an unversioned archive of a repository revision
2519 2561 </td></tr>
2520 2562 <tr><td>
2521 2563 <a href="/help/backout">
2522 2564 backout
2523 2565 </a>
2524 2566 </td><td>
2525 2567 reverse effect of earlier changeset
2526 2568 </td></tr>
2527 2569 <tr><td>
2528 2570 <a href="/help/bisect">
2529 2571 bisect
2530 2572 </a>
2531 2573 </td><td>
2532 2574 subdivision search of changesets
2533 2575 </td></tr>
2534 2576 <tr><td>
2535 2577 <a href="/help/bookmarks">
2536 2578 bookmarks
2537 2579 </a>
2538 2580 </td><td>
2539 2581 create a new bookmark or list existing bookmarks
2540 2582 </td></tr>
2541 2583 <tr><td>
2542 2584 <a href="/help/branch">
2543 2585 branch
2544 2586 </a>
2545 2587 </td><td>
2546 2588 set or show the current branch name
2547 2589 </td></tr>
2548 2590 <tr><td>
2549 2591 <a href="/help/branches">
2550 2592 branches
2551 2593 </a>
2552 2594 </td><td>
2553 2595 list repository named branches
2554 2596 </td></tr>
2555 2597 <tr><td>
2556 2598 <a href="/help/bundle">
2557 2599 bundle
2558 2600 </a>
2559 2601 </td><td>
2560 2602 create a bundle file
2561 2603 </td></tr>
2562 2604 <tr><td>
2563 2605 <a href="/help/cat">
2564 2606 cat
2565 2607 </a>
2566 2608 </td><td>
2567 2609 output the current or given revision of files
2568 2610 </td></tr>
2569 2611 <tr><td>
2570 2612 <a href="/help/config">
2571 2613 config
2572 2614 </a>
2573 2615 </td><td>
2574 2616 show combined config settings from all hgrc files
2575 2617 </td></tr>
2576 2618 <tr><td>
2577 2619 <a href="/help/copy">
2578 2620 copy
2579 2621 </a>
2580 2622 </td><td>
2581 2623 mark files as copied for the next commit
2582 2624 </td></tr>
2583 2625 <tr><td>
2584 2626 <a href="/help/files">
2585 2627 files
2586 2628 </a>
2587 2629 </td><td>
2588 2630 list tracked files
2589 2631 </td></tr>
2590 2632 <tr><td>
2591 2633 <a href="/help/graft">
2592 2634 graft
2593 2635 </a>
2594 2636 </td><td>
2595 2637 copy changes from other branches onto the current branch
2596 2638 </td></tr>
2597 2639 <tr><td>
2598 2640 <a href="/help/grep">
2599 2641 grep
2600 2642 </a>
2601 2643 </td><td>
2602 2644 search revision history for a pattern in specified files
2603 2645 </td></tr>
2604 2646 <tr><td>
2605 2647 <a href="/help/heads">
2606 2648 heads
2607 2649 </a>
2608 2650 </td><td>
2609 2651 show branch heads
2610 2652 </td></tr>
2611 2653 <tr><td>
2612 2654 <a href="/help/help">
2613 2655 help
2614 2656 </a>
2615 2657 </td><td>
2616 2658 show help for a given topic or a help overview
2617 2659 </td></tr>
2618 2660 <tr><td>
2619 2661 <a href="/help/hgalias">
2620 2662 hgalias
2621 2663 </a>
2622 2664 </td><td>
2623 2665 summarize working directory state
2624 2666 </td></tr>
2625 2667 <tr><td>
2626 2668 <a href="/help/identify">
2627 2669 identify
2628 2670 </a>
2629 2671 </td><td>
2630 2672 identify the working directory or specified revision
2631 2673 </td></tr>
2632 2674 <tr><td>
2633 2675 <a href="/help/import">
2634 2676 import
2635 2677 </a>
2636 2678 </td><td>
2637 2679 import an ordered set of patches
2638 2680 </td></tr>
2639 2681 <tr><td>
2640 2682 <a href="/help/incoming">
2641 2683 incoming
2642 2684 </a>
2643 2685 </td><td>
2644 2686 show new changesets found in source
2645 2687 </td></tr>
2646 2688 <tr><td>
2647 2689 <a href="/help/manifest">
2648 2690 manifest
2649 2691 </a>
2650 2692 </td><td>
2651 2693 output the current or given revision of the project manifest
2652 2694 </td></tr>
2653 2695 <tr><td>
2654 2696 <a href="/help/nohelp">
2655 2697 nohelp
2656 2698 </a>
2657 2699 </td><td>
2658 2700 (no help text available)
2659 2701 </td></tr>
2660 2702 <tr><td>
2661 2703 <a href="/help/outgoing">
2662 2704 outgoing
2663 2705 </a>
2664 2706 </td><td>
2665 2707 show changesets not found in the destination
2666 2708 </td></tr>
2667 2709 <tr><td>
2668 2710 <a href="/help/paths">
2669 2711 paths
2670 2712 </a>
2671 2713 </td><td>
2672 2714 show aliases for remote repositories
2673 2715 </td></tr>
2674 2716 <tr><td>
2675 2717 <a href="/help/phase">
2676 2718 phase
2677 2719 </a>
2678 2720 </td><td>
2679 2721 set or show the current phase name
2680 2722 </td></tr>
2681 2723 <tr><td>
2682 2724 <a href="/help/recover">
2683 2725 recover
2684 2726 </a>
2685 2727 </td><td>
2686 2728 roll back an interrupted transaction
2687 2729 </td></tr>
2688 2730 <tr><td>
2689 2731 <a href="/help/rename">
2690 2732 rename
2691 2733 </a>
2692 2734 </td><td>
2693 2735 rename files; equivalent of copy + remove
2694 2736 </td></tr>
2695 2737 <tr><td>
2696 2738 <a href="/help/resolve">
2697 2739 resolve
2698 2740 </a>
2699 2741 </td><td>
2700 2742 redo merges or set/view the merge status of files
2701 2743 </td></tr>
2702 2744 <tr><td>
2703 2745 <a href="/help/revert">
2704 2746 revert
2705 2747 </a>
2706 2748 </td><td>
2707 2749 restore files to their checkout state
2708 2750 </td></tr>
2709 2751 <tr><td>
2710 2752 <a href="/help/root">
2711 2753 root
2712 2754 </a>
2713 2755 </td><td>
2714 2756 print the root (top) of the current working directory
2715 2757 </td></tr>
2716 2758 <tr><td>
2717 2759 <a href="/help/shellalias">
2718 2760 shellalias
2719 2761 </a>
2720 2762 </td><td>
2721 2763 (no help text available)
2722 2764 </td></tr>
2723 2765 <tr><td>
2724 2766 <a href="/help/tag">
2725 2767 tag
2726 2768 </a>
2727 2769 </td><td>
2728 2770 add one or more tags for the current or given revision
2729 2771 </td></tr>
2730 2772 <tr><td>
2731 2773 <a href="/help/tags">
2732 2774 tags
2733 2775 </a>
2734 2776 </td><td>
2735 2777 list repository tags
2736 2778 </td></tr>
2737 2779 <tr><td>
2738 2780 <a href="/help/unbundle">
2739 2781 unbundle
2740 2782 </a>
2741 2783 </td><td>
2742 2784 apply one or more bundle files
2743 2785 </td></tr>
2744 2786 <tr><td>
2745 2787 <a href="/help/verify">
2746 2788 verify
2747 2789 </a>
2748 2790 </td><td>
2749 2791 verify the integrity of the repository
2750 2792 </td></tr>
2751 2793 <tr><td>
2752 2794 <a href="/help/version">
2753 2795 version
2754 2796 </a>
2755 2797 </td><td>
2756 2798 output version and copyright information
2757 2799 </td></tr>
2758 2800
2759 2801
2760 2802 </table>
2761 2803 </div>
2762 2804 </div>
2763 2805
2764 2806
2765 2807
2766 2808 </body>
2767 2809 </html>
2768 2810
2769 2811
2770 2812 $ get-with-headers.py $LOCALIP:$HGPORT "help/add"
2771 2813 200 Script output follows
2772 2814
2773 2815 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2774 2816 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2775 2817 <head>
2776 2818 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2777 2819 <meta name="robots" content="index, nofollow" />
2778 2820 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2779 2821 <script type="text/javascript" src="/static/mercurial.js"></script>
2780 2822
2781 2823 <title>Help: add</title>
2782 2824 </head>
2783 2825 <body>
2784 2826
2785 2827 <div class="container">
2786 2828 <div class="menu">
2787 2829 <div class="logo">
2788 2830 <a href="https://mercurial-scm.org/">
2789 2831 <img src="/static/hglogo.png" alt="mercurial" /></a>
2790 2832 </div>
2791 2833 <ul>
2792 2834 <li><a href="/shortlog">log</a></li>
2793 2835 <li><a href="/graph">graph</a></li>
2794 2836 <li><a href="/tags">tags</a></li>
2795 2837 <li><a href="/bookmarks">bookmarks</a></li>
2796 2838 <li><a href="/branches">branches</a></li>
2797 2839 </ul>
2798 2840 <ul>
2799 2841 <li class="active"><a href="/help">help</a></li>
2800 2842 </ul>
2801 2843 </div>
2802 2844
2803 2845 <div class="main">
2804 2846 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2805 2847 <h3>Help: add</h3>
2806 2848
2807 2849 <form class="search" action="/log">
2808 2850
2809 2851 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2810 2852 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2811 2853 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2812 2854 </form>
2813 2855 <div id="doc">
2814 2856 <p>
2815 2857 hg add [OPTION]... [FILE]...
2816 2858 </p>
2817 2859 <p>
2818 2860 add the specified files on the next commit
2819 2861 </p>
2820 2862 <p>
2821 2863 Schedule files to be version controlled and added to the
2822 2864 repository.
2823 2865 </p>
2824 2866 <p>
2825 2867 The files will be added to the repository at the next commit. To
2826 2868 undo an add before that, see 'hg forget'.
2827 2869 </p>
2828 2870 <p>
2829 2871 If no names are given, add all files to the repository (except
2830 2872 files matching &quot;.hgignore&quot;).
2831 2873 </p>
2832 2874 <p>
2833 2875 Examples:
2834 2876 </p>
2835 2877 <ul>
2836 2878 <li> New (unknown) files are added automatically by 'hg add':
2837 2879 <pre>
2838 2880 \$ ls (re)
2839 2881 foo.c
2840 2882 \$ hg status (re)
2841 2883 ? foo.c
2842 2884 \$ hg add (re)
2843 2885 adding foo.c
2844 2886 \$ hg status (re)
2845 2887 A foo.c
2846 2888 </pre>
2847 2889 <li> Specific files to be added can be specified:
2848 2890 <pre>
2849 2891 \$ ls (re)
2850 2892 bar.c foo.c
2851 2893 \$ hg status (re)
2852 2894 ? bar.c
2853 2895 ? foo.c
2854 2896 \$ hg add bar.c (re)
2855 2897 \$ hg status (re)
2856 2898 A bar.c
2857 2899 ? foo.c
2858 2900 </pre>
2859 2901 </ul>
2860 2902 <p>
2861 2903 Returns 0 if all files are successfully added.
2862 2904 </p>
2863 2905 <p>
2864 2906 options ([+] can be repeated):
2865 2907 </p>
2866 2908 <table>
2867 2909 <tr><td>-I</td>
2868 2910 <td>--include PATTERN [+]</td>
2869 2911 <td>include names matching the given patterns</td></tr>
2870 2912 <tr><td>-X</td>
2871 2913 <td>--exclude PATTERN [+]</td>
2872 2914 <td>exclude names matching the given patterns</td></tr>
2873 2915 <tr><td>-S</td>
2874 2916 <td>--subrepos</td>
2875 2917 <td>recurse into subrepositories</td></tr>
2876 2918 <tr><td>-n</td>
2877 2919 <td>--dry-run</td>
2878 2920 <td>do not perform actions, just print output</td></tr>
2879 2921 </table>
2880 2922 <p>
2881 2923 global options ([+] can be repeated):
2882 2924 </p>
2883 2925 <table>
2884 2926 <tr><td>-R</td>
2885 2927 <td>--repository REPO</td>
2886 2928 <td>repository root directory or name of overlay bundle file</td></tr>
2887 2929 <tr><td></td>
2888 2930 <td>--cwd DIR</td>
2889 2931 <td>change working directory</td></tr>
2890 2932 <tr><td>-y</td>
2891 2933 <td>--noninteractive</td>
2892 2934 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2893 2935 <tr><td>-q</td>
2894 2936 <td>--quiet</td>
2895 2937 <td>suppress output</td></tr>
2896 2938 <tr><td>-v</td>
2897 2939 <td>--verbose</td>
2898 2940 <td>enable additional output</td></tr>
2899 2941 <tr><td></td>
2900 2942 <td>--color TYPE</td>
2901 2943 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2902 2944 <tr><td></td>
2903 2945 <td>--config CONFIG [+]</td>
2904 2946 <td>set/override config option (use 'section.name=value')</td></tr>
2905 2947 <tr><td></td>
2906 2948 <td>--debug</td>
2907 2949 <td>enable debugging output</td></tr>
2908 2950 <tr><td></td>
2909 2951 <td>--debugger</td>
2910 2952 <td>start debugger</td></tr>
2911 2953 <tr><td></td>
2912 2954 <td>--encoding ENCODE</td>
2913 2955 <td>set the charset encoding (default: ascii)</td></tr>
2914 2956 <tr><td></td>
2915 2957 <td>--encodingmode MODE</td>
2916 2958 <td>set the charset encoding mode (default: strict)</td></tr>
2917 2959 <tr><td></td>
2918 2960 <td>--traceback</td>
2919 2961 <td>always print a traceback on exception</td></tr>
2920 2962 <tr><td></td>
2921 2963 <td>--time</td>
2922 2964 <td>time how long the command takes</td></tr>
2923 2965 <tr><td></td>
2924 2966 <td>--profile</td>
2925 2967 <td>print command execution profile</td></tr>
2926 2968 <tr><td></td>
2927 2969 <td>--version</td>
2928 2970 <td>output version information and exit</td></tr>
2929 2971 <tr><td>-h</td>
2930 2972 <td>--help</td>
2931 2973 <td>display help and exit</td></tr>
2932 2974 <tr><td></td>
2933 2975 <td>--hidden</td>
2934 2976 <td>consider hidden changesets</td></tr>
2935 2977 <tr><td></td>
2936 2978 <td>--pager TYPE</td>
2937 2979 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2938 2980 </table>
2939 2981
2940 2982 </div>
2941 2983 </div>
2942 2984 </div>
2943 2985
2944 2986
2945 2987
2946 2988 </body>
2947 2989 </html>
2948 2990
2949 2991
2950 2992 $ get-with-headers.py $LOCALIP:$HGPORT "help/remove"
2951 2993 200 Script output follows
2952 2994
2953 2995 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2954 2996 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2955 2997 <head>
2956 2998 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2957 2999 <meta name="robots" content="index, nofollow" />
2958 3000 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2959 3001 <script type="text/javascript" src="/static/mercurial.js"></script>
2960 3002
2961 3003 <title>Help: remove</title>
2962 3004 </head>
2963 3005 <body>
2964 3006
2965 3007 <div class="container">
2966 3008 <div class="menu">
2967 3009 <div class="logo">
2968 3010 <a href="https://mercurial-scm.org/">
2969 3011 <img src="/static/hglogo.png" alt="mercurial" /></a>
2970 3012 </div>
2971 3013 <ul>
2972 3014 <li><a href="/shortlog">log</a></li>
2973 3015 <li><a href="/graph">graph</a></li>
2974 3016 <li><a href="/tags">tags</a></li>
2975 3017 <li><a href="/bookmarks">bookmarks</a></li>
2976 3018 <li><a href="/branches">branches</a></li>
2977 3019 </ul>
2978 3020 <ul>
2979 3021 <li class="active"><a href="/help">help</a></li>
2980 3022 </ul>
2981 3023 </div>
2982 3024
2983 3025 <div class="main">
2984 3026 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2985 3027 <h3>Help: remove</h3>
2986 3028
2987 3029 <form class="search" action="/log">
2988 3030
2989 3031 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2990 3032 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2991 3033 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2992 3034 </form>
2993 3035 <div id="doc">
2994 3036 <p>
2995 3037 hg remove [OPTION]... FILE...
2996 3038 </p>
2997 3039 <p>
2998 3040 aliases: rm
2999 3041 </p>
3000 3042 <p>
3001 3043 remove the specified files on the next commit
3002 3044 </p>
3003 3045 <p>
3004 3046 Schedule the indicated files for removal from the current branch.
3005 3047 </p>
3006 3048 <p>
3007 3049 This command schedules the files to be removed at the next commit.
3008 3050 To undo a remove before that, see 'hg revert'. To undo added
3009 3051 files, see 'hg forget'.
3010 3052 </p>
3011 3053 <p>
3012 3054 -A/--after can be used to remove only files that have already
3013 3055 been deleted, -f/--force can be used to force deletion, and -Af
3014 3056 can be used to remove files from the next revision without
3015 3057 deleting them from the working directory.
3016 3058 </p>
3017 3059 <p>
3018 3060 The following table details the behavior of remove for different
3019 3061 file states (columns) and option combinations (rows). The file
3020 3062 states are Added [A], Clean [C], Modified [M] and Missing [!]
3021 3063 (as reported by 'hg status'). The actions are Warn, Remove
3022 3064 (from branch) and Delete (from disk):
3023 3065 </p>
3024 3066 <table>
3025 3067 <tr><td>opt/state</td>
3026 3068 <td>A</td>
3027 3069 <td>C</td>
3028 3070 <td>M</td>
3029 3071 <td>!</td></tr>
3030 3072 <tr><td>none</td>
3031 3073 <td>W</td>
3032 3074 <td>RD</td>
3033 3075 <td>W</td>
3034 3076 <td>R</td></tr>
3035 3077 <tr><td>-f</td>
3036 3078 <td>R</td>
3037 3079 <td>RD</td>
3038 3080 <td>RD</td>
3039 3081 <td>R</td></tr>
3040 3082 <tr><td>-A</td>
3041 3083 <td>W</td>
3042 3084 <td>W</td>
3043 3085 <td>W</td>
3044 3086 <td>R</td></tr>
3045 3087 <tr><td>-Af</td>
3046 3088 <td>R</td>
3047 3089 <td>R</td>
3048 3090 <td>R</td>
3049 3091 <td>R</td></tr>
3050 3092 </table>
3051 3093 <p>
3052 3094 <b>Note:</b>
3053 3095 </p>
3054 3096 <p>
3055 3097 'hg remove' never deletes files in Added [A] state from the
3056 3098 working directory, not even if &quot;--force&quot; is specified.
3057 3099 </p>
3058 3100 <p>
3059 3101 Returns 0 on success, 1 if any warnings encountered.
3060 3102 </p>
3061 3103 <p>
3062 3104 options ([+] can be repeated):
3063 3105 </p>
3064 3106 <table>
3065 3107 <tr><td>-A</td>
3066 3108 <td>--after</td>
3067 3109 <td>record delete for missing files</td></tr>
3068 3110 <tr><td>-f</td>
3069 3111 <td>--force</td>
3070 3112 <td>forget added files, delete modified files</td></tr>
3071 3113 <tr><td>-S</td>
3072 3114 <td>--subrepos</td>
3073 3115 <td>recurse into subrepositories</td></tr>
3074 3116 <tr><td>-I</td>
3075 3117 <td>--include PATTERN [+]</td>
3076 3118 <td>include names matching the given patterns</td></tr>
3077 3119 <tr><td>-X</td>
3078 3120 <td>--exclude PATTERN [+]</td>
3079 3121 <td>exclude names matching the given patterns</td></tr>
3080 3122 <tr><td>-n</td>
3081 3123 <td>--dry-run</td>
3082 3124 <td>do not perform actions, just print output</td></tr>
3083 3125 </table>
3084 3126 <p>
3085 3127 global options ([+] can be repeated):
3086 3128 </p>
3087 3129 <table>
3088 3130 <tr><td>-R</td>
3089 3131 <td>--repository REPO</td>
3090 3132 <td>repository root directory or name of overlay bundle file</td></tr>
3091 3133 <tr><td></td>
3092 3134 <td>--cwd DIR</td>
3093 3135 <td>change working directory</td></tr>
3094 3136 <tr><td>-y</td>
3095 3137 <td>--noninteractive</td>
3096 3138 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
3097 3139 <tr><td>-q</td>
3098 3140 <td>--quiet</td>
3099 3141 <td>suppress output</td></tr>
3100 3142 <tr><td>-v</td>
3101 3143 <td>--verbose</td>
3102 3144 <td>enable additional output</td></tr>
3103 3145 <tr><td></td>
3104 3146 <td>--color TYPE</td>
3105 3147 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
3106 3148 <tr><td></td>
3107 3149 <td>--config CONFIG [+]</td>
3108 3150 <td>set/override config option (use 'section.name=value')</td></tr>
3109 3151 <tr><td></td>
3110 3152 <td>--debug</td>
3111 3153 <td>enable debugging output</td></tr>
3112 3154 <tr><td></td>
3113 3155 <td>--debugger</td>
3114 3156 <td>start debugger</td></tr>
3115 3157 <tr><td></td>
3116 3158 <td>--encoding ENCODE</td>
3117 3159 <td>set the charset encoding (default: ascii)</td></tr>
3118 3160 <tr><td></td>
3119 3161 <td>--encodingmode MODE</td>
3120 3162 <td>set the charset encoding mode (default: strict)</td></tr>
3121 3163 <tr><td></td>
3122 3164 <td>--traceback</td>
3123 3165 <td>always print a traceback on exception</td></tr>
3124 3166 <tr><td></td>
3125 3167 <td>--time</td>
3126 3168 <td>time how long the command takes</td></tr>
3127 3169 <tr><td></td>
3128 3170 <td>--profile</td>
3129 3171 <td>print command execution profile</td></tr>
3130 3172 <tr><td></td>
3131 3173 <td>--version</td>
3132 3174 <td>output version information and exit</td></tr>
3133 3175 <tr><td>-h</td>
3134 3176 <td>--help</td>
3135 3177 <td>display help and exit</td></tr>
3136 3178 <tr><td></td>
3137 3179 <td>--hidden</td>
3138 3180 <td>consider hidden changesets</td></tr>
3139 3181 <tr><td></td>
3140 3182 <td>--pager TYPE</td>
3141 3183 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
3142 3184 </table>
3143 3185
3144 3186 </div>
3145 3187 </div>
3146 3188 </div>
3147 3189
3148 3190
3149 3191
3150 3192 </body>
3151 3193 </html>
3152 3194
3153 3195
3154 3196 $ get-with-headers.py $LOCALIP:$HGPORT "help/dates"
3155 3197 200 Script output follows
3156 3198
3157 3199 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3158 3200 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3159 3201 <head>
3160 3202 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3161 3203 <meta name="robots" content="index, nofollow" />
3162 3204 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3163 3205 <script type="text/javascript" src="/static/mercurial.js"></script>
3164 3206
3165 3207 <title>Help: dates</title>
3166 3208 </head>
3167 3209 <body>
3168 3210
3169 3211 <div class="container">
3170 3212 <div class="menu">
3171 3213 <div class="logo">
3172 3214 <a href="https://mercurial-scm.org/">
3173 3215 <img src="/static/hglogo.png" alt="mercurial" /></a>
3174 3216 </div>
3175 3217 <ul>
3176 3218 <li><a href="/shortlog">log</a></li>
3177 3219 <li><a href="/graph">graph</a></li>
3178 3220 <li><a href="/tags">tags</a></li>
3179 3221 <li><a href="/bookmarks">bookmarks</a></li>
3180 3222 <li><a href="/branches">branches</a></li>
3181 3223 </ul>
3182 3224 <ul>
3183 3225 <li class="active"><a href="/help">help</a></li>
3184 3226 </ul>
3185 3227 </div>
3186 3228
3187 3229 <div class="main">
3188 3230 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3189 3231 <h3>Help: dates</h3>
3190 3232
3191 3233 <form class="search" action="/log">
3192 3234
3193 3235 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3194 3236 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3195 3237 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3196 3238 </form>
3197 3239 <div id="doc">
3198 3240 <h1>Date Formats</h1>
3199 3241 <p>
3200 3242 Some commands allow the user to specify a date, e.g.:
3201 3243 </p>
3202 3244 <ul>
3203 3245 <li> backout, commit, import, tag: Specify the commit date.
3204 3246 <li> log, revert, update: Select revision(s) by date.
3205 3247 </ul>
3206 3248 <p>
3207 3249 Many date formats are valid. Here are some examples:
3208 3250 </p>
3209 3251 <ul>
3210 3252 <li> &quot;Wed Dec 6 13:18:29 2006&quot; (local timezone assumed)
3211 3253 <li> &quot;Dec 6 13:18 -0600&quot; (year assumed, time offset provided)
3212 3254 <li> &quot;Dec 6 13:18 UTC&quot; (UTC and GMT are aliases for +0000)
3213 3255 <li> &quot;Dec 6&quot; (midnight)
3214 3256 <li> &quot;13:18&quot; (today assumed)
3215 3257 <li> &quot;3:39&quot; (3:39AM assumed)
3216 3258 <li> &quot;3:39pm&quot; (15:39)
3217 3259 <li> &quot;2006-12-06 13:18:29&quot; (ISO 8601 format)
3218 3260 <li> &quot;2006-12-6 13:18&quot;
3219 3261 <li> &quot;2006-12-6&quot;
3220 3262 <li> &quot;12-6&quot;
3221 3263 <li> &quot;12/6&quot;
3222 3264 <li> &quot;12/6/6&quot; (Dec 6 2006)
3223 3265 <li> &quot;today&quot; (midnight)
3224 3266 <li> &quot;yesterday&quot; (midnight)
3225 3267 <li> &quot;now&quot; - right now
3226 3268 </ul>
3227 3269 <p>
3228 3270 Lastly, there is Mercurial's internal format:
3229 3271 </p>
3230 3272 <ul>
3231 3273 <li> &quot;1165411109 0&quot; (Wed Dec 6 13:18:29 2006 UTC)
3232 3274 </ul>
3233 3275 <p>
3234 3276 This is the internal representation format for dates. The first number
3235 3277 is the number of seconds since the epoch (1970-01-01 00:00 UTC). The
3236 3278 second is the offset of the local timezone, in seconds west of UTC
3237 3279 (negative if the timezone is east of UTC).
3238 3280 </p>
3239 3281 <p>
3240 3282 The log command also accepts date ranges:
3241 3283 </p>
3242 3284 <ul>
3243 3285 <li> &quot;&lt;DATE&quot; - at or before a given date/time
3244 3286 <li> &quot;&gt;DATE&quot; - on or after a given date/time
3245 3287 <li> &quot;DATE to DATE&quot; - a date range, inclusive
3246 3288 <li> &quot;-DAYS&quot; - within a given number of days of today
3247 3289 </ul>
3248 3290
3249 3291 </div>
3250 3292 </div>
3251 3293 </div>
3252 3294
3253 3295
3254 3296
3255 3297 </body>
3256 3298 </html>
3257 3299
3258 3300
3259 3301 $ get-with-headers.py $LOCALIP:$HGPORT "help/pager"
3260 3302 200 Script output follows
3261 3303
3262 3304 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3263 3305 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3264 3306 <head>
3265 3307 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3266 3308 <meta name="robots" content="index, nofollow" />
3267 3309 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3268 3310 <script type="text/javascript" src="/static/mercurial.js"></script>
3269 3311
3270 3312 <title>Help: pager</title>
3271 3313 </head>
3272 3314 <body>
3273 3315
3274 3316 <div class="container">
3275 3317 <div class="menu">
3276 3318 <div class="logo">
3277 3319 <a href="https://mercurial-scm.org/">
3278 3320 <img src="/static/hglogo.png" alt="mercurial" /></a>
3279 3321 </div>
3280 3322 <ul>
3281 3323 <li><a href="/shortlog">log</a></li>
3282 3324 <li><a href="/graph">graph</a></li>
3283 3325 <li><a href="/tags">tags</a></li>
3284 3326 <li><a href="/bookmarks">bookmarks</a></li>
3285 3327 <li><a href="/branches">branches</a></li>
3286 3328 </ul>
3287 3329 <ul>
3288 3330 <li class="active"><a href="/help">help</a></li>
3289 3331 </ul>
3290 3332 </div>
3291 3333
3292 3334 <div class="main">
3293 3335 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3294 3336 <h3>Help: pager</h3>
3295 3337
3296 3338 <form class="search" action="/log">
3297 3339
3298 3340 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3299 3341 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3300 3342 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3301 3343 </form>
3302 3344 <div id="doc">
3303 3345 <h1>Pager Support</h1>
3304 3346 <p>
3305 3347 Some Mercurial commands can produce a lot of output, and Mercurial will
3306 3348 attempt to use a pager to make those commands more pleasant.
3307 3349 </p>
3308 3350 <p>
3309 3351 To set the pager that should be used, set the application variable:
3310 3352 </p>
3311 3353 <pre>
3312 3354 [pager]
3313 3355 pager = less -FRX
3314 3356 </pre>
3315 3357 <p>
3316 3358 If no pager is set in the user or repository configuration, Mercurial uses the
3317 3359 environment variable $PAGER. If $PAGER is not set, pager.pager from the default
3318 3360 or system configuration is used. If none of these are set, a default pager will
3319 3361 be used, typically 'less' on Unix and 'more' on Windows.
3320 3362 </p>
3321 3363 <p>
3322 3364 You can disable the pager for certain commands by adding them to the
3323 3365 pager.ignore list:
3324 3366 </p>
3325 3367 <pre>
3326 3368 [pager]
3327 3369 ignore = version, help, update
3328 3370 </pre>
3329 3371 <p>
3330 3372 To ignore global commands like 'hg version' or 'hg help', you have
3331 3373 to specify them in your user configuration file.
3332 3374 </p>
3333 3375 <p>
3334 3376 To control whether the pager is used at all for an individual command,
3335 3377 you can use --pager=&lt;value&gt;:
3336 3378 </p>
3337 3379 <ul>
3338 3380 <li> use as needed: 'auto'.
3339 3381 <li> require the pager: 'yes' or 'on'.
3340 3382 <li> suppress the pager: 'no' or 'off' (any unrecognized value will also work).
3341 3383 </ul>
3342 3384 <p>
3343 3385 To globally turn off all attempts to use a pager, set:
3344 3386 </p>
3345 3387 <pre>
3346 3388 [ui]
3347 3389 paginate = never
3348 3390 </pre>
3349 3391 <p>
3350 3392 which will prevent the pager from running.
3351 3393 </p>
3352 3394
3353 3395 </div>
3354 3396 </div>
3355 3397 </div>
3356 3398
3357 3399
3358 3400
3359 3401 </body>
3360 3402 </html>
3361 3403
3362 3404
3363 3405 Sub-topic indexes rendered properly
3364 3406
3365 3407 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals"
3366 3408 200 Script output follows
3367 3409
3368 3410 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3369 3411 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3370 3412 <head>
3371 3413 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3372 3414 <meta name="robots" content="index, nofollow" />
3373 3415 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3374 3416 <script type="text/javascript" src="/static/mercurial.js"></script>
3375 3417
3376 3418 <title>Help: internals</title>
3377 3419 </head>
3378 3420 <body>
3379 3421
3380 3422 <div class="container">
3381 3423 <div class="menu">
3382 3424 <div class="logo">
3383 3425 <a href="https://mercurial-scm.org/">
3384 3426 <img src="/static/hglogo.png" alt="mercurial" /></a>
3385 3427 </div>
3386 3428 <ul>
3387 3429 <li><a href="/shortlog">log</a></li>
3388 3430 <li><a href="/graph">graph</a></li>
3389 3431 <li><a href="/tags">tags</a></li>
3390 3432 <li><a href="/bookmarks">bookmarks</a></li>
3391 3433 <li><a href="/branches">branches</a></li>
3392 3434 </ul>
3393 3435 <ul>
3394 3436 <li><a href="/help">help</a></li>
3395 3437 </ul>
3396 3438 </div>
3397 3439
3398 3440 <div class="main">
3399 3441 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3400 3442
3401 3443 <form class="search" action="/log">
3402 3444
3403 3445 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3404 3446 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3405 3447 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3406 3448 </form>
3407 3449 <table class="bigtable">
3408 3450 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
3409 3451
3410 3452 <tr><td>
3411 3453 <a href="/help/internals.bundle2">
3412 3454 bundle2
3413 3455 </a>
3414 3456 </td><td>
3415 3457 Bundle2
3416 3458 </td></tr>
3417 3459 <tr><td>
3418 3460 <a href="/help/internals.bundles">
3419 3461 bundles
3420 3462 </a>
3421 3463 </td><td>
3422 3464 Bundles
3423 3465 </td></tr>
3424 3466 <tr><td>
3425 3467 <a href="/help/internals.cbor">
3426 3468 cbor
3427 3469 </a>
3428 3470 </td><td>
3429 3471 CBOR
3430 3472 </td></tr>
3431 3473 <tr><td>
3432 3474 <a href="/help/internals.censor">
3433 3475 censor
3434 3476 </a>
3435 3477 </td><td>
3436 3478 Censor
3437 3479 </td></tr>
3438 3480 <tr><td>
3439 3481 <a href="/help/internals.changegroups">
3440 3482 changegroups
3441 3483 </a>
3442 3484 </td><td>
3443 3485 Changegroups
3444 3486 </td></tr>
3445 3487 <tr><td>
3446 3488 <a href="/help/internals.config">
3447 3489 config
3448 3490 </a>
3449 3491 </td><td>
3450 3492 Config Registrar
3451 3493 </td></tr>
3452 3494 <tr><td>
3453 3495 <a href="/help/internals.requirements">
3454 3496 requirements
3455 3497 </a>
3456 3498 </td><td>
3457 3499 Repository Requirements
3458 3500 </td></tr>
3459 3501 <tr><td>
3460 3502 <a href="/help/internals.revlogs">
3461 3503 revlogs
3462 3504 </a>
3463 3505 </td><td>
3464 3506 Revision Logs
3465 3507 </td></tr>
3466 3508 <tr><td>
3467 3509 <a href="/help/internals.wireprotocol">
3468 3510 wireprotocol
3469 3511 </a>
3470 3512 </td><td>
3471 3513 Wire Protocol
3472 3514 </td></tr>
3473 3515 <tr><td>
3474 3516 <a href="/help/internals.wireprotocolrpc">
3475 3517 wireprotocolrpc
3476 3518 </a>
3477 3519 </td><td>
3478 3520 Wire Protocol RPC
3479 3521 </td></tr>
3480 3522 <tr><td>
3481 3523 <a href="/help/internals.wireprotocolv2">
3482 3524 wireprotocolv2
3483 3525 </a>
3484 3526 </td><td>
3485 3527 Wire Protocol Version 2
3486 3528 </td></tr>
3487 3529
3488 3530
3489 3531
3490 3532
3491 3533
3492 3534 </table>
3493 3535 </div>
3494 3536 </div>
3495 3537
3496 3538
3497 3539
3498 3540 </body>
3499 3541 </html>
3500 3542
3501 3543
3502 3544 Sub-topic topics rendered properly
3503 3545
3504 3546 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals.changegroups"
3505 3547 200 Script output follows
3506 3548
3507 3549 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3508 3550 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3509 3551 <head>
3510 3552 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3511 3553 <meta name="robots" content="index, nofollow" />
3512 3554 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3513 3555 <script type="text/javascript" src="/static/mercurial.js"></script>
3514 3556
3515 3557 <title>Help: internals.changegroups</title>
3516 3558 </head>
3517 3559 <body>
3518 3560
3519 3561 <div class="container">
3520 3562 <div class="menu">
3521 3563 <div class="logo">
3522 3564 <a href="https://mercurial-scm.org/">
3523 3565 <img src="/static/hglogo.png" alt="mercurial" /></a>
3524 3566 </div>
3525 3567 <ul>
3526 3568 <li><a href="/shortlog">log</a></li>
3527 3569 <li><a href="/graph">graph</a></li>
3528 3570 <li><a href="/tags">tags</a></li>
3529 3571 <li><a href="/bookmarks">bookmarks</a></li>
3530 3572 <li><a href="/branches">branches</a></li>
3531 3573 </ul>
3532 3574 <ul>
3533 3575 <li class="active"><a href="/help">help</a></li>
3534 3576 </ul>
3535 3577 </div>
3536 3578
3537 3579 <div class="main">
3538 3580 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3539 3581 <h3>Help: internals.changegroups</h3>
3540 3582
3541 3583 <form class="search" action="/log">
3542 3584
3543 3585 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3544 3586 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3545 3587 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3546 3588 </form>
3547 3589 <div id="doc">
3548 3590 <h1>Changegroups</h1>
3549 3591 <p>
3550 3592 Changegroups are representations of repository revlog data, specifically
3551 3593 the changelog data, root/flat manifest data, treemanifest data, and
3552 3594 filelogs.
3553 3595 </p>
3554 3596 <p>
3555 3597 There are 3 versions of changegroups: &quot;1&quot;, &quot;2&quot;, and &quot;3&quot;. From a
3556 3598 high-level, versions &quot;1&quot; and &quot;2&quot; are almost exactly the same, with the
3557 3599 only difference being an additional item in the *delta header*. Version
3558 3600 &quot;3&quot; adds support for storage flags in the *delta header* and optionally
3559 3601 exchanging treemanifests (enabled by setting an option on the
3560 3602 &quot;changegroup&quot; part in the bundle2).
3561 3603 </p>
3562 3604 <p>
3563 3605 Changegroups when not exchanging treemanifests consist of 3 logical
3564 3606 segments:
3565 3607 </p>
3566 3608 <pre>
3567 3609 +---------------------------------+
3568 3610 | | | |
3569 3611 | changeset | manifest | filelogs |
3570 3612 | | | |
3571 3613 | | | |
3572 3614 +---------------------------------+
3573 3615 </pre>
3574 3616 <p>
3575 3617 When exchanging treemanifests, there are 4 logical segments:
3576 3618 </p>
3577 3619 <pre>
3578 3620 +-------------------------------------------------+
3579 3621 | | | | |
3580 3622 | changeset | root | treemanifests | filelogs |
3581 3623 | | manifest | | |
3582 3624 | | | | |
3583 3625 +-------------------------------------------------+
3584 3626 </pre>
3585 3627 <p>
3586 3628 The principle building block of each segment is a *chunk*. A *chunk*
3587 3629 is a framed piece of data:
3588 3630 </p>
3589 3631 <pre>
3590 3632 +---------------------------------------+
3591 3633 | | |
3592 3634 | length | data |
3593 3635 | (4 bytes) | (&lt;length - 4&gt; bytes) |
3594 3636 | | |
3595 3637 +---------------------------------------+
3596 3638 </pre>
3597 3639 <p>
3598 3640 All integers are big-endian signed integers. Each chunk starts with a 32-bit
3599 3641 integer indicating the length of the entire chunk (including the length field
3600 3642 itself).
3601 3643 </p>
3602 3644 <p>
3603 3645 There is a special case chunk that has a value of 0 for the length
3604 3646 (&quot;0x00000000&quot;). We call this an *empty chunk*.
3605 3647 </p>
3606 3648 <h2>Delta Groups</h2>
3607 3649 <p>
3608 3650 A *delta group* expresses the content of a revlog as a series of deltas,
3609 3651 or patches against previous revisions.
3610 3652 </p>
3611 3653 <p>
3612 3654 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
3613 3655 to signal the end of the delta group:
3614 3656 </p>
3615 3657 <pre>
3616 3658 +------------------------------------------------------------------------+
3617 3659 | | | | | |
3618 3660 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
3619 3661 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
3620 3662 | | | | | |
3621 3663 +------------------------------------------------------------------------+
3622 3664 </pre>
3623 3665 <p>
3624 3666 Each *chunk*'s data consists of the following:
3625 3667 </p>
3626 3668 <pre>
3627 3669 +---------------------------------------+
3628 3670 | | |
3629 3671 | delta header | delta data |
3630 3672 | (various by version) | (various) |
3631 3673 | | |
3632 3674 +---------------------------------------+
3633 3675 </pre>
3634 3676 <p>
3635 3677 The *delta data* is a series of *delta*s that describe a diff from an existing
3636 3678 entry (either that the recipient already has, or previously specified in the
3637 3679 bundle/changegroup).
3638 3680 </p>
3639 3681 <p>
3640 3682 The *delta header* is different between versions &quot;1&quot;, &quot;2&quot;, and
3641 3683 &quot;3&quot; of the changegroup format.
3642 3684 </p>
3643 3685 <p>
3644 3686 Version 1 (headerlen=80):
3645 3687 </p>
3646 3688 <pre>
3647 3689 +------------------------------------------------------+
3648 3690 | | | | |
3649 3691 | node | p1 node | p2 node | link node |
3650 3692 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3651 3693 | | | | |
3652 3694 +------------------------------------------------------+
3653 3695 </pre>
3654 3696 <p>
3655 3697 Version 2 (headerlen=100):
3656 3698 </p>
3657 3699 <pre>
3658 3700 +------------------------------------------------------------------+
3659 3701 | | | | | |
3660 3702 | node | p1 node | p2 node | base node | link node |
3661 3703 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3662 3704 | | | | | |
3663 3705 +------------------------------------------------------------------+
3664 3706 </pre>
3665 3707 <p>
3666 3708 Version 3 (headerlen=102):
3667 3709 </p>
3668 3710 <pre>
3669 3711 +------------------------------------------------------------------------------+
3670 3712 | | | | | | |
3671 3713 | node | p1 node | p2 node | base node | link node | flags |
3672 3714 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
3673 3715 | | | | | | |
3674 3716 +------------------------------------------------------------------------------+
3675 3717 </pre>
3676 3718 <p>
3677 3719 The *delta data* consists of &quot;chunklen - 4 - headerlen&quot; bytes, which contain a
3678 3720 series of *delta*s, densely packed (no separators). These deltas describe a diff
3679 3721 from an existing entry (either that the recipient already has, or previously
3680 3722 specified in the bundle/changegroup). The format is described more fully in
3681 3723 &quot;hg help internals.bdiff&quot;, but briefly:
3682 3724 </p>
3683 3725 <pre>
3684 3726 +---------------------------------------------------------------+
3685 3727 | | | | |
3686 3728 | start offset | end offset | new length | content |
3687 3729 | (4 bytes) | (4 bytes) | (4 bytes) | (&lt;new length&gt; bytes) |
3688 3730 | | | | |
3689 3731 +---------------------------------------------------------------+
3690 3732 </pre>
3691 3733 <p>
3692 3734 Please note that the length field in the delta data does *not* include itself.
3693 3735 </p>
3694 3736 <p>
3695 3737 In version 1, the delta is always applied against the previous node from
3696 3738 the changegroup or the first parent if this is the first entry in the
3697 3739 changegroup.
3698 3740 </p>
3699 3741 <p>
3700 3742 In version 2 and up, the delta base node is encoded in the entry in the
3701 3743 changegroup. This allows the delta to be expressed against any parent,
3702 3744 which can result in smaller deltas and more efficient encoding of data.
3703 3745 </p>
3704 3746 <p>
3705 3747 The *flags* field holds bitwise flags affecting the processing of revision
3706 3748 data. The following flags are defined:
3707 3749 </p>
3708 3750 <dl>
3709 3751 <dt>32768
3710 3752 <dd>Censored revision. The revision's fulltext has been replaced by censor metadata. May only occur on file revisions.
3711 3753 <dt>16384
3712 3754 <dd>Ellipsis revision. Revision hash does not match data (likely due to rewritten parents).
3713 3755 <dt>8192
3714 3756 <dd>Externally stored. The revision fulltext contains &quot;key:value&quot; &quot;\n&quot; delimited metadata defining an object stored elsewhere. Used by the LFS extension.
3715 3757 </dl>
3716 3758 <p>
3717 3759 For historical reasons, the integer values are identical to revlog version 1
3718 3760 per-revision storage flags and correspond to bits being set in this 2-byte
3719 3761 field. Bits were allocated starting from the most-significant bit, hence the
3720 3762 reverse ordering and allocation of these flags.
3721 3763 </p>
3722 3764 <h2>Changeset Segment</h2>
3723 3765 <p>
3724 3766 The *changeset segment* consists of a single *delta group* holding
3725 3767 changelog data. The *empty chunk* at the end of the *delta group* denotes
3726 3768 the boundary to the *manifest segment*.
3727 3769 </p>
3728 3770 <h2>Manifest Segment</h2>
3729 3771 <p>
3730 3772 The *manifest segment* consists of a single *delta group* holding manifest
3731 3773 data. If treemanifests are in use, it contains only the manifest for the
3732 3774 root directory of the repository. Otherwise, it contains the entire
3733 3775 manifest data. The *empty chunk* at the end of the *delta group* denotes
3734 3776 the boundary to the next segment (either the *treemanifests segment* or the
3735 3777 *filelogs segment*, depending on version and the request options).
3736 3778 </p>
3737 3779 <h3>Treemanifests Segment</h3>
3738 3780 <p>
3739 3781 The *treemanifests segment* only exists in changegroup version &quot;3&quot;, and
3740 3782 only if the 'treemanifest' param is part of the bundle2 changegroup part
3741 3783 (it is not possible to use changegroup version 3 outside of bundle2).
3742 3784 Aside from the filenames in the *treemanifests segment* containing a
3743 3785 trailing &quot;/&quot; character, it behaves identically to the *filelogs segment*
3744 3786 (see below). The final sub-segment is followed by an *empty chunk* (logically,
3745 3787 a sub-segment with filename size 0). This denotes the boundary to the
3746 3788 *filelogs segment*.
3747 3789 </p>
3748 3790 <h2>Filelogs Segment</h2>
3749 3791 <p>
3750 3792 The *filelogs segment* consists of multiple sub-segments, each
3751 3793 corresponding to an individual file whose data is being described:
3752 3794 </p>
3753 3795 <pre>
3754 3796 +--------------------------------------------------+
3755 3797 | | | | | |
3756 3798 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
3757 3799 | | | | | (4 bytes) |
3758 3800 | | | | | |
3759 3801 +--------------------------------------------------+
3760 3802 </pre>
3761 3803 <p>
3762 3804 The final filelog sub-segment is followed by an *empty chunk* (logically,
3763 3805 a sub-segment with filename size 0). This denotes the end of the segment
3764 3806 and of the overall changegroup.
3765 3807 </p>
3766 3808 <p>
3767 3809 Each filelog sub-segment consists of the following:
3768 3810 </p>
3769 3811 <pre>
3770 3812 +------------------------------------------------------+
3771 3813 | | | |
3772 3814 | filename length | filename | delta group |
3773 3815 | (4 bytes) | (&lt;length - 4&gt; bytes) | (various) |
3774 3816 | | | |
3775 3817 +------------------------------------------------------+
3776 3818 </pre>
3777 3819 <p>
3778 3820 That is, a *chunk* consisting of the filename (not terminated or padded)
3779 3821 followed by N chunks constituting the *delta group* for this file. The
3780 3822 *empty chunk* at the end of each *delta group* denotes the boundary to the
3781 3823 next filelog sub-segment.
3782 3824 </p>
3783 3825
3784 3826 </div>
3785 3827 </div>
3786 3828 </div>
3787 3829
3788 3830
3789 3831
3790 3832 </body>
3791 3833 </html>
3792 3834
3793 3835
3794 3836 $ get-with-headers.py 127.0.0.1:$HGPORT "help/unknowntopic"
3795 3837 404 Not Found
3796 3838
3797 3839 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3798 3840 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3799 3841 <head>
3800 3842 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3801 3843 <meta name="robots" content="index, nofollow" />
3802 3844 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3803 3845 <script type="text/javascript" src="/static/mercurial.js"></script>
3804 3846
3805 3847 <title>test: error</title>
3806 3848 </head>
3807 3849 <body>
3808 3850
3809 3851 <div class="container">
3810 3852 <div class="menu">
3811 3853 <div class="logo">
3812 3854 <a href="https://mercurial-scm.org/">
3813 3855 <img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial" /></a>
3814 3856 </div>
3815 3857 <ul>
3816 3858 <li><a href="/shortlog">log</a></li>
3817 3859 <li><a href="/graph">graph</a></li>
3818 3860 <li><a href="/tags">tags</a></li>
3819 3861 <li><a href="/bookmarks">bookmarks</a></li>
3820 3862 <li><a href="/branches">branches</a></li>
3821 3863 </ul>
3822 3864 <ul>
3823 3865 <li><a href="/help">help</a></li>
3824 3866 </ul>
3825 3867 </div>
3826 3868
3827 3869 <div class="main">
3828 3870
3829 3871 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3830 3872 <h3>error</h3>
3831 3873
3832 3874
3833 3875 <form class="search" action="/log">
3834 3876
3835 3877 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3836 3878 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3837 3879 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3838 3880 </form>
3839 3881
3840 3882 <div class="description">
3841 3883 <p>
3842 3884 An error occurred while processing your request:
3843 3885 </p>
3844 3886 <p>
3845 3887 Not Found
3846 3888 </p>
3847 3889 </div>
3848 3890 </div>
3849 3891 </div>
3850 3892
3851 3893
3852 3894
3853 3895 </body>
3854 3896 </html>
3855 3897
3856 3898 [1]
3857 3899
3858 3900 $ killdaemons.py
3859 3901
3860 3902 #endif
General Comments 0
You need to be logged in to leave comments. Login now