##// END OF EJS Templates
help: show "[no-]" only for default-on Flags...
Martin von Zweigbergk -
r41045:fcc0a7ac default
parent child Browse files
Show More
@@ -1,866 +1,866 b''
1 # help.py - help data for mercurial
1 # help.py - help data for mercurial
2 #
2 #
3 # Copyright 2006 Matt Mackall <mpm@selenic.com>
3 # Copyright 2006 Matt Mackall <mpm@selenic.com>
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 from __future__ import absolute_import
8 from __future__ import absolute_import
9
9
10 import itertools
10 import itertools
11 import os
11 import os
12 import re
12 import re
13 import textwrap
13 import textwrap
14
14
15 from .i18n import (
15 from .i18n import (
16 _,
16 _,
17 gettext,
17 gettext,
18 )
18 )
19 from . import (
19 from . import (
20 cmdutil,
20 cmdutil,
21 encoding,
21 encoding,
22 error,
22 error,
23 extensions,
23 extensions,
24 fancyopts,
24 fancyopts,
25 filemerge,
25 filemerge,
26 fileset,
26 fileset,
27 minirst,
27 minirst,
28 pycompat,
28 pycompat,
29 registrar,
29 registrar,
30 revset,
30 revset,
31 templatefilters,
31 templatefilters,
32 templatefuncs,
32 templatefuncs,
33 templatekw,
33 templatekw,
34 ui as uimod,
34 ui as uimod,
35 util,
35 util,
36 )
36 )
37 from .hgweb import (
37 from .hgweb import (
38 webcommands,
38 webcommands,
39 )
39 )
40
40
41 _exclkeywords = {
41 _exclkeywords = {
42 "(ADVANCED)",
42 "(ADVANCED)",
43 "(DEPRECATED)",
43 "(DEPRECATED)",
44 "(EXPERIMENTAL)",
44 "(EXPERIMENTAL)",
45 # i18n: "(ADVANCED)" is a keyword, must be translated consistently
45 # i18n: "(ADVANCED)" is a keyword, must be translated consistently
46 _("(ADVANCED)"),
46 _("(ADVANCED)"),
47 # i18n: "(DEPRECATED)" is a keyword, must be translated consistently
47 # i18n: "(DEPRECATED)" is a keyword, must be translated consistently
48 _("(DEPRECATED)"),
48 _("(DEPRECATED)"),
49 # i18n: "(EXPERIMENTAL)" is a keyword, must be translated consistently
49 # i18n: "(EXPERIMENTAL)" is a keyword, must be translated consistently
50 _("(EXPERIMENTAL)"),
50 _("(EXPERIMENTAL)"),
51 }
51 }
52
52
53 # The order in which command categories will be displayed.
53 # The order in which command categories will be displayed.
54 # Extensions with custom categories should insert them into this list
54 # Extensions with custom categories should insert them into this list
55 # after/before the appropriate item, rather than replacing the list or
55 # after/before the appropriate item, rather than replacing the list or
56 # assuming absolute positions.
56 # assuming absolute positions.
57 CATEGORY_ORDER = [
57 CATEGORY_ORDER = [
58 registrar.command.CATEGORY_REPO_CREATION,
58 registrar.command.CATEGORY_REPO_CREATION,
59 registrar.command.CATEGORY_REMOTE_REPO_MANAGEMENT,
59 registrar.command.CATEGORY_REMOTE_REPO_MANAGEMENT,
60 registrar.command.CATEGORY_COMMITTING,
60 registrar.command.CATEGORY_COMMITTING,
61 registrar.command.CATEGORY_CHANGE_MANAGEMENT,
61 registrar.command.CATEGORY_CHANGE_MANAGEMENT,
62 registrar.command.CATEGORY_CHANGE_ORGANIZATION,
62 registrar.command.CATEGORY_CHANGE_ORGANIZATION,
63 registrar.command.CATEGORY_FILE_CONTENTS,
63 registrar.command.CATEGORY_FILE_CONTENTS,
64 registrar.command.CATEGORY_CHANGE_NAVIGATION ,
64 registrar.command.CATEGORY_CHANGE_NAVIGATION ,
65 registrar.command.CATEGORY_WORKING_DIRECTORY,
65 registrar.command.CATEGORY_WORKING_DIRECTORY,
66 registrar.command.CATEGORY_IMPORT_EXPORT,
66 registrar.command.CATEGORY_IMPORT_EXPORT,
67 registrar.command.CATEGORY_MAINTENANCE,
67 registrar.command.CATEGORY_MAINTENANCE,
68 registrar.command.CATEGORY_HELP,
68 registrar.command.CATEGORY_HELP,
69 registrar.command.CATEGORY_MISC,
69 registrar.command.CATEGORY_MISC,
70 registrar.command.CATEGORY_NONE,
70 registrar.command.CATEGORY_NONE,
71 ]
71 ]
72
72
73 # Human-readable category names. These are translated.
73 # Human-readable category names. These are translated.
74 # Extensions with custom categories should add their names here.
74 # Extensions with custom categories should add their names here.
75 CATEGORY_NAMES = {
75 CATEGORY_NAMES = {
76 registrar.command.CATEGORY_REPO_CREATION: 'Repository creation',
76 registrar.command.CATEGORY_REPO_CREATION: 'Repository creation',
77 registrar.command.CATEGORY_REMOTE_REPO_MANAGEMENT:
77 registrar.command.CATEGORY_REMOTE_REPO_MANAGEMENT:
78 'Remote repository management',
78 'Remote repository management',
79 registrar.command.CATEGORY_COMMITTING: 'Change creation',
79 registrar.command.CATEGORY_COMMITTING: 'Change creation',
80 registrar.command.CATEGORY_CHANGE_NAVIGATION: 'Change navigation',
80 registrar.command.CATEGORY_CHANGE_NAVIGATION: 'Change navigation',
81 registrar.command.CATEGORY_CHANGE_MANAGEMENT: 'Change manipulation',
81 registrar.command.CATEGORY_CHANGE_MANAGEMENT: 'Change manipulation',
82 registrar.command.CATEGORY_CHANGE_ORGANIZATION: 'Change organization',
82 registrar.command.CATEGORY_CHANGE_ORGANIZATION: 'Change organization',
83 registrar.command.CATEGORY_WORKING_DIRECTORY:
83 registrar.command.CATEGORY_WORKING_DIRECTORY:
84 'Working directory management',
84 'Working directory management',
85 registrar.command.CATEGORY_FILE_CONTENTS: 'File content management',
85 registrar.command.CATEGORY_FILE_CONTENTS: 'File content management',
86 registrar.command.CATEGORY_IMPORT_EXPORT: 'Change import/export',
86 registrar.command.CATEGORY_IMPORT_EXPORT: 'Change import/export',
87 registrar.command.CATEGORY_MAINTENANCE: 'Repository maintenance',
87 registrar.command.CATEGORY_MAINTENANCE: 'Repository maintenance',
88 registrar.command.CATEGORY_HELP: 'Help',
88 registrar.command.CATEGORY_HELP: 'Help',
89 registrar.command.CATEGORY_MISC: 'Miscellaneous commands',
89 registrar.command.CATEGORY_MISC: 'Miscellaneous commands',
90 registrar.command.CATEGORY_NONE: 'Uncategorized commands',
90 registrar.command.CATEGORY_NONE: 'Uncategorized commands',
91 }
91 }
92
92
93 # Topic categories.
93 # Topic categories.
94 TOPIC_CATEGORY_IDS = 'ids'
94 TOPIC_CATEGORY_IDS = 'ids'
95 TOPIC_CATEGORY_OUTPUT = 'output'
95 TOPIC_CATEGORY_OUTPUT = 'output'
96 TOPIC_CATEGORY_CONFIG = 'config'
96 TOPIC_CATEGORY_CONFIG = 'config'
97 TOPIC_CATEGORY_CONCEPTS = 'concepts'
97 TOPIC_CATEGORY_CONCEPTS = 'concepts'
98 TOPIC_CATEGORY_MISC = 'misc'
98 TOPIC_CATEGORY_MISC = 'misc'
99 TOPIC_CATEGORY_NONE = 'none'
99 TOPIC_CATEGORY_NONE = 'none'
100
100
101 # The order in which topic categories will be displayed.
101 # The order in which topic categories will be displayed.
102 # Extensions with custom categories should insert them into this list
102 # Extensions with custom categories should insert them into this list
103 # after/before the appropriate item, rather than replacing the list or
103 # after/before the appropriate item, rather than replacing the list or
104 # assuming absolute positions.
104 # assuming absolute positions.
105 TOPIC_CATEGORY_ORDER = [
105 TOPIC_CATEGORY_ORDER = [
106 TOPIC_CATEGORY_IDS,
106 TOPIC_CATEGORY_IDS,
107 TOPIC_CATEGORY_OUTPUT,
107 TOPIC_CATEGORY_OUTPUT,
108 TOPIC_CATEGORY_CONFIG,
108 TOPIC_CATEGORY_CONFIG,
109 TOPIC_CATEGORY_CONCEPTS,
109 TOPIC_CATEGORY_CONCEPTS,
110 TOPIC_CATEGORY_MISC,
110 TOPIC_CATEGORY_MISC,
111 TOPIC_CATEGORY_NONE,
111 TOPIC_CATEGORY_NONE,
112 ]
112 ]
113
113
114 # Human-readable topic category names. These are translated.
114 # Human-readable topic category names. These are translated.
115 TOPIC_CATEGORY_NAMES = {
115 TOPIC_CATEGORY_NAMES = {
116 TOPIC_CATEGORY_IDS: 'Mercurial identifiers',
116 TOPIC_CATEGORY_IDS: 'Mercurial identifiers',
117 TOPIC_CATEGORY_OUTPUT: 'Mercurial output',
117 TOPIC_CATEGORY_OUTPUT: 'Mercurial output',
118 TOPIC_CATEGORY_CONFIG: 'Mercurial configuration',
118 TOPIC_CATEGORY_CONFIG: 'Mercurial configuration',
119 TOPIC_CATEGORY_CONCEPTS: 'Concepts',
119 TOPIC_CATEGORY_CONCEPTS: 'Concepts',
120 TOPIC_CATEGORY_MISC: 'Miscellaneous',
120 TOPIC_CATEGORY_MISC: 'Miscellaneous',
121 TOPIC_CATEGORY_NONE: 'Uncategorized topics',
121 TOPIC_CATEGORY_NONE: 'Uncategorized topics',
122 TOPIC_CATEGORY_NONE: 'Uncategorized topics',
122 TOPIC_CATEGORY_NONE: 'Uncategorized topics',
123 }
123 }
124
124
125 def listexts(header, exts, indent=1, showdeprecated=False):
125 def listexts(header, exts, indent=1, showdeprecated=False):
126 '''return a text listing of the given extensions'''
126 '''return a text listing of the given extensions'''
127 rst = []
127 rst = []
128 if exts:
128 if exts:
129 for name, desc in sorted(exts.iteritems()):
129 for name, desc in sorted(exts.iteritems()):
130 if not showdeprecated and any(w in desc for w in _exclkeywords):
130 if not showdeprecated and any(w in desc for w in _exclkeywords):
131 continue
131 continue
132 rst.append('%s:%s: %s\n' % (' ' * indent, name, desc))
132 rst.append('%s:%s: %s\n' % (' ' * indent, name, desc))
133 if rst:
133 if rst:
134 rst.insert(0, '\n%s\n\n' % header)
134 rst.insert(0, '\n%s\n\n' % header)
135 return rst
135 return rst
136
136
137 def extshelp(ui):
137 def extshelp(ui):
138 rst = loaddoc('extensions')(ui).splitlines(True)
138 rst = loaddoc('extensions')(ui).splitlines(True)
139 rst.extend(listexts(
139 rst.extend(listexts(
140 _('enabled extensions:'), extensions.enabled(), showdeprecated=True))
140 _('enabled extensions:'), extensions.enabled(), showdeprecated=True))
141 rst.extend(listexts(_('disabled extensions:'), extensions.disabled(),
141 rst.extend(listexts(_('disabled extensions:'), extensions.disabled(),
142 showdeprecated=ui.verbose))
142 showdeprecated=ui.verbose))
143 doc = ''.join(rst)
143 doc = ''.join(rst)
144 return doc
144 return doc
145
145
146 def optrst(header, options, verbose):
146 def optrst(header, options, verbose):
147 data = []
147 data = []
148 multioccur = False
148 multioccur = False
149 for option in options:
149 for option in options:
150 if len(option) == 5:
150 if len(option) == 5:
151 shortopt, longopt, default, desc, optlabel = option
151 shortopt, longopt, default, desc, optlabel = option
152 else:
152 else:
153 shortopt, longopt, default, desc = option
153 shortopt, longopt, default, desc = option
154 optlabel = _("VALUE") # default label
154 optlabel = _("VALUE") # default label
155
155
156 if not verbose and any(w in desc for w in _exclkeywords):
156 if not verbose and any(w in desc for w in _exclkeywords):
157 continue
157 continue
158
158
159 so = ''
159 so = ''
160 if shortopt:
160 if shortopt:
161 so = '-' + shortopt
161 so = '-' + shortopt
162 lo = '--' + longopt
162 lo = '--' + longopt
163 if isinstance(default, bool):
163 if default is True:
164 lo = '--[no-]' + longopt
164 lo = '--[no-]' + longopt
165
165
166 if isinstance(default, fancyopts.customopt):
166 if isinstance(default, fancyopts.customopt):
167 default = default.getdefaultvalue()
167 default = default.getdefaultvalue()
168 if (default and not callable(default)) or default is False:
168 if (default and not callable(default)) or default is False:
169 # default is of unknown type, and in Python 2 we abused
169 # default is of unknown type, and in Python 2 we abused
170 # the %s-shows-repr property to handle integers etc. To
170 # the %s-shows-repr property to handle integers etc. To
171 # match that behavior on Python 3, we do str(default) and
171 # match that behavior on Python 3, we do str(default) and
172 # then convert it to bytes.
172 # then convert it to bytes.
173 defaultstr = pycompat.bytestr(default)
173 defaultstr = pycompat.bytestr(default)
174 if isinstance(default, bool):
174 if isinstance(default, bool):
175 defaultstr = _("on") if default else _("off")
175 defaultstr = _("on") if default else _("off")
176 desc += _(" (default: %s)") % defaultstr
176 desc += _(" (default: %s)") % defaultstr
177
177
178 if isinstance(default, list):
178 if isinstance(default, list):
179 lo += " %s [+]" % optlabel
179 lo += " %s [+]" % optlabel
180 multioccur = True
180 multioccur = True
181 elif (default is not None) and not isinstance(default, bool):
181 elif (default is not None) and not isinstance(default, bool):
182 lo += " %s" % optlabel
182 lo += " %s" % optlabel
183
183
184 data.append((so, lo, desc))
184 data.append((so, lo, desc))
185
185
186 if multioccur:
186 if multioccur:
187 header += (_(" ([+] can be repeated)"))
187 header += (_(" ([+] can be repeated)"))
188
188
189 rst = ['\n%s:\n\n' % header]
189 rst = ['\n%s:\n\n' % header]
190 rst.extend(minirst.maketable(data, 1))
190 rst.extend(minirst.maketable(data, 1))
191
191
192 return ''.join(rst)
192 return ''.join(rst)
193
193
194 def indicateomitted(rst, omitted, notomitted=None):
194 def indicateomitted(rst, omitted, notomitted=None):
195 rst.append('\n\n.. container:: omitted\n\n %s\n\n' % omitted)
195 rst.append('\n\n.. container:: omitted\n\n %s\n\n' % omitted)
196 if notomitted:
196 if notomitted:
197 rst.append('\n\n.. container:: notomitted\n\n %s\n\n' % notomitted)
197 rst.append('\n\n.. container:: notomitted\n\n %s\n\n' % notomitted)
198
198
199 def filtercmd(ui, cmd, func, kw, doc):
199 def filtercmd(ui, cmd, func, kw, doc):
200 if not ui.debugflag and cmd.startswith("debug") and kw != "debug":
200 if not ui.debugflag and cmd.startswith("debug") and kw != "debug":
201 # Debug command, and user is not looking for those.
201 # Debug command, and user is not looking for those.
202 return True
202 return True
203 if not ui.verbose:
203 if not ui.verbose:
204 if not kw and not doc:
204 if not kw and not doc:
205 # Command had no documentation, no point in showing it by default.
205 # Command had no documentation, no point in showing it by default.
206 return True
206 return True
207 if getattr(func, 'alias', False) and not getattr(func, 'owndoc', False):
207 if getattr(func, 'alias', False) and not getattr(func, 'owndoc', False):
208 # Alias didn't have its own documentation.
208 # Alias didn't have its own documentation.
209 return True
209 return True
210 if doc and any(w in doc for w in _exclkeywords):
210 if doc and any(w in doc for w in _exclkeywords):
211 # Documentation has excluded keywords.
211 # Documentation has excluded keywords.
212 return True
212 return True
213 if kw == "shortlist" and not getattr(func, 'helpbasic', False):
213 if kw == "shortlist" and not getattr(func, 'helpbasic', False):
214 # We're presenting the short list but the command is not basic.
214 # We're presenting the short list but the command is not basic.
215 return True
215 return True
216 if ui.configbool('help', 'hidden-command.%s' % cmd):
216 if ui.configbool('help', 'hidden-command.%s' % cmd):
217 # Configuration explicitly hides the command.
217 # Configuration explicitly hides the command.
218 return True
218 return True
219 return False
219 return False
220
220
221 def filtertopic(ui, topic):
221 def filtertopic(ui, topic):
222 return ui.configbool('help', 'hidden-topic.%s' % topic, False)
222 return ui.configbool('help', 'hidden-topic.%s' % topic, False)
223
223
224 def topicmatch(ui, commands, kw):
224 def topicmatch(ui, commands, kw):
225 """Return help topics matching kw.
225 """Return help topics matching kw.
226
226
227 Returns {'section': [(name, summary), ...], ...} where section is
227 Returns {'section': [(name, summary), ...], ...} where section is
228 one of topics, commands, extensions, or extensioncommands.
228 one of topics, commands, extensions, or extensioncommands.
229 """
229 """
230 kw = encoding.lower(kw)
230 kw = encoding.lower(kw)
231 def lowercontains(container):
231 def lowercontains(container):
232 return kw in encoding.lower(container) # translated in helptable
232 return kw in encoding.lower(container) # translated in helptable
233 results = {'topics': [],
233 results = {'topics': [],
234 'commands': [],
234 'commands': [],
235 'extensions': [],
235 'extensions': [],
236 'extensioncommands': [],
236 'extensioncommands': [],
237 }
237 }
238 for topic in helptable:
238 for topic in helptable:
239 names, header, doc = topic[0:3]
239 names, header, doc = topic[0:3]
240 # Old extensions may use a str as doc.
240 # Old extensions may use a str as doc.
241 if (sum(map(lowercontains, names))
241 if (sum(map(lowercontains, names))
242 or lowercontains(header)
242 or lowercontains(header)
243 or (callable(doc) and lowercontains(doc(ui)))):
243 or (callable(doc) and lowercontains(doc(ui)))):
244 name = names[0]
244 name = names[0]
245 if not filtertopic(ui, name):
245 if not filtertopic(ui, name):
246 results['topics'].append((names[0], header))
246 results['topics'].append((names[0], header))
247 for cmd, entry in commands.table.iteritems():
247 for cmd, entry in commands.table.iteritems():
248 if len(entry) == 3:
248 if len(entry) == 3:
249 summary = entry[2]
249 summary = entry[2]
250 else:
250 else:
251 summary = ''
251 summary = ''
252 # translate docs *before* searching there
252 # translate docs *before* searching there
253 func = entry[0]
253 func = entry[0]
254 docs = _(pycompat.getdoc(func)) or ''
254 docs = _(pycompat.getdoc(func)) or ''
255 if kw in cmd or lowercontains(summary) or lowercontains(docs):
255 if kw in cmd or lowercontains(summary) or lowercontains(docs):
256 doclines = docs.splitlines()
256 doclines = docs.splitlines()
257 if doclines:
257 if doclines:
258 summary = doclines[0]
258 summary = doclines[0]
259 cmdname = cmdutil.parsealiases(cmd)[0]
259 cmdname = cmdutil.parsealiases(cmd)[0]
260 if filtercmd(ui, cmdname, func, kw, docs):
260 if filtercmd(ui, cmdname, func, kw, docs):
261 continue
261 continue
262 results['commands'].append((cmdname, summary))
262 results['commands'].append((cmdname, summary))
263 for name, docs in itertools.chain(
263 for name, docs in itertools.chain(
264 extensions.enabled(False).iteritems(),
264 extensions.enabled(False).iteritems(),
265 extensions.disabled().iteritems()):
265 extensions.disabled().iteritems()):
266 if not docs:
266 if not docs:
267 continue
267 continue
268 name = name.rpartition('.')[-1]
268 name = name.rpartition('.')[-1]
269 if lowercontains(name) or lowercontains(docs):
269 if lowercontains(name) or lowercontains(docs):
270 # extension docs are already translated
270 # extension docs are already translated
271 results['extensions'].append((name, docs.splitlines()[0]))
271 results['extensions'].append((name, docs.splitlines()[0]))
272 try:
272 try:
273 mod = extensions.load(ui, name, '')
273 mod = extensions.load(ui, name, '')
274 except ImportError:
274 except ImportError:
275 # debug message would be printed in extensions.load()
275 # debug message would be printed in extensions.load()
276 continue
276 continue
277 for cmd, entry in getattr(mod, 'cmdtable', {}).iteritems():
277 for cmd, entry in getattr(mod, 'cmdtable', {}).iteritems():
278 if kw in cmd or (len(entry) > 2 and lowercontains(entry[2])):
278 if kw in cmd or (len(entry) > 2 and lowercontains(entry[2])):
279 cmdname = cmdutil.parsealiases(cmd)[0]
279 cmdname = cmdutil.parsealiases(cmd)[0]
280 func = entry[0]
280 func = entry[0]
281 cmddoc = pycompat.getdoc(func)
281 cmddoc = pycompat.getdoc(func)
282 if cmddoc:
282 if cmddoc:
283 cmddoc = gettext(cmddoc).splitlines()[0]
283 cmddoc = gettext(cmddoc).splitlines()[0]
284 else:
284 else:
285 cmddoc = _('(no help text available)')
285 cmddoc = _('(no help text available)')
286 if filtercmd(ui, cmdname, func, kw, cmddoc):
286 if filtercmd(ui, cmdname, func, kw, cmddoc):
287 continue
287 continue
288 results['extensioncommands'].append((cmdname, cmddoc))
288 results['extensioncommands'].append((cmdname, cmddoc))
289 return results
289 return results
290
290
291 def loaddoc(topic, subdir=None):
291 def loaddoc(topic, subdir=None):
292 """Return a delayed loader for help/topic.txt."""
292 """Return a delayed loader for help/topic.txt."""
293
293
294 def loader(ui):
294 def loader(ui):
295 docdir = os.path.join(util.datapath, 'help')
295 docdir = os.path.join(util.datapath, 'help')
296 if subdir:
296 if subdir:
297 docdir = os.path.join(docdir, subdir)
297 docdir = os.path.join(docdir, subdir)
298 path = os.path.join(docdir, topic + ".txt")
298 path = os.path.join(docdir, topic + ".txt")
299 doc = gettext(util.readfile(path))
299 doc = gettext(util.readfile(path))
300 for rewriter in helphooks.get(topic, []):
300 for rewriter in helphooks.get(topic, []):
301 doc = rewriter(ui, topic, doc)
301 doc = rewriter(ui, topic, doc)
302 return doc
302 return doc
303
303
304 return loader
304 return loader
305
305
306 internalstable = sorted([
306 internalstable = sorted([
307 (['bundle2'], _('Bundle2'),
307 (['bundle2'], _('Bundle2'),
308 loaddoc('bundle2', subdir='internals')),
308 loaddoc('bundle2', subdir='internals')),
309 (['bundles'], _('Bundles'),
309 (['bundles'], _('Bundles'),
310 loaddoc('bundles', subdir='internals')),
310 loaddoc('bundles', subdir='internals')),
311 (['cbor'], _('CBOR'),
311 (['cbor'], _('CBOR'),
312 loaddoc('cbor', subdir='internals')),
312 loaddoc('cbor', subdir='internals')),
313 (['censor'], _('Censor'),
313 (['censor'], _('Censor'),
314 loaddoc('censor', subdir='internals')),
314 loaddoc('censor', subdir='internals')),
315 (['changegroups'], _('Changegroups'),
315 (['changegroups'], _('Changegroups'),
316 loaddoc('changegroups', subdir='internals')),
316 loaddoc('changegroups', subdir='internals')),
317 (['config'], _('Config Registrar'),
317 (['config'], _('Config Registrar'),
318 loaddoc('config', subdir='internals')),
318 loaddoc('config', subdir='internals')),
319 (['extensions', 'extension'], _('Extension API'),
319 (['extensions', 'extension'], _('Extension API'),
320 loaddoc('extensions', subdir='internals')),
320 loaddoc('extensions', subdir='internals')),
321 (['requirements'], _('Repository Requirements'),
321 (['requirements'], _('Repository Requirements'),
322 loaddoc('requirements', subdir='internals')),
322 loaddoc('requirements', subdir='internals')),
323 (['revlogs'], _('Revision Logs'),
323 (['revlogs'], _('Revision Logs'),
324 loaddoc('revlogs', subdir='internals')),
324 loaddoc('revlogs', subdir='internals')),
325 (['wireprotocol'], _('Wire Protocol'),
325 (['wireprotocol'], _('Wire Protocol'),
326 loaddoc('wireprotocol', subdir='internals')),
326 loaddoc('wireprotocol', subdir='internals')),
327 (['wireprotocolrpc'], _('Wire Protocol RPC'),
327 (['wireprotocolrpc'], _('Wire Protocol RPC'),
328 loaddoc('wireprotocolrpc', subdir='internals')),
328 loaddoc('wireprotocolrpc', subdir='internals')),
329 (['wireprotocolv2'], _('Wire Protocol Version 2'),
329 (['wireprotocolv2'], _('Wire Protocol Version 2'),
330 loaddoc('wireprotocolv2', subdir='internals')),
330 loaddoc('wireprotocolv2', subdir='internals')),
331 ])
331 ])
332
332
333 def internalshelp(ui):
333 def internalshelp(ui):
334 """Generate the index for the "internals" topic."""
334 """Generate the index for the "internals" topic."""
335 lines = ['To access a subtopic, use "hg help internals.{subtopic-name}"\n',
335 lines = ['To access a subtopic, use "hg help internals.{subtopic-name}"\n',
336 '\n']
336 '\n']
337 for names, header, doc in internalstable:
337 for names, header, doc in internalstable:
338 lines.append(' :%s: %s\n' % (names[0], header))
338 lines.append(' :%s: %s\n' % (names[0], header))
339
339
340 return ''.join(lines)
340 return ''.join(lines)
341
341
342 helptable = sorted([
342 helptable = sorted([
343 (['bundlespec'], _("Bundle File Formats"), loaddoc('bundlespec'),
343 (['bundlespec'], _("Bundle File Formats"), loaddoc('bundlespec'),
344 TOPIC_CATEGORY_CONCEPTS),
344 TOPIC_CATEGORY_CONCEPTS),
345 (['color'], _("Colorizing Outputs"), loaddoc('color'),
345 (['color'], _("Colorizing Outputs"), loaddoc('color'),
346 TOPIC_CATEGORY_OUTPUT),
346 TOPIC_CATEGORY_OUTPUT),
347 (["config", "hgrc"], _("Configuration Files"), loaddoc('config'),
347 (["config", "hgrc"], _("Configuration Files"), loaddoc('config'),
348 TOPIC_CATEGORY_CONFIG),
348 TOPIC_CATEGORY_CONFIG),
349 (['deprecated'], _("Deprecated Features"), loaddoc('deprecated'),
349 (['deprecated'], _("Deprecated Features"), loaddoc('deprecated'),
350 TOPIC_CATEGORY_MISC),
350 TOPIC_CATEGORY_MISC),
351 (["dates"], _("Date Formats"), loaddoc('dates'), TOPIC_CATEGORY_OUTPUT),
351 (["dates"], _("Date Formats"), loaddoc('dates'), TOPIC_CATEGORY_OUTPUT),
352 (["flags"], _("Command-line flags"), loaddoc('flags'),
352 (["flags"], _("Command-line flags"), loaddoc('flags'),
353 TOPIC_CATEGORY_CONFIG),
353 TOPIC_CATEGORY_CONFIG),
354 (["patterns"], _("File Name Patterns"), loaddoc('patterns'),
354 (["patterns"], _("File Name Patterns"), loaddoc('patterns'),
355 TOPIC_CATEGORY_IDS),
355 TOPIC_CATEGORY_IDS),
356 (['environment', 'env'], _('Environment Variables'),
356 (['environment', 'env'], _('Environment Variables'),
357 loaddoc('environment'), TOPIC_CATEGORY_CONFIG),
357 loaddoc('environment'), TOPIC_CATEGORY_CONFIG),
358 (['revisions', 'revs', 'revsets', 'revset', 'multirevs', 'mrevs'],
358 (['revisions', 'revs', 'revsets', 'revset', 'multirevs', 'mrevs'],
359 _('Specifying Revisions'), loaddoc('revisions'), TOPIC_CATEGORY_IDS),
359 _('Specifying Revisions'), loaddoc('revisions'), TOPIC_CATEGORY_IDS),
360 (['filesets', 'fileset'], _("Specifying File Sets"), loaddoc('filesets'),
360 (['filesets', 'fileset'], _("Specifying File Sets"), loaddoc('filesets'),
361 TOPIC_CATEGORY_IDS),
361 TOPIC_CATEGORY_IDS),
362 (['diffs'], _('Diff Formats'), loaddoc('diffs'), TOPIC_CATEGORY_OUTPUT),
362 (['diffs'], _('Diff Formats'), loaddoc('diffs'), TOPIC_CATEGORY_OUTPUT),
363 (['merge-tools', 'mergetools', 'mergetool'], _('Merge Tools'),
363 (['merge-tools', 'mergetools', 'mergetool'], _('Merge Tools'),
364 loaddoc('merge-tools'), TOPIC_CATEGORY_CONFIG),
364 loaddoc('merge-tools'), TOPIC_CATEGORY_CONFIG),
365 (['templating', 'templates', 'template', 'style'], _('Template Usage'),
365 (['templating', 'templates', 'template', 'style'], _('Template Usage'),
366 loaddoc('templates'), TOPIC_CATEGORY_OUTPUT),
366 loaddoc('templates'), TOPIC_CATEGORY_OUTPUT),
367 (['urls'], _('URL Paths'), loaddoc('urls'), TOPIC_CATEGORY_IDS),
367 (['urls'], _('URL Paths'), loaddoc('urls'), TOPIC_CATEGORY_IDS),
368 (["extensions"], _("Using Additional Features"), extshelp,
368 (["extensions"], _("Using Additional Features"), extshelp,
369 TOPIC_CATEGORY_CONFIG),
369 TOPIC_CATEGORY_CONFIG),
370 (["subrepos", "subrepo"], _("Subrepositories"), loaddoc('subrepos'),
370 (["subrepos", "subrepo"], _("Subrepositories"), loaddoc('subrepos'),
371 TOPIC_CATEGORY_CONCEPTS),
371 TOPIC_CATEGORY_CONCEPTS),
372 (["hgweb"], _("Configuring hgweb"), loaddoc('hgweb'),
372 (["hgweb"], _("Configuring hgweb"), loaddoc('hgweb'),
373 TOPIC_CATEGORY_CONFIG),
373 TOPIC_CATEGORY_CONFIG),
374 (["glossary"], _("Glossary"), loaddoc('glossary'), TOPIC_CATEGORY_CONCEPTS),
374 (["glossary"], _("Glossary"), loaddoc('glossary'), TOPIC_CATEGORY_CONCEPTS),
375 (["hgignore", "ignore"], _("Syntax for Mercurial Ignore Files"),
375 (["hgignore", "ignore"], _("Syntax for Mercurial Ignore Files"),
376 loaddoc('hgignore'), TOPIC_CATEGORY_IDS),
376 loaddoc('hgignore'), TOPIC_CATEGORY_IDS),
377 (["phases"], _("Working with Phases"), loaddoc('phases'),
377 (["phases"], _("Working with Phases"), loaddoc('phases'),
378 TOPIC_CATEGORY_CONCEPTS),
378 TOPIC_CATEGORY_CONCEPTS),
379 (['scripting'], _('Using Mercurial from scripts and automation'),
379 (['scripting'], _('Using Mercurial from scripts and automation'),
380 loaddoc('scripting'), TOPIC_CATEGORY_MISC),
380 loaddoc('scripting'), TOPIC_CATEGORY_MISC),
381 (['internals'], _("Technical implementation topics"), internalshelp,
381 (['internals'], _("Technical implementation topics"), internalshelp,
382 TOPIC_CATEGORY_MISC),
382 TOPIC_CATEGORY_MISC),
383 (['pager'], _("Pager Support"), loaddoc('pager'), TOPIC_CATEGORY_CONFIG),
383 (['pager'], _("Pager Support"), loaddoc('pager'), TOPIC_CATEGORY_CONFIG),
384 ])
384 ])
385
385
386 # Maps topics with sub-topics to a list of their sub-topics.
386 # Maps topics with sub-topics to a list of their sub-topics.
387 subtopics = {
387 subtopics = {
388 'internals': internalstable,
388 'internals': internalstable,
389 }
389 }
390
390
391 # Map topics to lists of callable taking the current topic help and
391 # Map topics to lists of callable taking the current topic help and
392 # returning the updated version
392 # returning the updated version
393 helphooks = {}
393 helphooks = {}
394
394
395 def addtopichook(topic, rewriter):
395 def addtopichook(topic, rewriter):
396 helphooks.setdefault(topic, []).append(rewriter)
396 helphooks.setdefault(topic, []).append(rewriter)
397
397
398 def makeitemsdoc(ui, topic, doc, marker, items, dedent=False):
398 def makeitemsdoc(ui, topic, doc, marker, items, dedent=False):
399 """Extract docstring from the items key to function mapping, build a
399 """Extract docstring from the items key to function mapping, build a
400 single documentation block and use it to overwrite the marker in doc.
400 single documentation block and use it to overwrite the marker in doc.
401 """
401 """
402 entries = []
402 entries = []
403 for name in sorted(items):
403 for name in sorted(items):
404 text = (pycompat.getdoc(items[name]) or '').rstrip()
404 text = (pycompat.getdoc(items[name]) or '').rstrip()
405 if (not text
405 if (not text
406 or not ui.verbose and any(w in text for w in _exclkeywords)):
406 or not ui.verbose and any(w in text for w in _exclkeywords)):
407 continue
407 continue
408 text = gettext(text)
408 text = gettext(text)
409 if dedent:
409 if dedent:
410 # Abuse latin1 to use textwrap.dedent() on bytes.
410 # Abuse latin1 to use textwrap.dedent() on bytes.
411 text = textwrap.dedent(text.decode('latin1')).encode('latin1')
411 text = textwrap.dedent(text.decode('latin1')).encode('latin1')
412 lines = text.splitlines()
412 lines = text.splitlines()
413 doclines = [(lines[0])]
413 doclines = [(lines[0])]
414 for l in lines[1:]:
414 for l in lines[1:]:
415 # Stop once we find some Python doctest
415 # Stop once we find some Python doctest
416 if l.strip().startswith('>>>'):
416 if l.strip().startswith('>>>'):
417 break
417 break
418 if dedent:
418 if dedent:
419 doclines.append(l.rstrip())
419 doclines.append(l.rstrip())
420 else:
420 else:
421 doclines.append(' ' + l.strip())
421 doclines.append(' ' + l.strip())
422 entries.append('\n'.join(doclines))
422 entries.append('\n'.join(doclines))
423 entries = '\n\n'.join(entries)
423 entries = '\n\n'.join(entries)
424 return doc.replace(marker, entries)
424 return doc.replace(marker, entries)
425
425
426 def addtopicsymbols(topic, marker, symbols, dedent=False):
426 def addtopicsymbols(topic, marker, symbols, dedent=False):
427 def add(ui, topic, doc):
427 def add(ui, topic, doc):
428 return makeitemsdoc(ui, topic, doc, marker, symbols, dedent=dedent)
428 return makeitemsdoc(ui, topic, doc, marker, symbols, dedent=dedent)
429 addtopichook(topic, add)
429 addtopichook(topic, add)
430
430
431 addtopicsymbols('bundlespec', '.. bundlecompressionmarker',
431 addtopicsymbols('bundlespec', '.. bundlecompressionmarker',
432 util.bundlecompressiontopics())
432 util.bundlecompressiontopics())
433 addtopicsymbols('filesets', '.. predicatesmarker', fileset.symbols)
433 addtopicsymbols('filesets', '.. predicatesmarker', fileset.symbols)
434 addtopicsymbols('merge-tools', '.. internaltoolsmarker',
434 addtopicsymbols('merge-tools', '.. internaltoolsmarker',
435 filemerge.internalsdoc)
435 filemerge.internalsdoc)
436 addtopicsymbols('revisions', '.. predicatesmarker', revset.symbols)
436 addtopicsymbols('revisions', '.. predicatesmarker', revset.symbols)
437 addtopicsymbols('templates', '.. keywordsmarker', templatekw.keywords)
437 addtopicsymbols('templates', '.. keywordsmarker', templatekw.keywords)
438 addtopicsymbols('templates', '.. filtersmarker', templatefilters.filters)
438 addtopicsymbols('templates', '.. filtersmarker', templatefilters.filters)
439 addtopicsymbols('templates', '.. functionsmarker', templatefuncs.funcs)
439 addtopicsymbols('templates', '.. functionsmarker', templatefuncs.funcs)
440 addtopicsymbols('hgweb', '.. webcommandsmarker', webcommands.commands,
440 addtopicsymbols('hgweb', '.. webcommandsmarker', webcommands.commands,
441 dedent=True)
441 dedent=True)
442
442
443 def inserttweakrc(ui, topic, doc):
443 def inserttweakrc(ui, topic, doc):
444 marker = '.. tweakdefaultsmarker'
444 marker = '.. tweakdefaultsmarker'
445 repl = uimod.tweakrc
445 repl = uimod.tweakrc
446 def sub(m):
446 def sub(m):
447 lines = [m.group(1) + s for s in repl.splitlines()]
447 lines = [m.group(1) + s for s in repl.splitlines()]
448 return '\n'.join(lines)
448 return '\n'.join(lines)
449 return re.sub(br'( *)%s' % re.escape(marker), sub, doc)
449 return re.sub(br'( *)%s' % re.escape(marker), sub, doc)
450
450
451 addtopichook('config', inserttweakrc)
451 addtopichook('config', inserttweakrc)
452
452
453 def help_(ui, commands, name, unknowncmd=False, full=True, subtopic=None,
453 def help_(ui, commands, name, unknowncmd=False, full=True, subtopic=None,
454 **opts):
454 **opts):
455 '''
455 '''
456 Generate the help for 'name' as unformatted restructured text. If
456 Generate the help for 'name' as unformatted restructured text. If
457 'name' is None, describe the commands available.
457 'name' is None, describe the commands available.
458 '''
458 '''
459
459
460 opts = pycompat.byteskwargs(opts)
460 opts = pycompat.byteskwargs(opts)
461
461
462 def helpcmd(name, subtopic=None):
462 def helpcmd(name, subtopic=None):
463 try:
463 try:
464 aliases, entry = cmdutil.findcmd(name, commands.table,
464 aliases, entry = cmdutil.findcmd(name, commands.table,
465 strict=unknowncmd)
465 strict=unknowncmd)
466 except error.AmbiguousCommand as inst:
466 except error.AmbiguousCommand as inst:
467 # py3 fix: except vars can't be used outside the scope of the
467 # py3 fix: except vars can't be used outside the scope of the
468 # except block, nor can be used inside a lambda. python issue4617
468 # except block, nor can be used inside a lambda. python issue4617
469 prefix = inst.args[0]
469 prefix = inst.args[0]
470 select = lambda c: cmdutil.parsealiases(c)[0].startswith(prefix)
470 select = lambda c: cmdutil.parsealiases(c)[0].startswith(prefix)
471 rst = helplist(select)
471 rst = helplist(select)
472 return rst
472 return rst
473
473
474 rst = []
474 rst = []
475
475
476 # check if it's an invalid alias and display its error if it is
476 # check if it's an invalid alias and display its error if it is
477 if getattr(entry[0], 'badalias', None):
477 if getattr(entry[0], 'badalias', None):
478 rst.append(entry[0].badalias + '\n')
478 rst.append(entry[0].badalias + '\n')
479 if entry[0].unknowncmd:
479 if entry[0].unknowncmd:
480 try:
480 try:
481 rst.extend(helpextcmd(entry[0].cmdname))
481 rst.extend(helpextcmd(entry[0].cmdname))
482 except error.UnknownCommand:
482 except error.UnknownCommand:
483 pass
483 pass
484 return rst
484 return rst
485
485
486 # synopsis
486 # synopsis
487 if len(entry) > 2:
487 if len(entry) > 2:
488 if entry[2].startswith('hg'):
488 if entry[2].startswith('hg'):
489 rst.append("%s\n" % entry[2])
489 rst.append("%s\n" % entry[2])
490 else:
490 else:
491 rst.append('hg %s %s\n' % (aliases[0], entry[2]))
491 rst.append('hg %s %s\n' % (aliases[0], entry[2]))
492 else:
492 else:
493 rst.append('hg %s\n' % aliases[0])
493 rst.append('hg %s\n' % aliases[0])
494 # aliases
494 # aliases
495 if full and not ui.quiet and len(aliases) > 1:
495 if full and not ui.quiet and len(aliases) > 1:
496 rst.append(_("\naliases: %s\n") % ', '.join(aliases[1:]))
496 rst.append(_("\naliases: %s\n") % ', '.join(aliases[1:]))
497 rst.append('\n')
497 rst.append('\n')
498
498
499 # description
499 # description
500 doc = gettext(pycompat.getdoc(entry[0]))
500 doc = gettext(pycompat.getdoc(entry[0]))
501 if not doc:
501 if not doc:
502 doc = _("(no help text available)")
502 doc = _("(no help text available)")
503 if util.safehasattr(entry[0], 'definition'): # aliased command
503 if util.safehasattr(entry[0], 'definition'): # aliased command
504 source = entry[0].source
504 source = entry[0].source
505 if entry[0].definition.startswith('!'): # shell alias
505 if entry[0].definition.startswith('!'): # shell alias
506 doc = (_('shell alias for: %s\n\n%s\n\ndefined by: %s\n') %
506 doc = (_('shell alias for: %s\n\n%s\n\ndefined by: %s\n') %
507 (entry[0].definition[1:], doc, source))
507 (entry[0].definition[1:], doc, source))
508 else:
508 else:
509 doc = (_('alias for: hg %s\n\n%s\n\ndefined by: %s\n') %
509 doc = (_('alias for: hg %s\n\n%s\n\ndefined by: %s\n') %
510 (entry[0].definition, doc, source))
510 (entry[0].definition, doc, source))
511 doc = doc.splitlines(True)
511 doc = doc.splitlines(True)
512 if ui.quiet or not full:
512 if ui.quiet or not full:
513 rst.append(doc[0])
513 rst.append(doc[0])
514 else:
514 else:
515 rst.extend(doc)
515 rst.extend(doc)
516 rst.append('\n')
516 rst.append('\n')
517
517
518 # check if this command shadows a non-trivial (multi-line)
518 # check if this command shadows a non-trivial (multi-line)
519 # extension help text
519 # extension help text
520 try:
520 try:
521 mod = extensions.find(name)
521 mod = extensions.find(name)
522 doc = gettext(pycompat.getdoc(mod)) or ''
522 doc = gettext(pycompat.getdoc(mod)) or ''
523 if '\n' in doc.strip():
523 if '\n' in doc.strip():
524 msg = _("(use 'hg help -e %s' to show help for "
524 msg = _("(use 'hg help -e %s' to show help for "
525 "the %s extension)") % (name, name)
525 "the %s extension)") % (name, name)
526 rst.append('\n%s\n' % msg)
526 rst.append('\n%s\n' % msg)
527 except KeyError:
527 except KeyError:
528 pass
528 pass
529
529
530 # options
530 # options
531 if not ui.quiet and entry[1]:
531 if not ui.quiet and entry[1]:
532 rst.append(optrst(_("options"), entry[1], ui.verbose))
532 rst.append(optrst(_("options"), entry[1], ui.verbose))
533
533
534 if ui.verbose:
534 if ui.verbose:
535 rst.append(optrst(_("global options"),
535 rst.append(optrst(_("global options"),
536 commands.globalopts, ui.verbose))
536 commands.globalopts, ui.verbose))
537
537
538 if not ui.verbose:
538 if not ui.verbose:
539 if not full:
539 if not full:
540 rst.append(_("\n(use 'hg %s -h' to show more help)\n")
540 rst.append(_("\n(use 'hg %s -h' to show more help)\n")
541 % name)
541 % name)
542 elif not ui.quiet:
542 elif not ui.quiet:
543 rst.append(_('\n(some details hidden, use --verbose '
543 rst.append(_('\n(some details hidden, use --verbose '
544 'to show complete help)'))
544 'to show complete help)'))
545
545
546 return rst
546 return rst
547
547
548 def helplist(select=None, **opts):
548 def helplist(select=None, **opts):
549 # Category -> list of commands
549 # Category -> list of commands
550 cats = {}
550 cats = {}
551 # Command -> short description
551 # Command -> short description
552 h = {}
552 h = {}
553 # Command -> string showing synonyms
553 # Command -> string showing synonyms
554 syns = {}
554 syns = {}
555 for c, e in commands.table.iteritems():
555 for c, e in commands.table.iteritems():
556 fs = cmdutil.parsealiases(c)
556 fs = cmdutil.parsealiases(c)
557 f = fs[0]
557 f = fs[0]
558 syns[f] = ', '.join(fs)
558 syns[f] = ', '.join(fs)
559 func = e[0]
559 func = e[0]
560 if select and not select(f):
560 if select and not select(f):
561 continue
561 continue
562 doc = pycompat.getdoc(func)
562 doc = pycompat.getdoc(func)
563 if filtercmd(ui, f, func, name, doc):
563 if filtercmd(ui, f, func, name, doc):
564 continue
564 continue
565 doc = gettext(doc)
565 doc = gettext(doc)
566 if not doc:
566 if not doc:
567 doc = _("(no help text available)")
567 doc = _("(no help text available)")
568 h[f] = doc.splitlines()[0].rstrip()
568 h[f] = doc.splitlines()[0].rstrip()
569
569
570 cat = getattr(func, 'helpcategory', None) or (
570 cat = getattr(func, 'helpcategory', None) or (
571 registrar.command.CATEGORY_NONE)
571 registrar.command.CATEGORY_NONE)
572 cats.setdefault(cat, []).append(f)
572 cats.setdefault(cat, []).append(f)
573
573
574 rst = []
574 rst = []
575 if not h:
575 if not h:
576 if not ui.quiet:
576 if not ui.quiet:
577 rst.append(_('no commands defined\n'))
577 rst.append(_('no commands defined\n'))
578 return rst
578 return rst
579
579
580 # Output top header.
580 # Output top header.
581 if not ui.quiet:
581 if not ui.quiet:
582 if name == "shortlist":
582 if name == "shortlist":
583 rst.append(_('basic commands:\n\n'))
583 rst.append(_('basic commands:\n\n'))
584 elif name == "debug":
584 elif name == "debug":
585 rst.append(_('debug commands (internal and unsupported):\n\n'))
585 rst.append(_('debug commands (internal and unsupported):\n\n'))
586 else:
586 else:
587 rst.append(_('list of commands:\n'))
587 rst.append(_('list of commands:\n'))
588
588
589 def appendcmds(cmds):
589 def appendcmds(cmds):
590 cmds = sorted(cmds)
590 cmds = sorted(cmds)
591 for c in cmds:
591 for c in cmds:
592 if ui.verbose:
592 if ui.verbose:
593 rst.append(" :%s: %s\n" % (syns[c], h[c]))
593 rst.append(" :%s: %s\n" % (syns[c], h[c]))
594 else:
594 else:
595 rst.append(' :%s: %s\n' % (c, h[c]))
595 rst.append(' :%s: %s\n' % (c, h[c]))
596
596
597 if name in ('shortlist', 'debug'):
597 if name in ('shortlist', 'debug'):
598 # List without categories.
598 # List without categories.
599 appendcmds(h)
599 appendcmds(h)
600 else:
600 else:
601 # Check that all categories have an order.
601 # Check that all categories have an order.
602 missing_order = set(cats.keys()) - set(CATEGORY_ORDER)
602 missing_order = set(cats.keys()) - set(CATEGORY_ORDER)
603 if missing_order:
603 if missing_order:
604 ui.develwarn('help categories missing from CATEGORY_ORDER: %s' %
604 ui.develwarn('help categories missing from CATEGORY_ORDER: %s' %
605 missing_order)
605 missing_order)
606
606
607 # List per category.
607 # List per category.
608 for cat in CATEGORY_ORDER:
608 for cat in CATEGORY_ORDER:
609 catfns = cats.get(cat, [])
609 catfns = cats.get(cat, [])
610 if catfns:
610 if catfns:
611 if len(cats) > 1:
611 if len(cats) > 1:
612 catname = gettext(CATEGORY_NAMES[cat])
612 catname = gettext(CATEGORY_NAMES[cat])
613 rst.append("\n%s:\n" % catname)
613 rst.append("\n%s:\n" % catname)
614 rst.append("\n")
614 rst.append("\n")
615 appendcmds(catfns)
615 appendcmds(catfns)
616
616
617 ex = opts.get
617 ex = opts.get
618 anyopts = (ex(r'keyword') or not (ex(r'command') or ex(r'extension')))
618 anyopts = (ex(r'keyword') or not (ex(r'command') or ex(r'extension')))
619 if not name and anyopts:
619 if not name and anyopts:
620 exts = listexts(_('enabled extensions:'), extensions.enabled())
620 exts = listexts(_('enabled extensions:'), extensions.enabled())
621 if exts:
621 if exts:
622 rst.append('\n')
622 rst.append('\n')
623 rst.extend(exts)
623 rst.extend(exts)
624
624
625 rst.append(_("\nadditional help topics:\n"))
625 rst.append(_("\nadditional help topics:\n"))
626 # Group commands by category.
626 # Group commands by category.
627 topiccats = {}
627 topiccats = {}
628 for topic in helptable:
628 for topic in helptable:
629 names, header, doc = topic[0:3]
629 names, header, doc = topic[0:3]
630 if len(topic) > 3 and topic[3]:
630 if len(topic) > 3 and topic[3]:
631 category = topic[3]
631 category = topic[3]
632 else:
632 else:
633 category = TOPIC_CATEGORY_NONE
633 category = TOPIC_CATEGORY_NONE
634
634
635 topicname = names[0]
635 topicname = names[0]
636 if not filtertopic(ui, topicname):
636 if not filtertopic(ui, topicname):
637 topiccats.setdefault(category, []).append(
637 topiccats.setdefault(category, []).append(
638 (topicname, header))
638 (topicname, header))
639
639
640 # Check that all categories have an order.
640 # Check that all categories have an order.
641 missing_order = set(topiccats.keys()) - set(TOPIC_CATEGORY_ORDER)
641 missing_order = set(topiccats.keys()) - set(TOPIC_CATEGORY_ORDER)
642 if missing_order:
642 if missing_order:
643 ui.develwarn(
643 ui.develwarn(
644 'help categories missing from TOPIC_CATEGORY_ORDER: %s' %
644 'help categories missing from TOPIC_CATEGORY_ORDER: %s' %
645 missing_order)
645 missing_order)
646
646
647 # Output topics per category.
647 # Output topics per category.
648 for cat in TOPIC_CATEGORY_ORDER:
648 for cat in TOPIC_CATEGORY_ORDER:
649 topics = topiccats.get(cat, [])
649 topics = topiccats.get(cat, [])
650 if topics:
650 if topics:
651 if len(topiccats) > 1:
651 if len(topiccats) > 1:
652 catname = gettext(TOPIC_CATEGORY_NAMES[cat])
652 catname = gettext(TOPIC_CATEGORY_NAMES[cat])
653 rst.append("\n%s:\n" % catname)
653 rst.append("\n%s:\n" % catname)
654 rst.append("\n")
654 rst.append("\n")
655 for t, desc in topics:
655 for t, desc in topics:
656 rst.append(" :%s: %s\n" % (t, desc))
656 rst.append(" :%s: %s\n" % (t, desc))
657
657
658 if ui.quiet:
658 if ui.quiet:
659 pass
659 pass
660 elif ui.verbose:
660 elif ui.verbose:
661 rst.append('\n%s\n' % optrst(_("global options"),
661 rst.append('\n%s\n' % optrst(_("global options"),
662 commands.globalopts, ui.verbose))
662 commands.globalopts, ui.verbose))
663 if name == 'shortlist':
663 if name == 'shortlist':
664 rst.append(_("\n(use 'hg help' for the full list "
664 rst.append(_("\n(use 'hg help' for the full list "
665 "of commands)\n"))
665 "of commands)\n"))
666 else:
666 else:
667 if name == 'shortlist':
667 if name == 'shortlist':
668 rst.append(_("\n(use 'hg help' for the full list of commands "
668 rst.append(_("\n(use 'hg help' for the full list of commands "
669 "or 'hg -v' for details)\n"))
669 "or 'hg -v' for details)\n"))
670 elif name and not full:
670 elif name and not full:
671 rst.append(_("\n(use 'hg help %s' to show the full help "
671 rst.append(_("\n(use 'hg help %s' to show the full help "
672 "text)\n") % name)
672 "text)\n") % name)
673 elif name and syns and name in syns.keys():
673 elif name and syns and name in syns.keys():
674 rst.append(_("\n(use 'hg help -v -e %s' to show built-in "
674 rst.append(_("\n(use 'hg help -v -e %s' to show built-in "
675 "aliases and global options)\n") % name)
675 "aliases and global options)\n") % name)
676 else:
676 else:
677 rst.append(_("\n(use 'hg help -v%s' to show built-in aliases "
677 rst.append(_("\n(use 'hg help -v%s' to show built-in aliases "
678 "and global options)\n")
678 "and global options)\n")
679 % (name and " " + name or ""))
679 % (name and " " + name or ""))
680 return rst
680 return rst
681
681
682 def helptopic(name, subtopic=None):
682 def helptopic(name, subtopic=None):
683 # Look for sub-topic entry first.
683 # Look for sub-topic entry first.
684 header, doc = None, None
684 header, doc = None, None
685 if subtopic and name in subtopics:
685 if subtopic and name in subtopics:
686 for names, header, doc in subtopics[name]:
686 for names, header, doc in subtopics[name]:
687 if subtopic in names:
687 if subtopic in names:
688 break
688 break
689
689
690 if not header:
690 if not header:
691 for topic in helptable:
691 for topic in helptable:
692 names, header, doc = topic[0:3]
692 names, header, doc = topic[0:3]
693 if name in names:
693 if name in names:
694 break
694 break
695 else:
695 else:
696 raise error.UnknownCommand(name)
696 raise error.UnknownCommand(name)
697
697
698 rst = [minirst.section(header)]
698 rst = [minirst.section(header)]
699
699
700 # description
700 # description
701 if not doc:
701 if not doc:
702 rst.append(" %s\n" % _("(no help text available)"))
702 rst.append(" %s\n" % _("(no help text available)"))
703 if callable(doc):
703 if callable(doc):
704 rst += [" %s\n" % l for l in doc(ui).splitlines()]
704 rst += [" %s\n" % l for l in doc(ui).splitlines()]
705
705
706 if not ui.verbose:
706 if not ui.verbose:
707 omitted = _('(some details hidden, use --verbose'
707 omitted = _('(some details hidden, use --verbose'
708 ' to show complete help)')
708 ' to show complete help)')
709 indicateomitted(rst, omitted)
709 indicateomitted(rst, omitted)
710
710
711 try:
711 try:
712 cmdutil.findcmd(name, commands.table)
712 cmdutil.findcmd(name, commands.table)
713 rst.append(_("\nuse 'hg help -c %s' to see help for "
713 rst.append(_("\nuse 'hg help -c %s' to see help for "
714 "the %s command\n") % (name, name))
714 "the %s command\n") % (name, name))
715 except error.UnknownCommand:
715 except error.UnknownCommand:
716 pass
716 pass
717 return rst
717 return rst
718
718
719 def helpext(name, subtopic=None):
719 def helpext(name, subtopic=None):
720 try:
720 try:
721 mod = extensions.find(name)
721 mod = extensions.find(name)
722 doc = gettext(pycompat.getdoc(mod)) or _('no help text available')
722 doc = gettext(pycompat.getdoc(mod)) or _('no help text available')
723 except KeyError:
723 except KeyError:
724 mod = None
724 mod = None
725 doc = extensions.disabledext(name)
725 doc = extensions.disabledext(name)
726 if not doc:
726 if not doc:
727 raise error.UnknownCommand(name)
727 raise error.UnknownCommand(name)
728
728
729 if '\n' not in doc:
729 if '\n' not in doc:
730 head, tail = doc, ""
730 head, tail = doc, ""
731 else:
731 else:
732 head, tail = doc.split('\n', 1)
732 head, tail = doc.split('\n', 1)
733 rst = [_('%s extension - %s\n\n') % (name.rpartition('.')[-1], head)]
733 rst = [_('%s extension - %s\n\n') % (name.rpartition('.')[-1], head)]
734 if tail:
734 if tail:
735 rst.extend(tail.splitlines(True))
735 rst.extend(tail.splitlines(True))
736 rst.append('\n')
736 rst.append('\n')
737
737
738 if not ui.verbose:
738 if not ui.verbose:
739 omitted = _('(some details hidden, use --verbose'
739 omitted = _('(some details hidden, use --verbose'
740 ' to show complete help)')
740 ' to show complete help)')
741 indicateomitted(rst, omitted)
741 indicateomitted(rst, omitted)
742
742
743 if mod:
743 if mod:
744 try:
744 try:
745 ct = mod.cmdtable
745 ct = mod.cmdtable
746 except AttributeError:
746 except AttributeError:
747 ct = {}
747 ct = {}
748 modcmds = set([c.partition('|')[0] for c in ct])
748 modcmds = set([c.partition('|')[0] for c in ct])
749 rst.extend(helplist(modcmds.__contains__))
749 rst.extend(helplist(modcmds.__contains__))
750 else:
750 else:
751 rst.append(_("(use 'hg help extensions' for information on enabling"
751 rst.append(_("(use 'hg help extensions' for information on enabling"
752 " extensions)\n"))
752 " extensions)\n"))
753 return rst
753 return rst
754
754
755 def helpextcmd(name, subtopic=None):
755 def helpextcmd(name, subtopic=None):
756 cmd, ext, doc = extensions.disabledcmd(ui, name,
756 cmd, ext, doc = extensions.disabledcmd(ui, name,
757 ui.configbool('ui', 'strict'))
757 ui.configbool('ui', 'strict'))
758 doc = doc.splitlines()[0]
758 doc = doc.splitlines()[0]
759
759
760 rst = listexts(_("'%s' is provided by the following "
760 rst = listexts(_("'%s' is provided by the following "
761 "extension:") % cmd, {ext: doc}, indent=4,
761 "extension:") % cmd, {ext: doc}, indent=4,
762 showdeprecated=True)
762 showdeprecated=True)
763 rst.append('\n')
763 rst.append('\n')
764 rst.append(_("(use 'hg help extensions' for information on enabling "
764 rst.append(_("(use 'hg help extensions' for information on enabling "
765 "extensions)\n"))
765 "extensions)\n"))
766 return rst
766 return rst
767
767
768
768
769 rst = []
769 rst = []
770 kw = opts.get('keyword')
770 kw = opts.get('keyword')
771 if kw or name is None and any(opts[o] for o in opts):
771 if kw or name is None and any(opts[o] for o in opts):
772 matches = topicmatch(ui, commands, name or '')
772 matches = topicmatch(ui, commands, name or '')
773 helpareas = []
773 helpareas = []
774 if opts.get('extension'):
774 if opts.get('extension'):
775 helpareas += [('extensions', _('Extensions'))]
775 helpareas += [('extensions', _('Extensions'))]
776 if opts.get('command'):
776 if opts.get('command'):
777 helpareas += [('commands', _('Commands'))]
777 helpareas += [('commands', _('Commands'))]
778 if not helpareas:
778 if not helpareas:
779 helpareas = [('topics', _('Topics')),
779 helpareas = [('topics', _('Topics')),
780 ('commands', _('Commands')),
780 ('commands', _('Commands')),
781 ('extensions', _('Extensions')),
781 ('extensions', _('Extensions')),
782 ('extensioncommands', _('Extension Commands'))]
782 ('extensioncommands', _('Extension Commands'))]
783 for t, title in helpareas:
783 for t, title in helpareas:
784 if matches[t]:
784 if matches[t]:
785 rst.append('%s:\n\n' % title)
785 rst.append('%s:\n\n' % title)
786 rst.extend(minirst.maketable(sorted(matches[t]), 1))
786 rst.extend(minirst.maketable(sorted(matches[t]), 1))
787 rst.append('\n')
787 rst.append('\n')
788 if not rst:
788 if not rst:
789 msg = _('no matches')
789 msg = _('no matches')
790 hint = _("try 'hg help' for a list of topics")
790 hint = _("try 'hg help' for a list of topics")
791 raise error.Abort(msg, hint=hint)
791 raise error.Abort(msg, hint=hint)
792 elif name and name != 'shortlist':
792 elif name and name != 'shortlist':
793 queries = []
793 queries = []
794 if unknowncmd:
794 if unknowncmd:
795 queries += [helpextcmd]
795 queries += [helpextcmd]
796 if opts.get('extension'):
796 if opts.get('extension'):
797 queries += [helpext]
797 queries += [helpext]
798 if opts.get('command'):
798 if opts.get('command'):
799 queries += [helpcmd]
799 queries += [helpcmd]
800 if not queries:
800 if not queries:
801 queries = (helptopic, helpcmd, helpext, helpextcmd)
801 queries = (helptopic, helpcmd, helpext, helpextcmd)
802 for f in queries:
802 for f in queries:
803 try:
803 try:
804 rst = f(name, subtopic)
804 rst = f(name, subtopic)
805 break
805 break
806 except error.UnknownCommand:
806 except error.UnknownCommand:
807 pass
807 pass
808 else:
808 else:
809 if unknowncmd:
809 if unknowncmd:
810 raise error.UnknownCommand(name)
810 raise error.UnknownCommand(name)
811 else:
811 else:
812 msg = _('no such help topic: %s') % name
812 msg = _('no such help topic: %s') % name
813 hint = _("try 'hg help --keyword %s'") % name
813 hint = _("try 'hg help --keyword %s'") % name
814 raise error.Abort(msg, hint=hint)
814 raise error.Abort(msg, hint=hint)
815 else:
815 else:
816 # program name
816 # program name
817 if not ui.quiet:
817 if not ui.quiet:
818 rst = [_("Mercurial Distributed SCM\n"), '\n']
818 rst = [_("Mercurial Distributed SCM\n"), '\n']
819 rst.extend(helplist(None, **pycompat.strkwargs(opts)))
819 rst.extend(helplist(None, **pycompat.strkwargs(opts)))
820
820
821 return ''.join(rst)
821 return ''.join(rst)
822
822
823 def formattedhelp(ui, commands, fullname, keep=None, unknowncmd=False,
823 def formattedhelp(ui, commands, fullname, keep=None, unknowncmd=False,
824 full=True, **opts):
824 full=True, **opts):
825 """get help for a given topic (as a dotted name) as rendered rst
825 """get help for a given topic (as a dotted name) as rendered rst
826
826
827 Either returns the rendered help text or raises an exception.
827 Either returns the rendered help text or raises an exception.
828 """
828 """
829 if keep is None:
829 if keep is None:
830 keep = []
830 keep = []
831 else:
831 else:
832 keep = list(keep) # make a copy so we can mutate this later
832 keep = list(keep) # make a copy so we can mutate this later
833
833
834 # <fullname> := <name>[.<subtopic][.<section>]
834 # <fullname> := <name>[.<subtopic][.<section>]
835 name = subtopic = section = None
835 name = subtopic = section = None
836 if fullname is not None:
836 if fullname is not None:
837 nameparts = fullname.split('.')
837 nameparts = fullname.split('.')
838 name = nameparts.pop(0)
838 name = nameparts.pop(0)
839 if nameparts and name in subtopics:
839 if nameparts and name in subtopics:
840 subtopic = nameparts.pop(0)
840 subtopic = nameparts.pop(0)
841 if nameparts:
841 if nameparts:
842 section = encoding.lower('.'.join(nameparts))
842 section = encoding.lower('.'.join(nameparts))
843
843
844 textwidth = ui.configint('ui', 'textwidth')
844 textwidth = ui.configint('ui', 'textwidth')
845 termwidth = ui.termwidth() - 2
845 termwidth = ui.termwidth() - 2
846 if textwidth <= 0 or termwidth < textwidth:
846 if textwidth <= 0 or termwidth < textwidth:
847 textwidth = termwidth
847 textwidth = termwidth
848 text = help_(ui, commands, name,
848 text = help_(ui, commands, name,
849 subtopic=subtopic, unknowncmd=unknowncmd, full=full, **opts)
849 subtopic=subtopic, unknowncmd=unknowncmd, full=full, **opts)
850
850
851 blocks, pruned = minirst.parse(text, keep=keep)
851 blocks, pruned = minirst.parse(text, keep=keep)
852 if 'verbose' in pruned:
852 if 'verbose' in pruned:
853 keep.append('omitted')
853 keep.append('omitted')
854 else:
854 else:
855 keep.append('notomitted')
855 keep.append('notomitted')
856 blocks, pruned = minirst.parse(text, keep=keep)
856 blocks, pruned = minirst.parse(text, keep=keep)
857 if section:
857 if section:
858 blocks = minirst.filtersections(blocks, section)
858 blocks = minirst.filtersections(blocks, section)
859
859
860 # We could have been given a weird ".foo" section without a name
860 # We could have been given a weird ".foo" section without a name
861 # to look for, or we could have simply failed to found "foo.bar"
861 # to look for, or we could have simply failed to found "foo.bar"
862 # because bar isn't a section of foo
862 # because bar isn't a section of foo
863 if section and not (blocks and name):
863 if section and not (blocks and name):
864 raise error.Abort(_("help section not found: %s") % fullname)
864 raise error.Abort(_("help section not found: %s") % fullname)
865
865
866 return minirst.formatplain(blocks, textwidth)
866 return minirst.formatplain(blocks, textwidth)
@@ -1,1838 +1,1838 b''
1 Test basic extension support
1 Test basic extension support
2 $ cat > unflush.py <<EOF
2 $ cat > unflush.py <<EOF
3 > import sys
3 > import sys
4 > from mercurial import pycompat
4 > from mercurial import pycompat
5 > if pycompat.ispy3:
5 > if pycompat.ispy3:
6 > # no changes required
6 > # no changes required
7 > sys.exit(0)
7 > sys.exit(0)
8 > with open(sys.argv[1], 'rb') as f:
8 > with open(sys.argv[1], 'rb') as f:
9 > data = f.read()
9 > data = f.read()
10 > with open(sys.argv[1], 'wb') as f:
10 > with open(sys.argv[1], 'wb') as f:
11 > f.write(data.replace(b', flush=True', b''))
11 > f.write(data.replace(b', flush=True', b''))
12 > EOF
12 > EOF
13
13
14 $ cat > foobar.py <<EOF
14 $ cat > foobar.py <<EOF
15 > import os
15 > import os
16 > from mercurial import commands, registrar
16 > from mercurial import commands, registrar
17 > cmdtable = {}
17 > cmdtable = {}
18 > command = registrar.command(cmdtable)
18 > command = registrar.command(cmdtable)
19 > configtable = {}
19 > configtable = {}
20 > configitem = registrar.configitem(configtable)
20 > configitem = registrar.configitem(configtable)
21 > configitem(b'tests', b'foo', default=b"Foo")
21 > configitem(b'tests', b'foo', default=b"Foo")
22 > def uisetup(ui):
22 > def uisetup(ui):
23 > ui.debug(b"uisetup called [debug]\\n")
23 > ui.debug(b"uisetup called [debug]\\n")
24 > ui.write(b"uisetup called\\n")
24 > ui.write(b"uisetup called\\n")
25 > ui.status(b"uisetup called [status]\\n")
25 > ui.status(b"uisetup called [status]\\n")
26 > ui.flush()
26 > ui.flush()
27 > def uipopulate(ui):
27 > def uipopulate(ui):
28 > ui._populatecnt = getattr(ui, "_populatecnt", 0) + 1
28 > ui._populatecnt = getattr(ui, "_populatecnt", 0) + 1
29 > ui.write(b"uipopulate called (%d times)\n" % ui._populatecnt)
29 > ui.write(b"uipopulate called (%d times)\n" % ui._populatecnt)
30 > def reposetup(ui, repo):
30 > def reposetup(ui, repo):
31 > ui.write(b"reposetup called for %s\\n" % os.path.basename(repo.root))
31 > ui.write(b"reposetup called for %s\\n" % os.path.basename(repo.root))
32 > ui.write(b"ui %s= repo.ui\\n" % (ui == repo.ui and b"=" or b"!"))
32 > ui.write(b"ui %s= repo.ui\\n" % (ui == repo.ui and b"=" or b"!"))
33 > ui.flush()
33 > ui.flush()
34 > @command(b'foo', [], b'hg foo')
34 > @command(b'foo', [], b'hg foo')
35 > def foo(ui, *args, **kwargs):
35 > def foo(ui, *args, **kwargs):
36 > foo = ui.config(b'tests', b'foo')
36 > foo = ui.config(b'tests', b'foo')
37 > ui.write(foo)
37 > ui.write(foo)
38 > ui.write(b"\\n")
38 > ui.write(b"\\n")
39 > @command(b'bar', [], b'hg bar', norepo=True)
39 > @command(b'bar', [], b'hg bar', norepo=True)
40 > def bar(ui, *args, **kwargs):
40 > def bar(ui, *args, **kwargs):
41 > ui.write(b"Bar\\n")
41 > ui.write(b"Bar\\n")
42 > EOF
42 > EOF
43 $ abspath=`pwd`/foobar.py
43 $ abspath=`pwd`/foobar.py
44
44
45 $ mkdir barfoo
45 $ mkdir barfoo
46 $ cp foobar.py barfoo/__init__.py
46 $ cp foobar.py barfoo/__init__.py
47 $ barfoopath=`pwd`/barfoo
47 $ barfoopath=`pwd`/barfoo
48
48
49 $ hg init a
49 $ hg init a
50 $ cd a
50 $ cd a
51 $ echo foo > file
51 $ echo foo > file
52 $ hg add file
52 $ hg add file
53 $ hg commit -m 'add file'
53 $ hg commit -m 'add file'
54
54
55 $ echo '[extensions]' >> $HGRCPATH
55 $ echo '[extensions]' >> $HGRCPATH
56 $ echo "foobar = $abspath" >> $HGRCPATH
56 $ echo "foobar = $abspath" >> $HGRCPATH
57 $ hg foo
57 $ hg foo
58 uisetup called
58 uisetup called
59 uisetup called [status]
59 uisetup called [status]
60 uipopulate called (1 times)
60 uipopulate called (1 times)
61 uipopulate called (1 times)
61 uipopulate called (1 times)
62 uipopulate called (1 times)
62 uipopulate called (1 times)
63 reposetup called for a
63 reposetup called for a
64 ui == repo.ui
64 ui == repo.ui
65 uipopulate called (1 times) (chg !)
65 uipopulate called (1 times) (chg !)
66 uipopulate called (1 times) (chg !)
66 uipopulate called (1 times) (chg !)
67 uipopulate called (1 times) (chg !)
67 uipopulate called (1 times) (chg !)
68 uipopulate called (1 times) (chg !)
68 uipopulate called (1 times) (chg !)
69 uipopulate called (1 times) (chg !)
69 uipopulate called (1 times) (chg !)
70 reposetup called for a (chg !)
70 reposetup called for a (chg !)
71 ui == repo.ui (chg !)
71 ui == repo.ui (chg !)
72 Foo
72 Foo
73 $ hg foo --quiet
73 $ hg foo --quiet
74 uisetup called (no-chg !)
74 uisetup called (no-chg !)
75 uipopulate called (1 times)
75 uipopulate called (1 times)
76 uipopulate called (1 times)
76 uipopulate called (1 times)
77 uipopulate called (1 times) (chg !)
77 uipopulate called (1 times) (chg !)
78 uipopulate called (1 times) (chg !)
78 uipopulate called (1 times) (chg !)
79 uipopulate called (1 times) (chg !)
79 uipopulate called (1 times) (chg !)
80 reposetup called for a (chg !)
80 reposetup called for a (chg !)
81 ui == repo.ui
81 ui == repo.ui
82 Foo
82 Foo
83 $ hg foo --debug
83 $ hg foo --debug
84 uisetup called [debug] (no-chg !)
84 uisetup called [debug] (no-chg !)
85 uisetup called (no-chg !)
85 uisetup called (no-chg !)
86 uisetup called [status] (no-chg !)
86 uisetup called [status] (no-chg !)
87 uipopulate called (1 times)
87 uipopulate called (1 times)
88 uipopulate called (1 times)
88 uipopulate called (1 times)
89 uipopulate called (1 times) (chg !)
89 uipopulate called (1 times) (chg !)
90 uipopulate called (1 times) (chg !)
90 uipopulate called (1 times) (chg !)
91 uipopulate called (1 times) (chg !)
91 uipopulate called (1 times) (chg !)
92 reposetup called for a (chg !)
92 reposetup called for a (chg !)
93 ui == repo.ui
93 ui == repo.ui
94 Foo
94 Foo
95
95
96 $ cd ..
96 $ cd ..
97 $ hg clone a b
97 $ hg clone a b
98 uisetup called (no-chg !)
98 uisetup called (no-chg !)
99 uisetup called [status] (no-chg !)
99 uisetup called [status] (no-chg !)
100 uipopulate called (1 times)
100 uipopulate called (1 times)
101 uipopulate called (1 times) (chg !)
101 uipopulate called (1 times) (chg !)
102 uipopulate called (1 times) (chg !)
102 uipopulate called (1 times) (chg !)
103 reposetup called for a
103 reposetup called for a
104 ui == repo.ui
104 ui == repo.ui
105 uipopulate called (1 times)
105 uipopulate called (1 times)
106 reposetup called for b
106 reposetup called for b
107 ui == repo.ui
107 ui == repo.ui
108 updating to branch default
108 updating to branch default
109 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
109 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
110
110
111 $ hg bar
111 $ hg bar
112 uisetup called (no-chg !)
112 uisetup called (no-chg !)
113 uisetup called [status] (no-chg !)
113 uisetup called [status] (no-chg !)
114 uipopulate called (1 times)
114 uipopulate called (1 times)
115 uipopulate called (1 times) (chg !)
115 uipopulate called (1 times) (chg !)
116 Bar
116 Bar
117 $ echo 'foobar = !' >> $HGRCPATH
117 $ echo 'foobar = !' >> $HGRCPATH
118
118
119 module/__init__.py-style
119 module/__init__.py-style
120
120
121 $ echo "barfoo = $barfoopath" >> $HGRCPATH
121 $ echo "barfoo = $barfoopath" >> $HGRCPATH
122 $ cd a
122 $ cd a
123 $ hg foo
123 $ hg foo
124 uisetup called
124 uisetup called
125 uisetup called [status]
125 uisetup called [status]
126 uipopulate called (1 times)
126 uipopulate called (1 times)
127 uipopulate called (1 times)
127 uipopulate called (1 times)
128 uipopulate called (1 times)
128 uipopulate called (1 times)
129 reposetup called for a
129 reposetup called for a
130 ui == repo.ui
130 ui == repo.ui
131 uipopulate called (1 times) (chg !)
131 uipopulate called (1 times) (chg !)
132 uipopulate called (1 times) (chg !)
132 uipopulate called (1 times) (chg !)
133 uipopulate called (1 times) (chg !)
133 uipopulate called (1 times) (chg !)
134 uipopulate called (1 times) (chg !)
134 uipopulate called (1 times) (chg !)
135 uipopulate called (1 times) (chg !)
135 uipopulate called (1 times) (chg !)
136 reposetup called for a (chg !)
136 reposetup called for a (chg !)
137 ui == repo.ui (chg !)
137 ui == repo.ui (chg !)
138 Foo
138 Foo
139 $ echo 'barfoo = !' >> $HGRCPATH
139 $ echo 'barfoo = !' >> $HGRCPATH
140
140
141 Check that extensions are loaded in phases:
141 Check that extensions are loaded in phases:
142
142
143 $ cat > foo.py <<EOF
143 $ cat > foo.py <<EOF
144 > from __future__ import print_function
144 > from __future__ import print_function
145 > import os
145 > import os
146 > name = os.path.basename(__file__).rsplit('.', 1)[0]
146 > name = os.path.basename(__file__).rsplit('.', 1)[0]
147 > print("1) %s imported" % name, flush=True)
147 > print("1) %s imported" % name, flush=True)
148 > def uisetup(ui):
148 > def uisetup(ui):
149 > print("2) %s uisetup" % name, flush=True)
149 > print("2) %s uisetup" % name, flush=True)
150 > def extsetup():
150 > def extsetup():
151 > print("3) %s extsetup" % name, flush=True)
151 > print("3) %s extsetup" % name, flush=True)
152 > def uipopulate(ui):
152 > def uipopulate(ui):
153 > print("4) %s uipopulate" % name, flush=True)
153 > print("4) %s uipopulate" % name, flush=True)
154 > def reposetup(ui, repo):
154 > def reposetup(ui, repo):
155 > print("5) %s reposetup" % name, flush=True)
155 > print("5) %s reposetup" % name, flush=True)
156 >
156 >
157 > bytesname = name.encode('utf-8')
157 > bytesname = name.encode('utf-8')
158 > # custom predicate to check registration of functions at loading
158 > # custom predicate to check registration of functions at loading
159 > from mercurial import (
159 > from mercurial import (
160 > registrar,
160 > registrar,
161 > smartset,
161 > smartset,
162 > )
162 > )
163 > revsetpredicate = registrar.revsetpredicate()
163 > revsetpredicate = registrar.revsetpredicate()
164 > @revsetpredicate(bytesname, safe=True) # safe=True for query via hgweb
164 > @revsetpredicate(bytesname, safe=True) # safe=True for query via hgweb
165 > def custompredicate(repo, subset, x):
165 > def custompredicate(repo, subset, x):
166 > return smartset.baseset([r for r in subset if r in {0}])
166 > return smartset.baseset([r for r in subset if r in {0}])
167 > EOF
167 > EOF
168 $ "$PYTHON" $TESTTMP/unflush.py foo.py
168 $ "$PYTHON" $TESTTMP/unflush.py foo.py
169
169
170 $ cp foo.py bar.py
170 $ cp foo.py bar.py
171 $ echo 'foo = foo.py' >> $HGRCPATH
171 $ echo 'foo = foo.py' >> $HGRCPATH
172 $ echo 'bar = bar.py' >> $HGRCPATH
172 $ echo 'bar = bar.py' >> $HGRCPATH
173
173
174 Check normal command's load order of extensions and registration of functions
174 Check normal command's load order of extensions and registration of functions
175
175
176 $ hg log -r "foo() and bar()" -q
176 $ hg log -r "foo() and bar()" -q
177 1) foo imported
177 1) foo imported
178 1) bar imported
178 1) bar imported
179 2) foo uisetup
179 2) foo uisetup
180 2) bar uisetup
180 2) bar uisetup
181 3) foo extsetup
181 3) foo extsetup
182 3) bar extsetup
182 3) bar extsetup
183 4) foo uipopulate
183 4) foo uipopulate
184 4) bar uipopulate
184 4) bar uipopulate
185 4) foo uipopulate
185 4) foo uipopulate
186 4) bar uipopulate
186 4) bar uipopulate
187 4) foo uipopulate
187 4) foo uipopulate
188 4) bar uipopulate
188 4) bar uipopulate
189 5) foo reposetup
189 5) foo reposetup
190 5) bar reposetup
190 5) bar reposetup
191 0:c24b9ac61126
191 0:c24b9ac61126
192
192
193 Check hgweb's load order of extensions and registration of functions
193 Check hgweb's load order of extensions and registration of functions
194
194
195 $ cat > hgweb.cgi <<EOF
195 $ cat > hgweb.cgi <<EOF
196 > #!$PYTHON
196 > #!$PYTHON
197 > from mercurial import demandimport; demandimport.enable()
197 > from mercurial import demandimport; demandimport.enable()
198 > from mercurial.hgweb import hgweb
198 > from mercurial.hgweb import hgweb
199 > from mercurial.hgweb import wsgicgi
199 > from mercurial.hgweb import wsgicgi
200 > application = hgweb(b'.', b'test repo')
200 > application = hgweb(b'.', b'test repo')
201 > wsgicgi.launch(application)
201 > wsgicgi.launch(application)
202 > EOF
202 > EOF
203 $ . "$TESTDIR/cgienv"
203 $ . "$TESTDIR/cgienv"
204
204
205 $ PATH_INFO='/' SCRIPT_NAME='' "$PYTHON" hgweb.cgi \
205 $ PATH_INFO='/' SCRIPT_NAME='' "$PYTHON" hgweb.cgi \
206 > | grep '^[0-9]) ' # ignores HTML output
206 > | grep '^[0-9]) ' # ignores HTML output
207 1) foo imported
207 1) foo imported
208 1) bar imported
208 1) bar imported
209 2) foo uisetup
209 2) foo uisetup
210 2) bar uisetup
210 2) bar uisetup
211 3) foo extsetup
211 3) foo extsetup
212 3) bar extsetup
212 3) bar extsetup
213 4) foo uipopulate
213 4) foo uipopulate
214 4) bar uipopulate
214 4) bar uipopulate
215 4) foo uipopulate
215 4) foo uipopulate
216 4) bar uipopulate
216 4) bar uipopulate
217 5) foo reposetup
217 5) foo reposetup
218 5) bar reposetup
218 5) bar reposetup
219
219
220 (check that revset predicate foo() and bar() are available)
220 (check that revset predicate foo() and bar() are available)
221
221
222 #if msys
222 #if msys
223 $ PATH_INFO='//shortlog'
223 $ PATH_INFO='//shortlog'
224 #else
224 #else
225 $ PATH_INFO='/shortlog'
225 $ PATH_INFO='/shortlog'
226 #endif
226 #endif
227 $ export PATH_INFO
227 $ export PATH_INFO
228 $ SCRIPT_NAME='' QUERY_STRING='rev=foo() and bar()' "$PYTHON" hgweb.cgi \
228 $ SCRIPT_NAME='' QUERY_STRING='rev=foo() and bar()' "$PYTHON" hgweb.cgi \
229 > | grep '<a href="/rev/[0-9a-z]*">'
229 > | grep '<a href="/rev/[0-9a-z]*">'
230 <a href="/rev/c24b9ac61126">add file</a>
230 <a href="/rev/c24b9ac61126">add file</a>
231
231
232 $ echo 'foo = !' >> $HGRCPATH
232 $ echo 'foo = !' >> $HGRCPATH
233 $ echo 'bar = !' >> $HGRCPATH
233 $ echo 'bar = !' >> $HGRCPATH
234
234
235 Check "from __future__ import absolute_import" support for external libraries
235 Check "from __future__ import absolute_import" support for external libraries
236
236
237 (import-checker.py reports issues for some of heredoc python code
237 (import-checker.py reports issues for some of heredoc python code
238 fragments below, because import-checker.py does not know test specific
238 fragments below, because import-checker.py does not know test specific
239 package hierarchy. NO_CHECK_* should be used as a limit mark of
239 package hierarchy. NO_CHECK_* should be used as a limit mark of
240 heredoc, in order to make import-checker.py ignore them. For
240 heredoc, in order to make import-checker.py ignore them. For
241 simplicity, all python code fragments below are generated with such
241 simplicity, all python code fragments below are generated with such
242 limit mark, regardless of importing module or not.)
242 limit mark, regardless of importing module or not.)
243
243
244 #if windows
244 #if windows
245 $ PATHSEP=";"
245 $ PATHSEP=";"
246 #else
246 #else
247 $ PATHSEP=":"
247 $ PATHSEP=":"
248 #endif
248 #endif
249 $ export PATHSEP
249 $ export PATHSEP
250
250
251 $ mkdir $TESTTMP/libroot
251 $ mkdir $TESTTMP/libroot
252 $ echo "s = 'libroot/ambig.py'" > $TESTTMP/libroot/ambig.py
252 $ echo "s = 'libroot/ambig.py'" > $TESTTMP/libroot/ambig.py
253 $ mkdir $TESTTMP/libroot/mod
253 $ mkdir $TESTTMP/libroot/mod
254 $ touch $TESTTMP/libroot/mod/__init__.py
254 $ touch $TESTTMP/libroot/mod/__init__.py
255 $ echo "s = 'libroot/mod/ambig.py'" > $TESTTMP/libroot/mod/ambig.py
255 $ echo "s = 'libroot/mod/ambig.py'" > $TESTTMP/libroot/mod/ambig.py
256
256
257 $ cat > $TESTTMP/libroot/mod/ambigabs.py <<NO_CHECK_EOF
257 $ cat > $TESTTMP/libroot/mod/ambigabs.py <<NO_CHECK_EOF
258 > from __future__ import absolute_import, print_function
258 > from __future__ import absolute_import, print_function
259 > import ambig # should load "libroot/ambig.py"
259 > import ambig # should load "libroot/ambig.py"
260 > s = ambig.s
260 > s = ambig.s
261 > NO_CHECK_EOF
261 > NO_CHECK_EOF
262 $ cat > loadabs.py <<NO_CHECK_EOF
262 $ cat > loadabs.py <<NO_CHECK_EOF
263 > import mod.ambigabs as ambigabs
263 > import mod.ambigabs as ambigabs
264 > def extsetup():
264 > def extsetup():
265 > print('ambigabs.s=%s' % ambigabs.s, flush=True)
265 > print('ambigabs.s=%s' % ambigabs.s, flush=True)
266 > NO_CHECK_EOF
266 > NO_CHECK_EOF
267 $ "$PYTHON" $TESTTMP/unflush.py loadabs.py
267 $ "$PYTHON" $TESTTMP/unflush.py loadabs.py
268 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadabs=loadabs.py root)
268 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadabs=loadabs.py root)
269 ambigabs.s=libroot/ambig.py
269 ambigabs.s=libroot/ambig.py
270 $TESTTMP/a
270 $TESTTMP/a
271
271
272 #if no-py3
272 #if no-py3
273 $ cat > $TESTTMP/libroot/mod/ambigrel.py <<NO_CHECK_EOF
273 $ cat > $TESTTMP/libroot/mod/ambigrel.py <<NO_CHECK_EOF
274 > from __future__ import print_function
274 > from __future__ import print_function
275 > import ambig # should load "libroot/mod/ambig.py"
275 > import ambig # should load "libroot/mod/ambig.py"
276 > s = ambig.s
276 > s = ambig.s
277 > NO_CHECK_EOF
277 > NO_CHECK_EOF
278 $ cat > loadrel.py <<NO_CHECK_EOF
278 $ cat > loadrel.py <<NO_CHECK_EOF
279 > import mod.ambigrel as ambigrel
279 > import mod.ambigrel as ambigrel
280 > def extsetup():
280 > def extsetup():
281 > print('ambigrel.s=%s' % ambigrel.s, flush=True)
281 > print('ambigrel.s=%s' % ambigrel.s, flush=True)
282 > NO_CHECK_EOF
282 > NO_CHECK_EOF
283 $ "$PYTHON" $TESTTMP/unflush.py loadrel.py
283 $ "$PYTHON" $TESTTMP/unflush.py loadrel.py
284 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadrel=loadrel.py root)
284 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadrel=loadrel.py root)
285 ambigrel.s=libroot/mod/ambig.py
285 ambigrel.s=libroot/mod/ambig.py
286 $TESTTMP/a
286 $TESTTMP/a
287 #endif
287 #endif
288
288
289 Check absolute/relative import of extension specific modules
289 Check absolute/relative import of extension specific modules
290
290
291 $ mkdir $TESTTMP/extroot
291 $ mkdir $TESTTMP/extroot
292 $ cat > $TESTTMP/extroot/bar.py <<NO_CHECK_EOF
292 $ cat > $TESTTMP/extroot/bar.py <<NO_CHECK_EOF
293 > s = b'this is extroot.bar'
293 > s = b'this is extroot.bar'
294 > NO_CHECK_EOF
294 > NO_CHECK_EOF
295 $ mkdir $TESTTMP/extroot/sub1
295 $ mkdir $TESTTMP/extroot/sub1
296 $ cat > $TESTTMP/extroot/sub1/__init__.py <<NO_CHECK_EOF
296 $ cat > $TESTTMP/extroot/sub1/__init__.py <<NO_CHECK_EOF
297 > s = b'this is extroot.sub1.__init__'
297 > s = b'this is extroot.sub1.__init__'
298 > NO_CHECK_EOF
298 > NO_CHECK_EOF
299 $ cat > $TESTTMP/extroot/sub1/baz.py <<NO_CHECK_EOF
299 $ cat > $TESTTMP/extroot/sub1/baz.py <<NO_CHECK_EOF
300 > s = b'this is extroot.sub1.baz'
300 > s = b'this is extroot.sub1.baz'
301 > NO_CHECK_EOF
301 > NO_CHECK_EOF
302 $ cat > $TESTTMP/extroot/__init__.py <<NO_CHECK_EOF
302 $ cat > $TESTTMP/extroot/__init__.py <<NO_CHECK_EOF
303 > from __future__ import absolute_import
303 > from __future__ import absolute_import
304 > s = b'this is extroot.__init__'
304 > s = b'this is extroot.__init__'
305 > from . import foo
305 > from . import foo
306 > def extsetup(ui):
306 > def extsetup(ui):
307 > ui.write(b'(extroot) ', foo.func(), b'\n')
307 > ui.write(b'(extroot) ', foo.func(), b'\n')
308 > ui.flush()
308 > ui.flush()
309 > NO_CHECK_EOF
309 > NO_CHECK_EOF
310
310
311 $ cat > $TESTTMP/extroot/foo.py <<NO_CHECK_EOF
311 $ cat > $TESTTMP/extroot/foo.py <<NO_CHECK_EOF
312 > # test absolute import
312 > # test absolute import
313 > buf = []
313 > buf = []
314 > def func():
314 > def func():
315 > # "not locals" case
315 > # "not locals" case
316 > import extroot.bar
316 > import extroot.bar
317 > buf.append(b'import extroot.bar in func(): %s' % extroot.bar.s)
317 > buf.append(b'import extroot.bar in func(): %s' % extroot.bar.s)
318 > return b'\n(extroot) '.join(buf)
318 > return b'\n(extroot) '.join(buf)
319 > # b"fromlist == ('*',)" case
319 > # b"fromlist == ('*',)" case
320 > from extroot.bar import *
320 > from extroot.bar import *
321 > buf.append(b'from extroot.bar import *: %s' % s)
321 > buf.append(b'from extroot.bar import *: %s' % s)
322 > # "not fromlist" and "if '.' in name" case
322 > # "not fromlist" and "if '.' in name" case
323 > import extroot.sub1.baz
323 > import extroot.sub1.baz
324 > buf.append(b'import extroot.sub1.baz: %s' % extroot.sub1.baz.s)
324 > buf.append(b'import extroot.sub1.baz: %s' % extroot.sub1.baz.s)
325 > # "not fromlist" and NOT "if '.' in name" case
325 > # "not fromlist" and NOT "if '.' in name" case
326 > import extroot
326 > import extroot
327 > buf.append(b'import extroot: %s' % extroot.s)
327 > buf.append(b'import extroot: %s' % extroot.s)
328 > # NOT "not fromlist" and NOT "level != -1" case
328 > # NOT "not fromlist" and NOT "level != -1" case
329 > from extroot.bar import s
329 > from extroot.bar import s
330 > buf.append(b'from extroot.bar import s: %s' % s)
330 > buf.append(b'from extroot.bar import s: %s' % s)
331 > NO_CHECK_EOF
331 > NO_CHECK_EOF
332 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.extroot=$TESTTMP/extroot root)
332 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.extroot=$TESTTMP/extroot root)
333 (extroot) from extroot.bar import *: this is extroot.bar
333 (extroot) from extroot.bar import *: this is extroot.bar
334 (extroot) import extroot.sub1.baz: this is extroot.sub1.baz
334 (extroot) import extroot.sub1.baz: this is extroot.sub1.baz
335 (extroot) import extroot: this is extroot.__init__
335 (extroot) import extroot: this is extroot.__init__
336 (extroot) from extroot.bar import s: this is extroot.bar
336 (extroot) from extroot.bar import s: this is extroot.bar
337 (extroot) import extroot.bar in func(): this is extroot.bar
337 (extroot) import extroot.bar in func(): this is extroot.bar
338 $TESTTMP/a
338 $TESTTMP/a
339
339
340 #if no-py3
340 #if no-py3
341 $ rm "$TESTTMP"/extroot/foo.*
341 $ rm "$TESTTMP"/extroot/foo.*
342 $ rm -Rf "$TESTTMP/extroot/__pycache__"
342 $ rm -Rf "$TESTTMP/extroot/__pycache__"
343 $ cat > $TESTTMP/extroot/foo.py <<NO_CHECK_EOF
343 $ cat > $TESTTMP/extroot/foo.py <<NO_CHECK_EOF
344 > # test relative import
344 > # test relative import
345 > buf = []
345 > buf = []
346 > def func():
346 > def func():
347 > # "not locals" case
347 > # "not locals" case
348 > import bar
348 > import bar
349 > buf.append('import bar in func(): %s' % bar.s)
349 > buf.append('import bar in func(): %s' % bar.s)
350 > return '\n(extroot) '.join(buf)
350 > return '\n(extroot) '.join(buf)
351 > # "fromlist == ('*',)" case
351 > # "fromlist == ('*',)" case
352 > from bar import *
352 > from bar import *
353 > buf.append('from bar import *: %s' % s)
353 > buf.append('from bar import *: %s' % s)
354 > # "not fromlist" and "if '.' in name" case
354 > # "not fromlist" and "if '.' in name" case
355 > import sub1.baz
355 > import sub1.baz
356 > buf.append('import sub1.baz: %s' % sub1.baz.s)
356 > buf.append('import sub1.baz: %s' % sub1.baz.s)
357 > # "not fromlist" and NOT "if '.' in name" case
357 > # "not fromlist" and NOT "if '.' in name" case
358 > import sub1
358 > import sub1
359 > buf.append('import sub1: %s' % sub1.s)
359 > buf.append('import sub1: %s' % sub1.s)
360 > # NOT "not fromlist" and NOT "level != -1" case
360 > # NOT "not fromlist" and NOT "level != -1" case
361 > from bar import s
361 > from bar import s
362 > buf.append('from bar import s: %s' % s)
362 > buf.append('from bar import s: %s' % s)
363 > NO_CHECK_EOF
363 > NO_CHECK_EOF
364 $ hg --config extensions.extroot=$TESTTMP/extroot root
364 $ hg --config extensions.extroot=$TESTTMP/extroot root
365 (extroot) from bar import *: this is extroot.bar
365 (extroot) from bar import *: this is extroot.bar
366 (extroot) import sub1.baz: this is extroot.sub1.baz
366 (extroot) import sub1.baz: this is extroot.sub1.baz
367 (extroot) import sub1: this is extroot.sub1.__init__
367 (extroot) import sub1: this is extroot.sub1.__init__
368 (extroot) from bar import s: this is extroot.bar
368 (extroot) from bar import s: this is extroot.bar
369 (extroot) import bar in func(): this is extroot.bar
369 (extroot) import bar in func(): this is extroot.bar
370 $TESTTMP/a
370 $TESTTMP/a
371 #endif
371 #endif
372
372
373 #if demandimport
373 #if demandimport
374
374
375 Examine whether module loading is delayed until actual referring, even
375 Examine whether module loading is delayed until actual referring, even
376 though module is imported with "absolute_import" feature.
376 though module is imported with "absolute_import" feature.
377
377
378 Files below in each packages are used for described purpose:
378 Files below in each packages are used for described purpose:
379
379
380 - "called": examine whether "from MODULE import ATTR" works correctly
380 - "called": examine whether "from MODULE import ATTR" works correctly
381 - "unused": examine whether loading is delayed correctly
381 - "unused": examine whether loading is delayed correctly
382 - "used": examine whether "from PACKAGE import MODULE" works correctly
382 - "used": examine whether "from PACKAGE import MODULE" works correctly
383
383
384 Package hierarchy is needed to examine whether demand importing works
384 Package hierarchy is needed to examine whether demand importing works
385 as expected for "from SUB.PACK.AGE import MODULE".
385 as expected for "from SUB.PACK.AGE import MODULE".
386
386
387 Setup "external library" to be imported with "absolute_import"
387 Setup "external library" to be imported with "absolute_import"
388 feature.
388 feature.
389
389
390 $ mkdir -p $TESTTMP/extlibroot/lsub1/lsub2
390 $ mkdir -p $TESTTMP/extlibroot/lsub1/lsub2
391 $ touch $TESTTMP/extlibroot/__init__.py
391 $ touch $TESTTMP/extlibroot/__init__.py
392 $ touch $TESTTMP/extlibroot/lsub1/__init__.py
392 $ touch $TESTTMP/extlibroot/lsub1/__init__.py
393 $ touch $TESTTMP/extlibroot/lsub1/lsub2/__init__.py
393 $ touch $TESTTMP/extlibroot/lsub1/lsub2/__init__.py
394
394
395 $ cat > $TESTTMP/extlibroot/lsub1/lsub2/called.py <<NO_CHECK_EOF
395 $ cat > $TESTTMP/extlibroot/lsub1/lsub2/called.py <<NO_CHECK_EOF
396 > def func():
396 > def func():
397 > return b"this is extlibroot.lsub1.lsub2.called.func()"
397 > return b"this is extlibroot.lsub1.lsub2.called.func()"
398 > NO_CHECK_EOF
398 > NO_CHECK_EOF
399 $ cat > $TESTTMP/extlibroot/lsub1/lsub2/unused.py <<NO_CHECK_EOF
399 $ cat > $TESTTMP/extlibroot/lsub1/lsub2/unused.py <<NO_CHECK_EOF
400 > raise Exception("extlibroot.lsub1.lsub2.unused is loaded unintentionally")
400 > raise Exception("extlibroot.lsub1.lsub2.unused is loaded unintentionally")
401 > NO_CHECK_EOF
401 > NO_CHECK_EOF
402 $ cat > $TESTTMP/extlibroot/lsub1/lsub2/used.py <<NO_CHECK_EOF
402 $ cat > $TESTTMP/extlibroot/lsub1/lsub2/used.py <<NO_CHECK_EOF
403 > detail = b"this is extlibroot.lsub1.lsub2.used"
403 > detail = b"this is extlibroot.lsub1.lsub2.used"
404 > NO_CHECK_EOF
404 > NO_CHECK_EOF
405
405
406 Setup sub-package of "external library", which causes instantiation of
406 Setup sub-package of "external library", which causes instantiation of
407 demandmod in "recurse down the module chain" code path. Relative
407 demandmod in "recurse down the module chain" code path. Relative
408 importing with "absolute_import" feature isn't tested, because "level
408 importing with "absolute_import" feature isn't tested, because "level
409 >=1 " doesn't cause instantiation of demandmod.
409 >=1 " doesn't cause instantiation of demandmod.
410
410
411 $ mkdir -p $TESTTMP/extlibroot/recursedown/abs
411 $ mkdir -p $TESTTMP/extlibroot/recursedown/abs
412 $ cat > $TESTTMP/extlibroot/recursedown/abs/used.py <<NO_CHECK_EOF
412 $ cat > $TESTTMP/extlibroot/recursedown/abs/used.py <<NO_CHECK_EOF
413 > detail = b"this is extlibroot.recursedown.abs.used"
413 > detail = b"this is extlibroot.recursedown.abs.used"
414 > NO_CHECK_EOF
414 > NO_CHECK_EOF
415 $ cat > $TESTTMP/extlibroot/recursedown/abs/__init__.py <<NO_CHECK_EOF
415 $ cat > $TESTTMP/extlibroot/recursedown/abs/__init__.py <<NO_CHECK_EOF
416 > from __future__ import absolute_import
416 > from __future__ import absolute_import
417 > from extlibroot.recursedown.abs.used import detail
417 > from extlibroot.recursedown.abs.used import detail
418 > NO_CHECK_EOF
418 > NO_CHECK_EOF
419
419
420 $ mkdir -p $TESTTMP/extlibroot/recursedown/legacy
420 $ mkdir -p $TESTTMP/extlibroot/recursedown/legacy
421 $ cat > $TESTTMP/extlibroot/recursedown/legacy/used.py <<NO_CHECK_EOF
421 $ cat > $TESTTMP/extlibroot/recursedown/legacy/used.py <<NO_CHECK_EOF
422 > detail = b"this is extlibroot.recursedown.legacy.used"
422 > detail = b"this is extlibroot.recursedown.legacy.used"
423 > NO_CHECK_EOF
423 > NO_CHECK_EOF
424 $ cat > $TESTTMP/extlibroot/recursedown/legacy/__init__.py <<NO_CHECK_EOF
424 $ cat > $TESTTMP/extlibroot/recursedown/legacy/__init__.py <<NO_CHECK_EOF
425 > # legacy style (level == -1) import
425 > # legacy style (level == -1) import
426 > from extlibroot.recursedown.legacy.used import detail
426 > from extlibroot.recursedown.legacy.used import detail
427 > NO_CHECK_EOF
427 > NO_CHECK_EOF
428
428
429 $ cat > $TESTTMP/extlibroot/recursedown/__init__.py <<NO_CHECK_EOF
429 $ cat > $TESTTMP/extlibroot/recursedown/__init__.py <<NO_CHECK_EOF
430 > from __future__ import absolute_import
430 > from __future__ import absolute_import
431 > from extlibroot.recursedown.abs import detail as absdetail
431 > from extlibroot.recursedown.abs import detail as absdetail
432 > from .legacy import detail as legacydetail
432 > from .legacy import detail as legacydetail
433 > NO_CHECK_EOF
433 > NO_CHECK_EOF
434
434
435 Setup package that re-exports an attribute of its submodule as the same
435 Setup package that re-exports an attribute of its submodule as the same
436 name. This leaves 'shadowing.used' pointing to 'used.detail', but still
436 name. This leaves 'shadowing.used' pointing to 'used.detail', but still
437 the submodule 'used' should be somehow accessible. (issue5617)
437 the submodule 'used' should be somehow accessible. (issue5617)
438
438
439 $ mkdir -p $TESTTMP/extlibroot/shadowing
439 $ mkdir -p $TESTTMP/extlibroot/shadowing
440 $ cat > $TESTTMP/extlibroot/shadowing/used.py <<NO_CHECK_EOF
440 $ cat > $TESTTMP/extlibroot/shadowing/used.py <<NO_CHECK_EOF
441 > detail = b"this is extlibroot.shadowing.used"
441 > detail = b"this is extlibroot.shadowing.used"
442 > NO_CHECK_EOF
442 > NO_CHECK_EOF
443 $ cat > $TESTTMP/extlibroot/shadowing/proxied.py <<NO_CHECK_EOF
443 $ cat > $TESTTMP/extlibroot/shadowing/proxied.py <<NO_CHECK_EOF
444 > from __future__ import absolute_import
444 > from __future__ import absolute_import
445 > from extlibroot.shadowing.used import detail
445 > from extlibroot.shadowing.used import detail
446 > NO_CHECK_EOF
446 > NO_CHECK_EOF
447 $ cat > $TESTTMP/extlibroot/shadowing/__init__.py <<NO_CHECK_EOF
447 $ cat > $TESTTMP/extlibroot/shadowing/__init__.py <<NO_CHECK_EOF
448 > from __future__ import absolute_import
448 > from __future__ import absolute_import
449 > from .used import detail as used
449 > from .used import detail as used
450 > NO_CHECK_EOF
450 > NO_CHECK_EOF
451
451
452 Setup extension local modules to be imported with "absolute_import"
452 Setup extension local modules to be imported with "absolute_import"
453 feature.
453 feature.
454
454
455 $ mkdir -p $TESTTMP/absextroot/xsub1/xsub2
455 $ mkdir -p $TESTTMP/absextroot/xsub1/xsub2
456 $ touch $TESTTMP/absextroot/xsub1/__init__.py
456 $ touch $TESTTMP/absextroot/xsub1/__init__.py
457 $ touch $TESTTMP/absextroot/xsub1/xsub2/__init__.py
457 $ touch $TESTTMP/absextroot/xsub1/xsub2/__init__.py
458
458
459 $ cat > $TESTTMP/absextroot/xsub1/xsub2/called.py <<NO_CHECK_EOF
459 $ cat > $TESTTMP/absextroot/xsub1/xsub2/called.py <<NO_CHECK_EOF
460 > def func():
460 > def func():
461 > return b"this is absextroot.xsub1.xsub2.called.func()"
461 > return b"this is absextroot.xsub1.xsub2.called.func()"
462 > NO_CHECK_EOF
462 > NO_CHECK_EOF
463 $ cat > $TESTTMP/absextroot/xsub1/xsub2/unused.py <<NO_CHECK_EOF
463 $ cat > $TESTTMP/absextroot/xsub1/xsub2/unused.py <<NO_CHECK_EOF
464 > raise Exception("absextroot.xsub1.xsub2.unused is loaded unintentionally")
464 > raise Exception("absextroot.xsub1.xsub2.unused is loaded unintentionally")
465 > NO_CHECK_EOF
465 > NO_CHECK_EOF
466 $ cat > $TESTTMP/absextroot/xsub1/xsub2/used.py <<NO_CHECK_EOF
466 $ cat > $TESTTMP/absextroot/xsub1/xsub2/used.py <<NO_CHECK_EOF
467 > detail = b"this is absextroot.xsub1.xsub2.used"
467 > detail = b"this is absextroot.xsub1.xsub2.used"
468 > NO_CHECK_EOF
468 > NO_CHECK_EOF
469
469
470 Setup extension local modules to examine whether demand importing
470 Setup extension local modules to examine whether demand importing
471 works as expected in "level > 1" case.
471 works as expected in "level > 1" case.
472
472
473 $ cat > $TESTTMP/absextroot/relimportee.py <<NO_CHECK_EOF
473 $ cat > $TESTTMP/absextroot/relimportee.py <<NO_CHECK_EOF
474 > detail = b"this is absextroot.relimportee"
474 > detail = b"this is absextroot.relimportee"
475 > NO_CHECK_EOF
475 > NO_CHECK_EOF
476 $ cat > $TESTTMP/absextroot/xsub1/xsub2/relimporter.py <<NO_CHECK_EOF
476 $ cat > $TESTTMP/absextroot/xsub1/xsub2/relimporter.py <<NO_CHECK_EOF
477 > from __future__ import absolute_import
477 > from __future__ import absolute_import
478 > from mercurial import pycompat
478 > from mercurial import pycompat
479 > from ... import relimportee
479 > from ... import relimportee
480 > detail = b"this relimporter imports %r" % (
480 > detail = b"this relimporter imports %r" % (
481 > pycompat.bytestr(relimportee.detail))
481 > pycompat.bytestr(relimportee.detail))
482 > NO_CHECK_EOF
482 > NO_CHECK_EOF
483
483
484 Setup modules, which actually import extension local modules at
484 Setup modules, which actually import extension local modules at
485 runtime.
485 runtime.
486
486
487 $ cat > $TESTTMP/absextroot/absolute.py << NO_CHECK_EOF
487 $ cat > $TESTTMP/absextroot/absolute.py << NO_CHECK_EOF
488 > from __future__ import absolute_import
488 > from __future__ import absolute_import
489 >
489 >
490 > # import extension local modules absolutely (level = 0)
490 > # import extension local modules absolutely (level = 0)
491 > from absextroot.xsub1.xsub2 import used, unused
491 > from absextroot.xsub1.xsub2 import used, unused
492 > from absextroot.xsub1.xsub2.called import func
492 > from absextroot.xsub1.xsub2.called import func
493 >
493 >
494 > def getresult():
494 > def getresult():
495 > result = []
495 > result = []
496 > result.append(used.detail)
496 > result.append(used.detail)
497 > result.append(func())
497 > result.append(func())
498 > return result
498 > return result
499 > NO_CHECK_EOF
499 > NO_CHECK_EOF
500
500
501 $ cat > $TESTTMP/absextroot/relative.py << NO_CHECK_EOF
501 $ cat > $TESTTMP/absextroot/relative.py << NO_CHECK_EOF
502 > from __future__ import absolute_import
502 > from __future__ import absolute_import
503 >
503 >
504 > # import extension local modules relatively (level == 1)
504 > # import extension local modules relatively (level == 1)
505 > from .xsub1.xsub2 import used, unused
505 > from .xsub1.xsub2 import used, unused
506 > from .xsub1.xsub2.called import func
506 > from .xsub1.xsub2.called import func
507 >
507 >
508 > # import a module, which implies "importing with level > 1"
508 > # import a module, which implies "importing with level > 1"
509 > from .xsub1.xsub2 import relimporter
509 > from .xsub1.xsub2 import relimporter
510 >
510 >
511 > def getresult():
511 > def getresult():
512 > result = []
512 > result = []
513 > result.append(used.detail)
513 > result.append(used.detail)
514 > result.append(func())
514 > result.append(func())
515 > result.append(relimporter.detail)
515 > result.append(relimporter.detail)
516 > return result
516 > return result
517 > NO_CHECK_EOF
517 > NO_CHECK_EOF
518
518
519 Setup main procedure of extension.
519 Setup main procedure of extension.
520
520
521 $ cat > $TESTTMP/absextroot/__init__.py <<NO_CHECK_EOF
521 $ cat > $TESTTMP/absextroot/__init__.py <<NO_CHECK_EOF
522 > from __future__ import absolute_import
522 > from __future__ import absolute_import
523 > from mercurial import registrar
523 > from mercurial import registrar
524 > cmdtable = {}
524 > cmdtable = {}
525 > command = registrar.command(cmdtable)
525 > command = registrar.command(cmdtable)
526 >
526 >
527 > # "absolute" and "relative" shouldn't be imported before actual
527 > # "absolute" and "relative" shouldn't be imported before actual
528 > # command execution, because (1) they import same modules, and (2)
528 > # command execution, because (1) they import same modules, and (2)
529 > # preceding import (= instantiate "demandmod" object instead of
529 > # preceding import (= instantiate "demandmod" object instead of
530 > # real "module" object) might hide problem of succeeding import.
530 > # real "module" object) might hide problem of succeeding import.
531 >
531 >
532 > @command(b'showabsolute', [], norepo=True)
532 > @command(b'showabsolute', [], norepo=True)
533 > def showabsolute(ui, *args, **opts):
533 > def showabsolute(ui, *args, **opts):
534 > from absextroot import absolute
534 > from absextroot import absolute
535 > ui.write(b'ABS: %s\n' % b'\nABS: '.join(absolute.getresult()))
535 > ui.write(b'ABS: %s\n' % b'\nABS: '.join(absolute.getresult()))
536 >
536 >
537 > @command(b'showrelative', [], norepo=True)
537 > @command(b'showrelative', [], norepo=True)
538 > def showrelative(ui, *args, **opts):
538 > def showrelative(ui, *args, **opts):
539 > from . import relative
539 > from . import relative
540 > ui.write(b'REL: %s\n' % b'\nREL: '.join(relative.getresult()))
540 > ui.write(b'REL: %s\n' % b'\nREL: '.join(relative.getresult()))
541 >
541 >
542 > # import modules from external library
542 > # import modules from external library
543 > from extlibroot.lsub1.lsub2 import used as lused, unused as lunused
543 > from extlibroot.lsub1.lsub2 import used as lused, unused as lunused
544 > from extlibroot.lsub1.lsub2.called import func as lfunc
544 > from extlibroot.lsub1.lsub2.called import func as lfunc
545 > from extlibroot.recursedown import absdetail, legacydetail
545 > from extlibroot.recursedown import absdetail, legacydetail
546 > from extlibroot.shadowing import proxied
546 > from extlibroot.shadowing import proxied
547 >
547 >
548 > def uisetup(ui):
548 > def uisetup(ui):
549 > result = []
549 > result = []
550 > result.append(lused.detail)
550 > result.append(lused.detail)
551 > result.append(lfunc())
551 > result.append(lfunc())
552 > result.append(absdetail)
552 > result.append(absdetail)
553 > result.append(legacydetail)
553 > result.append(legacydetail)
554 > result.append(proxied.detail)
554 > result.append(proxied.detail)
555 > ui.write(b'LIB: %s\n' % b'\nLIB: '.join(result))
555 > ui.write(b'LIB: %s\n' % b'\nLIB: '.join(result))
556 > NO_CHECK_EOF
556 > NO_CHECK_EOF
557
557
558 Examine module importing.
558 Examine module importing.
559
559
560 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.absextroot=$TESTTMP/absextroot showabsolute)
560 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.absextroot=$TESTTMP/absextroot showabsolute)
561 LIB: this is extlibroot.lsub1.lsub2.used
561 LIB: this is extlibroot.lsub1.lsub2.used
562 LIB: this is extlibroot.lsub1.lsub2.called.func()
562 LIB: this is extlibroot.lsub1.lsub2.called.func()
563 LIB: this is extlibroot.recursedown.abs.used
563 LIB: this is extlibroot.recursedown.abs.used
564 LIB: this is extlibroot.recursedown.legacy.used
564 LIB: this is extlibroot.recursedown.legacy.used
565 LIB: this is extlibroot.shadowing.used
565 LIB: this is extlibroot.shadowing.used
566 ABS: this is absextroot.xsub1.xsub2.used
566 ABS: this is absextroot.xsub1.xsub2.used
567 ABS: this is absextroot.xsub1.xsub2.called.func()
567 ABS: this is absextroot.xsub1.xsub2.called.func()
568
568
569 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.absextroot=$TESTTMP/absextroot showrelative)
569 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.absextroot=$TESTTMP/absextroot showrelative)
570 LIB: this is extlibroot.lsub1.lsub2.used
570 LIB: this is extlibroot.lsub1.lsub2.used
571 LIB: this is extlibroot.lsub1.lsub2.called.func()
571 LIB: this is extlibroot.lsub1.lsub2.called.func()
572 LIB: this is extlibroot.recursedown.abs.used
572 LIB: this is extlibroot.recursedown.abs.used
573 LIB: this is extlibroot.recursedown.legacy.used
573 LIB: this is extlibroot.recursedown.legacy.used
574 LIB: this is extlibroot.shadowing.used
574 LIB: this is extlibroot.shadowing.used
575 REL: this is absextroot.xsub1.xsub2.used
575 REL: this is absextroot.xsub1.xsub2.used
576 REL: this is absextroot.xsub1.xsub2.called.func()
576 REL: this is absextroot.xsub1.xsub2.called.func()
577 REL: this relimporter imports 'this is absextroot.relimportee'
577 REL: this relimporter imports 'this is absextroot.relimportee'
578
578
579 Examine whether sub-module is imported relatively as expected.
579 Examine whether sub-module is imported relatively as expected.
580
580
581 See also issue5208 for detail about example case on Python 3.x.
581 See also issue5208 for detail about example case on Python 3.x.
582
582
583 $ f -q $TESTTMP/extlibroot/lsub1/lsub2/notexist.py
583 $ f -q $TESTTMP/extlibroot/lsub1/lsub2/notexist.py
584 $TESTTMP/extlibroot/lsub1/lsub2/notexist.py: file not found
584 $TESTTMP/extlibroot/lsub1/lsub2/notexist.py: file not found
585
585
586 $ cat > $TESTTMP/notexist.py <<NO_CHECK_EOF
586 $ cat > $TESTTMP/notexist.py <<NO_CHECK_EOF
587 > text = 'notexist.py at root is loaded unintentionally\n'
587 > text = 'notexist.py at root is loaded unintentionally\n'
588 > NO_CHECK_EOF
588 > NO_CHECK_EOF
589
589
590 $ cat > $TESTTMP/checkrelativity.py <<NO_CHECK_EOF
590 $ cat > $TESTTMP/checkrelativity.py <<NO_CHECK_EOF
591 > from mercurial import registrar
591 > from mercurial import registrar
592 > cmdtable = {}
592 > cmdtable = {}
593 > command = registrar.command(cmdtable)
593 > command = registrar.command(cmdtable)
594 >
594 >
595 > # demand import avoids failure of importing notexist here
595 > # demand import avoids failure of importing notexist here
596 > import extlibroot.lsub1.lsub2.notexist
596 > import extlibroot.lsub1.lsub2.notexist
597 >
597 >
598 > @command(b'checkrelativity', [], norepo=True)
598 > @command(b'checkrelativity', [], norepo=True)
599 > def checkrelativity(ui, *args, **opts):
599 > def checkrelativity(ui, *args, **opts):
600 > try:
600 > try:
601 > ui.write(extlibroot.lsub1.lsub2.notexist.text)
601 > ui.write(extlibroot.lsub1.lsub2.notexist.text)
602 > return 1 # unintentional success
602 > return 1 # unintentional success
603 > except ImportError:
603 > except ImportError:
604 > pass # intentional failure
604 > pass # intentional failure
605 > NO_CHECK_EOF
605 > NO_CHECK_EOF
606
606
607 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.checkrelativity=$TESTTMP/checkrelativity.py checkrelativity)
607 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.checkrelativity=$TESTTMP/checkrelativity.py checkrelativity)
608
608
609 #endif
609 #endif
610
610
611 (Here, module importing tests are finished. Therefore, use other than
611 (Here, module importing tests are finished. Therefore, use other than
612 NO_CHECK_* limit mark for heredoc python files, in order to apply
612 NO_CHECK_* limit mark for heredoc python files, in order to apply
613 import-checker.py or so on their contents)
613 import-checker.py or so on their contents)
614
614
615 Make sure a broken uisetup doesn't globally break hg:
615 Make sure a broken uisetup doesn't globally break hg:
616 $ cat > $TESTTMP/baduisetup.py <<EOF
616 $ cat > $TESTTMP/baduisetup.py <<EOF
617 > def uisetup(ui):
617 > def uisetup(ui):
618 > 1/0
618 > 1/0
619 > EOF
619 > EOF
620
620
621 Even though the extension fails during uisetup, hg is still basically usable:
621 Even though the extension fails during uisetup, hg is still basically usable:
622 $ hg --config extensions.baduisetup=$TESTTMP/baduisetup.py version
622 $ hg --config extensions.baduisetup=$TESTTMP/baduisetup.py version
623 Traceback (most recent call last):
623 Traceback (most recent call last):
624 File "*/mercurial/extensions.py", line *, in _runuisetup (glob)
624 File "*/mercurial/extensions.py", line *, in _runuisetup (glob)
625 uisetup(ui)
625 uisetup(ui)
626 File "$TESTTMP/baduisetup.py", line 2, in uisetup
626 File "$TESTTMP/baduisetup.py", line 2, in uisetup
627 1/0
627 1/0
628 ZeroDivisionError: * by zero (glob)
628 ZeroDivisionError: * by zero (glob)
629 *** failed to set up extension baduisetup: * by zero (glob)
629 *** failed to set up extension baduisetup: * by zero (glob)
630 Mercurial Distributed SCM (version *) (glob)
630 Mercurial Distributed SCM (version *) (glob)
631 (see https://mercurial-scm.org for more information)
631 (see https://mercurial-scm.org for more information)
632
632
633 Copyright (C) 2005-* Matt Mackall and others (glob)
633 Copyright (C) 2005-* Matt Mackall and others (glob)
634 This is free software; see the source for copying conditions. There is NO
634 This is free software; see the source for copying conditions. There is NO
635 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
635 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
636
636
637 $ cd ..
637 $ cd ..
638
638
639 hide outer repo
639 hide outer repo
640 $ hg init
640 $ hg init
641
641
642 $ cat > empty.py <<EOF
642 $ cat > empty.py <<EOF
643 > '''empty cmdtable
643 > '''empty cmdtable
644 > '''
644 > '''
645 > cmdtable = {}
645 > cmdtable = {}
646 > EOF
646 > EOF
647 $ emptypath=`pwd`/empty.py
647 $ emptypath=`pwd`/empty.py
648 $ echo "empty = $emptypath" >> $HGRCPATH
648 $ echo "empty = $emptypath" >> $HGRCPATH
649 $ hg help empty
649 $ hg help empty
650 empty extension - empty cmdtable
650 empty extension - empty cmdtable
651
651
652 no commands defined
652 no commands defined
653
653
654
654
655 $ echo 'empty = !' >> $HGRCPATH
655 $ echo 'empty = !' >> $HGRCPATH
656
656
657 $ cat > debugextension.py <<EOF
657 $ cat > debugextension.py <<EOF
658 > '''only debugcommands
658 > '''only debugcommands
659 > '''
659 > '''
660 > from mercurial import registrar
660 > from mercurial import registrar
661 > cmdtable = {}
661 > cmdtable = {}
662 > command = registrar.command(cmdtable)
662 > command = registrar.command(cmdtable)
663 > @command(b'debugfoobar', [], b'hg debugfoobar')
663 > @command(b'debugfoobar', [], b'hg debugfoobar')
664 > def debugfoobar(ui, repo, *args, **opts):
664 > def debugfoobar(ui, repo, *args, **opts):
665 > "yet another debug command"
665 > "yet another debug command"
666 > pass
666 > pass
667 > @command(b'foo', [], b'hg foo')
667 > @command(b'foo', [], b'hg foo')
668 > def foo(ui, repo, *args, **opts):
668 > def foo(ui, repo, *args, **opts):
669 > """yet another foo command
669 > """yet another foo command
670 > This command has been DEPRECATED since forever.
670 > This command has been DEPRECATED since forever.
671 > """
671 > """
672 > pass
672 > pass
673 > EOF
673 > EOF
674 $ debugpath=`pwd`/debugextension.py
674 $ debugpath=`pwd`/debugextension.py
675 $ echo "debugextension = $debugpath" >> $HGRCPATH
675 $ echo "debugextension = $debugpath" >> $HGRCPATH
676
676
677 $ hg help debugextension
677 $ hg help debugextension
678 hg debugextensions
678 hg debugextensions
679
679
680 show information about active extensions
680 show information about active extensions
681
681
682 options:
682 options:
683
683
684 -T --template TEMPLATE display with template
684 -T --template TEMPLATE display with template
685
685
686 (some details hidden, use --verbose to show complete help)
686 (some details hidden, use --verbose to show complete help)
687
687
688
688
689 $ hg --verbose help debugextension
689 $ hg --verbose help debugextension
690 hg debugextensions
690 hg debugextensions
691
691
692 show information about active extensions
692 show information about active extensions
693
693
694 options:
694 options:
695
695
696 -T --template TEMPLATE display with template
696 -T --template TEMPLATE display with template
697
697
698 global options ([+] can be repeated):
698 global options ([+] can be repeated):
699
699
700 -R --repository REPO repository root directory or name of overlay bundle
700 -R --repository REPO repository root directory or name of overlay bundle
701 file
701 file
702 --cwd DIR change working directory
702 --cwd DIR change working directory
703 -y --noninteractive do not prompt, automatically pick the first choice for
703 -y --noninteractive do not prompt, automatically pick the first choice for
704 all prompts
704 all prompts
705 -q --quiet suppress output
705 -q --quiet suppress output
706 -v --verbose enable additional output
706 -v --verbose enable additional output
707 --color TYPE when to colorize (boolean, always, auto, never, or
707 --color TYPE when to colorize (boolean, always, auto, never, or
708 debug)
708 debug)
709 --config CONFIG [+] set/override config option (use 'section.name=value')
709 --config CONFIG [+] set/override config option (use 'section.name=value')
710 --debug enable debugging output
710 --debug enable debugging output
711 --debugger start debugger
711 --debugger start debugger
712 --encoding ENCODE set the charset encoding (default: ascii)
712 --encoding ENCODE set the charset encoding (default: ascii)
713 --encodingmode MODE set the charset encoding mode (default: strict)
713 --encodingmode MODE set the charset encoding mode (default: strict)
714 --traceback always print a traceback on exception
714 --traceback always print a traceback on exception
715 --time time how long the command takes
715 --time time how long the command takes
716 --profile print command execution profile
716 --profile print command execution profile
717 --version output version information and exit
717 --version output version information and exit
718 -h --help display help and exit
718 -h --help display help and exit
719 --[no-]hidden consider hidden changesets (default: off)
719 --hidden consider hidden changesets (default: off)
720 --pager TYPE when to paginate (boolean, always, auto, or never)
720 --pager TYPE when to paginate (boolean, always, auto, or never)
721 (default: auto)
721 (default: auto)
722
722
723
723
724
724
725
725
726
726
727
727
728 $ hg --debug help debugextension
728 $ hg --debug help debugextension
729 hg debugextensions
729 hg debugextensions
730
730
731 show information about active extensions
731 show information about active extensions
732
732
733 options:
733 options:
734
734
735 -T --template TEMPLATE display with template
735 -T --template TEMPLATE display with template
736
736
737 global options ([+] can be repeated):
737 global options ([+] can be repeated):
738
738
739 -R --repository REPO repository root directory or name of overlay bundle
739 -R --repository REPO repository root directory or name of overlay bundle
740 file
740 file
741 --cwd DIR change working directory
741 --cwd DIR change working directory
742 -y --noninteractive do not prompt, automatically pick the first choice for
742 -y --noninteractive do not prompt, automatically pick the first choice for
743 all prompts
743 all prompts
744 -q --quiet suppress output
744 -q --quiet suppress output
745 -v --verbose enable additional output
745 -v --verbose enable additional output
746 --color TYPE when to colorize (boolean, always, auto, never, or
746 --color TYPE when to colorize (boolean, always, auto, never, or
747 debug)
747 debug)
748 --config CONFIG [+] set/override config option (use 'section.name=value')
748 --config CONFIG [+] set/override config option (use 'section.name=value')
749 --debug enable debugging output
749 --debug enable debugging output
750 --debugger start debugger
750 --debugger start debugger
751 --encoding ENCODE set the charset encoding (default: ascii)
751 --encoding ENCODE set the charset encoding (default: ascii)
752 --encodingmode MODE set the charset encoding mode (default: strict)
752 --encodingmode MODE set the charset encoding mode (default: strict)
753 --traceback always print a traceback on exception
753 --traceback always print a traceback on exception
754 --time time how long the command takes
754 --time time how long the command takes
755 --profile print command execution profile
755 --profile print command execution profile
756 --version output version information and exit
756 --version output version information and exit
757 -h --help display help and exit
757 -h --help display help and exit
758 --[no-]hidden consider hidden changesets (default: off)
758 --hidden consider hidden changesets (default: off)
759 --pager TYPE when to paginate (boolean, always, auto, or never)
759 --pager TYPE when to paginate (boolean, always, auto, or never)
760 (default: auto)
760 (default: auto)
761
761
762
762
763
763
764
764
765
765
766 $ echo 'debugextension = !' >> $HGRCPATH
766 $ echo 'debugextension = !' >> $HGRCPATH
767
767
768 Asking for help about a deprecated extension should do something useful:
768 Asking for help about a deprecated extension should do something useful:
769
769
770 $ hg help glog
770 $ hg help glog
771 'glog' is provided by the following extension:
771 'glog' is provided by the following extension:
772
772
773 graphlog command to view revision graphs from a shell (DEPRECATED)
773 graphlog command to view revision graphs from a shell (DEPRECATED)
774
774
775 (use 'hg help extensions' for information on enabling extensions)
775 (use 'hg help extensions' for information on enabling extensions)
776
776
777 Extension module help vs command help:
777 Extension module help vs command help:
778
778
779 $ echo 'extdiff =' >> $HGRCPATH
779 $ echo 'extdiff =' >> $HGRCPATH
780 $ hg help extdiff
780 $ hg help extdiff
781 hg extdiff [OPT]... [FILE]...
781 hg extdiff [OPT]... [FILE]...
782
782
783 use external program to diff repository (or selected files)
783 use external program to diff repository (or selected files)
784
784
785 Show differences between revisions for the specified files, using an
785 Show differences between revisions for the specified files, using an
786 external program. The default program used is diff, with default options
786 external program. The default program used is diff, with default options
787 "-Npru".
787 "-Npru".
788
788
789 To select a different program, use the -p/--program option. The program
789 To select a different program, use the -p/--program option. The program
790 will be passed the names of two directories to compare. To pass additional
790 will be passed the names of two directories to compare. To pass additional
791 options to the program, use -o/--option. These will be passed before the
791 options to the program, use -o/--option. These will be passed before the
792 names of the directories to compare.
792 names of the directories to compare.
793
793
794 When two revision arguments are given, then changes are shown between
794 When two revision arguments are given, then changes are shown between
795 those revisions. If only one revision is specified then that revision is
795 those revisions. If only one revision is specified then that revision is
796 compared to the working directory, and, when no revisions are specified,
796 compared to the working directory, and, when no revisions are specified,
797 the working directory files are compared to its parent.
797 the working directory files are compared to its parent.
798
798
799 (use 'hg help -e extdiff' to show help for the extdiff extension)
799 (use 'hg help -e extdiff' to show help for the extdiff extension)
800
800
801 options ([+] can be repeated):
801 options ([+] can be repeated):
802
802
803 -p --program CMD comparison program to run
803 -p --program CMD comparison program to run
804 -o --option OPT [+] pass option to comparison program
804 -o --option OPT [+] pass option to comparison program
805 -r --rev REV [+] revision
805 -r --rev REV [+] revision
806 -c --change REV change made by revision
806 -c --change REV change made by revision
807 --patch compare patches for two revisions
807 --patch compare patches for two revisions
808 -I --include PATTERN [+] include names matching the given patterns
808 -I --include PATTERN [+] include names matching the given patterns
809 -X --exclude PATTERN [+] exclude names matching the given patterns
809 -X --exclude PATTERN [+] exclude names matching the given patterns
810 -S --subrepos recurse into subrepositories
810 -S --subrepos recurse into subrepositories
811
811
812 (some details hidden, use --verbose to show complete help)
812 (some details hidden, use --verbose to show complete help)
813
813
814
814
815
815
816
816
817
817
818
818
819
819
820
820
821
821
822
822
823 $ hg help --extension extdiff
823 $ hg help --extension extdiff
824 extdiff extension - command to allow external programs to compare revisions
824 extdiff extension - command to allow external programs to compare revisions
825
825
826 The extdiff Mercurial extension allows you to use external programs to compare
826 The extdiff Mercurial extension allows you to use external programs to compare
827 revisions, or revision with working directory. The external diff programs are
827 revisions, or revision with working directory. The external diff programs are
828 called with a configurable set of options and two non-option arguments: paths
828 called with a configurable set of options and two non-option arguments: paths
829 to directories containing snapshots of files to compare.
829 to directories containing snapshots of files to compare.
830
830
831 If there is more than one file being compared and the "child" revision is the
831 If there is more than one file being compared and the "child" revision is the
832 working directory, any modifications made in the external diff program will be
832 working directory, any modifications made in the external diff program will be
833 copied back to the working directory from the temporary directory.
833 copied back to the working directory from the temporary directory.
834
834
835 The extdiff extension also allows you to configure new diff commands, so you
835 The extdiff extension also allows you to configure new diff commands, so you
836 do not need to type 'hg extdiff -p kdiff3' always.
836 do not need to type 'hg extdiff -p kdiff3' always.
837
837
838 [extdiff]
838 [extdiff]
839 # add new command that runs GNU diff(1) in 'context diff' mode
839 # add new command that runs GNU diff(1) in 'context diff' mode
840 cdiff = gdiff -Nprc5
840 cdiff = gdiff -Nprc5
841 ## or the old way:
841 ## or the old way:
842 #cmd.cdiff = gdiff
842 #cmd.cdiff = gdiff
843 #opts.cdiff = -Nprc5
843 #opts.cdiff = -Nprc5
844
844
845 # add new command called meld, runs meld (no need to name twice). If
845 # add new command called meld, runs meld (no need to name twice). If
846 # the meld executable is not available, the meld tool in [merge-tools]
846 # the meld executable is not available, the meld tool in [merge-tools]
847 # will be used, if available
847 # will be used, if available
848 meld =
848 meld =
849
849
850 # add new command called vimdiff, runs gvimdiff with DirDiff plugin
850 # add new command called vimdiff, runs gvimdiff with DirDiff plugin
851 # (see http://www.vim.org/scripts/script.php?script_id=102) Non
851 # (see http://www.vim.org/scripts/script.php?script_id=102) Non
852 # English user, be sure to put "let g:DirDiffDynamicDiffText = 1" in
852 # English user, be sure to put "let g:DirDiffDynamicDiffText = 1" in
853 # your .vimrc
853 # your .vimrc
854 vimdiff = gvim -f "+next" \
854 vimdiff = gvim -f "+next" \
855 "+execute 'DirDiff' fnameescape(argv(0)) fnameescape(argv(1))"
855 "+execute 'DirDiff' fnameescape(argv(0)) fnameescape(argv(1))"
856
856
857 Tool arguments can include variables that are expanded at runtime:
857 Tool arguments can include variables that are expanded at runtime:
858
858
859 $parent1, $plabel1 - filename, descriptive label of first parent
859 $parent1, $plabel1 - filename, descriptive label of first parent
860 $child, $clabel - filename, descriptive label of child revision
860 $child, $clabel - filename, descriptive label of child revision
861 $parent2, $plabel2 - filename, descriptive label of second parent
861 $parent2, $plabel2 - filename, descriptive label of second parent
862 $root - repository root
862 $root - repository root
863 $parent is an alias for $parent1.
863 $parent is an alias for $parent1.
864
864
865 The extdiff extension will look in your [diff-tools] and [merge-tools]
865 The extdiff extension will look in your [diff-tools] and [merge-tools]
866 sections for diff tool arguments, when none are specified in [extdiff].
866 sections for diff tool arguments, when none are specified in [extdiff].
867
867
868 [extdiff]
868 [extdiff]
869 kdiff3 =
869 kdiff3 =
870
870
871 [diff-tools]
871 [diff-tools]
872 kdiff3.diffargs=--L1 '$plabel1' --L2 '$clabel' $parent $child
872 kdiff3.diffargs=--L1 '$plabel1' --L2 '$clabel' $parent $child
873
873
874 You can use -I/-X and list of file or directory names like normal 'hg diff'
874 You can use -I/-X and list of file or directory names like normal 'hg diff'
875 command. The extdiff extension makes snapshots of only needed files, so
875 command. The extdiff extension makes snapshots of only needed files, so
876 running the external diff program will actually be pretty fast (at least
876 running the external diff program will actually be pretty fast (at least
877 faster than having to compare the entire tree).
877 faster than having to compare the entire tree).
878
878
879 list of commands:
879 list of commands:
880
880
881 extdiff use external program to diff repository (or selected files)
881 extdiff use external program to diff repository (or selected files)
882
882
883 (use 'hg help -v -e extdiff' to show built-in aliases and global options)
883 (use 'hg help -v -e extdiff' to show built-in aliases and global options)
884
884
885
885
886
886
887
887
888
888
889
889
890
890
891
891
892
892
893
893
894
894
895
895
896
896
897
897
898
898
899
899
900 $ echo 'extdiff = !' >> $HGRCPATH
900 $ echo 'extdiff = !' >> $HGRCPATH
901
901
902 Test help topic with same name as extension
902 Test help topic with same name as extension
903
903
904 $ cat > multirevs.py <<EOF
904 $ cat > multirevs.py <<EOF
905 > from mercurial import commands, registrar
905 > from mercurial import commands, registrar
906 > cmdtable = {}
906 > cmdtable = {}
907 > command = registrar.command(cmdtable)
907 > command = registrar.command(cmdtable)
908 > """multirevs extension
908 > """multirevs extension
909 > Big multi-line module docstring."""
909 > Big multi-line module docstring."""
910 > @command(b'multirevs', [], b'ARG', norepo=True)
910 > @command(b'multirevs', [], b'ARG', norepo=True)
911 > def multirevs(ui, repo, arg, *args, **opts):
911 > def multirevs(ui, repo, arg, *args, **opts):
912 > """multirevs command"""
912 > """multirevs command"""
913 > pass
913 > pass
914 > EOF
914 > EOF
915 $ echo "multirevs = multirevs.py" >> $HGRCPATH
915 $ echo "multirevs = multirevs.py" >> $HGRCPATH
916
916
917 $ hg help multirevs | tail
917 $ hg help multirevs | tail
918 used):
918 used):
919
919
920 hg update :@
920 hg update :@
921
921
922 - Show diff between tags 1.3 and 1.5 (this works because the first and the
922 - Show diff between tags 1.3 and 1.5 (this works because the first and the
923 last revisions of the revset are used):
923 last revisions of the revset are used):
924
924
925 hg diff -r 1.3::1.5
925 hg diff -r 1.3::1.5
926
926
927 use 'hg help -c multirevs' to see help for the multirevs command
927 use 'hg help -c multirevs' to see help for the multirevs command
928
928
929
929
930
930
931
931
932
932
933
933
934 $ hg help -c multirevs
934 $ hg help -c multirevs
935 hg multirevs ARG
935 hg multirevs ARG
936
936
937 multirevs command
937 multirevs command
938
938
939 (some details hidden, use --verbose to show complete help)
939 (some details hidden, use --verbose to show complete help)
940
940
941
941
942
942
943 $ hg multirevs
943 $ hg multirevs
944 hg multirevs: invalid arguments
944 hg multirevs: invalid arguments
945 hg multirevs ARG
945 hg multirevs ARG
946
946
947 multirevs command
947 multirevs command
948
948
949 (use 'hg multirevs -h' to show more help)
949 (use 'hg multirevs -h' to show more help)
950 [255]
950 [255]
951
951
952
952
953
953
954 $ echo "multirevs = !" >> $HGRCPATH
954 $ echo "multirevs = !" >> $HGRCPATH
955
955
956 Issue811: Problem loading extensions twice (by site and by user)
956 Issue811: Problem loading extensions twice (by site and by user)
957
957
958 $ cat <<EOF >> $HGRCPATH
958 $ cat <<EOF >> $HGRCPATH
959 > mq =
959 > mq =
960 > strip =
960 > strip =
961 > hgext.mq =
961 > hgext.mq =
962 > hgext/mq =
962 > hgext/mq =
963 > EOF
963 > EOF
964
964
965 Show extensions:
965 Show extensions:
966 (note that mq force load strip, also checking it's not loaded twice)
966 (note that mq force load strip, also checking it's not loaded twice)
967
967
968 #if no-extraextensions
968 #if no-extraextensions
969 $ hg debugextensions
969 $ hg debugextensions
970 mq
970 mq
971 strip
971 strip
972 #endif
972 #endif
973
973
974 For extensions, which name matches one of its commands, help
974 For extensions, which name matches one of its commands, help
975 message should ask '-v -e' to get list of built-in aliases
975 message should ask '-v -e' to get list of built-in aliases
976 along with extension help itself
976 along with extension help itself
977
977
978 $ mkdir $TESTTMP/d
978 $ mkdir $TESTTMP/d
979 $ cat > $TESTTMP/d/dodo.py <<EOF
979 $ cat > $TESTTMP/d/dodo.py <<EOF
980 > """
980 > """
981 > This is an awesome 'dodo' extension. It does nothing and
981 > This is an awesome 'dodo' extension. It does nothing and
982 > writes 'Foo foo'
982 > writes 'Foo foo'
983 > """
983 > """
984 > from mercurial import commands, registrar
984 > from mercurial import commands, registrar
985 > cmdtable = {}
985 > cmdtable = {}
986 > command = registrar.command(cmdtable)
986 > command = registrar.command(cmdtable)
987 > @command(b'dodo', [], b'hg dodo')
987 > @command(b'dodo', [], b'hg dodo')
988 > def dodo(ui, *args, **kwargs):
988 > def dodo(ui, *args, **kwargs):
989 > """Does nothing"""
989 > """Does nothing"""
990 > ui.write(b"I do nothing. Yay\\n")
990 > ui.write(b"I do nothing. Yay\\n")
991 > @command(b'foofoo', [], b'hg foofoo')
991 > @command(b'foofoo', [], b'hg foofoo')
992 > def foofoo(ui, *args, **kwargs):
992 > def foofoo(ui, *args, **kwargs):
993 > """Writes 'Foo foo'"""
993 > """Writes 'Foo foo'"""
994 > ui.write(b"Foo foo\\n")
994 > ui.write(b"Foo foo\\n")
995 > EOF
995 > EOF
996 $ dodopath=$TESTTMP/d/dodo.py
996 $ dodopath=$TESTTMP/d/dodo.py
997
997
998 $ echo "dodo = $dodopath" >> $HGRCPATH
998 $ echo "dodo = $dodopath" >> $HGRCPATH
999
999
1000 Make sure that user is asked to enter '-v -e' to get list of built-in aliases
1000 Make sure that user is asked to enter '-v -e' to get list of built-in aliases
1001 $ hg help -e dodo
1001 $ hg help -e dodo
1002 dodo extension -
1002 dodo extension -
1003
1003
1004 This is an awesome 'dodo' extension. It does nothing and writes 'Foo foo'
1004 This is an awesome 'dodo' extension. It does nothing and writes 'Foo foo'
1005
1005
1006 list of commands:
1006 list of commands:
1007
1007
1008 dodo Does nothing
1008 dodo Does nothing
1009 foofoo Writes 'Foo foo'
1009 foofoo Writes 'Foo foo'
1010
1010
1011 (use 'hg help -v -e dodo' to show built-in aliases and global options)
1011 (use 'hg help -v -e dodo' to show built-in aliases and global options)
1012
1012
1013 Make sure that '-v -e' prints list of built-in aliases along with
1013 Make sure that '-v -e' prints list of built-in aliases along with
1014 extension help itself
1014 extension help itself
1015 $ hg help -v -e dodo
1015 $ hg help -v -e dodo
1016 dodo extension -
1016 dodo extension -
1017
1017
1018 This is an awesome 'dodo' extension. It does nothing and writes 'Foo foo'
1018 This is an awesome 'dodo' extension. It does nothing and writes 'Foo foo'
1019
1019
1020 list of commands:
1020 list of commands:
1021
1021
1022 dodo Does nothing
1022 dodo Does nothing
1023 foofoo Writes 'Foo foo'
1023 foofoo Writes 'Foo foo'
1024
1024
1025 global options ([+] can be repeated):
1025 global options ([+] can be repeated):
1026
1026
1027 -R --repository REPO repository root directory or name of overlay bundle
1027 -R --repository REPO repository root directory or name of overlay bundle
1028 file
1028 file
1029 --cwd DIR change working directory
1029 --cwd DIR change working directory
1030 -y --noninteractive do not prompt, automatically pick the first choice for
1030 -y --noninteractive do not prompt, automatically pick the first choice for
1031 all prompts
1031 all prompts
1032 -q --quiet suppress output
1032 -q --quiet suppress output
1033 -v --verbose enable additional output
1033 -v --verbose enable additional output
1034 --color TYPE when to colorize (boolean, always, auto, never, or
1034 --color TYPE when to colorize (boolean, always, auto, never, or
1035 debug)
1035 debug)
1036 --config CONFIG [+] set/override config option (use 'section.name=value')
1036 --config CONFIG [+] set/override config option (use 'section.name=value')
1037 --debug enable debugging output
1037 --debug enable debugging output
1038 --debugger start debugger
1038 --debugger start debugger
1039 --encoding ENCODE set the charset encoding (default: ascii)
1039 --encoding ENCODE set the charset encoding (default: ascii)
1040 --encodingmode MODE set the charset encoding mode (default: strict)
1040 --encodingmode MODE set the charset encoding mode (default: strict)
1041 --traceback always print a traceback on exception
1041 --traceback always print a traceback on exception
1042 --time time how long the command takes
1042 --time time how long the command takes
1043 --profile print command execution profile
1043 --profile print command execution profile
1044 --version output version information and exit
1044 --version output version information and exit
1045 -h --help display help and exit
1045 -h --help display help and exit
1046 --[no-]hidden consider hidden changesets (default: off)
1046 --hidden consider hidden changesets (default: off)
1047 --pager TYPE when to paginate (boolean, always, auto, or never)
1047 --pager TYPE when to paginate (boolean, always, auto, or never)
1048 (default: auto)
1048 (default: auto)
1049
1049
1050 Make sure that single '-v' option shows help and built-ins only for 'dodo' command
1050 Make sure that single '-v' option shows help and built-ins only for 'dodo' command
1051 $ hg help -v dodo
1051 $ hg help -v dodo
1052 hg dodo
1052 hg dodo
1053
1053
1054 Does nothing
1054 Does nothing
1055
1055
1056 (use 'hg help -e dodo' to show help for the dodo extension)
1056 (use 'hg help -e dodo' to show help for the dodo extension)
1057
1057
1058 options:
1058 options:
1059
1059
1060 --mq operate on patch repository
1060 --mq operate on patch repository
1061
1061
1062 global options ([+] can be repeated):
1062 global options ([+] can be repeated):
1063
1063
1064 -R --repository REPO repository root directory or name of overlay bundle
1064 -R --repository REPO repository root directory or name of overlay bundle
1065 file
1065 file
1066 --cwd DIR change working directory
1066 --cwd DIR change working directory
1067 -y --noninteractive do not prompt, automatically pick the first choice for
1067 -y --noninteractive do not prompt, automatically pick the first choice for
1068 all prompts
1068 all prompts
1069 -q --quiet suppress output
1069 -q --quiet suppress output
1070 -v --verbose enable additional output
1070 -v --verbose enable additional output
1071 --color TYPE when to colorize (boolean, always, auto, never, or
1071 --color TYPE when to colorize (boolean, always, auto, never, or
1072 debug)
1072 debug)
1073 --config CONFIG [+] set/override config option (use 'section.name=value')
1073 --config CONFIG [+] set/override config option (use 'section.name=value')
1074 --debug enable debugging output
1074 --debug enable debugging output
1075 --debugger start debugger
1075 --debugger start debugger
1076 --encoding ENCODE set the charset encoding (default: ascii)
1076 --encoding ENCODE set the charset encoding (default: ascii)
1077 --encodingmode MODE set the charset encoding mode (default: strict)
1077 --encodingmode MODE set the charset encoding mode (default: strict)
1078 --traceback always print a traceback on exception
1078 --traceback always print a traceback on exception
1079 --time time how long the command takes
1079 --time time how long the command takes
1080 --profile print command execution profile
1080 --profile print command execution profile
1081 --version output version information and exit
1081 --version output version information and exit
1082 -h --help display help and exit
1082 -h --help display help and exit
1083 --[no-]hidden consider hidden changesets (default: off)
1083 --hidden consider hidden changesets (default: off)
1084 --pager TYPE when to paginate (boolean, always, auto, or never)
1084 --pager TYPE when to paginate (boolean, always, auto, or never)
1085 (default: auto)
1085 (default: auto)
1086
1086
1087 In case when extension name doesn't match any of its commands,
1087 In case when extension name doesn't match any of its commands,
1088 help message should ask for '-v' to get list of built-in aliases
1088 help message should ask for '-v' to get list of built-in aliases
1089 along with extension help
1089 along with extension help
1090 $ cat > $TESTTMP/d/dudu.py <<EOF
1090 $ cat > $TESTTMP/d/dudu.py <<EOF
1091 > """
1091 > """
1092 > This is an awesome 'dudu' extension. It does something and
1092 > This is an awesome 'dudu' extension. It does something and
1093 > also writes 'Beep beep'
1093 > also writes 'Beep beep'
1094 > """
1094 > """
1095 > from mercurial import commands, registrar
1095 > from mercurial import commands, registrar
1096 > cmdtable = {}
1096 > cmdtable = {}
1097 > command = registrar.command(cmdtable)
1097 > command = registrar.command(cmdtable)
1098 > @command(b'something', [], b'hg something')
1098 > @command(b'something', [], b'hg something')
1099 > def something(ui, *args, **kwargs):
1099 > def something(ui, *args, **kwargs):
1100 > """Does something"""
1100 > """Does something"""
1101 > ui.write(b"I do something. Yaaay\\n")
1101 > ui.write(b"I do something. Yaaay\\n")
1102 > @command(b'beep', [], b'hg beep')
1102 > @command(b'beep', [], b'hg beep')
1103 > def beep(ui, *args, **kwargs):
1103 > def beep(ui, *args, **kwargs):
1104 > """Writes 'Beep beep'"""
1104 > """Writes 'Beep beep'"""
1105 > ui.write(b"Beep beep\\n")
1105 > ui.write(b"Beep beep\\n")
1106 > EOF
1106 > EOF
1107 $ dudupath=$TESTTMP/d/dudu.py
1107 $ dudupath=$TESTTMP/d/dudu.py
1108
1108
1109 $ echo "dudu = $dudupath" >> $HGRCPATH
1109 $ echo "dudu = $dudupath" >> $HGRCPATH
1110
1110
1111 $ hg help -e dudu
1111 $ hg help -e dudu
1112 dudu extension -
1112 dudu extension -
1113
1113
1114 This is an awesome 'dudu' extension. It does something and also writes 'Beep
1114 This is an awesome 'dudu' extension. It does something and also writes 'Beep
1115 beep'
1115 beep'
1116
1116
1117 list of commands:
1117 list of commands:
1118
1118
1119 beep Writes 'Beep beep'
1119 beep Writes 'Beep beep'
1120 something Does something
1120 something Does something
1121
1121
1122 (use 'hg help -v dudu' to show built-in aliases and global options)
1122 (use 'hg help -v dudu' to show built-in aliases and global options)
1123
1123
1124 In case when extension name doesn't match any of its commands,
1124 In case when extension name doesn't match any of its commands,
1125 help options '-v' and '-v -e' should be equivalent
1125 help options '-v' and '-v -e' should be equivalent
1126 $ hg help -v dudu
1126 $ hg help -v dudu
1127 dudu extension -
1127 dudu extension -
1128
1128
1129 This is an awesome 'dudu' extension. It does something and also writes 'Beep
1129 This is an awesome 'dudu' extension. It does something and also writes 'Beep
1130 beep'
1130 beep'
1131
1131
1132 list of commands:
1132 list of commands:
1133
1133
1134 beep Writes 'Beep beep'
1134 beep Writes 'Beep beep'
1135 something Does something
1135 something Does something
1136
1136
1137 global options ([+] can be repeated):
1137 global options ([+] can be repeated):
1138
1138
1139 -R --repository REPO repository root directory or name of overlay bundle
1139 -R --repository REPO repository root directory or name of overlay bundle
1140 file
1140 file
1141 --cwd DIR change working directory
1141 --cwd DIR change working directory
1142 -y --noninteractive do not prompt, automatically pick the first choice for
1142 -y --noninteractive do not prompt, automatically pick the first choice for
1143 all prompts
1143 all prompts
1144 -q --quiet suppress output
1144 -q --quiet suppress output
1145 -v --verbose enable additional output
1145 -v --verbose enable additional output
1146 --color TYPE when to colorize (boolean, always, auto, never, or
1146 --color TYPE when to colorize (boolean, always, auto, never, or
1147 debug)
1147 debug)
1148 --config CONFIG [+] set/override config option (use 'section.name=value')
1148 --config CONFIG [+] set/override config option (use 'section.name=value')
1149 --debug enable debugging output
1149 --debug enable debugging output
1150 --debugger start debugger
1150 --debugger start debugger
1151 --encoding ENCODE set the charset encoding (default: ascii)
1151 --encoding ENCODE set the charset encoding (default: ascii)
1152 --encodingmode MODE set the charset encoding mode (default: strict)
1152 --encodingmode MODE set the charset encoding mode (default: strict)
1153 --traceback always print a traceback on exception
1153 --traceback always print a traceback on exception
1154 --time time how long the command takes
1154 --time time how long the command takes
1155 --profile print command execution profile
1155 --profile print command execution profile
1156 --version output version information and exit
1156 --version output version information and exit
1157 -h --help display help and exit
1157 -h --help display help and exit
1158 --[no-]hidden consider hidden changesets (default: off)
1158 --hidden consider hidden changesets (default: off)
1159 --pager TYPE when to paginate (boolean, always, auto, or never)
1159 --pager TYPE when to paginate (boolean, always, auto, or never)
1160 (default: auto)
1160 (default: auto)
1161
1161
1162 $ hg help -v -e dudu
1162 $ hg help -v -e dudu
1163 dudu extension -
1163 dudu extension -
1164
1164
1165 This is an awesome 'dudu' extension. It does something and also writes 'Beep
1165 This is an awesome 'dudu' extension. It does something and also writes 'Beep
1166 beep'
1166 beep'
1167
1167
1168 list of commands:
1168 list of commands:
1169
1169
1170 beep Writes 'Beep beep'
1170 beep Writes 'Beep beep'
1171 something Does something
1171 something Does something
1172
1172
1173 global options ([+] can be repeated):
1173 global options ([+] can be repeated):
1174
1174
1175 -R --repository REPO repository root directory or name of overlay bundle
1175 -R --repository REPO repository root directory or name of overlay bundle
1176 file
1176 file
1177 --cwd DIR change working directory
1177 --cwd DIR change working directory
1178 -y --noninteractive do not prompt, automatically pick the first choice for
1178 -y --noninteractive do not prompt, automatically pick the first choice for
1179 all prompts
1179 all prompts
1180 -q --quiet suppress output
1180 -q --quiet suppress output
1181 -v --verbose enable additional output
1181 -v --verbose enable additional output
1182 --color TYPE when to colorize (boolean, always, auto, never, or
1182 --color TYPE when to colorize (boolean, always, auto, never, or
1183 debug)
1183 debug)
1184 --config CONFIG [+] set/override config option (use 'section.name=value')
1184 --config CONFIG [+] set/override config option (use 'section.name=value')
1185 --debug enable debugging output
1185 --debug enable debugging output
1186 --debugger start debugger
1186 --debugger start debugger
1187 --encoding ENCODE set the charset encoding (default: ascii)
1187 --encoding ENCODE set the charset encoding (default: ascii)
1188 --encodingmode MODE set the charset encoding mode (default: strict)
1188 --encodingmode MODE set the charset encoding mode (default: strict)
1189 --traceback always print a traceback on exception
1189 --traceback always print a traceback on exception
1190 --time time how long the command takes
1190 --time time how long the command takes
1191 --profile print command execution profile
1191 --profile print command execution profile
1192 --version output version information and exit
1192 --version output version information and exit
1193 -h --help display help and exit
1193 -h --help display help and exit
1194 --[no-]hidden consider hidden changesets (default: off)
1194 --hidden consider hidden changesets (default: off)
1195 --pager TYPE when to paginate (boolean, always, auto, or never)
1195 --pager TYPE when to paginate (boolean, always, auto, or never)
1196 (default: auto)
1196 (default: auto)
1197
1197
1198 Disabled extension commands:
1198 Disabled extension commands:
1199
1199
1200 $ ORGHGRCPATH=$HGRCPATH
1200 $ ORGHGRCPATH=$HGRCPATH
1201 $ HGRCPATH=
1201 $ HGRCPATH=
1202 $ export HGRCPATH
1202 $ export HGRCPATH
1203 $ hg help email
1203 $ hg help email
1204 'email' is provided by the following extension:
1204 'email' is provided by the following extension:
1205
1205
1206 patchbomb command to send changesets as (a series of) patch emails
1206 patchbomb command to send changesets as (a series of) patch emails
1207
1207
1208 (use 'hg help extensions' for information on enabling extensions)
1208 (use 'hg help extensions' for information on enabling extensions)
1209
1209
1210
1210
1211 $ hg qdel
1211 $ hg qdel
1212 hg: unknown command 'qdel'
1212 hg: unknown command 'qdel'
1213 'qdelete' is provided by the following extension:
1213 'qdelete' is provided by the following extension:
1214
1214
1215 mq manage a stack of patches
1215 mq manage a stack of patches
1216
1216
1217 (use 'hg help extensions' for information on enabling extensions)
1217 (use 'hg help extensions' for information on enabling extensions)
1218 [255]
1218 [255]
1219
1219
1220
1220
1221 $ hg churn
1221 $ hg churn
1222 hg: unknown command 'churn'
1222 hg: unknown command 'churn'
1223 'churn' is provided by the following extension:
1223 'churn' is provided by the following extension:
1224
1224
1225 churn command to display statistics about repository history
1225 churn command to display statistics about repository history
1226
1226
1227 (use 'hg help extensions' for information on enabling extensions)
1227 (use 'hg help extensions' for information on enabling extensions)
1228 [255]
1228 [255]
1229
1229
1230
1230
1231
1231
1232 Disabled extensions:
1232 Disabled extensions:
1233
1233
1234 $ hg help churn
1234 $ hg help churn
1235 churn extension - command to display statistics about repository history
1235 churn extension - command to display statistics about repository history
1236
1236
1237 (use 'hg help extensions' for information on enabling extensions)
1237 (use 'hg help extensions' for information on enabling extensions)
1238
1238
1239 $ hg help patchbomb
1239 $ hg help patchbomb
1240 patchbomb extension - command to send changesets as (a series of) patch emails
1240 patchbomb extension - command to send changesets as (a series of) patch emails
1241
1241
1242 The series is started off with a "[PATCH 0 of N]" introduction, which
1242 The series is started off with a "[PATCH 0 of N]" introduction, which
1243 describes the series as a whole.
1243 describes the series as a whole.
1244
1244
1245 Each patch email has a Subject line of "[PATCH M of N] ...", using the first
1245 Each patch email has a Subject line of "[PATCH M of N] ...", using the first
1246 line of the changeset description as the subject text. The message contains
1246 line of the changeset description as the subject text. The message contains
1247 two or three body parts:
1247 two or three body parts:
1248
1248
1249 - The changeset description.
1249 - The changeset description.
1250 - [Optional] The result of running diffstat on the patch.
1250 - [Optional] The result of running diffstat on the patch.
1251 - The patch itself, as generated by 'hg export'.
1251 - The patch itself, as generated by 'hg export'.
1252
1252
1253 Each message refers to the first in the series using the In-Reply-To and
1253 Each message refers to the first in the series using the In-Reply-To and
1254 References headers, so they will show up as a sequence in threaded mail and
1254 References headers, so they will show up as a sequence in threaded mail and
1255 news readers, and in mail archives.
1255 news readers, and in mail archives.
1256
1256
1257 To configure other defaults, add a section like this to your configuration
1257 To configure other defaults, add a section like this to your configuration
1258 file:
1258 file:
1259
1259
1260 [email]
1260 [email]
1261 from = My Name <my@email>
1261 from = My Name <my@email>
1262 to = recipient1, recipient2, ...
1262 to = recipient1, recipient2, ...
1263 cc = cc1, cc2, ...
1263 cc = cc1, cc2, ...
1264 bcc = bcc1, bcc2, ...
1264 bcc = bcc1, bcc2, ...
1265 reply-to = address1, address2, ...
1265 reply-to = address1, address2, ...
1266
1266
1267 Use "[patchbomb]" as configuration section name if you need to override global
1267 Use "[patchbomb]" as configuration section name if you need to override global
1268 "[email]" address settings.
1268 "[email]" address settings.
1269
1269
1270 Then you can use the 'hg email' command to mail a series of changesets as a
1270 Then you can use the 'hg email' command to mail a series of changesets as a
1271 patchbomb.
1271 patchbomb.
1272
1272
1273 You can also either configure the method option in the email section to be a
1273 You can also either configure the method option in the email section to be a
1274 sendmail compatible mailer or fill out the [smtp] section so that the
1274 sendmail compatible mailer or fill out the [smtp] section so that the
1275 patchbomb extension can automatically send patchbombs directly from the
1275 patchbomb extension can automatically send patchbombs directly from the
1276 commandline. See the [email] and [smtp] sections in hgrc(5) for details.
1276 commandline. See the [email] and [smtp] sections in hgrc(5) for details.
1277
1277
1278 By default, 'hg email' will prompt for a "To" or "CC" header if you do not
1278 By default, 'hg email' will prompt for a "To" or "CC" header if you do not
1279 supply one via configuration or the command line. You can override this to
1279 supply one via configuration or the command line. You can override this to
1280 never prompt by configuring an empty value:
1280 never prompt by configuring an empty value:
1281
1281
1282 [email]
1282 [email]
1283 cc =
1283 cc =
1284
1284
1285 You can control the default inclusion of an introduction message with the
1285 You can control the default inclusion of an introduction message with the
1286 "patchbomb.intro" configuration option. The configuration is always
1286 "patchbomb.intro" configuration option. The configuration is always
1287 overwritten by command line flags like --intro and --desc:
1287 overwritten by command line flags like --intro and --desc:
1288
1288
1289 [patchbomb]
1289 [patchbomb]
1290 intro=auto # include introduction message if more than 1 patch (default)
1290 intro=auto # include introduction message if more than 1 patch (default)
1291 intro=never # never include an introduction message
1291 intro=never # never include an introduction message
1292 intro=always # always include an introduction message
1292 intro=always # always include an introduction message
1293
1293
1294 You can specify a template for flags to be added in subject prefixes. Flags
1294 You can specify a template for flags to be added in subject prefixes. Flags
1295 specified by --flag option are exported as "{flags}" keyword:
1295 specified by --flag option are exported as "{flags}" keyword:
1296
1296
1297 [patchbomb]
1297 [patchbomb]
1298 flagtemplate = "{separate(' ',
1298 flagtemplate = "{separate(' ',
1299 ifeq(branch, 'default', '', branch|upper),
1299 ifeq(branch, 'default', '', branch|upper),
1300 flags)}"
1300 flags)}"
1301
1301
1302 You can set patchbomb to always ask for confirmation by setting
1302 You can set patchbomb to always ask for confirmation by setting
1303 "patchbomb.confirm" to true.
1303 "patchbomb.confirm" to true.
1304
1304
1305 (use 'hg help extensions' for information on enabling extensions)
1305 (use 'hg help extensions' for information on enabling extensions)
1306
1306
1307
1307
1308 Broken disabled extension and command:
1308 Broken disabled extension and command:
1309
1309
1310 $ mkdir hgext
1310 $ mkdir hgext
1311 $ echo > hgext/__init__.py
1311 $ echo > hgext/__init__.py
1312 $ cat > hgext/broken.py <<NO_CHECK_EOF
1312 $ cat > hgext/broken.py <<NO_CHECK_EOF
1313 > "broken extension'
1313 > "broken extension'
1314 > NO_CHECK_EOF
1314 > NO_CHECK_EOF
1315 $ cat > path.py <<EOF
1315 $ cat > path.py <<EOF
1316 > import os
1316 > import os
1317 > import sys
1317 > import sys
1318 > sys.path.insert(0, os.environ['HGEXTPATH'])
1318 > sys.path.insert(0, os.environ['HGEXTPATH'])
1319 > EOF
1319 > EOF
1320 $ HGEXTPATH=`pwd`
1320 $ HGEXTPATH=`pwd`
1321 $ export HGEXTPATH
1321 $ export HGEXTPATH
1322
1322
1323 $ hg --config extensions.path=./path.py help broken
1323 $ hg --config extensions.path=./path.py help broken
1324 broken extension - (no help text available)
1324 broken extension - (no help text available)
1325
1325
1326 (use 'hg help extensions' for information on enabling extensions)
1326 (use 'hg help extensions' for information on enabling extensions)
1327
1327
1328
1328
1329 $ cat > hgext/forest.py <<EOF
1329 $ cat > hgext/forest.py <<EOF
1330 > cmdtable = None
1330 > cmdtable = None
1331 > @command()
1331 > @command()
1332 > def f():
1332 > def f():
1333 > pass
1333 > pass
1334 > @command(123)
1334 > @command(123)
1335 > def g():
1335 > def g():
1336 > pass
1336 > pass
1337 > EOF
1337 > EOF
1338 $ hg --config extensions.path=./path.py help foo
1338 $ hg --config extensions.path=./path.py help foo
1339 abort: no such help topic: foo
1339 abort: no such help topic: foo
1340 (try 'hg help --keyword foo')
1340 (try 'hg help --keyword foo')
1341 [255]
1341 [255]
1342
1342
1343 $ cat > throw.py <<EOF
1343 $ cat > throw.py <<EOF
1344 > from mercurial import commands, registrar, util
1344 > from mercurial import commands, registrar, util
1345 > cmdtable = {}
1345 > cmdtable = {}
1346 > command = registrar.command(cmdtable)
1346 > command = registrar.command(cmdtable)
1347 > class Bogon(Exception): pass
1347 > class Bogon(Exception): pass
1348 > @command(b'throw', [], b'hg throw', norepo=True)
1348 > @command(b'throw', [], b'hg throw', norepo=True)
1349 > def throw(ui, **opts):
1349 > def throw(ui, **opts):
1350 > """throws an exception"""
1350 > """throws an exception"""
1351 > raise Bogon()
1351 > raise Bogon()
1352 > EOF
1352 > EOF
1353
1353
1354 No declared supported version, extension complains:
1354 No declared supported version, extension complains:
1355 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
1355 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
1356 ** Unknown exception encountered with possibly-broken third-party extension throw
1356 ** Unknown exception encountered with possibly-broken third-party extension throw
1357 ** which supports versions unknown of Mercurial.
1357 ** which supports versions unknown of Mercurial.
1358 ** Please disable throw and try your action again.
1358 ** Please disable throw and try your action again.
1359 ** If that fixes the bug please report it to the extension author.
1359 ** If that fixes the bug please report it to the extension author.
1360 ** Python * (glob)
1360 ** Python * (glob)
1361 ** Mercurial Distributed SCM * (glob)
1361 ** Mercurial Distributed SCM * (glob)
1362 ** Extensions loaded: throw
1362 ** Extensions loaded: throw
1363
1363
1364 empty declaration of supported version, extension complains:
1364 empty declaration of supported version, extension complains:
1365 $ echo "testedwith = ''" >> throw.py
1365 $ echo "testedwith = ''" >> throw.py
1366 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
1366 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
1367 ** Unknown exception encountered with possibly-broken third-party extension throw
1367 ** Unknown exception encountered with possibly-broken third-party extension throw
1368 ** which supports versions unknown of Mercurial.
1368 ** which supports versions unknown of Mercurial.
1369 ** Please disable throw and try your action again.
1369 ** Please disable throw and try your action again.
1370 ** If that fixes the bug please report it to the extension author.
1370 ** If that fixes the bug please report it to the extension author.
1371 ** Python * (glob)
1371 ** Python * (glob)
1372 ** Mercurial Distributed SCM (*) (glob)
1372 ** Mercurial Distributed SCM (*) (glob)
1373 ** Extensions loaded: throw
1373 ** Extensions loaded: throw
1374
1374
1375 If the extension specifies a buglink, show that:
1375 If the extension specifies a buglink, show that:
1376 $ echo 'buglink = "http://example.com/bts"' >> throw.py
1376 $ echo 'buglink = "http://example.com/bts"' >> throw.py
1377 $ rm -f throw.pyc throw.pyo
1377 $ rm -f throw.pyc throw.pyo
1378 $ rm -Rf __pycache__
1378 $ rm -Rf __pycache__
1379 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
1379 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
1380 ** Unknown exception encountered with possibly-broken third-party extension throw
1380 ** Unknown exception encountered with possibly-broken third-party extension throw
1381 ** which supports versions unknown of Mercurial.
1381 ** which supports versions unknown of Mercurial.
1382 ** Please disable throw and try your action again.
1382 ** Please disable throw and try your action again.
1383 ** If that fixes the bug please report it to http://example.com/bts
1383 ** If that fixes the bug please report it to http://example.com/bts
1384 ** Python * (glob)
1384 ** Python * (glob)
1385 ** Mercurial Distributed SCM (*) (glob)
1385 ** Mercurial Distributed SCM (*) (glob)
1386 ** Extensions loaded: throw
1386 ** Extensions loaded: throw
1387
1387
1388 If the extensions declare outdated versions, accuse the older extension first:
1388 If the extensions declare outdated versions, accuse the older extension first:
1389 $ echo "from mercurial import util" >> older.py
1389 $ echo "from mercurial import util" >> older.py
1390 $ echo "util.version = lambda:b'2.2'" >> older.py
1390 $ echo "util.version = lambda:b'2.2'" >> older.py
1391 $ echo "testedwith = b'1.9.3'" >> older.py
1391 $ echo "testedwith = b'1.9.3'" >> older.py
1392 $ echo "testedwith = b'2.1.1'" >> throw.py
1392 $ echo "testedwith = b'2.1.1'" >> throw.py
1393 $ rm -f throw.pyc throw.pyo
1393 $ rm -f throw.pyc throw.pyo
1394 $ rm -Rf __pycache__
1394 $ rm -Rf __pycache__
1395 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
1395 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
1396 > throw 2>&1 | egrep '^\*\*'
1396 > throw 2>&1 | egrep '^\*\*'
1397 ** Unknown exception encountered with possibly-broken third-party extension older
1397 ** Unknown exception encountered with possibly-broken third-party extension older
1398 ** which supports versions 1.9 of Mercurial.
1398 ** which supports versions 1.9 of Mercurial.
1399 ** Please disable older and try your action again.
1399 ** Please disable older and try your action again.
1400 ** If that fixes the bug please report it to the extension author.
1400 ** If that fixes the bug please report it to the extension author.
1401 ** Python * (glob)
1401 ** Python * (glob)
1402 ** Mercurial Distributed SCM (version 2.2)
1402 ** Mercurial Distributed SCM (version 2.2)
1403 ** Extensions loaded: throw, older
1403 ** Extensions loaded: throw, older
1404
1404
1405 One extension only tested with older, one only with newer versions:
1405 One extension only tested with older, one only with newer versions:
1406 $ echo "util.version = lambda:b'2.1'" >> older.py
1406 $ echo "util.version = lambda:b'2.1'" >> older.py
1407 $ rm -f older.pyc older.pyo
1407 $ rm -f older.pyc older.pyo
1408 $ rm -Rf __pycache__
1408 $ rm -Rf __pycache__
1409 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
1409 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
1410 > throw 2>&1 | egrep '^\*\*'
1410 > throw 2>&1 | egrep '^\*\*'
1411 ** Unknown exception encountered with possibly-broken third-party extension older
1411 ** Unknown exception encountered with possibly-broken third-party extension older
1412 ** which supports versions 1.9 of Mercurial.
1412 ** which supports versions 1.9 of Mercurial.
1413 ** Please disable older and try your action again.
1413 ** Please disable older and try your action again.
1414 ** If that fixes the bug please report it to the extension author.
1414 ** If that fixes the bug please report it to the extension author.
1415 ** Python * (glob)
1415 ** Python * (glob)
1416 ** Mercurial Distributed SCM (version 2.1)
1416 ** Mercurial Distributed SCM (version 2.1)
1417 ** Extensions loaded: throw, older
1417 ** Extensions loaded: throw, older
1418
1418
1419 Older extension is tested with current version, the other only with newer:
1419 Older extension is tested with current version, the other only with newer:
1420 $ echo "util.version = lambda:b'1.9.3'" >> older.py
1420 $ echo "util.version = lambda:b'1.9.3'" >> older.py
1421 $ rm -f older.pyc older.pyo
1421 $ rm -f older.pyc older.pyo
1422 $ rm -Rf __pycache__
1422 $ rm -Rf __pycache__
1423 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
1423 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
1424 > throw 2>&1 | egrep '^\*\*'
1424 > throw 2>&1 | egrep '^\*\*'
1425 ** Unknown exception encountered with possibly-broken third-party extension throw
1425 ** Unknown exception encountered with possibly-broken third-party extension throw
1426 ** which supports versions 2.1 of Mercurial.
1426 ** which supports versions 2.1 of Mercurial.
1427 ** Please disable throw and try your action again.
1427 ** Please disable throw and try your action again.
1428 ** If that fixes the bug please report it to http://example.com/bts
1428 ** If that fixes the bug please report it to http://example.com/bts
1429 ** Python * (glob)
1429 ** Python * (glob)
1430 ** Mercurial Distributed SCM (version 1.9.3)
1430 ** Mercurial Distributed SCM (version 1.9.3)
1431 ** Extensions loaded: throw, older
1431 ** Extensions loaded: throw, older
1432
1432
1433 Ability to point to a different point
1433 Ability to point to a different point
1434 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
1434 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
1435 > --config ui.supportcontact='Your Local Goat Lenders' throw 2>&1 | egrep '^\*\*'
1435 > --config ui.supportcontact='Your Local Goat Lenders' throw 2>&1 | egrep '^\*\*'
1436 ** unknown exception encountered, please report by visiting
1436 ** unknown exception encountered, please report by visiting
1437 ** Your Local Goat Lenders
1437 ** Your Local Goat Lenders
1438 ** Python * (glob)
1438 ** Python * (glob)
1439 ** Mercurial Distributed SCM (*) (glob)
1439 ** Mercurial Distributed SCM (*) (glob)
1440 ** Extensions loaded: throw, older
1440 ** Extensions loaded: throw, older
1441
1441
1442 Declare the version as supporting this hg version, show regular bts link:
1442 Declare the version as supporting this hg version, show regular bts link:
1443 $ hgver=`hg debuginstall -T '{hgver}'`
1443 $ hgver=`hg debuginstall -T '{hgver}'`
1444 $ echo 'testedwith = """'"$hgver"'"""' >> throw.py
1444 $ echo 'testedwith = """'"$hgver"'"""' >> throw.py
1445 $ if [ -z "$hgver" ]; then
1445 $ if [ -z "$hgver" ]; then
1446 > echo "unable to fetch a mercurial version. Make sure __version__ is correct";
1446 > echo "unable to fetch a mercurial version. Make sure __version__ is correct";
1447 > fi
1447 > fi
1448 $ rm -f throw.pyc throw.pyo
1448 $ rm -f throw.pyc throw.pyo
1449 $ rm -Rf __pycache__
1449 $ rm -Rf __pycache__
1450 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
1450 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
1451 ** unknown exception encountered, please report by visiting
1451 ** unknown exception encountered, please report by visiting
1452 ** https://mercurial-scm.org/wiki/BugTracker
1452 ** https://mercurial-scm.org/wiki/BugTracker
1453 ** Python * (glob)
1453 ** Python * (glob)
1454 ** Mercurial Distributed SCM (*) (glob)
1454 ** Mercurial Distributed SCM (*) (glob)
1455 ** Extensions loaded: throw
1455 ** Extensions loaded: throw
1456
1456
1457 Patch version is ignored during compatibility check
1457 Patch version is ignored during compatibility check
1458 $ echo "testedwith = b'3.2'" >> throw.py
1458 $ echo "testedwith = b'3.2'" >> throw.py
1459 $ echo "util.version = lambda:b'3.2.2'" >> throw.py
1459 $ echo "util.version = lambda:b'3.2.2'" >> throw.py
1460 $ rm -f throw.pyc throw.pyo
1460 $ rm -f throw.pyc throw.pyo
1461 $ rm -Rf __pycache__
1461 $ rm -Rf __pycache__
1462 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
1462 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
1463 ** unknown exception encountered, please report by visiting
1463 ** unknown exception encountered, please report by visiting
1464 ** https://mercurial-scm.org/wiki/BugTracker
1464 ** https://mercurial-scm.org/wiki/BugTracker
1465 ** Python * (glob)
1465 ** Python * (glob)
1466 ** Mercurial Distributed SCM (*) (glob)
1466 ** Mercurial Distributed SCM (*) (glob)
1467 ** Extensions loaded: throw
1467 ** Extensions loaded: throw
1468
1468
1469 Test version number support in 'hg version':
1469 Test version number support in 'hg version':
1470 $ echo '__version__ = (1, 2, 3)' >> throw.py
1470 $ echo '__version__ = (1, 2, 3)' >> throw.py
1471 $ rm -f throw.pyc throw.pyo
1471 $ rm -f throw.pyc throw.pyo
1472 $ rm -Rf __pycache__
1472 $ rm -Rf __pycache__
1473 $ hg version -v
1473 $ hg version -v
1474 Mercurial Distributed SCM (version *) (glob)
1474 Mercurial Distributed SCM (version *) (glob)
1475 (see https://mercurial-scm.org for more information)
1475 (see https://mercurial-scm.org for more information)
1476
1476
1477 Copyright (C) 2005-* Matt Mackall and others (glob)
1477 Copyright (C) 2005-* Matt Mackall and others (glob)
1478 This is free software; see the source for copying conditions. There is NO
1478 This is free software; see the source for copying conditions. There is NO
1479 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1479 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1480
1480
1481 Enabled extensions:
1481 Enabled extensions:
1482
1482
1483
1483
1484 $ hg version -v --config extensions.throw=throw.py
1484 $ hg version -v --config extensions.throw=throw.py
1485 Mercurial Distributed SCM (version *) (glob)
1485 Mercurial Distributed SCM (version *) (glob)
1486 (see https://mercurial-scm.org for more information)
1486 (see https://mercurial-scm.org for more information)
1487
1487
1488 Copyright (C) 2005-* Matt Mackall and others (glob)
1488 Copyright (C) 2005-* Matt Mackall and others (glob)
1489 This is free software; see the source for copying conditions. There is NO
1489 This is free software; see the source for copying conditions. There is NO
1490 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1490 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1491
1491
1492 Enabled extensions:
1492 Enabled extensions:
1493
1493
1494 throw external 1.2.3
1494 throw external 1.2.3
1495 $ echo 'getversion = lambda: b"1.twentythree"' >> throw.py
1495 $ echo 'getversion = lambda: b"1.twentythree"' >> throw.py
1496 $ rm -f throw.pyc throw.pyo
1496 $ rm -f throw.pyc throw.pyo
1497 $ rm -Rf __pycache__
1497 $ rm -Rf __pycache__
1498 $ hg version -v --config extensions.throw=throw.py --config extensions.strip=
1498 $ hg version -v --config extensions.throw=throw.py --config extensions.strip=
1499 Mercurial Distributed SCM (version *) (glob)
1499 Mercurial Distributed SCM (version *) (glob)
1500 (see https://mercurial-scm.org for more information)
1500 (see https://mercurial-scm.org for more information)
1501
1501
1502 Copyright (C) 2005-* Matt Mackall and others (glob)
1502 Copyright (C) 2005-* Matt Mackall and others (glob)
1503 This is free software; see the source for copying conditions. There is NO
1503 This is free software; see the source for copying conditions. There is NO
1504 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1504 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1505
1505
1506 Enabled extensions:
1506 Enabled extensions:
1507
1507
1508 throw external 1.twentythree
1508 throw external 1.twentythree
1509 strip internal
1509 strip internal
1510
1510
1511 $ hg version -q --config extensions.throw=throw.py
1511 $ hg version -q --config extensions.throw=throw.py
1512 Mercurial Distributed SCM (version *) (glob)
1512 Mercurial Distributed SCM (version *) (glob)
1513
1513
1514 Test template output:
1514 Test template output:
1515
1515
1516 $ hg version --config extensions.strip= -T'{extensions}'
1516 $ hg version --config extensions.strip= -T'{extensions}'
1517 strip
1517 strip
1518
1518
1519 Test JSON output of version:
1519 Test JSON output of version:
1520
1520
1521 $ hg version -Tjson
1521 $ hg version -Tjson
1522 [
1522 [
1523 {
1523 {
1524 "extensions": [],
1524 "extensions": [],
1525 "ver": "*" (glob)
1525 "ver": "*" (glob)
1526 }
1526 }
1527 ]
1527 ]
1528
1528
1529 $ hg version --config extensions.throw=throw.py -Tjson
1529 $ hg version --config extensions.throw=throw.py -Tjson
1530 [
1530 [
1531 {
1531 {
1532 "extensions": [{"bundled": false, "name": "throw", "ver": "1.twentythree"}],
1532 "extensions": [{"bundled": false, "name": "throw", "ver": "1.twentythree"}],
1533 "ver": "3.2.2"
1533 "ver": "3.2.2"
1534 }
1534 }
1535 ]
1535 ]
1536
1536
1537 $ hg version --config extensions.strip= -Tjson
1537 $ hg version --config extensions.strip= -Tjson
1538 [
1538 [
1539 {
1539 {
1540 "extensions": [{"bundled": true, "name": "strip", "ver": null}],
1540 "extensions": [{"bundled": true, "name": "strip", "ver": null}],
1541 "ver": "*" (glob)
1541 "ver": "*" (glob)
1542 }
1542 }
1543 ]
1543 ]
1544
1544
1545 Test template output of version:
1545 Test template output of version:
1546
1546
1547 $ hg version --config extensions.throw=throw.py --config extensions.strip= \
1547 $ hg version --config extensions.throw=throw.py --config extensions.strip= \
1548 > -T'{extensions % "{name} {pad(ver, 16)} ({if(bundled, "internal", "external")})\n"}'
1548 > -T'{extensions % "{name} {pad(ver, 16)} ({if(bundled, "internal", "external")})\n"}'
1549 throw 1.twentythree (external)
1549 throw 1.twentythree (external)
1550 strip (internal)
1550 strip (internal)
1551
1551
1552 Refuse to load extensions with minimum version requirements
1552 Refuse to load extensions with minimum version requirements
1553
1553
1554 $ cat > minversion1.py << EOF
1554 $ cat > minversion1.py << EOF
1555 > from mercurial import util
1555 > from mercurial import util
1556 > util.version = lambda: b'3.5.2'
1556 > util.version = lambda: b'3.5.2'
1557 > minimumhgversion = b'3.6'
1557 > minimumhgversion = b'3.6'
1558 > EOF
1558 > EOF
1559 $ hg --config extensions.minversion=minversion1.py version
1559 $ hg --config extensions.minversion=minversion1.py version
1560 (third party extension minversion requires version 3.6 or newer of Mercurial (current: 3.5.2); disabling)
1560 (third party extension minversion requires version 3.6 or newer of Mercurial (current: 3.5.2); disabling)
1561 Mercurial Distributed SCM (version 3.5.2)
1561 Mercurial Distributed SCM (version 3.5.2)
1562 (see https://mercurial-scm.org for more information)
1562 (see https://mercurial-scm.org for more information)
1563
1563
1564 Copyright (C) 2005-* Matt Mackall and others (glob)
1564 Copyright (C) 2005-* Matt Mackall and others (glob)
1565 This is free software; see the source for copying conditions. There is NO
1565 This is free software; see the source for copying conditions. There is NO
1566 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1566 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1567
1567
1568 $ cat > minversion2.py << EOF
1568 $ cat > minversion2.py << EOF
1569 > from mercurial import util
1569 > from mercurial import util
1570 > util.version = lambda: b'3.6'
1570 > util.version = lambda: b'3.6'
1571 > minimumhgversion = b'3.7'
1571 > minimumhgversion = b'3.7'
1572 > EOF
1572 > EOF
1573 $ hg --config extensions.minversion=minversion2.py version 2>&1 | egrep '\(third'
1573 $ hg --config extensions.minversion=minversion2.py version 2>&1 | egrep '\(third'
1574 (third party extension minversion requires version 3.7 or newer of Mercurial (current: 3.6); disabling)
1574 (third party extension minversion requires version 3.7 or newer of Mercurial (current: 3.6); disabling)
1575
1575
1576 Can load version that is only off by point release
1576 Can load version that is only off by point release
1577
1577
1578 $ cat > minversion2.py << EOF
1578 $ cat > minversion2.py << EOF
1579 > from mercurial import util
1579 > from mercurial import util
1580 > util.version = lambda: b'3.6.1'
1580 > util.version = lambda: b'3.6.1'
1581 > minimumhgversion = b'3.6'
1581 > minimumhgversion = b'3.6'
1582 > EOF
1582 > EOF
1583 $ hg --config extensions.minversion=minversion3.py version 2>&1 | egrep '\(third'
1583 $ hg --config extensions.minversion=minversion3.py version 2>&1 | egrep '\(third'
1584 [1]
1584 [1]
1585
1585
1586 Can load minimum version identical to current
1586 Can load minimum version identical to current
1587
1587
1588 $ cat > minversion3.py << EOF
1588 $ cat > minversion3.py << EOF
1589 > from mercurial import util
1589 > from mercurial import util
1590 > util.version = lambda: b'3.5'
1590 > util.version = lambda: b'3.5'
1591 > minimumhgversion = b'3.5'
1591 > minimumhgversion = b'3.5'
1592 > EOF
1592 > EOF
1593 $ hg --config extensions.minversion=minversion3.py version 2>&1 | egrep '\(third'
1593 $ hg --config extensions.minversion=minversion3.py version 2>&1 | egrep '\(third'
1594 [1]
1594 [1]
1595
1595
1596 Restore HGRCPATH
1596 Restore HGRCPATH
1597
1597
1598 $ HGRCPATH=$ORGHGRCPATH
1598 $ HGRCPATH=$ORGHGRCPATH
1599 $ export HGRCPATH
1599 $ export HGRCPATH
1600
1600
1601 Commands handling multiple repositories at a time should invoke only
1601 Commands handling multiple repositories at a time should invoke only
1602 "reposetup()" of extensions enabling in the target repository.
1602 "reposetup()" of extensions enabling in the target repository.
1603
1603
1604 $ mkdir reposetup-test
1604 $ mkdir reposetup-test
1605 $ cd reposetup-test
1605 $ cd reposetup-test
1606
1606
1607 $ cat > $TESTTMP/reposetuptest.py <<EOF
1607 $ cat > $TESTTMP/reposetuptest.py <<EOF
1608 > from mercurial import extensions
1608 > from mercurial import extensions
1609 > def reposetup(ui, repo):
1609 > def reposetup(ui, repo):
1610 > ui.write(b'reposetup() for %s\n' % (repo.root))
1610 > ui.write(b'reposetup() for %s\n' % (repo.root))
1611 > ui.flush()
1611 > ui.flush()
1612 > EOF
1612 > EOF
1613 $ hg init src
1613 $ hg init src
1614 $ echo a > src/a
1614 $ echo a > src/a
1615 $ hg -R src commit -Am '#0 at src/a'
1615 $ hg -R src commit -Am '#0 at src/a'
1616 adding a
1616 adding a
1617 $ echo '[extensions]' >> src/.hg/hgrc
1617 $ echo '[extensions]' >> src/.hg/hgrc
1618 $ echo '# enable extension locally' >> src/.hg/hgrc
1618 $ echo '# enable extension locally' >> src/.hg/hgrc
1619 $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> src/.hg/hgrc
1619 $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> src/.hg/hgrc
1620 $ hg -R src status
1620 $ hg -R src status
1621 reposetup() for $TESTTMP/reposetup-test/src
1621 reposetup() for $TESTTMP/reposetup-test/src
1622 reposetup() for $TESTTMP/reposetup-test/src (chg !)
1622 reposetup() for $TESTTMP/reposetup-test/src (chg !)
1623
1623
1624 #if no-extraextensions
1624 #if no-extraextensions
1625 $ hg --cwd src debugextensions
1625 $ hg --cwd src debugextensions
1626 reposetup() for $TESTTMP/reposetup-test/src
1626 reposetup() for $TESTTMP/reposetup-test/src
1627 dodo (untested!)
1627 dodo (untested!)
1628 dudu (untested!)
1628 dudu (untested!)
1629 mq
1629 mq
1630 reposetuptest (untested!)
1630 reposetuptest (untested!)
1631 strip
1631 strip
1632 #endif
1632 #endif
1633
1633
1634 $ hg clone -U src clone-dst1
1634 $ hg clone -U src clone-dst1
1635 reposetup() for $TESTTMP/reposetup-test/src
1635 reposetup() for $TESTTMP/reposetup-test/src
1636 $ hg init push-dst1
1636 $ hg init push-dst1
1637 $ hg -q -R src push push-dst1
1637 $ hg -q -R src push push-dst1
1638 reposetup() for $TESTTMP/reposetup-test/src
1638 reposetup() for $TESTTMP/reposetup-test/src
1639 $ hg init pull-src1
1639 $ hg init pull-src1
1640 $ hg -q -R pull-src1 pull src
1640 $ hg -q -R pull-src1 pull src
1641 reposetup() for $TESTTMP/reposetup-test/src
1641 reposetup() for $TESTTMP/reposetup-test/src
1642
1642
1643 $ cat <<EOF >> $HGRCPATH
1643 $ cat <<EOF >> $HGRCPATH
1644 > [extensions]
1644 > [extensions]
1645 > # disable extension globally and explicitly
1645 > # disable extension globally and explicitly
1646 > reposetuptest = !
1646 > reposetuptest = !
1647 > EOF
1647 > EOF
1648 $ hg clone -U src clone-dst2
1648 $ hg clone -U src clone-dst2
1649 reposetup() for $TESTTMP/reposetup-test/src
1649 reposetup() for $TESTTMP/reposetup-test/src
1650 $ hg init push-dst2
1650 $ hg init push-dst2
1651 $ hg -q -R src push push-dst2
1651 $ hg -q -R src push push-dst2
1652 reposetup() for $TESTTMP/reposetup-test/src
1652 reposetup() for $TESTTMP/reposetup-test/src
1653 $ hg init pull-src2
1653 $ hg init pull-src2
1654 $ hg -q -R pull-src2 pull src
1654 $ hg -q -R pull-src2 pull src
1655 reposetup() for $TESTTMP/reposetup-test/src
1655 reposetup() for $TESTTMP/reposetup-test/src
1656
1656
1657 $ cat <<EOF >> $HGRCPATH
1657 $ cat <<EOF >> $HGRCPATH
1658 > [extensions]
1658 > [extensions]
1659 > # enable extension globally
1659 > # enable extension globally
1660 > reposetuptest = $TESTTMP/reposetuptest.py
1660 > reposetuptest = $TESTTMP/reposetuptest.py
1661 > EOF
1661 > EOF
1662 $ hg clone -U src clone-dst3
1662 $ hg clone -U src clone-dst3
1663 reposetup() for $TESTTMP/reposetup-test/src
1663 reposetup() for $TESTTMP/reposetup-test/src
1664 reposetup() for $TESTTMP/reposetup-test/clone-dst3
1664 reposetup() for $TESTTMP/reposetup-test/clone-dst3
1665 $ hg init push-dst3
1665 $ hg init push-dst3
1666 reposetup() for $TESTTMP/reposetup-test/push-dst3
1666 reposetup() for $TESTTMP/reposetup-test/push-dst3
1667 $ hg -q -R src push push-dst3
1667 $ hg -q -R src push push-dst3
1668 reposetup() for $TESTTMP/reposetup-test/src
1668 reposetup() for $TESTTMP/reposetup-test/src
1669 reposetup() for $TESTTMP/reposetup-test/push-dst3
1669 reposetup() for $TESTTMP/reposetup-test/push-dst3
1670 $ hg init pull-src3
1670 $ hg init pull-src3
1671 reposetup() for $TESTTMP/reposetup-test/pull-src3
1671 reposetup() for $TESTTMP/reposetup-test/pull-src3
1672 $ hg -q -R pull-src3 pull src
1672 $ hg -q -R pull-src3 pull src
1673 reposetup() for $TESTTMP/reposetup-test/pull-src3
1673 reposetup() for $TESTTMP/reposetup-test/pull-src3
1674 reposetup() for $TESTTMP/reposetup-test/src
1674 reposetup() for $TESTTMP/reposetup-test/src
1675
1675
1676 $ echo '[extensions]' >> src/.hg/hgrc
1676 $ echo '[extensions]' >> src/.hg/hgrc
1677 $ echo '# disable extension locally' >> src/.hg/hgrc
1677 $ echo '# disable extension locally' >> src/.hg/hgrc
1678 $ echo 'reposetuptest = !' >> src/.hg/hgrc
1678 $ echo 'reposetuptest = !' >> src/.hg/hgrc
1679 $ hg clone -U src clone-dst4
1679 $ hg clone -U src clone-dst4
1680 reposetup() for $TESTTMP/reposetup-test/clone-dst4
1680 reposetup() for $TESTTMP/reposetup-test/clone-dst4
1681 $ hg init push-dst4
1681 $ hg init push-dst4
1682 reposetup() for $TESTTMP/reposetup-test/push-dst4
1682 reposetup() for $TESTTMP/reposetup-test/push-dst4
1683 $ hg -q -R src push push-dst4
1683 $ hg -q -R src push push-dst4
1684 reposetup() for $TESTTMP/reposetup-test/push-dst4
1684 reposetup() for $TESTTMP/reposetup-test/push-dst4
1685 $ hg init pull-src4
1685 $ hg init pull-src4
1686 reposetup() for $TESTTMP/reposetup-test/pull-src4
1686 reposetup() for $TESTTMP/reposetup-test/pull-src4
1687 $ hg -q -R pull-src4 pull src
1687 $ hg -q -R pull-src4 pull src
1688 reposetup() for $TESTTMP/reposetup-test/pull-src4
1688 reposetup() for $TESTTMP/reposetup-test/pull-src4
1689
1689
1690 disabling in command line overlays with all configuration
1690 disabling in command line overlays with all configuration
1691 $ hg --config extensions.reposetuptest=! clone -U src clone-dst5
1691 $ hg --config extensions.reposetuptest=! clone -U src clone-dst5
1692 $ hg --config extensions.reposetuptest=! init push-dst5
1692 $ hg --config extensions.reposetuptest=! init push-dst5
1693 $ hg --config extensions.reposetuptest=! -q -R src push push-dst5
1693 $ hg --config extensions.reposetuptest=! -q -R src push push-dst5
1694 $ hg --config extensions.reposetuptest=! init pull-src5
1694 $ hg --config extensions.reposetuptest=! init pull-src5
1695 $ hg --config extensions.reposetuptest=! -q -R pull-src5 pull src
1695 $ hg --config extensions.reposetuptest=! -q -R pull-src5 pull src
1696
1696
1697 $ cat <<EOF >> $HGRCPATH
1697 $ cat <<EOF >> $HGRCPATH
1698 > [extensions]
1698 > [extensions]
1699 > # disable extension globally and explicitly
1699 > # disable extension globally and explicitly
1700 > reposetuptest = !
1700 > reposetuptest = !
1701 > EOF
1701 > EOF
1702 $ hg init parent
1702 $ hg init parent
1703 $ hg init parent/sub1
1703 $ hg init parent/sub1
1704 $ echo 1 > parent/sub1/1
1704 $ echo 1 > parent/sub1/1
1705 $ hg -R parent/sub1 commit -Am '#0 at parent/sub1'
1705 $ hg -R parent/sub1 commit -Am '#0 at parent/sub1'
1706 adding 1
1706 adding 1
1707 $ hg init parent/sub2
1707 $ hg init parent/sub2
1708 $ hg init parent/sub2/sub21
1708 $ hg init parent/sub2/sub21
1709 $ echo 21 > parent/sub2/sub21/21
1709 $ echo 21 > parent/sub2/sub21/21
1710 $ hg -R parent/sub2/sub21 commit -Am '#0 at parent/sub2/sub21'
1710 $ hg -R parent/sub2/sub21 commit -Am '#0 at parent/sub2/sub21'
1711 adding 21
1711 adding 21
1712 $ cat > parent/sub2/.hgsub <<EOF
1712 $ cat > parent/sub2/.hgsub <<EOF
1713 > sub21 = sub21
1713 > sub21 = sub21
1714 > EOF
1714 > EOF
1715 $ hg -R parent/sub2 commit -Am '#0 at parent/sub2'
1715 $ hg -R parent/sub2 commit -Am '#0 at parent/sub2'
1716 adding .hgsub
1716 adding .hgsub
1717 $ hg init parent/sub3
1717 $ hg init parent/sub3
1718 $ echo 3 > parent/sub3/3
1718 $ echo 3 > parent/sub3/3
1719 $ hg -R parent/sub3 commit -Am '#0 at parent/sub3'
1719 $ hg -R parent/sub3 commit -Am '#0 at parent/sub3'
1720 adding 3
1720 adding 3
1721 $ cat > parent/.hgsub <<EOF
1721 $ cat > parent/.hgsub <<EOF
1722 > sub1 = sub1
1722 > sub1 = sub1
1723 > sub2 = sub2
1723 > sub2 = sub2
1724 > sub3 = sub3
1724 > sub3 = sub3
1725 > EOF
1725 > EOF
1726 $ hg -R parent commit -Am '#0 at parent'
1726 $ hg -R parent commit -Am '#0 at parent'
1727 adding .hgsub
1727 adding .hgsub
1728 $ echo '[extensions]' >> parent/.hg/hgrc
1728 $ echo '[extensions]' >> parent/.hg/hgrc
1729 $ echo '# enable extension locally' >> parent/.hg/hgrc
1729 $ echo '# enable extension locally' >> parent/.hg/hgrc
1730 $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> parent/.hg/hgrc
1730 $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> parent/.hg/hgrc
1731 $ cp parent/.hg/hgrc parent/sub2/.hg/hgrc
1731 $ cp parent/.hg/hgrc parent/sub2/.hg/hgrc
1732 $ hg -R parent status -S -A
1732 $ hg -R parent status -S -A
1733 reposetup() for $TESTTMP/reposetup-test/parent
1733 reposetup() for $TESTTMP/reposetup-test/parent
1734 reposetup() for $TESTTMP/reposetup-test/parent/sub2
1734 reposetup() for $TESTTMP/reposetup-test/parent/sub2
1735 C .hgsub
1735 C .hgsub
1736 C .hgsubstate
1736 C .hgsubstate
1737 C sub1/1
1737 C sub1/1
1738 C sub2/.hgsub
1738 C sub2/.hgsub
1739 C sub2/.hgsubstate
1739 C sub2/.hgsubstate
1740 C sub2/sub21/21
1740 C sub2/sub21/21
1741 C sub3/3
1741 C sub3/3
1742
1742
1743 $ cd ..
1743 $ cd ..
1744
1744
1745 Prohibit registration of commands that don't use @command (issue5137)
1745 Prohibit registration of commands that don't use @command (issue5137)
1746
1746
1747 $ hg init deprecated
1747 $ hg init deprecated
1748 $ cd deprecated
1748 $ cd deprecated
1749
1749
1750 $ cat <<EOF > deprecatedcmd.py
1750 $ cat <<EOF > deprecatedcmd.py
1751 > def deprecatedcmd(repo, ui):
1751 > def deprecatedcmd(repo, ui):
1752 > pass
1752 > pass
1753 > cmdtable = {
1753 > cmdtable = {
1754 > b'deprecatedcmd': (deprecatedcmd, [], b''),
1754 > b'deprecatedcmd': (deprecatedcmd, [], b''),
1755 > }
1755 > }
1756 > EOF
1756 > EOF
1757 $ cat <<EOF > .hg/hgrc
1757 $ cat <<EOF > .hg/hgrc
1758 > [extensions]
1758 > [extensions]
1759 > deprecatedcmd = `pwd`/deprecatedcmd.py
1759 > deprecatedcmd = `pwd`/deprecatedcmd.py
1760 > mq = !
1760 > mq = !
1761 > hgext.mq = !
1761 > hgext.mq = !
1762 > hgext/mq = !
1762 > hgext/mq = !
1763 > EOF
1763 > EOF
1764
1764
1765 $ hg deprecatedcmd > /dev/null
1765 $ hg deprecatedcmd > /dev/null
1766 *** failed to import extension deprecatedcmd from $TESTTMP/deprecated/deprecatedcmd.py: missing attributes: norepo, optionalrepo, inferrepo
1766 *** failed to import extension deprecatedcmd from $TESTTMP/deprecated/deprecatedcmd.py: missing attributes: norepo, optionalrepo, inferrepo
1767 *** (use @command decorator to register 'deprecatedcmd')
1767 *** (use @command decorator to register 'deprecatedcmd')
1768 hg: unknown command 'deprecatedcmd'
1768 hg: unknown command 'deprecatedcmd'
1769 (use 'hg help' for a list of commands)
1769 (use 'hg help' for a list of commands)
1770 [255]
1770 [255]
1771
1771
1772 the extension shouldn't be loaded at all so the mq works:
1772 the extension shouldn't be loaded at all so the mq works:
1773
1773
1774 $ hg qseries --config extensions.mq= > /dev/null
1774 $ hg qseries --config extensions.mq= > /dev/null
1775 *** failed to import extension deprecatedcmd from $TESTTMP/deprecated/deprecatedcmd.py: missing attributes: norepo, optionalrepo, inferrepo
1775 *** failed to import extension deprecatedcmd from $TESTTMP/deprecated/deprecatedcmd.py: missing attributes: norepo, optionalrepo, inferrepo
1776 *** (use @command decorator to register 'deprecatedcmd')
1776 *** (use @command decorator to register 'deprecatedcmd')
1777
1777
1778 $ cd ..
1778 $ cd ..
1779
1779
1780 Test synopsis and docstring extending
1780 Test synopsis and docstring extending
1781
1781
1782 $ hg init exthelp
1782 $ hg init exthelp
1783 $ cat > exthelp.py <<EOF
1783 $ cat > exthelp.py <<EOF
1784 > from mercurial import commands, extensions
1784 > from mercurial import commands, extensions
1785 > def exbookmarks(orig, *args, **opts):
1785 > def exbookmarks(orig, *args, **opts):
1786 > return orig(*args, **opts)
1786 > return orig(*args, **opts)
1787 > def uisetup(ui):
1787 > def uisetup(ui):
1788 > synopsis = b' GREPME [--foo] [-x]'
1788 > synopsis = b' GREPME [--foo] [-x]'
1789 > docstring = '''
1789 > docstring = '''
1790 > GREPME make sure that this is in the help!
1790 > GREPME make sure that this is in the help!
1791 > '''
1791 > '''
1792 > extensions.wrapcommand(commands.table, b'bookmarks', exbookmarks,
1792 > extensions.wrapcommand(commands.table, b'bookmarks', exbookmarks,
1793 > synopsis, docstring)
1793 > synopsis, docstring)
1794 > EOF
1794 > EOF
1795 $ abspath=`pwd`/exthelp.py
1795 $ abspath=`pwd`/exthelp.py
1796 $ echo '[extensions]' >> $HGRCPATH
1796 $ echo '[extensions]' >> $HGRCPATH
1797 $ echo "exthelp = $abspath" >> $HGRCPATH
1797 $ echo "exthelp = $abspath" >> $HGRCPATH
1798 $ cd exthelp
1798 $ cd exthelp
1799 $ hg help bookmarks | grep GREPME
1799 $ hg help bookmarks | grep GREPME
1800 hg bookmarks [OPTIONS]... [NAME]... GREPME [--foo] [-x]
1800 hg bookmarks [OPTIONS]... [NAME]... GREPME [--foo] [-x]
1801 GREPME make sure that this is in the help!
1801 GREPME make sure that this is in the help!
1802 $ cd ..
1802 $ cd ..
1803
1803
1804 Show deprecation warning for the use of cmdutil.command
1804 Show deprecation warning for the use of cmdutil.command
1805
1805
1806 $ cat > nonregistrar.py <<EOF
1806 $ cat > nonregistrar.py <<EOF
1807 > from mercurial import cmdutil
1807 > from mercurial import cmdutil
1808 > cmdtable = {}
1808 > cmdtable = {}
1809 > command = cmdutil.command(cmdtable)
1809 > command = cmdutil.command(cmdtable)
1810 > @command(b'foo', [], norepo=True)
1810 > @command(b'foo', [], norepo=True)
1811 > def foo(ui):
1811 > def foo(ui):
1812 > pass
1812 > pass
1813 > EOF
1813 > EOF
1814
1814
1815 Prohibit the use of unicode strings as the default value of options
1815 Prohibit the use of unicode strings as the default value of options
1816
1816
1817 $ hg init $TESTTMP/opt-unicode-default
1817 $ hg init $TESTTMP/opt-unicode-default
1818
1818
1819 $ cat > $TESTTMP/test_unicode_default_value.py << EOF
1819 $ cat > $TESTTMP/test_unicode_default_value.py << EOF
1820 > from __future__ import print_function
1820 > from __future__ import print_function
1821 > from mercurial import registrar
1821 > from mercurial import registrar
1822 > cmdtable = {}
1822 > cmdtable = {}
1823 > command = registrar.command(cmdtable)
1823 > command = registrar.command(cmdtable)
1824 > @command(b'dummy', [(b'', b'opt', u'value', u'help')], 'ext [OPTIONS]')
1824 > @command(b'dummy', [(b'', b'opt', u'value', u'help')], 'ext [OPTIONS]')
1825 > def ext(*args, **opts):
1825 > def ext(*args, **opts):
1826 > print(opts[b'opt'], flush=True)
1826 > print(opts[b'opt'], flush=True)
1827 > EOF
1827 > EOF
1828 $ "$PYTHON" $TESTTMP/unflush.py $TESTTMP/test_unicode_default_value.py
1828 $ "$PYTHON" $TESTTMP/unflush.py $TESTTMP/test_unicode_default_value.py
1829 $ cat > $TESTTMP/opt-unicode-default/.hg/hgrc << EOF
1829 $ cat > $TESTTMP/opt-unicode-default/.hg/hgrc << EOF
1830 > [extensions]
1830 > [extensions]
1831 > test_unicode_default_value = $TESTTMP/test_unicode_default_value.py
1831 > test_unicode_default_value = $TESTTMP/test_unicode_default_value.py
1832 > EOF
1832 > EOF
1833 $ hg -R $TESTTMP/opt-unicode-default dummy
1833 $ hg -R $TESTTMP/opt-unicode-default dummy
1834 *** failed to import extension test_unicode_default_value from $TESTTMP/test_unicode_default_value.py: unicode *'value' found in cmdtable.dummy (glob)
1834 *** failed to import extension test_unicode_default_value from $TESTTMP/test_unicode_default_value.py: unicode *'value' found in cmdtable.dummy (glob)
1835 *** (use b'' to make it byte string)
1835 *** (use b'' to make it byte string)
1836 hg: unknown command 'dummy'
1836 hg: unknown command 'dummy'
1837 (did you mean summary?)
1837 (did you mean summary?)
1838 [255]
1838 [255]
@@ -1,1232 +1,1231 b''
1 A script that implements uppercasing of specific lines in a file. This
1 A script that implements uppercasing of specific lines in a file. This
2 approximates the behavior of code formatters well enough for our tests.
2 approximates the behavior of code formatters well enough for our tests.
3
3
4 $ UPPERCASEPY="$TESTTMP/uppercase.py"
4 $ UPPERCASEPY="$TESTTMP/uppercase.py"
5 $ cat > $UPPERCASEPY <<EOF
5 $ cat > $UPPERCASEPY <<EOF
6 > import sys
6 > import sys
7 > from mercurial.utils.procutil import setbinary
7 > from mercurial.utils.procutil import setbinary
8 > setbinary(sys.stdin)
8 > setbinary(sys.stdin)
9 > setbinary(sys.stdout)
9 > setbinary(sys.stdout)
10 > lines = set()
10 > lines = set()
11 > for arg in sys.argv[1:]:
11 > for arg in sys.argv[1:]:
12 > if arg == 'all':
12 > if arg == 'all':
13 > sys.stdout.write(sys.stdin.read().upper())
13 > sys.stdout.write(sys.stdin.read().upper())
14 > sys.exit(0)
14 > sys.exit(0)
15 > else:
15 > else:
16 > first, last = arg.split('-')
16 > first, last = arg.split('-')
17 > lines.update(range(int(first), int(last) + 1))
17 > lines.update(range(int(first), int(last) + 1))
18 > for i, line in enumerate(sys.stdin.readlines()):
18 > for i, line in enumerate(sys.stdin.readlines()):
19 > if i + 1 in lines:
19 > if i + 1 in lines:
20 > sys.stdout.write(line.upper())
20 > sys.stdout.write(line.upper())
21 > else:
21 > else:
22 > sys.stdout.write(line)
22 > sys.stdout.write(line)
23 > EOF
23 > EOF
24 $ TESTLINES="foo\nbar\nbaz\nqux\n"
24 $ TESTLINES="foo\nbar\nbaz\nqux\n"
25 $ printf $TESTLINES | "$PYTHON" $UPPERCASEPY
25 $ printf $TESTLINES | "$PYTHON" $UPPERCASEPY
26 foo
26 foo
27 bar
27 bar
28 baz
28 baz
29 qux
29 qux
30 $ printf $TESTLINES | "$PYTHON" $UPPERCASEPY all
30 $ printf $TESTLINES | "$PYTHON" $UPPERCASEPY all
31 FOO
31 FOO
32 BAR
32 BAR
33 BAZ
33 BAZ
34 QUX
34 QUX
35 $ printf $TESTLINES | "$PYTHON" $UPPERCASEPY 1-1
35 $ printf $TESTLINES | "$PYTHON" $UPPERCASEPY 1-1
36 FOO
36 FOO
37 bar
37 bar
38 baz
38 baz
39 qux
39 qux
40 $ printf $TESTLINES | "$PYTHON" $UPPERCASEPY 1-2
40 $ printf $TESTLINES | "$PYTHON" $UPPERCASEPY 1-2
41 FOO
41 FOO
42 BAR
42 BAR
43 baz
43 baz
44 qux
44 qux
45 $ printf $TESTLINES | "$PYTHON" $UPPERCASEPY 2-3
45 $ printf $TESTLINES | "$PYTHON" $UPPERCASEPY 2-3
46 foo
46 foo
47 BAR
47 BAR
48 BAZ
48 BAZ
49 qux
49 qux
50 $ printf $TESTLINES | "$PYTHON" $UPPERCASEPY 2-2 4-4
50 $ printf $TESTLINES | "$PYTHON" $UPPERCASEPY 2-2 4-4
51 foo
51 foo
52 BAR
52 BAR
53 baz
53 baz
54 QUX
54 QUX
55
55
56 Set up the config with two simple fixers: one that fixes specific line ranges,
56 Set up the config with two simple fixers: one that fixes specific line ranges,
57 and one that always fixes the whole file. They both "fix" files by converting
57 and one that always fixes the whole file. They both "fix" files by converting
58 letters to uppercase. They use different file extensions, so each test case can
58 letters to uppercase. They use different file extensions, so each test case can
59 choose which behavior to use by naming files.
59 choose which behavior to use by naming files.
60
60
61 $ cat >> $HGRCPATH <<EOF
61 $ cat >> $HGRCPATH <<EOF
62 > [extensions]
62 > [extensions]
63 > fix =
63 > fix =
64 > [experimental]
64 > [experimental]
65 > evolution.createmarkers=True
65 > evolution.createmarkers=True
66 > evolution.allowunstable=True
66 > evolution.allowunstable=True
67 > [fix]
67 > [fix]
68 > uppercase-whole-file:command="$PYTHON" $UPPERCASEPY all
68 > uppercase-whole-file:command="$PYTHON" $UPPERCASEPY all
69 > uppercase-whole-file:pattern=set:**.whole
69 > uppercase-whole-file:pattern=set:**.whole
70 > uppercase-changed-lines:command="$PYTHON" $UPPERCASEPY
70 > uppercase-changed-lines:command="$PYTHON" $UPPERCASEPY
71 > uppercase-changed-lines:linerange={first}-{last}
71 > uppercase-changed-lines:linerange={first}-{last}
72 > uppercase-changed-lines:pattern=set:**.changed
72 > uppercase-changed-lines:pattern=set:**.changed
73 > EOF
73 > EOF
74
74
75 Help text for fix.
75 Help text for fix.
76
76
77 $ hg help fix
77 $ hg help fix
78 hg fix [OPTION]... [FILE]...
78 hg fix [OPTION]... [FILE]...
79
79
80 rewrite file content in changesets or working directory
80 rewrite file content in changesets or working directory
81
81
82 Runs any configured tools to fix the content of files. Only affects files
82 Runs any configured tools to fix the content of files. Only affects files
83 with changes, unless file arguments are provided. Only affects changed
83 with changes, unless file arguments are provided. Only affects changed
84 lines of files, unless the --whole flag is used. Some tools may always
84 lines of files, unless the --whole flag is used. Some tools may always
85 affect the whole file regardless of --whole.
85 affect the whole file regardless of --whole.
86
86
87 If revisions are specified with --rev, those revisions will be checked,
87 If revisions are specified with --rev, those revisions will be checked,
88 and they may be replaced with new revisions that have fixed file content.
88 and they may be replaced with new revisions that have fixed file content.
89 It is desirable to specify all descendants of each specified revision, so
89 It is desirable to specify all descendants of each specified revision, so
90 that the fixes propagate to the descendants. If all descendants are fixed
90 that the fixes propagate to the descendants. If all descendants are fixed
91 at the same time, no merging, rebasing, or evolution will be required.
91 at the same time, no merging, rebasing, or evolution will be required.
92
92
93 If --working-dir is used, files with uncommitted changes in the working
93 If --working-dir is used, files with uncommitted changes in the working
94 copy will be fixed. If the checked-out revision is also fixed, the working
94 copy will be fixed. If the checked-out revision is also fixed, the working
95 directory will update to the replacement revision.
95 directory will update to the replacement revision.
96
96
97 When determining what lines of each file to fix at each revision, the
97 When determining what lines of each file to fix at each revision, the
98 whole set of revisions being fixed is considered, so that fixes to earlier
98 whole set of revisions being fixed is considered, so that fixes to earlier
99 revisions are not forgotten in later ones. The --base flag can be used to
99 revisions are not forgotten in later ones. The --base flag can be used to
100 override this default behavior, though it is not usually desirable to do
100 override this default behavior, though it is not usually desirable to do
101 so.
101 so.
102
102
103 (use 'hg help -e fix' to show help for the fix extension)
103 (use 'hg help -e fix' to show help for the fix extension)
104
104
105 options ([+] can be repeated):
105 options ([+] can be repeated):
106
106
107 --[no-]all fix all non-public non-obsolete revisions (default:
107 --all fix all non-public non-obsolete revisions (default: off)
108 off)
108 --base REV [+] revisions to diff against (overrides automatic selection,
109 --base REV [+] revisions to diff against (overrides automatic
109 and applies to every revision being fixed)
110 selection, and applies to every revision being fixed)
111 -r --rev REV [+] revisions to fix
110 -r --rev REV [+] revisions to fix
112 -w --[no-]working-dir fix the working directory (default: off)
111 -w --working-dir fix the working directory (default: off)
113 --[no-]whole always fix every line of a file (default: off)
112 --whole always fix every line of a file (default: off)
114
113
115 (some details hidden, use --verbose to show complete help)
114 (some details hidden, use --verbose to show complete help)
116
115
117 $ hg help -e fix
116 $ hg help -e fix
118 fix extension - rewrite file content in changesets or working copy
117 fix extension - rewrite file content in changesets or working copy
119 (EXPERIMENTAL)
118 (EXPERIMENTAL)
120
119
121 Provides a command that runs configured tools on the contents of modified
120 Provides a command that runs configured tools on the contents of modified
122 files, writing back any fixes to the working copy or replacing changesets.
121 files, writing back any fixes to the working copy or replacing changesets.
123
122
124 Here is an example configuration that causes 'hg fix' to apply automatic
123 Here is an example configuration that causes 'hg fix' to apply automatic
125 formatting fixes to modified lines in C++ code:
124 formatting fixes to modified lines in C++ code:
126
125
127 [fix]
126 [fix]
128 clang-format:command=clang-format --assume-filename={rootpath}
127 clang-format:command=clang-format --assume-filename={rootpath}
129 clang-format:linerange=--lines={first}:{last}
128 clang-format:linerange=--lines={first}:{last}
130 clang-format:pattern=set:**.cpp or **.hpp
129 clang-format:pattern=set:**.cpp or **.hpp
131
130
132 The :command suboption forms the first part of the shell command that will be
131 The :command suboption forms the first part of the shell command that will be
133 used to fix a file. The content of the file is passed on standard input, and
132 used to fix a file. The content of the file is passed on standard input, and
134 the fixed file content is expected on standard output. Any output on standard
133 the fixed file content is expected on standard output. Any output on standard
135 error will be displayed as a warning. If the exit status is not zero, the file
134 error will be displayed as a warning. If the exit status is not zero, the file
136 will not be affected. A placeholder warning is displayed if there is a non-
135 will not be affected. A placeholder warning is displayed if there is a non-
137 zero exit status but no standard error output. Some values may be substituted
136 zero exit status but no standard error output. Some values may be substituted
138 into the command:
137 into the command:
139
138
140 {rootpath} The path of the file being fixed, relative to the repo root
139 {rootpath} The path of the file being fixed, relative to the repo root
141 {basename} The name of the file being fixed, without the directory path
140 {basename} The name of the file being fixed, without the directory path
142
141
143 If the :linerange suboption is set, the tool will only be run if there are
142 If the :linerange suboption is set, the tool will only be run if there are
144 changed lines in a file. The value of this suboption is appended to the shell
143 changed lines in a file. The value of this suboption is appended to the shell
145 command once for every range of changed lines in the file. Some values may be
144 command once for every range of changed lines in the file. Some values may be
146 substituted into the command:
145 substituted into the command:
147
146
148 {first} The 1-based line number of the first line in the modified range
147 {first} The 1-based line number of the first line in the modified range
149 {last} The 1-based line number of the last line in the modified range
148 {last} The 1-based line number of the last line in the modified range
150
149
151 The :pattern suboption determines which files will be passed through each
150 The :pattern suboption determines which files will be passed through each
152 configured tool. See 'hg help patterns' for possible values. If there are file
151 configured tool. See 'hg help patterns' for possible values. If there are file
153 arguments to 'hg fix', the intersection of these patterns is used.
152 arguments to 'hg fix', the intersection of these patterns is used.
154
153
155 There is also a configurable limit for the maximum size of file that will be
154 There is also a configurable limit for the maximum size of file that will be
156 processed by 'hg fix':
155 processed by 'hg fix':
157
156
158 [fix]
157 [fix]
159 maxfilesize = 2MB
158 maxfilesize = 2MB
160
159
161 Normally, execution of configured tools will continue after a failure
160 Normally, execution of configured tools will continue after a failure
162 (indicated by a non-zero exit status). It can also be configured to abort
161 (indicated by a non-zero exit status). It can also be configured to abort
163 after the first such failure, so that no files will be affected if any tool
162 after the first such failure, so that no files will be affected if any tool
164 fails. This abort will also cause 'hg fix' to exit with a non-zero status:
163 fails. This abort will also cause 'hg fix' to exit with a non-zero status:
165
164
166 [fix]
165 [fix]
167 failure = abort
166 failure = abort
168
167
169 When multiple tools are configured to affect a file, they execute in an order
168 When multiple tools are configured to affect a file, they execute in an order
170 defined by the :priority suboption. The priority suboption has a default value
169 defined by the :priority suboption. The priority suboption has a default value
171 of zero for each tool. Tools are executed in order of descending priority. The
170 of zero for each tool. Tools are executed in order of descending priority. The
172 execution order of tools with equal priority is unspecified. For example, you
171 execution order of tools with equal priority is unspecified. For example, you
173 could use the 'sort' and 'head' utilities to keep only the 10 smallest numbers
172 could use the 'sort' and 'head' utilities to keep only the 10 smallest numbers
174 in a text file by ensuring that 'sort' runs before 'head':
173 in a text file by ensuring that 'sort' runs before 'head':
175
174
176 [fix]
175 [fix]
177 sort:command = sort --numeric-sort
176 sort:command = sort --numeric-sort
178 head:command = head --lines=10
177 head:command = head --lines=10
179 sort:pattern = numbers.txt
178 sort:pattern = numbers.txt
180 head:pattern = numbers.txt
179 head:pattern = numbers.txt
181 sort:priority = 2
180 sort:priority = 2
182 head:priority = 1
181 head:priority = 1
183
182
184 To account for changes made by each tool, the line numbers used for
183 To account for changes made by each tool, the line numbers used for
185 incremental formatting are recomputed before executing the next tool. So, each
184 incremental formatting are recomputed before executing the next tool. So, each
186 tool may see different values for the arguments added by the :linerange
185 tool may see different values for the arguments added by the :linerange
187 suboption.
186 suboption.
188
187
189 list of commands:
188 list of commands:
190
189
191 fix rewrite file content in changesets or working directory
190 fix rewrite file content in changesets or working directory
192
191
193 (use 'hg help -v -e fix' to show built-in aliases and global options)
192 (use 'hg help -v -e fix' to show built-in aliases and global options)
194
193
195 There is no default behavior in the absence of --rev and --working-dir.
194 There is no default behavior in the absence of --rev and --working-dir.
196
195
197 $ hg init badusage
196 $ hg init badusage
198 $ cd badusage
197 $ cd badusage
199
198
200 $ hg fix
199 $ hg fix
201 abort: no changesets specified
200 abort: no changesets specified
202 (use --rev or --working-dir)
201 (use --rev or --working-dir)
203 [255]
202 [255]
204 $ hg fix --whole
203 $ hg fix --whole
205 abort: no changesets specified
204 abort: no changesets specified
206 (use --rev or --working-dir)
205 (use --rev or --working-dir)
207 [255]
206 [255]
208 $ hg fix --base 0
207 $ hg fix --base 0
209 abort: no changesets specified
208 abort: no changesets specified
210 (use --rev or --working-dir)
209 (use --rev or --working-dir)
211 [255]
210 [255]
212
211
213 Fixing a public revision isn't allowed. It should abort early enough that
212 Fixing a public revision isn't allowed. It should abort early enough that
214 nothing happens, even to the working directory.
213 nothing happens, even to the working directory.
215
214
216 $ printf "hello\n" > hello.whole
215 $ printf "hello\n" > hello.whole
217 $ hg commit -Aqm "hello"
216 $ hg commit -Aqm "hello"
218 $ hg phase -r 0 --public
217 $ hg phase -r 0 --public
219 $ hg fix -r 0
218 $ hg fix -r 0
220 abort: can't fix immutable changeset 0:6470986d2e7b
219 abort: can't fix immutable changeset 0:6470986d2e7b
221 [255]
220 [255]
222 $ hg fix -r 0 --working-dir
221 $ hg fix -r 0 --working-dir
223 abort: can't fix immutable changeset 0:6470986d2e7b
222 abort: can't fix immutable changeset 0:6470986d2e7b
224 [255]
223 [255]
225 $ hg cat -r tip hello.whole
224 $ hg cat -r tip hello.whole
226 hello
225 hello
227 $ cat hello.whole
226 $ cat hello.whole
228 hello
227 hello
229
228
230 $ cd ..
229 $ cd ..
231
230
232 Fixing a clean working directory should do nothing. Even the --whole flag
231 Fixing a clean working directory should do nothing. Even the --whole flag
233 shouldn't cause any clean files to be fixed. Specifying a clean file explicitly
232 shouldn't cause any clean files to be fixed. Specifying a clean file explicitly
234 should only fix it if the fixer always fixes the whole file. The combination of
233 should only fix it if the fixer always fixes the whole file. The combination of
235 an explicit filename and --whole should format the entire file regardless.
234 an explicit filename and --whole should format the entire file regardless.
236
235
237 $ hg init fixcleanwdir
236 $ hg init fixcleanwdir
238 $ cd fixcleanwdir
237 $ cd fixcleanwdir
239
238
240 $ printf "hello\n" > hello.changed
239 $ printf "hello\n" > hello.changed
241 $ printf "world\n" > hello.whole
240 $ printf "world\n" > hello.whole
242 $ hg commit -Aqm "foo"
241 $ hg commit -Aqm "foo"
243 $ hg fix --working-dir
242 $ hg fix --working-dir
244 $ hg diff
243 $ hg diff
245 $ hg fix --working-dir --whole
244 $ hg fix --working-dir --whole
246 $ hg diff
245 $ hg diff
247 $ hg fix --working-dir *
246 $ hg fix --working-dir *
248 $ cat *
247 $ cat *
249 hello
248 hello
250 WORLD
249 WORLD
251 $ hg revert --all --no-backup
250 $ hg revert --all --no-backup
252 reverting hello.whole
251 reverting hello.whole
253 $ hg fix --working-dir * --whole
252 $ hg fix --working-dir * --whole
254 $ cat *
253 $ cat *
255 HELLO
254 HELLO
256 WORLD
255 WORLD
257
256
258 The same ideas apply to fixing a revision, so we create a revision that doesn't
257 The same ideas apply to fixing a revision, so we create a revision that doesn't
259 modify either of the files in question and try fixing it. This also tests that
258 modify either of the files in question and try fixing it. This also tests that
260 we ignore a file that doesn't match any configured fixer.
259 we ignore a file that doesn't match any configured fixer.
261
260
262 $ hg revert --all --no-backup
261 $ hg revert --all --no-backup
263 reverting hello.changed
262 reverting hello.changed
264 reverting hello.whole
263 reverting hello.whole
265 $ printf "unimportant\n" > some.file
264 $ printf "unimportant\n" > some.file
266 $ hg commit -Aqm "some other file"
265 $ hg commit -Aqm "some other file"
267
266
268 $ hg fix -r .
267 $ hg fix -r .
269 $ hg cat -r tip *
268 $ hg cat -r tip *
270 hello
269 hello
271 world
270 world
272 unimportant
271 unimportant
273 $ hg fix -r . --whole
272 $ hg fix -r . --whole
274 $ hg cat -r tip *
273 $ hg cat -r tip *
275 hello
274 hello
276 world
275 world
277 unimportant
276 unimportant
278 $ hg fix -r . *
277 $ hg fix -r . *
279 $ hg cat -r tip *
278 $ hg cat -r tip *
280 hello
279 hello
281 WORLD
280 WORLD
282 unimportant
281 unimportant
283 $ hg fix -r . * --whole --config experimental.evolution.allowdivergence=true
282 $ hg fix -r . * --whole --config experimental.evolution.allowdivergence=true
284 2 new content-divergent changesets
283 2 new content-divergent changesets
285 $ hg cat -r tip *
284 $ hg cat -r tip *
286 HELLO
285 HELLO
287 WORLD
286 WORLD
288 unimportant
287 unimportant
289
288
290 $ cd ..
289 $ cd ..
291
290
292 Fixing the working directory should still work if there are no revisions.
291 Fixing the working directory should still work if there are no revisions.
293
292
294 $ hg init norevisions
293 $ hg init norevisions
295 $ cd norevisions
294 $ cd norevisions
296
295
297 $ printf "something\n" > something.whole
296 $ printf "something\n" > something.whole
298 $ hg add
297 $ hg add
299 adding something.whole
298 adding something.whole
300 $ hg fix --working-dir
299 $ hg fix --working-dir
301 $ cat something.whole
300 $ cat something.whole
302 SOMETHING
301 SOMETHING
303
302
304 $ cd ..
303 $ cd ..
305
304
306 Test the effect of fixing the working directory for each possible status, with
305 Test the effect of fixing the working directory for each possible status, with
307 and without providing explicit file arguments.
306 and without providing explicit file arguments.
308
307
309 $ hg init implicitlyfixstatus
308 $ hg init implicitlyfixstatus
310 $ cd implicitlyfixstatus
309 $ cd implicitlyfixstatus
311
310
312 $ printf "modified\n" > modified.whole
311 $ printf "modified\n" > modified.whole
313 $ printf "removed\n" > removed.whole
312 $ printf "removed\n" > removed.whole
314 $ printf "deleted\n" > deleted.whole
313 $ printf "deleted\n" > deleted.whole
315 $ printf "clean\n" > clean.whole
314 $ printf "clean\n" > clean.whole
316 $ printf "ignored.whole" > .hgignore
315 $ printf "ignored.whole" > .hgignore
317 $ hg commit -Aqm "stuff"
316 $ hg commit -Aqm "stuff"
318
317
319 $ printf "modified!!!\n" > modified.whole
318 $ printf "modified!!!\n" > modified.whole
320 $ printf "unknown\n" > unknown.whole
319 $ printf "unknown\n" > unknown.whole
321 $ printf "ignored\n" > ignored.whole
320 $ printf "ignored\n" > ignored.whole
322 $ printf "added\n" > added.whole
321 $ printf "added\n" > added.whole
323 $ hg add added.whole
322 $ hg add added.whole
324 $ hg remove removed.whole
323 $ hg remove removed.whole
325 $ rm deleted.whole
324 $ rm deleted.whole
326
325
327 $ hg status --all
326 $ hg status --all
328 M modified.whole
327 M modified.whole
329 A added.whole
328 A added.whole
330 R removed.whole
329 R removed.whole
331 ! deleted.whole
330 ! deleted.whole
332 ? unknown.whole
331 ? unknown.whole
333 I ignored.whole
332 I ignored.whole
334 C .hgignore
333 C .hgignore
335 C clean.whole
334 C clean.whole
336
335
337 $ hg fix --working-dir
336 $ hg fix --working-dir
338
337
339 $ hg status --all
338 $ hg status --all
340 M modified.whole
339 M modified.whole
341 A added.whole
340 A added.whole
342 R removed.whole
341 R removed.whole
343 ! deleted.whole
342 ! deleted.whole
344 ? unknown.whole
343 ? unknown.whole
345 I ignored.whole
344 I ignored.whole
346 C .hgignore
345 C .hgignore
347 C clean.whole
346 C clean.whole
348
347
349 $ cat *.whole
348 $ cat *.whole
350 ADDED
349 ADDED
351 clean
350 clean
352 ignored
351 ignored
353 MODIFIED!!!
352 MODIFIED!!!
354 unknown
353 unknown
355
354
356 $ printf "modified!!!\n" > modified.whole
355 $ printf "modified!!!\n" > modified.whole
357 $ printf "added\n" > added.whole
356 $ printf "added\n" > added.whole
358 $ hg fix --working-dir *.whole
357 $ hg fix --working-dir *.whole
359
358
360 $ hg status --all
359 $ hg status --all
361 M clean.whole
360 M clean.whole
362 M modified.whole
361 M modified.whole
363 A added.whole
362 A added.whole
364 R removed.whole
363 R removed.whole
365 ! deleted.whole
364 ! deleted.whole
366 ? unknown.whole
365 ? unknown.whole
367 I ignored.whole
366 I ignored.whole
368 C .hgignore
367 C .hgignore
369
368
370 It would be better if this also fixed the unknown file.
369 It would be better if this also fixed the unknown file.
371 $ cat *.whole
370 $ cat *.whole
372 ADDED
371 ADDED
373 CLEAN
372 CLEAN
374 ignored
373 ignored
375 MODIFIED!!!
374 MODIFIED!!!
376 unknown
375 unknown
377
376
378 $ cd ..
377 $ cd ..
379
378
380 Test that incremental fixing works on files with additions, deletions, and
379 Test that incremental fixing works on files with additions, deletions, and
381 changes in multiple line ranges. Note that deletions do not generally cause
380 changes in multiple line ranges. Note that deletions do not generally cause
382 neighboring lines to be fixed, so we don't return a line range for purely
381 neighboring lines to be fixed, so we don't return a line range for purely
383 deleted sections. In the future we should support a :deletion config that
382 deleted sections. In the future we should support a :deletion config that
384 allows fixers to know where deletions are located.
383 allows fixers to know where deletions are located.
385
384
386 $ hg init incrementalfixedlines
385 $ hg init incrementalfixedlines
387 $ cd incrementalfixedlines
386 $ cd incrementalfixedlines
388
387
389 $ printf "a\nb\nc\nd\ne\nf\ng\n" > foo.txt
388 $ printf "a\nb\nc\nd\ne\nf\ng\n" > foo.txt
390 $ hg commit -Aqm "foo"
389 $ hg commit -Aqm "foo"
391 $ printf "zz\na\nc\ndd\nee\nff\nf\ngg\n" > foo.txt
390 $ printf "zz\na\nc\ndd\nee\nff\nf\ngg\n" > foo.txt
392
391
393 $ hg --config "fix.fail:command=echo" \
392 $ hg --config "fix.fail:command=echo" \
394 > --config "fix.fail:linerange={first}:{last}" \
393 > --config "fix.fail:linerange={first}:{last}" \
395 > --config "fix.fail:pattern=foo.txt" \
394 > --config "fix.fail:pattern=foo.txt" \
396 > fix --working-dir
395 > fix --working-dir
397 $ cat foo.txt
396 $ cat foo.txt
398 1:1 4:6 8:8
397 1:1 4:6 8:8
399
398
400 $ cd ..
399 $ cd ..
401
400
402 Test that --whole fixes all lines regardless of the diffs present.
401 Test that --whole fixes all lines regardless of the diffs present.
403
402
404 $ hg init wholeignoresdiffs
403 $ hg init wholeignoresdiffs
405 $ cd wholeignoresdiffs
404 $ cd wholeignoresdiffs
406
405
407 $ printf "a\nb\nc\nd\ne\nf\ng\n" > foo.changed
406 $ printf "a\nb\nc\nd\ne\nf\ng\n" > foo.changed
408 $ hg commit -Aqm "foo"
407 $ hg commit -Aqm "foo"
409 $ printf "zz\na\nc\ndd\nee\nff\nf\ngg\n" > foo.changed
408 $ printf "zz\na\nc\ndd\nee\nff\nf\ngg\n" > foo.changed
410 $ hg fix --working-dir --whole
409 $ hg fix --working-dir --whole
411 $ cat foo.changed
410 $ cat foo.changed
412 ZZ
411 ZZ
413 A
412 A
414 C
413 C
415 DD
414 DD
416 EE
415 EE
417 FF
416 FF
418 F
417 F
419 GG
418 GG
420
419
421 $ cd ..
420 $ cd ..
422
421
423 We should do nothing with symlinks, and their targets should be unaffected. Any
422 We should do nothing with symlinks, and their targets should be unaffected. Any
424 other behavior would be more complicated to implement and harder to document.
423 other behavior would be more complicated to implement and harder to document.
425
424
426 #if symlink
425 #if symlink
427 $ hg init dontmesswithsymlinks
426 $ hg init dontmesswithsymlinks
428 $ cd dontmesswithsymlinks
427 $ cd dontmesswithsymlinks
429
428
430 $ printf "hello\n" > hello.whole
429 $ printf "hello\n" > hello.whole
431 $ ln -s hello.whole hellolink
430 $ ln -s hello.whole hellolink
432 $ hg add
431 $ hg add
433 adding hello.whole
432 adding hello.whole
434 adding hellolink
433 adding hellolink
435 $ hg fix --working-dir hellolink
434 $ hg fix --working-dir hellolink
436 $ hg status
435 $ hg status
437 A hello.whole
436 A hello.whole
438 A hellolink
437 A hellolink
439
438
440 $ cd ..
439 $ cd ..
441 #endif
440 #endif
442
441
443 We should allow fixers to run on binary files, even though this doesn't sound
442 We should allow fixers to run on binary files, even though this doesn't sound
444 like a common use case. There's not much benefit to disallowing it, and users
443 like a common use case. There's not much benefit to disallowing it, and users
445 can add "and not binary()" to their filesets if needed. The Mercurial
444 can add "and not binary()" to their filesets if needed. The Mercurial
446 philosophy is generally to not handle binary files specially anyway.
445 philosophy is generally to not handle binary files specially anyway.
447
446
448 $ hg init cantouchbinaryfiles
447 $ hg init cantouchbinaryfiles
449 $ cd cantouchbinaryfiles
448 $ cd cantouchbinaryfiles
450
449
451 $ printf "hello\0\n" > hello.whole
450 $ printf "hello\0\n" > hello.whole
452 $ hg add
451 $ hg add
453 adding hello.whole
452 adding hello.whole
454 $ hg fix --working-dir 'set:binary()'
453 $ hg fix --working-dir 'set:binary()'
455 $ cat hello.whole
454 $ cat hello.whole
456 HELLO\x00 (esc)
455 HELLO\x00 (esc)
457
456
458 $ cd ..
457 $ cd ..
459
458
460 We have a config for the maximum size of file we will attempt to fix. This can
459 We have a config for the maximum size of file we will attempt to fix. This can
461 be helpful to avoid running unsuspecting fixer tools on huge inputs, which
460 be helpful to avoid running unsuspecting fixer tools on huge inputs, which
462 could happen by accident without a well considered configuration. A more
461 could happen by accident without a well considered configuration. A more
463 precise configuration could use the size() fileset function if one global limit
462 precise configuration could use the size() fileset function if one global limit
464 is undesired.
463 is undesired.
465
464
466 $ hg init maxfilesize
465 $ hg init maxfilesize
467 $ cd maxfilesize
466 $ cd maxfilesize
468
467
469 $ printf "this file is huge\n" > hello.whole
468 $ printf "this file is huge\n" > hello.whole
470 $ hg add
469 $ hg add
471 adding hello.whole
470 adding hello.whole
472 $ hg --config fix.maxfilesize=10 fix --working-dir
471 $ hg --config fix.maxfilesize=10 fix --working-dir
473 ignoring file larger than 10 bytes: hello.whole
472 ignoring file larger than 10 bytes: hello.whole
474 $ cat hello.whole
473 $ cat hello.whole
475 this file is huge
474 this file is huge
476
475
477 $ cd ..
476 $ cd ..
478
477
479 If we specify a file to fix, other files should be left alone, even if they
478 If we specify a file to fix, other files should be left alone, even if they
480 have changes.
479 have changes.
481
480
482 $ hg init fixonlywhatitellyouto
481 $ hg init fixonlywhatitellyouto
483 $ cd fixonlywhatitellyouto
482 $ cd fixonlywhatitellyouto
484
483
485 $ printf "fix me!\n" > fixme.whole
484 $ printf "fix me!\n" > fixme.whole
486 $ printf "not me.\n" > notme.whole
485 $ printf "not me.\n" > notme.whole
487 $ hg add
486 $ hg add
488 adding fixme.whole
487 adding fixme.whole
489 adding notme.whole
488 adding notme.whole
490 $ hg fix --working-dir fixme.whole
489 $ hg fix --working-dir fixme.whole
491 $ cat *.whole
490 $ cat *.whole
492 FIX ME!
491 FIX ME!
493 not me.
492 not me.
494
493
495 $ cd ..
494 $ cd ..
496
495
497 Specifying a directory name should fix all its files and subdirectories.
496 Specifying a directory name should fix all its files and subdirectories.
498
497
499 $ hg init fixdirectory
498 $ hg init fixdirectory
500 $ cd fixdirectory
499 $ cd fixdirectory
501
500
502 $ mkdir -p dir1/dir2
501 $ mkdir -p dir1/dir2
503 $ printf "foo\n" > foo.whole
502 $ printf "foo\n" > foo.whole
504 $ printf "bar\n" > dir1/bar.whole
503 $ printf "bar\n" > dir1/bar.whole
505 $ printf "baz\n" > dir1/dir2/baz.whole
504 $ printf "baz\n" > dir1/dir2/baz.whole
506 $ hg add
505 $ hg add
507 adding dir1/bar.whole
506 adding dir1/bar.whole
508 adding dir1/dir2/baz.whole
507 adding dir1/dir2/baz.whole
509 adding foo.whole
508 adding foo.whole
510 $ hg fix --working-dir dir1
509 $ hg fix --working-dir dir1
511 $ cat foo.whole dir1/bar.whole dir1/dir2/baz.whole
510 $ cat foo.whole dir1/bar.whole dir1/dir2/baz.whole
512 foo
511 foo
513 BAR
512 BAR
514 BAZ
513 BAZ
515
514
516 $ cd ..
515 $ cd ..
517
516
518 Fixing a file in the working directory that needs no fixes should not actually
517 Fixing a file in the working directory that needs no fixes should not actually
519 write back to the file, so for example the mtime shouldn't change.
518 write back to the file, so for example the mtime shouldn't change.
520
519
521 $ hg init donttouchunfixedfiles
520 $ hg init donttouchunfixedfiles
522 $ cd donttouchunfixedfiles
521 $ cd donttouchunfixedfiles
523
522
524 $ printf "NO FIX NEEDED\n" > foo.whole
523 $ printf "NO FIX NEEDED\n" > foo.whole
525 $ hg add
524 $ hg add
526 adding foo.whole
525 adding foo.whole
527 $ cp -p foo.whole foo.whole.orig
526 $ cp -p foo.whole foo.whole.orig
528 $ cp -p foo.whole.orig foo.whole
527 $ cp -p foo.whole.orig foo.whole
529 $ sleep 2 # mtime has a resolution of one or two seconds.
528 $ sleep 2 # mtime has a resolution of one or two seconds.
530 $ hg fix --working-dir
529 $ hg fix --working-dir
531 $ f foo.whole.orig --newer foo.whole
530 $ f foo.whole.orig --newer foo.whole
532 foo.whole.orig: newer than foo.whole
531 foo.whole.orig: newer than foo.whole
533
532
534 $ cd ..
533 $ cd ..
535
534
536 When a fixer prints to stderr, we don't assume that it has failed. We show the
535 When a fixer prints to stderr, we don't assume that it has failed. We show the
537 error messages to the user, and we still let the fixer affect the file it was
536 error messages to the user, and we still let the fixer affect the file it was
538 fixing if its exit code is zero. Some code formatters might emit error messages
537 fixing if its exit code is zero. Some code formatters might emit error messages
539 on stderr and nothing on stdout, which would cause us the clear the file,
538 on stderr and nothing on stdout, which would cause us the clear the file,
540 except that they also exit with a non-zero code. We show the user which fixer
539 except that they also exit with a non-zero code. We show the user which fixer
541 emitted the stderr, and which revision, but we assume that the fixer will print
540 emitted the stderr, and which revision, but we assume that the fixer will print
542 the filename if it is relevant (since the issue may be non-specific). There is
541 the filename if it is relevant (since the issue may be non-specific). There is
543 also a config to abort (without affecting any files whatsoever) if we see any
542 also a config to abort (without affecting any files whatsoever) if we see any
544 tool with a non-zero exit status.
543 tool with a non-zero exit status.
545
544
546 $ hg init showstderr
545 $ hg init showstderr
547 $ cd showstderr
546 $ cd showstderr
548
547
549 $ printf "hello\n" > hello.txt
548 $ printf "hello\n" > hello.txt
550 $ hg add
549 $ hg add
551 adding hello.txt
550 adding hello.txt
552 $ cat > $TESTTMP/work.sh <<'EOF'
551 $ cat > $TESTTMP/work.sh <<'EOF'
553 > printf 'HELLO\n'
552 > printf 'HELLO\n'
554 > printf "$@: some\nerror that didn't stop the tool" >&2
553 > printf "$@: some\nerror that didn't stop the tool" >&2
555 > exit 0 # success despite the stderr output
554 > exit 0 # success despite the stderr output
556 > EOF
555 > EOF
557 $ hg --config "fix.work:command=sh $TESTTMP/work.sh {rootpath}" \
556 $ hg --config "fix.work:command=sh $TESTTMP/work.sh {rootpath}" \
558 > --config "fix.work:pattern=hello.txt" \
557 > --config "fix.work:pattern=hello.txt" \
559 > fix --working-dir
558 > fix --working-dir
560 [wdir] work: hello.txt: some
559 [wdir] work: hello.txt: some
561 [wdir] work: error that didn't stop the tool
560 [wdir] work: error that didn't stop the tool
562 $ cat hello.txt
561 $ cat hello.txt
563 HELLO
562 HELLO
564
563
565 $ printf "goodbye\n" > hello.txt
564 $ printf "goodbye\n" > hello.txt
566 $ printf "foo\n" > foo.whole
565 $ printf "foo\n" > foo.whole
567 $ hg add
566 $ hg add
568 adding foo.whole
567 adding foo.whole
569 $ cat > $TESTTMP/fail.sh <<'EOF'
568 $ cat > $TESTTMP/fail.sh <<'EOF'
570 > printf 'GOODBYE\n'
569 > printf 'GOODBYE\n'
571 > printf "$@: some\nerror that did stop the tool\n" >&2
570 > printf "$@: some\nerror that did stop the tool\n" >&2
572 > exit 42 # success despite the stdout output
571 > exit 42 # success despite the stdout output
573 > EOF
572 > EOF
574 $ hg --config "fix.fail:command=sh $TESTTMP/fail.sh {rootpath}" \
573 $ hg --config "fix.fail:command=sh $TESTTMP/fail.sh {rootpath}" \
575 > --config "fix.fail:pattern=hello.txt" \
574 > --config "fix.fail:pattern=hello.txt" \
576 > --config "fix.failure=abort" \
575 > --config "fix.failure=abort" \
577 > fix --working-dir
576 > fix --working-dir
578 [wdir] fail: hello.txt: some
577 [wdir] fail: hello.txt: some
579 [wdir] fail: error that did stop the tool
578 [wdir] fail: error that did stop the tool
580 abort: no fixes will be applied
579 abort: no fixes will be applied
581 (use --config fix.failure=continue to apply any successful fixes anyway)
580 (use --config fix.failure=continue to apply any successful fixes anyway)
582 [255]
581 [255]
583 $ cat hello.txt
582 $ cat hello.txt
584 goodbye
583 goodbye
585 $ cat foo.whole
584 $ cat foo.whole
586 foo
585 foo
587
586
588 $ hg --config "fix.fail:command=sh $TESTTMP/fail.sh {rootpath}" \
587 $ hg --config "fix.fail:command=sh $TESTTMP/fail.sh {rootpath}" \
589 > --config "fix.fail:pattern=hello.txt" \
588 > --config "fix.fail:pattern=hello.txt" \
590 > fix --working-dir
589 > fix --working-dir
591 [wdir] fail: hello.txt: some
590 [wdir] fail: hello.txt: some
592 [wdir] fail: error that did stop the tool
591 [wdir] fail: error that did stop the tool
593 $ cat hello.txt
592 $ cat hello.txt
594 goodbye
593 goodbye
595 $ cat foo.whole
594 $ cat foo.whole
596 FOO
595 FOO
597
596
598 $ hg --config "fix.fail:command=exit 42" \
597 $ hg --config "fix.fail:command=exit 42" \
599 > --config "fix.fail:pattern=hello.txt" \
598 > --config "fix.fail:pattern=hello.txt" \
600 > fix --working-dir
599 > fix --working-dir
601 [wdir] fail: exited with status 42
600 [wdir] fail: exited with status 42
602
601
603 $ cd ..
602 $ cd ..
604
603
605 Fixing the working directory and its parent revision at the same time should
604 Fixing the working directory and its parent revision at the same time should
606 check out the replacement revision for the parent. This prevents any new
605 check out the replacement revision for the parent. This prevents any new
607 uncommitted changes from appearing. We test this for a clean working directory
606 uncommitted changes from appearing. We test this for a clean working directory
608 and a dirty one. In both cases, all lines/files changed since the grandparent
607 and a dirty one. In both cases, all lines/files changed since the grandparent
609 will be fixed. The grandparent is the "baserev" for both the parent and the
608 will be fixed. The grandparent is the "baserev" for both the parent and the
610 working copy.
609 working copy.
611
610
612 $ hg init fixdotandcleanwdir
611 $ hg init fixdotandcleanwdir
613 $ cd fixdotandcleanwdir
612 $ cd fixdotandcleanwdir
614
613
615 $ printf "hello\n" > hello.whole
614 $ printf "hello\n" > hello.whole
616 $ printf "world\n" > world.whole
615 $ printf "world\n" > world.whole
617 $ hg commit -Aqm "the parent commit"
616 $ hg commit -Aqm "the parent commit"
618
617
619 $ hg parents --template '{rev} {desc}\n'
618 $ hg parents --template '{rev} {desc}\n'
620 0 the parent commit
619 0 the parent commit
621 $ hg fix --working-dir -r .
620 $ hg fix --working-dir -r .
622 $ hg parents --template '{rev} {desc}\n'
621 $ hg parents --template '{rev} {desc}\n'
623 1 the parent commit
622 1 the parent commit
624 $ hg cat -r . *.whole
623 $ hg cat -r . *.whole
625 HELLO
624 HELLO
626 WORLD
625 WORLD
627 $ cat *.whole
626 $ cat *.whole
628 HELLO
627 HELLO
629 WORLD
628 WORLD
630 $ hg status
629 $ hg status
631
630
632 $ cd ..
631 $ cd ..
633
632
634 Same test with a dirty working copy.
633 Same test with a dirty working copy.
635
634
636 $ hg init fixdotanddirtywdir
635 $ hg init fixdotanddirtywdir
637 $ cd fixdotanddirtywdir
636 $ cd fixdotanddirtywdir
638
637
639 $ printf "hello\n" > hello.whole
638 $ printf "hello\n" > hello.whole
640 $ printf "world\n" > world.whole
639 $ printf "world\n" > world.whole
641 $ hg commit -Aqm "the parent commit"
640 $ hg commit -Aqm "the parent commit"
642
641
643 $ printf "hello,\n" > hello.whole
642 $ printf "hello,\n" > hello.whole
644 $ printf "world!\n" > world.whole
643 $ printf "world!\n" > world.whole
645
644
646 $ hg parents --template '{rev} {desc}\n'
645 $ hg parents --template '{rev} {desc}\n'
647 0 the parent commit
646 0 the parent commit
648 $ hg fix --working-dir -r .
647 $ hg fix --working-dir -r .
649 $ hg parents --template '{rev} {desc}\n'
648 $ hg parents --template '{rev} {desc}\n'
650 1 the parent commit
649 1 the parent commit
651 $ hg cat -r . *.whole
650 $ hg cat -r . *.whole
652 HELLO
651 HELLO
653 WORLD
652 WORLD
654 $ cat *.whole
653 $ cat *.whole
655 HELLO,
654 HELLO,
656 WORLD!
655 WORLD!
657 $ hg status
656 $ hg status
658 M hello.whole
657 M hello.whole
659 M world.whole
658 M world.whole
660
659
661 $ cd ..
660 $ cd ..
662
661
663 When we have a chain of commits that change mutually exclusive lines of code,
662 When we have a chain of commits that change mutually exclusive lines of code,
664 we should be able to do incremental fixing that causes each commit in the chain
663 we should be able to do incremental fixing that causes each commit in the chain
665 to include fixes made to the previous commits. This prevents children from
664 to include fixes made to the previous commits. This prevents children from
666 backing out the fixes made in their parents. A dirty working directory is
665 backing out the fixes made in their parents. A dirty working directory is
667 conceptually similar to another commit in the chain.
666 conceptually similar to another commit in the chain.
668
667
669 $ hg init incrementallyfixchain
668 $ hg init incrementallyfixchain
670 $ cd incrementallyfixchain
669 $ cd incrementallyfixchain
671
670
672 $ cat > file.changed <<EOF
671 $ cat > file.changed <<EOF
673 > first
672 > first
674 > second
673 > second
675 > third
674 > third
676 > fourth
675 > fourth
677 > fifth
676 > fifth
678 > EOF
677 > EOF
679 $ hg commit -Aqm "the common ancestor (the baserev)"
678 $ hg commit -Aqm "the common ancestor (the baserev)"
680 $ cat > file.changed <<EOF
679 $ cat > file.changed <<EOF
681 > first (changed)
680 > first (changed)
682 > second
681 > second
683 > third
682 > third
684 > fourth
683 > fourth
685 > fifth
684 > fifth
686 > EOF
685 > EOF
687 $ hg commit -Aqm "the first commit to fix"
686 $ hg commit -Aqm "the first commit to fix"
688 $ cat > file.changed <<EOF
687 $ cat > file.changed <<EOF
689 > first (changed)
688 > first (changed)
690 > second
689 > second
691 > third (changed)
690 > third (changed)
692 > fourth
691 > fourth
693 > fifth
692 > fifth
694 > EOF
693 > EOF
695 $ hg commit -Aqm "the second commit to fix"
694 $ hg commit -Aqm "the second commit to fix"
696 $ cat > file.changed <<EOF
695 $ cat > file.changed <<EOF
697 > first (changed)
696 > first (changed)
698 > second
697 > second
699 > third (changed)
698 > third (changed)
700 > fourth
699 > fourth
701 > fifth (changed)
700 > fifth (changed)
702 > EOF
701 > EOF
703
702
704 $ hg fix -r . -r '.^' --working-dir
703 $ hg fix -r . -r '.^' --working-dir
705
704
706 $ hg parents --template '{rev}\n'
705 $ hg parents --template '{rev}\n'
707 4
706 4
708 $ hg cat -r '.^^' file.changed
707 $ hg cat -r '.^^' file.changed
709 first
708 first
710 second
709 second
711 third
710 third
712 fourth
711 fourth
713 fifth
712 fifth
714 $ hg cat -r '.^' file.changed
713 $ hg cat -r '.^' file.changed
715 FIRST (CHANGED)
714 FIRST (CHANGED)
716 second
715 second
717 third
716 third
718 fourth
717 fourth
719 fifth
718 fifth
720 $ hg cat -r . file.changed
719 $ hg cat -r . file.changed
721 FIRST (CHANGED)
720 FIRST (CHANGED)
722 second
721 second
723 THIRD (CHANGED)
722 THIRD (CHANGED)
724 fourth
723 fourth
725 fifth
724 fifth
726 $ cat file.changed
725 $ cat file.changed
727 FIRST (CHANGED)
726 FIRST (CHANGED)
728 second
727 second
729 THIRD (CHANGED)
728 THIRD (CHANGED)
730 fourth
729 fourth
731 FIFTH (CHANGED)
730 FIFTH (CHANGED)
732
731
733 $ cd ..
732 $ cd ..
734
733
735 If we incrementally fix a merge commit, we should fix any lines that changed
734 If we incrementally fix a merge commit, we should fix any lines that changed
736 versus either parent. You could imagine only fixing the intersection or some
735 versus either parent. You could imagine only fixing the intersection or some
737 other subset, but this is necessary if either parent is being fixed. It
736 other subset, but this is necessary if either parent is being fixed. It
738 prevents us from forgetting fixes made in either parent.
737 prevents us from forgetting fixes made in either parent.
739
738
740 $ hg init incrementallyfixmergecommit
739 $ hg init incrementallyfixmergecommit
741 $ cd incrementallyfixmergecommit
740 $ cd incrementallyfixmergecommit
742
741
743 $ printf "a\nb\nc\n" > file.changed
742 $ printf "a\nb\nc\n" > file.changed
744 $ hg commit -Aqm "ancestor"
743 $ hg commit -Aqm "ancestor"
745
744
746 $ printf "aa\nb\nc\n" > file.changed
745 $ printf "aa\nb\nc\n" > file.changed
747 $ hg commit -m "change a"
746 $ hg commit -m "change a"
748
747
749 $ hg checkout '.^'
748 $ hg checkout '.^'
750 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
749 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
751 $ printf "a\nb\ncc\n" > file.changed
750 $ printf "a\nb\ncc\n" > file.changed
752 $ hg commit -m "change c"
751 $ hg commit -m "change c"
753 created new head
752 created new head
754
753
755 $ hg merge
754 $ hg merge
756 merging file.changed
755 merging file.changed
757 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
756 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
758 (branch merge, don't forget to commit)
757 (branch merge, don't forget to commit)
759 $ hg commit -m "merge"
758 $ hg commit -m "merge"
760 $ hg cat -r . file.changed
759 $ hg cat -r . file.changed
761 aa
760 aa
762 b
761 b
763 cc
762 cc
764
763
765 $ hg fix -r . --working-dir
764 $ hg fix -r . --working-dir
766 $ hg cat -r . file.changed
765 $ hg cat -r . file.changed
767 AA
766 AA
768 b
767 b
769 CC
768 CC
770
769
771 $ cd ..
770 $ cd ..
772
771
773 Abort fixing revisions if there is an unfinished operation. We don't want to
772 Abort fixing revisions if there is an unfinished operation. We don't want to
774 make things worse by editing files or stripping/obsoleting things. Also abort
773 make things worse by editing files or stripping/obsoleting things. Also abort
775 fixing the working directory if there are unresolved merge conflicts.
774 fixing the working directory if there are unresolved merge conflicts.
776
775
777 $ hg init abortunresolved
776 $ hg init abortunresolved
778 $ cd abortunresolved
777 $ cd abortunresolved
779
778
780 $ echo "foo1" > foo.whole
779 $ echo "foo1" > foo.whole
781 $ hg commit -Aqm "foo 1"
780 $ hg commit -Aqm "foo 1"
782
781
783 $ hg update null
782 $ hg update null
784 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
783 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
785 $ echo "foo2" > foo.whole
784 $ echo "foo2" > foo.whole
786 $ hg commit -Aqm "foo 2"
785 $ hg commit -Aqm "foo 2"
787
786
788 $ hg --config extensions.rebase= rebase -r 1 -d 0
787 $ hg --config extensions.rebase= rebase -r 1 -d 0
789 rebasing 1:c3b6dc0e177a "foo 2" (tip)
788 rebasing 1:c3b6dc0e177a "foo 2" (tip)
790 merging foo.whole
789 merging foo.whole
791 warning: conflicts while merging foo.whole! (edit, then use 'hg resolve --mark')
790 warning: conflicts while merging foo.whole! (edit, then use 'hg resolve --mark')
792 unresolved conflicts (see hg resolve, then hg rebase --continue)
791 unresolved conflicts (see hg resolve, then hg rebase --continue)
793 [1]
792 [1]
794
793
795 $ hg --config extensions.rebase= fix --working-dir
794 $ hg --config extensions.rebase= fix --working-dir
796 abort: unresolved conflicts
795 abort: unresolved conflicts
797 (use 'hg resolve')
796 (use 'hg resolve')
798 [255]
797 [255]
799
798
800 $ hg --config extensions.rebase= fix -r .
799 $ hg --config extensions.rebase= fix -r .
801 abort: rebase in progress
800 abort: rebase in progress
802 (use 'hg rebase --continue' or 'hg rebase --abort')
801 (use 'hg rebase --continue' or 'hg rebase --abort')
803 [255]
802 [255]
804
803
805 When fixing a file that was renamed, we should diff against the source of the
804 When fixing a file that was renamed, we should diff against the source of the
806 rename for incremental fixing and we should correctly reproduce the rename in
805 rename for incremental fixing and we should correctly reproduce the rename in
807 the replacement revision.
806 the replacement revision.
808
807
809 $ hg init fixrenamecommit
808 $ hg init fixrenamecommit
810 $ cd fixrenamecommit
809 $ cd fixrenamecommit
811
810
812 $ printf "a\nb\nc\n" > source.changed
811 $ printf "a\nb\nc\n" > source.changed
813 $ hg commit -Aqm "source revision"
812 $ hg commit -Aqm "source revision"
814 $ hg move source.changed dest.changed
813 $ hg move source.changed dest.changed
815 $ printf "a\nb\ncc\n" > dest.changed
814 $ printf "a\nb\ncc\n" > dest.changed
816 $ hg commit -m "dest revision"
815 $ hg commit -m "dest revision"
817
816
818 $ hg fix -r .
817 $ hg fix -r .
819 $ hg log -r tip --copies --template "{file_copies}\n"
818 $ hg log -r tip --copies --template "{file_copies}\n"
820 dest.changed (source.changed)
819 dest.changed (source.changed)
821 $ hg cat -r tip dest.changed
820 $ hg cat -r tip dest.changed
822 a
821 a
823 b
822 b
824 CC
823 CC
825
824
826 $ cd ..
825 $ cd ..
827
826
828 When fixing revisions that remove files we must ensure that the replacement
827 When fixing revisions that remove files we must ensure that the replacement
829 actually removes the file, whereas it could accidentally leave it unchanged or
828 actually removes the file, whereas it could accidentally leave it unchanged or
830 write an empty string to it.
829 write an empty string to it.
831
830
832 $ hg init fixremovedfile
831 $ hg init fixremovedfile
833 $ cd fixremovedfile
832 $ cd fixremovedfile
834
833
835 $ printf "foo\n" > foo.whole
834 $ printf "foo\n" > foo.whole
836 $ printf "bar\n" > bar.whole
835 $ printf "bar\n" > bar.whole
837 $ hg commit -Aqm "add files"
836 $ hg commit -Aqm "add files"
838 $ hg remove bar.whole
837 $ hg remove bar.whole
839 $ hg commit -m "remove file"
838 $ hg commit -m "remove file"
840 $ hg status --change .
839 $ hg status --change .
841 R bar.whole
840 R bar.whole
842 $ hg fix -r . foo.whole
841 $ hg fix -r . foo.whole
843 $ hg status --change tip
842 $ hg status --change tip
844 M foo.whole
843 M foo.whole
845 R bar.whole
844 R bar.whole
846
845
847 $ cd ..
846 $ cd ..
848
847
849 If fixing a revision finds no fixes to make, no replacement revision should be
848 If fixing a revision finds no fixes to make, no replacement revision should be
850 created.
849 created.
851
850
852 $ hg init nofixesneeded
851 $ hg init nofixesneeded
853 $ cd nofixesneeded
852 $ cd nofixesneeded
854
853
855 $ printf "FOO\n" > foo.whole
854 $ printf "FOO\n" > foo.whole
856 $ hg commit -Aqm "add file"
855 $ hg commit -Aqm "add file"
857 $ hg log --template '{rev}\n'
856 $ hg log --template '{rev}\n'
858 0
857 0
859 $ hg fix -r .
858 $ hg fix -r .
860 $ hg log --template '{rev}\n'
859 $ hg log --template '{rev}\n'
861 0
860 0
862
861
863 $ cd ..
862 $ cd ..
864
863
865 If fixing a commit reverts all the changes in the commit, we replace it with a
864 If fixing a commit reverts all the changes in the commit, we replace it with a
866 commit that changes no files.
865 commit that changes no files.
867
866
868 $ hg init nochangesleft
867 $ hg init nochangesleft
869 $ cd nochangesleft
868 $ cd nochangesleft
870
869
871 $ printf "FOO\n" > foo.whole
870 $ printf "FOO\n" > foo.whole
872 $ hg commit -Aqm "add file"
871 $ hg commit -Aqm "add file"
873 $ printf "foo\n" > foo.whole
872 $ printf "foo\n" > foo.whole
874 $ hg commit -m "edit file"
873 $ hg commit -m "edit file"
875 $ hg status --change .
874 $ hg status --change .
876 M foo.whole
875 M foo.whole
877 $ hg fix -r .
876 $ hg fix -r .
878 $ hg status --change tip
877 $ hg status --change tip
879
878
880 $ cd ..
879 $ cd ..
881
880
882 If we fix a parent and child revision together, the child revision must be
881 If we fix a parent and child revision together, the child revision must be
883 replaced if the parent is replaced, even if the diffs of the child needed no
882 replaced if the parent is replaced, even if the diffs of the child needed no
884 fixes. However, we're free to not replace revisions that need no fixes and have
883 fixes. However, we're free to not replace revisions that need no fixes and have
885 no ancestors that are replaced.
884 no ancestors that are replaced.
886
885
887 $ hg init mustreplacechild
886 $ hg init mustreplacechild
888 $ cd mustreplacechild
887 $ cd mustreplacechild
889
888
890 $ printf "FOO\n" > foo.whole
889 $ printf "FOO\n" > foo.whole
891 $ hg commit -Aqm "add foo"
890 $ hg commit -Aqm "add foo"
892 $ printf "foo\n" > foo.whole
891 $ printf "foo\n" > foo.whole
893 $ hg commit -m "edit foo"
892 $ hg commit -m "edit foo"
894 $ printf "BAR\n" > bar.whole
893 $ printf "BAR\n" > bar.whole
895 $ hg commit -Aqm "add bar"
894 $ hg commit -Aqm "add bar"
896
895
897 $ hg log --graph --template '{rev} {files}'
896 $ hg log --graph --template '{rev} {files}'
898 @ 2 bar.whole
897 @ 2 bar.whole
899 |
898 |
900 o 1 foo.whole
899 o 1 foo.whole
901 |
900 |
902 o 0 foo.whole
901 o 0 foo.whole
903
902
904 $ hg fix -r 0:2
903 $ hg fix -r 0:2
905 $ hg log --graph --template '{rev} {files}'
904 $ hg log --graph --template '{rev} {files}'
906 o 4 bar.whole
905 o 4 bar.whole
907 |
906 |
908 o 3
907 o 3
909 |
908 |
910 | @ 2 bar.whole
909 | @ 2 bar.whole
911 | |
910 | |
912 | x 1 foo.whole
911 | x 1 foo.whole
913 |/
912 |/
914 o 0 foo.whole
913 o 0 foo.whole
915
914
916
915
917 $ cd ..
916 $ cd ..
918
917
919 It's also possible that the child needs absolutely no changes, but we still
918 It's also possible that the child needs absolutely no changes, but we still
920 need to replace it to update its parent. If we skipped replacing the child
919 need to replace it to update its parent. If we skipped replacing the child
921 because it had no file content changes, it would become an orphan for no good
920 because it had no file content changes, it would become an orphan for no good
922 reason.
921 reason.
923
922
924 $ hg init mustreplacechildevenifnop
923 $ hg init mustreplacechildevenifnop
925 $ cd mustreplacechildevenifnop
924 $ cd mustreplacechildevenifnop
926
925
927 $ printf "Foo\n" > foo.whole
926 $ printf "Foo\n" > foo.whole
928 $ hg commit -Aqm "add a bad foo"
927 $ hg commit -Aqm "add a bad foo"
929 $ printf "FOO\n" > foo.whole
928 $ printf "FOO\n" > foo.whole
930 $ hg commit -m "add a good foo"
929 $ hg commit -m "add a good foo"
931 $ hg fix -r . -r '.^'
930 $ hg fix -r . -r '.^'
932 $ hg log --graph --template '{rev} {desc}'
931 $ hg log --graph --template '{rev} {desc}'
933 o 3 add a good foo
932 o 3 add a good foo
934 |
933 |
935 o 2 add a bad foo
934 o 2 add a bad foo
936
935
937 @ 1 add a good foo
936 @ 1 add a good foo
938 |
937 |
939 x 0 add a bad foo
938 x 0 add a bad foo
940
939
941
940
942 $ cd ..
941 $ cd ..
943
942
944 Similar to the case above, the child revision may become empty as a result of
943 Similar to the case above, the child revision may become empty as a result of
945 fixing its parent. We should still create an empty replacement child.
944 fixing its parent. We should still create an empty replacement child.
946 TODO: determine how this should interact with ui.allowemptycommit given that
945 TODO: determine how this should interact with ui.allowemptycommit given that
947 the empty replacement could have children.
946 the empty replacement could have children.
948
947
949 $ hg init mustreplacechildevenifempty
948 $ hg init mustreplacechildevenifempty
950 $ cd mustreplacechildevenifempty
949 $ cd mustreplacechildevenifempty
951
950
952 $ printf "foo\n" > foo.whole
951 $ printf "foo\n" > foo.whole
953 $ hg commit -Aqm "add foo"
952 $ hg commit -Aqm "add foo"
954 $ printf "Foo\n" > foo.whole
953 $ printf "Foo\n" > foo.whole
955 $ hg commit -m "edit foo"
954 $ hg commit -m "edit foo"
956 $ hg fix -r . -r '.^'
955 $ hg fix -r . -r '.^'
957 $ hg log --graph --template '{rev} {desc}\n' --stat
956 $ hg log --graph --template '{rev} {desc}\n' --stat
958 o 3 edit foo
957 o 3 edit foo
959 |
958 |
960 o 2 add foo
959 o 2 add foo
961 foo.whole | 1 +
960 foo.whole | 1 +
962 1 files changed, 1 insertions(+), 0 deletions(-)
961 1 files changed, 1 insertions(+), 0 deletions(-)
963
962
964 @ 1 edit foo
963 @ 1 edit foo
965 | foo.whole | 2 +-
964 | foo.whole | 2 +-
966 | 1 files changed, 1 insertions(+), 1 deletions(-)
965 | 1 files changed, 1 insertions(+), 1 deletions(-)
967 |
966 |
968 x 0 add foo
967 x 0 add foo
969 foo.whole | 1 +
968 foo.whole | 1 +
970 1 files changed, 1 insertions(+), 0 deletions(-)
969 1 files changed, 1 insertions(+), 0 deletions(-)
971
970
972
971
973 $ cd ..
972 $ cd ..
974
973
975 Fixing a secret commit should replace it with another secret commit.
974 Fixing a secret commit should replace it with another secret commit.
976
975
977 $ hg init fixsecretcommit
976 $ hg init fixsecretcommit
978 $ cd fixsecretcommit
977 $ cd fixsecretcommit
979
978
980 $ printf "foo\n" > foo.whole
979 $ printf "foo\n" > foo.whole
981 $ hg commit -Aqm "add foo" --secret
980 $ hg commit -Aqm "add foo" --secret
982 $ hg fix -r .
981 $ hg fix -r .
983 $ hg log --template '{rev} {phase}\n'
982 $ hg log --template '{rev} {phase}\n'
984 1 secret
983 1 secret
985 0 secret
984 0 secret
986
985
987 $ cd ..
986 $ cd ..
988
987
989 We should also preserve phase when fixing a draft commit while the user has
988 We should also preserve phase when fixing a draft commit while the user has
990 their default set to secret.
989 their default set to secret.
991
990
992 $ hg init respectphasesnewcommit
991 $ hg init respectphasesnewcommit
993 $ cd respectphasesnewcommit
992 $ cd respectphasesnewcommit
994
993
995 $ printf "foo\n" > foo.whole
994 $ printf "foo\n" > foo.whole
996 $ hg commit -Aqm "add foo"
995 $ hg commit -Aqm "add foo"
997 $ hg --config phases.newcommit=secret fix -r .
996 $ hg --config phases.newcommit=secret fix -r .
998 $ hg log --template '{rev} {phase}\n'
997 $ hg log --template '{rev} {phase}\n'
999 1 draft
998 1 draft
1000 0 draft
999 0 draft
1001
1000
1002 $ cd ..
1001 $ cd ..
1003
1002
1004 Debug output should show what fixer commands are being subprocessed, which is
1003 Debug output should show what fixer commands are being subprocessed, which is
1005 useful for anyone trying to set up a new config.
1004 useful for anyone trying to set up a new config.
1006
1005
1007 $ hg init debugoutput
1006 $ hg init debugoutput
1008 $ cd debugoutput
1007 $ cd debugoutput
1009
1008
1010 $ printf "foo\nbar\nbaz\n" > foo.changed
1009 $ printf "foo\nbar\nbaz\n" > foo.changed
1011 $ hg commit -Aqm "foo"
1010 $ hg commit -Aqm "foo"
1012 $ printf "Foo\nbar\nBaz\n" > foo.changed
1011 $ printf "Foo\nbar\nBaz\n" > foo.changed
1013 $ hg --debug fix --working-dir
1012 $ hg --debug fix --working-dir
1014 subprocess: * $TESTTMP/uppercase.py 1-1 3-3 (glob)
1013 subprocess: * $TESTTMP/uppercase.py 1-1 3-3 (glob)
1015
1014
1016 $ cd ..
1015 $ cd ..
1017
1016
1018 Fixing an obsolete revision can cause divergence, so we abort unless the user
1017 Fixing an obsolete revision can cause divergence, so we abort unless the user
1019 configures to allow it. This is not yet smart enough to know whether there is a
1018 configures to allow it. This is not yet smart enough to know whether there is a
1020 successor, but even then it is not likely intentional or idiomatic to fix an
1019 successor, but even then it is not likely intentional or idiomatic to fix an
1021 obsolete revision.
1020 obsolete revision.
1022
1021
1023 $ hg init abortobsoleterev
1022 $ hg init abortobsoleterev
1024 $ cd abortobsoleterev
1023 $ cd abortobsoleterev
1025
1024
1026 $ printf "foo\n" > foo.changed
1025 $ printf "foo\n" > foo.changed
1027 $ hg commit -Aqm "foo"
1026 $ hg commit -Aqm "foo"
1028 $ hg debugobsolete `hg parents --template '{node}'`
1027 $ hg debugobsolete `hg parents --template '{node}'`
1029 obsoleted 1 changesets
1028 obsoleted 1 changesets
1030 $ hg --hidden fix -r 0
1029 $ hg --hidden fix -r 0
1031 abort: fixing obsolete revision could cause divergence
1030 abort: fixing obsolete revision could cause divergence
1032 [255]
1031 [255]
1033
1032
1034 $ hg --hidden fix -r 0 --config experimental.evolution.allowdivergence=true
1033 $ hg --hidden fix -r 0 --config experimental.evolution.allowdivergence=true
1035 $ hg cat -r tip foo.changed
1034 $ hg cat -r tip foo.changed
1036 FOO
1035 FOO
1037
1036
1038 $ cd ..
1037 $ cd ..
1039
1038
1040 Test all of the available substitution values for fixer commands.
1039 Test all of the available substitution values for fixer commands.
1041
1040
1042 $ hg init substitution
1041 $ hg init substitution
1043 $ cd substitution
1042 $ cd substitution
1044
1043
1045 $ mkdir foo
1044 $ mkdir foo
1046 $ printf "hello\ngoodbye\n" > foo/bar
1045 $ printf "hello\ngoodbye\n" > foo/bar
1047 $ hg add
1046 $ hg add
1048 adding foo/bar
1047 adding foo/bar
1049 $ hg --config "fix.fail:command=printf '%s\n' '{rootpath}' '{basename}'" \
1048 $ hg --config "fix.fail:command=printf '%s\n' '{rootpath}' '{basename}'" \
1050 > --config "fix.fail:linerange='{first}' '{last}'" \
1049 > --config "fix.fail:linerange='{first}' '{last}'" \
1051 > --config "fix.fail:pattern=foo/bar" \
1050 > --config "fix.fail:pattern=foo/bar" \
1052 > fix --working-dir
1051 > fix --working-dir
1053 $ cat foo/bar
1052 $ cat foo/bar
1054 foo/bar
1053 foo/bar
1055 bar
1054 bar
1056 1
1055 1
1057 2
1056 2
1058
1057
1059 $ cd ..
1058 $ cd ..
1060
1059
1061 The --base flag should allow picking the revisions to diff against for changed
1060 The --base flag should allow picking the revisions to diff against for changed
1062 files and incremental line formatting.
1061 files and incremental line formatting.
1063
1062
1064 $ hg init baseflag
1063 $ hg init baseflag
1065 $ cd baseflag
1064 $ cd baseflag
1066
1065
1067 $ printf "one\ntwo\n" > foo.changed
1066 $ printf "one\ntwo\n" > foo.changed
1068 $ printf "bar\n" > bar.changed
1067 $ printf "bar\n" > bar.changed
1069 $ hg commit -Aqm "first"
1068 $ hg commit -Aqm "first"
1070 $ printf "one\nTwo\n" > foo.changed
1069 $ printf "one\nTwo\n" > foo.changed
1071 $ hg commit -m "second"
1070 $ hg commit -m "second"
1072 $ hg fix -w --base .
1071 $ hg fix -w --base .
1073 $ hg status
1072 $ hg status
1074 $ hg fix -w --base null
1073 $ hg fix -w --base null
1075 $ cat foo.changed
1074 $ cat foo.changed
1076 ONE
1075 ONE
1077 TWO
1076 TWO
1078 $ cat bar.changed
1077 $ cat bar.changed
1079 BAR
1078 BAR
1080
1079
1081 $ cd ..
1080 $ cd ..
1082
1081
1083 If the user asks to fix the parent of another commit, they are asking to create
1082 If the user asks to fix the parent of another commit, they are asking to create
1084 an orphan. We must respect experimental.evolution.allowunstable.
1083 an orphan. We must respect experimental.evolution.allowunstable.
1085
1084
1086 $ hg init allowunstable
1085 $ hg init allowunstable
1087 $ cd allowunstable
1086 $ cd allowunstable
1088
1087
1089 $ printf "one\n" > foo.whole
1088 $ printf "one\n" > foo.whole
1090 $ hg commit -Aqm "first"
1089 $ hg commit -Aqm "first"
1091 $ printf "two\n" > foo.whole
1090 $ printf "two\n" > foo.whole
1092 $ hg commit -m "second"
1091 $ hg commit -m "second"
1093 $ hg --config experimental.evolution.allowunstable=False fix -r '.^'
1092 $ hg --config experimental.evolution.allowunstable=False fix -r '.^'
1094 abort: can only fix a changeset together with all its descendants
1093 abort: can only fix a changeset together with all its descendants
1095 [255]
1094 [255]
1096 $ hg fix -r '.^'
1095 $ hg fix -r '.^'
1097 1 new orphan changesets
1096 1 new orphan changesets
1098 $ hg cat -r 2 foo.whole
1097 $ hg cat -r 2 foo.whole
1099 ONE
1098 ONE
1100
1099
1101 $ cd ..
1100 $ cd ..
1102
1101
1103 The --base flag affects the set of files being fixed. So while the --whole flag
1102 The --base flag affects the set of files being fixed. So while the --whole flag
1104 makes the base irrelevant for changed line ranges, it still changes the
1103 makes the base irrelevant for changed line ranges, it still changes the
1105 meaning and effect of the command. In this example, no files or lines are fixed
1104 meaning and effect of the command. In this example, no files or lines are fixed
1106 until we specify the base, but then we do fix unchanged lines.
1105 until we specify the base, but then we do fix unchanged lines.
1107
1106
1108 $ hg init basewhole
1107 $ hg init basewhole
1109 $ cd basewhole
1108 $ cd basewhole
1110 $ printf "foo1\n" > foo.changed
1109 $ printf "foo1\n" > foo.changed
1111 $ hg commit -Aqm "first"
1110 $ hg commit -Aqm "first"
1112 $ printf "foo2\n" >> foo.changed
1111 $ printf "foo2\n" >> foo.changed
1113 $ printf "bar\n" > bar.changed
1112 $ printf "bar\n" > bar.changed
1114 $ hg commit -Aqm "second"
1113 $ hg commit -Aqm "second"
1115
1114
1116 $ hg fix --working-dir --whole
1115 $ hg fix --working-dir --whole
1117 $ cat *.changed
1116 $ cat *.changed
1118 bar
1117 bar
1119 foo1
1118 foo1
1120 foo2
1119 foo2
1121
1120
1122 $ hg fix --working-dir --base 0 --whole
1121 $ hg fix --working-dir --base 0 --whole
1123 $ cat *.changed
1122 $ cat *.changed
1124 BAR
1123 BAR
1125 FOO1
1124 FOO1
1126 FOO2
1125 FOO2
1127
1126
1128 $ cd ..
1127 $ cd ..
1129
1128
1130 The :fileset subconfig was a misnomer, so we renamed it to :pattern. We will
1129 The :fileset subconfig was a misnomer, so we renamed it to :pattern. We will
1131 still accept :fileset by itself as if it were :pattern, but this will issue a
1130 still accept :fileset by itself as if it were :pattern, but this will issue a
1132 warning.
1131 warning.
1133
1132
1134 $ hg init filesetispattern
1133 $ hg init filesetispattern
1135 $ cd filesetispattern
1134 $ cd filesetispattern
1136
1135
1137 $ printf "foo\n" > foo.whole
1136 $ printf "foo\n" > foo.whole
1138 $ printf "first\nsecond\n" > bar.txt
1137 $ printf "first\nsecond\n" > bar.txt
1139 $ hg add -q
1138 $ hg add -q
1140 $ hg fix -w --config fix.sometool:fileset=bar.txt \
1139 $ hg fix -w --config fix.sometool:fileset=bar.txt \
1141 > --config fix.sometool:command="sort -r"
1140 > --config fix.sometool:command="sort -r"
1142 the fix.tool:fileset config name is deprecated; please rename it to fix.tool:pattern
1141 the fix.tool:fileset config name is deprecated; please rename it to fix.tool:pattern
1143
1142
1144 $ cat foo.whole
1143 $ cat foo.whole
1145 FOO
1144 FOO
1146 $ cat bar.txt
1145 $ cat bar.txt
1147 second
1146 second
1148 first
1147 first
1149
1148
1150 $ cd ..
1149 $ cd ..
1151
1150
1152 The execution order of tools can be controlled. This example doesn't work if
1151 The execution order of tools can be controlled. This example doesn't work if
1153 you sort after truncating, but the config defines the correct order while the
1152 you sort after truncating, but the config defines the correct order while the
1154 definitions are out of order (which might imply the incorrect order given the
1153 definitions are out of order (which might imply the incorrect order given the
1155 implementation of fix). The goal is to use multiple tools to select the lowest
1154 implementation of fix). The goal is to use multiple tools to select the lowest
1156 5 numbers in the file.
1155 5 numbers in the file.
1157
1156
1158 $ hg init priorityexample
1157 $ hg init priorityexample
1159 $ cd priorityexample
1158 $ cd priorityexample
1160
1159
1161 $ cat >> .hg/hgrc <<EOF
1160 $ cat >> .hg/hgrc <<EOF
1162 > [fix]
1161 > [fix]
1163 > head:command = head --lines=5
1162 > head:command = head --lines=5
1164 > head:pattern = numbers.txt
1163 > head:pattern = numbers.txt
1165 > head:priority = 1
1164 > head:priority = 1
1166 > sort:command = sort --numeric-sort
1165 > sort:command = sort --numeric-sort
1167 > sort:pattern = numbers.txt
1166 > sort:pattern = numbers.txt
1168 > sort:priority = 2
1167 > sort:priority = 2
1169 > EOF
1168 > EOF
1170
1169
1171 $ printf "8\n2\n3\n6\n7\n4\n9\n5\n1\n0\n" > numbers.txt
1170 $ printf "8\n2\n3\n6\n7\n4\n9\n5\n1\n0\n" > numbers.txt
1172 $ hg add -q
1171 $ hg add -q
1173 $ hg fix -w
1172 $ hg fix -w
1174 $ cat numbers.txt
1173 $ cat numbers.txt
1175 0
1174 0
1176 1
1175 1
1177 2
1176 2
1178 3
1177 3
1179 4
1178 4
1180
1179
1181 And of course we should be able to break this by reversing the execution order.
1180 And of course we should be able to break this by reversing the execution order.
1182 Test negative priorities while we're at it.
1181 Test negative priorities while we're at it.
1183
1182
1184 $ cat >> .hg/hgrc <<EOF
1183 $ cat >> .hg/hgrc <<EOF
1185 > [fix]
1184 > [fix]
1186 > head:priority = -1
1185 > head:priority = -1
1187 > sort:priority = -2
1186 > sort:priority = -2
1188 > EOF
1187 > EOF
1189 $ printf "8\n2\n3\n6\n7\n4\n9\n5\n1\n0\n" > numbers.txt
1188 $ printf "8\n2\n3\n6\n7\n4\n9\n5\n1\n0\n" > numbers.txt
1190 $ hg fix -w
1189 $ hg fix -w
1191 $ cat numbers.txt
1190 $ cat numbers.txt
1192 2
1191 2
1193 3
1192 3
1194 6
1193 6
1195 7
1194 7
1196 8
1195 8
1197
1196
1198 $ cd ..
1197 $ cd ..
1199
1198
1200 It's possible for repeated applications of a fixer tool to create cycles in the
1199 It's possible for repeated applications of a fixer tool to create cycles in the
1201 generated content of a file. For example, two users with different versions of
1200 generated content of a file. For example, two users with different versions of
1202 a code formatter might fight over the formatting when they run hg fix. In the
1201 a code formatter might fight over the formatting when they run hg fix. In the
1203 absence of other changes, this means we could produce commits with the same
1202 absence of other changes, this means we could produce commits with the same
1204 hash in subsequent runs of hg fix. This is a problem unless we support
1203 hash in subsequent runs of hg fix. This is a problem unless we support
1205 obsolescence cycles well. We avoid this by adding an extra field to the
1204 obsolescence cycles well. We avoid this by adding an extra field to the
1206 successor which forces it to have a new hash. That's why this test creates
1205 successor which forces it to have a new hash. That's why this test creates
1207 three revisions instead of two.
1206 three revisions instead of two.
1208
1207
1209 $ hg init cyclictool
1208 $ hg init cyclictool
1210 $ cd cyclictool
1209 $ cd cyclictool
1211
1210
1212 $ cat >> .hg/hgrc <<EOF
1211 $ cat >> .hg/hgrc <<EOF
1213 > [fix]
1212 > [fix]
1214 > swapletters:command = tr ab ba
1213 > swapletters:command = tr ab ba
1215 > swapletters:pattern = foo
1214 > swapletters:pattern = foo
1216 > EOF
1215 > EOF
1217
1216
1218 $ echo ab > foo
1217 $ echo ab > foo
1219 $ hg commit -Aqm foo
1218 $ hg commit -Aqm foo
1220
1219
1221 $ hg fix -r 0
1220 $ hg fix -r 0
1222 $ hg fix -r 1
1221 $ hg fix -r 1
1223
1222
1224 $ hg cat -r 0 foo --hidden
1223 $ hg cat -r 0 foo --hidden
1225 ab
1224 ab
1226 $ hg cat -r 1 foo --hidden
1225 $ hg cat -r 1 foo --hidden
1227 ba
1226 ba
1228 $ hg cat -r 2 foo
1227 $ hg cat -r 2 foo
1229 ab
1228 ab
1230
1229
1231 $ cd ..
1230 $ cd ..
1232
1231
@@ -1,3826 +1,3826 b''
1 Short help:
1 Short help:
2
2
3 $ hg
3 $ hg
4 Mercurial Distributed SCM
4 Mercurial Distributed SCM
5
5
6 basic commands:
6 basic commands:
7
7
8 add add the specified files on the next commit
8 add add the specified files on the next commit
9 annotate show changeset information by line for each file
9 annotate show changeset information by line for each file
10 clone make a copy of an existing repository
10 clone make a copy of an existing repository
11 commit commit the specified files or all outstanding changes
11 commit commit the specified files or all outstanding changes
12 diff diff repository (or selected files)
12 diff diff repository (or selected files)
13 export dump the header and diffs for one or more changesets
13 export dump the header and diffs for one or more changesets
14 forget forget the specified files on the next commit
14 forget forget the specified files on the next commit
15 init create a new repository in the given directory
15 init create a new repository in the given directory
16 log show revision history of entire repository or files
16 log show revision history of entire repository or files
17 merge merge another revision into working directory
17 merge merge another revision into working directory
18 pull pull changes from the specified source
18 pull pull changes from the specified source
19 push push changes to the specified destination
19 push push changes to the specified destination
20 remove remove the specified files on the next commit
20 remove remove the specified files on the next commit
21 serve start stand-alone webserver
21 serve start stand-alone webserver
22 status show changed files in the working directory
22 status show changed files in the working directory
23 summary summarize working directory state
23 summary summarize working directory state
24 update update working directory (or switch revisions)
24 update update working directory (or switch revisions)
25
25
26 (use 'hg help' for the full list of commands or 'hg -v' for details)
26 (use 'hg help' for the full list of commands or 'hg -v' for details)
27
27
28 $ hg -q
28 $ hg -q
29 add add the specified files on the next commit
29 add add the specified files on the next commit
30 annotate show changeset information by line for each file
30 annotate show changeset information by line for each file
31 clone make a copy of an existing repository
31 clone make a copy of an existing repository
32 commit commit the specified files or all outstanding changes
32 commit commit the specified files or all outstanding changes
33 diff diff repository (or selected files)
33 diff diff repository (or selected files)
34 export dump the header and diffs for one or more changesets
34 export dump the header and diffs for one or more changesets
35 forget forget the specified files on the next commit
35 forget forget the specified files on the next commit
36 init create a new repository in the given directory
36 init create a new repository in the given directory
37 log show revision history of entire repository or files
37 log show revision history of entire repository or files
38 merge merge another revision into working directory
38 merge merge another revision into working directory
39 pull pull changes from the specified source
39 pull pull changes from the specified source
40 push push changes to the specified destination
40 push push changes to the specified destination
41 remove remove the specified files on the next commit
41 remove remove the specified files on the next commit
42 serve start stand-alone webserver
42 serve start stand-alone webserver
43 status show changed files in the working directory
43 status show changed files in the working directory
44 summary summarize working directory state
44 summary summarize working directory state
45 update update working directory (or switch revisions)
45 update update working directory (or switch revisions)
46
46
47 Extra extensions will be printed in help output in a non-reliable order since
47 Extra extensions will be printed in help output in a non-reliable order since
48 the extension is unknown.
48 the extension is unknown.
49 #if no-extraextensions
49 #if no-extraextensions
50
50
51 $ hg help
51 $ hg help
52 Mercurial Distributed SCM
52 Mercurial Distributed SCM
53
53
54 list of commands:
54 list of commands:
55
55
56 Repository creation:
56 Repository creation:
57
57
58 clone make a copy of an existing repository
58 clone make a copy of an existing repository
59 init create a new repository in the given directory
59 init create a new repository in the given directory
60
60
61 Remote repository management:
61 Remote repository management:
62
62
63 incoming show new changesets found in source
63 incoming show new changesets found in source
64 outgoing show changesets not found in the destination
64 outgoing show changesets not found in the destination
65 paths show aliases for remote repositories
65 paths show aliases for remote repositories
66 pull pull changes from the specified source
66 pull pull changes from the specified source
67 push push changes to the specified destination
67 push push changes to the specified destination
68 serve start stand-alone webserver
68 serve start stand-alone webserver
69
69
70 Change creation:
70 Change creation:
71
71
72 commit commit the specified files or all outstanding changes
72 commit commit the specified files or all outstanding changes
73
73
74 Change manipulation:
74 Change manipulation:
75
75
76 backout reverse effect of earlier changeset
76 backout reverse effect of earlier changeset
77 graft copy changes from other branches onto the current branch
77 graft copy changes from other branches onto the current branch
78 merge merge another revision into working directory
78 merge merge another revision into working directory
79
79
80 Change organization:
80 Change organization:
81
81
82 bookmarks create a new bookmark or list existing bookmarks
82 bookmarks create a new bookmark or list existing bookmarks
83 branch set or show the current branch name
83 branch set or show the current branch name
84 branches list repository named branches
84 branches list repository named branches
85 phase set or show the current phase name
85 phase set or show the current phase name
86 tag add one or more tags for the current or given revision
86 tag add one or more tags for the current or given revision
87 tags list repository tags
87 tags list repository tags
88
88
89 File content management:
89 File content management:
90
90
91 annotate show changeset information by line for each file
91 annotate show changeset information by line for each file
92 cat output the current or given revision of files
92 cat output the current or given revision of files
93 copy mark files as copied for the next commit
93 copy mark files as copied for the next commit
94 diff diff repository (or selected files)
94 diff diff repository (or selected files)
95 grep search revision history for a pattern in specified files
95 grep search revision history for a pattern in specified files
96
96
97 Change navigation:
97 Change navigation:
98
98
99 bisect subdivision search of changesets
99 bisect subdivision search of changesets
100 heads show branch heads
100 heads show branch heads
101 identify identify the working directory or specified revision
101 identify identify the working directory or specified revision
102 log show revision history of entire repository or files
102 log show revision history of entire repository or files
103
103
104 Working directory management:
104 Working directory management:
105
105
106 add add the specified files on the next commit
106 add add the specified files on the next commit
107 addremove add all new files, delete all missing files
107 addremove add all new files, delete all missing files
108 files list tracked files
108 files list tracked files
109 forget forget the specified files on the next commit
109 forget forget the specified files on the next commit
110 remove remove the specified files on the next commit
110 remove remove the specified files on the next commit
111 rename rename files; equivalent of copy + remove
111 rename rename files; equivalent of copy + remove
112 resolve redo merges or set/view the merge status of files
112 resolve redo merges or set/view the merge status of files
113 revert restore files to their checkout state
113 revert restore files to their checkout state
114 root print the root (top) of the current working directory
114 root print the root (top) of the current working directory
115 status show changed files in the working directory
115 status show changed files in the working directory
116 summary summarize working directory state
116 summary summarize working directory state
117 update update working directory (or switch revisions)
117 update update working directory (or switch revisions)
118
118
119 Change import/export:
119 Change import/export:
120
120
121 archive create an unversioned archive of a repository revision
121 archive create an unversioned archive of a repository revision
122 bundle create a bundle file
122 bundle create a bundle file
123 export dump the header and diffs for one or more changesets
123 export dump the header and diffs for one or more changesets
124 import import an ordered set of patches
124 import import an ordered set of patches
125 unbundle apply one or more bundle files
125 unbundle apply one or more bundle files
126
126
127 Repository maintenance:
127 Repository maintenance:
128
128
129 manifest output the current or given revision of the project manifest
129 manifest output the current or given revision of the project manifest
130 recover roll back an interrupted transaction
130 recover roll back an interrupted transaction
131 verify verify the integrity of the repository
131 verify verify the integrity of the repository
132
132
133 Help:
133 Help:
134
134
135 config show combined config settings from all hgrc files
135 config show combined config settings from all hgrc files
136 help show help for a given topic or a help overview
136 help show help for a given topic or a help overview
137 version output version and copyright information
137 version output version and copyright information
138
138
139 additional help topics:
139 additional help topics:
140
140
141 Mercurial identifiers:
141 Mercurial identifiers:
142
142
143 filesets Specifying File Sets
143 filesets Specifying File Sets
144 hgignore Syntax for Mercurial Ignore Files
144 hgignore Syntax for Mercurial Ignore Files
145 patterns File Name Patterns
145 patterns File Name Patterns
146 revisions Specifying Revisions
146 revisions Specifying Revisions
147 urls URL Paths
147 urls URL Paths
148
148
149 Mercurial output:
149 Mercurial output:
150
150
151 color Colorizing Outputs
151 color Colorizing Outputs
152 dates Date Formats
152 dates Date Formats
153 diffs Diff Formats
153 diffs Diff Formats
154 templating Template Usage
154 templating Template Usage
155
155
156 Mercurial configuration:
156 Mercurial configuration:
157
157
158 config Configuration Files
158 config Configuration Files
159 environment Environment Variables
159 environment Environment Variables
160 extensions Using Additional Features
160 extensions Using Additional Features
161 flags Command-line flags
161 flags Command-line flags
162 hgweb Configuring hgweb
162 hgweb Configuring hgweb
163 merge-tools Merge Tools
163 merge-tools Merge Tools
164 pager Pager Support
164 pager Pager Support
165
165
166 Concepts:
166 Concepts:
167
167
168 bundlespec Bundle File Formats
168 bundlespec Bundle File Formats
169 glossary Glossary
169 glossary Glossary
170 phases Working with Phases
170 phases Working with Phases
171 subrepos Subrepositories
171 subrepos Subrepositories
172
172
173 Miscellaneous:
173 Miscellaneous:
174
174
175 deprecated Deprecated Features
175 deprecated Deprecated Features
176 internals Technical implementation topics
176 internals Technical implementation topics
177 scripting Using Mercurial from scripts and automation
177 scripting Using Mercurial from scripts and automation
178
178
179 (use 'hg help -v' to show built-in aliases and global options)
179 (use 'hg help -v' to show built-in aliases and global options)
180
180
181 $ hg -q help
181 $ hg -q help
182 Repository creation:
182 Repository creation:
183
183
184 clone make a copy of an existing repository
184 clone make a copy of an existing repository
185 init create a new repository in the given directory
185 init create a new repository in the given directory
186
186
187 Remote repository management:
187 Remote repository management:
188
188
189 incoming show new changesets found in source
189 incoming show new changesets found in source
190 outgoing show changesets not found in the destination
190 outgoing show changesets not found in the destination
191 paths show aliases for remote repositories
191 paths show aliases for remote repositories
192 pull pull changes from the specified source
192 pull pull changes from the specified source
193 push push changes to the specified destination
193 push push changes to the specified destination
194 serve start stand-alone webserver
194 serve start stand-alone webserver
195
195
196 Change creation:
196 Change creation:
197
197
198 commit commit the specified files or all outstanding changes
198 commit commit the specified files or all outstanding changes
199
199
200 Change manipulation:
200 Change manipulation:
201
201
202 backout reverse effect of earlier changeset
202 backout reverse effect of earlier changeset
203 graft copy changes from other branches onto the current branch
203 graft copy changes from other branches onto the current branch
204 merge merge another revision into working directory
204 merge merge another revision into working directory
205
205
206 Change organization:
206 Change organization:
207
207
208 bookmarks create a new bookmark or list existing bookmarks
208 bookmarks create a new bookmark or list existing bookmarks
209 branch set or show the current branch name
209 branch set or show the current branch name
210 branches list repository named branches
210 branches list repository named branches
211 phase set or show the current phase name
211 phase set or show the current phase name
212 tag add one or more tags for the current or given revision
212 tag add one or more tags for the current or given revision
213 tags list repository tags
213 tags list repository tags
214
214
215 File content management:
215 File content management:
216
216
217 annotate show changeset information by line for each file
217 annotate show changeset information by line for each file
218 cat output the current or given revision of files
218 cat output the current or given revision of files
219 copy mark files as copied for the next commit
219 copy mark files as copied for the next commit
220 diff diff repository (or selected files)
220 diff diff repository (or selected files)
221 grep search revision history for a pattern in specified files
221 grep search revision history for a pattern in specified files
222
222
223 Change navigation:
223 Change navigation:
224
224
225 bisect subdivision search of changesets
225 bisect subdivision search of changesets
226 heads show branch heads
226 heads show branch heads
227 identify identify the working directory or specified revision
227 identify identify the working directory or specified revision
228 log show revision history of entire repository or files
228 log show revision history of entire repository or files
229
229
230 Working directory management:
230 Working directory management:
231
231
232 add add the specified files on the next commit
232 add add the specified files on the next commit
233 addremove add all new files, delete all missing files
233 addremove add all new files, delete all missing files
234 files list tracked files
234 files list tracked files
235 forget forget the specified files on the next commit
235 forget forget the specified files on the next commit
236 remove remove the specified files on the next commit
236 remove remove the specified files on the next commit
237 rename rename files; equivalent of copy + remove
237 rename rename files; equivalent of copy + remove
238 resolve redo merges or set/view the merge status of files
238 resolve redo merges or set/view the merge status of files
239 revert restore files to their checkout state
239 revert restore files to their checkout state
240 root print the root (top) of the current working directory
240 root print the root (top) of the current working directory
241 status show changed files in the working directory
241 status show changed files in the working directory
242 summary summarize working directory state
242 summary summarize working directory state
243 update update working directory (or switch revisions)
243 update update working directory (or switch revisions)
244
244
245 Change import/export:
245 Change import/export:
246
246
247 archive create an unversioned archive of a repository revision
247 archive create an unversioned archive of a repository revision
248 bundle create a bundle file
248 bundle create a bundle file
249 export dump the header and diffs for one or more changesets
249 export dump the header and diffs for one or more changesets
250 import import an ordered set of patches
250 import import an ordered set of patches
251 unbundle apply one or more bundle files
251 unbundle apply one or more bundle files
252
252
253 Repository maintenance:
253 Repository maintenance:
254
254
255 manifest output the current or given revision of the project manifest
255 manifest output the current or given revision of the project manifest
256 recover roll back an interrupted transaction
256 recover roll back an interrupted transaction
257 verify verify the integrity of the repository
257 verify verify the integrity of the repository
258
258
259 Help:
259 Help:
260
260
261 config show combined config settings from all hgrc files
261 config show combined config settings from all hgrc files
262 help show help for a given topic or a help overview
262 help show help for a given topic or a help overview
263 version output version and copyright information
263 version output version and copyright information
264
264
265 additional help topics:
265 additional help topics:
266
266
267 Mercurial identifiers:
267 Mercurial identifiers:
268
268
269 filesets Specifying File Sets
269 filesets Specifying File Sets
270 hgignore Syntax for Mercurial Ignore Files
270 hgignore Syntax for Mercurial Ignore Files
271 patterns File Name Patterns
271 patterns File Name Patterns
272 revisions Specifying Revisions
272 revisions Specifying Revisions
273 urls URL Paths
273 urls URL Paths
274
274
275 Mercurial output:
275 Mercurial output:
276
276
277 color Colorizing Outputs
277 color Colorizing Outputs
278 dates Date Formats
278 dates Date Formats
279 diffs Diff Formats
279 diffs Diff Formats
280 templating Template Usage
280 templating Template Usage
281
281
282 Mercurial configuration:
282 Mercurial configuration:
283
283
284 config Configuration Files
284 config Configuration Files
285 environment Environment Variables
285 environment Environment Variables
286 extensions Using Additional Features
286 extensions Using Additional Features
287 flags Command-line flags
287 flags Command-line flags
288 hgweb Configuring hgweb
288 hgweb Configuring hgweb
289 merge-tools Merge Tools
289 merge-tools Merge Tools
290 pager Pager Support
290 pager Pager Support
291
291
292 Concepts:
292 Concepts:
293
293
294 bundlespec Bundle File Formats
294 bundlespec Bundle File Formats
295 glossary Glossary
295 glossary Glossary
296 phases Working with Phases
296 phases Working with Phases
297 subrepos Subrepositories
297 subrepos Subrepositories
298
298
299 Miscellaneous:
299 Miscellaneous:
300
300
301 deprecated Deprecated Features
301 deprecated Deprecated Features
302 internals Technical implementation topics
302 internals Technical implementation topics
303 scripting Using Mercurial from scripts and automation
303 scripting Using Mercurial from scripts and automation
304
304
305 Test extension help:
305 Test extension help:
306 $ hg help extensions --config extensions.rebase= --config extensions.children=
306 $ hg help extensions --config extensions.rebase= --config extensions.children=
307 Using Additional Features
307 Using Additional Features
308 """""""""""""""""""""""""
308 """""""""""""""""""""""""
309
309
310 Mercurial has the ability to add new features through the use of
310 Mercurial has the ability to add new features through the use of
311 extensions. Extensions may add new commands, add options to existing
311 extensions. Extensions may add new commands, add options to existing
312 commands, change the default behavior of commands, or implement hooks.
312 commands, change the default behavior of commands, or implement hooks.
313
313
314 To enable the "foo" extension, either shipped with Mercurial or in the
314 To enable the "foo" extension, either shipped with Mercurial or in the
315 Python search path, create an entry for it in your configuration file,
315 Python search path, create an entry for it in your configuration file,
316 like this:
316 like this:
317
317
318 [extensions]
318 [extensions]
319 foo =
319 foo =
320
320
321 You may also specify the full path to an extension:
321 You may also specify the full path to an extension:
322
322
323 [extensions]
323 [extensions]
324 myfeature = ~/.hgext/myfeature.py
324 myfeature = ~/.hgext/myfeature.py
325
325
326 See 'hg help config' for more information on configuration files.
326 See 'hg help config' for more information on configuration files.
327
327
328 Extensions are not loaded by default for a variety of reasons: they can
328 Extensions are not loaded by default for a variety of reasons: they can
329 increase startup overhead; they may be meant for advanced usage only; they
329 increase startup overhead; they may be meant for advanced usage only; they
330 may provide potentially dangerous abilities (such as letting you destroy
330 may provide potentially dangerous abilities (such as letting you destroy
331 or modify history); they might not be ready for prime time; or they may
331 or modify history); they might not be ready for prime time; or they may
332 alter some usual behaviors of stock Mercurial. It is thus up to the user
332 alter some usual behaviors of stock Mercurial. It is thus up to the user
333 to activate extensions as needed.
333 to activate extensions as needed.
334
334
335 To explicitly disable an extension enabled in a configuration file of
335 To explicitly disable an extension enabled in a configuration file of
336 broader scope, prepend its path with !:
336 broader scope, prepend its path with !:
337
337
338 [extensions]
338 [extensions]
339 # disabling extension bar residing in /path/to/extension/bar.py
339 # disabling extension bar residing in /path/to/extension/bar.py
340 bar = !/path/to/extension/bar.py
340 bar = !/path/to/extension/bar.py
341 # ditto, but no path was supplied for extension baz
341 # ditto, but no path was supplied for extension baz
342 baz = !
342 baz = !
343
343
344 enabled extensions:
344 enabled extensions:
345
345
346 children command to display child changesets (DEPRECATED)
346 children command to display child changesets (DEPRECATED)
347 rebase command to move sets of revisions to a different ancestor
347 rebase command to move sets of revisions to a different ancestor
348
348
349 disabled extensions:
349 disabled extensions:
350
350
351 acl hooks for controlling repository access
351 acl hooks for controlling repository access
352 blackbox log repository events to a blackbox for debugging
352 blackbox log repository events to a blackbox for debugging
353 bugzilla hooks for integrating with the Bugzilla bug tracker
353 bugzilla hooks for integrating with the Bugzilla bug tracker
354 censor erase file content at a given revision
354 censor erase file content at a given revision
355 churn command to display statistics about repository history
355 churn command to display statistics about repository history
356 clonebundles advertise pre-generated bundles to seed clones
356 clonebundles advertise pre-generated bundles to seed clones
357 closehead close arbitrary heads without checking them out first
357 closehead close arbitrary heads without checking them out first
358 convert import revisions from foreign VCS repositories into
358 convert import revisions from foreign VCS repositories into
359 Mercurial
359 Mercurial
360 eol automatically manage newlines in repository files
360 eol automatically manage newlines in repository files
361 extdiff command to allow external programs to compare revisions
361 extdiff command to allow external programs to compare revisions
362 factotum http authentication with factotum
362 factotum http authentication with factotum
363 githelp try mapping git commands to Mercurial commands
363 githelp try mapping git commands to Mercurial commands
364 gpg commands to sign and verify changesets
364 gpg commands to sign and verify changesets
365 hgk browse the repository in a graphical way
365 hgk browse the repository in a graphical way
366 highlight syntax highlighting for hgweb (requires Pygments)
366 highlight syntax highlighting for hgweb (requires Pygments)
367 histedit interactive history editing
367 histedit interactive history editing
368 keyword expand keywords in tracked files
368 keyword expand keywords in tracked files
369 largefiles track large binary files
369 largefiles track large binary files
370 mq manage a stack of patches
370 mq manage a stack of patches
371 notify hooks for sending email push notifications
371 notify hooks for sending email push notifications
372 patchbomb command to send changesets as (a series of) patch emails
372 patchbomb command to send changesets as (a series of) patch emails
373 purge command to delete untracked files from the working
373 purge command to delete untracked files from the working
374 directory
374 directory
375 relink recreates hardlinks between repository clones
375 relink recreates hardlinks between repository clones
376 schemes extend schemes with shortcuts to repository swarms
376 schemes extend schemes with shortcuts to repository swarms
377 share share a common history between several working directories
377 share share a common history between several working directories
378 shelve save and restore changes to the working directory
378 shelve save and restore changes to the working directory
379 strip strip changesets and their descendants from history
379 strip strip changesets and their descendants from history
380 transplant command to transplant changesets from another branch
380 transplant command to transplant changesets from another branch
381 win32mbcs allow the use of MBCS paths with problematic encodings
381 win32mbcs allow the use of MBCS paths with problematic encodings
382 zeroconf discover and advertise repositories on the local network
382 zeroconf discover and advertise repositories on the local network
383
383
384 #endif
384 #endif
385
385
386 Verify that deprecated extensions are included if --verbose:
386 Verify that deprecated extensions are included if --verbose:
387
387
388 $ hg -v help extensions | grep children
388 $ hg -v help extensions | grep children
389 children command to display child changesets (DEPRECATED)
389 children command to display child changesets (DEPRECATED)
390
390
391 Verify that extension keywords appear in help templates
391 Verify that extension keywords appear in help templates
392
392
393 $ hg help --config extensions.transplant= templating|grep transplant > /dev/null
393 $ hg help --config extensions.transplant= templating|grep transplant > /dev/null
394
394
395 Test short command list with verbose option
395 Test short command list with verbose option
396
396
397 $ hg -v help shortlist
397 $ hg -v help shortlist
398 Mercurial Distributed SCM
398 Mercurial Distributed SCM
399
399
400 basic commands:
400 basic commands:
401
401
402 add add the specified files on the next commit
402 add add the specified files on the next commit
403 annotate, blame
403 annotate, blame
404 show changeset information by line for each file
404 show changeset information by line for each file
405 clone make a copy of an existing repository
405 clone make a copy of an existing repository
406 commit, ci commit the specified files or all outstanding changes
406 commit, ci commit the specified files or all outstanding changes
407 diff diff repository (or selected files)
407 diff diff repository (or selected files)
408 export dump the header and diffs for one or more changesets
408 export dump the header and diffs for one or more changesets
409 forget forget the specified files on the next commit
409 forget forget the specified files on the next commit
410 init create a new repository in the given directory
410 init create a new repository in the given directory
411 log, history show revision history of entire repository or files
411 log, history show revision history of entire repository or files
412 merge merge another revision into working directory
412 merge merge another revision into working directory
413 pull pull changes from the specified source
413 pull pull changes from the specified source
414 push push changes to the specified destination
414 push push changes to the specified destination
415 remove, rm remove the specified files on the next commit
415 remove, rm remove the specified files on the next commit
416 serve start stand-alone webserver
416 serve start stand-alone webserver
417 status, st show changed files in the working directory
417 status, st show changed files in the working directory
418 summary, sum summarize working directory state
418 summary, sum summarize working directory state
419 update, up, checkout, co
419 update, up, checkout, co
420 update working directory (or switch revisions)
420 update working directory (or switch revisions)
421
421
422 global options ([+] can be repeated):
422 global options ([+] can be repeated):
423
423
424 -R --repository REPO repository root directory or name of overlay bundle
424 -R --repository REPO repository root directory or name of overlay bundle
425 file
425 file
426 --cwd DIR change working directory
426 --cwd DIR change working directory
427 -y --noninteractive do not prompt, automatically pick the first choice for
427 -y --noninteractive do not prompt, automatically pick the first choice for
428 all prompts
428 all prompts
429 -q --quiet suppress output
429 -q --quiet suppress output
430 -v --verbose enable additional output
430 -v --verbose enable additional output
431 --color TYPE when to colorize (boolean, always, auto, never, or
431 --color TYPE when to colorize (boolean, always, auto, never, or
432 debug)
432 debug)
433 --config CONFIG [+] set/override config option (use 'section.name=value')
433 --config CONFIG [+] set/override config option (use 'section.name=value')
434 --debug enable debugging output
434 --debug enable debugging output
435 --debugger start debugger
435 --debugger start debugger
436 --encoding ENCODE set the charset encoding (default: ascii)
436 --encoding ENCODE set the charset encoding (default: ascii)
437 --encodingmode MODE set the charset encoding mode (default: strict)
437 --encodingmode MODE set the charset encoding mode (default: strict)
438 --traceback always print a traceback on exception
438 --traceback always print a traceback on exception
439 --time time how long the command takes
439 --time time how long the command takes
440 --profile print command execution profile
440 --profile print command execution profile
441 --version output version information and exit
441 --version output version information and exit
442 -h --help display help and exit
442 -h --help display help and exit
443 --[no-]hidden consider hidden changesets (default: off)
443 --hidden consider hidden changesets (default: off)
444 --pager TYPE when to paginate (boolean, always, auto, or never)
444 --pager TYPE when to paginate (boolean, always, auto, or never)
445 (default: auto)
445 (default: auto)
446
446
447 (use 'hg help' for the full list of commands)
447 (use 'hg help' for the full list of commands)
448
448
449 $ hg add -h
449 $ hg add -h
450 hg add [OPTION]... [FILE]...
450 hg add [OPTION]... [FILE]...
451
451
452 add the specified files on the next commit
452 add the specified files on the next commit
453
453
454 Schedule files to be version controlled and added to the repository.
454 Schedule files to be version controlled and added to the repository.
455
455
456 The files will be added to the repository at the next commit. To undo an
456 The files will be added to the repository at the next commit. To undo an
457 add before that, see 'hg forget'.
457 add before that, see 'hg forget'.
458
458
459 If no names are given, add all files to the repository (except files
459 If no names are given, add all files to the repository (except files
460 matching ".hgignore").
460 matching ".hgignore").
461
461
462 Returns 0 if all files are successfully added.
462 Returns 0 if all files are successfully added.
463
463
464 options ([+] can be repeated):
464 options ([+] can be repeated):
465
465
466 -I --include PATTERN [+] include names matching the given patterns
466 -I --include PATTERN [+] include names matching the given patterns
467 -X --exclude PATTERN [+] exclude names matching the given patterns
467 -X --exclude PATTERN [+] exclude names matching the given patterns
468 -S --subrepos recurse into subrepositories
468 -S --subrepos recurse into subrepositories
469 -n --dry-run do not perform actions, just print output
469 -n --dry-run do not perform actions, just print output
470
470
471 (some details hidden, use --verbose to show complete help)
471 (some details hidden, use --verbose to show complete help)
472
472
473 Verbose help for add
473 Verbose help for add
474
474
475 $ hg add -hv
475 $ hg add -hv
476 hg add [OPTION]... [FILE]...
476 hg add [OPTION]... [FILE]...
477
477
478 add the specified files on the next commit
478 add the specified files on the next commit
479
479
480 Schedule files to be version controlled and added to the repository.
480 Schedule files to be version controlled and added to the repository.
481
481
482 The files will be added to the repository at the next commit. To undo an
482 The files will be added to the repository at the next commit. To undo an
483 add before that, see 'hg forget'.
483 add before that, see 'hg forget'.
484
484
485 If no names are given, add all files to the repository (except files
485 If no names are given, add all files to the repository (except files
486 matching ".hgignore").
486 matching ".hgignore").
487
487
488 Examples:
488 Examples:
489
489
490 - New (unknown) files are added automatically by 'hg add':
490 - New (unknown) files are added automatically by 'hg add':
491
491
492 $ ls
492 $ ls
493 foo.c
493 foo.c
494 $ hg status
494 $ hg status
495 ? foo.c
495 ? foo.c
496 $ hg add
496 $ hg add
497 adding foo.c
497 adding foo.c
498 $ hg status
498 $ hg status
499 A foo.c
499 A foo.c
500
500
501 - Specific files to be added can be specified:
501 - Specific files to be added can be specified:
502
502
503 $ ls
503 $ ls
504 bar.c foo.c
504 bar.c foo.c
505 $ hg status
505 $ hg status
506 ? bar.c
506 ? bar.c
507 ? foo.c
507 ? foo.c
508 $ hg add bar.c
508 $ hg add bar.c
509 $ hg status
509 $ hg status
510 A bar.c
510 A bar.c
511 ? foo.c
511 ? foo.c
512
512
513 Returns 0 if all files are successfully added.
513 Returns 0 if all files are successfully added.
514
514
515 options ([+] can be repeated):
515 options ([+] can be repeated):
516
516
517 -I --include PATTERN [+] include names matching the given patterns
517 -I --include PATTERN [+] include names matching the given patterns
518 -X --exclude PATTERN [+] exclude names matching the given patterns
518 -X --exclude PATTERN [+] exclude names matching the given patterns
519 -S --subrepos recurse into subrepositories
519 -S --subrepos recurse into subrepositories
520 -n --dry-run do not perform actions, just print output
520 -n --dry-run do not perform actions, just print output
521
521
522 global options ([+] can be repeated):
522 global options ([+] can be repeated):
523
523
524 -R --repository REPO repository root directory or name of overlay bundle
524 -R --repository REPO repository root directory or name of overlay bundle
525 file
525 file
526 --cwd DIR change working directory
526 --cwd DIR change working directory
527 -y --noninteractive do not prompt, automatically pick the first choice for
527 -y --noninteractive do not prompt, automatically pick the first choice for
528 all prompts
528 all prompts
529 -q --quiet suppress output
529 -q --quiet suppress output
530 -v --verbose enable additional output
530 -v --verbose enable additional output
531 --color TYPE when to colorize (boolean, always, auto, never, or
531 --color TYPE when to colorize (boolean, always, auto, never, or
532 debug)
532 debug)
533 --config CONFIG [+] set/override config option (use 'section.name=value')
533 --config CONFIG [+] set/override config option (use 'section.name=value')
534 --debug enable debugging output
534 --debug enable debugging output
535 --debugger start debugger
535 --debugger start debugger
536 --encoding ENCODE set the charset encoding (default: ascii)
536 --encoding ENCODE set the charset encoding (default: ascii)
537 --encodingmode MODE set the charset encoding mode (default: strict)
537 --encodingmode MODE set the charset encoding mode (default: strict)
538 --traceback always print a traceback on exception
538 --traceback always print a traceback on exception
539 --time time how long the command takes
539 --time time how long the command takes
540 --profile print command execution profile
540 --profile print command execution profile
541 --version output version information and exit
541 --version output version information and exit
542 -h --help display help and exit
542 -h --help display help and exit
543 --[no-]hidden consider hidden changesets (default: off)
543 --hidden consider hidden changesets (default: off)
544 --pager TYPE when to paginate (boolean, always, auto, or never)
544 --pager TYPE when to paginate (boolean, always, auto, or never)
545 (default: auto)
545 (default: auto)
546
546
547 Test the textwidth config option
547 Test the textwidth config option
548
548
549 $ hg root -h --config ui.textwidth=50
549 $ hg root -h --config ui.textwidth=50
550 hg root
550 hg root
551
551
552 print the root (top) of the current working
552 print the root (top) of the current working
553 directory
553 directory
554
554
555 Print the root directory of the current
555 Print the root directory of the current
556 repository.
556 repository.
557
557
558 Returns 0 on success.
558 Returns 0 on success.
559
559
560 (some details hidden, use --verbose to show
560 (some details hidden, use --verbose to show
561 complete help)
561 complete help)
562
562
563 Test help option with version option
563 Test help option with version option
564
564
565 $ hg add -h --version
565 $ hg add -h --version
566 Mercurial Distributed SCM (version *) (glob)
566 Mercurial Distributed SCM (version *) (glob)
567 (see https://mercurial-scm.org for more information)
567 (see https://mercurial-scm.org for more information)
568
568
569 Copyright (C) 2005-* Matt Mackall and others (glob)
569 Copyright (C) 2005-* Matt Mackall and others (glob)
570 This is free software; see the source for copying conditions. There is NO
570 This is free software; see the source for copying conditions. There is NO
571 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
571 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
572
572
573 $ hg add --skjdfks
573 $ hg add --skjdfks
574 hg add: option --skjdfks not recognized
574 hg add: option --skjdfks not recognized
575 hg add [OPTION]... [FILE]...
575 hg add [OPTION]... [FILE]...
576
576
577 add the specified files on the next commit
577 add the specified files on the next commit
578
578
579 options ([+] can be repeated):
579 options ([+] can be repeated):
580
580
581 -I --include PATTERN [+] include names matching the given patterns
581 -I --include PATTERN [+] include names matching the given patterns
582 -X --exclude PATTERN [+] exclude names matching the given patterns
582 -X --exclude PATTERN [+] exclude names matching the given patterns
583 -S --subrepos recurse into subrepositories
583 -S --subrepos recurse into subrepositories
584 -n --dry-run do not perform actions, just print output
584 -n --dry-run do not perform actions, just print output
585
585
586 (use 'hg add -h' to show more help)
586 (use 'hg add -h' to show more help)
587 [255]
587 [255]
588
588
589 Test ambiguous command help
589 Test ambiguous command help
590
590
591 $ hg help ad
591 $ hg help ad
592 list of commands:
592 list of commands:
593
593
594 add add the specified files on the next commit
594 add add the specified files on the next commit
595 addremove add all new files, delete all missing files
595 addremove add all new files, delete all missing files
596
596
597 (use 'hg help -v ad' to show built-in aliases and global options)
597 (use 'hg help -v ad' to show built-in aliases and global options)
598
598
599 Test command without options
599 Test command without options
600
600
601 $ hg help verify
601 $ hg help verify
602 hg verify
602 hg verify
603
603
604 verify the integrity of the repository
604 verify the integrity of the repository
605
605
606 Verify the integrity of the current repository.
606 Verify the integrity of the current repository.
607
607
608 This will perform an extensive check of the repository's integrity,
608 This will perform an extensive check of the repository's integrity,
609 validating the hashes and checksums of each entry in the changelog,
609 validating the hashes and checksums of each entry in the changelog,
610 manifest, and tracked files, as well as the integrity of their crosslinks
610 manifest, and tracked files, as well as the integrity of their crosslinks
611 and indices.
611 and indices.
612
612
613 Please see https://mercurial-scm.org/wiki/RepositoryCorruption for more
613 Please see https://mercurial-scm.org/wiki/RepositoryCorruption for more
614 information about recovery from corruption of the repository.
614 information about recovery from corruption of the repository.
615
615
616 Returns 0 on success, 1 if errors are encountered.
616 Returns 0 on success, 1 if errors are encountered.
617
617
618 (some details hidden, use --verbose to show complete help)
618 (some details hidden, use --verbose to show complete help)
619
619
620 $ hg help diff
620 $ hg help diff
621 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
621 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
622
622
623 diff repository (or selected files)
623 diff repository (or selected files)
624
624
625 Show differences between revisions for the specified files.
625 Show differences between revisions for the specified files.
626
626
627 Differences between files are shown using the unified diff format.
627 Differences between files are shown using the unified diff format.
628
628
629 Note:
629 Note:
630 'hg diff' may generate unexpected results for merges, as it will
630 'hg diff' may generate unexpected results for merges, as it will
631 default to comparing against the working directory's first parent
631 default to comparing against the working directory's first parent
632 changeset if no revisions are specified.
632 changeset if no revisions are specified.
633
633
634 When two revision arguments are given, then changes are shown between
634 When two revision arguments are given, then changes are shown between
635 those revisions. If only one revision is specified then that revision is
635 those revisions. If only one revision is specified then that revision is
636 compared to the working directory, and, when no revisions are specified,
636 compared to the working directory, and, when no revisions are specified,
637 the working directory files are compared to its first parent.
637 the working directory files are compared to its first parent.
638
638
639 Alternatively you can specify -c/--change with a revision to see the
639 Alternatively you can specify -c/--change with a revision to see the
640 changes in that changeset relative to its first parent.
640 changes in that changeset relative to its first parent.
641
641
642 Without the -a/--text option, diff will avoid generating diffs of files it
642 Without the -a/--text option, diff will avoid generating diffs of files it
643 detects as binary. With -a, diff will generate a diff anyway, probably
643 detects as binary. With -a, diff will generate a diff anyway, probably
644 with undesirable results.
644 with undesirable results.
645
645
646 Use the -g/--git option to generate diffs in the git extended diff format.
646 Use the -g/--git option to generate diffs in the git extended diff format.
647 For more information, read 'hg help diffs'.
647 For more information, read 'hg help diffs'.
648
648
649 Returns 0 on success.
649 Returns 0 on success.
650
650
651 options ([+] can be repeated):
651 options ([+] can be repeated):
652
652
653 -r --rev REV [+] revision
653 -r --rev REV [+] revision
654 -c --change REV change made by revision
654 -c --change REV change made by revision
655 -a --text treat all files as text
655 -a --text treat all files as text
656 -g --git use git extended diff format
656 -g --git use git extended diff format
657 --binary generate binary diffs in git mode (default)
657 --binary generate binary diffs in git mode (default)
658 --nodates omit dates from diff headers
658 --nodates omit dates from diff headers
659 --noprefix omit a/ and b/ prefixes from filenames
659 --noprefix omit a/ and b/ prefixes from filenames
660 -p --show-function show which function each change is in
660 -p --show-function show which function each change is in
661 --reverse produce a diff that undoes the changes
661 --reverse produce a diff that undoes the changes
662 -w --ignore-all-space ignore white space when comparing lines
662 -w --ignore-all-space ignore white space when comparing lines
663 -b --ignore-space-change ignore changes in the amount of white space
663 -b --ignore-space-change ignore changes in the amount of white space
664 -B --ignore-blank-lines ignore changes whose lines are all blank
664 -B --ignore-blank-lines ignore changes whose lines are all blank
665 -Z --ignore-space-at-eol ignore changes in whitespace at EOL
665 -Z --ignore-space-at-eol ignore changes in whitespace at EOL
666 -U --unified NUM number of lines of context to show
666 -U --unified NUM number of lines of context to show
667 --stat output diffstat-style summary of changes
667 --stat output diffstat-style summary of changes
668 --root DIR produce diffs relative to subdirectory
668 --root DIR produce diffs relative to subdirectory
669 -I --include PATTERN [+] include names matching the given patterns
669 -I --include PATTERN [+] include names matching the given patterns
670 -X --exclude PATTERN [+] exclude names matching the given patterns
670 -X --exclude PATTERN [+] exclude names matching the given patterns
671 -S --subrepos recurse into subrepositories
671 -S --subrepos recurse into subrepositories
672
672
673 (some details hidden, use --verbose to show complete help)
673 (some details hidden, use --verbose to show complete help)
674
674
675 $ hg help status
675 $ hg help status
676 hg status [OPTION]... [FILE]...
676 hg status [OPTION]... [FILE]...
677
677
678 aliases: st
678 aliases: st
679
679
680 show changed files in the working directory
680 show changed files in the working directory
681
681
682 Show status of files in the repository. If names are given, only files
682 Show status of files in the repository. If names are given, only files
683 that match are shown. Files that are clean or ignored or the source of a
683 that match are shown. Files that are clean or ignored or the source of a
684 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
684 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
685 -C/--copies or -A/--all are given. Unless options described with "show
685 -C/--copies or -A/--all are given. Unless options described with "show
686 only ..." are given, the options -mardu are used.
686 only ..." are given, the options -mardu are used.
687
687
688 Option -q/--quiet hides untracked (unknown and ignored) files unless
688 Option -q/--quiet hides untracked (unknown and ignored) files unless
689 explicitly requested with -u/--unknown or -i/--ignored.
689 explicitly requested with -u/--unknown or -i/--ignored.
690
690
691 Note:
691 Note:
692 'hg status' may appear to disagree with diff if permissions have
692 'hg status' may appear to disagree with diff if permissions have
693 changed or a merge has occurred. The standard diff format does not
693 changed or a merge has occurred. The standard diff format does not
694 report permission changes and diff only reports changes relative to one
694 report permission changes and diff only reports changes relative to one
695 merge parent.
695 merge parent.
696
696
697 If one revision is given, it is used as the base revision. If two
697 If one revision is given, it is used as the base revision. If two
698 revisions are given, the differences between them are shown. The --change
698 revisions are given, the differences between them are shown. The --change
699 option can also be used as a shortcut to list the changed files of a
699 option can also be used as a shortcut to list the changed files of a
700 revision from its first parent.
700 revision from its first parent.
701
701
702 The codes used to show the status of files are:
702 The codes used to show the status of files are:
703
703
704 M = modified
704 M = modified
705 A = added
705 A = added
706 R = removed
706 R = removed
707 C = clean
707 C = clean
708 ! = missing (deleted by non-hg command, but still tracked)
708 ! = missing (deleted by non-hg command, but still tracked)
709 ? = not tracked
709 ? = not tracked
710 I = ignored
710 I = ignored
711 = origin of the previous file (with --copies)
711 = origin of the previous file (with --copies)
712
712
713 Returns 0 on success.
713 Returns 0 on success.
714
714
715 options ([+] can be repeated):
715 options ([+] can be repeated):
716
716
717 -A --all show status of all files
717 -A --all show status of all files
718 -m --modified show only modified files
718 -m --modified show only modified files
719 -a --added show only added files
719 -a --added show only added files
720 -r --removed show only removed files
720 -r --removed show only removed files
721 -d --deleted show only deleted (but tracked) files
721 -d --deleted show only deleted (but tracked) files
722 -c --clean show only files without changes
722 -c --clean show only files without changes
723 -u --unknown show only unknown (not tracked) files
723 -u --unknown show only unknown (not tracked) files
724 -i --ignored show only ignored files
724 -i --ignored show only ignored files
725 -n --no-status hide status prefix
725 -n --no-status hide status prefix
726 -C --copies show source of copied files
726 -C --copies show source of copied files
727 -0 --print0 end filenames with NUL, for use with xargs
727 -0 --print0 end filenames with NUL, for use with xargs
728 --rev REV [+] show difference from revision
728 --rev REV [+] show difference from revision
729 --change REV list the changed files of a revision
729 --change REV list the changed files of a revision
730 -I --include PATTERN [+] include names matching the given patterns
730 -I --include PATTERN [+] include names matching the given patterns
731 -X --exclude PATTERN [+] exclude names matching the given patterns
731 -X --exclude PATTERN [+] exclude names matching the given patterns
732 -S --subrepos recurse into subrepositories
732 -S --subrepos recurse into subrepositories
733 -T --template TEMPLATE display with template
733 -T --template TEMPLATE display with template
734
734
735 (some details hidden, use --verbose to show complete help)
735 (some details hidden, use --verbose to show complete help)
736
736
737 $ hg -q help status
737 $ hg -q help status
738 hg status [OPTION]... [FILE]...
738 hg status [OPTION]... [FILE]...
739
739
740 show changed files in the working directory
740 show changed files in the working directory
741
741
742 $ hg help foo
742 $ hg help foo
743 abort: no such help topic: foo
743 abort: no such help topic: foo
744 (try 'hg help --keyword foo')
744 (try 'hg help --keyword foo')
745 [255]
745 [255]
746
746
747 $ hg skjdfks
747 $ hg skjdfks
748 hg: unknown command 'skjdfks'
748 hg: unknown command 'skjdfks'
749 (use 'hg help' for a list of commands)
749 (use 'hg help' for a list of commands)
750 [255]
750 [255]
751
751
752 Typoed command gives suggestion
752 Typoed command gives suggestion
753 $ hg puls
753 $ hg puls
754 hg: unknown command 'puls'
754 hg: unknown command 'puls'
755 (did you mean one of pull, push?)
755 (did you mean one of pull, push?)
756 [255]
756 [255]
757
757
758 Not enabled extension gets suggested
758 Not enabled extension gets suggested
759
759
760 $ hg rebase
760 $ hg rebase
761 hg: unknown command 'rebase'
761 hg: unknown command 'rebase'
762 'rebase' is provided by the following extension:
762 'rebase' is provided by the following extension:
763
763
764 rebase command to move sets of revisions to a different ancestor
764 rebase command to move sets of revisions to a different ancestor
765
765
766 (use 'hg help extensions' for information on enabling extensions)
766 (use 'hg help extensions' for information on enabling extensions)
767 [255]
767 [255]
768
768
769 Disabled extension gets suggested
769 Disabled extension gets suggested
770 $ hg --config extensions.rebase=! rebase
770 $ hg --config extensions.rebase=! rebase
771 hg: unknown command 'rebase'
771 hg: unknown command 'rebase'
772 'rebase' is provided by the following extension:
772 'rebase' is provided by the following extension:
773
773
774 rebase command to move sets of revisions to a different ancestor
774 rebase command to move sets of revisions to a different ancestor
775
775
776 (use 'hg help extensions' for information on enabling extensions)
776 (use 'hg help extensions' for information on enabling extensions)
777 [255]
777 [255]
778
778
779 Make sure that we don't run afoul of the help system thinking that
779 Make sure that we don't run afoul of the help system thinking that
780 this is a section and erroring out weirdly.
780 this is a section and erroring out weirdly.
781
781
782 $ hg .log
782 $ hg .log
783 hg: unknown command '.log'
783 hg: unknown command '.log'
784 (did you mean log?)
784 (did you mean log?)
785 [255]
785 [255]
786
786
787 $ hg log.
787 $ hg log.
788 hg: unknown command 'log.'
788 hg: unknown command 'log.'
789 (did you mean log?)
789 (did you mean log?)
790 [255]
790 [255]
791 $ hg pu.lh
791 $ hg pu.lh
792 hg: unknown command 'pu.lh'
792 hg: unknown command 'pu.lh'
793 (did you mean one of pull, push?)
793 (did you mean one of pull, push?)
794 [255]
794 [255]
795
795
796 $ cat > helpext.py <<EOF
796 $ cat > helpext.py <<EOF
797 > import os
797 > import os
798 > from mercurial import commands, fancyopts, registrar
798 > from mercurial import commands, fancyopts, registrar
799 >
799 >
800 > def func(arg):
800 > def func(arg):
801 > return '%sfoo' % arg
801 > return '%sfoo' % arg
802 > class customopt(fancyopts.customopt):
802 > class customopt(fancyopts.customopt):
803 > def newstate(self, oldstate, newparam, abort):
803 > def newstate(self, oldstate, newparam, abort):
804 > return '%sbar' % oldstate
804 > return '%sbar' % oldstate
805 > cmdtable = {}
805 > cmdtable = {}
806 > command = registrar.command(cmdtable)
806 > command = registrar.command(cmdtable)
807 >
807 >
808 > @command(b'nohelp',
808 > @command(b'nohelp',
809 > [(b'', b'longdesc', 3, b'x'*67),
809 > [(b'', b'longdesc', 3, b'x'*67),
810 > (b'n', b'', None, b'normal desc'),
810 > (b'n', b'', None, b'normal desc'),
811 > (b'', b'newline', b'', b'line1\nline2'),
811 > (b'', b'newline', b'', b'line1\nline2'),
812 > (b'', b'default-off', False, b'enable X'),
812 > (b'', b'default-off', False, b'enable X'),
813 > (b'', b'default-on', True, b'enable Y'),
813 > (b'', b'default-on', True, b'enable Y'),
814 > (b'', b'callableopt', func, b'adds foo'),
814 > (b'', b'callableopt', func, b'adds foo'),
815 > (b'', b'customopt', customopt(''), b'adds bar'),
815 > (b'', b'customopt', customopt(''), b'adds bar'),
816 > (b'', b'customopt-withdefault', customopt('foo'), b'adds bar')],
816 > (b'', b'customopt-withdefault', customopt('foo'), b'adds bar')],
817 > b'hg nohelp',
817 > b'hg nohelp',
818 > norepo=True)
818 > norepo=True)
819 > @command(b'debugoptADV', [(b'', b'aopt', None, b'option is (ADVANCED)')])
819 > @command(b'debugoptADV', [(b'', b'aopt', None, b'option is (ADVANCED)')])
820 > @command(b'debugoptDEP', [(b'', b'dopt', None, b'option is (DEPRECATED)')])
820 > @command(b'debugoptDEP', [(b'', b'dopt', None, b'option is (DEPRECATED)')])
821 > @command(b'debugoptEXP', [(b'', b'eopt', None, b'option is (EXPERIMENTAL)')])
821 > @command(b'debugoptEXP', [(b'', b'eopt', None, b'option is (EXPERIMENTAL)')])
822 > def nohelp(ui, *args, **kwargs):
822 > def nohelp(ui, *args, **kwargs):
823 > pass
823 > pass
824 >
824 >
825 > @command(b'hashelp', [], b'hg hashelp', norepo=True)
825 > @command(b'hashelp', [], b'hg hashelp', norepo=True)
826 > def hashelp(ui, *args, **kwargs):
826 > def hashelp(ui, *args, **kwargs):
827 > """Extension command's help"""
827 > """Extension command's help"""
828 > pass
828 > pass
829 >
829 >
830 > def uisetup(ui):
830 > def uisetup(ui):
831 > ui.setconfig(b'alias', b'shellalias', b'!echo hi', b'helpext')
831 > ui.setconfig(b'alias', b'shellalias', b'!echo hi', b'helpext')
832 > ui.setconfig(b'alias', b'hgalias', b'summary', b'helpext')
832 > ui.setconfig(b'alias', b'hgalias', b'summary', b'helpext')
833 > ui.setconfig(b'alias', b'hgalias:doc', b'My doc', b'helpext')
833 > ui.setconfig(b'alias', b'hgalias:doc', b'My doc', b'helpext')
834 > ui.setconfig(b'alias', b'hgalias:category', b'navigation', b'helpext')
834 > ui.setconfig(b'alias', b'hgalias:category', b'navigation', b'helpext')
835 > ui.setconfig(b'alias', b'hgaliasnodoc', b'summary', b'helpext')
835 > ui.setconfig(b'alias', b'hgaliasnodoc', b'summary', b'helpext')
836 >
836 >
837 > EOF
837 > EOF
838 $ echo '[extensions]' >> $HGRCPATH
838 $ echo '[extensions]' >> $HGRCPATH
839 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
839 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
840
840
841 Test for aliases
841 Test for aliases
842
842
843 $ hg help | grep hgalias
843 $ hg help | grep hgalias
844 hgalias My doc
844 hgalias My doc
845
845
846 $ hg help hgalias
846 $ hg help hgalias
847 hg hgalias [--remote]
847 hg hgalias [--remote]
848
848
849 alias for: hg summary
849 alias for: hg summary
850
850
851 My doc
851 My doc
852
852
853 defined by: helpext
853 defined by: helpext
854
854
855 options:
855 options:
856
856
857 --remote check for push and pull
857 --remote check for push and pull
858
858
859 (some details hidden, use --verbose to show complete help)
859 (some details hidden, use --verbose to show complete help)
860 $ hg help hgaliasnodoc
860 $ hg help hgaliasnodoc
861 hg hgaliasnodoc [--remote]
861 hg hgaliasnodoc [--remote]
862
862
863 alias for: hg summary
863 alias for: hg summary
864
864
865 summarize working directory state
865 summarize working directory state
866
866
867 This generates a brief summary of the working directory state, including
867 This generates a brief summary of the working directory state, including
868 parents, branch, commit status, phase and available updates.
868 parents, branch, commit status, phase and available updates.
869
869
870 With the --remote option, this will check the default paths for incoming
870 With the --remote option, this will check the default paths for incoming
871 and outgoing changes. This can be time-consuming.
871 and outgoing changes. This can be time-consuming.
872
872
873 Returns 0 on success.
873 Returns 0 on success.
874
874
875 defined by: helpext
875 defined by: helpext
876
876
877 options:
877 options:
878
878
879 --remote check for push and pull
879 --remote check for push and pull
880
880
881 (some details hidden, use --verbose to show complete help)
881 (some details hidden, use --verbose to show complete help)
882
882
883 $ hg help shellalias
883 $ hg help shellalias
884 hg shellalias
884 hg shellalias
885
885
886 shell alias for: echo hi
886 shell alias for: echo hi
887
887
888 (no help text available)
888 (no help text available)
889
889
890 defined by: helpext
890 defined by: helpext
891
891
892 (some details hidden, use --verbose to show complete help)
892 (some details hidden, use --verbose to show complete help)
893
893
894 Test command with no help text
894 Test command with no help text
895
895
896 $ hg help nohelp
896 $ hg help nohelp
897 hg nohelp
897 hg nohelp
898
898
899 (no help text available)
899 (no help text available)
900
900
901 options:
901 options:
902
902
903 --longdesc VALUE
903 --longdesc VALUE
904 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
904 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
905 xxxxxxxxxxxxxxxxxxxxxxx (default: 3)
905 xxxxxxxxxxxxxxxxxxxxxxx (default: 3)
906 -n -- normal desc
906 -n -- normal desc
907 --newline VALUE line1 line2
907 --newline VALUE line1 line2
908 --[no-]default-off enable X (default: off)
908 --default-off enable X (default: off)
909 --[no-]default-on enable Y (default: on)
909 --[no-]default-on enable Y (default: on)
910 --callableopt VALUE adds foo
910 --callableopt VALUE adds foo
911 --customopt VALUE adds bar
911 --customopt VALUE adds bar
912 --customopt-withdefault VALUE adds bar (default: foo)
912 --customopt-withdefault VALUE adds bar (default: foo)
913
913
914 (some details hidden, use --verbose to show complete help)
914 (some details hidden, use --verbose to show complete help)
915
915
916 Test that default list of commands includes extension commands that have help,
916 Test that default list of commands includes extension commands that have help,
917 but not those that don't, except in verbose mode, when a keyword is passed, or
917 but not those that don't, except in verbose mode, when a keyword is passed, or
918 when help about the extension is requested.
918 when help about the extension is requested.
919
919
920 #if no-extraextensions
920 #if no-extraextensions
921
921
922 $ hg help | grep hashelp
922 $ hg help | grep hashelp
923 hashelp Extension command's help
923 hashelp Extension command's help
924 $ hg help | grep nohelp
924 $ hg help | grep nohelp
925 [1]
925 [1]
926 $ hg help -v | grep nohelp
926 $ hg help -v | grep nohelp
927 nohelp (no help text available)
927 nohelp (no help text available)
928
928
929 $ hg help -k nohelp
929 $ hg help -k nohelp
930 Commands:
930 Commands:
931
931
932 nohelp hg nohelp
932 nohelp hg nohelp
933
933
934 Extension Commands:
934 Extension Commands:
935
935
936 nohelp (no help text available)
936 nohelp (no help text available)
937
937
938 $ hg help helpext
938 $ hg help helpext
939 helpext extension - no help text available
939 helpext extension - no help text available
940
940
941 list of commands:
941 list of commands:
942
942
943 hashelp Extension command's help
943 hashelp Extension command's help
944 nohelp (no help text available)
944 nohelp (no help text available)
945
945
946 (use 'hg help -v helpext' to show built-in aliases and global options)
946 (use 'hg help -v helpext' to show built-in aliases and global options)
947
947
948 #endif
948 #endif
949
949
950 Test list of internal help commands
950 Test list of internal help commands
951
951
952 $ hg help debug
952 $ hg help debug
953 debug commands (internal and unsupported):
953 debug commands (internal and unsupported):
954
954
955 debugancestor
955 debugancestor
956 find the ancestor revision of two revisions in a given index
956 find the ancestor revision of two revisions in a given index
957 debugapplystreamclonebundle
957 debugapplystreamclonebundle
958 apply a stream clone bundle file
958 apply a stream clone bundle file
959 debugbuilddag
959 debugbuilddag
960 builds a repo with a given DAG from scratch in the current
960 builds a repo with a given DAG from scratch in the current
961 empty repo
961 empty repo
962 debugbundle lists the contents of a bundle
962 debugbundle lists the contents of a bundle
963 debugcapabilities
963 debugcapabilities
964 lists the capabilities of a remote peer
964 lists the capabilities of a remote peer
965 debugcheckstate
965 debugcheckstate
966 validate the correctness of the current dirstate
966 validate the correctness of the current dirstate
967 debugcolor show available color, effects or style
967 debugcolor show available color, effects or style
968 debugcommands
968 debugcommands
969 list all available commands and options
969 list all available commands and options
970 debugcomplete
970 debugcomplete
971 returns the completion list associated with the given command
971 returns the completion list associated with the given command
972 debugcreatestreamclonebundle
972 debugcreatestreamclonebundle
973 create a stream clone bundle file
973 create a stream clone bundle file
974 debugdag format the changelog or an index DAG as a concise textual
974 debugdag format the changelog or an index DAG as a concise textual
975 description
975 description
976 debugdata dump the contents of a data file revision
976 debugdata dump the contents of a data file revision
977 debugdate parse and display a date
977 debugdate parse and display a date
978 debugdeltachain
978 debugdeltachain
979 dump information about delta chains in a revlog
979 dump information about delta chains in a revlog
980 debugdirstate
980 debugdirstate
981 show the contents of the current dirstate
981 show the contents of the current dirstate
982 debugdiscovery
982 debugdiscovery
983 runs the changeset discovery protocol in isolation
983 runs the changeset discovery protocol in isolation
984 debugdownload
984 debugdownload
985 download a resource using Mercurial logic and config
985 download a resource using Mercurial logic and config
986 debugextensions
986 debugextensions
987 show information about active extensions
987 show information about active extensions
988 debugfileset parse and apply a fileset specification
988 debugfileset parse and apply a fileset specification
989 debugformat display format information about the current repository
989 debugformat display format information about the current repository
990 debugfsinfo show information detected about current filesystem
990 debugfsinfo show information detected about current filesystem
991 debuggetbundle
991 debuggetbundle
992 retrieves a bundle from a repo
992 retrieves a bundle from a repo
993 debugignore display the combined ignore pattern and information about
993 debugignore display the combined ignore pattern and information about
994 ignored files
994 ignored files
995 debugindex dump index data for a storage primitive
995 debugindex dump index data for a storage primitive
996 debugindexdot
996 debugindexdot
997 dump an index DAG as a graphviz dot file
997 dump an index DAG as a graphviz dot file
998 debugindexstats
998 debugindexstats
999 show stats related to the changelog index
999 show stats related to the changelog index
1000 debuginstall test Mercurial installation
1000 debuginstall test Mercurial installation
1001 debugknown test whether node ids are known to a repo
1001 debugknown test whether node ids are known to a repo
1002 debuglocks show or modify state of locks
1002 debuglocks show or modify state of locks
1003 debugmanifestfulltextcache
1003 debugmanifestfulltextcache
1004 show, clear or amend the contents of the manifest fulltext
1004 show, clear or amend the contents of the manifest fulltext
1005 cache
1005 cache
1006 debugmergestate
1006 debugmergestate
1007 print merge state
1007 print merge state
1008 debugnamecomplete
1008 debugnamecomplete
1009 complete "names" - tags, open branch names, bookmark names
1009 complete "names" - tags, open branch names, bookmark names
1010 debugobsolete
1010 debugobsolete
1011 create arbitrary obsolete marker
1011 create arbitrary obsolete marker
1012 debugoptADV (no help text available)
1012 debugoptADV (no help text available)
1013 debugoptDEP (no help text available)
1013 debugoptDEP (no help text available)
1014 debugoptEXP (no help text available)
1014 debugoptEXP (no help text available)
1015 debugpathcomplete
1015 debugpathcomplete
1016 complete part or all of a tracked path
1016 complete part or all of a tracked path
1017 debugpeer establish a connection to a peer repository
1017 debugpeer establish a connection to a peer repository
1018 debugpickmergetool
1018 debugpickmergetool
1019 examine which merge tool is chosen for specified file
1019 examine which merge tool is chosen for specified file
1020 debugpushkey access the pushkey key/value protocol
1020 debugpushkey access the pushkey key/value protocol
1021 debugpvec (no help text available)
1021 debugpvec (no help text available)
1022 debugrebuilddirstate
1022 debugrebuilddirstate
1023 rebuild the dirstate as it would look like for the given
1023 rebuild the dirstate as it would look like for the given
1024 revision
1024 revision
1025 debugrebuildfncache
1025 debugrebuildfncache
1026 rebuild the fncache file
1026 rebuild the fncache file
1027 debugrename dump rename information
1027 debugrename dump rename information
1028 debugrevlog show data and statistics about a revlog
1028 debugrevlog show data and statistics about a revlog
1029 debugrevlogindex
1029 debugrevlogindex
1030 dump the contents of a revlog index
1030 dump the contents of a revlog index
1031 debugrevspec parse and apply a revision specification
1031 debugrevspec parse and apply a revision specification
1032 debugserve run a server with advanced settings
1032 debugserve run a server with advanced settings
1033 debugsetparents
1033 debugsetparents
1034 manually set the parents of the current working directory
1034 manually set the parents of the current working directory
1035 debugssl test a secure connection to a server
1035 debugssl test a secure connection to a server
1036 debugsub (no help text available)
1036 debugsub (no help text available)
1037 debugsuccessorssets
1037 debugsuccessorssets
1038 show set of successors for revision
1038 show set of successors for revision
1039 debugtemplate
1039 debugtemplate
1040 parse and apply a template
1040 parse and apply a template
1041 debuguigetpass
1041 debuguigetpass
1042 show prompt to type password
1042 show prompt to type password
1043 debuguiprompt
1043 debuguiprompt
1044 show plain prompt
1044 show plain prompt
1045 debugupdatecaches
1045 debugupdatecaches
1046 warm all known caches in the repository
1046 warm all known caches in the repository
1047 debugupgraderepo
1047 debugupgraderepo
1048 upgrade a repository to use different features
1048 upgrade a repository to use different features
1049 debugwalk show how files match on given patterns
1049 debugwalk show how files match on given patterns
1050 debugwhyunstable
1050 debugwhyunstable
1051 explain instabilities of a changeset
1051 explain instabilities of a changeset
1052 debugwireargs
1052 debugwireargs
1053 (no help text available)
1053 (no help text available)
1054 debugwireproto
1054 debugwireproto
1055 send wire protocol commands to a server
1055 send wire protocol commands to a server
1056
1056
1057 (use 'hg help -v debug' to show built-in aliases and global options)
1057 (use 'hg help -v debug' to show built-in aliases and global options)
1058
1058
1059 internals topic renders index of available sub-topics
1059 internals topic renders index of available sub-topics
1060
1060
1061 $ hg help internals
1061 $ hg help internals
1062 Technical implementation topics
1062 Technical implementation topics
1063 """""""""""""""""""""""""""""""
1063 """""""""""""""""""""""""""""""
1064
1064
1065 To access a subtopic, use "hg help internals.{subtopic-name}"
1065 To access a subtopic, use "hg help internals.{subtopic-name}"
1066
1066
1067 bundle2 Bundle2
1067 bundle2 Bundle2
1068 bundles Bundles
1068 bundles Bundles
1069 cbor CBOR
1069 cbor CBOR
1070 censor Censor
1070 censor Censor
1071 changegroups Changegroups
1071 changegroups Changegroups
1072 config Config Registrar
1072 config Config Registrar
1073 extensions Extension API
1073 extensions Extension API
1074 requirements Repository Requirements
1074 requirements Repository Requirements
1075 revlogs Revision Logs
1075 revlogs Revision Logs
1076 wireprotocol Wire Protocol
1076 wireprotocol Wire Protocol
1077 wireprotocolrpc
1077 wireprotocolrpc
1078 Wire Protocol RPC
1078 Wire Protocol RPC
1079 wireprotocolv2
1079 wireprotocolv2
1080 Wire Protocol Version 2
1080 Wire Protocol Version 2
1081
1081
1082 sub-topics can be accessed
1082 sub-topics can be accessed
1083
1083
1084 $ hg help internals.changegroups
1084 $ hg help internals.changegroups
1085 Changegroups
1085 Changegroups
1086 """"""""""""
1086 """"""""""""
1087
1087
1088 Changegroups are representations of repository revlog data, specifically
1088 Changegroups are representations of repository revlog data, specifically
1089 the changelog data, root/flat manifest data, treemanifest data, and
1089 the changelog data, root/flat manifest data, treemanifest data, and
1090 filelogs.
1090 filelogs.
1091
1091
1092 There are 3 versions of changegroups: "1", "2", and "3". From a high-
1092 There are 3 versions of changegroups: "1", "2", and "3". From a high-
1093 level, versions "1" and "2" are almost exactly the same, with the only
1093 level, versions "1" and "2" are almost exactly the same, with the only
1094 difference being an additional item in the *delta header*. Version "3"
1094 difference being an additional item in the *delta header*. Version "3"
1095 adds support for storage flags in the *delta header* and optionally
1095 adds support for storage flags in the *delta header* and optionally
1096 exchanging treemanifests (enabled by setting an option on the
1096 exchanging treemanifests (enabled by setting an option on the
1097 "changegroup" part in the bundle2).
1097 "changegroup" part in the bundle2).
1098
1098
1099 Changegroups when not exchanging treemanifests consist of 3 logical
1099 Changegroups when not exchanging treemanifests consist of 3 logical
1100 segments:
1100 segments:
1101
1101
1102 +---------------------------------+
1102 +---------------------------------+
1103 | | | |
1103 | | | |
1104 | changeset | manifest | filelogs |
1104 | changeset | manifest | filelogs |
1105 | | | |
1105 | | | |
1106 | | | |
1106 | | | |
1107 +---------------------------------+
1107 +---------------------------------+
1108
1108
1109 When exchanging treemanifests, there are 4 logical segments:
1109 When exchanging treemanifests, there are 4 logical segments:
1110
1110
1111 +-------------------------------------------------+
1111 +-------------------------------------------------+
1112 | | | | |
1112 | | | | |
1113 | changeset | root | treemanifests | filelogs |
1113 | changeset | root | treemanifests | filelogs |
1114 | | manifest | | |
1114 | | manifest | | |
1115 | | | | |
1115 | | | | |
1116 +-------------------------------------------------+
1116 +-------------------------------------------------+
1117
1117
1118 The principle building block of each segment is a *chunk*. A *chunk* is a
1118 The principle building block of each segment is a *chunk*. A *chunk* is a
1119 framed piece of data:
1119 framed piece of data:
1120
1120
1121 +---------------------------------------+
1121 +---------------------------------------+
1122 | | |
1122 | | |
1123 | length | data |
1123 | length | data |
1124 | (4 bytes) | (<length - 4> bytes) |
1124 | (4 bytes) | (<length - 4> bytes) |
1125 | | |
1125 | | |
1126 +---------------------------------------+
1126 +---------------------------------------+
1127
1127
1128 All integers are big-endian signed integers. Each chunk starts with a
1128 All integers are big-endian signed integers. Each chunk starts with a
1129 32-bit integer indicating the length of the entire chunk (including the
1129 32-bit integer indicating the length of the entire chunk (including the
1130 length field itself).
1130 length field itself).
1131
1131
1132 There is a special case chunk that has a value of 0 for the length
1132 There is a special case chunk that has a value of 0 for the length
1133 ("0x00000000"). We call this an *empty chunk*.
1133 ("0x00000000"). We call this an *empty chunk*.
1134
1134
1135 Delta Groups
1135 Delta Groups
1136 ============
1136 ============
1137
1137
1138 A *delta group* expresses the content of a revlog as a series of deltas,
1138 A *delta group* expresses the content of a revlog as a series of deltas,
1139 or patches against previous revisions.
1139 or patches against previous revisions.
1140
1140
1141 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
1141 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
1142 to signal the end of the delta group:
1142 to signal the end of the delta group:
1143
1143
1144 +------------------------------------------------------------------------+
1144 +------------------------------------------------------------------------+
1145 | | | | | |
1145 | | | | | |
1146 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
1146 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
1147 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
1147 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
1148 | | | | | |
1148 | | | | | |
1149 +------------------------------------------------------------------------+
1149 +------------------------------------------------------------------------+
1150
1150
1151 Each *chunk*'s data consists of the following:
1151 Each *chunk*'s data consists of the following:
1152
1152
1153 +---------------------------------------+
1153 +---------------------------------------+
1154 | | |
1154 | | |
1155 | delta header | delta data |
1155 | delta header | delta data |
1156 | (various by version) | (various) |
1156 | (various by version) | (various) |
1157 | | |
1157 | | |
1158 +---------------------------------------+
1158 +---------------------------------------+
1159
1159
1160 The *delta data* is a series of *delta*s that describe a diff from an
1160 The *delta data* is a series of *delta*s that describe a diff from an
1161 existing entry (either that the recipient already has, or previously
1161 existing entry (either that the recipient already has, or previously
1162 specified in the bundle/changegroup).
1162 specified in the bundle/changegroup).
1163
1163
1164 The *delta header* is different between versions "1", "2", and "3" of the
1164 The *delta header* is different between versions "1", "2", and "3" of the
1165 changegroup format.
1165 changegroup format.
1166
1166
1167 Version 1 (headerlen=80):
1167 Version 1 (headerlen=80):
1168
1168
1169 +------------------------------------------------------+
1169 +------------------------------------------------------+
1170 | | | | |
1170 | | | | |
1171 | node | p1 node | p2 node | link node |
1171 | node | p1 node | p2 node | link node |
1172 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1172 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1173 | | | | |
1173 | | | | |
1174 +------------------------------------------------------+
1174 +------------------------------------------------------+
1175
1175
1176 Version 2 (headerlen=100):
1176 Version 2 (headerlen=100):
1177
1177
1178 +------------------------------------------------------------------+
1178 +------------------------------------------------------------------+
1179 | | | | | |
1179 | | | | | |
1180 | node | p1 node | p2 node | base node | link node |
1180 | node | p1 node | p2 node | base node | link node |
1181 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1181 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1182 | | | | | |
1182 | | | | | |
1183 +------------------------------------------------------------------+
1183 +------------------------------------------------------------------+
1184
1184
1185 Version 3 (headerlen=102):
1185 Version 3 (headerlen=102):
1186
1186
1187 +------------------------------------------------------------------------------+
1187 +------------------------------------------------------------------------------+
1188 | | | | | | |
1188 | | | | | | |
1189 | node | p1 node | p2 node | base node | link node | flags |
1189 | node | p1 node | p2 node | base node | link node | flags |
1190 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
1190 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
1191 | | | | | | |
1191 | | | | | | |
1192 +------------------------------------------------------------------------------+
1192 +------------------------------------------------------------------------------+
1193
1193
1194 The *delta data* consists of "chunklen - 4 - headerlen" bytes, which
1194 The *delta data* consists of "chunklen - 4 - headerlen" bytes, which
1195 contain a series of *delta*s, densely packed (no separators). These deltas
1195 contain a series of *delta*s, densely packed (no separators). These deltas
1196 describe a diff from an existing entry (either that the recipient already
1196 describe a diff from an existing entry (either that the recipient already
1197 has, or previously specified in the bundle/changegroup). The format is
1197 has, or previously specified in the bundle/changegroup). The format is
1198 described more fully in "hg help internals.bdiff", but briefly:
1198 described more fully in "hg help internals.bdiff", but briefly:
1199
1199
1200 +---------------------------------------------------------------+
1200 +---------------------------------------------------------------+
1201 | | | | |
1201 | | | | |
1202 | start offset | end offset | new length | content |
1202 | start offset | end offset | new length | content |
1203 | (4 bytes) | (4 bytes) | (4 bytes) | (<new length> bytes) |
1203 | (4 bytes) | (4 bytes) | (4 bytes) | (<new length> bytes) |
1204 | | | | |
1204 | | | | |
1205 +---------------------------------------------------------------+
1205 +---------------------------------------------------------------+
1206
1206
1207 Please note that the length field in the delta data does *not* include
1207 Please note that the length field in the delta data does *not* include
1208 itself.
1208 itself.
1209
1209
1210 In version 1, the delta is always applied against the previous node from
1210 In version 1, the delta is always applied against the previous node from
1211 the changegroup or the first parent if this is the first entry in the
1211 the changegroup or the first parent if this is the first entry in the
1212 changegroup.
1212 changegroup.
1213
1213
1214 In version 2 and up, the delta base node is encoded in the entry in the
1214 In version 2 and up, the delta base node is encoded in the entry in the
1215 changegroup. This allows the delta to be expressed against any parent,
1215 changegroup. This allows the delta to be expressed against any parent,
1216 which can result in smaller deltas and more efficient encoding of data.
1216 which can result in smaller deltas and more efficient encoding of data.
1217
1217
1218 The *flags* field holds bitwise flags affecting the processing of revision
1218 The *flags* field holds bitwise flags affecting the processing of revision
1219 data. The following flags are defined:
1219 data. The following flags are defined:
1220
1220
1221 32768
1221 32768
1222 Censored revision. The revision's fulltext has been replaced by censor
1222 Censored revision. The revision's fulltext has been replaced by censor
1223 metadata. May only occur on file revisions.
1223 metadata. May only occur on file revisions.
1224
1224
1225 16384
1225 16384
1226 Ellipsis revision. Revision hash does not match data (likely due to
1226 Ellipsis revision. Revision hash does not match data (likely due to
1227 rewritten parents).
1227 rewritten parents).
1228
1228
1229 8192
1229 8192
1230 Externally stored. The revision fulltext contains "key:value" "\n"
1230 Externally stored. The revision fulltext contains "key:value" "\n"
1231 delimited metadata defining an object stored elsewhere. Used by the LFS
1231 delimited metadata defining an object stored elsewhere. Used by the LFS
1232 extension.
1232 extension.
1233
1233
1234 For historical reasons, the integer values are identical to revlog version
1234 For historical reasons, the integer values are identical to revlog version
1235 1 per-revision storage flags and correspond to bits being set in this
1235 1 per-revision storage flags and correspond to bits being set in this
1236 2-byte field. Bits were allocated starting from the most-significant bit,
1236 2-byte field. Bits were allocated starting from the most-significant bit,
1237 hence the reverse ordering and allocation of these flags.
1237 hence the reverse ordering and allocation of these flags.
1238
1238
1239 Changeset Segment
1239 Changeset Segment
1240 =================
1240 =================
1241
1241
1242 The *changeset segment* consists of a single *delta group* holding
1242 The *changeset segment* consists of a single *delta group* holding
1243 changelog data. The *empty chunk* at the end of the *delta group* denotes
1243 changelog data. The *empty chunk* at the end of the *delta group* denotes
1244 the boundary to the *manifest segment*.
1244 the boundary to the *manifest segment*.
1245
1245
1246 Manifest Segment
1246 Manifest Segment
1247 ================
1247 ================
1248
1248
1249 The *manifest segment* consists of a single *delta group* holding manifest
1249 The *manifest segment* consists of a single *delta group* holding manifest
1250 data. If treemanifests are in use, it contains only the manifest for the
1250 data. If treemanifests are in use, it contains only the manifest for the
1251 root directory of the repository. Otherwise, it contains the entire
1251 root directory of the repository. Otherwise, it contains the entire
1252 manifest data. The *empty chunk* at the end of the *delta group* denotes
1252 manifest data. The *empty chunk* at the end of the *delta group* denotes
1253 the boundary to the next segment (either the *treemanifests segment* or
1253 the boundary to the next segment (either the *treemanifests segment* or
1254 the *filelogs segment*, depending on version and the request options).
1254 the *filelogs segment*, depending on version and the request options).
1255
1255
1256 Treemanifests Segment
1256 Treemanifests Segment
1257 ---------------------
1257 ---------------------
1258
1258
1259 The *treemanifests segment* only exists in changegroup version "3", and
1259 The *treemanifests segment* only exists in changegroup version "3", and
1260 only if the 'treemanifest' param is part of the bundle2 changegroup part
1260 only if the 'treemanifest' param is part of the bundle2 changegroup part
1261 (it is not possible to use changegroup version 3 outside of bundle2).
1261 (it is not possible to use changegroup version 3 outside of bundle2).
1262 Aside from the filenames in the *treemanifests segment* containing a
1262 Aside from the filenames in the *treemanifests segment* containing a
1263 trailing "/" character, it behaves identically to the *filelogs segment*
1263 trailing "/" character, it behaves identically to the *filelogs segment*
1264 (see below). The final sub-segment is followed by an *empty chunk*
1264 (see below). The final sub-segment is followed by an *empty chunk*
1265 (logically, a sub-segment with filename size 0). This denotes the boundary
1265 (logically, a sub-segment with filename size 0). This denotes the boundary
1266 to the *filelogs segment*.
1266 to the *filelogs segment*.
1267
1267
1268 Filelogs Segment
1268 Filelogs Segment
1269 ================
1269 ================
1270
1270
1271 The *filelogs segment* consists of multiple sub-segments, each
1271 The *filelogs segment* consists of multiple sub-segments, each
1272 corresponding to an individual file whose data is being described:
1272 corresponding to an individual file whose data is being described:
1273
1273
1274 +--------------------------------------------------+
1274 +--------------------------------------------------+
1275 | | | | | |
1275 | | | | | |
1276 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
1276 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
1277 | | | | | (4 bytes) |
1277 | | | | | (4 bytes) |
1278 | | | | | |
1278 | | | | | |
1279 +--------------------------------------------------+
1279 +--------------------------------------------------+
1280
1280
1281 The final filelog sub-segment is followed by an *empty chunk* (logically,
1281 The final filelog sub-segment is followed by an *empty chunk* (logically,
1282 a sub-segment with filename size 0). This denotes the end of the segment
1282 a sub-segment with filename size 0). This denotes the end of the segment
1283 and of the overall changegroup.
1283 and of the overall changegroup.
1284
1284
1285 Each filelog sub-segment consists of the following:
1285 Each filelog sub-segment consists of the following:
1286
1286
1287 +------------------------------------------------------+
1287 +------------------------------------------------------+
1288 | | | |
1288 | | | |
1289 | filename length | filename | delta group |
1289 | filename length | filename | delta group |
1290 | (4 bytes) | (<length - 4> bytes) | (various) |
1290 | (4 bytes) | (<length - 4> bytes) | (various) |
1291 | | | |
1291 | | | |
1292 +------------------------------------------------------+
1292 +------------------------------------------------------+
1293
1293
1294 That is, a *chunk* consisting of the filename (not terminated or padded)
1294 That is, a *chunk* consisting of the filename (not terminated or padded)
1295 followed by N chunks constituting the *delta group* for this file. The
1295 followed by N chunks constituting the *delta group* for this file. The
1296 *empty chunk* at the end of each *delta group* denotes the boundary to the
1296 *empty chunk* at the end of each *delta group* denotes the boundary to the
1297 next filelog sub-segment.
1297 next filelog sub-segment.
1298
1298
1299 test advanced, deprecated and experimental options are hidden in command help
1299 test advanced, deprecated and experimental options are hidden in command help
1300 $ hg help debugoptADV
1300 $ hg help debugoptADV
1301 hg debugoptADV
1301 hg debugoptADV
1302
1302
1303 (no help text available)
1303 (no help text available)
1304
1304
1305 options:
1305 options:
1306
1306
1307 (some details hidden, use --verbose to show complete help)
1307 (some details hidden, use --verbose to show complete help)
1308 $ hg help debugoptDEP
1308 $ hg help debugoptDEP
1309 hg debugoptDEP
1309 hg debugoptDEP
1310
1310
1311 (no help text available)
1311 (no help text available)
1312
1312
1313 options:
1313 options:
1314
1314
1315 (some details hidden, use --verbose to show complete help)
1315 (some details hidden, use --verbose to show complete help)
1316
1316
1317 $ hg help debugoptEXP
1317 $ hg help debugoptEXP
1318 hg debugoptEXP
1318 hg debugoptEXP
1319
1319
1320 (no help text available)
1320 (no help text available)
1321
1321
1322 options:
1322 options:
1323
1323
1324 (some details hidden, use --verbose to show complete help)
1324 (some details hidden, use --verbose to show complete help)
1325
1325
1326 test advanced, deprecated and experimental options are shown with -v
1326 test advanced, deprecated and experimental options are shown with -v
1327 $ hg help -v debugoptADV | grep aopt
1327 $ hg help -v debugoptADV | grep aopt
1328 --aopt option is (ADVANCED)
1328 --aopt option is (ADVANCED)
1329 $ hg help -v debugoptDEP | grep dopt
1329 $ hg help -v debugoptDEP | grep dopt
1330 --dopt option is (DEPRECATED)
1330 --dopt option is (DEPRECATED)
1331 $ hg help -v debugoptEXP | grep eopt
1331 $ hg help -v debugoptEXP | grep eopt
1332 --eopt option is (EXPERIMENTAL)
1332 --eopt option is (EXPERIMENTAL)
1333
1333
1334 #if gettext
1334 #if gettext
1335 test deprecated option is hidden with translation with untranslated description
1335 test deprecated option is hidden with translation with untranslated description
1336 (use many globy for not failing on changed transaction)
1336 (use many globy for not failing on changed transaction)
1337 $ LANGUAGE=sv hg help debugoptDEP
1337 $ LANGUAGE=sv hg help debugoptDEP
1338 hg debugoptDEP
1338 hg debugoptDEP
1339
1339
1340 (*) (glob)
1340 (*) (glob)
1341
1341
1342 options:
1342 options:
1343
1343
1344 (some details hidden, use --verbose to show complete help)
1344 (some details hidden, use --verbose to show complete help)
1345 #endif
1345 #endif
1346
1346
1347 Test commands that collide with topics (issue4240)
1347 Test commands that collide with topics (issue4240)
1348
1348
1349 $ hg config -hq
1349 $ hg config -hq
1350 hg config [-u] [NAME]...
1350 hg config [-u] [NAME]...
1351
1351
1352 show combined config settings from all hgrc files
1352 show combined config settings from all hgrc files
1353 $ hg showconfig -hq
1353 $ hg showconfig -hq
1354 hg config [-u] [NAME]...
1354 hg config [-u] [NAME]...
1355
1355
1356 show combined config settings from all hgrc files
1356 show combined config settings from all hgrc files
1357
1357
1358 Test a help topic
1358 Test a help topic
1359
1359
1360 $ hg help dates
1360 $ hg help dates
1361 Date Formats
1361 Date Formats
1362 """"""""""""
1362 """"""""""""
1363
1363
1364 Some commands allow the user to specify a date, e.g.:
1364 Some commands allow the user to specify a date, e.g.:
1365
1365
1366 - backout, commit, import, tag: Specify the commit date.
1366 - backout, commit, import, tag: Specify the commit date.
1367 - log, revert, update: Select revision(s) by date.
1367 - log, revert, update: Select revision(s) by date.
1368
1368
1369 Many date formats are valid. Here are some examples:
1369 Many date formats are valid. Here are some examples:
1370
1370
1371 - "Wed Dec 6 13:18:29 2006" (local timezone assumed)
1371 - "Wed Dec 6 13:18:29 2006" (local timezone assumed)
1372 - "Dec 6 13:18 -0600" (year assumed, time offset provided)
1372 - "Dec 6 13:18 -0600" (year assumed, time offset provided)
1373 - "Dec 6 13:18 UTC" (UTC and GMT are aliases for +0000)
1373 - "Dec 6 13:18 UTC" (UTC and GMT are aliases for +0000)
1374 - "Dec 6" (midnight)
1374 - "Dec 6" (midnight)
1375 - "13:18" (today assumed)
1375 - "13:18" (today assumed)
1376 - "3:39" (3:39AM assumed)
1376 - "3:39" (3:39AM assumed)
1377 - "3:39pm" (15:39)
1377 - "3:39pm" (15:39)
1378 - "2006-12-06 13:18:29" (ISO 8601 format)
1378 - "2006-12-06 13:18:29" (ISO 8601 format)
1379 - "2006-12-6 13:18"
1379 - "2006-12-6 13:18"
1380 - "2006-12-6"
1380 - "2006-12-6"
1381 - "12-6"
1381 - "12-6"
1382 - "12/6"
1382 - "12/6"
1383 - "12/6/6" (Dec 6 2006)
1383 - "12/6/6" (Dec 6 2006)
1384 - "today" (midnight)
1384 - "today" (midnight)
1385 - "yesterday" (midnight)
1385 - "yesterday" (midnight)
1386 - "now" - right now
1386 - "now" - right now
1387
1387
1388 Lastly, there is Mercurial's internal format:
1388 Lastly, there is Mercurial's internal format:
1389
1389
1390 - "1165411109 0" (Wed Dec 6 13:18:29 2006 UTC)
1390 - "1165411109 0" (Wed Dec 6 13:18:29 2006 UTC)
1391
1391
1392 This is the internal representation format for dates. The first number is
1392 This is the internal representation format for dates. The first number is
1393 the number of seconds since the epoch (1970-01-01 00:00 UTC). The second
1393 the number of seconds since the epoch (1970-01-01 00:00 UTC). The second
1394 is the offset of the local timezone, in seconds west of UTC (negative if
1394 is the offset of the local timezone, in seconds west of UTC (negative if
1395 the timezone is east of UTC).
1395 the timezone is east of UTC).
1396
1396
1397 The log command also accepts date ranges:
1397 The log command also accepts date ranges:
1398
1398
1399 - "<DATE" - at or before a given date/time
1399 - "<DATE" - at or before a given date/time
1400 - ">DATE" - on or after a given date/time
1400 - ">DATE" - on or after a given date/time
1401 - "DATE to DATE" - a date range, inclusive
1401 - "DATE to DATE" - a date range, inclusive
1402 - "-DAYS" - within a given number of days of today
1402 - "-DAYS" - within a given number of days of today
1403
1403
1404 Test repeated config section name
1404 Test repeated config section name
1405
1405
1406 $ hg help config.host
1406 $ hg help config.host
1407 "http_proxy.host"
1407 "http_proxy.host"
1408 Host name and (optional) port of the proxy server, for example
1408 Host name and (optional) port of the proxy server, for example
1409 "myproxy:8000".
1409 "myproxy:8000".
1410
1410
1411 "smtp.host"
1411 "smtp.host"
1412 Host name of mail server, e.g. "mail.example.com".
1412 Host name of mail server, e.g. "mail.example.com".
1413
1413
1414
1414
1415 Test section name with dot
1415 Test section name with dot
1416
1416
1417 $ hg help config.ui.username
1417 $ hg help config.ui.username
1418 "ui.username"
1418 "ui.username"
1419 The committer of a changeset created when running "commit". Typically
1419 The committer of a changeset created when running "commit". Typically
1420 a person's name and email address, e.g. "Fred Widget
1420 a person's name and email address, e.g. "Fred Widget
1421 <fred@example.com>". Environment variables in the username are
1421 <fred@example.com>". Environment variables in the username are
1422 expanded.
1422 expanded.
1423
1423
1424 (default: "$EMAIL" or "username@hostname". If the username in hgrc is
1424 (default: "$EMAIL" or "username@hostname". If the username in hgrc is
1425 empty, e.g. if the system admin set "username =" in the system hgrc,
1425 empty, e.g. if the system admin set "username =" in the system hgrc,
1426 it has to be specified manually or in a different hgrc file)
1426 it has to be specified manually or in a different hgrc file)
1427
1427
1428
1428
1429 $ hg help config.annotate.git
1429 $ hg help config.annotate.git
1430 abort: help section not found: config.annotate.git
1430 abort: help section not found: config.annotate.git
1431 [255]
1431 [255]
1432
1432
1433 $ hg help config.update.check
1433 $ hg help config.update.check
1434 "commands.update.check"
1434 "commands.update.check"
1435 Determines what level of checking 'hg update' will perform before
1435 Determines what level of checking 'hg update' will perform before
1436 moving to a destination revision. Valid values are "abort", "none",
1436 moving to a destination revision. Valid values are "abort", "none",
1437 "linear", and "noconflict". "abort" always fails if the working
1437 "linear", and "noconflict". "abort" always fails if the working
1438 directory has uncommitted changes. "none" performs no checking, and
1438 directory has uncommitted changes. "none" performs no checking, and
1439 may result in a merge with uncommitted changes. "linear" allows any
1439 may result in a merge with uncommitted changes. "linear" allows any
1440 update as long as it follows a straight line in the revision history,
1440 update as long as it follows a straight line in the revision history,
1441 and may trigger a merge with uncommitted changes. "noconflict" will
1441 and may trigger a merge with uncommitted changes. "noconflict" will
1442 allow any update which would not trigger a merge with uncommitted
1442 allow any update which would not trigger a merge with uncommitted
1443 changes, if any are present. (default: "linear")
1443 changes, if any are present. (default: "linear")
1444
1444
1445
1445
1446 $ hg help config.commands.update.check
1446 $ hg help config.commands.update.check
1447 "commands.update.check"
1447 "commands.update.check"
1448 Determines what level of checking 'hg update' will perform before
1448 Determines what level of checking 'hg update' will perform before
1449 moving to a destination revision. Valid values are "abort", "none",
1449 moving to a destination revision. Valid values are "abort", "none",
1450 "linear", and "noconflict". "abort" always fails if the working
1450 "linear", and "noconflict". "abort" always fails if the working
1451 directory has uncommitted changes. "none" performs no checking, and
1451 directory has uncommitted changes. "none" performs no checking, and
1452 may result in a merge with uncommitted changes. "linear" allows any
1452 may result in a merge with uncommitted changes. "linear" allows any
1453 update as long as it follows a straight line in the revision history,
1453 update as long as it follows a straight line in the revision history,
1454 and may trigger a merge with uncommitted changes. "noconflict" will
1454 and may trigger a merge with uncommitted changes. "noconflict" will
1455 allow any update which would not trigger a merge with uncommitted
1455 allow any update which would not trigger a merge with uncommitted
1456 changes, if any are present. (default: "linear")
1456 changes, if any are present. (default: "linear")
1457
1457
1458
1458
1459 $ hg help config.ommands.update.check
1459 $ hg help config.ommands.update.check
1460 abort: help section not found: config.ommands.update.check
1460 abort: help section not found: config.ommands.update.check
1461 [255]
1461 [255]
1462
1462
1463 Unrelated trailing paragraphs shouldn't be included
1463 Unrelated trailing paragraphs shouldn't be included
1464
1464
1465 $ hg help config.extramsg | grep '^$'
1465 $ hg help config.extramsg | grep '^$'
1466
1466
1467
1467
1468 Test capitalized section name
1468 Test capitalized section name
1469
1469
1470 $ hg help scripting.HGPLAIN > /dev/null
1470 $ hg help scripting.HGPLAIN > /dev/null
1471
1471
1472 Help subsection:
1472 Help subsection:
1473
1473
1474 $ hg help config.charsets |grep "Email example:" > /dev/null
1474 $ hg help config.charsets |grep "Email example:" > /dev/null
1475 [1]
1475 [1]
1476
1476
1477 Show nested definitions
1477 Show nested definitions
1478 ("profiling.type"[break]"ls"[break]"stat"[break])
1478 ("profiling.type"[break]"ls"[break]"stat"[break])
1479
1479
1480 $ hg help config.type | egrep '^$'|wc -l
1480 $ hg help config.type | egrep '^$'|wc -l
1481 \s*3 (re)
1481 \s*3 (re)
1482
1482
1483 $ hg help config.profiling.type.ls
1483 $ hg help config.profiling.type.ls
1484 "profiling.type.ls"
1484 "profiling.type.ls"
1485 Use Python's built-in instrumenting profiler. This profiler works on
1485 Use Python's built-in instrumenting profiler. This profiler works on
1486 all platforms, but each line number it reports is the first line of
1486 all platforms, but each line number it reports is the first line of
1487 a function. This restriction makes it difficult to identify the
1487 a function. This restriction makes it difficult to identify the
1488 expensive parts of a non-trivial function.
1488 expensive parts of a non-trivial function.
1489
1489
1490
1490
1491 Separate sections from subsections
1491 Separate sections from subsections
1492
1492
1493 $ hg help config.format | egrep '^ ("|-)|^\s*$' | uniq
1493 $ hg help config.format | egrep '^ ("|-)|^\s*$' | uniq
1494 "format"
1494 "format"
1495 --------
1495 --------
1496
1496
1497 "usegeneraldelta"
1497 "usegeneraldelta"
1498
1498
1499 "dotencode"
1499 "dotencode"
1500
1500
1501 "usefncache"
1501 "usefncache"
1502
1502
1503 "usestore"
1503 "usestore"
1504
1504
1505 "profiling"
1505 "profiling"
1506 -----------
1506 -----------
1507
1507
1508 "format"
1508 "format"
1509
1509
1510 "progress"
1510 "progress"
1511 ----------
1511 ----------
1512
1512
1513 "format"
1513 "format"
1514
1514
1515
1515
1516 Last item in help config.*:
1516 Last item in help config.*:
1517
1517
1518 $ hg help config.`hg help config|grep '^ "'| \
1518 $ hg help config.`hg help config|grep '^ "'| \
1519 > tail -1|sed 's![ "]*!!g'`| \
1519 > tail -1|sed 's![ "]*!!g'`| \
1520 > grep 'hg help -c config' > /dev/null
1520 > grep 'hg help -c config' > /dev/null
1521 [1]
1521 [1]
1522
1522
1523 note to use help -c for general hg help config:
1523 note to use help -c for general hg help config:
1524
1524
1525 $ hg help config |grep 'hg help -c config' > /dev/null
1525 $ hg help config |grep 'hg help -c config' > /dev/null
1526
1526
1527 Test templating help
1527 Test templating help
1528
1528
1529 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
1529 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
1530 desc String. The text of the changeset description.
1530 desc String. The text of the changeset description.
1531 diffstat String. Statistics of changes with the following format:
1531 diffstat String. Statistics of changes with the following format:
1532 firstline Any text. Returns the first line of text.
1532 firstline Any text. Returns the first line of text.
1533 nonempty Any text. Returns '(none)' if the string is empty.
1533 nonempty Any text. Returns '(none)' if the string is empty.
1534
1534
1535 Test deprecated items
1535 Test deprecated items
1536
1536
1537 $ hg help -v templating | grep currentbookmark
1537 $ hg help -v templating | grep currentbookmark
1538 currentbookmark
1538 currentbookmark
1539 $ hg help templating | (grep currentbookmark || true)
1539 $ hg help templating | (grep currentbookmark || true)
1540
1540
1541 Test help hooks
1541 Test help hooks
1542
1542
1543 $ cat > helphook1.py <<EOF
1543 $ cat > helphook1.py <<EOF
1544 > from mercurial import help
1544 > from mercurial import help
1545 >
1545 >
1546 > def rewrite(ui, topic, doc):
1546 > def rewrite(ui, topic, doc):
1547 > return doc + b'\nhelphook1\n'
1547 > return doc + b'\nhelphook1\n'
1548 >
1548 >
1549 > def extsetup(ui):
1549 > def extsetup(ui):
1550 > help.addtopichook(b'revisions', rewrite)
1550 > help.addtopichook(b'revisions', rewrite)
1551 > EOF
1551 > EOF
1552 $ cat > helphook2.py <<EOF
1552 $ cat > helphook2.py <<EOF
1553 > from mercurial import help
1553 > from mercurial import help
1554 >
1554 >
1555 > def rewrite(ui, topic, doc):
1555 > def rewrite(ui, topic, doc):
1556 > return doc + b'\nhelphook2\n'
1556 > return doc + b'\nhelphook2\n'
1557 >
1557 >
1558 > def extsetup(ui):
1558 > def extsetup(ui):
1559 > help.addtopichook(b'revisions', rewrite)
1559 > help.addtopichook(b'revisions', rewrite)
1560 > EOF
1560 > EOF
1561 $ echo '[extensions]' >> $HGRCPATH
1561 $ echo '[extensions]' >> $HGRCPATH
1562 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
1562 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
1563 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
1563 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
1564 $ hg help revsets | grep helphook
1564 $ hg help revsets | grep helphook
1565 helphook1
1565 helphook1
1566 helphook2
1566 helphook2
1567
1567
1568 help -c should only show debug --debug
1568 help -c should only show debug --debug
1569
1569
1570 $ hg help -c --debug|egrep debug|wc -l|egrep '^\s*0\s*$'
1570 $ hg help -c --debug|egrep debug|wc -l|egrep '^\s*0\s*$'
1571 [1]
1571 [1]
1572
1572
1573 help -c should only show deprecated for -v
1573 help -c should only show deprecated for -v
1574
1574
1575 $ hg help -c -v|egrep DEPRECATED|wc -l|egrep '^\s*0\s*$'
1575 $ hg help -c -v|egrep DEPRECATED|wc -l|egrep '^\s*0\s*$'
1576 [1]
1576 [1]
1577
1577
1578 Test -s / --system
1578 Test -s / --system
1579
1579
1580 $ hg help config.files -s windows |grep 'etc/mercurial' | \
1580 $ hg help config.files -s windows |grep 'etc/mercurial' | \
1581 > wc -l | sed -e 's/ //g'
1581 > wc -l | sed -e 's/ //g'
1582 0
1582 0
1583 $ hg help config.files --system unix | grep 'USER' | \
1583 $ hg help config.files --system unix | grep 'USER' | \
1584 > wc -l | sed -e 's/ //g'
1584 > wc -l | sed -e 's/ //g'
1585 0
1585 0
1586
1586
1587 Test -e / -c / -k combinations
1587 Test -e / -c / -k combinations
1588
1588
1589 $ hg help -c|egrep '^[A-Z].*:|^ debug'
1589 $ hg help -c|egrep '^[A-Z].*:|^ debug'
1590 Commands:
1590 Commands:
1591 $ hg help -e|egrep '^[A-Z].*:|^ debug'
1591 $ hg help -e|egrep '^[A-Z].*:|^ debug'
1592 Extensions:
1592 Extensions:
1593 $ hg help -k|egrep '^[A-Z].*:|^ debug'
1593 $ hg help -k|egrep '^[A-Z].*:|^ debug'
1594 Topics:
1594 Topics:
1595 Commands:
1595 Commands:
1596 Extensions:
1596 Extensions:
1597 Extension Commands:
1597 Extension Commands:
1598 $ hg help -c schemes
1598 $ hg help -c schemes
1599 abort: no such help topic: schemes
1599 abort: no such help topic: schemes
1600 (try 'hg help --keyword schemes')
1600 (try 'hg help --keyword schemes')
1601 [255]
1601 [255]
1602 $ hg help -e schemes |head -1
1602 $ hg help -e schemes |head -1
1603 schemes extension - extend schemes with shortcuts to repository swarms
1603 schemes extension - extend schemes with shortcuts to repository swarms
1604 $ hg help -c -k dates |egrep '^(Topics|Extensions|Commands):'
1604 $ hg help -c -k dates |egrep '^(Topics|Extensions|Commands):'
1605 Commands:
1605 Commands:
1606 $ hg help -e -k a |egrep '^(Topics|Extensions|Commands):'
1606 $ hg help -e -k a |egrep '^(Topics|Extensions|Commands):'
1607 Extensions:
1607 Extensions:
1608 $ hg help -e -c -k date |egrep '^(Topics|Extensions|Commands):'
1608 $ hg help -e -c -k date |egrep '^(Topics|Extensions|Commands):'
1609 Extensions:
1609 Extensions:
1610 Commands:
1610 Commands:
1611 $ hg help -c commit > /dev/null
1611 $ hg help -c commit > /dev/null
1612 $ hg help -e -c commit > /dev/null
1612 $ hg help -e -c commit > /dev/null
1613 $ hg help -e commit
1613 $ hg help -e commit
1614 abort: no such help topic: commit
1614 abort: no such help topic: commit
1615 (try 'hg help --keyword commit')
1615 (try 'hg help --keyword commit')
1616 [255]
1616 [255]
1617
1617
1618 Test keyword search help
1618 Test keyword search help
1619
1619
1620 $ cat > prefixedname.py <<EOF
1620 $ cat > prefixedname.py <<EOF
1621 > '''matched against word "clone"
1621 > '''matched against word "clone"
1622 > '''
1622 > '''
1623 > EOF
1623 > EOF
1624 $ echo '[extensions]' >> $HGRCPATH
1624 $ echo '[extensions]' >> $HGRCPATH
1625 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
1625 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
1626 $ hg help -k clone
1626 $ hg help -k clone
1627 Topics:
1627 Topics:
1628
1628
1629 config Configuration Files
1629 config Configuration Files
1630 extensions Using Additional Features
1630 extensions Using Additional Features
1631 glossary Glossary
1631 glossary Glossary
1632 phases Working with Phases
1632 phases Working with Phases
1633 subrepos Subrepositories
1633 subrepos Subrepositories
1634 urls URL Paths
1634 urls URL Paths
1635
1635
1636 Commands:
1636 Commands:
1637
1637
1638 bookmarks create a new bookmark or list existing bookmarks
1638 bookmarks create a new bookmark or list existing bookmarks
1639 clone make a copy of an existing repository
1639 clone make a copy of an existing repository
1640 paths show aliases for remote repositories
1640 paths show aliases for remote repositories
1641 pull pull changes from the specified source
1641 pull pull changes from the specified source
1642 update update working directory (or switch revisions)
1642 update update working directory (or switch revisions)
1643
1643
1644 Extensions:
1644 Extensions:
1645
1645
1646 clonebundles advertise pre-generated bundles to seed clones
1646 clonebundles advertise pre-generated bundles to seed clones
1647 narrow create clones which fetch history data for subset of files
1647 narrow create clones which fetch history data for subset of files
1648 (EXPERIMENTAL)
1648 (EXPERIMENTAL)
1649 prefixedname matched against word "clone"
1649 prefixedname matched against word "clone"
1650 relink recreates hardlinks between repository clones
1650 relink recreates hardlinks between repository clones
1651
1651
1652 Extension Commands:
1652 Extension Commands:
1653
1653
1654 qclone clone main and patch repository at same time
1654 qclone clone main and patch repository at same time
1655
1655
1656 Test unfound topic
1656 Test unfound topic
1657
1657
1658 $ hg help nonexistingtopicthatwillneverexisteverever
1658 $ hg help nonexistingtopicthatwillneverexisteverever
1659 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
1659 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
1660 (try 'hg help --keyword nonexistingtopicthatwillneverexisteverever')
1660 (try 'hg help --keyword nonexistingtopicthatwillneverexisteverever')
1661 [255]
1661 [255]
1662
1662
1663 Test unfound keyword
1663 Test unfound keyword
1664
1664
1665 $ hg help --keyword nonexistingwordthatwillneverexisteverever
1665 $ hg help --keyword nonexistingwordthatwillneverexisteverever
1666 abort: no matches
1666 abort: no matches
1667 (try 'hg help' for a list of topics)
1667 (try 'hg help' for a list of topics)
1668 [255]
1668 [255]
1669
1669
1670 Test omit indicating for help
1670 Test omit indicating for help
1671
1671
1672 $ cat > addverboseitems.py <<EOF
1672 $ cat > addverboseitems.py <<EOF
1673 > '''extension to test omit indicating.
1673 > '''extension to test omit indicating.
1674 >
1674 >
1675 > This paragraph is never omitted (for extension)
1675 > This paragraph is never omitted (for extension)
1676 >
1676 >
1677 > .. container:: verbose
1677 > .. container:: verbose
1678 >
1678 >
1679 > This paragraph is omitted,
1679 > This paragraph is omitted,
1680 > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension)
1680 > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension)
1681 >
1681 >
1682 > This paragraph is never omitted, too (for extension)
1682 > This paragraph is never omitted, too (for extension)
1683 > '''
1683 > '''
1684 > from __future__ import absolute_import
1684 > from __future__ import absolute_import
1685 > from mercurial import commands, help
1685 > from mercurial import commands, help
1686 > testtopic = b"""This paragraph is never omitted (for topic).
1686 > testtopic = b"""This paragraph is never omitted (for topic).
1687 >
1687 >
1688 > .. container:: verbose
1688 > .. container:: verbose
1689 >
1689 >
1690 > This paragraph is omitted,
1690 > This paragraph is omitted,
1691 > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic)
1691 > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic)
1692 >
1692 >
1693 > This paragraph is never omitted, too (for topic)
1693 > This paragraph is never omitted, too (for topic)
1694 > """
1694 > """
1695 > def extsetup(ui):
1695 > def extsetup(ui):
1696 > help.helptable.append(([b"topic-containing-verbose"],
1696 > help.helptable.append(([b"topic-containing-verbose"],
1697 > b"This is the topic to test omit indicating.",
1697 > b"This is the topic to test omit indicating.",
1698 > lambda ui: testtopic))
1698 > lambda ui: testtopic))
1699 > EOF
1699 > EOF
1700 $ echo '[extensions]' >> $HGRCPATH
1700 $ echo '[extensions]' >> $HGRCPATH
1701 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1701 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1702 $ hg help addverboseitems
1702 $ hg help addverboseitems
1703 addverboseitems extension - extension to test omit indicating.
1703 addverboseitems extension - extension to test omit indicating.
1704
1704
1705 This paragraph is never omitted (for extension)
1705 This paragraph is never omitted (for extension)
1706
1706
1707 This paragraph is never omitted, too (for extension)
1707 This paragraph is never omitted, too (for extension)
1708
1708
1709 (some details hidden, use --verbose to show complete help)
1709 (some details hidden, use --verbose to show complete help)
1710
1710
1711 no commands defined
1711 no commands defined
1712 $ hg help -v addverboseitems
1712 $ hg help -v addverboseitems
1713 addverboseitems extension - extension to test omit indicating.
1713 addverboseitems extension - extension to test omit indicating.
1714
1714
1715 This paragraph is never omitted (for extension)
1715 This paragraph is never omitted (for extension)
1716
1716
1717 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1717 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1718 extension)
1718 extension)
1719
1719
1720 This paragraph is never omitted, too (for extension)
1720 This paragraph is never omitted, too (for extension)
1721
1721
1722 no commands defined
1722 no commands defined
1723 $ hg help topic-containing-verbose
1723 $ hg help topic-containing-verbose
1724 This is the topic to test omit indicating.
1724 This is the topic to test omit indicating.
1725 """"""""""""""""""""""""""""""""""""""""""
1725 """"""""""""""""""""""""""""""""""""""""""
1726
1726
1727 This paragraph is never omitted (for topic).
1727 This paragraph is never omitted (for topic).
1728
1728
1729 This paragraph is never omitted, too (for topic)
1729 This paragraph is never omitted, too (for topic)
1730
1730
1731 (some details hidden, use --verbose to show complete help)
1731 (some details hidden, use --verbose to show complete help)
1732 $ hg help -v topic-containing-verbose
1732 $ hg help -v topic-containing-verbose
1733 This is the topic to test omit indicating.
1733 This is the topic to test omit indicating.
1734 """"""""""""""""""""""""""""""""""""""""""
1734 """"""""""""""""""""""""""""""""""""""""""
1735
1735
1736 This paragraph is never omitted (for topic).
1736 This paragraph is never omitted (for topic).
1737
1737
1738 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1738 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1739 topic)
1739 topic)
1740
1740
1741 This paragraph is never omitted, too (for topic)
1741 This paragraph is never omitted, too (for topic)
1742
1742
1743 Test section lookup
1743 Test section lookup
1744
1744
1745 $ hg help revset.merge
1745 $ hg help revset.merge
1746 "merge()"
1746 "merge()"
1747 Changeset is a merge changeset.
1747 Changeset is a merge changeset.
1748
1748
1749 $ hg help glossary.dag
1749 $ hg help glossary.dag
1750 DAG
1750 DAG
1751 The repository of changesets of a distributed version control system
1751 The repository of changesets of a distributed version control system
1752 (DVCS) can be described as a directed acyclic graph (DAG), consisting
1752 (DVCS) can be described as a directed acyclic graph (DAG), consisting
1753 of nodes and edges, where nodes correspond to changesets and edges
1753 of nodes and edges, where nodes correspond to changesets and edges
1754 imply a parent -> child relation. This graph can be visualized by
1754 imply a parent -> child relation. This graph can be visualized by
1755 graphical tools such as 'hg log --graph'. In Mercurial, the DAG is
1755 graphical tools such as 'hg log --graph'. In Mercurial, the DAG is
1756 limited by the requirement for children to have at most two parents.
1756 limited by the requirement for children to have at most two parents.
1757
1757
1758
1758
1759 $ hg help hgrc.paths
1759 $ hg help hgrc.paths
1760 "paths"
1760 "paths"
1761 -------
1761 -------
1762
1762
1763 Assigns symbolic names and behavior to repositories.
1763 Assigns symbolic names and behavior to repositories.
1764
1764
1765 Options are symbolic names defining the URL or directory that is the
1765 Options are symbolic names defining the URL or directory that is the
1766 location of the repository. Example:
1766 location of the repository. Example:
1767
1767
1768 [paths]
1768 [paths]
1769 my_server = https://example.com/my_repo
1769 my_server = https://example.com/my_repo
1770 local_path = /home/me/repo
1770 local_path = /home/me/repo
1771
1771
1772 These symbolic names can be used from the command line. To pull from
1772 These symbolic names can be used from the command line. To pull from
1773 "my_server": 'hg pull my_server'. To push to "local_path": 'hg push
1773 "my_server": 'hg pull my_server'. To push to "local_path": 'hg push
1774 local_path'.
1774 local_path'.
1775
1775
1776 Options containing colons (":") denote sub-options that can influence
1776 Options containing colons (":") denote sub-options that can influence
1777 behavior for that specific path. Example:
1777 behavior for that specific path. Example:
1778
1778
1779 [paths]
1779 [paths]
1780 my_server = https://example.com/my_path
1780 my_server = https://example.com/my_path
1781 my_server:pushurl = ssh://example.com/my_path
1781 my_server:pushurl = ssh://example.com/my_path
1782
1782
1783 The following sub-options can be defined:
1783 The following sub-options can be defined:
1784
1784
1785 "pushurl"
1785 "pushurl"
1786 The URL to use for push operations. If not defined, the location
1786 The URL to use for push operations. If not defined, the location
1787 defined by the path's main entry is used.
1787 defined by the path's main entry is used.
1788
1788
1789 "pushrev"
1789 "pushrev"
1790 A revset defining which revisions to push by default.
1790 A revset defining which revisions to push by default.
1791
1791
1792 When 'hg push' is executed without a "-r" argument, the revset defined
1792 When 'hg push' is executed without a "-r" argument, the revset defined
1793 by this sub-option is evaluated to determine what to push.
1793 by this sub-option is evaluated to determine what to push.
1794
1794
1795 For example, a value of "." will push the working directory's revision
1795 For example, a value of "." will push the working directory's revision
1796 by default.
1796 by default.
1797
1797
1798 Revsets specifying bookmarks will not result in the bookmark being
1798 Revsets specifying bookmarks will not result in the bookmark being
1799 pushed.
1799 pushed.
1800
1800
1801 The following special named paths exist:
1801 The following special named paths exist:
1802
1802
1803 "default"
1803 "default"
1804 The URL or directory to use when no source or remote is specified.
1804 The URL or directory to use when no source or remote is specified.
1805
1805
1806 'hg clone' will automatically define this path to the location the
1806 'hg clone' will automatically define this path to the location the
1807 repository was cloned from.
1807 repository was cloned from.
1808
1808
1809 "default-push"
1809 "default-push"
1810 (deprecated) The URL or directory for the default 'hg push' location.
1810 (deprecated) The URL or directory for the default 'hg push' location.
1811 "default:pushurl" should be used instead.
1811 "default:pushurl" should be used instead.
1812
1812
1813 $ hg help glossary.mcguffin
1813 $ hg help glossary.mcguffin
1814 abort: help section not found: glossary.mcguffin
1814 abort: help section not found: glossary.mcguffin
1815 [255]
1815 [255]
1816
1816
1817 $ hg help glossary.mc.guffin
1817 $ hg help glossary.mc.guffin
1818 abort: help section not found: glossary.mc.guffin
1818 abort: help section not found: glossary.mc.guffin
1819 [255]
1819 [255]
1820
1820
1821 $ hg help template.files
1821 $ hg help template.files
1822 files List of strings. All files modified, added, or removed by
1822 files List of strings. All files modified, added, or removed by
1823 this changeset.
1823 this changeset.
1824 files(pattern)
1824 files(pattern)
1825 All files of the current changeset matching the pattern. See
1825 All files of the current changeset matching the pattern. See
1826 'hg help patterns'.
1826 'hg help patterns'.
1827
1827
1828 Test section lookup by translated message
1828 Test section lookup by translated message
1829
1829
1830 str.lower() instead of encoding.lower(str) on translated message might
1830 str.lower() instead of encoding.lower(str) on translated message might
1831 make message meaningless, because some encoding uses 0x41(A) - 0x5a(Z)
1831 make message meaningless, because some encoding uses 0x41(A) - 0x5a(Z)
1832 as the second or later byte of multi-byte character.
1832 as the second or later byte of multi-byte character.
1833
1833
1834 For example, "\x8bL\x98^" (translation of "record" in ja_JP.cp932)
1834 For example, "\x8bL\x98^" (translation of "record" in ja_JP.cp932)
1835 contains 0x4c (L). str.lower() replaces 0x4c(L) by 0x6c(l) and this
1835 contains 0x4c (L). str.lower() replaces 0x4c(L) by 0x6c(l) and this
1836 replacement makes message meaningless.
1836 replacement makes message meaningless.
1837
1837
1838 This tests that section lookup by translated string isn't broken by
1838 This tests that section lookup by translated string isn't broken by
1839 such str.lower().
1839 such str.lower().
1840
1840
1841 $ "$PYTHON" <<EOF
1841 $ "$PYTHON" <<EOF
1842 > def escape(s):
1842 > def escape(s):
1843 > return b''.join(b'\\u%x' % ord(uc) for uc in s.decode('cp932'))
1843 > return b''.join(b'\\u%x' % ord(uc) for uc in s.decode('cp932'))
1844 > # translation of "record" in ja_JP.cp932
1844 > # translation of "record" in ja_JP.cp932
1845 > upper = b"\x8bL\x98^"
1845 > upper = b"\x8bL\x98^"
1846 > # str.lower()-ed section name should be treated as different one
1846 > # str.lower()-ed section name should be treated as different one
1847 > lower = b"\x8bl\x98^"
1847 > lower = b"\x8bl\x98^"
1848 > with open('ambiguous.py', 'wb') as fp:
1848 > with open('ambiguous.py', 'wb') as fp:
1849 > fp.write(b"""# ambiguous section names in ja_JP.cp932
1849 > fp.write(b"""# ambiguous section names in ja_JP.cp932
1850 > u'''summary of extension
1850 > u'''summary of extension
1851 >
1851 >
1852 > %s
1852 > %s
1853 > ----
1853 > ----
1854 >
1854 >
1855 > Upper name should show only this message
1855 > Upper name should show only this message
1856 >
1856 >
1857 > %s
1857 > %s
1858 > ----
1858 > ----
1859 >
1859 >
1860 > Lower name should show only this message
1860 > Lower name should show only this message
1861 >
1861 >
1862 > subsequent section
1862 > subsequent section
1863 > ------------------
1863 > ------------------
1864 >
1864 >
1865 > This should be hidden at 'hg help ambiguous' with section name.
1865 > This should be hidden at 'hg help ambiguous' with section name.
1866 > '''
1866 > '''
1867 > """ % (escape(upper), escape(lower)))
1867 > """ % (escape(upper), escape(lower)))
1868 > EOF
1868 > EOF
1869
1869
1870 $ cat >> $HGRCPATH <<EOF
1870 $ cat >> $HGRCPATH <<EOF
1871 > [extensions]
1871 > [extensions]
1872 > ambiguous = ./ambiguous.py
1872 > ambiguous = ./ambiguous.py
1873 > EOF
1873 > EOF
1874
1874
1875 $ "$PYTHON" <<EOF | sh
1875 $ "$PYTHON" <<EOF | sh
1876 > from mercurial import pycompat
1876 > from mercurial import pycompat
1877 > upper = b"\x8bL\x98^"
1877 > upper = b"\x8bL\x98^"
1878 > pycompat.stdout.write(b"hg --encoding cp932 help -e ambiguous.%s\n" % upper)
1878 > pycompat.stdout.write(b"hg --encoding cp932 help -e ambiguous.%s\n" % upper)
1879 > EOF
1879 > EOF
1880 \x8bL\x98^ (esc)
1880 \x8bL\x98^ (esc)
1881 ----
1881 ----
1882
1882
1883 Upper name should show only this message
1883 Upper name should show only this message
1884
1884
1885
1885
1886 $ "$PYTHON" <<EOF | sh
1886 $ "$PYTHON" <<EOF | sh
1887 > from mercurial import pycompat
1887 > from mercurial import pycompat
1888 > lower = b"\x8bl\x98^"
1888 > lower = b"\x8bl\x98^"
1889 > pycompat.stdout.write(b"hg --encoding cp932 help -e ambiguous.%s\n" % lower)
1889 > pycompat.stdout.write(b"hg --encoding cp932 help -e ambiguous.%s\n" % lower)
1890 > EOF
1890 > EOF
1891 \x8bl\x98^ (esc)
1891 \x8bl\x98^ (esc)
1892 ----
1892 ----
1893
1893
1894 Lower name should show only this message
1894 Lower name should show only this message
1895
1895
1896
1896
1897 $ cat >> $HGRCPATH <<EOF
1897 $ cat >> $HGRCPATH <<EOF
1898 > [extensions]
1898 > [extensions]
1899 > ambiguous = !
1899 > ambiguous = !
1900 > EOF
1900 > EOF
1901
1901
1902 Show help content of disabled extensions
1902 Show help content of disabled extensions
1903
1903
1904 $ cat >> $HGRCPATH <<EOF
1904 $ cat >> $HGRCPATH <<EOF
1905 > [extensions]
1905 > [extensions]
1906 > ambiguous = !./ambiguous.py
1906 > ambiguous = !./ambiguous.py
1907 > EOF
1907 > EOF
1908 $ hg help -e ambiguous
1908 $ hg help -e ambiguous
1909 ambiguous extension - (no help text available)
1909 ambiguous extension - (no help text available)
1910
1910
1911 (use 'hg help extensions' for information on enabling extensions)
1911 (use 'hg help extensions' for information on enabling extensions)
1912
1912
1913 Test dynamic list of merge tools only shows up once
1913 Test dynamic list of merge tools only shows up once
1914 $ hg help merge-tools
1914 $ hg help merge-tools
1915 Merge Tools
1915 Merge Tools
1916 """""""""""
1916 """""""""""
1917
1917
1918 To merge files Mercurial uses merge tools.
1918 To merge files Mercurial uses merge tools.
1919
1919
1920 A merge tool combines two different versions of a file into a merged file.
1920 A merge tool combines two different versions of a file into a merged file.
1921 Merge tools are given the two files and the greatest common ancestor of
1921 Merge tools are given the two files and the greatest common ancestor of
1922 the two file versions, so they can determine the changes made on both
1922 the two file versions, so they can determine the changes made on both
1923 branches.
1923 branches.
1924
1924
1925 Merge tools are used both for 'hg resolve', 'hg merge', 'hg update', 'hg
1925 Merge tools are used both for 'hg resolve', 'hg merge', 'hg update', 'hg
1926 backout' and in several extensions.
1926 backout' and in several extensions.
1927
1927
1928 Usually, the merge tool tries to automatically reconcile the files by
1928 Usually, the merge tool tries to automatically reconcile the files by
1929 combining all non-overlapping changes that occurred separately in the two
1929 combining all non-overlapping changes that occurred separately in the two
1930 different evolutions of the same initial base file. Furthermore, some
1930 different evolutions of the same initial base file. Furthermore, some
1931 interactive merge programs make it easier to manually resolve conflicting
1931 interactive merge programs make it easier to manually resolve conflicting
1932 merges, either in a graphical way, or by inserting some conflict markers.
1932 merges, either in a graphical way, or by inserting some conflict markers.
1933 Mercurial does not include any interactive merge programs but relies on
1933 Mercurial does not include any interactive merge programs but relies on
1934 external tools for that.
1934 external tools for that.
1935
1935
1936 Available merge tools
1936 Available merge tools
1937 =====================
1937 =====================
1938
1938
1939 External merge tools and their properties are configured in the merge-
1939 External merge tools and their properties are configured in the merge-
1940 tools configuration section - see hgrc(5) - but they can often just be
1940 tools configuration section - see hgrc(5) - but they can often just be
1941 named by their executable.
1941 named by their executable.
1942
1942
1943 A merge tool is generally usable if its executable can be found on the
1943 A merge tool is generally usable if its executable can be found on the
1944 system and if it can handle the merge. The executable is found if it is an
1944 system and if it can handle the merge. The executable is found if it is an
1945 absolute or relative executable path or the name of an application in the
1945 absolute or relative executable path or the name of an application in the
1946 executable search path. The tool is assumed to be able to handle the merge
1946 executable search path. The tool is assumed to be able to handle the merge
1947 if it can handle symlinks if the file is a symlink, if it can handle
1947 if it can handle symlinks if the file is a symlink, if it can handle
1948 binary files if the file is binary, and if a GUI is available if the tool
1948 binary files if the file is binary, and if a GUI is available if the tool
1949 requires a GUI.
1949 requires a GUI.
1950
1950
1951 There are some internal merge tools which can be used. The internal merge
1951 There are some internal merge tools which can be used. The internal merge
1952 tools are:
1952 tools are:
1953
1953
1954 ":dump"
1954 ":dump"
1955 Creates three versions of the files to merge, containing the contents of
1955 Creates three versions of the files to merge, containing the contents of
1956 local, other and base. These files can then be used to perform a merge
1956 local, other and base. These files can then be used to perform a merge
1957 manually. If the file to be merged is named "a.txt", these files will
1957 manually. If the file to be merged is named "a.txt", these files will
1958 accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and
1958 accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and
1959 they will be placed in the same directory as "a.txt".
1959 they will be placed in the same directory as "a.txt".
1960
1960
1961 This implies premerge. Therefore, files aren't dumped, if premerge runs
1961 This implies premerge. Therefore, files aren't dumped, if premerge runs
1962 successfully. Use :forcedump to forcibly write files out.
1962 successfully. Use :forcedump to forcibly write files out.
1963
1963
1964 (actual capabilities: binary, symlink)
1964 (actual capabilities: binary, symlink)
1965
1965
1966 ":fail"
1966 ":fail"
1967 Rather than attempting to merge files that were modified on both
1967 Rather than attempting to merge files that were modified on both
1968 branches, it marks them as unresolved. The resolve command must be used
1968 branches, it marks them as unresolved. The resolve command must be used
1969 to resolve these conflicts.
1969 to resolve these conflicts.
1970
1970
1971 (actual capabilities: binary, symlink)
1971 (actual capabilities: binary, symlink)
1972
1972
1973 ":forcedump"
1973 ":forcedump"
1974 Creates three versions of the files as same as :dump, but omits
1974 Creates three versions of the files as same as :dump, but omits
1975 premerge.
1975 premerge.
1976
1976
1977 (actual capabilities: binary, symlink)
1977 (actual capabilities: binary, symlink)
1978
1978
1979 ":local"
1979 ":local"
1980 Uses the local 'p1()' version of files as the merged version.
1980 Uses the local 'p1()' version of files as the merged version.
1981
1981
1982 (actual capabilities: binary, symlink)
1982 (actual capabilities: binary, symlink)
1983
1983
1984 ":merge"
1984 ":merge"
1985 Uses the internal non-interactive simple merge algorithm for merging
1985 Uses the internal non-interactive simple merge algorithm for merging
1986 files. It will fail if there are any conflicts and leave markers in the
1986 files. It will fail if there are any conflicts and leave markers in the
1987 partially merged file. Markers will have two sections, one for each side
1987 partially merged file. Markers will have two sections, one for each side
1988 of merge.
1988 of merge.
1989
1989
1990 ":merge-local"
1990 ":merge-local"
1991 Like :merge, but resolve all conflicts non-interactively in favor of the
1991 Like :merge, but resolve all conflicts non-interactively in favor of the
1992 local 'p1()' changes.
1992 local 'p1()' changes.
1993
1993
1994 ":merge-other"
1994 ":merge-other"
1995 Like :merge, but resolve all conflicts non-interactively in favor of the
1995 Like :merge, but resolve all conflicts non-interactively in favor of the
1996 other 'p2()' changes.
1996 other 'p2()' changes.
1997
1997
1998 ":merge3"
1998 ":merge3"
1999 Uses the internal non-interactive simple merge algorithm for merging
1999 Uses the internal non-interactive simple merge algorithm for merging
2000 files. It will fail if there are any conflicts and leave markers in the
2000 files. It will fail if there are any conflicts and leave markers in the
2001 partially merged file. Marker will have three sections, one from each
2001 partially merged file. Marker will have three sections, one from each
2002 side of the merge and one for the base content.
2002 side of the merge and one for the base content.
2003
2003
2004 ":other"
2004 ":other"
2005 Uses the other 'p2()' version of files as the merged version.
2005 Uses the other 'p2()' version of files as the merged version.
2006
2006
2007 (actual capabilities: binary, symlink)
2007 (actual capabilities: binary, symlink)
2008
2008
2009 ":prompt"
2009 ":prompt"
2010 Asks the user which of the local 'p1()' or the other 'p2()' version to
2010 Asks the user which of the local 'p1()' or the other 'p2()' version to
2011 keep as the merged version.
2011 keep as the merged version.
2012
2012
2013 (actual capabilities: binary, symlink)
2013 (actual capabilities: binary, symlink)
2014
2014
2015 ":tagmerge"
2015 ":tagmerge"
2016 Uses the internal tag merge algorithm (experimental).
2016 Uses the internal tag merge algorithm (experimental).
2017
2017
2018 ":union"
2018 ":union"
2019 Uses the internal non-interactive simple merge algorithm for merging
2019 Uses the internal non-interactive simple merge algorithm for merging
2020 files. It will use both left and right sides for conflict regions. No
2020 files. It will use both left and right sides for conflict regions. No
2021 markers are inserted.
2021 markers are inserted.
2022
2022
2023 Internal tools are always available and do not require a GUI but will by
2023 Internal tools are always available and do not require a GUI but will by
2024 default not handle symlinks or binary files. See next section for detail
2024 default not handle symlinks or binary files. See next section for detail
2025 about "actual capabilities" described above.
2025 about "actual capabilities" described above.
2026
2026
2027 Choosing a merge tool
2027 Choosing a merge tool
2028 =====================
2028 =====================
2029
2029
2030 Mercurial uses these rules when deciding which merge tool to use:
2030 Mercurial uses these rules when deciding which merge tool to use:
2031
2031
2032 1. If a tool has been specified with the --tool option to merge or
2032 1. If a tool has been specified with the --tool option to merge or
2033 resolve, it is used. If it is the name of a tool in the merge-tools
2033 resolve, it is used. If it is the name of a tool in the merge-tools
2034 configuration, its configuration is used. Otherwise the specified tool
2034 configuration, its configuration is used. Otherwise the specified tool
2035 must be executable by the shell.
2035 must be executable by the shell.
2036 2. If the "HGMERGE" environment variable is present, its value is used and
2036 2. If the "HGMERGE" environment variable is present, its value is used and
2037 must be executable by the shell.
2037 must be executable by the shell.
2038 3. If the filename of the file to be merged matches any of the patterns in
2038 3. If the filename of the file to be merged matches any of the patterns in
2039 the merge-patterns configuration section, the first usable merge tool
2039 the merge-patterns configuration section, the first usable merge tool
2040 corresponding to a matching pattern is used.
2040 corresponding to a matching pattern is used.
2041 4. If ui.merge is set it will be considered next. If the value is not the
2041 4. If ui.merge is set it will be considered next. If the value is not the
2042 name of a configured tool, the specified value is used and must be
2042 name of a configured tool, the specified value is used and must be
2043 executable by the shell. Otherwise the named tool is used if it is
2043 executable by the shell. Otherwise the named tool is used if it is
2044 usable.
2044 usable.
2045 5. If any usable merge tools are present in the merge-tools configuration
2045 5. If any usable merge tools are present in the merge-tools configuration
2046 section, the one with the highest priority is used.
2046 section, the one with the highest priority is used.
2047 6. If a program named "hgmerge" can be found on the system, it is used -
2047 6. If a program named "hgmerge" can be found on the system, it is used -
2048 but it will by default not be used for symlinks and binary files.
2048 but it will by default not be used for symlinks and binary files.
2049 7. If the file to be merged is not binary and is not a symlink, then
2049 7. If the file to be merged is not binary and is not a symlink, then
2050 internal ":merge" is used.
2050 internal ":merge" is used.
2051 8. Otherwise, ":prompt" is used.
2051 8. Otherwise, ":prompt" is used.
2052
2052
2053 For historical reason, Mercurial treats merge tools as below while
2053 For historical reason, Mercurial treats merge tools as below while
2054 examining rules above.
2054 examining rules above.
2055
2055
2056 step specified via binary symlink
2056 step specified via binary symlink
2057 ----------------------------------
2057 ----------------------------------
2058 1. --tool o/o o/o
2058 1. --tool o/o o/o
2059 2. HGMERGE o/o o/o
2059 2. HGMERGE o/o o/o
2060 3. merge-patterns o/o(*) x/?(*)
2060 3. merge-patterns o/o(*) x/?(*)
2061 4. ui.merge x/?(*) x/?(*)
2061 4. ui.merge x/?(*) x/?(*)
2062
2062
2063 Each capability column indicates Mercurial behavior for internal/external
2063 Each capability column indicates Mercurial behavior for internal/external
2064 merge tools at examining each rule.
2064 merge tools at examining each rule.
2065
2065
2066 - "o": "assume that a tool has capability"
2066 - "o": "assume that a tool has capability"
2067 - "x": "assume that a tool does not have capability"
2067 - "x": "assume that a tool does not have capability"
2068 - "?": "check actual capability of a tool"
2068 - "?": "check actual capability of a tool"
2069
2069
2070 If "merge.strict-capability-check" configuration is true, Mercurial checks
2070 If "merge.strict-capability-check" configuration is true, Mercurial checks
2071 capabilities of merge tools strictly in (*) cases above (= each capability
2071 capabilities of merge tools strictly in (*) cases above (= each capability
2072 column becomes "?/?"). It is false by default for backward compatibility.
2072 column becomes "?/?"). It is false by default for backward compatibility.
2073
2073
2074 Note:
2074 Note:
2075 After selecting a merge program, Mercurial will by default attempt to
2075 After selecting a merge program, Mercurial will by default attempt to
2076 merge the files using a simple merge algorithm first. Only if it
2076 merge the files using a simple merge algorithm first. Only if it
2077 doesn't succeed because of conflicting changes will Mercurial actually
2077 doesn't succeed because of conflicting changes will Mercurial actually
2078 execute the merge program. Whether to use the simple merge algorithm
2078 execute the merge program. Whether to use the simple merge algorithm
2079 first can be controlled by the premerge setting of the merge tool.
2079 first can be controlled by the premerge setting of the merge tool.
2080 Premerge is enabled by default unless the file is binary or a symlink.
2080 Premerge is enabled by default unless the file is binary or a symlink.
2081
2081
2082 See the merge-tools and ui sections of hgrc(5) for details on the
2082 See the merge-tools and ui sections of hgrc(5) for details on the
2083 configuration of merge tools.
2083 configuration of merge tools.
2084
2084
2085 Compression engines listed in `hg help bundlespec`
2085 Compression engines listed in `hg help bundlespec`
2086
2086
2087 $ hg help bundlespec | grep gzip
2087 $ hg help bundlespec | grep gzip
2088 "v1" bundles can only use the "gzip", "bzip2", and "none" compression
2088 "v1" bundles can only use the "gzip", "bzip2", and "none" compression
2089 An algorithm that produces smaller bundles than "gzip".
2089 An algorithm that produces smaller bundles than "gzip".
2090 This engine will likely produce smaller bundles than "gzip" but will be
2090 This engine will likely produce smaller bundles than "gzip" but will be
2091 "gzip"
2091 "gzip"
2092 better compression than "gzip". It also frequently yields better (?)
2092 better compression than "gzip". It also frequently yields better (?)
2093
2093
2094 Test usage of section marks in help documents
2094 Test usage of section marks in help documents
2095
2095
2096 $ cd "$TESTDIR"/../doc
2096 $ cd "$TESTDIR"/../doc
2097 $ "$PYTHON" check-seclevel.py
2097 $ "$PYTHON" check-seclevel.py
2098 $ cd $TESTTMP
2098 $ cd $TESTTMP
2099
2099
2100 #if serve
2100 #if serve
2101
2101
2102 Test the help pages in hgweb.
2102 Test the help pages in hgweb.
2103
2103
2104 Dish up an empty repo; serve it cold.
2104 Dish up an empty repo; serve it cold.
2105
2105
2106 $ hg init "$TESTTMP/test"
2106 $ hg init "$TESTTMP/test"
2107 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
2107 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
2108 $ cat hg.pid >> $DAEMON_PIDS
2108 $ cat hg.pid >> $DAEMON_PIDS
2109
2109
2110 $ get-with-headers.py $LOCALIP:$HGPORT "help"
2110 $ get-with-headers.py $LOCALIP:$HGPORT "help"
2111 200 Script output follows
2111 200 Script output follows
2112
2112
2113 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2113 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2114 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2114 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2115 <head>
2115 <head>
2116 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2116 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2117 <meta name="robots" content="index, nofollow" />
2117 <meta name="robots" content="index, nofollow" />
2118 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2118 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2119 <script type="text/javascript" src="/static/mercurial.js"></script>
2119 <script type="text/javascript" src="/static/mercurial.js"></script>
2120
2120
2121 <title>Help: Index</title>
2121 <title>Help: Index</title>
2122 </head>
2122 </head>
2123 <body>
2123 <body>
2124
2124
2125 <div class="container">
2125 <div class="container">
2126 <div class="menu">
2126 <div class="menu">
2127 <div class="logo">
2127 <div class="logo">
2128 <a href="https://mercurial-scm.org/">
2128 <a href="https://mercurial-scm.org/">
2129 <img src="/static/hglogo.png" alt="mercurial" /></a>
2129 <img src="/static/hglogo.png" alt="mercurial" /></a>
2130 </div>
2130 </div>
2131 <ul>
2131 <ul>
2132 <li><a href="/shortlog">log</a></li>
2132 <li><a href="/shortlog">log</a></li>
2133 <li><a href="/graph">graph</a></li>
2133 <li><a href="/graph">graph</a></li>
2134 <li><a href="/tags">tags</a></li>
2134 <li><a href="/tags">tags</a></li>
2135 <li><a href="/bookmarks">bookmarks</a></li>
2135 <li><a href="/bookmarks">bookmarks</a></li>
2136 <li><a href="/branches">branches</a></li>
2136 <li><a href="/branches">branches</a></li>
2137 </ul>
2137 </ul>
2138 <ul>
2138 <ul>
2139 <li class="active">help</li>
2139 <li class="active">help</li>
2140 </ul>
2140 </ul>
2141 </div>
2141 </div>
2142
2142
2143 <div class="main">
2143 <div class="main">
2144 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2144 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2145
2145
2146 <form class="search" action="/log">
2146 <form class="search" action="/log">
2147
2147
2148 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2148 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2149 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2149 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2150 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2150 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2151 </form>
2151 </form>
2152 <table class="bigtable">
2152 <table class="bigtable">
2153 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
2153 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
2154
2154
2155 <tr><td>
2155 <tr><td>
2156 <a href="/help/bundlespec">
2156 <a href="/help/bundlespec">
2157 bundlespec
2157 bundlespec
2158 </a>
2158 </a>
2159 </td><td>
2159 </td><td>
2160 Bundle File Formats
2160 Bundle File Formats
2161 </td></tr>
2161 </td></tr>
2162 <tr><td>
2162 <tr><td>
2163 <a href="/help/color">
2163 <a href="/help/color">
2164 color
2164 color
2165 </a>
2165 </a>
2166 </td><td>
2166 </td><td>
2167 Colorizing Outputs
2167 Colorizing Outputs
2168 </td></tr>
2168 </td></tr>
2169 <tr><td>
2169 <tr><td>
2170 <a href="/help/config">
2170 <a href="/help/config">
2171 config
2171 config
2172 </a>
2172 </a>
2173 </td><td>
2173 </td><td>
2174 Configuration Files
2174 Configuration Files
2175 </td></tr>
2175 </td></tr>
2176 <tr><td>
2176 <tr><td>
2177 <a href="/help/dates">
2177 <a href="/help/dates">
2178 dates
2178 dates
2179 </a>
2179 </a>
2180 </td><td>
2180 </td><td>
2181 Date Formats
2181 Date Formats
2182 </td></tr>
2182 </td></tr>
2183 <tr><td>
2183 <tr><td>
2184 <a href="/help/deprecated">
2184 <a href="/help/deprecated">
2185 deprecated
2185 deprecated
2186 </a>
2186 </a>
2187 </td><td>
2187 </td><td>
2188 Deprecated Features
2188 Deprecated Features
2189 </td></tr>
2189 </td></tr>
2190 <tr><td>
2190 <tr><td>
2191 <a href="/help/diffs">
2191 <a href="/help/diffs">
2192 diffs
2192 diffs
2193 </a>
2193 </a>
2194 </td><td>
2194 </td><td>
2195 Diff Formats
2195 Diff Formats
2196 </td></tr>
2196 </td></tr>
2197 <tr><td>
2197 <tr><td>
2198 <a href="/help/environment">
2198 <a href="/help/environment">
2199 environment
2199 environment
2200 </a>
2200 </a>
2201 </td><td>
2201 </td><td>
2202 Environment Variables
2202 Environment Variables
2203 </td></tr>
2203 </td></tr>
2204 <tr><td>
2204 <tr><td>
2205 <a href="/help/extensions">
2205 <a href="/help/extensions">
2206 extensions
2206 extensions
2207 </a>
2207 </a>
2208 </td><td>
2208 </td><td>
2209 Using Additional Features
2209 Using Additional Features
2210 </td></tr>
2210 </td></tr>
2211 <tr><td>
2211 <tr><td>
2212 <a href="/help/filesets">
2212 <a href="/help/filesets">
2213 filesets
2213 filesets
2214 </a>
2214 </a>
2215 </td><td>
2215 </td><td>
2216 Specifying File Sets
2216 Specifying File Sets
2217 </td></tr>
2217 </td></tr>
2218 <tr><td>
2218 <tr><td>
2219 <a href="/help/flags">
2219 <a href="/help/flags">
2220 flags
2220 flags
2221 </a>
2221 </a>
2222 </td><td>
2222 </td><td>
2223 Command-line flags
2223 Command-line flags
2224 </td></tr>
2224 </td></tr>
2225 <tr><td>
2225 <tr><td>
2226 <a href="/help/glossary">
2226 <a href="/help/glossary">
2227 glossary
2227 glossary
2228 </a>
2228 </a>
2229 </td><td>
2229 </td><td>
2230 Glossary
2230 Glossary
2231 </td></tr>
2231 </td></tr>
2232 <tr><td>
2232 <tr><td>
2233 <a href="/help/hgignore">
2233 <a href="/help/hgignore">
2234 hgignore
2234 hgignore
2235 </a>
2235 </a>
2236 </td><td>
2236 </td><td>
2237 Syntax for Mercurial Ignore Files
2237 Syntax for Mercurial Ignore Files
2238 </td></tr>
2238 </td></tr>
2239 <tr><td>
2239 <tr><td>
2240 <a href="/help/hgweb">
2240 <a href="/help/hgweb">
2241 hgweb
2241 hgweb
2242 </a>
2242 </a>
2243 </td><td>
2243 </td><td>
2244 Configuring hgweb
2244 Configuring hgweb
2245 </td></tr>
2245 </td></tr>
2246 <tr><td>
2246 <tr><td>
2247 <a href="/help/internals">
2247 <a href="/help/internals">
2248 internals
2248 internals
2249 </a>
2249 </a>
2250 </td><td>
2250 </td><td>
2251 Technical implementation topics
2251 Technical implementation topics
2252 </td></tr>
2252 </td></tr>
2253 <tr><td>
2253 <tr><td>
2254 <a href="/help/merge-tools">
2254 <a href="/help/merge-tools">
2255 merge-tools
2255 merge-tools
2256 </a>
2256 </a>
2257 </td><td>
2257 </td><td>
2258 Merge Tools
2258 Merge Tools
2259 </td></tr>
2259 </td></tr>
2260 <tr><td>
2260 <tr><td>
2261 <a href="/help/pager">
2261 <a href="/help/pager">
2262 pager
2262 pager
2263 </a>
2263 </a>
2264 </td><td>
2264 </td><td>
2265 Pager Support
2265 Pager Support
2266 </td></tr>
2266 </td></tr>
2267 <tr><td>
2267 <tr><td>
2268 <a href="/help/patterns">
2268 <a href="/help/patterns">
2269 patterns
2269 patterns
2270 </a>
2270 </a>
2271 </td><td>
2271 </td><td>
2272 File Name Patterns
2272 File Name Patterns
2273 </td></tr>
2273 </td></tr>
2274 <tr><td>
2274 <tr><td>
2275 <a href="/help/phases">
2275 <a href="/help/phases">
2276 phases
2276 phases
2277 </a>
2277 </a>
2278 </td><td>
2278 </td><td>
2279 Working with Phases
2279 Working with Phases
2280 </td></tr>
2280 </td></tr>
2281 <tr><td>
2281 <tr><td>
2282 <a href="/help/revisions">
2282 <a href="/help/revisions">
2283 revisions
2283 revisions
2284 </a>
2284 </a>
2285 </td><td>
2285 </td><td>
2286 Specifying Revisions
2286 Specifying Revisions
2287 </td></tr>
2287 </td></tr>
2288 <tr><td>
2288 <tr><td>
2289 <a href="/help/scripting">
2289 <a href="/help/scripting">
2290 scripting
2290 scripting
2291 </a>
2291 </a>
2292 </td><td>
2292 </td><td>
2293 Using Mercurial from scripts and automation
2293 Using Mercurial from scripts and automation
2294 </td></tr>
2294 </td></tr>
2295 <tr><td>
2295 <tr><td>
2296 <a href="/help/subrepos">
2296 <a href="/help/subrepos">
2297 subrepos
2297 subrepos
2298 </a>
2298 </a>
2299 </td><td>
2299 </td><td>
2300 Subrepositories
2300 Subrepositories
2301 </td></tr>
2301 </td></tr>
2302 <tr><td>
2302 <tr><td>
2303 <a href="/help/templating">
2303 <a href="/help/templating">
2304 templating
2304 templating
2305 </a>
2305 </a>
2306 </td><td>
2306 </td><td>
2307 Template Usage
2307 Template Usage
2308 </td></tr>
2308 </td></tr>
2309 <tr><td>
2309 <tr><td>
2310 <a href="/help/urls">
2310 <a href="/help/urls">
2311 urls
2311 urls
2312 </a>
2312 </a>
2313 </td><td>
2313 </td><td>
2314 URL Paths
2314 URL Paths
2315 </td></tr>
2315 </td></tr>
2316 <tr><td>
2316 <tr><td>
2317 <a href="/help/topic-containing-verbose">
2317 <a href="/help/topic-containing-verbose">
2318 topic-containing-verbose
2318 topic-containing-verbose
2319 </a>
2319 </a>
2320 </td><td>
2320 </td><td>
2321 This is the topic to test omit indicating.
2321 This is the topic to test omit indicating.
2322 </td></tr>
2322 </td></tr>
2323
2323
2324
2324
2325 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
2325 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
2326
2326
2327 <tr><td>
2327 <tr><td>
2328 <a href="/help/add">
2328 <a href="/help/add">
2329 add
2329 add
2330 </a>
2330 </a>
2331 </td><td>
2331 </td><td>
2332 add the specified files on the next commit
2332 add the specified files on the next commit
2333 </td></tr>
2333 </td></tr>
2334 <tr><td>
2334 <tr><td>
2335 <a href="/help/annotate">
2335 <a href="/help/annotate">
2336 annotate
2336 annotate
2337 </a>
2337 </a>
2338 </td><td>
2338 </td><td>
2339 show changeset information by line for each file
2339 show changeset information by line for each file
2340 </td></tr>
2340 </td></tr>
2341 <tr><td>
2341 <tr><td>
2342 <a href="/help/clone">
2342 <a href="/help/clone">
2343 clone
2343 clone
2344 </a>
2344 </a>
2345 </td><td>
2345 </td><td>
2346 make a copy of an existing repository
2346 make a copy of an existing repository
2347 </td></tr>
2347 </td></tr>
2348 <tr><td>
2348 <tr><td>
2349 <a href="/help/commit">
2349 <a href="/help/commit">
2350 commit
2350 commit
2351 </a>
2351 </a>
2352 </td><td>
2352 </td><td>
2353 commit the specified files or all outstanding changes
2353 commit the specified files or all outstanding changes
2354 </td></tr>
2354 </td></tr>
2355 <tr><td>
2355 <tr><td>
2356 <a href="/help/diff">
2356 <a href="/help/diff">
2357 diff
2357 diff
2358 </a>
2358 </a>
2359 </td><td>
2359 </td><td>
2360 diff repository (or selected files)
2360 diff repository (or selected files)
2361 </td></tr>
2361 </td></tr>
2362 <tr><td>
2362 <tr><td>
2363 <a href="/help/export">
2363 <a href="/help/export">
2364 export
2364 export
2365 </a>
2365 </a>
2366 </td><td>
2366 </td><td>
2367 dump the header and diffs for one or more changesets
2367 dump the header and diffs for one or more changesets
2368 </td></tr>
2368 </td></tr>
2369 <tr><td>
2369 <tr><td>
2370 <a href="/help/forget">
2370 <a href="/help/forget">
2371 forget
2371 forget
2372 </a>
2372 </a>
2373 </td><td>
2373 </td><td>
2374 forget the specified files on the next commit
2374 forget the specified files on the next commit
2375 </td></tr>
2375 </td></tr>
2376 <tr><td>
2376 <tr><td>
2377 <a href="/help/init">
2377 <a href="/help/init">
2378 init
2378 init
2379 </a>
2379 </a>
2380 </td><td>
2380 </td><td>
2381 create a new repository in the given directory
2381 create a new repository in the given directory
2382 </td></tr>
2382 </td></tr>
2383 <tr><td>
2383 <tr><td>
2384 <a href="/help/log">
2384 <a href="/help/log">
2385 log
2385 log
2386 </a>
2386 </a>
2387 </td><td>
2387 </td><td>
2388 show revision history of entire repository or files
2388 show revision history of entire repository or files
2389 </td></tr>
2389 </td></tr>
2390 <tr><td>
2390 <tr><td>
2391 <a href="/help/merge">
2391 <a href="/help/merge">
2392 merge
2392 merge
2393 </a>
2393 </a>
2394 </td><td>
2394 </td><td>
2395 merge another revision into working directory
2395 merge another revision into working directory
2396 </td></tr>
2396 </td></tr>
2397 <tr><td>
2397 <tr><td>
2398 <a href="/help/pull">
2398 <a href="/help/pull">
2399 pull
2399 pull
2400 </a>
2400 </a>
2401 </td><td>
2401 </td><td>
2402 pull changes from the specified source
2402 pull changes from the specified source
2403 </td></tr>
2403 </td></tr>
2404 <tr><td>
2404 <tr><td>
2405 <a href="/help/push">
2405 <a href="/help/push">
2406 push
2406 push
2407 </a>
2407 </a>
2408 </td><td>
2408 </td><td>
2409 push changes to the specified destination
2409 push changes to the specified destination
2410 </td></tr>
2410 </td></tr>
2411 <tr><td>
2411 <tr><td>
2412 <a href="/help/remove">
2412 <a href="/help/remove">
2413 remove
2413 remove
2414 </a>
2414 </a>
2415 </td><td>
2415 </td><td>
2416 remove the specified files on the next commit
2416 remove the specified files on the next commit
2417 </td></tr>
2417 </td></tr>
2418 <tr><td>
2418 <tr><td>
2419 <a href="/help/serve">
2419 <a href="/help/serve">
2420 serve
2420 serve
2421 </a>
2421 </a>
2422 </td><td>
2422 </td><td>
2423 start stand-alone webserver
2423 start stand-alone webserver
2424 </td></tr>
2424 </td></tr>
2425 <tr><td>
2425 <tr><td>
2426 <a href="/help/status">
2426 <a href="/help/status">
2427 status
2427 status
2428 </a>
2428 </a>
2429 </td><td>
2429 </td><td>
2430 show changed files in the working directory
2430 show changed files in the working directory
2431 </td></tr>
2431 </td></tr>
2432 <tr><td>
2432 <tr><td>
2433 <a href="/help/summary">
2433 <a href="/help/summary">
2434 summary
2434 summary
2435 </a>
2435 </a>
2436 </td><td>
2436 </td><td>
2437 summarize working directory state
2437 summarize working directory state
2438 </td></tr>
2438 </td></tr>
2439 <tr><td>
2439 <tr><td>
2440 <a href="/help/update">
2440 <a href="/help/update">
2441 update
2441 update
2442 </a>
2442 </a>
2443 </td><td>
2443 </td><td>
2444 update working directory (or switch revisions)
2444 update working directory (or switch revisions)
2445 </td></tr>
2445 </td></tr>
2446
2446
2447
2447
2448
2448
2449 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
2449 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
2450
2450
2451 <tr><td>
2451 <tr><td>
2452 <a href="/help/addremove">
2452 <a href="/help/addremove">
2453 addremove
2453 addremove
2454 </a>
2454 </a>
2455 </td><td>
2455 </td><td>
2456 add all new files, delete all missing files
2456 add all new files, delete all missing files
2457 </td></tr>
2457 </td></tr>
2458 <tr><td>
2458 <tr><td>
2459 <a href="/help/archive">
2459 <a href="/help/archive">
2460 archive
2460 archive
2461 </a>
2461 </a>
2462 </td><td>
2462 </td><td>
2463 create an unversioned archive of a repository revision
2463 create an unversioned archive of a repository revision
2464 </td></tr>
2464 </td></tr>
2465 <tr><td>
2465 <tr><td>
2466 <a href="/help/backout">
2466 <a href="/help/backout">
2467 backout
2467 backout
2468 </a>
2468 </a>
2469 </td><td>
2469 </td><td>
2470 reverse effect of earlier changeset
2470 reverse effect of earlier changeset
2471 </td></tr>
2471 </td></tr>
2472 <tr><td>
2472 <tr><td>
2473 <a href="/help/bisect">
2473 <a href="/help/bisect">
2474 bisect
2474 bisect
2475 </a>
2475 </a>
2476 </td><td>
2476 </td><td>
2477 subdivision search of changesets
2477 subdivision search of changesets
2478 </td></tr>
2478 </td></tr>
2479 <tr><td>
2479 <tr><td>
2480 <a href="/help/bookmarks">
2480 <a href="/help/bookmarks">
2481 bookmarks
2481 bookmarks
2482 </a>
2482 </a>
2483 </td><td>
2483 </td><td>
2484 create a new bookmark or list existing bookmarks
2484 create a new bookmark or list existing bookmarks
2485 </td></tr>
2485 </td></tr>
2486 <tr><td>
2486 <tr><td>
2487 <a href="/help/branch">
2487 <a href="/help/branch">
2488 branch
2488 branch
2489 </a>
2489 </a>
2490 </td><td>
2490 </td><td>
2491 set or show the current branch name
2491 set or show the current branch name
2492 </td></tr>
2492 </td></tr>
2493 <tr><td>
2493 <tr><td>
2494 <a href="/help/branches">
2494 <a href="/help/branches">
2495 branches
2495 branches
2496 </a>
2496 </a>
2497 </td><td>
2497 </td><td>
2498 list repository named branches
2498 list repository named branches
2499 </td></tr>
2499 </td></tr>
2500 <tr><td>
2500 <tr><td>
2501 <a href="/help/bundle">
2501 <a href="/help/bundle">
2502 bundle
2502 bundle
2503 </a>
2503 </a>
2504 </td><td>
2504 </td><td>
2505 create a bundle file
2505 create a bundle file
2506 </td></tr>
2506 </td></tr>
2507 <tr><td>
2507 <tr><td>
2508 <a href="/help/cat">
2508 <a href="/help/cat">
2509 cat
2509 cat
2510 </a>
2510 </a>
2511 </td><td>
2511 </td><td>
2512 output the current or given revision of files
2512 output the current or given revision of files
2513 </td></tr>
2513 </td></tr>
2514 <tr><td>
2514 <tr><td>
2515 <a href="/help/config">
2515 <a href="/help/config">
2516 config
2516 config
2517 </a>
2517 </a>
2518 </td><td>
2518 </td><td>
2519 show combined config settings from all hgrc files
2519 show combined config settings from all hgrc files
2520 </td></tr>
2520 </td></tr>
2521 <tr><td>
2521 <tr><td>
2522 <a href="/help/copy">
2522 <a href="/help/copy">
2523 copy
2523 copy
2524 </a>
2524 </a>
2525 </td><td>
2525 </td><td>
2526 mark files as copied for the next commit
2526 mark files as copied for the next commit
2527 </td></tr>
2527 </td></tr>
2528 <tr><td>
2528 <tr><td>
2529 <a href="/help/files">
2529 <a href="/help/files">
2530 files
2530 files
2531 </a>
2531 </a>
2532 </td><td>
2532 </td><td>
2533 list tracked files
2533 list tracked files
2534 </td></tr>
2534 </td></tr>
2535 <tr><td>
2535 <tr><td>
2536 <a href="/help/graft">
2536 <a href="/help/graft">
2537 graft
2537 graft
2538 </a>
2538 </a>
2539 </td><td>
2539 </td><td>
2540 copy changes from other branches onto the current branch
2540 copy changes from other branches onto the current branch
2541 </td></tr>
2541 </td></tr>
2542 <tr><td>
2542 <tr><td>
2543 <a href="/help/grep">
2543 <a href="/help/grep">
2544 grep
2544 grep
2545 </a>
2545 </a>
2546 </td><td>
2546 </td><td>
2547 search revision history for a pattern in specified files
2547 search revision history for a pattern in specified files
2548 </td></tr>
2548 </td></tr>
2549 <tr><td>
2549 <tr><td>
2550 <a href="/help/hashelp">
2550 <a href="/help/hashelp">
2551 hashelp
2551 hashelp
2552 </a>
2552 </a>
2553 </td><td>
2553 </td><td>
2554 Extension command's help
2554 Extension command's help
2555 </td></tr>
2555 </td></tr>
2556 <tr><td>
2556 <tr><td>
2557 <a href="/help/heads">
2557 <a href="/help/heads">
2558 heads
2558 heads
2559 </a>
2559 </a>
2560 </td><td>
2560 </td><td>
2561 show branch heads
2561 show branch heads
2562 </td></tr>
2562 </td></tr>
2563 <tr><td>
2563 <tr><td>
2564 <a href="/help/help">
2564 <a href="/help/help">
2565 help
2565 help
2566 </a>
2566 </a>
2567 </td><td>
2567 </td><td>
2568 show help for a given topic or a help overview
2568 show help for a given topic or a help overview
2569 </td></tr>
2569 </td></tr>
2570 <tr><td>
2570 <tr><td>
2571 <a href="/help/hgalias">
2571 <a href="/help/hgalias">
2572 hgalias
2572 hgalias
2573 </a>
2573 </a>
2574 </td><td>
2574 </td><td>
2575 My doc
2575 My doc
2576 </td></tr>
2576 </td></tr>
2577 <tr><td>
2577 <tr><td>
2578 <a href="/help/hgaliasnodoc">
2578 <a href="/help/hgaliasnodoc">
2579 hgaliasnodoc
2579 hgaliasnodoc
2580 </a>
2580 </a>
2581 </td><td>
2581 </td><td>
2582 summarize working directory state
2582 summarize working directory state
2583 </td></tr>
2583 </td></tr>
2584 <tr><td>
2584 <tr><td>
2585 <a href="/help/identify">
2585 <a href="/help/identify">
2586 identify
2586 identify
2587 </a>
2587 </a>
2588 </td><td>
2588 </td><td>
2589 identify the working directory or specified revision
2589 identify the working directory or specified revision
2590 </td></tr>
2590 </td></tr>
2591 <tr><td>
2591 <tr><td>
2592 <a href="/help/import">
2592 <a href="/help/import">
2593 import
2593 import
2594 </a>
2594 </a>
2595 </td><td>
2595 </td><td>
2596 import an ordered set of patches
2596 import an ordered set of patches
2597 </td></tr>
2597 </td></tr>
2598 <tr><td>
2598 <tr><td>
2599 <a href="/help/incoming">
2599 <a href="/help/incoming">
2600 incoming
2600 incoming
2601 </a>
2601 </a>
2602 </td><td>
2602 </td><td>
2603 show new changesets found in source
2603 show new changesets found in source
2604 </td></tr>
2604 </td></tr>
2605 <tr><td>
2605 <tr><td>
2606 <a href="/help/manifest">
2606 <a href="/help/manifest">
2607 manifest
2607 manifest
2608 </a>
2608 </a>
2609 </td><td>
2609 </td><td>
2610 output the current or given revision of the project manifest
2610 output the current or given revision of the project manifest
2611 </td></tr>
2611 </td></tr>
2612 <tr><td>
2612 <tr><td>
2613 <a href="/help/nohelp">
2613 <a href="/help/nohelp">
2614 nohelp
2614 nohelp
2615 </a>
2615 </a>
2616 </td><td>
2616 </td><td>
2617 (no help text available)
2617 (no help text available)
2618 </td></tr>
2618 </td></tr>
2619 <tr><td>
2619 <tr><td>
2620 <a href="/help/outgoing">
2620 <a href="/help/outgoing">
2621 outgoing
2621 outgoing
2622 </a>
2622 </a>
2623 </td><td>
2623 </td><td>
2624 show changesets not found in the destination
2624 show changesets not found in the destination
2625 </td></tr>
2625 </td></tr>
2626 <tr><td>
2626 <tr><td>
2627 <a href="/help/paths">
2627 <a href="/help/paths">
2628 paths
2628 paths
2629 </a>
2629 </a>
2630 </td><td>
2630 </td><td>
2631 show aliases for remote repositories
2631 show aliases for remote repositories
2632 </td></tr>
2632 </td></tr>
2633 <tr><td>
2633 <tr><td>
2634 <a href="/help/phase">
2634 <a href="/help/phase">
2635 phase
2635 phase
2636 </a>
2636 </a>
2637 </td><td>
2637 </td><td>
2638 set or show the current phase name
2638 set or show the current phase name
2639 </td></tr>
2639 </td></tr>
2640 <tr><td>
2640 <tr><td>
2641 <a href="/help/recover">
2641 <a href="/help/recover">
2642 recover
2642 recover
2643 </a>
2643 </a>
2644 </td><td>
2644 </td><td>
2645 roll back an interrupted transaction
2645 roll back an interrupted transaction
2646 </td></tr>
2646 </td></tr>
2647 <tr><td>
2647 <tr><td>
2648 <a href="/help/rename">
2648 <a href="/help/rename">
2649 rename
2649 rename
2650 </a>
2650 </a>
2651 </td><td>
2651 </td><td>
2652 rename files; equivalent of copy + remove
2652 rename files; equivalent of copy + remove
2653 </td></tr>
2653 </td></tr>
2654 <tr><td>
2654 <tr><td>
2655 <a href="/help/resolve">
2655 <a href="/help/resolve">
2656 resolve
2656 resolve
2657 </a>
2657 </a>
2658 </td><td>
2658 </td><td>
2659 redo merges or set/view the merge status of files
2659 redo merges or set/view the merge status of files
2660 </td></tr>
2660 </td></tr>
2661 <tr><td>
2661 <tr><td>
2662 <a href="/help/revert">
2662 <a href="/help/revert">
2663 revert
2663 revert
2664 </a>
2664 </a>
2665 </td><td>
2665 </td><td>
2666 restore files to their checkout state
2666 restore files to their checkout state
2667 </td></tr>
2667 </td></tr>
2668 <tr><td>
2668 <tr><td>
2669 <a href="/help/root">
2669 <a href="/help/root">
2670 root
2670 root
2671 </a>
2671 </a>
2672 </td><td>
2672 </td><td>
2673 print the root (top) of the current working directory
2673 print the root (top) of the current working directory
2674 </td></tr>
2674 </td></tr>
2675 <tr><td>
2675 <tr><td>
2676 <a href="/help/shellalias">
2676 <a href="/help/shellalias">
2677 shellalias
2677 shellalias
2678 </a>
2678 </a>
2679 </td><td>
2679 </td><td>
2680 (no help text available)
2680 (no help text available)
2681 </td></tr>
2681 </td></tr>
2682 <tr><td>
2682 <tr><td>
2683 <a href="/help/tag">
2683 <a href="/help/tag">
2684 tag
2684 tag
2685 </a>
2685 </a>
2686 </td><td>
2686 </td><td>
2687 add one or more tags for the current or given revision
2687 add one or more tags for the current or given revision
2688 </td></tr>
2688 </td></tr>
2689 <tr><td>
2689 <tr><td>
2690 <a href="/help/tags">
2690 <a href="/help/tags">
2691 tags
2691 tags
2692 </a>
2692 </a>
2693 </td><td>
2693 </td><td>
2694 list repository tags
2694 list repository tags
2695 </td></tr>
2695 </td></tr>
2696 <tr><td>
2696 <tr><td>
2697 <a href="/help/unbundle">
2697 <a href="/help/unbundle">
2698 unbundle
2698 unbundle
2699 </a>
2699 </a>
2700 </td><td>
2700 </td><td>
2701 apply one or more bundle files
2701 apply one or more bundle files
2702 </td></tr>
2702 </td></tr>
2703 <tr><td>
2703 <tr><td>
2704 <a href="/help/verify">
2704 <a href="/help/verify">
2705 verify
2705 verify
2706 </a>
2706 </a>
2707 </td><td>
2707 </td><td>
2708 verify the integrity of the repository
2708 verify the integrity of the repository
2709 </td></tr>
2709 </td></tr>
2710 <tr><td>
2710 <tr><td>
2711 <a href="/help/version">
2711 <a href="/help/version">
2712 version
2712 version
2713 </a>
2713 </a>
2714 </td><td>
2714 </td><td>
2715 output version and copyright information
2715 output version and copyright information
2716 </td></tr>
2716 </td></tr>
2717
2717
2718
2718
2719 </table>
2719 </table>
2720 </div>
2720 </div>
2721 </div>
2721 </div>
2722
2722
2723
2723
2724
2724
2725 </body>
2725 </body>
2726 </html>
2726 </html>
2727
2727
2728
2728
2729 $ get-with-headers.py $LOCALIP:$HGPORT "help/add"
2729 $ get-with-headers.py $LOCALIP:$HGPORT "help/add"
2730 200 Script output follows
2730 200 Script output follows
2731
2731
2732 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2732 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2733 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2733 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2734 <head>
2734 <head>
2735 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2735 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2736 <meta name="robots" content="index, nofollow" />
2736 <meta name="robots" content="index, nofollow" />
2737 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2737 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2738 <script type="text/javascript" src="/static/mercurial.js"></script>
2738 <script type="text/javascript" src="/static/mercurial.js"></script>
2739
2739
2740 <title>Help: add</title>
2740 <title>Help: add</title>
2741 </head>
2741 </head>
2742 <body>
2742 <body>
2743
2743
2744 <div class="container">
2744 <div class="container">
2745 <div class="menu">
2745 <div class="menu">
2746 <div class="logo">
2746 <div class="logo">
2747 <a href="https://mercurial-scm.org/">
2747 <a href="https://mercurial-scm.org/">
2748 <img src="/static/hglogo.png" alt="mercurial" /></a>
2748 <img src="/static/hglogo.png" alt="mercurial" /></a>
2749 </div>
2749 </div>
2750 <ul>
2750 <ul>
2751 <li><a href="/shortlog">log</a></li>
2751 <li><a href="/shortlog">log</a></li>
2752 <li><a href="/graph">graph</a></li>
2752 <li><a href="/graph">graph</a></li>
2753 <li><a href="/tags">tags</a></li>
2753 <li><a href="/tags">tags</a></li>
2754 <li><a href="/bookmarks">bookmarks</a></li>
2754 <li><a href="/bookmarks">bookmarks</a></li>
2755 <li><a href="/branches">branches</a></li>
2755 <li><a href="/branches">branches</a></li>
2756 </ul>
2756 </ul>
2757 <ul>
2757 <ul>
2758 <li class="active"><a href="/help">help</a></li>
2758 <li class="active"><a href="/help">help</a></li>
2759 </ul>
2759 </ul>
2760 </div>
2760 </div>
2761
2761
2762 <div class="main">
2762 <div class="main">
2763 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2763 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2764 <h3>Help: add</h3>
2764 <h3>Help: add</h3>
2765
2765
2766 <form class="search" action="/log">
2766 <form class="search" action="/log">
2767
2767
2768 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2768 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2769 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2769 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2770 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2770 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2771 </form>
2771 </form>
2772 <div id="doc">
2772 <div id="doc">
2773 <p>
2773 <p>
2774 hg add [OPTION]... [FILE]...
2774 hg add [OPTION]... [FILE]...
2775 </p>
2775 </p>
2776 <p>
2776 <p>
2777 add the specified files on the next commit
2777 add the specified files on the next commit
2778 </p>
2778 </p>
2779 <p>
2779 <p>
2780 Schedule files to be version controlled and added to the
2780 Schedule files to be version controlled and added to the
2781 repository.
2781 repository.
2782 </p>
2782 </p>
2783 <p>
2783 <p>
2784 The files will be added to the repository at the next commit. To
2784 The files will be added to the repository at the next commit. To
2785 undo an add before that, see 'hg forget'.
2785 undo an add before that, see 'hg forget'.
2786 </p>
2786 </p>
2787 <p>
2787 <p>
2788 If no names are given, add all files to the repository (except
2788 If no names are given, add all files to the repository (except
2789 files matching &quot;.hgignore&quot;).
2789 files matching &quot;.hgignore&quot;).
2790 </p>
2790 </p>
2791 <p>
2791 <p>
2792 Examples:
2792 Examples:
2793 </p>
2793 </p>
2794 <ul>
2794 <ul>
2795 <li> New (unknown) files are added automatically by 'hg add':
2795 <li> New (unknown) files are added automatically by 'hg add':
2796 <pre>
2796 <pre>
2797 \$ ls (re)
2797 \$ ls (re)
2798 foo.c
2798 foo.c
2799 \$ hg status (re)
2799 \$ hg status (re)
2800 ? foo.c
2800 ? foo.c
2801 \$ hg add (re)
2801 \$ hg add (re)
2802 adding foo.c
2802 adding foo.c
2803 \$ hg status (re)
2803 \$ hg status (re)
2804 A foo.c
2804 A foo.c
2805 </pre>
2805 </pre>
2806 <li> Specific files to be added can be specified:
2806 <li> Specific files to be added can be specified:
2807 <pre>
2807 <pre>
2808 \$ ls (re)
2808 \$ ls (re)
2809 bar.c foo.c
2809 bar.c foo.c
2810 \$ hg status (re)
2810 \$ hg status (re)
2811 ? bar.c
2811 ? bar.c
2812 ? foo.c
2812 ? foo.c
2813 \$ hg add bar.c (re)
2813 \$ hg add bar.c (re)
2814 \$ hg status (re)
2814 \$ hg status (re)
2815 A bar.c
2815 A bar.c
2816 ? foo.c
2816 ? foo.c
2817 </pre>
2817 </pre>
2818 </ul>
2818 </ul>
2819 <p>
2819 <p>
2820 Returns 0 if all files are successfully added.
2820 Returns 0 if all files are successfully added.
2821 </p>
2821 </p>
2822 <p>
2822 <p>
2823 options ([+] can be repeated):
2823 options ([+] can be repeated):
2824 </p>
2824 </p>
2825 <table>
2825 <table>
2826 <tr><td>-I</td>
2826 <tr><td>-I</td>
2827 <td>--include PATTERN [+]</td>
2827 <td>--include PATTERN [+]</td>
2828 <td>include names matching the given patterns</td></tr>
2828 <td>include names matching the given patterns</td></tr>
2829 <tr><td>-X</td>
2829 <tr><td>-X</td>
2830 <td>--exclude PATTERN [+]</td>
2830 <td>--exclude PATTERN [+]</td>
2831 <td>exclude names matching the given patterns</td></tr>
2831 <td>exclude names matching the given patterns</td></tr>
2832 <tr><td>-S</td>
2832 <tr><td>-S</td>
2833 <td>--subrepos</td>
2833 <td>--subrepos</td>
2834 <td>recurse into subrepositories</td></tr>
2834 <td>recurse into subrepositories</td></tr>
2835 <tr><td>-n</td>
2835 <tr><td>-n</td>
2836 <td>--dry-run</td>
2836 <td>--dry-run</td>
2837 <td>do not perform actions, just print output</td></tr>
2837 <td>do not perform actions, just print output</td></tr>
2838 </table>
2838 </table>
2839 <p>
2839 <p>
2840 global options ([+] can be repeated):
2840 global options ([+] can be repeated):
2841 </p>
2841 </p>
2842 <table>
2842 <table>
2843 <tr><td>-R</td>
2843 <tr><td>-R</td>
2844 <td>--repository REPO</td>
2844 <td>--repository REPO</td>
2845 <td>repository root directory or name of overlay bundle file</td></tr>
2845 <td>repository root directory or name of overlay bundle file</td></tr>
2846 <tr><td></td>
2846 <tr><td></td>
2847 <td>--cwd DIR</td>
2847 <td>--cwd DIR</td>
2848 <td>change working directory</td></tr>
2848 <td>change working directory</td></tr>
2849 <tr><td>-y</td>
2849 <tr><td>-y</td>
2850 <td>--noninteractive</td>
2850 <td>--noninteractive</td>
2851 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2851 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2852 <tr><td>-q</td>
2852 <tr><td>-q</td>
2853 <td>--quiet</td>
2853 <td>--quiet</td>
2854 <td>suppress output</td></tr>
2854 <td>suppress output</td></tr>
2855 <tr><td>-v</td>
2855 <tr><td>-v</td>
2856 <td>--verbose</td>
2856 <td>--verbose</td>
2857 <td>enable additional output</td></tr>
2857 <td>enable additional output</td></tr>
2858 <tr><td></td>
2858 <tr><td></td>
2859 <td>--color TYPE</td>
2859 <td>--color TYPE</td>
2860 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2860 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2861 <tr><td></td>
2861 <tr><td></td>
2862 <td>--config CONFIG [+]</td>
2862 <td>--config CONFIG [+]</td>
2863 <td>set/override config option (use 'section.name=value')</td></tr>
2863 <td>set/override config option (use 'section.name=value')</td></tr>
2864 <tr><td></td>
2864 <tr><td></td>
2865 <td>--debug</td>
2865 <td>--debug</td>
2866 <td>enable debugging output</td></tr>
2866 <td>enable debugging output</td></tr>
2867 <tr><td></td>
2867 <tr><td></td>
2868 <td>--debugger</td>
2868 <td>--debugger</td>
2869 <td>start debugger</td></tr>
2869 <td>start debugger</td></tr>
2870 <tr><td></td>
2870 <tr><td></td>
2871 <td>--encoding ENCODE</td>
2871 <td>--encoding ENCODE</td>
2872 <td>set the charset encoding (default: ascii)</td></tr>
2872 <td>set the charset encoding (default: ascii)</td></tr>
2873 <tr><td></td>
2873 <tr><td></td>
2874 <td>--encodingmode MODE</td>
2874 <td>--encodingmode MODE</td>
2875 <td>set the charset encoding mode (default: strict)</td></tr>
2875 <td>set the charset encoding mode (default: strict)</td></tr>
2876 <tr><td></td>
2876 <tr><td></td>
2877 <td>--traceback</td>
2877 <td>--traceback</td>
2878 <td>always print a traceback on exception</td></tr>
2878 <td>always print a traceback on exception</td></tr>
2879 <tr><td></td>
2879 <tr><td></td>
2880 <td>--time</td>
2880 <td>--time</td>
2881 <td>time how long the command takes</td></tr>
2881 <td>time how long the command takes</td></tr>
2882 <tr><td></td>
2882 <tr><td></td>
2883 <td>--profile</td>
2883 <td>--profile</td>
2884 <td>print command execution profile</td></tr>
2884 <td>print command execution profile</td></tr>
2885 <tr><td></td>
2885 <tr><td></td>
2886 <td>--version</td>
2886 <td>--version</td>
2887 <td>output version information and exit</td></tr>
2887 <td>output version information and exit</td></tr>
2888 <tr><td>-h</td>
2888 <tr><td>-h</td>
2889 <td>--help</td>
2889 <td>--help</td>
2890 <td>display help and exit</td></tr>
2890 <td>display help and exit</td></tr>
2891 <tr><td></td>
2891 <tr><td></td>
2892 <td>--[no-]hidden</td>
2892 <td>--hidden</td>
2893 <td>consider hidden changesets (default: off)</td></tr>
2893 <td>consider hidden changesets (default: off)</td></tr>
2894 <tr><td></td>
2894 <tr><td></td>
2895 <td>--pager TYPE</td>
2895 <td>--pager TYPE</td>
2896 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2896 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2897 </table>
2897 </table>
2898
2898
2899 </div>
2899 </div>
2900 </div>
2900 </div>
2901 </div>
2901 </div>
2902
2902
2903
2903
2904
2904
2905 </body>
2905 </body>
2906 </html>
2906 </html>
2907
2907
2908
2908
2909 $ get-with-headers.py $LOCALIP:$HGPORT "help/remove"
2909 $ get-with-headers.py $LOCALIP:$HGPORT "help/remove"
2910 200 Script output follows
2910 200 Script output follows
2911
2911
2912 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2912 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2913 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2913 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2914 <head>
2914 <head>
2915 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2915 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2916 <meta name="robots" content="index, nofollow" />
2916 <meta name="robots" content="index, nofollow" />
2917 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2917 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2918 <script type="text/javascript" src="/static/mercurial.js"></script>
2918 <script type="text/javascript" src="/static/mercurial.js"></script>
2919
2919
2920 <title>Help: remove</title>
2920 <title>Help: remove</title>
2921 </head>
2921 </head>
2922 <body>
2922 <body>
2923
2923
2924 <div class="container">
2924 <div class="container">
2925 <div class="menu">
2925 <div class="menu">
2926 <div class="logo">
2926 <div class="logo">
2927 <a href="https://mercurial-scm.org/">
2927 <a href="https://mercurial-scm.org/">
2928 <img src="/static/hglogo.png" alt="mercurial" /></a>
2928 <img src="/static/hglogo.png" alt="mercurial" /></a>
2929 </div>
2929 </div>
2930 <ul>
2930 <ul>
2931 <li><a href="/shortlog">log</a></li>
2931 <li><a href="/shortlog">log</a></li>
2932 <li><a href="/graph">graph</a></li>
2932 <li><a href="/graph">graph</a></li>
2933 <li><a href="/tags">tags</a></li>
2933 <li><a href="/tags">tags</a></li>
2934 <li><a href="/bookmarks">bookmarks</a></li>
2934 <li><a href="/bookmarks">bookmarks</a></li>
2935 <li><a href="/branches">branches</a></li>
2935 <li><a href="/branches">branches</a></li>
2936 </ul>
2936 </ul>
2937 <ul>
2937 <ul>
2938 <li class="active"><a href="/help">help</a></li>
2938 <li class="active"><a href="/help">help</a></li>
2939 </ul>
2939 </ul>
2940 </div>
2940 </div>
2941
2941
2942 <div class="main">
2942 <div class="main">
2943 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2943 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2944 <h3>Help: remove</h3>
2944 <h3>Help: remove</h3>
2945
2945
2946 <form class="search" action="/log">
2946 <form class="search" action="/log">
2947
2947
2948 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2948 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2949 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2949 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2950 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2950 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2951 </form>
2951 </form>
2952 <div id="doc">
2952 <div id="doc">
2953 <p>
2953 <p>
2954 hg remove [OPTION]... FILE...
2954 hg remove [OPTION]... FILE...
2955 </p>
2955 </p>
2956 <p>
2956 <p>
2957 aliases: rm
2957 aliases: rm
2958 </p>
2958 </p>
2959 <p>
2959 <p>
2960 remove the specified files on the next commit
2960 remove the specified files on the next commit
2961 </p>
2961 </p>
2962 <p>
2962 <p>
2963 Schedule the indicated files for removal from the current branch.
2963 Schedule the indicated files for removal from the current branch.
2964 </p>
2964 </p>
2965 <p>
2965 <p>
2966 This command schedules the files to be removed at the next commit.
2966 This command schedules the files to be removed at the next commit.
2967 To undo a remove before that, see 'hg revert'. To undo added
2967 To undo a remove before that, see 'hg revert'. To undo added
2968 files, see 'hg forget'.
2968 files, see 'hg forget'.
2969 </p>
2969 </p>
2970 <p>
2970 <p>
2971 -A/--after can be used to remove only files that have already
2971 -A/--after can be used to remove only files that have already
2972 been deleted, -f/--force can be used to force deletion, and -Af
2972 been deleted, -f/--force can be used to force deletion, and -Af
2973 can be used to remove files from the next revision without
2973 can be used to remove files from the next revision without
2974 deleting them from the working directory.
2974 deleting them from the working directory.
2975 </p>
2975 </p>
2976 <p>
2976 <p>
2977 The following table details the behavior of remove for different
2977 The following table details the behavior of remove for different
2978 file states (columns) and option combinations (rows). The file
2978 file states (columns) and option combinations (rows). The file
2979 states are Added [A], Clean [C], Modified [M] and Missing [!]
2979 states are Added [A], Clean [C], Modified [M] and Missing [!]
2980 (as reported by 'hg status'). The actions are Warn, Remove
2980 (as reported by 'hg status'). The actions are Warn, Remove
2981 (from branch) and Delete (from disk):
2981 (from branch) and Delete (from disk):
2982 </p>
2982 </p>
2983 <table>
2983 <table>
2984 <tr><td>opt/state</td>
2984 <tr><td>opt/state</td>
2985 <td>A</td>
2985 <td>A</td>
2986 <td>C</td>
2986 <td>C</td>
2987 <td>M</td>
2987 <td>M</td>
2988 <td>!</td></tr>
2988 <td>!</td></tr>
2989 <tr><td>none</td>
2989 <tr><td>none</td>
2990 <td>W</td>
2990 <td>W</td>
2991 <td>RD</td>
2991 <td>RD</td>
2992 <td>W</td>
2992 <td>W</td>
2993 <td>R</td></tr>
2993 <td>R</td></tr>
2994 <tr><td>-f</td>
2994 <tr><td>-f</td>
2995 <td>R</td>
2995 <td>R</td>
2996 <td>RD</td>
2996 <td>RD</td>
2997 <td>RD</td>
2997 <td>RD</td>
2998 <td>R</td></tr>
2998 <td>R</td></tr>
2999 <tr><td>-A</td>
2999 <tr><td>-A</td>
3000 <td>W</td>
3000 <td>W</td>
3001 <td>W</td>
3001 <td>W</td>
3002 <td>W</td>
3002 <td>W</td>
3003 <td>R</td></tr>
3003 <td>R</td></tr>
3004 <tr><td>-Af</td>
3004 <tr><td>-Af</td>
3005 <td>R</td>
3005 <td>R</td>
3006 <td>R</td>
3006 <td>R</td>
3007 <td>R</td>
3007 <td>R</td>
3008 <td>R</td></tr>
3008 <td>R</td></tr>
3009 </table>
3009 </table>
3010 <p>
3010 <p>
3011 <b>Note:</b>
3011 <b>Note:</b>
3012 </p>
3012 </p>
3013 <p>
3013 <p>
3014 'hg remove' never deletes files in Added [A] state from the
3014 'hg remove' never deletes files in Added [A] state from the
3015 working directory, not even if &quot;--force&quot; is specified.
3015 working directory, not even if &quot;--force&quot; is specified.
3016 </p>
3016 </p>
3017 <p>
3017 <p>
3018 Returns 0 on success, 1 if any warnings encountered.
3018 Returns 0 on success, 1 if any warnings encountered.
3019 </p>
3019 </p>
3020 <p>
3020 <p>
3021 options ([+] can be repeated):
3021 options ([+] can be repeated):
3022 </p>
3022 </p>
3023 <table>
3023 <table>
3024 <tr><td>-A</td>
3024 <tr><td>-A</td>
3025 <td>--after</td>
3025 <td>--after</td>
3026 <td>record delete for missing files</td></tr>
3026 <td>record delete for missing files</td></tr>
3027 <tr><td>-f</td>
3027 <tr><td>-f</td>
3028 <td>--force</td>
3028 <td>--force</td>
3029 <td>forget added files, delete modified files</td></tr>
3029 <td>forget added files, delete modified files</td></tr>
3030 <tr><td>-S</td>
3030 <tr><td>-S</td>
3031 <td>--subrepos</td>
3031 <td>--subrepos</td>
3032 <td>recurse into subrepositories</td></tr>
3032 <td>recurse into subrepositories</td></tr>
3033 <tr><td>-I</td>
3033 <tr><td>-I</td>
3034 <td>--include PATTERN [+]</td>
3034 <td>--include PATTERN [+]</td>
3035 <td>include names matching the given patterns</td></tr>
3035 <td>include names matching the given patterns</td></tr>
3036 <tr><td>-X</td>
3036 <tr><td>-X</td>
3037 <td>--exclude PATTERN [+]</td>
3037 <td>--exclude PATTERN [+]</td>
3038 <td>exclude names matching the given patterns</td></tr>
3038 <td>exclude names matching the given patterns</td></tr>
3039 <tr><td>-n</td>
3039 <tr><td>-n</td>
3040 <td>--dry-run</td>
3040 <td>--dry-run</td>
3041 <td>do not perform actions, just print output</td></tr>
3041 <td>do not perform actions, just print output</td></tr>
3042 </table>
3042 </table>
3043 <p>
3043 <p>
3044 global options ([+] can be repeated):
3044 global options ([+] can be repeated):
3045 </p>
3045 </p>
3046 <table>
3046 <table>
3047 <tr><td>-R</td>
3047 <tr><td>-R</td>
3048 <td>--repository REPO</td>
3048 <td>--repository REPO</td>
3049 <td>repository root directory or name of overlay bundle file</td></tr>
3049 <td>repository root directory or name of overlay bundle file</td></tr>
3050 <tr><td></td>
3050 <tr><td></td>
3051 <td>--cwd DIR</td>
3051 <td>--cwd DIR</td>
3052 <td>change working directory</td></tr>
3052 <td>change working directory</td></tr>
3053 <tr><td>-y</td>
3053 <tr><td>-y</td>
3054 <td>--noninteractive</td>
3054 <td>--noninteractive</td>
3055 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
3055 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
3056 <tr><td>-q</td>
3056 <tr><td>-q</td>
3057 <td>--quiet</td>
3057 <td>--quiet</td>
3058 <td>suppress output</td></tr>
3058 <td>suppress output</td></tr>
3059 <tr><td>-v</td>
3059 <tr><td>-v</td>
3060 <td>--verbose</td>
3060 <td>--verbose</td>
3061 <td>enable additional output</td></tr>
3061 <td>enable additional output</td></tr>
3062 <tr><td></td>
3062 <tr><td></td>
3063 <td>--color TYPE</td>
3063 <td>--color TYPE</td>
3064 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
3064 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
3065 <tr><td></td>
3065 <tr><td></td>
3066 <td>--config CONFIG [+]</td>
3066 <td>--config CONFIG [+]</td>
3067 <td>set/override config option (use 'section.name=value')</td></tr>
3067 <td>set/override config option (use 'section.name=value')</td></tr>
3068 <tr><td></td>
3068 <tr><td></td>
3069 <td>--debug</td>
3069 <td>--debug</td>
3070 <td>enable debugging output</td></tr>
3070 <td>enable debugging output</td></tr>
3071 <tr><td></td>
3071 <tr><td></td>
3072 <td>--debugger</td>
3072 <td>--debugger</td>
3073 <td>start debugger</td></tr>
3073 <td>start debugger</td></tr>
3074 <tr><td></td>
3074 <tr><td></td>
3075 <td>--encoding ENCODE</td>
3075 <td>--encoding ENCODE</td>
3076 <td>set the charset encoding (default: ascii)</td></tr>
3076 <td>set the charset encoding (default: ascii)</td></tr>
3077 <tr><td></td>
3077 <tr><td></td>
3078 <td>--encodingmode MODE</td>
3078 <td>--encodingmode MODE</td>
3079 <td>set the charset encoding mode (default: strict)</td></tr>
3079 <td>set the charset encoding mode (default: strict)</td></tr>
3080 <tr><td></td>
3080 <tr><td></td>
3081 <td>--traceback</td>
3081 <td>--traceback</td>
3082 <td>always print a traceback on exception</td></tr>
3082 <td>always print a traceback on exception</td></tr>
3083 <tr><td></td>
3083 <tr><td></td>
3084 <td>--time</td>
3084 <td>--time</td>
3085 <td>time how long the command takes</td></tr>
3085 <td>time how long the command takes</td></tr>
3086 <tr><td></td>
3086 <tr><td></td>
3087 <td>--profile</td>
3087 <td>--profile</td>
3088 <td>print command execution profile</td></tr>
3088 <td>print command execution profile</td></tr>
3089 <tr><td></td>
3089 <tr><td></td>
3090 <td>--version</td>
3090 <td>--version</td>
3091 <td>output version information and exit</td></tr>
3091 <td>output version information and exit</td></tr>
3092 <tr><td>-h</td>
3092 <tr><td>-h</td>
3093 <td>--help</td>
3093 <td>--help</td>
3094 <td>display help and exit</td></tr>
3094 <td>display help and exit</td></tr>
3095 <tr><td></td>
3095 <tr><td></td>
3096 <td>--[no-]hidden</td>
3096 <td>--hidden</td>
3097 <td>consider hidden changesets (default: off)</td></tr>
3097 <td>consider hidden changesets (default: off)</td></tr>
3098 <tr><td></td>
3098 <tr><td></td>
3099 <td>--pager TYPE</td>
3099 <td>--pager TYPE</td>
3100 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
3100 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
3101 </table>
3101 </table>
3102
3102
3103 </div>
3103 </div>
3104 </div>
3104 </div>
3105 </div>
3105 </div>
3106
3106
3107
3107
3108
3108
3109 </body>
3109 </body>
3110 </html>
3110 </html>
3111
3111
3112
3112
3113 $ get-with-headers.py $LOCALIP:$HGPORT "help/dates"
3113 $ get-with-headers.py $LOCALIP:$HGPORT "help/dates"
3114 200 Script output follows
3114 200 Script output follows
3115
3115
3116 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3116 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3117 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3117 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3118 <head>
3118 <head>
3119 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3119 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3120 <meta name="robots" content="index, nofollow" />
3120 <meta name="robots" content="index, nofollow" />
3121 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3121 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3122 <script type="text/javascript" src="/static/mercurial.js"></script>
3122 <script type="text/javascript" src="/static/mercurial.js"></script>
3123
3123
3124 <title>Help: dates</title>
3124 <title>Help: dates</title>
3125 </head>
3125 </head>
3126 <body>
3126 <body>
3127
3127
3128 <div class="container">
3128 <div class="container">
3129 <div class="menu">
3129 <div class="menu">
3130 <div class="logo">
3130 <div class="logo">
3131 <a href="https://mercurial-scm.org/">
3131 <a href="https://mercurial-scm.org/">
3132 <img src="/static/hglogo.png" alt="mercurial" /></a>
3132 <img src="/static/hglogo.png" alt="mercurial" /></a>
3133 </div>
3133 </div>
3134 <ul>
3134 <ul>
3135 <li><a href="/shortlog">log</a></li>
3135 <li><a href="/shortlog">log</a></li>
3136 <li><a href="/graph">graph</a></li>
3136 <li><a href="/graph">graph</a></li>
3137 <li><a href="/tags">tags</a></li>
3137 <li><a href="/tags">tags</a></li>
3138 <li><a href="/bookmarks">bookmarks</a></li>
3138 <li><a href="/bookmarks">bookmarks</a></li>
3139 <li><a href="/branches">branches</a></li>
3139 <li><a href="/branches">branches</a></li>
3140 </ul>
3140 </ul>
3141 <ul>
3141 <ul>
3142 <li class="active"><a href="/help">help</a></li>
3142 <li class="active"><a href="/help">help</a></li>
3143 </ul>
3143 </ul>
3144 </div>
3144 </div>
3145
3145
3146 <div class="main">
3146 <div class="main">
3147 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3147 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3148 <h3>Help: dates</h3>
3148 <h3>Help: dates</h3>
3149
3149
3150 <form class="search" action="/log">
3150 <form class="search" action="/log">
3151
3151
3152 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3152 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3153 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3153 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3154 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3154 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3155 </form>
3155 </form>
3156 <div id="doc">
3156 <div id="doc">
3157 <h1>Date Formats</h1>
3157 <h1>Date Formats</h1>
3158 <p>
3158 <p>
3159 Some commands allow the user to specify a date, e.g.:
3159 Some commands allow the user to specify a date, e.g.:
3160 </p>
3160 </p>
3161 <ul>
3161 <ul>
3162 <li> backout, commit, import, tag: Specify the commit date.
3162 <li> backout, commit, import, tag: Specify the commit date.
3163 <li> log, revert, update: Select revision(s) by date.
3163 <li> log, revert, update: Select revision(s) by date.
3164 </ul>
3164 </ul>
3165 <p>
3165 <p>
3166 Many date formats are valid. Here are some examples:
3166 Many date formats are valid. Here are some examples:
3167 </p>
3167 </p>
3168 <ul>
3168 <ul>
3169 <li> &quot;Wed Dec 6 13:18:29 2006&quot; (local timezone assumed)
3169 <li> &quot;Wed Dec 6 13:18:29 2006&quot; (local timezone assumed)
3170 <li> &quot;Dec 6 13:18 -0600&quot; (year assumed, time offset provided)
3170 <li> &quot;Dec 6 13:18 -0600&quot; (year assumed, time offset provided)
3171 <li> &quot;Dec 6 13:18 UTC&quot; (UTC and GMT are aliases for +0000)
3171 <li> &quot;Dec 6 13:18 UTC&quot; (UTC and GMT are aliases for +0000)
3172 <li> &quot;Dec 6&quot; (midnight)
3172 <li> &quot;Dec 6&quot; (midnight)
3173 <li> &quot;13:18&quot; (today assumed)
3173 <li> &quot;13:18&quot; (today assumed)
3174 <li> &quot;3:39&quot; (3:39AM assumed)
3174 <li> &quot;3:39&quot; (3:39AM assumed)
3175 <li> &quot;3:39pm&quot; (15:39)
3175 <li> &quot;3:39pm&quot; (15:39)
3176 <li> &quot;2006-12-06 13:18:29&quot; (ISO 8601 format)
3176 <li> &quot;2006-12-06 13:18:29&quot; (ISO 8601 format)
3177 <li> &quot;2006-12-6 13:18&quot;
3177 <li> &quot;2006-12-6 13:18&quot;
3178 <li> &quot;2006-12-6&quot;
3178 <li> &quot;2006-12-6&quot;
3179 <li> &quot;12-6&quot;
3179 <li> &quot;12-6&quot;
3180 <li> &quot;12/6&quot;
3180 <li> &quot;12/6&quot;
3181 <li> &quot;12/6/6&quot; (Dec 6 2006)
3181 <li> &quot;12/6/6&quot; (Dec 6 2006)
3182 <li> &quot;today&quot; (midnight)
3182 <li> &quot;today&quot; (midnight)
3183 <li> &quot;yesterday&quot; (midnight)
3183 <li> &quot;yesterday&quot; (midnight)
3184 <li> &quot;now&quot; - right now
3184 <li> &quot;now&quot; - right now
3185 </ul>
3185 </ul>
3186 <p>
3186 <p>
3187 Lastly, there is Mercurial's internal format:
3187 Lastly, there is Mercurial's internal format:
3188 </p>
3188 </p>
3189 <ul>
3189 <ul>
3190 <li> &quot;1165411109 0&quot; (Wed Dec 6 13:18:29 2006 UTC)
3190 <li> &quot;1165411109 0&quot; (Wed Dec 6 13:18:29 2006 UTC)
3191 </ul>
3191 </ul>
3192 <p>
3192 <p>
3193 This is the internal representation format for dates. The first number
3193 This is the internal representation format for dates. The first number
3194 is the number of seconds since the epoch (1970-01-01 00:00 UTC). The
3194 is the number of seconds since the epoch (1970-01-01 00:00 UTC). The
3195 second is the offset of the local timezone, in seconds west of UTC
3195 second is the offset of the local timezone, in seconds west of UTC
3196 (negative if the timezone is east of UTC).
3196 (negative if the timezone is east of UTC).
3197 </p>
3197 </p>
3198 <p>
3198 <p>
3199 The log command also accepts date ranges:
3199 The log command also accepts date ranges:
3200 </p>
3200 </p>
3201 <ul>
3201 <ul>
3202 <li> &quot;&lt;DATE&quot; - at or before a given date/time
3202 <li> &quot;&lt;DATE&quot; - at or before a given date/time
3203 <li> &quot;&gt;DATE&quot; - on or after a given date/time
3203 <li> &quot;&gt;DATE&quot; - on or after a given date/time
3204 <li> &quot;DATE to DATE&quot; - a date range, inclusive
3204 <li> &quot;DATE to DATE&quot; - a date range, inclusive
3205 <li> &quot;-DAYS&quot; - within a given number of days of today
3205 <li> &quot;-DAYS&quot; - within a given number of days of today
3206 </ul>
3206 </ul>
3207
3207
3208 </div>
3208 </div>
3209 </div>
3209 </div>
3210 </div>
3210 </div>
3211
3211
3212
3212
3213
3213
3214 </body>
3214 </body>
3215 </html>
3215 </html>
3216
3216
3217
3217
3218 $ get-with-headers.py $LOCALIP:$HGPORT "help/pager"
3218 $ get-with-headers.py $LOCALIP:$HGPORT "help/pager"
3219 200 Script output follows
3219 200 Script output follows
3220
3220
3221 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3221 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3222 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3222 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3223 <head>
3223 <head>
3224 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3224 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3225 <meta name="robots" content="index, nofollow" />
3225 <meta name="robots" content="index, nofollow" />
3226 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3226 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3227 <script type="text/javascript" src="/static/mercurial.js"></script>
3227 <script type="text/javascript" src="/static/mercurial.js"></script>
3228
3228
3229 <title>Help: pager</title>
3229 <title>Help: pager</title>
3230 </head>
3230 </head>
3231 <body>
3231 <body>
3232
3232
3233 <div class="container">
3233 <div class="container">
3234 <div class="menu">
3234 <div class="menu">
3235 <div class="logo">
3235 <div class="logo">
3236 <a href="https://mercurial-scm.org/">
3236 <a href="https://mercurial-scm.org/">
3237 <img src="/static/hglogo.png" alt="mercurial" /></a>
3237 <img src="/static/hglogo.png" alt="mercurial" /></a>
3238 </div>
3238 </div>
3239 <ul>
3239 <ul>
3240 <li><a href="/shortlog">log</a></li>
3240 <li><a href="/shortlog">log</a></li>
3241 <li><a href="/graph">graph</a></li>
3241 <li><a href="/graph">graph</a></li>
3242 <li><a href="/tags">tags</a></li>
3242 <li><a href="/tags">tags</a></li>
3243 <li><a href="/bookmarks">bookmarks</a></li>
3243 <li><a href="/bookmarks">bookmarks</a></li>
3244 <li><a href="/branches">branches</a></li>
3244 <li><a href="/branches">branches</a></li>
3245 </ul>
3245 </ul>
3246 <ul>
3246 <ul>
3247 <li class="active"><a href="/help">help</a></li>
3247 <li class="active"><a href="/help">help</a></li>
3248 </ul>
3248 </ul>
3249 </div>
3249 </div>
3250
3250
3251 <div class="main">
3251 <div class="main">
3252 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3252 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3253 <h3>Help: pager</h3>
3253 <h3>Help: pager</h3>
3254
3254
3255 <form class="search" action="/log">
3255 <form class="search" action="/log">
3256
3256
3257 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3257 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3258 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3258 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3259 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3259 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3260 </form>
3260 </form>
3261 <div id="doc">
3261 <div id="doc">
3262 <h1>Pager Support</h1>
3262 <h1>Pager Support</h1>
3263 <p>
3263 <p>
3264 Some Mercurial commands can produce a lot of output, and Mercurial will
3264 Some Mercurial commands can produce a lot of output, and Mercurial will
3265 attempt to use a pager to make those commands more pleasant.
3265 attempt to use a pager to make those commands more pleasant.
3266 </p>
3266 </p>
3267 <p>
3267 <p>
3268 To set the pager that should be used, set the application variable:
3268 To set the pager that should be used, set the application variable:
3269 </p>
3269 </p>
3270 <pre>
3270 <pre>
3271 [pager]
3271 [pager]
3272 pager = less -FRX
3272 pager = less -FRX
3273 </pre>
3273 </pre>
3274 <p>
3274 <p>
3275 If no pager is set in the user or repository configuration, Mercurial uses the
3275 If no pager is set in the user or repository configuration, Mercurial uses the
3276 environment variable $PAGER. If $PAGER is not set, pager.pager from the default
3276 environment variable $PAGER. If $PAGER is not set, pager.pager from the default
3277 or system configuration is used. If none of these are set, a default pager will
3277 or system configuration is used. If none of these are set, a default pager will
3278 be used, typically 'less' on Unix and 'more' on Windows.
3278 be used, typically 'less' on Unix and 'more' on Windows.
3279 </p>
3279 </p>
3280 <p>
3280 <p>
3281 You can disable the pager for certain commands by adding them to the
3281 You can disable the pager for certain commands by adding them to the
3282 pager.ignore list:
3282 pager.ignore list:
3283 </p>
3283 </p>
3284 <pre>
3284 <pre>
3285 [pager]
3285 [pager]
3286 ignore = version, help, update
3286 ignore = version, help, update
3287 </pre>
3287 </pre>
3288 <p>
3288 <p>
3289 To ignore global commands like 'hg version' or 'hg help', you have
3289 To ignore global commands like 'hg version' or 'hg help', you have
3290 to specify them in your user configuration file.
3290 to specify them in your user configuration file.
3291 </p>
3291 </p>
3292 <p>
3292 <p>
3293 To control whether the pager is used at all for an individual command,
3293 To control whether the pager is used at all for an individual command,
3294 you can use --pager=&lt;value&gt;:
3294 you can use --pager=&lt;value&gt;:
3295 </p>
3295 </p>
3296 <ul>
3296 <ul>
3297 <li> use as needed: 'auto'.
3297 <li> use as needed: 'auto'.
3298 <li> require the pager: 'yes' or 'on'.
3298 <li> require the pager: 'yes' or 'on'.
3299 <li> suppress the pager: 'no' or 'off' (any unrecognized value will also work).
3299 <li> suppress the pager: 'no' or 'off' (any unrecognized value will also work).
3300 </ul>
3300 </ul>
3301 <p>
3301 <p>
3302 To globally turn off all attempts to use a pager, set:
3302 To globally turn off all attempts to use a pager, set:
3303 </p>
3303 </p>
3304 <pre>
3304 <pre>
3305 [ui]
3305 [ui]
3306 paginate = never
3306 paginate = never
3307 </pre>
3307 </pre>
3308 <p>
3308 <p>
3309 which will prevent the pager from running.
3309 which will prevent the pager from running.
3310 </p>
3310 </p>
3311
3311
3312 </div>
3312 </div>
3313 </div>
3313 </div>
3314 </div>
3314 </div>
3315
3315
3316
3316
3317
3317
3318 </body>
3318 </body>
3319 </html>
3319 </html>
3320
3320
3321
3321
3322 Sub-topic indexes rendered properly
3322 Sub-topic indexes rendered properly
3323
3323
3324 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals"
3324 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals"
3325 200 Script output follows
3325 200 Script output follows
3326
3326
3327 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3327 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3328 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3328 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3329 <head>
3329 <head>
3330 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3330 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3331 <meta name="robots" content="index, nofollow" />
3331 <meta name="robots" content="index, nofollow" />
3332 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3332 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3333 <script type="text/javascript" src="/static/mercurial.js"></script>
3333 <script type="text/javascript" src="/static/mercurial.js"></script>
3334
3334
3335 <title>Help: internals</title>
3335 <title>Help: internals</title>
3336 </head>
3336 </head>
3337 <body>
3337 <body>
3338
3338
3339 <div class="container">
3339 <div class="container">
3340 <div class="menu">
3340 <div class="menu">
3341 <div class="logo">
3341 <div class="logo">
3342 <a href="https://mercurial-scm.org/">
3342 <a href="https://mercurial-scm.org/">
3343 <img src="/static/hglogo.png" alt="mercurial" /></a>
3343 <img src="/static/hglogo.png" alt="mercurial" /></a>
3344 </div>
3344 </div>
3345 <ul>
3345 <ul>
3346 <li><a href="/shortlog">log</a></li>
3346 <li><a href="/shortlog">log</a></li>
3347 <li><a href="/graph">graph</a></li>
3347 <li><a href="/graph">graph</a></li>
3348 <li><a href="/tags">tags</a></li>
3348 <li><a href="/tags">tags</a></li>
3349 <li><a href="/bookmarks">bookmarks</a></li>
3349 <li><a href="/bookmarks">bookmarks</a></li>
3350 <li><a href="/branches">branches</a></li>
3350 <li><a href="/branches">branches</a></li>
3351 </ul>
3351 </ul>
3352 <ul>
3352 <ul>
3353 <li><a href="/help">help</a></li>
3353 <li><a href="/help">help</a></li>
3354 </ul>
3354 </ul>
3355 </div>
3355 </div>
3356
3356
3357 <div class="main">
3357 <div class="main">
3358 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3358 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3359
3359
3360 <form class="search" action="/log">
3360 <form class="search" action="/log">
3361
3361
3362 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3362 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3363 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3363 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3364 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3364 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3365 </form>
3365 </form>
3366 <table class="bigtable">
3366 <table class="bigtable">
3367 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
3367 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
3368
3368
3369 <tr><td>
3369 <tr><td>
3370 <a href="/help/internals.bundle2">
3370 <a href="/help/internals.bundle2">
3371 bundle2
3371 bundle2
3372 </a>
3372 </a>
3373 </td><td>
3373 </td><td>
3374 Bundle2
3374 Bundle2
3375 </td></tr>
3375 </td></tr>
3376 <tr><td>
3376 <tr><td>
3377 <a href="/help/internals.bundles">
3377 <a href="/help/internals.bundles">
3378 bundles
3378 bundles
3379 </a>
3379 </a>
3380 </td><td>
3380 </td><td>
3381 Bundles
3381 Bundles
3382 </td></tr>
3382 </td></tr>
3383 <tr><td>
3383 <tr><td>
3384 <a href="/help/internals.cbor">
3384 <a href="/help/internals.cbor">
3385 cbor
3385 cbor
3386 </a>
3386 </a>
3387 </td><td>
3387 </td><td>
3388 CBOR
3388 CBOR
3389 </td></tr>
3389 </td></tr>
3390 <tr><td>
3390 <tr><td>
3391 <a href="/help/internals.censor">
3391 <a href="/help/internals.censor">
3392 censor
3392 censor
3393 </a>
3393 </a>
3394 </td><td>
3394 </td><td>
3395 Censor
3395 Censor
3396 </td></tr>
3396 </td></tr>
3397 <tr><td>
3397 <tr><td>
3398 <a href="/help/internals.changegroups">
3398 <a href="/help/internals.changegroups">
3399 changegroups
3399 changegroups
3400 </a>
3400 </a>
3401 </td><td>
3401 </td><td>
3402 Changegroups
3402 Changegroups
3403 </td></tr>
3403 </td></tr>
3404 <tr><td>
3404 <tr><td>
3405 <a href="/help/internals.config">
3405 <a href="/help/internals.config">
3406 config
3406 config
3407 </a>
3407 </a>
3408 </td><td>
3408 </td><td>
3409 Config Registrar
3409 Config Registrar
3410 </td></tr>
3410 </td></tr>
3411 <tr><td>
3411 <tr><td>
3412 <a href="/help/internals.extensions">
3412 <a href="/help/internals.extensions">
3413 extensions
3413 extensions
3414 </a>
3414 </a>
3415 </td><td>
3415 </td><td>
3416 Extension API
3416 Extension API
3417 </td></tr>
3417 </td></tr>
3418 <tr><td>
3418 <tr><td>
3419 <a href="/help/internals.requirements">
3419 <a href="/help/internals.requirements">
3420 requirements
3420 requirements
3421 </a>
3421 </a>
3422 </td><td>
3422 </td><td>
3423 Repository Requirements
3423 Repository Requirements
3424 </td></tr>
3424 </td></tr>
3425 <tr><td>
3425 <tr><td>
3426 <a href="/help/internals.revlogs">
3426 <a href="/help/internals.revlogs">
3427 revlogs
3427 revlogs
3428 </a>
3428 </a>
3429 </td><td>
3429 </td><td>
3430 Revision Logs
3430 Revision Logs
3431 </td></tr>
3431 </td></tr>
3432 <tr><td>
3432 <tr><td>
3433 <a href="/help/internals.wireprotocol">
3433 <a href="/help/internals.wireprotocol">
3434 wireprotocol
3434 wireprotocol
3435 </a>
3435 </a>
3436 </td><td>
3436 </td><td>
3437 Wire Protocol
3437 Wire Protocol
3438 </td></tr>
3438 </td></tr>
3439 <tr><td>
3439 <tr><td>
3440 <a href="/help/internals.wireprotocolrpc">
3440 <a href="/help/internals.wireprotocolrpc">
3441 wireprotocolrpc
3441 wireprotocolrpc
3442 </a>
3442 </a>
3443 </td><td>
3443 </td><td>
3444 Wire Protocol RPC
3444 Wire Protocol RPC
3445 </td></tr>
3445 </td></tr>
3446 <tr><td>
3446 <tr><td>
3447 <a href="/help/internals.wireprotocolv2">
3447 <a href="/help/internals.wireprotocolv2">
3448 wireprotocolv2
3448 wireprotocolv2
3449 </a>
3449 </a>
3450 </td><td>
3450 </td><td>
3451 Wire Protocol Version 2
3451 Wire Protocol Version 2
3452 </td></tr>
3452 </td></tr>
3453
3453
3454
3454
3455
3455
3456
3456
3457
3457
3458 </table>
3458 </table>
3459 </div>
3459 </div>
3460 </div>
3460 </div>
3461
3461
3462
3462
3463
3463
3464 </body>
3464 </body>
3465 </html>
3465 </html>
3466
3466
3467
3467
3468 Sub-topic topics rendered properly
3468 Sub-topic topics rendered properly
3469
3469
3470 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals.changegroups"
3470 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals.changegroups"
3471 200 Script output follows
3471 200 Script output follows
3472
3472
3473 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3473 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3474 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3474 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3475 <head>
3475 <head>
3476 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3476 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3477 <meta name="robots" content="index, nofollow" />
3477 <meta name="robots" content="index, nofollow" />
3478 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3478 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3479 <script type="text/javascript" src="/static/mercurial.js"></script>
3479 <script type="text/javascript" src="/static/mercurial.js"></script>
3480
3480
3481 <title>Help: internals.changegroups</title>
3481 <title>Help: internals.changegroups</title>
3482 </head>
3482 </head>
3483 <body>
3483 <body>
3484
3484
3485 <div class="container">
3485 <div class="container">
3486 <div class="menu">
3486 <div class="menu">
3487 <div class="logo">
3487 <div class="logo">
3488 <a href="https://mercurial-scm.org/">
3488 <a href="https://mercurial-scm.org/">
3489 <img src="/static/hglogo.png" alt="mercurial" /></a>
3489 <img src="/static/hglogo.png" alt="mercurial" /></a>
3490 </div>
3490 </div>
3491 <ul>
3491 <ul>
3492 <li><a href="/shortlog">log</a></li>
3492 <li><a href="/shortlog">log</a></li>
3493 <li><a href="/graph">graph</a></li>
3493 <li><a href="/graph">graph</a></li>
3494 <li><a href="/tags">tags</a></li>
3494 <li><a href="/tags">tags</a></li>
3495 <li><a href="/bookmarks">bookmarks</a></li>
3495 <li><a href="/bookmarks">bookmarks</a></li>
3496 <li><a href="/branches">branches</a></li>
3496 <li><a href="/branches">branches</a></li>
3497 </ul>
3497 </ul>
3498 <ul>
3498 <ul>
3499 <li class="active"><a href="/help">help</a></li>
3499 <li class="active"><a href="/help">help</a></li>
3500 </ul>
3500 </ul>
3501 </div>
3501 </div>
3502
3502
3503 <div class="main">
3503 <div class="main">
3504 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3504 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3505 <h3>Help: internals.changegroups</h3>
3505 <h3>Help: internals.changegroups</h3>
3506
3506
3507 <form class="search" action="/log">
3507 <form class="search" action="/log">
3508
3508
3509 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3509 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3510 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3510 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3511 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3511 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3512 </form>
3512 </form>
3513 <div id="doc">
3513 <div id="doc">
3514 <h1>Changegroups</h1>
3514 <h1>Changegroups</h1>
3515 <p>
3515 <p>
3516 Changegroups are representations of repository revlog data, specifically
3516 Changegroups are representations of repository revlog data, specifically
3517 the changelog data, root/flat manifest data, treemanifest data, and
3517 the changelog data, root/flat manifest data, treemanifest data, and
3518 filelogs.
3518 filelogs.
3519 </p>
3519 </p>
3520 <p>
3520 <p>
3521 There are 3 versions of changegroups: &quot;1&quot;, &quot;2&quot;, and &quot;3&quot;. From a
3521 There are 3 versions of changegroups: &quot;1&quot;, &quot;2&quot;, and &quot;3&quot;. From a
3522 high-level, versions &quot;1&quot; and &quot;2&quot; are almost exactly the same, with the
3522 high-level, versions &quot;1&quot; and &quot;2&quot; are almost exactly the same, with the
3523 only difference being an additional item in the *delta header*. Version
3523 only difference being an additional item in the *delta header*. Version
3524 &quot;3&quot; adds support for storage flags in the *delta header* and optionally
3524 &quot;3&quot; adds support for storage flags in the *delta header* and optionally
3525 exchanging treemanifests (enabled by setting an option on the
3525 exchanging treemanifests (enabled by setting an option on the
3526 &quot;changegroup&quot; part in the bundle2).
3526 &quot;changegroup&quot; part in the bundle2).
3527 </p>
3527 </p>
3528 <p>
3528 <p>
3529 Changegroups when not exchanging treemanifests consist of 3 logical
3529 Changegroups when not exchanging treemanifests consist of 3 logical
3530 segments:
3530 segments:
3531 </p>
3531 </p>
3532 <pre>
3532 <pre>
3533 +---------------------------------+
3533 +---------------------------------+
3534 | | | |
3534 | | | |
3535 | changeset | manifest | filelogs |
3535 | changeset | manifest | filelogs |
3536 | | | |
3536 | | | |
3537 | | | |
3537 | | | |
3538 +---------------------------------+
3538 +---------------------------------+
3539 </pre>
3539 </pre>
3540 <p>
3540 <p>
3541 When exchanging treemanifests, there are 4 logical segments:
3541 When exchanging treemanifests, there are 4 logical segments:
3542 </p>
3542 </p>
3543 <pre>
3543 <pre>
3544 +-------------------------------------------------+
3544 +-------------------------------------------------+
3545 | | | | |
3545 | | | | |
3546 | changeset | root | treemanifests | filelogs |
3546 | changeset | root | treemanifests | filelogs |
3547 | | manifest | | |
3547 | | manifest | | |
3548 | | | | |
3548 | | | | |
3549 +-------------------------------------------------+
3549 +-------------------------------------------------+
3550 </pre>
3550 </pre>
3551 <p>
3551 <p>
3552 The principle building block of each segment is a *chunk*. A *chunk*
3552 The principle building block of each segment is a *chunk*. A *chunk*
3553 is a framed piece of data:
3553 is a framed piece of data:
3554 </p>
3554 </p>
3555 <pre>
3555 <pre>
3556 +---------------------------------------+
3556 +---------------------------------------+
3557 | | |
3557 | | |
3558 | length | data |
3558 | length | data |
3559 | (4 bytes) | (&lt;length - 4&gt; bytes) |
3559 | (4 bytes) | (&lt;length - 4&gt; bytes) |
3560 | | |
3560 | | |
3561 +---------------------------------------+
3561 +---------------------------------------+
3562 </pre>
3562 </pre>
3563 <p>
3563 <p>
3564 All integers are big-endian signed integers. Each chunk starts with a 32-bit
3564 All integers are big-endian signed integers. Each chunk starts with a 32-bit
3565 integer indicating the length of the entire chunk (including the length field
3565 integer indicating the length of the entire chunk (including the length field
3566 itself).
3566 itself).
3567 </p>
3567 </p>
3568 <p>
3568 <p>
3569 There is a special case chunk that has a value of 0 for the length
3569 There is a special case chunk that has a value of 0 for the length
3570 (&quot;0x00000000&quot;). We call this an *empty chunk*.
3570 (&quot;0x00000000&quot;). We call this an *empty chunk*.
3571 </p>
3571 </p>
3572 <h2>Delta Groups</h2>
3572 <h2>Delta Groups</h2>
3573 <p>
3573 <p>
3574 A *delta group* expresses the content of a revlog as a series of deltas,
3574 A *delta group* expresses the content of a revlog as a series of deltas,
3575 or patches against previous revisions.
3575 or patches against previous revisions.
3576 </p>
3576 </p>
3577 <p>
3577 <p>
3578 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
3578 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
3579 to signal the end of the delta group:
3579 to signal the end of the delta group:
3580 </p>
3580 </p>
3581 <pre>
3581 <pre>
3582 +------------------------------------------------------------------------+
3582 +------------------------------------------------------------------------+
3583 | | | | | |
3583 | | | | | |
3584 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
3584 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
3585 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
3585 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
3586 | | | | | |
3586 | | | | | |
3587 +------------------------------------------------------------------------+
3587 +------------------------------------------------------------------------+
3588 </pre>
3588 </pre>
3589 <p>
3589 <p>
3590 Each *chunk*'s data consists of the following:
3590 Each *chunk*'s data consists of the following:
3591 </p>
3591 </p>
3592 <pre>
3592 <pre>
3593 +---------------------------------------+
3593 +---------------------------------------+
3594 | | |
3594 | | |
3595 | delta header | delta data |
3595 | delta header | delta data |
3596 | (various by version) | (various) |
3596 | (various by version) | (various) |
3597 | | |
3597 | | |
3598 +---------------------------------------+
3598 +---------------------------------------+
3599 </pre>
3599 </pre>
3600 <p>
3600 <p>
3601 The *delta data* is a series of *delta*s that describe a diff from an existing
3601 The *delta data* is a series of *delta*s that describe a diff from an existing
3602 entry (either that the recipient already has, or previously specified in the
3602 entry (either that the recipient already has, or previously specified in the
3603 bundle/changegroup).
3603 bundle/changegroup).
3604 </p>
3604 </p>
3605 <p>
3605 <p>
3606 The *delta header* is different between versions &quot;1&quot;, &quot;2&quot;, and
3606 The *delta header* is different between versions &quot;1&quot;, &quot;2&quot;, and
3607 &quot;3&quot; of the changegroup format.
3607 &quot;3&quot; of the changegroup format.
3608 </p>
3608 </p>
3609 <p>
3609 <p>
3610 Version 1 (headerlen=80):
3610 Version 1 (headerlen=80):
3611 </p>
3611 </p>
3612 <pre>
3612 <pre>
3613 +------------------------------------------------------+
3613 +------------------------------------------------------+
3614 | | | | |
3614 | | | | |
3615 | node | p1 node | p2 node | link node |
3615 | node | p1 node | p2 node | link node |
3616 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3616 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3617 | | | | |
3617 | | | | |
3618 +------------------------------------------------------+
3618 +------------------------------------------------------+
3619 </pre>
3619 </pre>
3620 <p>
3620 <p>
3621 Version 2 (headerlen=100):
3621 Version 2 (headerlen=100):
3622 </p>
3622 </p>
3623 <pre>
3623 <pre>
3624 +------------------------------------------------------------------+
3624 +------------------------------------------------------------------+
3625 | | | | | |
3625 | | | | | |
3626 | node | p1 node | p2 node | base node | link node |
3626 | node | p1 node | p2 node | base node | link node |
3627 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3627 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3628 | | | | | |
3628 | | | | | |
3629 +------------------------------------------------------------------+
3629 +------------------------------------------------------------------+
3630 </pre>
3630 </pre>
3631 <p>
3631 <p>
3632 Version 3 (headerlen=102):
3632 Version 3 (headerlen=102):
3633 </p>
3633 </p>
3634 <pre>
3634 <pre>
3635 +------------------------------------------------------------------------------+
3635 +------------------------------------------------------------------------------+
3636 | | | | | | |
3636 | | | | | | |
3637 | node | p1 node | p2 node | base node | link node | flags |
3637 | node | p1 node | p2 node | base node | link node | flags |
3638 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
3638 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
3639 | | | | | | |
3639 | | | | | | |
3640 +------------------------------------------------------------------------------+
3640 +------------------------------------------------------------------------------+
3641 </pre>
3641 </pre>
3642 <p>
3642 <p>
3643 The *delta data* consists of &quot;chunklen - 4 - headerlen&quot; bytes, which contain a
3643 The *delta data* consists of &quot;chunklen - 4 - headerlen&quot; bytes, which contain a
3644 series of *delta*s, densely packed (no separators). These deltas describe a diff
3644 series of *delta*s, densely packed (no separators). These deltas describe a diff
3645 from an existing entry (either that the recipient already has, or previously
3645 from an existing entry (either that the recipient already has, or previously
3646 specified in the bundle/changegroup). The format is described more fully in
3646 specified in the bundle/changegroup). The format is described more fully in
3647 &quot;hg help internals.bdiff&quot;, but briefly:
3647 &quot;hg help internals.bdiff&quot;, but briefly:
3648 </p>
3648 </p>
3649 <pre>
3649 <pre>
3650 +---------------------------------------------------------------+
3650 +---------------------------------------------------------------+
3651 | | | | |
3651 | | | | |
3652 | start offset | end offset | new length | content |
3652 | start offset | end offset | new length | content |
3653 | (4 bytes) | (4 bytes) | (4 bytes) | (&lt;new length&gt; bytes) |
3653 | (4 bytes) | (4 bytes) | (4 bytes) | (&lt;new length&gt; bytes) |
3654 | | | | |
3654 | | | | |
3655 +---------------------------------------------------------------+
3655 +---------------------------------------------------------------+
3656 </pre>
3656 </pre>
3657 <p>
3657 <p>
3658 Please note that the length field in the delta data does *not* include itself.
3658 Please note that the length field in the delta data does *not* include itself.
3659 </p>
3659 </p>
3660 <p>
3660 <p>
3661 In version 1, the delta is always applied against the previous node from
3661 In version 1, the delta is always applied against the previous node from
3662 the changegroup or the first parent if this is the first entry in the
3662 the changegroup or the first parent if this is the first entry in the
3663 changegroup.
3663 changegroup.
3664 </p>
3664 </p>
3665 <p>
3665 <p>
3666 In version 2 and up, the delta base node is encoded in the entry in the
3666 In version 2 and up, the delta base node is encoded in the entry in the
3667 changegroup. This allows the delta to be expressed against any parent,
3667 changegroup. This allows the delta to be expressed against any parent,
3668 which can result in smaller deltas and more efficient encoding of data.
3668 which can result in smaller deltas and more efficient encoding of data.
3669 </p>
3669 </p>
3670 <p>
3670 <p>
3671 The *flags* field holds bitwise flags affecting the processing of revision
3671 The *flags* field holds bitwise flags affecting the processing of revision
3672 data. The following flags are defined:
3672 data. The following flags are defined:
3673 </p>
3673 </p>
3674 <dl>
3674 <dl>
3675 <dt>32768
3675 <dt>32768
3676 <dd>Censored revision. The revision's fulltext has been replaced by censor metadata. May only occur on file revisions.
3676 <dd>Censored revision. The revision's fulltext has been replaced by censor metadata. May only occur on file revisions.
3677 <dt>16384
3677 <dt>16384
3678 <dd>Ellipsis revision. Revision hash does not match data (likely due to rewritten parents).
3678 <dd>Ellipsis revision. Revision hash does not match data (likely due to rewritten parents).
3679 <dt>8192
3679 <dt>8192
3680 <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.
3680 <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.
3681 </dl>
3681 </dl>
3682 <p>
3682 <p>
3683 For historical reasons, the integer values are identical to revlog version 1
3683 For historical reasons, the integer values are identical to revlog version 1
3684 per-revision storage flags and correspond to bits being set in this 2-byte
3684 per-revision storage flags and correspond to bits being set in this 2-byte
3685 field. Bits were allocated starting from the most-significant bit, hence the
3685 field. Bits were allocated starting from the most-significant bit, hence the
3686 reverse ordering and allocation of these flags.
3686 reverse ordering and allocation of these flags.
3687 </p>
3687 </p>
3688 <h2>Changeset Segment</h2>
3688 <h2>Changeset Segment</h2>
3689 <p>
3689 <p>
3690 The *changeset segment* consists of a single *delta group* holding
3690 The *changeset segment* consists of a single *delta group* holding
3691 changelog data. The *empty chunk* at the end of the *delta group* denotes
3691 changelog data. The *empty chunk* at the end of the *delta group* denotes
3692 the boundary to the *manifest segment*.
3692 the boundary to the *manifest segment*.
3693 </p>
3693 </p>
3694 <h2>Manifest Segment</h2>
3694 <h2>Manifest Segment</h2>
3695 <p>
3695 <p>
3696 The *manifest segment* consists of a single *delta group* holding manifest
3696 The *manifest segment* consists of a single *delta group* holding manifest
3697 data. If treemanifests are in use, it contains only the manifest for the
3697 data. If treemanifests are in use, it contains only the manifest for the
3698 root directory of the repository. Otherwise, it contains the entire
3698 root directory of the repository. Otherwise, it contains the entire
3699 manifest data. The *empty chunk* at the end of the *delta group* denotes
3699 manifest data. The *empty chunk* at the end of the *delta group* denotes
3700 the boundary to the next segment (either the *treemanifests segment* or the
3700 the boundary to the next segment (either the *treemanifests segment* or the
3701 *filelogs segment*, depending on version and the request options).
3701 *filelogs segment*, depending on version and the request options).
3702 </p>
3702 </p>
3703 <h3>Treemanifests Segment</h3>
3703 <h3>Treemanifests Segment</h3>
3704 <p>
3704 <p>
3705 The *treemanifests segment* only exists in changegroup version &quot;3&quot;, and
3705 The *treemanifests segment* only exists in changegroup version &quot;3&quot;, and
3706 only if the 'treemanifest' param is part of the bundle2 changegroup part
3706 only if the 'treemanifest' param is part of the bundle2 changegroup part
3707 (it is not possible to use changegroup version 3 outside of bundle2).
3707 (it is not possible to use changegroup version 3 outside of bundle2).
3708 Aside from the filenames in the *treemanifests segment* containing a
3708 Aside from the filenames in the *treemanifests segment* containing a
3709 trailing &quot;/&quot; character, it behaves identically to the *filelogs segment*
3709 trailing &quot;/&quot; character, it behaves identically to the *filelogs segment*
3710 (see below). The final sub-segment is followed by an *empty chunk* (logically,
3710 (see below). The final sub-segment is followed by an *empty chunk* (logically,
3711 a sub-segment with filename size 0). This denotes the boundary to the
3711 a sub-segment with filename size 0). This denotes the boundary to the
3712 *filelogs segment*.
3712 *filelogs segment*.
3713 </p>
3713 </p>
3714 <h2>Filelogs Segment</h2>
3714 <h2>Filelogs Segment</h2>
3715 <p>
3715 <p>
3716 The *filelogs segment* consists of multiple sub-segments, each
3716 The *filelogs segment* consists of multiple sub-segments, each
3717 corresponding to an individual file whose data is being described:
3717 corresponding to an individual file whose data is being described:
3718 </p>
3718 </p>
3719 <pre>
3719 <pre>
3720 +--------------------------------------------------+
3720 +--------------------------------------------------+
3721 | | | | | |
3721 | | | | | |
3722 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
3722 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
3723 | | | | | (4 bytes) |
3723 | | | | | (4 bytes) |
3724 | | | | | |
3724 | | | | | |
3725 +--------------------------------------------------+
3725 +--------------------------------------------------+
3726 </pre>
3726 </pre>
3727 <p>
3727 <p>
3728 The final filelog sub-segment is followed by an *empty chunk* (logically,
3728 The final filelog sub-segment is followed by an *empty chunk* (logically,
3729 a sub-segment with filename size 0). This denotes the end of the segment
3729 a sub-segment with filename size 0). This denotes the end of the segment
3730 and of the overall changegroup.
3730 and of the overall changegroup.
3731 </p>
3731 </p>
3732 <p>
3732 <p>
3733 Each filelog sub-segment consists of the following:
3733 Each filelog sub-segment consists of the following:
3734 </p>
3734 </p>
3735 <pre>
3735 <pre>
3736 +------------------------------------------------------+
3736 +------------------------------------------------------+
3737 | | | |
3737 | | | |
3738 | filename length | filename | delta group |
3738 | filename length | filename | delta group |
3739 | (4 bytes) | (&lt;length - 4&gt; bytes) | (various) |
3739 | (4 bytes) | (&lt;length - 4&gt; bytes) | (various) |
3740 | | | |
3740 | | | |
3741 +------------------------------------------------------+
3741 +------------------------------------------------------+
3742 </pre>
3742 </pre>
3743 <p>
3743 <p>
3744 That is, a *chunk* consisting of the filename (not terminated or padded)
3744 That is, a *chunk* consisting of the filename (not terminated or padded)
3745 followed by N chunks constituting the *delta group* for this file. The
3745 followed by N chunks constituting the *delta group* for this file. The
3746 *empty chunk* at the end of each *delta group* denotes the boundary to the
3746 *empty chunk* at the end of each *delta group* denotes the boundary to the
3747 next filelog sub-segment.
3747 next filelog sub-segment.
3748 </p>
3748 </p>
3749
3749
3750 </div>
3750 </div>
3751 </div>
3751 </div>
3752 </div>
3752 </div>
3753
3753
3754
3754
3755
3755
3756 </body>
3756 </body>
3757 </html>
3757 </html>
3758
3758
3759
3759
3760 $ get-with-headers.py 127.0.0.1:$HGPORT "help/unknowntopic"
3760 $ get-with-headers.py 127.0.0.1:$HGPORT "help/unknowntopic"
3761 404 Not Found
3761 404 Not Found
3762
3762
3763 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3763 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3764 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3764 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3765 <head>
3765 <head>
3766 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3766 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3767 <meta name="robots" content="index, nofollow" />
3767 <meta name="robots" content="index, nofollow" />
3768 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3768 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3769 <script type="text/javascript" src="/static/mercurial.js"></script>
3769 <script type="text/javascript" src="/static/mercurial.js"></script>
3770
3770
3771 <title>test: error</title>
3771 <title>test: error</title>
3772 </head>
3772 </head>
3773 <body>
3773 <body>
3774
3774
3775 <div class="container">
3775 <div class="container">
3776 <div class="menu">
3776 <div class="menu">
3777 <div class="logo">
3777 <div class="logo">
3778 <a href="https://mercurial-scm.org/">
3778 <a href="https://mercurial-scm.org/">
3779 <img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial" /></a>
3779 <img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial" /></a>
3780 </div>
3780 </div>
3781 <ul>
3781 <ul>
3782 <li><a href="/shortlog">log</a></li>
3782 <li><a href="/shortlog">log</a></li>
3783 <li><a href="/graph">graph</a></li>
3783 <li><a href="/graph">graph</a></li>
3784 <li><a href="/tags">tags</a></li>
3784 <li><a href="/tags">tags</a></li>
3785 <li><a href="/bookmarks">bookmarks</a></li>
3785 <li><a href="/bookmarks">bookmarks</a></li>
3786 <li><a href="/branches">branches</a></li>
3786 <li><a href="/branches">branches</a></li>
3787 </ul>
3787 </ul>
3788 <ul>
3788 <ul>
3789 <li><a href="/help">help</a></li>
3789 <li><a href="/help">help</a></li>
3790 </ul>
3790 </ul>
3791 </div>
3791 </div>
3792
3792
3793 <div class="main">
3793 <div class="main">
3794
3794
3795 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3795 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3796 <h3>error</h3>
3796 <h3>error</h3>
3797
3797
3798
3798
3799 <form class="search" action="/log">
3799 <form class="search" action="/log">
3800
3800
3801 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3801 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3802 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3802 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3803 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3803 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3804 </form>
3804 </form>
3805
3805
3806 <div class="description">
3806 <div class="description">
3807 <p>
3807 <p>
3808 An error occurred while processing your request:
3808 An error occurred while processing your request:
3809 </p>
3809 </p>
3810 <p>
3810 <p>
3811 Not Found
3811 Not Found
3812 </p>
3812 </p>
3813 </div>
3813 </div>
3814 </div>
3814 </div>
3815 </div>
3815 </div>
3816
3816
3817
3817
3818
3818
3819 </body>
3819 </body>
3820 </html>
3820 </html>
3821
3821
3822 [1]
3822 [1]
3823
3823
3824 $ killdaemons.py
3824 $ killdaemons.py
3825
3825
3826 #endif
3826 #endif
@@ -1,220 +1,219 b''
1 #testcases flat tree
1 #testcases flat tree
2 $ . "$TESTDIR/narrow-library.sh"
2 $ . "$TESTDIR/narrow-library.sh"
3
3
4 #if tree
4 #if tree
5 $ cat << EOF >> $HGRCPATH
5 $ cat << EOF >> $HGRCPATH
6 > [experimental]
6 > [experimental]
7 > treemanifest = 1
7 > treemanifest = 1
8 > EOF
8 > EOF
9 #endif
9 #endif
10
10
11 $ hg init master
11 $ hg init master
12 $ cd master
12 $ cd master
13 $ cat >> .hg/hgrc <<EOF
13 $ cat >> .hg/hgrc <<EOF
14 > [narrow]
14 > [narrow]
15 > serveellipses=True
15 > serveellipses=True
16 > EOF
16 > EOF
17
17
18 $ mkdir inside
18 $ mkdir inside
19 $ echo 'inside' > inside/f
19 $ echo 'inside' > inside/f
20 $ hg add inside/f
20 $ hg add inside/f
21 $ hg commit -m 'add inside'
21 $ hg commit -m 'add inside'
22
22
23 $ mkdir widest
23 $ mkdir widest
24 $ echo 'widest' > widest/f
24 $ echo 'widest' > widest/f
25 $ hg add widest/f
25 $ hg add widest/f
26 $ hg commit -m 'add widest'
26 $ hg commit -m 'add widest'
27
27
28 $ mkdir outside
28 $ mkdir outside
29 $ echo 'outside' > outside/f
29 $ echo 'outside' > outside/f
30 $ hg add outside/f
30 $ hg add outside/f
31 $ hg commit -m 'add outside'
31 $ hg commit -m 'add outside'
32
32
33 $ cd ..
33 $ cd ..
34
34
35 narrow clone the inside file
35 narrow clone the inside file
36
36
37 $ hg clone --narrow ssh://user@dummy/master narrow --include inside
37 $ hg clone --narrow ssh://user@dummy/master narrow --include inside
38 requesting all changes
38 requesting all changes
39 adding changesets
39 adding changesets
40 adding manifests
40 adding manifests
41 adding file changes
41 adding file changes
42 added 2 changesets with 1 changes to 1 files
42 added 2 changesets with 1 changes to 1 files
43 new changesets *:* (glob)
43 new changesets *:* (glob)
44 updating to branch default
44 updating to branch default
45 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
45 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
46 $ cd narrow
46 $ cd narrow
47 $ hg tracked
47 $ hg tracked
48 I path:inside
48 I path:inside
49 $ ls
49 $ ls
50 inside
50 inside
51 $ cat inside/f
51 $ cat inside/f
52 inside
52 inside
53 $ cd ..
53 $ cd ..
54
54
55 add more upstream files which we will include in a wider narrow spec
55 add more upstream files which we will include in a wider narrow spec
56
56
57 $ cd master
57 $ cd master
58
58
59 $ mkdir wider
59 $ mkdir wider
60 $ echo 'wider' > wider/f
60 $ echo 'wider' > wider/f
61 $ hg add wider/f
61 $ hg add wider/f
62 $ echo 'widest v2' > widest/f
62 $ echo 'widest v2' > widest/f
63 $ hg commit -m 'add wider, update widest'
63 $ hg commit -m 'add wider, update widest'
64
64
65 $ echo 'widest v3' > widest/f
65 $ echo 'widest v3' > widest/f
66 $ hg commit -m 'update widest v3'
66 $ hg commit -m 'update widest v3'
67
67
68 $ echo 'inside v2' > inside/f
68 $ echo 'inside v2' > inside/f
69 $ hg commit -m 'update inside'
69 $ hg commit -m 'update inside'
70
70
71 $ mkdir outside2
71 $ mkdir outside2
72 $ echo 'outside2' > outside2/f
72 $ echo 'outside2' > outside2/f
73 $ hg add outside2/f
73 $ hg add outside2/f
74 $ hg commit -m 'add outside2'
74 $ hg commit -m 'add outside2'
75
75
76 $ echo 'widest v4' > widest/f
76 $ echo 'widest v4' > widest/f
77 $ hg commit -m 'update widest v4'
77 $ hg commit -m 'update widest v4'
78
78
79 $ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n"
79 $ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n"
80 7: update widest v4
80 7: update widest v4
81 6: add outside2
81 6: add outside2
82 5: update inside
82 5: update inside
83 4: update widest v3
83 4: update widest v3
84 3: add wider, update widest
84 3: add wider, update widest
85 2: add outside
85 2: add outside
86 1: add widest
86 1: add widest
87 0: add inside
87 0: add inside
88
88
89 $ cd ..
89 $ cd ..
90
90
91 Testing the --import-rules flag of `hg tracked` command
91 Testing the --import-rules flag of `hg tracked` command
92
92
93 $ cd narrow
93 $ cd narrow
94 $ hg tracked --import-rules
94 $ hg tracked --import-rules
95 hg tracked: option --import-rules requires argument
95 hg tracked: option --import-rules requires argument
96 hg tracked [OPTIONS]... [REMOTE]
96 hg tracked [OPTIONS]... [REMOTE]
97
97
98 show or change the current narrowspec
98 show or change the current narrowspec
99
99
100 options ([+] can be repeated):
100 options ([+] can be repeated):
101
101
102 --addinclude VALUE [+] new paths to include
102 --addinclude VALUE [+] new paths to include
103 --removeinclude VALUE [+] old paths to no longer include
103 --removeinclude VALUE [+] old paths to no longer include
104 --addexclude VALUE [+] new paths to exclude
104 --addexclude VALUE [+] new paths to exclude
105 --import-rules VALUE import narrowspecs from a file
105 --import-rules VALUE import narrowspecs from a file
106 --removeexclude VALUE [+] old paths to no longer exclude
106 --removeexclude VALUE [+] old paths to no longer exclude
107 --[no-]clear whether to replace the existing
107 --clear whether to replace the existing narrowspec
108 narrowspec (default: off)
108 (default: off)
109 --[no-]force-delete-local-changes forces deletion of local changes when
109 --force-delete-local-changes forces deletion of local changes when
110 narrowing (default: off)
110 narrowing (default: off)
111 -e --ssh CMD specify ssh command to use
111 -e --ssh CMD specify ssh command to use
112 --remotecmd CMD specify hg command to run on the remote
112 --remotecmd CMD specify hg command to run on the remote side
113 side
113 --insecure do not verify server certificate (ignoring
114 --insecure do not verify server certificate
114 web.cacerts config)
115 (ignoring web.cacerts config)
116
115
117 (use 'hg tracked -h' to show more help)
116 (use 'hg tracked -h' to show more help)
118 [255]
117 [255]
119 $ hg tracked --import-rules doesnotexist
118 $ hg tracked --import-rules doesnotexist
120 abort: cannot read narrowspecs from '$TESTTMP/narrow/doesnotexist': $ENOENT$
119 abort: cannot read narrowspecs from '$TESTTMP/narrow/doesnotexist': $ENOENT$
121 [255]
120 [255]
122
121
123 $ cat > specs <<EOF
122 $ cat > specs <<EOF
124 > %include foo
123 > %include foo
125 > [include]
124 > [include]
126 > path:widest/
125 > path:widest/
127 > [exclude]
126 > [exclude]
128 > path:inside/
127 > path:inside/
129 > EOF
128 > EOF
130
129
131 $ hg tracked --import-rules specs
130 $ hg tracked --import-rules specs
132 abort: including other spec files using '%include' is not supported in narrowspec
131 abort: including other spec files using '%include' is not supported in narrowspec
133 [255]
132 [255]
134
133
135 $ cat > specs <<EOF
134 $ cat > specs <<EOF
136 > [include]
135 > [include]
137 > outisde
136 > outisde
138 > [exclude]
137 > [exclude]
139 > inside
138 > inside
140 > EOF
139 > EOF
141
140
142 $ hg tracked --import-rules specs
141 $ hg tracked --import-rules specs
143 comparing with ssh://user@dummy/master
142 comparing with ssh://user@dummy/master
144 searching for changes
143 searching for changes
145 looking for local changes to affected paths
144 looking for local changes to affected paths
146 deleting data/inside/f.i
145 deleting data/inside/f.i
147 deleting meta/inside/00manifest.i (tree !)
146 deleting meta/inside/00manifest.i (tree !)
148 no changes found
147 no changes found
149 saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-widen.hg (glob)
148 saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-widen.hg (glob)
150 adding changesets
149 adding changesets
151 adding manifests
150 adding manifests
152 adding file changes
151 adding file changes
153 added 2 changesets with 0 changes to 0 files
152 added 2 changesets with 0 changes to 0 files
154 new changesets *:* (glob)
153 new changesets *:* (glob)
155 $ hg tracked
154 $ hg tracked
156 I path:outisde
155 I path:outisde
157 X path:inside
156 X path:inside
158
157
159 Testing the --import-rules flag with --addinclude and --addexclude
158 Testing the --import-rules flag with --addinclude and --addexclude
160
159
161 $ cat > specs <<EOF
160 $ cat > specs <<EOF
162 > [include]
161 > [include]
163 > widest
162 > widest
164 > EOF
163 > EOF
165
164
166 $ hg tracked --import-rules specs --addinclude 'wider/'
165 $ hg tracked --import-rules specs --addinclude 'wider/'
167 comparing with ssh://user@dummy/master
166 comparing with ssh://user@dummy/master
168 searching for changes
167 searching for changes
169 no changes found
168 no changes found
170 saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-widen.hg (glob)
169 saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-widen.hg (glob)
171 adding changesets
170 adding changesets
172 adding manifests
171 adding manifests
173 adding file changes
172 adding file changes
174 added 3 changesets with 1 changes to 1 files
173 added 3 changesets with 1 changes to 1 files
175 new changesets *:* (glob)
174 new changesets *:* (glob)
176 $ hg tracked
175 $ hg tracked
177 I path:outisde
176 I path:outisde
178 I path:wider
177 I path:wider
179 I path:widest
178 I path:widest
180 X path:inside
179 X path:inside
181
180
182 $ cat > specs <<EOF
181 $ cat > specs <<EOF
183 > [exclude]
182 > [exclude]
184 > outside2
183 > outside2
185 > EOF
184 > EOF
186
185
187 $ hg tracked --import-rules specs --addexclude 'widest'
186 $ hg tracked --import-rules specs --addexclude 'widest'
188 comparing with ssh://user@dummy/master
187 comparing with ssh://user@dummy/master
189 searching for changes
188 searching for changes
190 looking for local changes to affected paths
189 looking for local changes to affected paths
191 deleting data/widest/f.i
190 deleting data/widest/f.i
192 deleting meta/widest/00manifest.i (tree !)
191 deleting meta/widest/00manifest.i (tree !)
193 $ hg tracked
192 $ hg tracked
194 I path:outisde
193 I path:outisde
195 I path:wider
194 I path:wider
196 X path:inside
195 X path:inside
197 X path:outside2
196 X path:outside2
198 X path:widest
197 X path:widest
199
198
200 $ hg tracked --import-rules specs --clear
199 $ hg tracked --import-rules specs --clear
201 The --clear option is not yet supported.
200 The --clear option is not yet supported.
202 [1]
201 [1]
203
202
204 Testing with passing a out of wdir file
203 Testing with passing a out of wdir file
205
204
206 $ cat > ../nspecs <<EOF
205 $ cat > ../nspecs <<EOF
207 > [include]
206 > [include]
208 > widest
207 > widest
209 > EOF
208 > EOF
210
209
211 $ hg tracked --import-rules ../nspecs
210 $ hg tracked --import-rules ../nspecs
212 comparing with ssh://user@dummy/master
211 comparing with ssh://user@dummy/master
213 searching for changes
212 searching for changes
214 no changes found
213 no changes found
215 saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-widen.hg (glob)
214 saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-widen.hg (glob)
216 adding changesets
215 adding changesets
217 adding manifests
216 adding manifests
218 adding file changes
217 adding file changes
219 added 3 changesets with 0 changes to 0 files
218 added 3 changesets with 0 changes to 0 files
220 new changesets *:* (glob)
219 new changesets *:* (glob)
@@ -1,1089 +1,1089 b''
1 #testcases stripbased phasebased
1 #testcases stripbased phasebased
2
2
3 $ cat <<EOF >> $HGRCPATH
3 $ cat <<EOF >> $HGRCPATH
4 > [extensions]
4 > [extensions]
5 > mq =
5 > mq =
6 > shelve =
6 > shelve =
7 > [defaults]
7 > [defaults]
8 > diff = --nodates --git
8 > diff = --nodates --git
9 > qnew = --date '0 0'
9 > qnew = --date '0 0'
10 > [shelve]
10 > [shelve]
11 > maxbackups = 2
11 > maxbackups = 2
12 > EOF
12 > EOF
13
13
14 #if phasebased
14 #if phasebased
15
15
16 $ cat <<EOF >> $HGRCPATH
16 $ cat <<EOF >> $HGRCPATH
17 > [format]
17 > [format]
18 > internal-phase = yes
18 > internal-phase = yes
19 > EOF
19 > EOF
20
20
21 #endif
21 #endif
22
22
23 $ hg init repo
23 $ hg init repo
24 $ cd repo
24 $ cd repo
25 $ mkdir a b
25 $ mkdir a b
26 $ echo a > a/a
26 $ echo a > a/a
27 $ echo b > b/b
27 $ echo b > b/b
28 $ echo c > c
28 $ echo c > c
29 $ echo d > d
29 $ echo d > d
30 $ echo x > x
30 $ echo x > x
31 $ hg addremove -q
31 $ hg addremove -q
32
32
33 shelve has a help message
33 shelve has a help message
34 $ hg shelve -h
34 $ hg shelve -h
35 hg shelve [OPTION]... [FILE]...
35 hg shelve [OPTION]... [FILE]...
36
36
37 save and set aside changes from the working directory
37 save and set aside changes from the working directory
38
38
39 Shelving takes files that "hg status" reports as not clean, saves the
39 Shelving takes files that "hg status" reports as not clean, saves the
40 modifications to a bundle (a shelved change), and reverts the files so
40 modifications to a bundle (a shelved change), and reverts the files so
41 that their state in the working directory becomes clean.
41 that their state in the working directory becomes clean.
42
42
43 To restore these changes to the working directory, using "hg unshelve";
43 To restore these changes to the working directory, using "hg unshelve";
44 this will work even if you switch to a different commit.
44 this will work even if you switch to a different commit.
45
45
46 When no files are specified, "hg shelve" saves all not-clean files. If
46 When no files are specified, "hg shelve" saves all not-clean files. If
47 specific files or directories are named, only changes to those files are
47 specific files or directories are named, only changes to those files are
48 shelved.
48 shelved.
49
49
50 In bare shelve (when no files are specified, without interactive, include
50 In bare shelve (when no files are specified, without interactive, include
51 and exclude option), shelving remembers information if the working
51 and exclude option), shelving remembers information if the working
52 directory was on newly created branch, in other words working directory
52 directory was on newly created branch, in other words working directory
53 was on different branch than its first parent. In this situation
53 was on different branch than its first parent. In this situation
54 unshelving restores branch information to the working directory.
54 unshelving restores branch information to the working directory.
55
55
56 Each shelved change has a name that makes it easier to find later. The
56 Each shelved change has a name that makes it easier to find later. The
57 name of a shelved change defaults to being based on the active bookmark,
57 name of a shelved change defaults to being based on the active bookmark,
58 or if there is no active bookmark, the current named branch. To specify a
58 or if there is no active bookmark, the current named branch. To specify a
59 different name, use "--name".
59 different name, use "--name".
60
60
61 To see a list of existing shelved changes, use the "--list" option. For
61 To see a list of existing shelved changes, use the "--list" option. For
62 each shelved change, this will print its name, age, and description; use "
62 each shelved change, this will print its name, age, and description; use "
63 --patch" or "--stat" for more details.
63 --patch" or "--stat" for more details.
64
64
65 To delete specific shelved changes, use "--delete". To delete all shelved
65 To delete specific shelved changes, use "--delete". To delete all shelved
66 changes, use "--cleanup".
66 changes, use "--cleanup".
67
67
68 (use 'hg help -e shelve' to show help for the shelve extension)
68 (use 'hg help -e shelve' to show help for the shelve extension)
69
69
70 options ([+] can be repeated):
70 options ([+] can be repeated):
71
71
72 -A --addremove mark new/missing files as added/removed before
72 -A --addremove mark new/missing files as added/removed before
73 shelving
73 shelving
74 -u --unknown store unknown files in the shelve
74 -u --unknown store unknown files in the shelve
75 --cleanup delete all shelved changes
75 --cleanup delete all shelved changes
76 --date DATE shelve with the specified commit date
76 --date DATE shelve with the specified commit date
77 -d --delete delete the named shelved change(s)
77 -d --delete delete the named shelved change(s)
78 -e --[no-]edit invoke editor on commit messages (default: off)
78 -e --edit invoke editor on commit messages (default: off)
79 -l --list list current shelves
79 -l --list list current shelves
80 -m --message TEXT use text as shelve message
80 -m --message TEXT use text as shelve message
81 -n --name NAME use the given name for the shelved commit
81 -n --name NAME use the given name for the shelved commit
82 -p --patch output patches for changes (provide the names of the
82 -p --patch output patches for changes (provide the names of the
83 shelved changes as positional arguments)
83 shelved changes as positional arguments)
84 -i --interactive interactive mode, only works while creating a shelve
84 -i --interactive interactive mode, only works while creating a shelve
85 --stat output diffstat-style summary of changes (provide
85 --stat output diffstat-style summary of changes (provide
86 the names of the shelved changes as positional
86 the names of the shelved changes as positional
87 arguments)
87 arguments)
88 -I --include PATTERN [+] include names matching the given patterns
88 -I --include PATTERN [+] include names matching the given patterns
89 -X --exclude PATTERN [+] exclude names matching the given patterns
89 -X --exclude PATTERN [+] exclude names matching the given patterns
90 --mq operate on patch repository
90 --mq operate on patch repository
91
91
92 (some details hidden, use --verbose to show complete help)
92 (some details hidden, use --verbose to show complete help)
93
93
94 shelving in an empty repo should be possible
94 shelving in an empty repo should be possible
95 (this tests also that editor is not invoked, if '--edit' is not
95 (this tests also that editor is not invoked, if '--edit' is not
96 specified)
96 specified)
97
97
98 $ HGEDITOR=cat hg shelve
98 $ HGEDITOR=cat hg shelve
99 shelved as default
99 shelved as default
100 0 files updated, 0 files merged, 5 files removed, 0 files unresolved
100 0 files updated, 0 files merged, 5 files removed, 0 files unresolved
101
101
102 $ hg unshelve
102 $ hg unshelve
103 unshelving change 'default'
103 unshelving change 'default'
104
104
105 $ hg commit -q -m 'initial commit'
105 $ hg commit -q -m 'initial commit'
106
106
107 $ hg shelve
107 $ hg shelve
108 nothing changed
108 nothing changed
109 [1]
109 [1]
110
110
111 make sure shelve files were backed up
111 make sure shelve files were backed up
112
112
113 $ ls .hg/shelve-backup
113 $ ls .hg/shelve-backup
114 default.hg
114 default.hg
115 default.patch
115 default.patch
116 default.shelve
116 default.shelve
117
117
118 checks to make sure we dont create a directory or
118 checks to make sure we dont create a directory or
119 hidden file while choosing a new shelve name
119 hidden file while choosing a new shelve name
120
120
121 when we are given a name
121 when we are given a name
122
122
123 $ hg shelve -n foo/bar
123 $ hg shelve -n foo/bar
124 abort: shelved change names can not contain slashes
124 abort: shelved change names can not contain slashes
125 [255]
125 [255]
126 $ hg shelve -n .baz
126 $ hg shelve -n .baz
127 abort: shelved change names can not start with '.'
127 abort: shelved change names can not start with '.'
128 [255]
128 [255]
129 $ hg shelve -n foo\\bar
129 $ hg shelve -n foo\\bar
130 abort: shelved change names can not contain slashes
130 abort: shelved change names can not contain slashes
131 [255]
131 [255]
132
132
133 when shelve has to choose itself
133 when shelve has to choose itself
134
134
135 $ hg branch x/y -q
135 $ hg branch x/y -q
136 $ hg commit -q -m "Branch commit 0"
136 $ hg commit -q -m "Branch commit 0"
137 $ hg shelve
137 $ hg shelve
138 nothing changed
138 nothing changed
139 [1]
139 [1]
140 $ hg branch .x -q
140 $ hg branch .x -q
141 $ hg commit -q -m "Branch commit 1"
141 $ hg commit -q -m "Branch commit 1"
142 $ hg shelve
142 $ hg shelve
143 nothing changed
143 nothing changed
144 [1]
144 [1]
145 $ hg branch x\\y -q
145 $ hg branch x\\y -q
146 $ hg commit -q -m "Branch commit 2"
146 $ hg commit -q -m "Branch commit 2"
147 $ hg shelve
147 $ hg shelve
148 nothing changed
148 nothing changed
149 [1]
149 [1]
150
150
151 cleaning the branches made for name checking tests
151 cleaning the branches made for name checking tests
152
152
153 $ hg up default -q
153 $ hg up default -q
154 $ hg strip e9177275307e+6a6d231f43d+882bae7c62c2 -q
154 $ hg strip e9177275307e+6a6d231f43d+882bae7c62c2 -q
155
155
156 create an mq patch - shelving should work fine with a patch applied
156 create an mq patch - shelving should work fine with a patch applied
157
157
158 $ echo n > n
158 $ echo n > n
159 $ hg add n
159 $ hg add n
160 $ hg commit n -m second
160 $ hg commit n -m second
161 $ hg qnew second.patch
161 $ hg qnew second.patch
162
162
163 shelve a change that we will delete later
163 shelve a change that we will delete later
164
164
165 $ echo a >> a/a
165 $ echo a >> a/a
166 $ hg shelve
166 $ hg shelve
167 shelved as default
167 shelved as default
168 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
168 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
169
169
170 set up some more complex changes to shelve
170 set up some more complex changes to shelve
171
171
172 $ echo a >> a/a
172 $ echo a >> a/a
173 $ hg mv b b.rename
173 $ hg mv b b.rename
174 moving b/b to b.rename/b
174 moving b/b to b.rename/b
175 $ hg cp c c.copy
175 $ hg cp c c.copy
176 $ hg status -C
176 $ hg status -C
177 M a/a
177 M a/a
178 A b.rename/b
178 A b.rename/b
179 b/b
179 b/b
180 A c.copy
180 A c.copy
181 c
181 c
182 R b/b
182 R b/b
183
183
184 the common case - no options or filenames
184 the common case - no options or filenames
185
185
186 $ hg shelve
186 $ hg shelve
187 shelved as default-01
187 shelved as default-01
188 2 files updated, 0 files merged, 2 files removed, 0 files unresolved
188 2 files updated, 0 files merged, 2 files removed, 0 files unresolved
189 $ hg status -C
189 $ hg status -C
190
190
191 ensure that our shelved changes exist
191 ensure that our shelved changes exist
192
192
193 $ hg shelve -l
193 $ hg shelve -l
194 default-01 (*)* changes to: [mq]: second.patch (glob)
194 default-01 (*)* changes to: [mq]: second.patch (glob)
195 default (*)* changes to: [mq]: second.patch (glob)
195 default (*)* changes to: [mq]: second.patch (glob)
196
196
197 $ hg shelve -l -p default
197 $ hg shelve -l -p default
198 default (*)* changes to: [mq]: second.patch (glob)
198 default (*)* changes to: [mq]: second.patch (glob)
199
199
200 diff --git a/a/a b/a/a
200 diff --git a/a/a b/a/a
201 --- a/a/a
201 --- a/a/a
202 +++ b/a/a
202 +++ b/a/a
203 @@ -1,1 +1,2 @@
203 @@ -1,1 +1,2 @@
204 a
204 a
205 +a
205 +a
206
206
207 $ hg shelve --list --addremove
207 $ hg shelve --list --addremove
208 abort: options '--list' and '--addremove' may not be used together
208 abort: options '--list' and '--addremove' may not be used together
209 [255]
209 [255]
210
210
211 delete our older shelved change
211 delete our older shelved change
212
212
213 $ hg shelve -d default
213 $ hg shelve -d default
214 $ hg qfinish -a -q
214 $ hg qfinish -a -q
215
215
216 ensure shelve backups aren't overwritten
216 ensure shelve backups aren't overwritten
217
217
218 $ ls .hg/shelve-backup/
218 $ ls .hg/shelve-backup/
219 default-1.hg
219 default-1.hg
220 default-1.patch
220 default-1.patch
221 default-1.shelve
221 default-1.shelve
222 default.hg
222 default.hg
223 default.patch
223 default.patch
224 default.shelve
224 default.shelve
225
225
226 local edits should not prevent a shelved change from applying
226 local edits should not prevent a shelved change from applying
227
227
228 $ printf "z\na\n" > a/a
228 $ printf "z\na\n" > a/a
229 $ hg unshelve --keep
229 $ hg unshelve --keep
230 unshelving change 'default-01'
230 unshelving change 'default-01'
231 temporarily committing pending changes (restore with 'hg unshelve --abort')
231 temporarily committing pending changes (restore with 'hg unshelve --abort')
232 rebasing shelved changes
232 rebasing shelved changes
233 merging a/a
233 merging a/a
234
234
235 $ hg revert --all -q
235 $ hg revert --all -q
236 $ rm a/a.orig b.rename/b c.copy
236 $ rm a/a.orig b.rename/b c.copy
237
237
238 apply it and make sure our state is as expected
238 apply it and make sure our state is as expected
239
239
240 (this also tests that same timestamp prevents backups from being
240 (this also tests that same timestamp prevents backups from being
241 removed, even though there are more than 'maxbackups' backups)
241 removed, even though there are more than 'maxbackups' backups)
242
242
243 $ f -t .hg/shelve-backup/default.patch
243 $ f -t .hg/shelve-backup/default.patch
244 .hg/shelve-backup/default.patch: file
244 .hg/shelve-backup/default.patch: file
245 $ touch -t 200001010000 .hg/shelve-backup/default.patch
245 $ touch -t 200001010000 .hg/shelve-backup/default.patch
246 $ f -t .hg/shelve-backup/default-1.patch
246 $ f -t .hg/shelve-backup/default-1.patch
247 .hg/shelve-backup/default-1.patch: file
247 .hg/shelve-backup/default-1.patch: file
248 $ touch -t 200001010000 .hg/shelve-backup/default-1.patch
248 $ touch -t 200001010000 .hg/shelve-backup/default-1.patch
249
249
250 $ hg unshelve
250 $ hg unshelve
251 unshelving change 'default-01'
251 unshelving change 'default-01'
252 $ hg status -C
252 $ hg status -C
253 M a/a
253 M a/a
254 A b.rename/b
254 A b.rename/b
255 b/b
255 b/b
256 A c.copy
256 A c.copy
257 c
257 c
258 R b/b
258 R b/b
259 $ hg shelve -l
259 $ hg shelve -l
260
260
261 (both of default.hg and default-1.hg should be still kept, because it
261 (both of default.hg and default-1.hg should be still kept, because it
262 is difficult to decide actual order of them from same timestamp)
262 is difficult to decide actual order of them from same timestamp)
263
263
264 $ ls .hg/shelve-backup/
264 $ ls .hg/shelve-backup/
265 default-01.hg
265 default-01.hg
266 default-01.patch
266 default-01.patch
267 default-01.shelve
267 default-01.shelve
268 default-1.hg
268 default-1.hg
269 default-1.patch
269 default-1.patch
270 default-1.shelve
270 default-1.shelve
271 default.hg
271 default.hg
272 default.patch
272 default.patch
273 default.shelve
273 default.shelve
274
274
275 $ hg unshelve
275 $ hg unshelve
276 abort: no shelved changes to apply!
276 abort: no shelved changes to apply!
277 [255]
277 [255]
278 $ hg unshelve foo
278 $ hg unshelve foo
279 abort: shelved change 'foo' not found
279 abort: shelved change 'foo' not found
280 [255]
280 [255]
281
281
282 named shelves, specific filenames, and "commit messages" should all work
282 named shelves, specific filenames, and "commit messages" should all work
283 (this tests also that editor is invoked, if '--edit' is specified)
283 (this tests also that editor is invoked, if '--edit' is specified)
284
284
285 $ hg status -C
285 $ hg status -C
286 M a/a
286 M a/a
287 A b.rename/b
287 A b.rename/b
288 b/b
288 b/b
289 A c.copy
289 A c.copy
290 c
290 c
291 R b/b
291 R b/b
292 $ HGEDITOR=cat hg shelve -q -n wibble -m wat -e a
292 $ HGEDITOR=cat hg shelve -q -n wibble -m wat -e a
293 wat
293 wat
294
294
295
295
296 HG: Enter commit message. Lines beginning with 'HG:' are removed.
296 HG: Enter commit message. Lines beginning with 'HG:' are removed.
297 HG: Leave message empty to abort commit.
297 HG: Leave message empty to abort commit.
298 HG: --
298 HG: --
299 HG: user: shelve@localhost
299 HG: user: shelve@localhost
300 HG: branch 'default'
300 HG: branch 'default'
301 HG: changed a/a
301 HG: changed a/a
302
302
303 expect "a" to no longer be present, but status otherwise unchanged
303 expect "a" to no longer be present, but status otherwise unchanged
304
304
305 $ hg status -C
305 $ hg status -C
306 A b.rename/b
306 A b.rename/b
307 b/b
307 b/b
308 A c.copy
308 A c.copy
309 c
309 c
310 R b/b
310 R b/b
311 $ hg shelve -l --stat
311 $ hg shelve -l --stat
312 wibble (*) wat (glob)
312 wibble (*) wat (glob)
313 a/a | 1 +
313 a/a | 1 +
314 1 files changed, 1 insertions(+), 0 deletions(-)
314 1 files changed, 1 insertions(+), 0 deletions(-)
315
315
316 and now "a/a" should reappear
316 and now "a/a" should reappear
317
317
318 $ cd a
318 $ cd a
319 $ hg unshelve -q wibble
319 $ hg unshelve -q wibble
320 $ cd ..
320 $ cd ..
321 $ hg status -C
321 $ hg status -C
322 M a/a
322 M a/a
323 A b.rename/b
323 A b.rename/b
324 b/b
324 b/b
325 A c.copy
325 A c.copy
326 c
326 c
327 R b/b
327 R b/b
328
328
329 ensure old shelve backups are being deleted automatically
329 ensure old shelve backups are being deleted automatically
330
330
331 $ ls .hg/shelve-backup/
331 $ ls .hg/shelve-backup/
332 default-01.hg
332 default-01.hg
333 default-01.patch
333 default-01.patch
334 default-01.shelve
334 default-01.shelve
335 wibble.hg
335 wibble.hg
336 wibble.patch
336 wibble.patch
337 wibble.shelve
337 wibble.shelve
338
338
339 cause unshelving to result in a merge with 'a' conflicting
339 cause unshelving to result in a merge with 'a' conflicting
340
340
341 $ hg shelve -q
341 $ hg shelve -q
342 $ echo c>>a/a
342 $ echo c>>a/a
343 $ hg commit -m second
343 $ hg commit -m second
344 $ hg tip --template '{files}\n'
344 $ hg tip --template '{files}\n'
345 a/a
345 a/a
346
346
347 add an unrelated change that should be preserved
347 add an unrelated change that should be preserved
348
348
349 $ mkdir foo
349 $ mkdir foo
350 $ echo foo > foo/foo
350 $ echo foo > foo/foo
351 $ hg add foo/foo
351 $ hg add foo/foo
352
352
353 force a conflicted merge to occur
353 force a conflicted merge to occur
354
354
355 $ hg unshelve
355 $ hg unshelve
356 unshelving change 'default'
356 unshelving change 'default'
357 temporarily committing pending changes (restore with 'hg unshelve --abort')
357 temporarily committing pending changes (restore with 'hg unshelve --abort')
358 rebasing shelved changes
358 rebasing shelved changes
359 merging a/a
359 merging a/a
360 warning: conflicts while merging a/a! (edit, then use 'hg resolve --mark')
360 warning: conflicts while merging a/a! (edit, then use 'hg resolve --mark')
361 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
361 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
362 [1]
362 [1]
363 $ hg status -v
363 $ hg status -v
364 M a/a
364 M a/a
365 M b.rename/b
365 M b.rename/b
366 M c.copy
366 M c.copy
367 R b/b
367 R b/b
368 ? a/a.orig
368 ? a/a.orig
369 # The repository is in an unfinished *unshelve* state.
369 # The repository is in an unfinished *unshelve* state.
370
370
371 # Unresolved merge conflicts:
371 # Unresolved merge conflicts:
372 #
372 #
373 # a/a
373 # a/a
374 #
374 #
375 # To mark files as resolved: hg resolve --mark FILE
375 # To mark files as resolved: hg resolve --mark FILE
376
376
377 # To continue: hg unshelve --continue
377 # To continue: hg unshelve --continue
378 # To abort: hg unshelve --abort
378 # To abort: hg unshelve --abort
379
379
380
380
381 ensure that we have a merge with unresolved conflicts
381 ensure that we have a merge with unresolved conflicts
382
382
383 #if phasebased
383 #if phasebased
384 $ hg heads -q --template '{rev}\n'
384 $ hg heads -q --template '{rev}\n'
385 8
385 8
386 5
386 5
387 $ hg parents -q --template '{rev}\n'
387 $ hg parents -q --template '{rev}\n'
388 8
388 8
389 5
389 5
390 #endif
390 #endif
391
391
392 #if stripbased
392 #if stripbased
393 $ hg heads -q --template '{rev}\n'
393 $ hg heads -q --template '{rev}\n'
394 5
394 5
395 4
395 4
396 $ hg parents -q --template '{rev}\n'
396 $ hg parents -q --template '{rev}\n'
397 4
397 4
398 5
398 5
399 #endif
399 #endif
400
400
401 $ hg status
401 $ hg status
402 M a/a
402 M a/a
403 M b.rename/b
403 M b.rename/b
404 M c.copy
404 M c.copy
405 R b/b
405 R b/b
406 ? a/a.orig
406 ? a/a.orig
407 $ hg diff
407 $ hg diff
408 diff --git a/a/a b/a/a
408 diff --git a/a/a b/a/a
409 --- a/a/a
409 --- a/a/a
410 +++ b/a/a
410 +++ b/a/a
411 @@ -1,2 +1,6 @@
411 @@ -1,2 +1,6 @@
412 a
412 a
413 +<<<<<<< shelve: 2377350b6337 - shelve: pending changes temporary commit
413 +<<<<<<< shelve: 2377350b6337 - shelve: pending changes temporary commit
414 c
414 c
415 +=======
415 +=======
416 +a
416 +a
417 +>>>>>>> working-copy: a68ec3400638 - shelve: changes to: [mq]: second.patch
417 +>>>>>>> working-copy: a68ec3400638 - shelve: changes to: [mq]: second.patch
418 diff --git a/b/b b/b.rename/b
418 diff --git a/b/b b/b.rename/b
419 rename from b/b
419 rename from b/b
420 rename to b.rename/b
420 rename to b.rename/b
421 diff --git a/c b/c.copy
421 diff --git a/c b/c.copy
422 copy from c
422 copy from c
423 copy to c.copy
423 copy to c.copy
424 $ hg resolve -l
424 $ hg resolve -l
425 U a/a
425 U a/a
426
426
427 $ hg shelve
427 $ hg shelve
428 abort: unshelve already in progress
428 abort: unshelve already in progress
429 (use 'hg unshelve --continue' or 'hg unshelve --abort')
429 (use 'hg unshelve --continue' or 'hg unshelve --abort')
430 [255]
430 [255]
431
431
432 abort the unshelve and be happy
432 abort the unshelve and be happy
433
433
434 $ hg status
434 $ hg status
435 M a/a
435 M a/a
436 M b.rename/b
436 M b.rename/b
437 M c.copy
437 M c.copy
438 R b/b
438 R b/b
439 ? a/a.orig
439 ? a/a.orig
440 $ hg unshelve -a
440 $ hg unshelve -a
441 unshelve of 'default' aborted
441 unshelve of 'default' aborted
442 $ hg heads -q
442 $ hg heads -q
443 [37]:2e69b451d1ea (re)
443 [37]:2e69b451d1ea (re)
444 $ hg parents
444 $ hg parents
445 changeset: [37]:2e69b451d1ea (re)
445 changeset: [37]:2e69b451d1ea (re)
446 tag: tip
446 tag: tip
447 parent: 3:509104101065 (?)
447 parent: 3:509104101065 (?)
448 user: test
448 user: test
449 date: Thu Jan 01 00:00:00 1970 +0000
449 date: Thu Jan 01 00:00:00 1970 +0000
450 summary: second
450 summary: second
451
451
452 $ hg resolve -l
452 $ hg resolve -l
453 $ hg status
453 $ hg status
454 A foo/foo
454 A foo/foo
455 ? a/a.orig
455 ? a/a.orig
456
456
457 try to continue with no unshelve underway
457 try to continue with no unshelve underway
458
458
459 $ hg unshelve -c
459 $ hg unshelve -c
460 abort: no unshelve in progress
460 abort: no unshelve in progress
461 [255]
461 [255]
462 $ hg status
462 $ hg status
463 A foo/foo
463 A foo/foo
464 ? a/a.orig
464 ? a/a.orig
465
465
466 redo the unshelve to get a conflict
466 redo the unshelve to get a conflict
467
467
468 $ hg unshelve -q
468 $ hg unshelve -q
469 warning: conflicts while merging a/a! (edit, then use 'hg resolve --mark')
469 warning: conflicts while merging a/a! (edit, then use 'hg resolve --mark')
470 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
470 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
471 [1]
471 [1]
472
472
473 attempt to continue
473 attempt to continue
474
474
475 $ hg unshelve -c
475 $ hg unshelve -c
476 abort: unresolved conflicts, can't continue
476 abort: unresolved conflicts, can't continue
477 (see 'hg resolve', then 'hg unshelve --continue')
477 (see 'hg resolve', then 'hg unshelve --continue')
478 [255]
478 [255]
479
479
480 $ hg revert -r . a/a
480 $ hg revert -r . a/a
481 $ hg resolve -m a/a
481 $ hg resolve -m a/a
482 (no more unresolved files)
482 (no more unresolved files)
483 continue: hg unshelve --continue
483 continue: hg unshelve --continue
484
484
485 $ hg commit -m 'commit while unshelve in progress'
485 $ hg commit -m 'commit while unshelve in progress'
486 abort: unshelve already in progress
486 abort: unshelve already in progress
487 (use 'hg unshelve --continue' or 'hg unshelve --abort')
487 (use 'hg unshelve --continue' or 'hg unshelve --abort')
488 [255]
488 [255]
489
489
490 $ hg graft --continue
490 $ hg graft --continue
491 abort: no graft in progress
491 abort: no graft in progress
492 (continue: hg unshelve --continue)
492 (continue: hg unshelve --continue)
493 [255]
493 [255]
494 $ hg unshelve -c
494 $ hg unshelve -c
495 unshelve of 'default' complete
495 unshelve of 'default' complete
496
496
497 ensure the repo is as we hope
497 ensure the repo is as we hope
498
498
499 $ hg parents
499 $ hg parents
500 changeset: [37]:2e69b451d1ea (re)
500 changeset: [37]:2e69b451d1ea (re)
501 tag: tip
501 tag: tip
502 parent: 3:509104101065 (?)
502 parent: 3:509104101065 (?)
503 user: test
503 user: test
504 date: Thu Jan 01 00:00:00 1970 +0000
504 date: Thu Jan 01 00:00:00 1970 +0000
505 summary: second
505 summary: second
506
506
507 $ hg heads -q
507 $ hg heads -q
508 [37]:2e69b451d1ea (re)
508 [37]:2e69b451d1ea (re)
509
509
510 $ hg status -C
510 $ hg status -C
511 A b.rename/b
511 A b.rename/b
512 b/b
512 b/b
513 A c.copy
513 A c.copy
514 c
514 c
515 A foo/foo
515 A foo/foo
516 R b/b
516 R b/b
517 ? a/a.orig
517 ? a/a.orig
518
518
519 there should be no shelves left
519 there should be no shelves left
520
520
521 $ hg shelve -l
521 $ hg shelve -l
522
522
523 #if execbit
523 #if execbit
524
524
525 ensure that metadata-only changes are shelved
525 ensure that metadata-only changes are shelved
526
526
527 $ chmod +x a/a
527 $ chmod +x a/a
528 $ hg shelve -q -n execbit a/a
528 $ hg shelve -q -n execbit a/a
529 $ hg status a/a
529 $ hg status a/a
530 $ hg unshelve -q execbit
530 $ hg unshelve -q execbit
531 $ hg status a/a
531 $ hg status a/a
532 M a/a
532 M a/a
533 $ hg revert a/a
533 $ hg revert a/a
534
534
535 #else
535 #else
536
536
537 Dummy shelve op, to keep rev numbers aligned
537 Dummy shelve op, to keep rev numbers aligned
538
538
539 $ echo foo > a/a
539 $ echo foo > a/a
540 $ hg shelve -q -n dummy a/a
540 $ hg shelve -q -n dummy a/a
541 $ hg unshelve -q dummy
541 $ hg unshelve -q dummy
542 $ hg revert a/a
542 $ hg revert a/a
543
543
544 #endif
544 #endif
545
545
546 #if symlink
546 #if symlink
547
547
548 $ rm a/a
548 $ rm a/a
549 $ ln -s foo a/a
549 $ ln -s foo a/a
550 $ hg shelve -q -n symlink a/a
550 $ hg shelve -q -n symlink a/a
551 $ hg status a/a
551 $ hg status a/a
552 $ hg unshelve -q -n symlink
552 $ hg unshelve -q -n symlink
553 $ hg status a/a
553 $ hg status a/a
554 M a/a
554 M a/a
555 $ hg revert a/a
555 $ hg revert a/a
556
556
557 #else
557 #else
558
558
559 Dummy shelve op, to keep rev numbers aligned
559 Dummy shelve op, to keep rev numbers aligned
560
560
561 $ echo bar > a/a
561 $ echo bar > a/a
562 $ hg shelve -q -n dummy a/a
562 $ hg shelve -q -n dummy a/a
563 $ hg unshelve -q dummy
563 $ hg unshelve -q dummy
564 $ hg revert a/a
564 $ hg revert a/a
565
565
566 #endif
566 #endif
567
567
568 set up another conflict between a commit and a shelved change
568 set up another conflict between a commit and a shelved change
569
569
570 $ hg revert -q -C -a
570 $ hg revert -q -C -a
571 $ rm a/a.orig b.rename/b c.copy
571 $ rm a/a.orig b.rename/b c.copy
572 $ echo a >> a/a
572 $ echo a >> a/a
573 $ hg shelve -q
573 $ hg shelve -q
574 $ echo x >> a/a
574 $ echo x >> a/a
575 $ hg ci -m 'create conflict'
575 $ hg ci -m 'create conflict'
576 $ hg add foo/foo
576 $ hg add foo/foo
577
577
578 if we resolve a conflict while unshelving, the unshelve should succeed
578 if we resolve a conflict while unshelving, the unshelve should succeed
579
579
580 $ hg unshelve --tool :merge-other --keep
580 $ hg unshelve --tool :merge-other --keep
581 unshelving change 'default'
581 unshelving change 'default'
582 temporarily committing pending changes (restore with 'hg unshelve --abort')
582 temporarily committing pending changes (restore with 'hg unshelve --abort')
583 rebasing shelved changes
583 rebasing shelved changes
584 merging a/a
584 merging a/a
585 $ hg parents -q
585 $ hg parents -q
586 (4|13):33f7f61e6c5e (re)
586 (4|13):33f7f61e6c5e (re)
587 $ hg shelve -l
587 $ hg shelve -l
588 default (*)* changes to: second (glob)
588 default (*)* changes to: second (glob)
589 $ hg status
589 $ hg status
590 M a/a
590 M a/a
591 A foo/foo
591 A foo/foo
592 $ cat a/a
592 $ cat a/a
593 a
593 a
594 c
594 c
595 a
595 a
596 $ cat > a/a << EOF
596 $ cat > a/a << EOF
597 > a
597 > a
598 > c
598 > c
599 > x
599 > x
600 > EOF
600 > EOF
601
601
602 $ HGMERGE=true hg unshelve
602 $ HGMERGE=true hg unshelve
603 unshelving change 'default'
603 unshelving change 'default'
604 temporarily committing pending changes (restore with 'hg unshelve --abort')
604 temporarily committing pending changes (restore with 'hg unshelve --abort')
605 rebasing shelved changes
605 rebasing shelved changes
606 merging a/a
606 merging a/a
607 note: unshelved changes already existed in the working copy
607 note: unshelved changes already existed in the working copy
608 $ hg parents -q
608 $ hg parents -q
609 (4|13):33f7f61e6c5e (re)
609 (4|13):33f7f61e6c5e (re)
610 $ hg shelve -l
610 $ hg shelve -l
611 $ hg status
611 $ hg status
612 A foo/foo
612 A foo/foo
613 $ cat a/a
613 $ cat a/a
614 a
614 a
615 c
615 c
616 x
616 x
617
617
618 test keep and cleanup
618 test keep and cleanup
619
619
620 $ hg shelve
620 $ hg shelve
621 shelved as default
621 shelved as default
622 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
622 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
623 $ hg shelve --list
623 $ hg shelve --list
624 default (*)* changes to: create conflict (glob)
624 default (*)* changes to: create conflict (glob)
625 $ hg unshelve -k
625 $ hg unshelve -k
626 unshelving change 'default'
626 unshelving change 'default'
627 $ hg shelve --list
627 $ hg shelve --list
628 default (*)* changes to: create conflict (glob)
628 default (*)* changes to: create conflict (glob)
629 $ hg shelve --cleanup
629 $ hg shelve --cleanup
630 $ hg shelve --list
630 $ hg shelve --list
631
631
632 $ hg shelve --cleanup --delete
632 $ hg shelve --cleanup --delete
633 abort: options '--cleanup' and '--delete' may not be used together
633 abort: options '--cleanup' and '--delete' may not be used together
634 [255]
634 [255]
635 $ hg shelve --cleanup --patch
635 $ hg shelve --cleanup --patch
636 abort: options '--cleanup' and '--patch' may not be used together
636 abort: options '--cleanup' and '--patch' may not be used together
637 [255]
637 [255]
638 $ hg shelve --cleanup --message MESSAGE
638 $ hg shelve --cleanup --message MESSAGE
639 abort: options '--cleanup' and '--message' may not be used together
639 abort: options '--cleanup' and '--message' may not be used together
640 [255]
640 [255]
641
641
642 test bookmarks
642 test bookmarks
643
643
644 $ hg bookmark test
644 $ hg bookmark test
645 $ hg bookmark
645 $ hg bookmark
646 \* test (4|13):33f7f61e6c5e (re)
646 \* test (4|13):33f7f61e6c5e (re)
647 $ hg shelve
647 $ hg shelve
648 shelved as test
648 shelved as test
649 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
649 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
650 $ hg bookmark
650 $ hg bookmark
651 \* test (4|13):33f7f61e6c5e (re)
651 \* test (4|13):33f7f61e6c5e (re)
652 $ hg unshelve
652 $ hg unshelve
653 unshelving change 'test'
653 unshelving change 'test'
654 $ hg bookmark
654 $ hg bookmark
655 \* test (4|13):33f7f61e6c5e (re)
655 \* test (4|13):33f7f61e6c5e (re)
656
656
657 shelve should still work even if mq is disabled
657 shelve should still work even if mq is disabled
658
658
659 $ hg --config extensions.mq=! shelve
659 $ hg --config extensions.mq=! shelve
660 shelved as test
660 shelved as test
661 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
661 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
662 $ hg --config extensions.mq=! shelve --list
662 $ hg --config extensions.mq=! shelve --list
663 test (*)* changes to: create conflict (glob)
663 test (*)* changes to: create conflict (glob)
664 $ hg bookmark
664 $ hg bookmark
665 \* test (4|13):33f7f61e6c5e (re)
665 \* test (4|13):33f7f61e6c5e (re)
666 $ hg --config extensions.mq=! unshelve
666 $ hg --config extensions.mq=! unshelve
667 unshelving change 'test'
667 unshelving change 'test'
668 $ hg bookmark
668 $ hg bookmark
669 \* test (4|13):33f7f61e6c5e (re)
669 \* test (4|13):33f7f61e6c5e (re)
670
670
671 Recreate some conflict again
671 Recreate some conflict again
672
672
673 $ hg up -C -r 2e69b451d1ea
673 $ hg up -C -r 2e69b451d1ea
674 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
674 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
675 (leaving bookmark test)
675 (leaving bookmark test)
676 $ echo y >> a/a
676 $ echo y >> a/a
677 $ hg shelve
677 $ hg shelve
678 shelved as default
678 shelved as default
679 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
679 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
680 $ hg up test
680 $ hg up test
681 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
681 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
682 (activating bookmark test)
682 (activating bookmark test)
683 $ hg bookmark
683 $ hg bookmark
684 \* test (4|13):33f7f61e6c5e (re)
684 \* test (4|13):33f7f61e6c5e (re)
685 $ hg unshelve
685 $ hg unshelve
686 unshelving change 'default'
686 unshelving change 'default'
687 rebasing shelved changes
687 rebasing shelved changes
688 merging a/a
688 merging a/a
689 warning: conflicts while merging a/a! (edit, then use 'hg resolve --mark')
689 warning: conflicts while merging a/a! (edit, then use 'hg resolve --mark')
690 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
690 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
691 [1]
691 [1]
692 $ hg bookmark
692 $ hg bookmark
693 test (4|13):33f7f61e6c5e (re)
693 test (4|13):33f7f61e6c5e (re)
694
694
695 Test that resolving all conflicts in one direction (so that the rebase
695 Test that resolving all conflicts in one direction (so that the rebase
696 is a no-op), works (issue4398)
696 is a no-op), works (issue4398)
697
697
698 $ hg revert -a -r .
698 $ hg revert -a -r .
699 reverting a/a
699 reverting a/a
700 $ hg resolve -m a/a
700 $ hg resolve -m a/a
701 (no more unresolved files)
701 (no more unresolved files)
702 continue: hg unshelve --continue
702 continue: hg unshelve --continue
703 $ hg unshelve -c
703 $ hg unshelve -c
704 note: unshelved changes already existed in the working copy
704 note: unshelved changes already existed in the working copy
705 unshelve of 'default' complete
705 unshelve of 'default' complete
706 $ hg bookmark
706 $ hg bookmark
707 \* test (4|13):33f7f61e6c5e (re)
707 \* test (4|13):33f7f61e6c5e (re)
708 $ hg diff
708 $ hg diff
709 $ hg status
709 $ hg status
710 ? a/a.orig
710 ? a/a.orig
711 ? foo/foo
711 ? foo/foo
712 $ hg summary
712 $ hg summary
713 parent: (4|13):33f7f61e6c5e tip (re)
713 parent: (4|13):33f7f61e6c5e tip (re)
714 create conflict
714 create conflict
715 branch: default
715 branch: default
716 bookmarks: *test
716 bookmarks: *test
717 commit: 2 unknown (clean)
717 commit: 2 unknown (clean)
718 update: (current)
718 update: (current)
719 phases: 5 draft
719 phases: 5 draft
720
720
721 $ hg shelve --delete --stat
721 $ hg shelve --delete --stat
722 abort: options '--delete' and '--stat' may not be used together
722 abort: options '--delete' and '--stat' may not be used together
723 [255]
723 [255]
724 $ hg shelve --delete --name NAME
724 $ hg shelve --delete --name NAME
725 abort: options '--delete' and '--name' may not be used together
725 abort: options '--delete' and '--name' may not be used together
726 [255]
726 [255]
727
727
728 Test interactive shelve
728 Test interactive shelve
729 $ cat <<EOF >> $HGRCPATH
729 $ cat <<EOF >> $HGRCPATH
730 > [ui]
730 > [ui]
731 > interactive = true
731 > interactive = true
732 > EOF
732 > EOF
733 $ echo 'a' >> a/b
733 $ echo 'a' >> a/b
734 $ cat a/a >> a/b
734 $ cat a/a >> a/b
735 $ echo 'x' >> a/b
735 $ echo 'x' >> a/b
736 $ mv a/b a/a
736 $ mv a/b a/a
737 $ echo 'a' >> foo/foo
737 $ echo 'a' >> foo/foo
738 $ hg st
738 $ hg st
739 M a/a
739 M a/a
740 ? a/a.orig
740 ? a/a.orig
741 ? foo/foo
741 ? foo/foo
742 $ cat a/a
742 $ cat a/a
743 a
743 a
744 a
744 a
745 c
745 c
746 x
746 x
747 x
747 x
748 $ cat foo/foo
748 $ cat foo/foo
749 foo
749 foo
750 a
750 a
751 $ hg shelve --interactive --config ui.interactive=false
751 $ hg shelve --interactive --config ui.interactive=false
752 abort: running non-interactively
752 abort: running non-interactively
753 [255]
753 [255]
754 $ hg shelve --interactive << EOF
754 $ hg shelve --interactive << EOF
755 > y
755 > y
756 > y
756 > y
757 > n
757 > n
758 > EOF
758 > EOF
759 diff --git a/a/a b/a/a
759 diff --git a/a/a b/a/a
760 2 hunks, 2 lines changed
760 2 hunks, 2 lines changed
761 examine changes to 'a/a'? [Ynesfdaq?] y
761 examine changes to 'a/a'? [Ynesfdaq?] y
762
762
763 @@ -1,3 +1,4 @@
763 @@ -1,3 +1,4 @@
764 +a
764 +a
765 a
765 a
766 c
766 c
767 x
767 x
768 record change 1/2 to 'a/a'? [Ynesfdaq?] y
768 record change 1/2 to 'a/a'? [Ynesfdaq?] y
769
769
770 @@ -1,3 +2,4 @@
770 @@ -1,3 +2,4 @@
771 a
771 a
772 c
772 c
773 x
773 x
774 +x
774 +x
775 record change 2/2 to 'a/a'? [Ynesfdaq?] n
775 record change 2/2 to 'a/a'? [Ynesfdaq?] n
776
776
777 shelved as test
777 shelved as test
778 merging a/a
778 merging a/a
779 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
779 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
780 $ cat a/a
780 $ cat a/a
781 a
781 a
782 c
782 c
783 x
783 x
784 x
784 x
785 $ cat foo/foo
785 $ cat foo/foo
786 foo
786 foo
787 a
787 a
788 $ hg st
788 $ hg st
789 M a/a
789 M a/a
790 ? foo/foo
790 ? foo/foo
791 $ hg bookmark
791 $ hg bookmark
792 \* test (4|13):33f7f61e6c5e (re)
792 \* test (4|13):33f7f61e6c5e (re)
793 $ hg unshelve
793 $ hg unshelve
794 unshelving change 'test'
794 unshelving change 'test'
795 temporarily committing pending changes (restore with 'hg unshelve --abort')
795 temporarily committing pending changes (restore with 'hg unshelve --abort')
796 rebasing shelved changes
796 rebasing shelved changes
797 merging a/a
797 merging a/a
798 $ hg bookmark
798 $ hg bookmark
799 \* test (4|13):33f7f61e6c5e (re)
799 \* test (4|13):33f7f61e6c5e (re)
800 $ cat a/a
800 $ cat a/a
801 a
801 a
802 a
802 a
803 c
803 c
804 x
804 x
805 x
805 x
806
806
807 shelve --patch and shelve --stat should work with valid shelfnames
807 shelve --patch and shelve --stat should work with valid shelfnames
808
808
809 $ hg up --clean .
809 $ hg up --clean .
810 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
810 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
811 (leaving bookmark test)
811 (leaving bookmark test)
812 $ hg shelve --list
812 $ hg shelve --list
813 $ echo 'patch a' > shelf-patch-a
813 $ echo 'patch a' > shelf-patch-a
814 $ hg add shelf-patch-a
814 $ hg add shelf-patch-a
815 $ hg shelve
815 $ hg shelve
816 shelved as default
816 shelved as default
817 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
817 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
818 $ echo 'patch b' > shelf-patch-b
818 $ echo 'patch b' > shelf-patch-b
819 $ hg add shelf-patch-b
819 $ hg add shelf-patch-b
820 $ hg shelve
820 $ hg shelve
821 shelved as default-01
821 shelved as default-01
822 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
822 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
823 $ hg shelve --patch default default-01
823 $ hg shelve --patch default default-01
824 default-01 (*)* changes to: create conflict (glob)
824 default-01 (*)* changes to: create conflict (glob)
825
825
826 diff --git a/shelf-patch-b b/shelf-patch-b
826 diff --git a/shelf-patch-b b/shelf-patch-b
827 new file mode 100644
827 new file mode 100644
828 --- /dev/null
828 --- /dev/null
829 +++ b/shelf-patch-b
829 +++ b/shelf-patch-b
830 @@ -0,0 +1,1 @@
830 @@ -0,0 +1,1 @@
831 +patch b
831 +patch b
832 default (*)* changes to: create conflict (glob)
832 default (*)* changes to: create conflict (glob)
833
833
834 diff --git a/shelf-patch-a b/shelf-patch-a
834 diff --git a/shelf-patch-a b/shelf-patch-a
835 new file mode 100644
835 new file mode 100644
836 --- /dev/null
836 --- /dev/null
837 +++ b/shelf-patch-a
837 +++ b/shelf-patch-a
838 @@ -0,0 +1,1 @@
838 @@ -0,0 +1,1 @@
839 +patch a
839 +patch a
840 $ hg shelve --stat default default-01
840 $ hg shelve --stat default default-01
841 default-01 (*)* changes to: create conflict (glob)
841 default-01 (*)* changes to: create conflict (glob)
842 shelf-patch-b | 1 +
842 shelf-patch-b | 1 +
843 1 files changed, 1 insertions(+), 0 deletions(-)
843 1 files changed, 1 insertions(+), 0 deletions(-)
844 default (*)* changes to: create conflict (glob)
844 default (*)* changes to: create conflict (glob)
845 shelf-patch-a | 1 +
845 shelf-patch-a | 1 +
846 1 files changed, 1 insertions(+), 0 deletions(-)
846 1 files changed, 1 insertions(+), 0 deletions(-)
847 $ hg shelve --patch default
847 $ hg shelve --patch default
848 default (*)* changes to: create conflict (glob)
848 default (*)* changes to: create conflict (glob)
849
849
850 diff --git a/shelf-patch-a b/shelf-patch-a
850 diff --git a/shelf-patch-a b/shelf-patch-a
851 new file mode 100644
851 new file mode 100644
852 --- /dev/null
852 --- /dev/null
853 +++ b/shelf-patch-a
853 +++ b/shelf-patch-a
854 @@ -0,0 +1,1 @@
854 @@ -0,0 +1,1 @@
855 +patch a
855 +patch a
856 $ hg shelve --stat default
856 $ hg shelve --stat default
857 default (*)* changes to: create conflict (glob)
857 default (*)* changes to: create conflict (glob)
858 shelf-patch-a | 1 +
858 shelf-patch-a | 1 +
859 1 files changed, 1 insertions(+), 0 deletions(-)
859 1 files changed, 1 insertions(+), 0 deletions(-)
860 $ hg shelve --patch nonexistentshelf
860 $ hg shelve --patch nonexistentshelf
861 abort: cannot find shelf nonexistentshelf
861 abort: cannot find shelf nonexistentshelf
862 [255]
862 [255]
863 $ hg shelve --stat nonexistentshelf
863 $ hg shelve --stat nonexistentshelf
864 abort: cannot find shelf nonexistentshelf
864 abort: cannot find shelf nonexistentshelf
865 [255]
865 [255]
866 $ hg shelve --patch default nonexistentshelf
866 $ hg shelve --patch default nonexistentshelf
867 abort: cannot find shelf nonexistentshelf
867 abort: cannot find shelf nonexistentshelf
868 [255]
868 [255]
869
869
870 when the user asks for a patch, we assume they want the most recent shelve if
870 when the user asks for a patch, we assume they want the most recent shelve if
871 they don't provide a shelve name
871 they don't provide a shelve name
872
872
873 $ hg shelve --patch
873 $ hg shelve --patch
874 default-01 (*)* changes to: create conflict (glob)
874 default-01 (*)* changes to: create conflict (glob)
875
875
876 diff --git a/shelf-patch-b b/shelf-patch-b
876 diff --git a/shelf-patch-b b/shelf-patch-b
877 new file mode 100644
877 new file mode 100644
878 --- /dev/null
878 --- /dev/null
879 +++ b/shelf-patch-b
879 +++ b/shelf-patch-b
880 @@ -0,0 +1,1 @@
880 @@ -0,0 +1,1 @@
881 +patch b
881 +patch b
882
882
883 $ cd ..
883 $ cd ..
884
884
885 Shelve from general delta repo uses bundle2 on disk
885 Shelve from general delta repo uses bundle2 on disk
886 --------------------------------------------------
886 --------------------------------------------------
887
887
888 no general delta
888 no general delta
889
889
890 $ hg clone --pull repo bundle1 --config format.usegeneraldelta=0
890 $ hg clone --pull repo bundle1 --config format.usegeneraldelta=0
891 requesting all changes
891 requesting all changes
892 adding changesets
892 adding changesets
893 adding manifests
893 adding manifests
894 adding file changes
894 adding file changes
895 added 5 changesets with 8 changes to 6 files
895 added 5 changesets with 8 changes to 6 files
896 new changesets cc01e2b0c59f:33f7f61e6c5e
896 new changesets cc01e2b0c59f:33f7f61e6c5e
897 updating to branch default
897 updating to branch default
898 6 files updated, 0 files merged, 0 files removed, 0 files unresolved
898 6 files updated, 0 files merged, 0 files removed, 0 files unresolved
899 $ cd bundle1
899 $ cd bundle1
900 $ echo babar > jungle
900 $ echo babar > jungle
901 $ hg add jungle
901 $ hg add jungle
902 $ hg shelve
902 $ hg shelve
903 shelved as default
903 shelved as default
904 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
904 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
905 $ hg debugbundle .hg/shelved/*.hg
905 $ hg debugbundle .hg/shelved/*.hg
906 330882a04d2ce8487636b1fb292e5beea77fa1e3
906 330882a04d2ce8487636b1fb292e5beea77fa1e3
907 $ cd ..
907 $ cd ..
908
908
909 with general delta
909 with general delta
910
910
911 $ hg clone --pull repo bundle2 --config format.usegeneraldelta=1
911 $ hg clone --pull repo bundle2 --config format.usegeneraldelta=1
912 requesting all changes
912 requesting all changes
913 adding changesets
913 adding changesets
914 adding manifests
914 adding manifests
915 adding file changes
915 adding file changes
916 added 5 changesets with 8 changes to 6 files
916 added 5 changesets with 8 changes to 6 files
917 new changesets cc01e2b0c59f:33f7f61e6c5e
917 new changesets cc01e2b0c59f:33f7f61e6c5e
918 updating to branch default
918 updating to branch default
919 6 files updated, 0 files merged, 0 files removed, 0 files unresolved
919 6 files updated, 0 files merged, 0 files removed, 0 files unresolved
920 $ cd bundle2
920 $ cd bundle2
921 $ echo babar > jungle
921 $ echo babar > jungle
922 $ hg add jungle
922 $ hg add jungle
923 $ hg shelve
923 $ hg shelve
924 shelved as default
924 shelved as default
925 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
925 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
926 $ hg debugbundle .hg/shelved/*.hg
926 $ hg debugbundle .hg/shelved/*.hg
927 Stream params: {Compression: BZ}
927 Stream params: {Compression: BZ}
928 changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
928 changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
929 330882a04d2ce8487636b1fb292e5beea77fa1e3
929 330882a04d2ce8487636b1fb292e5beea77fa1e3
930 $ cd ..
930 $ cd ..
931
931
932 Test visibility of in-memory changes inside transaction to external hook
932 Test visibility of in-memory changes inside transaction to external hook
933 ------------------------------------------------------------------------
933 ------------------------------------------------------------------------
934
934
935 $ cd repo
935 $ cd repo
936
936
937 $ echo xxxx >> x
937 $ echo xxxx >> x
938 $ hg commit -m "#5: changes to invoke rebase"
938 $ hg commit -m "#5: changes to invoke rebase"
939
939
940 $ cat > $TESTTMP/checkvisibility.sh <<EOF
940 $ cat > $TESTTMP/checkvisibility.sh <<EOF
941 > echo "==== \$1:"
941 > echo "==== \$1:"
942 > hg parents --template "VISIBLE {rev}:{node|short}\n"
942 > hg parents --template "VISIBLE {rev}:{node|short}\n"
943 > # test that pending changes are hidden
943 > # test that pending changes are hidden
944 > unset HG_PENDING
944 > unset HG_PENDING
945 > hg parents --template "ACTUAL {rev}:{node|short}\n"
945 > hg parents --template "ACTUAL {rev}:{node|short}\n"
946 > echo "===="
946 > echo "===="
947 > EOF
947 > EOF
948
948
949 $ cat >> .hg/hgrc <<EOF
949 $ cat >> .hg/hgrc <<EOF
950 > [defaults]
950 > [defaults]
951 > # to fix hash id of temporary revisions
951 > # to fix hash id of temporary revisions
952 > unshelve = --date '0 0'
952 > unshelve = --date '0 0'
953 > EOF
953 > EOF
954
954
955 "hg unshelve" at REV5 implies steps below:
955 "hg unshelve" at REV5 implies steps below:
956
956
957 (1) commit changes in the working directory (REV6)
957 (1) commit changes in the working directory (REV6)
958 (2) unbundle shelved revision (REV7)
958 (2) unbundle shelved revision (REV7)
959 (3) rebase: merge REV7 into REV6 (REV6 => REV6, REV7)
959 (3) rebase: merge REV7 into REV6 (REV6 => REV6, REV7)
960 (4) rebase: commit merged revision (REV8)
960 (4) rebase: commit merged revision (REV8)
961 (5) rebase: update to REV6 (REV8 => REV6)
961 (5) rebase: update to REV6 (REV8 => REV6)
962 (6) update to REV5 (REV6 => REV5)
962 (6) update to REV5 (REV6 => REV5)
963 (7) abort transaction
963 (7) abort transaction
964
964
965 == test visibility to external preupdate hook
965 == test visibility to external preupdate hook
966
966
967 $ cat >> .hg/hgrc <<EOF
967 $ cat >> .hg/hgrc <<EOF
968 > [hooks]
968 > [hooks]
969 > preupdate.visibility = sh $TESTTMP/checkvisibility.sh preupdate
969 > preupdate.visibility = sh $TESTTMP/checkvisibility.sh preupdate
970 > EOF
970 > EOF
971
971
972 $ echo nnnn >> n
972 $ echo nnnn >> n
973
973
974 $ sh $TESTTMP/checkvisibility.sh before-unshelving
974 $ sh $TESTTMP/checkvisibility.sh before-unshelving
975 ==== before-unshelving:
975 ==== before-unshelving:
976 VISIBLE (5|19):703117a2acfb (re)
976 VISIBLE (5|19):703117a2acfb (re)
977 ACTUAL (5|19):703117a2acfb (re)
977 ACTUAL (5|19):703117a2acfb (re)
978 ====
978 ====
979
979
980 $ hg unshelve --keep default
980 $ hg unshelve --keep default
981 temporarily committing pending changes (restore with 'hg unshelve --abort')
981 temporarily committing pending changes (restore with 'hg unshelve --abort')
982 rebasing shelved changes
982 rebasing shelved changes
983 ==== preupdate:
983 ==== preupdate:
984 VISIBLE (6|20):54c00d20fb3f (re)
984 VISIBLE (6|20):54c00d20fb3f (re)
985 ACTUAL (5|19):703117a2acfb (re)
985 ACTUAL (5|19):703117a2acfb (re)
986 ====
986 ====
987 ==== preupdate:
987 ==== preupdate:
988 VISIBLE (8|21):8efe6f7537dc (re)
988 VISIBLE (8|21):8efe6f7537dc (re)
989 ACTUAL (5|19):703117a2acfb (re)
989 ACTUAL (5|19):703117a2acfb (re)
990 ====
990 ====
991 ==== preupdate:
991 ==== preupdate:
992 VISIBLE (6|20):54c00d20fb3f (re)
992 VISIBLE (6|20):54c00d20fb3f (re)
993 ACTUAL (5|19):703117a2acfb (re)
993 ACTUAL (5|19):703117a2acfb (re)
994 ====
994 ====
995
995
996 $ cat >> .hg/hgrc <<EOF
996 $ cat >> .hg/hgrc <<EOF
997 > [hooks]
997 > [hooks]
998 > preupdate.visibility =
998 > preupdate.visibility =
999 > EOF
999 > EOF
1000
1000
1001 $ sh $TESTTMP/checkvisibility.sh after-unshelving
1001 $ sh $TESTTMP/checkvisibility.sh after-unshelving
1002 ==== after-unshelving:
1002 ==== after-unshelving:
1003 VISIBLE (5|19):703117a2acfb (re)
1003 VISIBLE (5|19):703117a2acfb (re)
1004 ACTUAL (5|19):703117a2acfb (re)
1004 ACTUAL (5|19):703117a2acfb (re)
1005 ====
1005 ====
1006
1006
1007 == test visibility to external update hook
1007 == test visibility to external update hook
1008
1008
1009 $ hg update -q -C 703117a2acfb
1009 $ hg update -q -C 703117a2acfb
1010
1010
1011 $ cat >> .hg/hgrc <<EOF
1011 $ cat >> .hg/hgrc <<EOF
1012 > [hooks]
1012 > [hooks]
1013 > update.visibility = sh $TESTTMP/checkvisibility.sh update
1013 > update.visibility = sh $TESTTMP/checkvisibility.sh update
1014 > EOF
1014 > EOF
1015
1015
1016 $ echo nnnn >> n
1016 $ echo nnnn >> n
1017
1017
1018 $ sh $TESTTMP/checkvisibility.sh before-unshelving
1018 $ sh $TESTTMP/checkvisibility.sh before-unshelving
1019 ==== before-unshelving:
1019 ==== before-unshelving:
1020 VISIBLE (5|19):703117a2acfb (re)
1020 VISIBLE (5|19):703117a2acfb (re)
1021 ACTUAL (5|19):703117a2acfb (re)
1021 ACTUAL (5|19):703117a2acfb (re)
1022 ====
1022 ====
1023
1023
1024 $ hg unshelve --keep default
1024 $ hg unshelve --keep default
1025 temporarily committing pending changes (restore with 'hg unshelve --abort')
1025 temporarily committing pending changes (restore with 'hg unshelve --abort')
1026 rebasing shelved changes
1026 rebasing shelved changes
1027 ==== update:
1027 ==== update:
1028 VISIBLE (6|20):54c00d20fb3f (re)
1028 VISIBLE (6|20):54c00d20fb3f (re)
1029 VISIBLE 1?7:492ed9d705e5 (re)
1029 VISIBLE 1?7:492ed9d705e5 (re)
1030 ACTUAL (5|19):703117a2acfb (re)
1030 ACTUAL (5|19):703117a2acfb (re)
1031 ====
1031 ====
1032 ==== update:
1032 ==== update:
1033 VISIBLE (6|20):54c00d20fb3f (re)
1033 VISIBLE (6|20):54c00d20fb3f (re)
1034 ACTUAL (5|19):703117a2acfb (re)
1034 ACTUAL (5|19):703117a2acfb (re)
1035 ====
1035 ====
1036 ==== update:
1036 ==== update:
1037 VISIBLE (5|19):703117a2acfb (re)
1037 VISIBLE (5|19):703117a2acfb (re)
1038 ACTUAL (5|19):703117a2acfb (re)
1038 ACTUAL (5|19):703117a2acfb (re)
1039 ====
1039 ====
1040
1040
1041 $ cat >> .hg/hgrc <<EOF
1041 $ cat >> .hg/hgrc <<EOF
1042 > [hooks]
1042 > [hooks]
1043 > update.visibility =
1043 > update.visibility =
1044 > EOF
1044 > EOF
1045
1045
1046 $ sh $TESTTMP/checkvisibility.sh after-unshelving
1046 $ sh $TESTTMP/checkvisibility.sh after-unshelving
1047 ==== after-unshelving:
1047 ==== after-unshelving:
1048 VISIBLE (5|19):703117a2acfb (re)
1048 VISIBLE (5|19):703117a2acfb (re)
1049 ACTUAL (5|19):703117a2acfb (re)
1049 ACTUAL (5|19):703117a2acfb (re)
1050 ====
1050 ====
1051
1051
1052 $ cd ..
1052 $ cd ..
1053
1053
1054 Keep active bookmark while (un)shelving even on shared repo (issue4940)
1054 Keep active bookmark while (un)shelving even on shared repo (issue4940)
1055 -----------------------------------------------------------------------
1055 -----------------------------------------------------------------------
1056
1056
1057 $ cat <<EOF >> $HGRCPATH
1057 $ cat <<EOF >> $HGRCPATH
1058 > [extensions]
1058 > [extensions]
1059 > share =
1059 > share =
1060 > EOF
1060 > EOF
1061
1061
1062 $ hg bookmarks -R repo
1062 $ hg bookmarks -R repo
1063 test (4|13):33f7f61e6c5e (re)
1063 test (4|13):33f7f61e6c5e (re)
1064 $ hg share -B repo share
1064 $ hg share -B repo share
1065 updating working directory
1065 updating working directory
1066 6 files updated, 0 files merged, 0 files removed, 0 files unresolved
1066 6 files updated, 0 files merged, 0 files removed, 0 files unresolved
1067 $ cd share
1067 $ cd share
1068
1068
1069 $ hg bookmarks
1069 $ hg bookmarks
1070 test (4|13):33f7f61e6c5e (re)
1070 test (4|13):33f7f61e6c5e (re)
1071 $ hg bookmarks foo
1071 $ hg bookmarks foo
1072 $ hg bookmarks
1072 $ hg bookmarks
1073 \* foo (5|19):703117a2acfb (re)
1073 \* foo (5|19):703117a2acfb (re)
1074 test (4|13):33f7f61e6c5e (re)
1074 test (4|13):33f7f61e6c5e (re)
1075 $ echo x >> x
1075 $ echo x >> x
1076 $ hg shelve
1076 $ hg shelve
1077 shelved as foo
1077 shelved as foo
1078 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1078 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1079 $ hg bookmarks
1079 $ hg bookmarks
1080 \* foo (5|19):703117a2acfb (re)
1080 \* foo (5|19):703117a2acfb (re)
1081 test (4|13):33f7f61e6c5e (re)
1081 test (4|13):33f7f61e6c5e (re)
1082
1082
1083 $ hg unshelve
1083 $ hg unshelve
1084 unshelving change 'foo'
1084 unshelving change 'foo'
1085 $ hg bookmarks
1085 $ hg bookmarks
1086 \* foo (5|19):703117a2acfb (re)
1086 \* foo (5|19):703117a2acfb (re)
1087 test (4|13):33f7f61e6c5e (re)
1087 test (4|13):33f7f61e6c5e (re)
1088
1088
1089 $ cd ..
1089 $ cd ..
@@ -1,401 +1,401 b''
1 Test uncommit - set up the config
1 Test uncommit - set up the config
2
2
3 $ cat >> $HGRCPATH <<EOF
3 $ cat >> $HGRCPATH <<EOF
4 > [experimental]
4 > [experimental]
5 > evolution.createmarkers=True
5 > evolution.createmarkers=True
6 > evolution.allowunstable=True
6 > evolution.allowunstable=True
7 > [extensions]
7 > [extensions]
8 > uncommit =
8 > uncommit =
9 > drawdag=$TESTDIR/drawdag.py
9 > drawdag=$TESTDIR/drawdag.py
10 > EOF
10 > EOF
11
11
12 Build up a repo
12 Build up a repo
13
13
14 $ hg init repo
14 $ hg init repo
15 $ cd repo
15 $ cd repo
16 $ hg bookmark foo
16 $ hg bookmark foo
17
17
18 Help for uncommit
18 Help for uncommit
19
19
20 $ hg help uncommit
20 $ hg help uncommit
21 hg uncommit [OPTION]... [FILE]...
21 hg uncommit [OPTION]... [FILE]...
22
22
23 uncommit part or all of a local changeset
23 uncommit part or all of a local changeset
24
24
25 This command undoes the effect of a local commit, returning the affected
25 This command undoes the effect of a local commit, returning the affected
26 files to their uncommitted state. This means that files modified or
26 files to their uncommitted state. This means that files modified or
27 deleted in the changeset will be left unchanged, and so will remain
27 deleted in the changeset will be left unchanged, and so will remain
28 modified in the working directory.
28 modified in the working directory.
29
29
30 If no files are specified, the commit will be pruned, unless --keep is
30 If no files are specified, the commit will be pruned, unless --keep is
31 given.
31 given.
32
32
33 (use 'hg help -e uncommit' to show help for the uncommit extension)
33 (use 'hg help -e uncommit' to show help for the uncommit extension)
34
34
35 options ([+] can be repeated):
35 options ([+] can be repeated):
36
36
37 --[no-]keep allow an empty commit after uncommiting (default:
37 --keep allow an empty commit after uncommiting (default:
38 off)
38 off)
39 -I --include PATTERN [+] include names matching the given patterns
39 -I --include PATTERN [+] include names matching the given patterns
40 -X --exclude PATTERN [+] exclude names matching the given patterns
40 -X --exclude PATTERN [+] exclude names matching the given patterns
41
41
42 (some details hidden, use --verbose to show complete help)
42 (some details hidden, use --verbose to show complete help)
43
43
44 Uncommit with no commits should fail
44 Uncommit with no commits should fail
45
45
46 $ hg uncommit
46 $ hg uncommit
47 abort: cannot uncommit null changeset
47 abort: cannot uncommit null changeset
48 (no changeset checked out)
48 (no changeset checked out)
49 [255]
49 [255]
50
50
51 Create some commits
51 Create some commits
52
52
53 $ touch files
53 $ touch files
54 $ hg add files
54 $ hg add files
55 $ for i in a ab abc abcd abcde; do echo $i > files; echo $i > file-$i; hg add file-$i; hg commit -m "added file-$i"; done
55 $ for i in a ab abc abcd abcde; do echo $i > files; echo $i > file-$i; hg add file-$i; hg commit -m "added file-$i"; done
56 $ ls
56 $ ls
57 file-a
57 file-a
58 file-ab
58 file-ab
59 file-abc
59 file-abc
60 file-abcd
60 file-abcd
61 file-abcde
61 file-abcde
62 files
62 files
63
63
64 $ hg log -G -T '{rev}:{node} {desc}' --hidden
64 $ hg log -G -T '{rev}:{node} {desc}' --hidden
65 @ 4:6c4fd43ed714e7fcd8adbaa7b16c953c2e985b60 added file-abcde
65 @ 4:6c4fd43ed714e7fcd8adbaa7b16c953c2e985b60 added file-abcde
66 |
66 |
67 o 3:6db330d65db434145c0b59d291853e9a84719b24 added file-abcd
67 o 3:6db330d65db434145c0b59d291853e9a84719b24 added file-abcd
68 |
68 |
69 o 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abc
69 o 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abc
70 |
70 |
71 o 1:69a232e754b08d568c4899475faf2eb44b857802 added file-ab
71 o 1:69a232e754b08d568c4899475faf2eb44b857802 added file-ab
72 |
72 |
73 o 0:3004d2d9b50883c1538fc754a3aeb55f1b4084f6 added file-a
73 o 0:3004d2d9b50883c1538fc754a3aeb55f1b4084f6 added file-a
74
74
75 Simple uncommit off the top, also moves bookmark
75 Simple uncommit off the top, also moves bookmark
76
76
77 $ hg bookmark
77 $ hg bookmark
78 * foo 4:6c4fd43ed714
78 * foo 4:6c4fd43ed714
79 $ hg uncommit
79 $ hg uncommit
80 $ hg status
80 $ hg status
81 M files
81 M files
82 A file-abcde
82 A file-abcde
83 $ hg bookmark
83 $ hg bookmark
84 * foo 3:6db330d65db4
84 * foo 3:6db330d65db4
85
85
86 $ hg log -G -T '{rev}:{node} {desc}' --hidden
86 $ hg log -G -T '{rev}:{node} {desc}' --hidden
87 x 4:6c4fd43ed714e7fcd8adbaa7b16c953c2e985b60 added file-abcde
87 x 4:6c4fd43ed714e7fcd8adbaa7b16c953c2e985b60 added file-abcde
88 |
88 |
89 @ 3:6db330d65db434145c0b59d291853e9a84719b24 added file-abcd
89 @ 3:6db330d65db434145c0b59d291853e9a84719b24 added file-abcd
90 |
90 |
91 o 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abc
91 o 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abc
92 |
92 |
93 o 1:69a232e754b08d568c4899475faf2eb44b857802 added file-ab
93 o 1:69a232e754b08d568c4899475faf2eb44b857802 added file-ab
94 |
94 |
95 o 0:3004d2d9b50883c1538fc754a3aeb55f1b4084f6 added file-a
95 o 0:3004d2d9b50883c1538fc754a3aeb55f1b4084f6 added file-a
96
96
97
97
98 Recommit
98 Recommit
99
99
100 $ hg commit -m 'new change abcde'
100 $ hg commit -m 'new change abcde'
101 $ hg status
101 $ hg status
102 $ hg heads -T '{rev}:{node} {desc}'
102 $ hg heads -T '{rev}:{node} {desc}'
103 5:0c07a3ccda771b25f1cb1edbd02e683723344ef1 new change abcde (no-eol)
103 5:0c07a3ccda771b25f1cb1edbd02e683723344ef1 new change abcde (no-eol)
104
104
105 Uncommit of non-existent and unchanged files has no effect
105 Uncommit of non-existent and unchanged files has no effect
106 $ hg uncommit nothinghere
106 $ hg uncommit nothinghere
107 nothing to uncommit
107 nothing to uncommit
108 [1]
108 [1]
109 $ hg status
109 $ hg status
110 $ hg uncommit file-abc
110 $ hg uncommit file-abc
111 nothing to uncommit
111 nothing to uncommit
112 [1]
112 [1]
113 $ hg status
113 $ hg status
114
114
115 Try partial uncommit, also moves bookmark
115 Try partial uncommit, also moves bookmark
116
116
117 $ hg bookmark
117 $ hg bookmark
118 * foo 5:0c07a3ccda77
118 * foo 5:0c07a3ccda77
119 $ hg uncommit files
119 $ hg uncommit files
120 $ hg status
120 $ hg status
121 M files
121 M files
122 $ hg bookmark
122 $ hg bookmark
123 * foo 6:3727deee06f7
123 * foo 6:3727deee06f7
124 $ hg heads -T '{rev}:{node} {desc}'
124 $ hg heads -T '{rev}:{node} {desc}'
125 6:3727deee06f72f5ffa8db792ee299cf39e3e190b new change abcde (no-eol)
125 6:3727deee06f72f5ffa8db792ee299cf39e3e190b new change abcde (no-eol)
126 $ hg log -r . -p -T '{rev}:{node} {desc}'
126 $ hg log -r . -p -T '{rev}:{node} {desc}'
127 6:3727deee06f72f5ffa8db792ee299cf39e3e190b new change abcdediff -r 6db330d65db4 -r 3727deee06f7 file-abcde
127 6:3727deee06f72f5ffa8db792ee299cf39e3e190b new change abcdediff -r 6db330d65db4 -r 3727deee06f7 file-abcde
128 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
128 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
129 +++ b/file-abcde Thu Jan 01 00:00:00 1970 +0000
129 +++ b/file-abcde Thu Jan 01 00:00:00 1970 +0000
130 @@ -0,0 +1,1 @@
130 @@ -0,0 +1,1 @@
131 +abcde
131 +abcde
132
132
133 $ hg log -G -T '{rev}:{node} {desc}' --hidden
133 $ hg log -G -T '{rev}:{node} {desc}' --hidden
134 @ 6:3727deee06f72f5ffa8db792ee299cf39e3e190b new change abcde
134 @ 6:3727deee06f72f5ffa8db792ee299cf39e3e190b new change abcde
135 |
135 |
136 | x 5:0c07a3ccda771b25f1cb1edbd02e683723344ef1 new change abcde
136 | x 5:0c07a3ccda771b25f1cb1edbd02e683723344ef1 new change abcde
137 |/
137 |/
138 | x 4:6c4fd43ed714e7fcd8adbaa7b16c953c2e985b60 added file-abcde
138 | x 4:6c4fd43ed714e7fcd8adbaa7b16c953c2e985b60 added file-abcde
139 |/
139 |/
140 o 3:6db330d65db434145c0b59d291853e9a84719b24 added file-abcd
140 o 3:6db330d65db434145c0b59d291853e9a84719b24 added file-abcd
141 |
141 |
142 o 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abc
142 o 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abc
143 |
143 |
144 o 1:69a232e754b08d568c4899475faf2eb44b857802 added file-ab
144 o 1:69a232e754b08d568c4899475faf2eb44b857802 added file-ab
145 |
145 |
146 o 0:3004d2d9b50883c1538fc754a3aeb55f1b4084f6 added file-a
146 o 0:3004d2d9b50883c1538fc754a3aeb55f1b4084f6 added file-a
147
147
148 $ hg commit -m 'update files for abcde'
148 $ hg commit -m 'update files for abcde'
149
149
150 Uncommit with dirty state
150 Uncommit with dirty state
151
151
152 $ echo "foo" >> files
152 $ echo "foo" >> files
153 $ cat files
153 $ cat files
154 abcde
154 abcde
155 foo
155 foo
156 $ hg status
156 $ hg status
157 M files
157 M files
158 $ hg uncommit
158 $ hg uncommit
159 abort: uncommitted changes
159 abort: uncommitted changes
160 [255]
160 [255]
161 $ hg uncommit files
161 $ hg uncommit files
162 $ cat files
162 $ cat files
163 abcde
163 abcde
164 foo
164 foo
165 $ hg commit --amend -m "files abcde + foo"
165 $ hg commit --amend -m "files abcde + foo"
166
166
167 Testing the 'experimental.uncommitondirtywdir' config
167 Testing the 'experimental.uncommitondirtywdir' config
168
168
169 $ echo "bar" >> files
169 $ echo "bar" >> files
170 $ hg uncommit
170 $ hg uncommit
171 abort: uncommitted changes
171 abort: uncommitted changes
172 [255]
172 [255]
173 $ hg uncommit --config experimental.uncommitondirtywdir=True
173 $ hg uncommit --config experimental.uncommitondirtywdir=True
174 $ hg commit -m "files abcde + foo"
174 $ hg commit -m "files abcde + foo"
175
175
176 Uncommit in the middle of a stack, does not move bookmark
176 Uncommit in the middle of a stack, does not move bookmark
177
177
178 $ hg checkout '.^^^'
178 $ hg checkout '.^^^'
179 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
179 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
180 (leaving bookmark foo)
180 (leaving bookmark foo)
181 $ hg log -r . -p -T '{rev}:{node} {desc}'
181 $ hg log -r . -p -T '{rev}:{node} {desc}'
182 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abcdiff -r 69a232e754b0 -r abf2df566fc1 file-abc
182 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abcdiff -r 69a232e754b0 -r abf2df566fc1 file-abc
183 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
183 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
184 +++ b/file-abc Thu Jan 01 00:00:00 1970 +0000
184 +++ b/file-abc Thu Jan 01 00:00:00 1970 +0000
185 @@ -0,0 +1,1 @@
185 @@ -0,0 +1,1 @@
186 +abc
186 +abc
187 diff -r 69a232e754b0 -r abf2df566fc1 files
187 diff -r 69a232e754b0 -r abf2df566fc1 files
188 --- a/files Thu Jan 01 00:00:00 1970 +0000
188 --- a/files Thu Jan 01 00:00:00 1970 +0000
189 +++ b/files Thu Jan 01 00:00:00 1970 +0000
189 +++ b/files Thu Jan 01 00:00:00 1970 +0000
190 @@ -1,1 +1,1 @@
190 @@ -1,1 +1,1 @@
191 -ab
191 -ab
192 +abc
192 +abc
193
193
194 $ hg bookmark
194 $ hg bookmark
195 foo 10:48e5bd7cd583
195 foo 10:48e5bd7cd583
196 $ hg uncommit
196 $ hg uncommit
197 3 new orphan changesets
197 3 new orphan changesets
198 $ hg status
198 $ hg status
199 M files
199 M files
200 A file-abc
200 A file-abc
201 $ hg heads -T '{rev}:{node} {desc}'
201 $ hg heads -T '{rev}:{node} {desc}'
202 10:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo (no-eol)
202 10:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo (no-eol)
203 $ hg bookmark
203 $ hg bookmark
204 foo 10:48e5bd7cd583
204 foo 10:48e5bd7cd583
205 $ hg commit -m 'new abc'
205 $ hg commit -m 'new abc'
206 created new head
206 created new head
207
207
208 Partial uncommit in the middle, does not move bookmark
208 Partial uncommit in the middle, does not move bookmark
209
209
210 $ hg checkout '.^'
210 $ hg checkout '.^'
211 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
211 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
212 $ hg log -r . -p -T '{rev}:{node} {desc}'
212 $ hg log -r . -p -T '{rev}:{node} {desc}'
213 1:69a232e754b08d568c4899475faf2eb44b857802 added file-abdiff -r 3004d2d9b508 -r 69a232e754b0 file-ab
213 1:69a232e754b08d568c4899475faf2eb44b857802 added file-abdiff -r 3004d2d9b508 -r 69a232e754b0 file-ab
214 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
214 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
215 +++ b/file-ab Thu Jan 01 00:00:00 1970 +0000
215 +++ b/file-ab Thu Jan 01 00:00:00 1970 +0000
216 @@ -0,0 +1,1 @@
216 @@ -0,0 +1,1 @@
217 +ab
217 +ab
218 diff -r 3004d2d9b508 -r 69a232e754b0 files
218 diff -r 3004d2d9b508 -r 69a232e754b0 files
219 --- a/files Thu Jan 01 00:00:00 1970 +0000
219 --- a/files Thu Jan 01 00:00:00 1970 +0000
220 +++ b/files Thu Jan 01 00:00:00 1970 +0000
220 +++ b/files Thu Jan 01 00:00:00 1970 +0000
221 @@ -1,1 +1,1 @@
221 @@ -1,1 +1,1 @@
222 -a
222 -a
223 +ab
223 +ab
224
224
225 $ hg bookmark
225 $ hg bookmark
226 foo 10:48e5bd7cd583
226 foo 10:48e5bd7cd583
227 $ hg uncommit file-ab
227 $ hg uncommit file-ab
228 1 new orphan changesets
228 1 new orphan changesets
229 $ hg status
229 $ hg status
230 A file-ab
230 A file-ab
231
231
232 $ hg heads -T '{rev}:{node} {desc}\n'
232 $ hg heads -T '{rev}:{node} {desc}\n'
233 12:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-ab
233 12:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-ab
234 11:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc
234 11:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc
235 10:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo
235 10:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo
236
236
237 $ hg bookmark
237 $ hg bookmark
238 foo 10:48e5bd7cd583
238 foo 10:48e5bd7cd583
239 $ hg commit -m 'update ab'
239 $ hg commit -m 'update ab'
240 $ hg status
240 $ hg status
241 $ hg heads -T '{rev}:{node} {desc}\n'
241 $ hg heads -T '{rev}:{node} {desc}\n'
242 13:f21039c59242b085491bb58f591afc4ed1c04c09 update ab
242 13:f21039c59242b085491bb58f591afc4ed1c04c09 update ab
243 11:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc
243 11:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc
244 10:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo
244 10:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo
245
245
246 $ hg log -G -T '{rev}:{node} {desc}' --hidden
246 $ hg log -G -T '{rev}:{node} {desc}' --hidden
247 @ 13:f21039c59242b085491bb58f591afc4ed1c04c09 update ab
247 @ 13:f21039c59242b085491bb58f591afc4ed1c04c09 update ab
248 |
248 |
249 o 12:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-ab
249 o 12:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-ab
250 |
250 |
251 | * 11:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc
251 | * 11:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc
252 | |
252 | |
253 | | * 10:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo
253 | | * 10:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo
254 | | |
254 | | |
255 | | | x 9:8a6b58c173ca6a2e3745d8bd86698718d664bc6c files abcde + foo
255 | | | x 9:8a6b58c173ca6a2e3745d8bd86698718d664bc6c files abcde + foo
256 | | |/
256 | | |/
257 | | | x 8:39ad452c7f684a55d161c574340c5766c4569278 update files for abcde
257 | | | x 8:39ad452c7f684a55d161c574340c5766c4569278 update files for abcde
258 | | |/
258 | | |/
259 | | | x 7:0977fa602c2fd7d8427ed4e7ee15ea13b84c9173 update files for abcde
259 | | | x 7:0977fa602c2fd7d8427ed4e7ee15ea13b84c9173 update files for abcde
260 | | |/
260 | | |/
261 | | * 6:3727deee06f72f5ffa8db792ee299cf39e3e190b new change abcde
261 | | * 6:3727deee06f72f5ffa8db792ee299cf39e3e190b new change abcde
262 | | |
262 | | |
263 | | | x 5:0c07a3ccda771b25f1cb1edbd02e683723344ef1 new change abcde
263 | | | x 5:0c07a3ccda771b25f1cb1edbd02e683723344ef1 new change abcde
264 | | |/
264 | | |/
265 | | | x 4:6c4fd43ed714e7fcd8adbaa7b16c953c2e985b60 added file-abcde
265 | | | x 4:6c4fd43ed714e7fcd8adbaa7b16c953c2e985b60 added file-abcde
266 | | |/
266 | | |/
267 | | * 3:6db330d65db434145c0b59d291853e9a84719b24 added file-abcd
267 | | * 3:6db330d65db434145c0b59d291853e9a84719b24 added file-abcd
268 | | |
268 | | |
269 | | x 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abc
269 | | x 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abc
270 | |/
270 | |/
271 | x 1:69a232e754b08d568c4899475faf2eb44b857802 added file-ab
271 | x 1:69a232e754b08d568c4899475faf2eb44b857802 added file-ab
272 |/
272 |/
273 o 0:3004d2d9b50883c1538fc754a3aeb55f1b4084f6 added file-a
273 o 0:3004d2d9b50883c1538fc754a3aeb55f1b4084f6 added file-a
274
274
275 Uncommit with draft parent
275 Uncommit with draft parent
276
276
277 $ hg uncommit
277 $ hg uncommit
278 $ hg phase -r .
278 $ hg phase -r .
279 12: draft
279 12: draft
280 $ hg commit -m 'update ab again'
280 $ hg commit -m 'update ab again'
281
281
282 Phase is preserved
282 Phase is preserved
283
283
284 $ hg uncommit --keep --config phases.new-commit=secret
284 $ hg uncommit --keep --config phases.new-commit=secret
285 $ hg phase -r .
285 $ hg phase -r .
286 15: draft
286 15: draft
287 $ hg commit --amend -m 'update ab again'
287 $ hg commit --amend -m 'update ab again'
288
288
289 Uncommit with public parent
289 Uncommit with public parent
290
290
291 $ hg phase -p "::.^"
291 $ hg phase -p "::.^"
292 $ hg uncommit
292 $ hg uncommit
293 $ hg phase -r .
293 $ hg phase -r .
294 12: public
294 12: public
295
295
296 Partial uncommit with public parent
296 Partial uncommit with public parent
297
297
298 $ echo xyz > xyz
298 $ echo xyz > xyz
299 $ hg add xyz
299 $ hg add xyz
300 $ hg commit -m "update ab and add xyz"
300 $ hg commit -m "update ab and add xyz"
301 $ hg uncommit xyz
301 $ hg uncommit xyz
302 $ hg status
302 $ hg status
303 A xyz
303 A xyz
304 $ hg phase -r .
304 $ hg phase -r .
305 18: draft
305 18: draft
306 $ hg phase -r ".^"
306 $ hg phase -r ".^"
307 12: public
307 12: public
308
308
309 Uncommit leaving an empty changeset
309 Uncommit leaving an empty changeset
310
310
311 $ cd $TESTTMP
311 $ cd $TESTTMP
312 $ hg init repo1
312 $ hg init repo1
313 $ cd repo1
313 $ cd repo1
314 $ hg debugdrawdag <<'EOS'
314 $ hg debugdrawdag <<'EOS'
315 > Q
315 > Q
316 > |
316 > |
317 > P
317 > P
318 > EOS
318 > EOS
319 $ hg up Q -q
319 $ hg up Q -q
320 $ hg uncommit --keep
320 $ hg uncommit --keep
321 $ hg log -G -T '{desc} FILES: {files}'
321 $ hg log -G -T '{desc} FILES: {files}'
322 @ Q FILES:
322 @ Q FILES:
323 |
323 |
324 | x Q FILES: Q
324 | x Q FILES: Q
325 |/
325 |/
326 o P FILES: P
326 o P FILES: P
327
327
328 $ hg status
328 $ hg status
329 A Q
329 A Q
330
330
331 $ cd ..
331 $ cd ..
332 $ rm -rf repo1
332 $ rm -rf repo1
333
333
334 Testing uncommit while merge
334 Testing uncommit while merge
335
335
336 $ hg init repo2
336 $ hg init repo2
337 $ cd repo2
337 $ cd repo2
338
338
339 Create some history
339 Create some history
340
340
341 $ touch a
341 $ touch a
342 $ hg add a
342 $ hg add a
343 $ for i in 1 2 3; do echo $i > a; hg commit -m "a $i"; done
343 $ for i in 1 2 3; do echo $i > a; hg commit -m "a $i"; done
344 $ hg checkout 0
344 $ hg checkout 0
345 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
345 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
346 $ touch b
346 $ touch b
347 $ hg add b
347 $ hg add b
348 $ for i in 1 2 3; do echo $i > b; hg commit -m "b $i"; done
348 $ for i in 1 2 3; do echo $i > b; hg commit -m "b $i"; done
349 created new head
349 created new head
350 $ hg log -G -T '{rev}:{node} {desc}' --hidden
350 $ hg log -G -T '{rev}:{node} {desc}' --hidden
351 @ 5:2cd56cdde163ded2fbb16ba2f918c96046ab0bf2 b 3
351 @ 5:2cd56cdde163ded2fbb16ba2f918c96046ab0bf2 b 3
352 |
352 |
353 o 4:c3a0d5bb3b15834ffd2ef9ef603e93ec65cf2037 b 2
353 o 4:c3a0d5bb3b15834ffd2ef9ef603e93ec65cf2037 b 2
354 |
354 |
355 o 3:49bb009ca26078726b8870f1edb29fae8f7618f5 b 1
355 o 3:49bb009ca26078726b8870f1edb29fae8f7618f5 b 1
356 |
356 |
357 | o 2:990982b7384266e691f1bc08ca36177adcd1c8a9 a 3
357 | o 2:990982b7384266e691f1bc08ca36177adcd1c8a9 a 3
358 | |
358 | |
359 | o 1:24d38e3cf160c7b6f5ffe82179332229886a6d34 a 2
359 | o 1:24d38e3cf160c7b6f5ffe82179332229886a6d34 a 2
360 |/
360 |/
361 o 0:ea4e33293d4d274a2ba73150733c2612231f398c a 1
361 o 0:ea4e33293d4d274a2ba73150733c2612231f398c a 1
362
362
363
363
364 Add and expect uncommit to fail on both merge working dir and merge changeset
364 Add and expect uncommit to fail on both merge working dir and merge changeset
365
365
366 $ hg merge 2
366 $ hg merge 2
367 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
367 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
368 (branch merge, don't forget to commit)
368 (branch merge, don't forget to commit)
369
369
370 $ hg uncommit
370 $ hg uncommit
371 abort: outstanding uncommitted merge
371 abort: outstanding uncommitted merge
372 [255]
372 [255]
373
373
374 $ hg uncommit --config experimental.uncommitondirtywdir=True
374 $ hg uncommit --config experimental.uncommitondirtywdir=True
375 abort: cannot uncommit while merging
375 abort: cannot uncommit while merging
376 [255]
376 [255]
377
377
378 $ hg status
378 $ hg status
379 M a
379 M a
380 $ hg commit -m 'merge a and b'
380 $ hg commit -m 'merge a and b'
381
381
382 $ hg uncommit
382 $ hg uncommit
383 abort: cannot uncommit merge changeset
383 abort: cannot uncommit merge changeset
384 [255]
384 [255]
385
385
386 $ hg status
386 $ hg status
387 $ hg log -G -T '{rev}:{node} {desc}' --hidden
387 $ hg log -G -T '{rev}:{node} {desc}' --hidden
388 @ 6:c03b9c37bc67bf504d4912061cfb527b47a63c6e merge a and b
388 @ 6:c03b9c37bc67bf504d4912061cfb527b47a63c6e merge a and b
389 |\
389 |\
390 | o 5:2cd56cdde163ded2fbb16ba2f918c96046ab0bf2 b 3
390 | o 5:2cd56cdde163ded2fbb16ba2f918c96046ab0bf2 b 3
391 | |
391 | |
392 | o 4:c3a0d5bb3b15834ffd2ef9ef603e93ec65cf2037 b 2
392 | o 4:c3a0d5bb3b15834ffd2ef9ef603e93ec65cf2037 b 2
393 | |
393 | |
394 | o 3:49bb009ca26078726b8870f1edb29fae8f7618f5 b 1
394 | o 3:49bb009ca26078726b8870f1edb29fae8f7618f5 b 1
395 | |
395 | |
396 o | 2:990982b7384266e691f1bc08ca36177adcd1c8a9 a 3
396 o | 2:990982b7384266e691f1bc08ca36177adcd1c8a9 a 3
397 | |
397 | |
398 o | 1:24d38e3cf160c7b6f5ffe82179332229886a6d34 a 2
398 o | 1:24d38e3cf160c7b6f5ffe82179332229886a6d34 a 2
399 |/
399 |/
400 o 0:ea4e33293d4d274a2ba73150733c2612231f398c a 1
400 o 0:ea4e33293d4d274a2ba73150733c2612231f398c a 1
401
401
General Comments 0
You need to be logged in to leave comments. Login now