##// END OF EJS Templates
help: fold repeatable option message into option table header...
Matt Mackall -
r22117:c1d93edc default
parent child Browse files
Show More
@@ -1,507 +1,507
1 1 # help.py - help data for mercurial
2 2 #
3 3 # Copyright 2006 Matt Mackall <mpm@selenic.com>
4 4 #
5 5 # This software may be used and distributed according to the terms of the
6 6 # GNU General Public License version 2 or any later version.
7 7
8 8 from i18n import gettext, _
9 9 import itertools, sys, os
10 10 import error
11 11 import extensions, revset, fileset, templatekw, templatefilters, filemerge
12 12 import encoding, util, minirst
13 13 import cmdutil
14 14
15 15 def listexts(header, exts, indent=1, showdeprecated=False):
16 16 '''return a text listing of the given extensions'''
17 17 rst = []
18 18 if exts:
19 19 rst.append('\n%s\n\n' % header)
20 20 for name, desc in sorted(exts.iteritems()):
21 21 if '(DEPRECATED)' in desc and not showdeprecated:
22 22 continue
23 23 rst.append('%s:%s: %s\n' % (' ' * indent, name, desc))
24 24 return rst
25 25
26 26 def extshelp():
27 27 rst = loaddoc('extensions')().splitlines(True)
28 28 rst.extend(listexts(
29 29 _('enabled extensions:'), extensions.enabled(), showdeprecated=True))
30 30 rst.extend(listexts(_('disabled extensions:'), extensions.disabled()))
31 31 doc = ''.join(rst)
32 32 return doc
33 33
34 34 def optrst(header, options, verbose):
35 35 data = []
36 36 multioccur = False
37 37 for option in options:
38 38 if len(option) == 5:
39 39 shortopt, longopt, default, desc, optlabel = option
40 40 else:
41 41 shortopt, longopt, default, desc = option
42 42 optlabel = _("VALUE") # default label
43 43
44 44 if not verbose and ("DEPRECATED" in desc or _("DEPRECATED") in desc):
45 45 continue
46 46
47 47 so = ''
48 48 if shortopt:
49 49 so = '-' + shortopt
50 50 lo = '--' + longopt
51 51 if default:
52 52 desc += _(" (default: %s)") % default
53 53
54 54 if isinstance(default, list):
55 55 lo += " %s [+]" % optlabel
56 56 multioccur = True
57 57 elif (default is not None) and not isinstance(default, bool):
58 58 lo += " %s" % optlabel
59 59
60 60 data.append((so, lo, desc))
61 61
62 if multioccur:
63 header += (_(" ([+] can be repeated)"))
64
62 65 rst = ['\n%s:\n\n' % header]
63 66 rst.extend(minirst.maketable(data, 1))
64 67
65 if multioccur:
66 rst.append(_("\n[+] marked option can be specified multiple times\n"))
67
68 68 return ''.join(rst)
69 69
70 70 def indicateomitted(rst, omitted, notomitted=None):
71 71 rst.append('\n\n.. container:: omitted\n\n %s\n\n' % omitted)
72 72 if notomitted:
73 73 rst.append('\n\n.. container:: notomitted\n\n %s\n\n' % notomitted)
74 74
75 75 def topicmatch(kw):
76 76 """Return help topics matching kw.
77 77
78 78 Returns {'section': [(name, summary), ...], ...} where section is
79 79 one of topics, commands, extensions, or extensioncommands.
80 80 """
81 81 kw = encoding.lower(kw)
82 82 def lowercontains(container):
83 83 return kw in encoding.lower(container) # translated in helptable
84 84 results = {'topics': [],
85 85 'commands': [],
86 86 'extensions': [],
87 87 'extensioncommands': [],
88 88 }
89 89 for names, header, doc in helptable:
90 90 if (sum(map(lowercontains, names))
91 91 or lowercontains(header)
92 92 or lowercontains(doc())):
93 93 results['topics'].append((names[0], header))
94 94 import commands # avoid cycle
95 95 for cmd, entry in commands.table.iteritems():
96 96 if len(entry) == 3:
97 97 summary = entry[2]
98 98 else:
99 99 summary = ''
100 100 # translate docs *before* searching there
101 101 docs = _(getattr(entry[0], '__doc__', None)) or ''
102 102 if kw in cmd or lowercontains(summary) or lowercontains(docs):
103 103 doclines = docs.splitlines()
104 104 if doclines:
105 105 summary = doclines[0]
106 106 cmdname = cmd.split('|')[0].lstrip('^')
107 107 results['commands'].append((cmdname, summary))
108 108 for name, docs in itertools.chain(
109 109 extensions.enabled(False).iteritems(),
110 110 extensions.disabled().iteritems()):
111 111 # extensions.load ignores the UI argument
112 112 mod = extensions.load(None, name, '')
113 113 name = name.split('.')[-1]
114 114 if lowercontains(name) or lowercontains(docs):
115 115 # extension docs are already translated
116 116 results['extensions'].append((name, docs.splitlines()[0]))
117 117 for cmd, entry in getattr(mod, 'cmdtable', {}).iteritems():
118 118 if kw in cmd or (len(entry) > 2 and lowercontains(entry[2])):
119 119 cmdname = cmd.split('|')[0].lstrip('^')
120 120 if entry[0].__doc__:
121 121 cmddoc = gettext(entry[0].__doc__).splitlines()[0]
122 122 else:
123 123 cmddoc = _('(no help text available)')
124 124 results['extensioncommands'].append((cmdname, cmddoc))
125 125 return results
126 126
127 127 def loaddoc(topic):
128 128 """Return a delayed loader for help/topic.txt."""
129 129
130 130 def loader():
131 131 if util.mainfrozen():
132 132 module = sys.executable
133 133 else:
134 134 module = __file__
135 135 base = os.path.dirname(module)
136 136
137 137 for dir in ('.', '..'):
138 138 docdir = os.path.join(base, dir, 'help')
139 139 if os.path.isdir(docdir):
140 140 break
141 141
142 142 path = os.path.join(docdir, topic + ".txt")
143 143 doc = gettext(util.readfile(path))
144 144 for rewriter in helphooks.get(topic, []):
145 145 doc = rewriter(topic, doc)
146 146 return doc
147 147
148 148 return loader
149 149
150 150 helptable = sorted([
151 151 (["config", "hgrc"], _("Configuration Files"), loaddoc('config')),
152 152 (["dates"], _("Date Formats"), loaddoc('dates')),
153 153 (["patterns"], _("File Name Patterns"), loaddoc('patterns')),
154 154 (['environment', 'env'], _('Environment Variables'),
155 155 loaddoc('environment')),
156 156 (['revisions', 'revs'], _('Specifying Single Revisions'),
157 157 loaddoc('revisions')),
158 158 (['multirevs', 'mrevs'], _('Specifying Multiple Revisions'),
159 159 loaddoc('multirevs')),
160 160 (['revsets', 'revset'], _("Specifying Revision Sets"), loaddoc('revsets')),
161 161 (['filesets', 'fileset'], _("Specifying File Sets"), loaddoc('filesets')),
162 162 (['diffs'], _('Diff Formats'), loaddoc('diffs')),
163 163 (['merge-tools', 'mergetools'], _('Merge Tools'), loaddoc('merge-tools')),
164 164 (['templating', 'templates', 'template', 'style'], _('Template Usage'),
165 165 loaddoc('templates')),
166 166 (['urls'], _('URL Paths'), loaddoc('urls')),
167 167 (["extensions"], _("Using Additional Features"), extshelp),
168 168 (["subrepos", "subrepo"], _("Subrepositories"), loaddoc('subrepos')),
169 169 (["hgweb"], _("Configuring hgweb"), loaddoc('hgweb')),
170 170 (["glossary"], _("Glossary"), loaddoc('glossary')),
171 171 (["hgignore", "ignore"], _("Syntax for Mercurial Ignore Files"),
172 172 loaddoc('hgignore')),
173 173 (["phases"], _("Working with Phases"), loaddoc('phases')),
174 174 ])
175 175
176 176 # Map topics to lists of callable taking the current topic help and
177 177 # returning the updated version
178 178 helphooks = {}
179 179
180 180 def addtopichook(topic, rewriter):
181 181 helphooks.setdefault(topic, []).append(rewriter)
182 182
183 183 def makeitemsdoc(topic, doc, marker, items):
184 184 """Extract docstring from the items key to function mapping, build a
185 185 .single documentation block and use it to overwrite the marker in doc
186 186 """
187 187 entries = []
188 188 for name in sorted(items):
189 189 text = (items[name].__doc__ or '').rstrip()
190 190 if not text:
191 191 continue
192 192 text = gettext(text)
193 193 lines = text.splitlines()
194 194 doclines = [(lines[0])]
195 195 for l in lines[1:]:
196 196 # Stop once we find some Python doctest
197 197 if l.strip().startswith('>>>'):
198 198 break
199 199 doclines.append(' ' + l.strip())
200 200 entries.append('\n'.join(doclines))
201 201 entries = '\n\n'.join(entries)
202 202 return doc.replace(marker, entries)
203 203
204 204 def addtopicsymbols(topic, marker, symbols):
205 205 def add(topic, doc):
206 206 return makeitemsdoc(topic, doc, marker, symbols)
207 207 addtopichook(topic, add)
208 208
209 209 addtopicsymbols('filesets', '.. predicatesmarker', fileset.symbols)
210 210 addtopicsymbols('merge-tools', '.. internaltoolsmarker', filemerge.internals)
211 211 addtopicsymbols('revsets', '.. predicatesmarker', revset.symbols)
212 212 addtopicsymbols('templates', '.. keywordsmarker', templatekw.dockeywords)
213 213 addtopicsymbols('templates', '.. filtersmarker', templatefilters.filters)
214 214
215 215 def help_(ui, name, unknowncmd=False, full=True, **opts):
216 216 '''
217 217 Generate the help for 'name' as unformatted restructured text. If
218 218 'name' is None, describe the commands available.
219 219 '''
220 220
221 221 import commands # avoid cycle
222 222
223 223 def helpcmd(name):
224 224 try:
225 225 aliases, entry = cmdutil.findcmd(name, commands.table,
226 226 strict=unknowncmd)
227 227 except error.AmbiguousCommand, inst:
228 228 # py3k fix: except vars can't be used outside the scope of the
229 229 # except block, nor can be used inside a lambda. python issue4617
230 230 prefix = inst.args[0]
231 231 select = lambda c: c.lstrip('^').startswith(prefix)
232 232 rst = helplist(select)
233 233 return rst
234 234
235 235 rst = []
236 236
237 237 # check if it's an invalid alias and display its error if it is
238 238 if getattr(entry[0], 'badalias', False):
239 239 if not unknowncmd:
240 240 ui.pushbuffer()
241 241 entry[0](ui)
242 242 rst.append(ui.popbuffer())
243 243 return rst
244 244
245 245 # synopsis
246 246 if len(entry) > 2:
247 247 if entry[2].startswith('hg'):
248 248 rst.append("%s\n" % entry[2])
249 249 else:
250 250 rst.append('hg %s %s\n' % (aliases[0], entry[2]))
251 251 else:
252 252 rst.append('hg %s\n' % aliases[0])
253 253 # aliases
254 254 if full and not ui.quiet and len(aliases) > 1:
255 255 rst.append(_("\naliases: %s\n") % ', '.join(aliases[1:]))
256 256 rst.append('\n')
257 257
258 258 # description
259 259 doc = gettext(entry[0].__doc__)
260 260 if not doc:
261 261 doc = _("(no help text available)")
262 262 if util.safehasattr(entry[0], 'definition'): # aliased command
263 263 if entry[0].definition.startswith('!'): # shell alias
264 264 doc = _('shell alias for::\n\n %s') % entry[0].definition[1:]
265 265 else:
266 266 doc = _('alias for: hg %s\n\n%s') % (entry[0].definition, doc)
267 267 doc = doc.splitlines(True)
268 268 if ui.quiet or not full:
269 269 rst.append(doc[0])
270 270 else:
271 271 rst.extend(doc)
272 272 rst.append('\n')
273 273
274 274 # check if this command shadows a non-trivial (multi-line)
275 275 # extension help text
276 276 try:
277 277 mod = extensions.find(name)
278 278 doc = gettext(mod.__doc__) or ''
279 279 if '\n' in doc.strip():
280 280 msg = _('(use "hg help -e %s" to show help for '
281 281 'the %s extension)') % (name, name)
282 282 rst.append('\n%s\n' % msg)
283 283 except KeyError:
284 284 pass
285 285
286 286 # options
287 287 if not ui.quiet and entry[1]:
288 288 rst.append(optrst(_("options"), entry[1], ui.verbose))
289 289
290 290 if ui.verbose:
291 291 rst.append(optrst(_("global options"),
292 292 commands.globalopts, ui.verbose))
293 293
294 294 if not ui.verbose:
295 295 if not full:
296 296 rst.append(_('\n(use "hg %s -h" to show more help)\n')
297 297 % name)
298 298 elif not ui.quiet:
299 299 rst.append(_('\n(some details hidden, use --verbose '
300 300 'to show complete help)'))
301 301
302 302 return rst
303 303
304 304
305 305 def helplist(select=None):
306 306 # list of commands
307 307 if name == "shortlist":
308 308 header = _('basic commands:\n\n')
309 309 elif name == "debug":
310 310 header = _('debug commands (internal and unsupported):\n\n')
311 311 else:
312 312 header = _('list of commands:\n\n')
313 313
314 314 h = {}
315 315 cmds = {}
316 316 for c, e in commands.table.iteritems():
317 317 f = c.split("|", 1)[0]
318 318 if select and not select(f):
319 319 continue
320 320 if (not select and name != 'shortlist' and
321 321 e[0].__module__ != commands.__name__):
322 322 continue
323 323 if name == "shortlist" and not f.startswith("^"):
324 324 continue
325 325 f = f.lstrip("^")
326 326 if not ui.debugflag and f.startswith("debug") and name != "debug":
327 327 continue
328 328 doc = e[0].__doc__
329 329 if doc and 'DEPRECATED' in doc and not ui.verbose:
330 330 continue
331 331 doc = gettext(doc)
332 332 if not doc:
333 333 doc = _("(no help text available)")
334 334 h[f] = doc.splitlines()[0].rstrip()
335 335 cmds[f] = c.lstrip("^")
336 336
337 337 rst = []
338 338 if not h:
339 339 if not ui.quiet:
340 340 rst.append(_('no commands defined\n'))
341 341 return rst
342 342
343 343 if not ui.quiet:
344 344 rst.append(header)
345 345 fns = sorted(h)
346 346 for f in fns:
347 347 if ui.verbose:
348 348 commacmds = cmds[f].replace("|",", ")
349 349 rst.append(" :%s: %s\n" % (commacmds, h[f]))
350 350 else:
351 351 rst.append(' :%s: %s\n' % (f, h[f]))
352 352
353 353 if not name:
354 354 exts = listexts(_('enabled extensions:'), extensions.enabled())
355 355 if exts:
356 356 rst.append('\n')
357 357 rst.extend(exts)
358 358
359 359 rst.append(_("\nadditional help topics:\n\n"))
360 360 topics = []
361 361 for names, header, doc in helptable:
362 362 topics.append((names[0], header))
363 363 for t, desc in topics:
364 364 rst.append(" :%s: %s\n" % (t, desc))
365 365
366 366 if ui.quiet:
367 367 pass
368 368 elif ui.verbose:
369 369 rst.append('\n%s\n' % optrst(_("global options"),
370 370 commands.globalopts, ui.verbose))
371 371 if name == 'shortlist':
372 372 rst.append(_('\nuse "hg help" for the full list '
373 373 'of commands\n'))
374 374 else:
375 375 if name == 'shortlist':
376 376 rst.append(_('\nuse "hg help" for the full list of commands '
377 377 'or "hg -v" for details\n'))
378 378 elif name and not full:
379 379 rst.append(_('\nuse "hg help %s" to show the full help '
380 380 'text\n') % name)
381 381 else:
382 382 rst.append(_('\nuse "hg -v help%s" to show builtin aliases and '
383 383 'global options\n') % (name and " " + name or ""))
384 384 return rst
385 385
386 386 def helptopic(name):
387 387 for names, header, doc in helptable:
388 388 if name in names:
389 389 break
390 390 else:
391 391 raise error.UnknownCommand(name)
392 392
393 393 rst = [minirst.section(header)]
394 394
395 395 # description
396 396 if not doc:
397 397 rst.append(" %s\n" % _("(no help text available)"))
398 398 if callable(doc):
399 399 rst += [" %s\n" % l for l in doc().splitlines()]
400 400
401 401 if not ui.verbose:
402 402 omitted = _('(some details hidden, use --verbose'
403 403 ' to show complete help)')
404 404 indicateomitted(rst, omitted)
405 405
406 406 try:
407 407 cmdutil.findcmd(name, commands.table)
408 408 rst.append(_('\nuse "hg help -c %s" to see help for '
409 409 'the %s command\n') % (name, name))
410 410 except error.UnknownCommand:
411 411 pass
412 412 return rst
413 413
414 414 def helpext(name):
415 415 try:
416 416 mod = extensions.find(name)
417 417 doc = gettext(mod.__doc__) or _('no help text available')
418 418 except KeyError:
419 419 mod = None
420 420 doc = extensions.disabledext(name)
421 421 if not doc:
422 422 raise error.UnknownCommand(name)
423 423
424 424 if '\n' not in doc:
425 425 head, tail = doc, ""
426 426 else:
427 427 head, tail = doc.split('\n', 1)
428 428 rst = [_('%s extension - %s\n\n') % (name.split('.')[-1], head)]
429 429 if tail:
430 430 rst.extend(tail.splitlines(True))
431 431 rst.append('\n')
432 432
433 433 if not ui.verbose:
434 434 omitted = _('(some details hidden, use --verbose'
435 435 ' to show complete help)')
436 436 indicateomitted(rst, omitted)
437 437
438 438 if mod:
439 439 try:
440 440 ct = mod.cmdtable
441 441 except AttributeError:
442 442 ct = {}
443 443 modcmds = set([c.split('|', 1)[0] for c in ct])
444 444 rst.extend(helplist(modcmds.__contains__))
445 445 else:
446 446 rst.append(_('(use "hg help extensions" for information on enabling'
447 447 ' extensions)\n'))
448 448 return rst
449 449
450 450 def helpextcmd(name):
451 451 cmd, ext, mod = extensions.disabledcmd(ui, name,
452 452 ui.configbool('ui', 'strict'))
453 453 doc = gettext(mod.__doc__).splitlines()[0]
454 454
455 455 rst = listexts(_("'%s' is provided by the following "
456 456 "extension:") % cmd, {ext: doc}, indent=4)
457 457 rst.append('\n')
458 458 rst.append(_('(use "hg help extensions" for information on enabling '
459 459 'extensions)\n'))
460 460 return rst
461 461
462 462
463 463 rst = []
464 464 kw = opts.get('keyword')
465 465 if kw:
466 466 matches = topicmatch(kw)
467 467 for t, title in (('topics', _('Topics')),
468 468 ('commands', _('Commands')),
469 469 ('extensions', _('Extensions')),
470 470 ('extensioncommands', _('Extension Commands'))):
471 471 if matches[t]:
472 472 rst.append('%s:\n\n' % title)
473 473 rst.extend(minirst.maketable(sorted(matches[t]), 1))
474 474 rst.append('\n')
475 475 if not rst:
476 476 msg = _('no matches')
477 477 hint = _('try "hg help" for a list of topics')
478 478 raise util.Abort(msg, hint=hint)
479 479 elif name and name != 'shortlist':
480 480 if unknowncmd:
481 481 queries = (helpextcmd,)
482 482 elif opts.get('extension'):
483 483 queries = (helpext,)
484 484 elif opts.get('command'):
485 485 queries = (helpcmd,)
486 486 else:
487 487 queries = (helptopic, helpcmd, helpext, helpextcmd)
488 488 for f in queries:
489 489 try:
490 490 rst = f(name)
491 491 break
492 492 except error.UnknownCommand:
493 493 pass
494 494 else:
495 495 if unknowncmd:
496 496 raise error.UnknownCommand(name)
497 497 else:
498 498 msg = _('no such help topic: %s') % name
499 499 hint = _('try "hg help --keyword %s"') % name
500 500 raise util.Abort(msg, hint=hint)
501 501 else:
502 502 # program name
503 503 if not ui.quiet:
504 504 rst = [_("Mercurial Distributed SCM\n"), '\n']
505 505 rst.extend(helplist())
506 506
507 507 return ''.join(rst)
@@ -1,64 +1,62
1 1 test command parsing and dispatch
2 2
3 3 $ hg init a
4 4 $ cd a
5 5
6 6 Redundant options used to crash (issue436):
7 7 $ hg -v log -v
8 8 $ hg -v log -v x
9 9
10 10 $ echo a > a
11 11 $ hg ci -Ama
12 12 adding a
13 13
14 14 Missing arg:
15 15
16 16 $ hg cat
17 17 hg cat: invalid arguments
18 18 hg cat [OPTION]... FILE...
19 19
20 20 output the current or given revision of files
21 21
22 options:
22 options ([+] can be repeated):
23 23
24 24 -o --output FORMAT print output to file with formatted name
25 25 -r --rev REV print the given revision
26 26 --decode apply any matching decode filter
27 27 -I --include PATTERN [+] include names matching the given patterns
28 28 -X --exclude PATTERN [+] exclude names matching the given patterns
29 29
30 [+] marked option can be specified multiple times
31
32 30 (use "hg cat -h" to show more help)
33 31 [255]
34 32
35 33 [defaults]
36 34
37 35 $ hg cat a
38 36 a
39 37 $ cat >> $HGRCPATH <<EOF
40 38 > [defaults]
41 39 > cat = -r null
42 40 > EOF
43 41 $ hg cat a
44 42 a: no such file in rev 000000000000
45 43 [1]
46 44
47 45 $ cd "$TESTTMP"
48 46
49 47 OSError "No such file or directory" / "The system cannot find the path
50 48 specified" should include filename even when it is empty
51 49
52 50 $ hg -R a archive ''
53 51 abort: *: '' (glob)
54 52 [255]
55 53
56 54 #if no-outer-repo
57 55
58 56 No repo:
59 57
60 58 $ hg cat
61 59 abort: no repository found in '$TESTTMP' (.hg not found)!
62 60 [255]
63 61
64 62 #endif
@@ -1,204 +1,202
1 1 $ echo "[extensions]" >> $HGRCPATH
2 2 $ echo "extdiff=" >> $HGRCPATH
3 3
4 4 $ hg init a
5 5 $ cd a
6 6 $ echo a > a
7 7 $ echo b > b
8 8 $ hg add
9 9 adding a
10 10 adding b
11 11
12 12 Should diff cloned directories:
13 13
14 14 $ hg extdiff -o -r $opt
15 15 Only in a: a
16 16 Only in a: b
17 17 [1]
18 18
19 19 $ echo "[extdiff]" >> $HGRCPATH
20 20 $ echo "cmd.falabala=echo" >> $HGRCPATH
21 21 $ echo "opts.falabala=diffing" >> $HGRCPATH
22 22
23 23 $ hg falabala
24 24 diffing a.000000000000 a
25 25 [1]
26 26
27 27 $ hg help falabala
28 28 hg falabala [OPTION]... [FILE]...
29 29
30 30 use 'echo' to diff repository (or selected files)
31 31
32 32 Show differences between revisions for the specified files, using the
33 33 'echo' program.
34 34
35 35 When two revision arguments are given, then changes are shown between
36 36 those revisions. If only one revision is specified then that revision is
37 37 compared to the working directory, and, when no revisions are specified,
38 38 the working directory files are compared to its parent.
39 39
40 options:
40 options ([+] can be repeated):
41 41
42 42 -o --option OPT [+] pass option to comparison program
43 43 -r --rev REV [+] revision
44 44 -c --change REV change made by revision
45 45 -I --include PATTERN [+] include names matching the given patterns
46 46 -X --exclude PATTERN [+] exclude names matching the given patterns
47 47
48 [+] marked option can be specified multiple times
49
50 48 (some details hidden, use --verbose to show complete help)
51 49
52 50 $ hg ci -d '0 0' -mtest1
53 51
54 52 $ echo b >> a
55 53 $ hg ci -d '1 0' -mtest2
56 54
57 55 Should diff cloned files directly:
58 56
59 57 $ hg falabala -r 0:1
60 58 diffing */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
61 59 [1]
62 60
63 61 Test diff during merge:
64 62
65 63 $ hg update -C 0
66 64 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
67 65 $ echo c >> c
68 66 $ hg add c
69 67 $ hg ci -m "new branch" -d '1 0'
70 68 created new head
71 69 $ hg merge 1
72 70 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
73 71 (branch merge, don't forget to commit)
74 72
75 73 Should diff cloned file against wc file:
76 74
77 75 $ hg falabala
78 76 diffing */extdiff.*/a.2a13a4d2da36/a */a/a (glob)
79 77 [1]
80 78
81 79
82 80 Test --change option:
83 81
84 82 $ hg ci -d '2 0' -mtest3
85 83 $ hg falabala -c 1
86 84 diffing */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
87 85 [1]
88 86
89 87 Check diff are made from the first parent:
90 88
91 89 $ hg falabala -c 3 || echo "diff-like tools yield a non-zero exit code"
92 90 diffing */extdiff.*/a.2a13a4d2da36/a a.46c0e4daeb72/a (glob)
93 91 diff-like tools yield a non-zero exit code
94 92
95 93 #if execbit
96 94
97 95 Test extdiff of multiple files in tmp dir:
98 96
99 97 $ hg update -C 0 > /dev/null
100 98 $ echo changed > a
101 99 $ echo changed > b
102 100 $ chmod +x b
103 101
104 102 Diff in working directory, before:
105 103
106 104 $ hg diff --git
107 105 diff --git a/a b/a
108 106 --- a/a
109 107 +++ b/a
110 108 @@ -1,1 +1,1 @@
111 109 -a
112 110 +changed
113 111 diff --git a/b b/b
114 112 old mode 100644
115 113 new mode 100755
116 114 --- a/b
117 115 +++ b/b
118 116 @@ -1,1 +1,1 @@
119 117 -b
120 118 +changed
121 119
122 120
123 121 Edit with extdiff -p:
124 122
125 123 Prepare custom diff/edit tool:
126 124
127 125 $ cat > 'diff tool.py' << EOT
128 126 > #!/usr/bin/env python
129 127 > import time
130 128 > time.sleep(1) # avoid unchanged-timestamp problems
131 129 > file('a/a', 'ab').write('edited\n')
132 130 > file('a/b', 'ab').write('edited\n')
133 131 > EOT
134 132
135 133 $ chmod +x 'diff tool.py'
136 134
137 135 will change to /tmp/extdiff.TMP and populate directories a.TMP and a
138 136 and start tool
139 137
140 138 $ hg extdiff -p "`pwd`/diff tool.py"
141 139 [1]
142 140
143 141 Diff in working directory, after:
144 142
145 143 $ hg diff --git
146 144 diff --git a/a b/a
147 145 --- a/a
148 146 +++ b/a
149 147 @@ -1,1 +1,2 @@
150 148 -a
151 149 +changed
152 150 +edited
153 151 diff --git a/b b/b
154 152 old mode 100644
155 153 new mode 100755
156 154 --- a/b
157 155 +++ b/b
158 156 @@ -1,1 +1,2 @@
159 157 -b
160 158 +changed
161 159 +edited
162 160
163 161 Test extdiff with --option:
164 162
165 163 $ hg extdiff -p echo -o this -c 1
166 164 this */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
167 165 [1]
168 166
169 167 $ hg falabala -o this -c 1
170 168 diffing this */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
171 169 [1]
172 170
173 171 Test with revsets:
174 172
175 173 $ hg extdif -p echo -c "rev(1)"
176 174 */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
177 175 [1]
178 176
179 177 $ hg extdif -p echo -r "0::1"
180 178 */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
181 179 [1]
182 180
183 181 $ cd ..
184 182
185 183 #endif
186 184
187 185 #if symlink
188 186
189 187 Test symlinks handling (issue1909)
190 188
191 189 $ hg init testsymlinks
192 190 $ cd testsymlinks
193 191 $ echo a > a
194 192 $ hg ci -Am adda
195 193 adding a
196 194 $ echo a >> a
197 195 $ ln -s missing linka
198 196 $ hg add linka
199 197 $ hg falabala -r 0 --traceback
200 198 diffing testsymlinks.07f494440405 testsymlinks
201 199 [1]
202 200 $ cd ..
203 201
204 202 #endif
@@ -1,916 +1,910
1 1 Test basic extension support
2 2
3 3 $ cat > foobar.py <<EOF
4 4 > import os
5 5 > from mercurial import cmdutil, commands
6 6 > cmdtable = {}
7 7 > command = cmdutil.command(cmdtable)
8 8 > def uisetup(ui):
9 9 > ui.write("uisetup called\\n")
10 10 > def reposetup(ui, repo):
11 11 > ui.write("reposetup called for %s\\n" % os.path.basename(repo.root))
12 12 > ui.write("ui %s= repo.ui\\n" % (ui == repo.ui and "=" or "!"))
13 13 > @command('foo', [], 'hg foo')
14 14 > def foo(ui, *args, **kwargs):
15 15 > ui.write("Foo\\n")
16 16 > @command('bar', [], 'hg bar', norepo=True)
17 17 > def bar(ui, *args, **kwargs):
18 18 > ui.write("Bar\\n")
19 19 > EOF
20 20 $ abspath=`pwd`/foobar.py
21 21
22 22 $ mkdir barfoo
23 23 $ cp foobar.py barfoo/__init__.py
24 24 $ barfoopath=`pwd`/barfoo
25 25
26 26 $ hg init a
27 27 $ cd a
28 28 $ echo foo > file
29 29 $ hg add file
30 30 $ hg commit -m 'add file'
31 31
32 32 $ echo '[extensions]' >> $HGRCPATH
33 33 $ echo "foobar = $abspath" >> $HGRCPATH
34 34 $ hg foo
35 35 uisetup called
36 36 reposetup called for a
37 37 ui == repo.ui
38 38 Foo
39 39
40 40 $ cd ..
41 41 $ hg clone a b
42 42 uisetup called
43 43 reposetup called for a
44 44 ui == repo.ui
45 45 reposetup called for b
46 46 ui == repo.ui
47 47 updating to branch default
48 48 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
49 49
50 50 $ hg bar
51 51 uisetup called
52 52 Bar
53 53 $ echo 'foobar = !' >> $HGRCPATH
54 54
55 55 module/__init__.py-style
56 56
57 57 $ echo "barfoo = $barfoopath" >> $HGRCPATH
58 58 $ cd a
59 59 $ hg foo
60 60 uisetup called
61 61 reposetup called for a
62 62 ui == repo.ui
63 63 Foo
64 64 $ echo 'barfoo = !' >> $HGRCPATH
65 65
66 66 Check that extensions are loaded in phases:
67 67
68 68 $ cat > foo.py <<EOF
69 69 > import os
70 70 > name = os.path.basename(__file__).rsplit('.', 1)[0]
71 71 > print "1) %s imported" % name
72 72 > def uisetup(ui):
73 73 > print "2) %s uisetup" % name
74 74 > def extsetup():
75 75 > print "3) %s extsetup" % name
76 76 > def reposetup(ui, repo):
77 77 > print "4) %s reposetup" % name
78 78 > EOF
79 79
80 80 $ cp foo.py bar.py
81 81 $ echo 'foo = foo.py' >> $HGRCPATH
82 82 $ echo 'bar = bar.py' >> $HGRCPATH
83 83
84 84 Command with no output, we just want to see the extensions loaded:
85 85
86 86 $ hg paths
87 87 1) foo imported
88 88 1) bar imported
89 89 2) foo uisetup
90 90 2) bar uisetup
91 91 3) foo extsetup
92 92 3) bar extsetup
93 93 4) foo reposetup
94 94 4) bar reposetup
95 95
96 96 Check hgweb's load order:
97 97
98 98 $ cat > hgweb.cgi <<EOF
99 99 > #!/usr/bin/env python
100 100 > from mercurial import demandimport; demandimport.enable()
101 101 > from mercurial.hgweb import hgweb
102 102 > from mercurial.hgweb import wsgicgi
103 103 > application = hgweb('.', 'test repo')
104 104 > wsgicgi.launch(application)
105 105 > EOF
106 106
107 107 $ REQUEST_METHOD='GET' PATH_INFO='/' SCRIPT_NAME='' QUERY_STRING='' \
108 108 > SERVER_PORT='80' SERVER_NAME='localhost' python hgweb.cgi \
109 109 > | grep '^[0-9]) ' # ignores HTML output
110 110 1) foo imported
111 111 1) bar imported
112 112 2) foo uisetup
113 113 2) bar uisetup
114 114 3) foo extsetup
115 115 3) bar extsetup
116 116 4) foo reposetup
117 117 4) bar reposetup
118 118 4) foo reposetup
119 119 4) bar reposetup
120 120
121 121 $ echo 'foo = !' >> $HGRCPATH
122 122 $ echo 'bar = !' >> $HGRCPATH
123 123
124 124 Check "from __future__ import absolute_import" support for external libraries
125 125
126 126 #if windows
127 127 $ PATHSEP=";"
128 128 #else
129 129 $ PATHSEP=":"
130 130 #endif
131 131 $ export PATHSEP
132 132
133 133 $ mkdir $TESTTMP/libroot
134 134 $ echo "s = 'libroot/ambig.py'" > $TESTTMP/libroot/ambig.py
135 135 $ mkdir $TESTTMP/libroot/mod
136 136 $ touch $TESTTMP/libroot/mod/__init__.py
137 137 $ echo "s = 'libroot/mod/ambig.py'" > $TESTTMP/libroot/mod/ambig.py
138 138
139 139 #if absimport
140 140 $ cat > $TESTTMP/libroot/mod/ambigabs.py <<EOF
141 141 > from __future__ import absolute_import
142 142 > import ambig # should load "libroot/ambig.py"
143 143 > s = ambig.s
144 144 > EOF
145 145 $ cat > loadabs.py <<EOF
146 146 > import mod.ambigabs as ambigabs
147 147 > def extsetup():
148 148 > print 'ambigabs.s=%s' % ambigabs.s
149 149 > EOF
150 150 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadabs=loadabs.py root)
151 151 ambigabs.s=libroot/ambig.py
152 152 $TESTTMP/a (glob)
153 153 #endif
154 154
155 155 #if no-py3k
156 156 $ cat > $TESTTMP/libroot/mod/ambigrel.py <<EOF
157 157 > import ambig # should load "libroot/mod/ambig.py"
158 158 > s = ambig.s
159 159 > EOF
160 160 $ cat > loadrel.py <<EOF
161 161 > import mod.ambigrel as ambigrel
162 162 > def extsetup():
163 163 > print 'ambigrel.s=%s' % ambigrel.s
164 164 > EOF
165 165 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadrel=loadrel.py root)
166 166 ambigrel.s=libroot/mod/ambig.py
167 167 $TESTTMP/a (glob)
168 168 #endif
169 169
170 170 Check absolute/relative import of extension specific modules
171 171
172 172 $ mkdir $TESTTMP/extroot
173 173 $ cat > $TESTTMP/extroot/bar.py <<EOF
174 174 > s = 'this is extroot.bar'
175 175 > EOF
176 176 $ mkdir $TESTTMP/extroot/sub1
177 177 $ cat > $TESTTMP/extroot/sub1/__init__.py <<EOF
178 178 > s = 'this is extroot.sub1.__init__'
179 179 > EOF
180 180 $ cat > $TESTTMP/extroot/sub1/baz.py <<EOF
181 181 > s = 'this is extroot.sub1.baz'
182 182 > EOF
183 183 $ cat > $TESTTMP/extroot/__init__.py <<EOF
184 184 > s = 'this is extroot.__init__'
185 185 > import foo
186 186 > def extsetup(ui):
187 187 > ui.write('(extroot) ', foo.func(), '\n')
188 188 > EOF
189 189
190 190 $ cat > $TESTTMP/extroot/foo.py <<EOF
191 191 > # test absolute import
192 192 > buf = []
193 193 > def func():
194 194 > # "not locals" case
195 195 > import extroot.bar
196 196 > buf.append('import extroot.bar in func(): %s' % extroot.bar.s)
197 197 > return '\n(extroot) '.join(buf)
198 198 > # "fromlist == ('*',)" case
199 199 > from extroot.bar import *
200 200 > buf.append('from extroot.bar import *: %s' % s)
201 201 > # "not fromlist" and "if '.' in name" case
202 202 > import extroot.sub1.baz
203 203 > buf.append('import extroot.sub1.baz: %s' % extroot.sub1.baz.s)
204 204 > # "not fromlist" and NOT "if '.' in name" case
205 205 > import extroot
206 206 > buf.append('import extroot: %s' % extroot.s)
207 207 > # NOT "not fromlist" and NOT "level != -1" case
208 208 > from extroot.bar import s
209 209 > buf.append('from extroot.bar import s: %s' % s)
210 210 > EOF
211 211 $ hg --config extensions.extroot=$TESTTMP/extroot root
212 212 (extroot) from extroot.bar import *: this is extroot.bar
213 213 (extroot) import extroot.sub1.baz: this is extroot.sub1.baz
214 214 (extroot) import extroot: this is extroot.__init__
215 215 (extroot) from extroot.bar import s: this is extroot.bar
216 216 (extroot) import extroot.bar in func(): this is extroot.bar
217 217 $TESTTMP/a (glob)
218 218
219 219 #if no-py3k
220 220 $ rm "$TESTTMP"/extroot/foo.*
221 221 $ cat > $TESTTMP/extroot/foo.py <<EOF
222 222 > # test relative import
223 223 > buf = []
224 224 > def func():
225 225 > # "not locals" case
226 226 > import bar
227 227 > buf.append('import bar in func(): %s' % bar.s)
228 228 > return '\n(extroot) '.join(buf)
229 229 > # "fromlist == ('*',)" case
230 230 > from bar import *
231 231 > buf.append('from bar import *: %s' % s)
232 232 > # "not fromlist" and "if '.' in name" case
233 233 > import sub1.baz
234 234 > buf.append('import sub1.baz: %s' % sub1.baz.s)
235 235 > # "not fromlist" and NOT "if '.' in name" case
236 236 > import sub1
237 237 > buf.append('import sub1: %s' % sub1.s)
238 238 > # NOT "not fromlist" and NOT "level != -1" case
239 239 > from bar import s
240 240 > buf.append('from bar import s: %s' % s)
241 241 > EOF
242 242 $ hg --config extensions.extroot=$TESTTMP/extroot root
243 243 (extroot) from bar import *: this is extroot.bar
244 244 (extroot) import sub1.baz: this is extroot.sub1.baz
245 245 (extroot) import sub1: this is extroot.sub1.__init__
246 246 (extroot) from bar import s: this is extroot.bar
247 247 (extroot) import bar in func(): this is extroot.bar
248 248 $TESTTMP/a (glob)
249 249 #endif
250 250
251 251 $ cd ..
252 252
253 253 hide outer repo
254 254 $ hg init
255 255
256 256 $ cat > empty.py <<EOF
257 257 > '''empty cmdtable
258 258 > '''
259 259 > cmdtable = {}
260 260 > EOF
261 261 $ emptypath=`pwd`/empty.py
262 262 $ echo "empty = $emptypath" >> $HGRCPATH
263 263 $ hg help empty
264 264 empty extension - empty cmdtable
265 265
266 266 no commands defined
267 267
268 268
269 269 $ echo 'empty = !' >> $HGRCPATH
270 270
271 271 $ cat > debugextension.py <<EOF
272 272 > '''only debugcommands
273 273 > '''
274 274 > from mercurial import cmdutil
275 275 > cmdtable = {}
276 276 > command = cmdutil.command(cmdtable)
277 277 > @command('debugfoobar', [], 'hg debugfoobar')
278 278 > def debugfoobar(ui, repo, *args, **opts):
279 279 > "yet another debug command"
280 280 > pass
281 281 > @command('foo', [], 'hg foo')
282 282 > def foo(ui, repo, *args, **opts):
283 283 > """yet another foo command
284 284 > This command has been DEPRECATED since forever.
285 285 > """
286 286 > pass
287 287 > EOF
288 288 $ debugpath=`pwd`/debugextension.py
289 289 $ echo "debugextension = $debugpath" >> $HGRCPATH
290 290
291 291 $ hg help debugextension
292 292 debugextension extension - only debugcommands
293 293
294 294 no commands defined
295 295
296 296
297 297 $ hg --verbose help debugextension
298 298 debugextension extension - only debugcommands
299 299
300 300 list of commands:
301 301
302 302 foo yet another foo command
303 303
304 global options:
304 global options ([+] can be repeated):
305 305
306 306 -R --repository REPO repository root directory or name of overlay bundle
307 307 file
308 308 --cwd DIR change working directory
309 309 -y --noninteractive do not prompt, automatically pick the first choice for
310 310 all prompts
311 311 -q --quiet suppress output
312 312 -v --verbose enable additional output
313 313 --config CONFIG [+] set/override config option (use 'section.name=value')
314 314 --debug enable debugging output
315 315 --debugger start debugger
316 316 --encoding ENCODE set the charset encoding (default: ascii)
317 317 --encodingmode MODE set the charset encoding mode (default: strict)
318 318 --traceback always print a traceback on exception
319 319 --time time how long the command takes
320 320 --profile print command execution profile
321 321 --version output version information and exit
322 322 -h --help display help and exit
323 323 --hidden consider hidden changesets
324
325 [+] marked option can be specified multiple times
326 324
327 325
328 326
329 327
330 328
331 329
332 330 $ hg --debug help debugextension
333 331 debugextension extension - only debugcommands
334 332
335 333 list of commands:
336 334
337 335 debugfoobar yet another debug command
338 336 foo yet another foo command
339 337
340 global options:
338 global options ([+] can be repeated):
341 339
342 340 -R --repository REPO repository root directory or name of overlay bundle
343 341 file
344 342 --cwd DIR change working directory
345 343 -y --noninteractive do not prompt, automatically pick the first choice for
346 344 all prompts
347 345 -q --quiet suppress output
348 346 -v --verbose enable additional output
349 347 --config CONFIG [+] set/override config option (use 'section.name=value')
350 348 --debug enable debugging output
351 349 --debugger start debugger
352 350 --encoding ENCODE set the charset encoding (default: ascii)
353 351 --encodingmode MODE set the charset encoding mode (default: strict)
354 352 --traceback always print a traceback on exception
355 353 --time time how long the command takes
356 354 --profile print command execution profile
357 355 --version output version information and exit
358 356 -h --help display help and exit
359 357 --hidden consider hidden changesets
360
361 [+] marked option can be specified multiple times
362 358
363 359
364 360
365 361
366 362
367 363 $ echo 'debugextension = !' >> $HGRCPATH
368 364
369 365 Extension module help vs command help:
370 366
371 367 $ echo 'extdiff =' >> $HGRCPATH
372 368 $ hg help extdiff
373 369 hg extdiff [OPT]... [FILE]...
374 370
375 371 use external program to diff repository (or selected files)
376 372
377 373 Show differences between revisions for the specified files, using an
378 374 external program. The default program used is diff, with default options
379 375 "-Npru".
380 376
381 377 To select a different program, use the -p/--program option. The program
382 378 will be passed the names of two directories to compare. To pass additional
383 379 options to the program, use -o/--option. These will be passed before the
384 380 names of the directories to compare.
385 381
386 382 When two revision arguments are given, then changes are shown between
387 383 those revisions. If only one revision is specified then that revision is
388 384 compared to the working directory, and, when no revisions are specified,
389 385 the working directory files are compared to its parent.
390 386
391 387 (use "hg help -e extdiff" to show help for the extdiff extension)
392 388
393 options:
389 options ([+] can be repeated):
394 390
395 391 -p --program CMD comparison program to run
396 392 -o --option OPT [+] pass option to comparison program
397 393 -r --rev REV [+] revision
398 394 -c --change REV change made by revision
399 395 -I --include PATTERN [+] include names matching the given patterns
400 396 -X --exclude PATTERN [+] exclude names matching the given patterns
401 397
402 [+] marked option can be specified multiple times
403
404 398 (some details hidden, use --verbose to show complete help)
405 399
406 400
407 401
408 402
409 403
410 404
411 405
412 406
413 407
414 408
415 409 $ hg help --extension extdiff
416 410 extdiff extension - command to allow external programs to compare revisions
417 411
418 412 The extdiff Mercurial extension allows you to use external programs to compare
419 413 revisions, or revision with working directory. The external diff programs are
420 414 called with a configurable set of options and two non-option arguments: paths
421 415 to directories containing snapshots of files to compare.
422 416
423 417 The extdiff extension also allows you to configure new diff commands, so you
424 418 do not need to type "hg extdiff -p kdiff3" always.
425 419
426 420 [extdiff]
427 421 # add new command that runs GNU diff(1) in 'context diff' mode
428 422 cdiff = gdiff -Nprc5
429 423 ## or the old way:
430 424 #cmd.cdiff = gdiff
431 425 #opts.cdiff = -Nprc5
432 426
433 427 # add new command called vdiff, runs kdiff3
434 428 vdiff = kdiff3
435 429
436 430 # add new command called meld, runs meld (no need to name twice)
437 431 meld =
438 432
439 433 # add new command called vimdiff, runs gvimdiff with DirDiff plugin
440 434 # (see http://www.vim.org/scripts/script.php?script_id=102) Non
441 435 # English user, be sure to put "let g:DirDiffDynamicDiffText = 1" in
442 436 # your .vimrc
443 437 vimdiff = gvim -f "+next" \
444 438 "+execute 'DirDiff' fnameescape(argv(0)) fnameescape(argv(1))"
445 439
446 440 Tool arguments can include variables that are expanded at runtime:
447 441
448 442 $parent1, $plabel1 - filename, descriptive label of first parent
449 443 $child, $clabel - filename, descriptive label of child revision
450 444 $parent2, $plabel2 - filename, descriptive label of second parent
451 445 $root - repository root
452 446 $parent is an alias for $parent1.
453 447
454 448 The extdiff extension will look in your [diff-tools] and [merge-tools]
455 449 sections for diff tool arguments, when none are specified in [extdiff].
456 450
457 451 [extdiff]
458 452 kdiff3 =
459 453
460 454 [diff-tools]
461 455 kdiff3.diffargs=--L1 '$plabel1' --L2 '$clabel' $parent $child
462 456
463 457 You can use -I/-X and list of file or directory names like normal "hg diff"
464 458 command. The extdiff extension makes snapshots of only needed files, so
465 459 running the external diff program will actually be pretty fast (at least
466 460 faster than having to compare the entire tree).
467 461
468 462 list of commands:
469 463
470 464 extdiff use external program to diff repository (or selected files)
471 465
472 466 use "hg -v help extdiff" to show builtin aliases and global options
473 467
474 468
475 469
476 470
477 471
478 472
479 473
480 474
481 475
482 476
483 477
484 478
485 479
486 480
487 481
488 482
489 483 $ echo 'extdiff = !' >> $HGRCPATH
490 484
491 485 Test help topic with same name as extension
492 486
493 487 $ cat > multirevs.py <<EOF
494 488 > from mercurial import cmdutil, commands
495 489 > cmdtable = {}
496 490 > command = cmdutil.command(cmdtable)
497 491 > """multirevs extension
498 492 > Big multi-line module docstring."""
499 493 > @command('multirevs', [], 'ARG', norepo=True)
500 494 > def multirevs(ui, repo, arg, *args, **opts):
501 495 > """multirevs command"""
502 496 > pass
503 497 > EOF
504 498 $ echo "multirevs = multirevs.py" >> $HGRCPATH
505 499
506 500 $ hg help multirevs
507 501 Specifying Multiple Revisions
508 502 """""""""""""""""""""""""""""
509 503
510 504 When Mercurial accepts more than one revision, they may be specified
511 505 individually, or provided as a topologically continuous range, separated
512 506 by the ":" character.
513 507
514 508 The syntax of range notation is [BEGIN]:[END], where BEGIN and END are
515 509 revision identifiers. Both BEGIN and END are optional. If BEGIN is not
516 510 specified, it defaults to revision number 0. If END is not specified, it
517 511 defaults to the tip. The range ":" thus means "all revisions".
518 512
519 513 If BEGIN is greater than END, revisions are treated in reverse order.
520 514
521 515 A range acts as a closed interval. This means that a range of 3:5 gives 3,
522 516 4 and 5. Similarly, a range of 9:6 gives 9, 8, 7, and 6.
523 517
524 518 use "hg help -c multirevs" to see help for the multirevs command
525 519
526 520
527 521
528 522
529 523
530 524
531 525 $ hg help -c multirevs
532 526 hg multirevs ARG
533 527
534 528 multirevs command
535 529
536 530 (some details hidden, use --verbose to show complete help)
537 531
538 532
539 533
540 534 $ hg multirevs
541 535 hg multirevs: invalid arguments
542 536 hg multirevs ARG
543 537
544 538 multirevs command
545 539
546 540 (use "hg multirevs -h" to show more help)
547 541 [255]
548 542
549 543
550 544
551 545 $ echo "multirevs = !" >> $HGRCPATH
552 546
553 547 Issue811: Problem loading extensions twice (by site and by user)
554 548
555 549 $ debugpath=`pwd`/debugissue811.py
556 550 $ cat > debugissue811.py <<EOF
557 551 > '''show all loaded extensions
558 552 > '''
559 553 > from mercurial import cmdutil, commands, extensions
560 554 > cmdtable = {}
561 555 > command = cmdutil.command(cmdtable)
562 556 > @command('debugextensions', [], 'hg debugextensions', norepo=True)
563 557 > def debugextensions(ui):
564 558 > "yet another debug command"
565 559 > ui.write("%s\n" % '\n'.join([x for x, y in extensions.extensions()]))
566 560 > EOF
567 561 $ echo "debugissue811 = $debugpath" >> $HGRCPATH
568 562 $ echo "mq=" >> $HGRCPATH
569 563 $ echo "strip=" >> $HGRCPATH
570 564 $ echo "hgext.mq=" >> $HGRCPATH
571 565 $ echo "hgext/mq=" >> $HGRCPATH
572 566
573 567 Show extensions:
574 568 (note that mq force load strip, also checking it's not loaded twice)
575 569
576 570 $ hg debugextensions
577 571 debugissue811
578 572 strip
579 573 mq
580 574
581 575 Disabled extension commands:
582 576
583 577 $ ORGHGRCPATH=$HGRCPATH
584 578 $ HGRCPATH=
585 579 $ export HGRCPATH
586 580 $ hg help email
587 581 'email' is provided by the following extension:
588 582
589 583 patchbomb command to send changesets as (a series of) patch emails
590 584
591 585 (use "hg help extensions" for information on enabling extensions)
592 586
593 587
594 588 $ hg qdel
595 589 hg: unknown command 'qdel'
596 590 'qdelete' is provided by the following extension:
597 591
598 592 mq manage a stack of patches
599 593
600 594 (use "hg help extensions" for information on enabling extensions)
601 595 [255]
602 596
603 597
604 598 $ hg churn
605 599 hg: unknown command 'churn'
606 600 'churn' is provided by the following extension:
607 601
608 602 churn command to display statistics about repository history
609 603
610 604 (use "hg help extensions" for information on enabling extensions)
611 605 [255]
612 606
613 607
614 608
615 609 Disabled extensions:
616 610
617 611 $ hg help churn
618 612 churn extension - command to display statistics about repository history
619 613
620 614 (use "hg help extensions" for information on enabling extensions)
621 615
622 616 $ hg help patchbomb
623 617 patchbomb extension - command to send changesets as (a series of) patch emails
624 618
625 619 (use "hg help extensions" for information on enabling extensions)
626 620
627 621
628 622 Broken disabled extension and command:
629 623
630 624 $ mkdir hgext
631 625 $ echo > hgext/__init__.py
632 626 $ cat > hgext/broken.py <<EOF
633 627 > "broken extension'
634 628 > EOF
635 629 $ cat > path.py <<EOF
636 630 > import os, sys
637 631 > sys.path.insert(0, os.environ['HGEXTPATH'])
638 632 > EOF
639 633 $ HGEXTPATH=`pwd`
640 634 $ export HGEXTPATH
641 635
642 636 $ hg --config extensions.path=./path.py help broken
643 637 broken extension - (no help text available)
644 638
645 639 (use "hg help extensions" for information on enabling extensions)
646 640
647 641
648 642 $ cat > hgext/forest.py <<EOF
649 643 > cmdtable = None
650 644 > EOF
651 645 $ hg --config extensions.path=./path.py help foo > /dev/null
652 646 warning: error finding commands in $TESTTMP/hgext/forest.py (glob)
653 647 abort: no such help topic: foo
654 648 (try "hg help --keyword foo")
655 649 [255]
656 650
657 651 $ cat > throw.py <<EOF
658 652 > from mercurial import cmdutil, commands
659 653 > cmdtable = {}
660 654 > command = cmdutil.command(cmdtable)
661 655 > class Bogon(Exception): pass
662 656 > @command('throw', [], 'hg throw', norepo=True)
663 657 > def throw(ui, **opts):
664 658 > """throws an exception"""
665 659 > raise Bogon()
666 660 > EOF
667 661 No declared supported version, extension complains:
668 662 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
669 663 ** Unknown exception encountered with possibly-broken third-party extension throw
670 664 ** which supports versions unknown of Mercurial.
671 665 ** Please disable throw and try your action again.
672 666 ** If that fixes the bug please report it to the extension author.
673 667 ** Python * (glob)
674 668 ** Mercurial Distributed SCM * (glob)
675 669 ** Extensions loaded: throw
676 670 empty declaration of supported version, extension complains:
677 671 $ echo "testedwith = ''" >> throw.py
678 672 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
679 673 ** Unknown exception encountered with possibly-broken third-party extension throw
680 674 ** which supports versions unknown of Mercurial.
681 675 ** Please disable throw and try your action again.
682 676 ** If that fixes the bug please report it to the extension author.
683 677 ** Python * (glob)
684 678 ** Mercurial Distributed SCM (*) (glob)
685 679 ** Extensions loaded: throw
686 680 If the extension specifies a buglink, show that:
687 681 $ echo 'buglink = "http://example.com/bts"' >> throw.py
688 682 $ rm -f throw.pyc throw.pyo
689 683 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
690 684 ** Unknown exception encountered with possibly-broken third-party extension throw
691 685 ** which supports versions unknown of Mercurial.
692 686 ** Please disable throw and try your action again.
693 687 ** If that fixes the bug please report it to http://example.com/bts
694 688 ** Python * (glob)
695 689 ** Mercurial Distributed SCM (*) (glob)
696 690 ** Extensions loaded: throw
697 691 If the extensions declare outdated versions, accuse the older extension first:
698 692 $ echo "from mercurial import util" >> older.py
699 693 $ echo "util.version = lambda:'2.2'" >> older.py
700 694 $ echo "testedwith = '1.9.3'" >> older.py
701 695 $ echo "testedwith = '2.1.1'" >> throw.py
702 696 $ rm -f throw.pyc throw.pyo
703 697 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
704 698 > throw 2>&1 | egrep '^\*\*'
705 699 ** Unknown exception encountered with possibly-broken third-party extension older
706 700 ** which supports versions 1.9.3 of Mercurial.
707 701 ** Please disable older and try your action again.
708 702 ** If that fixes the bug please report it to the extension author.
709 703 ** Python * (glob)
710 704 ** Mercurial Distributed SCM (version 2.2)
711 705 ** Extensions loaded: throw, older
712 706 One extension only tested with older, one only with newer versions:
713 707 $ echo "util.version = lambda:'2.1.0'" >> older.py
714 708 $ rm -f older.pyc older.pyo
715 709 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
716 710 > throw 2>&1 | egrep '^\*\*'
717 711 ** Unknown exception encountered with possibly-broken third-party extension older
718 712 ** which supports versions 1.9.3 of Mercurial.
719 713 ** Please disable older and try your action again.
720 714 ** If that fixes the bug please report it to the extension author.
721 715 ** Python * (glob)
722 716 ** Mercurial Distributed SCM (version 2.1.0)
723 717 ** Extensions loaded: throw, older
724 718 Older extension is tested with current version, the other only with newer:
725 719 $ echo "util.version = lambda:'1.9.3'" >> older.py
726 720 $ rm -f older.pyc older.pyo
727 721 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
728 722 > throw 2>&1 | egrep '^\*\*'
729 723 ** Unknown exception encountered with possibly-broken third-party extension throw
730 724 ** which supports versions 2.1.1 of Mercurial.
731 725 ** Please disable throw and try your action again.
732 726 ** If that fixes the bug please report it to http://example.com/bts
733 727 ** Python * (glob)
734 728 ** Mercurial Distributed SCM (version 1.9.3)
735 729 ** Extensions loaded: throw, older
736 730
737 731 Declare the version as supporting this hg version, show regular bts link:
738 732 $ hgver=`python -c 'from mercurial import util; print util.version().split("+")[0]'`
739 733 $ echo 'testedwith = """'"$hgver"'"""' >> throw.py
740 734 $ rm -f throw.pyc throw.pyo
741 735 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
742 736 ** unknown exception encountered, please report by visiting
743 737 ** http://mercurial.selenic.com/wiki/BugTracker
744 738 ** Python * (glob)
745 739 ** Mercurial Distributed SCM (*) (glob)
746 740 ** Extensions loaded: throw
747 741
748 742 Test version number support in 'hg version':
749 743 $ echo '__version__ = (1, 2, 3)' >> throw.py
750 744 $ rm -f throw.pyc throw.pyo
751 745 $ hg version -v
752 746 Mercurial Distributed SCM (version *) (glob)
753 747 (see http://mercurial.selenic.com for more information)
754 748
755 749 Copyright (C) 2005-* Matt Mackall and others (glob)
756 750 This is free software; see the source for copying conditions. There is NO
757 751 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
758 752
759 753 Enabled extensions:
760 754
761 755
762 756 $ hg version -v --config extensions.throw=throw.py
763 757 Mercurial Distributed SCM (version *) (glob)
764 758 (see http://mercurial.selenic.com for more information)
765 759
766 760 Copyright (C) 2005-* Matt Mackall and others (glob)
767 761 This is free software; see the source for copying conditions. There is NO
768 762 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
769 763
770 764 Enabled extensions:
771 765
772 766 throw 1.2.3
773 767 $ echo 'getversion = lambda: "1.twentythree"' >> throw.py
774 768 $ rm -f throw.pyc throw.pyo
775 769 $ hg version -v --config extensions.throw=throw.py
776 770 Mercurial Distributed SCM (version *) (glob)
777 771 (see http://mercurial.selenic.com for more information)
778 772
779 773 Copyright (C) 2005-* Matt Mackall and others (glob)
780 774 This is free software; see the source for copying conditions. There is NO
781 775 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
782 776
783 777 Enabled extensions:
784 778
785 779 throw 1.twentythree
786 780
787 781 Restore HGRCPATH
788 782
789 783 $ HGRCPATH=$ORGHGRCPATH
790 784 $ export HGRCPATH
791 785
792 786 Commands handling multiple repositories at a time should invoke only
793 787 "reposetup()" of extensions enabling in the target repository.
794 788
795 789 $ mkdir reposetup-test
796 790 $ cd reposetup-test
797 791
798 792 $ cat > $TESTTMP/reposetuptest.py <<EOF
799 793 > from mercurial import extensions
800 794 > def reposetup(ui, repo):
801 795 > ui.write('reposetup() for %s\n' % (repo.root))
802 796 > EOF
803 797 $ hg init src
804 798 $ echo a > src/a
805 799 $ hg -R src commit -Am '#0 at src/a'
806 800 adding a
807 801 $ echo '[extensions]' >> src/.hg/hgrc
808 802 $ echo '# enable extension locally' >> src/.hg/hgrc
809 803 $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> src/.hg/hgrc
810 804 $ hg -R src status
811 805 reposetup() for $TESTTMP/reposetup-test/src (glob)
812 806
813 807 $ hg clone -U src clone-dst1
814 808 reposetup() for $TESTTMP/reposetup-test/src (glob)
815 809 $ hg init push-dst1
816 810 $ hg -q -R src push push-dst1
817 811 reposetup() for $TESTTMP/reposetup-test/src (glob)
818 812 $ hg init pull-src1
819 813 $ hg -q -R pull-src1 pull src
820 814 reposetup() for $TESTTMP/reposetup-test/src (glob)
821 815
822 816 $ echo '[extensions]' >> $HGRCPATH
823 817 $ echo '# disable extension globally and explicitly' >> $HGRCPATH
824 818 $ echo 'reposetuptest = !' >> $HGRCPATH
825 819 $ hg clone -U src clone-dst2
826 820 reposetup() for $TESTTMP/reposetup-test/src (glob)
827 821 $ hg init push-dst2
828 822 $ hg -q -R src push push-dst2
829 823 reposetup() for $TESTTMP/reposetup-test/src (glob)
830 824 $ hg init pull-src2
831 825 $ hg -q -R pull-src2 pull src
832 826 reposetup() for $TESTTMP/reposetup-test/src (glob)
833 827
834 828 $ echo '[extensions]' >> $HGRCPATH
835 829 $ echo '# enable extension globally' >> $HGRCPATH
836 830 $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> $HGRCPATH
837 831 $ hg clone -U src clone-dst3
838 832 reposetup() for $TESTTMP/reposetup-test/src (glob)
839 833 reposetup() for $TESTTMP/reposetup-test/clone-dst3 (glob)
840 834 $ hg init push-dst3
841 835 reposetup() for $TESTTMP/reposetup-test/push-dst3 (glob)
842 836 $ hg -q -R src push push-dst3
843 837 reposetup() for $TESTTMP/reposetup-test/src (glob)
844 838 reposetup() for $TESTTMP/reposetup-test/push-dst3 (glob)
845 839 $ hg init pull-src3
846 840 reposetup() for $TESTTMP/reposetup-test/pull-src3 (glob)
847 841 $ hg -q -R pull-src3 pull src
848 842 reposetup() for $TESTTMP/reposetup-test/pull-src3 (glob)
849 843 reposetup() for $TESTTMP/reposetup-test/src (glob)
850 844
851 845 $ echo '[extensions]' >> src/.hg/hgrc
852 846 $ echo '# disable extension locally' >> src/.hg/hgrc
853 847 $ echo 'reposetuptest = !' >> src/.hg/hgrc
854 848 $ hg clone -U src clone-dst4
855 849 reposetup() for $TESTTMP/reposetup-test/clone-dst4 (glob)
856 850 $ hg init push-dst4
857 851 reposetup() for $TESTTMP/reposetup-test/push-dst4 (glob)
858 852 $ hg -q -R src push push-dst4
859 853 reposetup() for $TESTTMP/reposetup-test/push-dst4 (glob)
860 854 $ hg init pull-src4
861 855 reposetup() for $TESTTMP/reposetup-test/pull-src4 (glob)
862 856 $ hg -q -R pull-src4 pull src
863 857 reposetup() for $TESTTMP/reposetup-test/pull-src4 (glob)
864 858
865 859 disabling in command line overlays with all configuration
866 860 $ hg --config extensions.reposetuptest=! clone -U src clone-dst5
867 861 $ hg --config extensions.reposetuptest=! init push-dst5
868 862 $ hg --config extensions.reposetuptest=! -q -R src push push-dst5
869 863 $ hg --config extensions.reposetuptest=! init pull-src5
870 864 $ hg --config extensions.reposetuptest=! -q -R pull-src5 pull src
871 865
872 866 $ echo '[extensions]' >> $HGRCPATH
873 867 $ echo '# disable extension globally and explicitly' >> $HGRCPATH
874 868 $ echo 'reposetuptest = !' >> $HGRCPATH
875 869 $ hg init parent
876 870 $ hg init parent/sub1
877 871 $ echo 1 > parent/sub1/1
878 872 $ hg -R parent/sub1 commit -Am '#0 at parent/sub1'
879 873 adding 1
880 874 $ hg init parent/sub2
881 875 $ hg init parent/sub2/sub21
882 876 $ echo 21 > parent/sub2/sub21/21
883 877 $ hg -R parent/sub2/sub21 commit -Am '#0 at parent/sub2/sub21'
884 878 adding 21
885 879 $ cat > parent/sub2/.hgsub <<EOF
886 880 > sub21 = sub21
887 881 > EOF
888 882 $ hg -R parent/sub2 commit -Am '#0 at parent/sub2'
889 883 adding .hgsub
890 884 $ hg init parent/sub3
891 885 $ echo 3 > parent/sub3/3
892 886 $ hg -R parent/sub3 commit -Am '#0 at parent/sub3'
893 887 adding 3
894 888 $ cat > parent/.hgsub <<EOF
895 889 > sub1 = sub1
896 890 > sub2 = sub2
897 891 > sub3 = sub3
898 892 > EOF
899 893 $ hg -R parent commit -Am '#0 at parent'
900 894 adding .hgsub
901 895 $ echo '[extensions]' >> parent/.hg/hgrc
902 896 $ echo '# enable extension locally' >> parent/.hg/hgrc
903 897 $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> parent/.hg/hgrc
904 898 $ cp parent/.hg/hgrc parent/sub2/.hg/hgrc
905 899 $ hg -R parent status -S -A
906 900 reposetup() for $TESTTMP/reposetup-test/parent (glob)
907 901 reposetup() for $TESTTMP/reposetup-test/parent/sub2 (glob)
908 902 C .hgsub
909 903 C .hgsubstate
910 904 C sub1/1
911 905 C sub2/.hgsub
912 906 C sub2/.hgsubstate
913 907 C sub2/sub21/21
914 908 C sub3/3
915 909
916 910 $ cd ..
@@ -1,2098 +1,2072
1 1 Short help:
2 2
3 3 $ hg
4 4 Mercurial Distributed SCM
5 5
6 6 basic commands:
7 7
8 8 add add the specified files on the next commit
9 9 annotate show changeset information by line for each file
10 10 clone make a copy of an existing repository
11 11 commit commit the specified files or all outstanding changes
12 12 diff diff repository (or selected files)
13 13 export dump the header and diffs for one or more changesets
14 14 forget forget the specified files on the next commit
15 15 init create a new repository in the given directory
16 16 log show revision history of entire repository or files
17 17 merge merge working directory with another revision
18 18 pull pull changes from the specified source
19 19 push push changes to the specified destination
20 20 remove remove the specified files on the next commit
21 21 serve start stand-alone webserver
22 22 status show changed files in the working directory
23 23 summary summarize working directory state
24 24 update update working directory (or switch revisions)
25 25
26 26 use "hg help" for the full list of commands or "hg -v" for details
27 27
28 28 $ hg -q
29 29 add add the specified files on the next commit
30 30 annotate show changeset information by line for each file
31 31 clone make a copy of an existing repository
32 32 commit commit the specified files or all outstanding changes
33 33 diff diff repository (or selected files)
34 34 export dump the header and diffs for one or more changesets
35 35 forget forget the specified files on the next commit
36 36 init create a new repository in the given directory
37 37 log show revision history of entire repository or files
38 38 merge merge working directory with another revision
39 39 pull pull changes from the specified source
40 40 push push changes to the specified destination
41 41 remove remove the specified files on the next commit
42 42 serve start stand-alone webserver
43 43 status show changed files in the working directory
44 44 summary summarize working directory state
45 45 update update working directory (or switch revisions)
46 46
47 47 $ hg help
48 48 Mercurial Distributed SCM
49 49
50 50 list of commands:
51 51
52 52 add add the specified files on the next commit
53 53 addremove add all new files, delete all missing files
54 54 annotate show changeset information by line for each file
55 55 archive create an unversioned archive of a repository revision
56 56 backout reverse effect of earlier changeset
57 57 bisect subdivision search of changesets
58 58 bookmarks create a new bookmark or list existing bookmarks
59 59 branch set or show the current branch name
60 60 branches list repository named branches
61 61 bundle create a changegroup file
62 62 cat output the current or given revision of files
63 63 clone make a copy of an existing repository
64 64 commit commit the specified files or all outstanding changes
65 65 config show combined config settings from all hgrc files
66 66 copy mark files as copied for the next commit
67 67 diff diff repository (or selected files)
68 68 export dump the header and diffs for one or more changesets
69 69 forget forget the specified files on the next commit
70 70 graft copy changes from other branches onto the current branch
71 71 grep search for a pattern in specified files and revisions
72 72 heads show branch heads
73 73 help show help for a given topic or a help overview
74 74 identify identify the working copy or specified revision
75 75 import import an ordered set of patches
76 76 incoming show new changesets found in source
77 77 init create a new repository in the given directory
78 78 locate locate files matching specific patterns
79 79 log show revision history of entire repository or files
80 80 manifest output the current or given revision of the project manifest
81 81 merge merge working directory with another revision
82 82 outgoing show changesets not found in the destination
83 83 parents show the parents of the working directory or revision
84 84 paths show aliases for remote repositories
85 85 phase set or show the current phase name
86 86 pull pull changes from the specified source
87 87 push push changes to the specified destination
88 88 recover roll back an interrupted transaction
89 89 remove remove the specified files on the next commit
90 90 rename rename files; equivalent of copy + remove
91 91 resolve redo merges or set/view the merge status of files
92 92 revert restore files to their checkout state
93 93 root print the root (top) of the current working directory
94 94 serve start stand-alone webserver
95 95 status show changed files in the working directory
96 96 summary summarize working directory state
97 97 tag add one or more tags for the current or given revision
98 98 tags list repository tags
99 99 unbundle apply one or more changegroup files
100 100 update update working directory (or switch revisions)
101 101 verify verify the integrity of the repository
102 102 version output version and copyright information
103 103
104 104 additional help topics:
105 105
106 106 config Configuration Files
107 107 dates Date Formats
108 108 diffs Diff Formats
109 109 environment Environment Variables
110 110 extensions Using Additional Features
111 111 filesets Specifying File Sets
112 112 glossary Glossary
113 113 hgignore Syntax for Mercurial Ignore Files
114 114 hgweb Configuring hgweb
115 115 merge-tools Merge Tools
116 116 multirevs Specifying Multiple Revisions
117 117 patterns File Name Patterns
118 118 phases Working with Phases
119 119 revisions Specifying Single Revisions
120 120 revsets Specifying Revision Sets
121 121 subrepos Subrepositories
122 122 templating Template Usage
123 123 urls URL Paths
124 124
125 125 use "hg -v help" to show builtin aliases and global options
126 126
127 127 $ hg -q help
128 128 add add the specified files on the next commit
129 129 addremove add all new files, delete all missing files
130 130 annotate show changeset information by line for each file
131 131 archive create an unversioned archive of a repository revision
132 132 backout reverse effect of earlier changeset
133 133 bisect subdivision search of changesets
134 134 bookmarks create a new bookmark or list existing bookmarks
135 135 branch set or show the current branch name
136 136 branches list repository named branches
137 137 bundle create a changegroup file
138 138 cat output the current or given revision of files
139 139 clone make a copy of an existing repository
140 140 commit commit the specified files or all outstanding changes
141 141 config show combined config settings from all hgrc files
142 142 copy mark files as copied for the next commit
143 143 diff diff repository (or selected files)
144 144 export dump the header and diffs for one or more changesets
145 145 forget forget the specified files on the next commit
146 146 graft copy changes from other branches onto the current branch
147 147 grep search for a pattern in specified files and revisions
148 148 heads show branch heads
149 149 help show help for a given topic or a help overview
150 150 identify identify the working copy or specified revision
151 151 import import an ordered set of patches
152 152 incoming show new changesets found in source
153 153 init create a new repository in the given directory
154 154 locate locate files matching specific patterns
155 155 log show revision history of entire repository or files
156 156 manifest output the current or given revision of the project manifest
157 157 merge merge working directory with another revision
158 158 outgoing show changesets not found in the destination
159 159 parents show the parents of the working directory or revision
160 160 paths show aliases for remote repositories
161 161 phase set or show the current phase name
162 162 pull pull changes from the specified source
163 163 push push changes to the specified destination
164 164 recover roll back an interrupted transaction
165 165 remove remove the specified files on the next commit
166 166 rename rename files; equivalent of copy + remove
167 167 resolve redo merges or set/view the merge status of files
168 168 revert restore files to their checkout state
169 169 root print the root (top) of the current working directory
170 170 serve start stand-alone webserver
171 171 status show changed files in the working directory
172 172 summary summarize working directory state
173 173 tag add one or more tags for the current or given revision
174 174 tags list repository tags
175 175 unbundle apply one or more changegroup files
176 176 update update working directory (or switch revisions)
177 177 verify verify the integrity of the repository
178 178 version output version and copyright information
179 179
180 180 additional help topics:
181 181
182 182 config Configuration Files
183 183 dates Date Formats
184 184 diffs Diff Formats
185 185 environment Environment Variables
186 186 extensions Using Additional Features
187 187 filesets Specifying File Sets
188 188 glossary Glossary
189 189 hgignore Syntax for Mercurial Ignore Files
190 190 hgweb Configuring hgweb
191 191 merge-tools Merge Tools
192 192 multirevs Specifying Multiple Revisions
193 193 patterns File Name Patterns
194 194 phases Working with Phases
195 195 revisions Specifying Single Revisions
196 196 revsets Specifying Revision Sets
197 197 subrepos Subrepositories
198 198 templating Template Usage
199 199 urls URL Paths
200 200
201 201 Test extension help:
202 202 $ hg help extensions --config extensions.rebase= --config extensions.children=
203 203 Using Additional Features
204 204 """""""""""""""""""""""""
205 205
206 206 Mercurial has the ability to add new features through the use of
207 207 extensions. Extensions may add new commands, add options to existing
208 208 commands, change the default behavior of commands, or implement hooks.
209 209
210 210 To enable the "foo" extension, either shipped with Mercurial or in the
211 211 Python search path, create an entry for it in your configuration file,
212 212 like this:
213 213
214 214 [extensions]
215 215 foo =
216 216
217 217 You may also specify the full path to an extension:
218 218
219 219 [extensions]
220 220 myfeature = ~/.hgext/myfeature.py
221 221
222 222 See "hg help config" for more information on configuration files.
223 223
224 224 Extensions are not loaded by default for a variety of reasons: they can
225 225 increase startup overhead; they may be meant for advanced usage only; they
226 226 may provide potentially dangerous abilities (such as letting you destroy
227 227 or modify history); they might not be ready for prime time; or they may
228 228 alter some usual behaviors of stock Mercurial. It is thus up to the user
229 229 to activate extensions as needed.
230 230
231 231 To explicitly disable an extension enabled in a configuration file of
232 232 broader scope, prepend its path with !:
233 233
234 234 [extensions]
235 235 # disabling extension bar residing in /path/to/extension/bar.py
236 236 bar = !/path/to/extension/bar.py
237 237 # ditto, but no path was supplied for extension baz
238 238 baz = !
239 239
240 240 enabled extensions:
241 241
242 242 children command to display child changesets (DEPRECATED)
243 243 rebase command to move sets of revisions to a different ancestor
244 244
245 245 disabled extensions:
246 246
247 247 acl hooks for controlling repository access
248 248 blackbox log repository events to a blackbox for debugging
249 249 bugzilla hooks for integrating with the Bugzilla bug tracker
250 250 churn command to display statistics about repository history
251 251 color colorize output from some commands
252 252 convert import revisions from foreign VCS repositories into
253 253 Mercurial
254 254 eol automatically manage newlines in repository files
255 255 extdiff command to allow external programs to compare revisions
256 256 factotum http authentication with factotum
257 257 gpg commands to sign and verify changesets
258 258 hgcia hooks for integrating with the CIA.vc notification service
259 259 hgk browse the repository in a graphical way
260 260 highlight syntax highlighting for hgweb (requires Pygments)
261 261 histedit interactive history editing
262 262 keyword expand keywords in tracked files
263 263 largefiles track large binary files
264 264 mq manage a stack of patches
265 265 notify hooks for sending email push notifications
266 266 pager browse command output with an external pager
267 267 patchbomb command to send changesets as (a series of) patch emails
268 268 progress show progress bars for some actions
269 269 purge command to delete untracked files from the working
270 270 directory
271 271 record commands to interactively select changes for
272 272 commit/qrefresh
273 273 relink recreates hardlinks between repository clones
274 274 schemes extend schemes with shortcuts to repository swarms
275 275 share share a common history between several working directories
276 276 shelve save and restore changes to the working directory
277 277 strip strip changesets and their descendents from history
278 278 transplant command to transplant changesets from another branch
279 279 win32mbcs allow the use of MBCS paths with problematic encodings
280 280 zeroconf discover and advertise repositories on the local network
281 281 Test short command list with verbose option
282 282
283 283 $ hg -v help shortlist
284 284 Mercurial Distributed SCM
285 285
286 286 basic commands:
287 287
288 288 add add the specified files on the next commit
289 289 annotate, blame
290 290 show changeset information by line for each file
291 291 clone make a copy of an existing repository
292 292 commit, ci commit the specified files or all outstanding changes
293 293 diff diff repository (or selected files)
294 294 export dump the header and diffs for one or more changesets
295 295 forget forget the specified files on the next commit
296 296 init create a new repository in the given directory
297 297 log, history show revision history of entire repository or files
298 298 merge merge working directory with another revision
299 299 pull pull changes from the specified source
300 300 push push changes to the specified destination
301 301 remove, rm remove the specified files on the next commit
302 302 serve start stand-alone webserver
303 303 status, st show changed files in the working directory
304 304 summary, sum summarize working directory state
305 305 update, up, checkout, co
306 306 update working directory (or switch revisions)
307 307
308 global options:
308 global options ([+] can be repeated):
309 309
310 310 -R --repository REPO repository root directory or name of overlay bundle
311 311 file
312 312 --cwd DIR change working directory
313 313 -y --noninteractive do not prompt, automatically pick the first choice for
314 314 all prompts
315 315 -q --quiet suppress output
316 316 -v --verbose enable additional output
317 317 --config CONFIG [+] set/override config option (use 'section.name=value')
318 318 --debug enable debugging output
319 319 --debugger start debugger
320 320 --encoding ENCODE set the charset encoding (default: ascii)
321 321 --encodingmode MODE set the charset encoding mode (default: strict)
322 322 --traceback always print a traceback on exception
323 323 --time time how long the command takes
324 324 --profile print command execution profile
325 325 --version output version information and exit
326 326 -h --help display help and exit
327 327 --hidden consider hidden changesets
328 328
329 [+] marked option can be specified multiple times
330
331 329 use "hg help" for the full list of commands
332 330
333 331 $ hg add -h
334 332 hg add [OPTION]... [FILE]...
335 333
336 334 add the specified files on the next commit
337 335
338 336 Schedule files to be version controlled and added to the repository.
339 337
340 338 The files will be added to the repository at the next commit. To undo an
341 339 add before that, see "hg forget".
342 340
343 341 If no names are given, add all files to the repository.
344 342
345 343 Returns 0 if all files are successfully added.
346 344
347 options:
345 options ([+] can be repeated):
348 346
349 347 -I --include PATTERN [+] include names matching the given patterns
350 348 -X --exclude PATTERN [+] exclude names matching the given patterns
351 349 -S --subrepos recurse into subrepositories
352 350 -n --dry-run do not perform actions, just print output
353 351
354 [+] marked option can be specified multiple times
355
356 352 (some details hidden, use --verbose to show complete help)
357 353
358 354 Verbose help for add
359 355
360 356 $ hg add -hv
361 357 hg add [OPTION]... [FILE]...
362 358
363 359 add the specified files on the next commit
364 360
365 361 Schedule files to be version controlled and added to the repository.
366 362
367 363 The files will be added to the repository at the next commit. To undo an
368 364 add before that, see "hg forget".
369 365
370 366 If no names are given, add all files to the repository.
371 367
372 368 An example showing how new (unknown) files are added automatically by "hg
373 369 add":
374 370
375 371 $ ls
376 372 foo.c
377 373 $ hg status
378 374 ? foo.c
379 375 $ hg add
380 376 adding foo.c
381 377 $ hg status
382 378 A foo.c
383 379
384 380 Returns 0 if all files are successfully added.
385 381
386 options:
382 options ([+] can be repeated):
387 383
388 384 -I --include PATTERN [+] include names matching the given patterns
389 385 -X --exclude PATTERN [+] exclude names matching the given patterns
390 386 -S --subrepos recurse into subrepositories
391 387 -n --dry-run do not perform actions, just print output
392 388
393 [+] marked option can be specified multiple times
394
395 global options:
389 global options ([+] can be repeated):
396 390
397 391 -R --repository REPO repository root directory or name of overlay bundle
398 392 file
399 393 --cwd DIR change working directory
400 394 -y --noninteractive do not prompt, automatically pick the first choice for
401 395 all prompts
402 396 -q --quiet suppress output
403 397 -v --verbose enable additional output
404 398 --config CONFIG [+] set/override config option (use 'section.name=value')
405 399 --debug enable debugging output
406 400 --debugger start debugger
407 401 --encoding ENCODE set the charset encoding (default: ascii)
408 402 --encodingmode MODE set the charset encoding mode (default: strict)
409 403 --traceback always print a traceback on exception
410 404 --time time how long the command takes
411 405 --profile print command execution profile
412 406 --version output version information and exit
413 407 -h --help display help and exit
414 408 --hidden consider hidden changesets
415
416 [+] marked option can be specified multiple times
417 409
418 410 Test help option with version option
419 411
420 412 $ hg add -h --version
421 413 Mercurial Distributed SCM (version *) (glob)
422 414 (see http://mercurial.selenic.com for more information)
423 415
424 416 Copyright (C) 2005-2014 Matt Mackall and others
425 417 This is free software; see the source for copying conditions. There is NO
426 418 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
427 419
428 420 $ hg add --skjdfks
429 421 hg add: option --skjdfks not recognized
430 422 hg add [OPTION]... [FILE]...
431 423
432 424 add the specified files on the next commit
433 425
434 options:
426 options ([+] can be repeated):
435 427
436 428 -I --include PATTERN [+] include names matching the given patterns
437 429 -X --exclude PATTERN [+] exclude names matching the given patterns
438 430 -S --subrepos recurse into subrepositories
439 431 -n --dry-run do not perform actions, just print output
440 432
441 [+] marked option can be specified multiple times
442
443 433 (use "hg add -h" to show more help)
444 434 [255]
445 435
446 436 Test ambiguous command help
447 437
448 438 $ hg help ad
449 439 list of commands:
450 440
451 441 add add the specified files on the next commit
452 442 addremove add all new files, delete all missing files
453 443
454 444 use "hg -v help ad" to show builtin aliases and global options
455 445
456 446 Test command without options
457 447
458 448 $ hg help verify
459 449 hg verify
460 450
461 451 verify the integrity of the repository
462 452
463 453 Verify the integrity of the current repository.
464 454
465 455 This will perform an extensive check of the repository's integrity,
466 456 validating the hashes and checksums of each entry in the changelog,
467 457 manifest, and tracked files, as well as the integrity of their crosslinks
468 458 and indices.
469 459
470 460 Please see http://mercurial.selenic.com/wiki/RepositoryCorruption for more
471 461 information about recovery from corruption of the repository.
472 462
473 463 Returns 0 on success, 1 if errors are encountered.
474 464
475 465 (some details hidden, use --verbose to show complete help)
476 466
477 467 $ hg help diff
478 468 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
479 469
480 470 diff repository (or selected files)
481 471
482 472 Show differences between revisions for the specified files.
483 473
484 474 Differences between files are shown using the unified diff format.
485 475
486 476 Note:
487 477 diff may generate unexpected results for merges, as it will default to
488 478 comparing against the working directory's first parent changeset if no
489 479 revisions are specified.
490 480
491 481 When two revision arguments are given, then changes are shown between
492 482 those revisions. If only one revision is specified then that revision is
493 483 compared to the working directory, and, when no revisions are specified,
494 484 the working directory files are compared to its parent.
495 485
496 486 Alternatively you can specify -c/--change with a revision to see the
497 487 changes in that changeset relative to its first parent.
498 488
499 489 Without the -a/--text option, diff will avoid generating diffs of files it
500 490 detects as binary. With -a, diff will generate a diff anyway, probably
501 491 with undesirable results.
502 492
503 493 Use the -g/--git option to generate diffs in the git extended diff format.
504 494 For more information, read "hg help diffs".
505 495
506 496 Returns 0 on success.
507 497
508 options:
498 options ([+] can be repeated):
509 499
510 500 -r --rev REV [+] revision
511 501 -c --change REV change made by revision
512 502 -a --text treat all files as text
513 503 -g --git use git extended diff format
514 504 --nodates omit dates from diff headers
515 505 -p --show-function show which function each change is in
516 506 --reverse produce a diff that undoes the changes
517 507 -w --ignore-all-space ignore white space when comparing lines
518 508 -b --ignore-space-change ignore changes in the amount of white space
519 509 -B --ignore-blank-lines ignore changes whose lines are all blank
520 510 -U --unified NUM number of lines of context to show
521 511 --stat output diffstat-style summary of changes
522 512 -I --include PATTERN [+] include names matching the given patterns
523 513 -X --exclude PATTERN [+] exclude names matching the given patterns
524 514 -S --subrepos recurse into subrepositories
525 515
526 [+] marked option can be specified multiple times
527
528 516 (some details hidden, use --verbose to show complete help)
529 517
530 518 $ hg help status
531 519 hg status [OPTION]... [FILE]...
532 520
533 521 aliases: st
534 522
535 523 show changed files in the working directory
536 524
537 525 Show status of files in the repository. If names are given, only files
538 526 that match are shown. Files that are clean or ignored or the source of a
539 527 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
540 528 -C/--copies or -A/--all are given. Unless options described with "show
541 529 only ..." are given, the options -mardu are used.
542 530
543 531 Option -q/--quiet hides untracked (unknown and ignored) files unless
544 532 explicitly requested with -u/--unknown or -i/--ignored.
545 533
546 534 Note:
547 535 status may appear to disagree with diff if permissions have changed or
548 536 a merge has occurred. The standard diff format does not report
549 537 permission changes and diff only reports changes relative to one merge
550 538 parent.
551 539
552 540 If one revision is given, it is used as the base revision. If two
553 541 revisions are given, the differences between them are shown. The --change
554 542 option can also be used as a shortcut to list the changed files of a
555 543 revision from its first parent.
556 544
557 545 The codes used to show the status of files are:
558 546
559 547 M = modified
560 548 A = added
561 549 R = removed
562 550 C = clean
563 551 ! = missing (deleted by non-hg command, but still tracked)
564 552 ? = not tracked
565 553 I = ignored
566 554 = origin of the previous file (with --copies)
567 555
568 556 Returns 0 on success.
569 557
570 options:
558 options ([+] can be repeated):
571 559
572 560 -A --all show status of all files
573 561 -m --modified show only modified files
574 562 -a --added show only added files
575 563 -r --removed show only removed files
576 564 -d --deleted show only deleted (but tracked) files
577 565 -c --clean show only files without changes
578 566 -u --unknown show only unknown (not tracked) files
579 567 -i --ignored show only ignored files
580 568 -n --no-status hide status prefix
581 569 -C --copies show source of copied files
582 570 -0 --print0 end filenames with NUL, for use with xargs
583 571 --rev REV [+] show difference from revision
584 572 --change REV list the changed files of a revision
585 573 -I --include PATTERN [+] include names matching the given patterns
586 574 -X --exclude PATTERN [+] exclude names matching the given patterns
587 575 -S --subrepos recurse into subrepositories
588 576
589 [+] marked option can be specified multiple times
590
591 577 (some details hidden, use --verbose to show complete help)
592 578
593 579 $ hg -q help status
594 580 hg status [OPTION]... [FILE]...
595 581
596 582 show changed files in the working directory
597 583
598 584 $ hg help foo
599 585 abort: no such help topic: foo
600 586 (try "hg help --keyword foo")
601 587 [255]
602 588
603 589 $ hg skjdfks
604 590 hg: unknown command 'skjdfks'
605 591 Mercurial Distributed SCM
606 592
607 593 basic commands:
608 594
609 595 add add the specified files on the next commit
610 596 annotate show changeset information by line for each file
611 597 clone make a copy of an existing repository
612 598 commit commit the specified files or all outstanding changes
613 599 diff diff repository (or selected files)
614 600 export dump the header and diffs for one or more changesets
615 601 forget forget the specified files on the next commit
616 602 init create a new repository in the given directory
617 603 log show revision history of entire repository or files
618 604 merge merge working directory with another revision
619 605 pull pull changes from the specified source
620 606 push push changes to the specified destination
621 607 remove remove the specified files on the next commit
622 608 serve start stand-alone webserver
623 609 status show changed files in the working directory
624 610 summary summarize working directory state
625 611 update update working directory (or switch revisions)
626 612
627 613 use "hg help" for the full list of commands or "hg -v" for details
628 614 [255]
629 615
630 616
631 617 $ cat > helpext.py <<EOF
632 618 > import os
633 619 > from mercurial import cmdutil, commands
634 620 >
635 621 > cmdtable = {}
636 622 > command = cmdutil.command(cmdtable)
637 623 >
638 624 > @command('nohelp',
639 625 > [('', 'longdesc', 3, 'x'*90),
640 626 > ('n', '', None, 'normal desc'),
641 627 > ('', 'newline', '', 'line1\nline2')],
642 628 > 'hg nohelp',
643 629 > norepo=True)
644 630 > @command('debugoptDEP', [('', 'dopt', None, 'option is DEPRECATED')])
645 631 > def nohelp(ui, *args, **kwargs):
646 632 > pass
647 633 >
648 634 > EOF
649 635 $ echo '[extensions]' >> $HGRCPATH
650 636 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
651 637
652 638 Test command with no help text
653 639
654 640 $ hg help nohelp
655 641 hg nohelp
656 642
657 643 (no help text available)
658 644
659 645 options:
660 646
661 647 --longdesc VALUE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
662 648 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (default: 3)
663 649 -n -- normal desc
664 650 --newline VALUE line1 line2
665 651
666 652 (some details hidden, use --verbose to show complete help)
667 653
668 654 $ hg help -k nohelp
669 655 Commands:
670 656
671 657 nohelp hg nohelp
672 658
673 659 Extension Commands:
674 660
675 661 nohelp (no help text available)
676 662
677 663 Test that default list of commands omits extension commands
678 664
679 665 $ hg help
680 666 Mercurial Distributed SCM
681 667
682 668 list of commands:
683 669
684 670 add add the specified files on the next commit
685 671 addremove add all new files, delete all missing files
686 672 annotate show changeset information by line for each file
687 673 archive create an unversioned archive of a repository revision
688 674 backout reverse effect of earlier changeset
689 675 bisect subdivision search of changesets
690 676 bookmarks create a new bookmark or list existing bookmarks
691 677 branch set or show the current branch name
692 678 branches list repository named branches
693 679 bundle create a changegroup file
694 680 cat output the current or given revision of files
695 681 clone make a copy of an existing repository
696 682 commit commit the specified files or all outstanding changes
697 683 config show combined config settings from all hgrc files
698 684 copy mark files as copied for the next commit
699 685 diff diff repository (or selected files)
700 686 export dump the header and diffs for one or more changesets
701 687 forget forget the specified files on the next commit
702 688 graft copy changes from other branches onto the current branch
703 689 grep search for a pattern in specified files and revisions
704 690 heads show branch heads
705 691 help show help for a given topic or a help overview
706 692 identify identify the working copy or specified revision
707 693 import import an ordered set of patches
708 694 incoming show new changesets found in source
709 695 init create a new repository in the given directory
710 696 locate locate files matching specific patterns
711 697 log show revision history of entire repository or files
712 698 manifest output the current or given revision of the project manifest
713 699 merge merge working directory with another revision
714 700 outgoing show changesets not found in the destination
715 701 parents show the parents of the working directory or revision
716 702 paths show aliases for remote repositories
717 703 phase set or show the current phase name
718 704 pull pull changes from the specified source
719 705 push push changes to the specified destination
720 706 recover roll back an interrupted transaction
721 707 remove remove the specified files on the next commit
722 708 rename rename files; equivalent of copy + remove
723 709 resolve redo merges or set/view the merge status of files
724 710 revert restore files to their checkout state
725 711 root print the root (top) of the current working directory
726 712 serve start stand-alone webserver
727 713 status show changed files in the working directory
728 714 summary summarize working directory state
729 715 tag add one or more tags for the current or given revision
730 716 tags list repository tags
731 717 unbundle apply one or more changegroup files
732 718 update update working directory (or switch revisions)
733 719 verify verify the integrity of the repository
734 720 version output version and copyright information
735 721
736 722 enabled extensions:
737 723
738 724 helpext (no help text available)
739 725
740 726 additional help topics:
741 727
742 728 config Configuration Files
743 729 dates Date Formats
744 730 diffs Diff Formats
745 731 environment Environment Variables
746 732 extensions Using Additional Features
747 733 filesets Specifying File Sets
748 734 glossary Glossary
749 735 hgignore Syntax for Mercurial Ignore Files
750 736 hgweb Configuring hgweb
751 737 merge-tools Merge Tools
752 738 multirevs Specifying Multiple Revisions
753 739 patterns File Name Patterns
754 740 phases Working with Phases
755 741 revisions Specifying Single Revisions
756 742 revsets Specifying Revision Sets
757 743 subrepos Subrepositories
758 744 templating Template Usage
759 745 urls URL Paths
760 746
761 747 use "hg -v help" to show builtin aliases and global options
762 748
763 749
764 750 Test list of internal help commands
765 751
766 752 $ hg help debug
767 753 debug commands (internal and unsupported):
768 754
769 755 debugancestor
770 756 find the ancestor revision of two revisions in a given index
771 757 debugbuilddag
772 758 builds a repo with a given DAG from scratch in the current
773 759 empty repo
774 760 debugbundle lists the contents of a bundle
775 761 debugcheckstate
776 762 validate the correctness of the current dirstate
777 763 debugcommands
778 764 list all available commands and options
779 765 debugcomplete
780 766 returns the completion list associated with the given command
781 767 debugdag format the changelog or an index DAG as a concise textual
782 768 description
783 769 debugdata dump the contents of a data file revision
784 770 debugdate parse and display a date
785 771 debugdirstate
786 772 show the contents of the current dirstate
787 773 debugdiscovery
788 774 runs the changeset discovery protocol in isolation
789 775 debugfileset parse and apply a fileset specification
790 776 debugfsinfo show information detected about current filesystem
791 777 debuggetbundle
792 778 retrieves a bundle from a repo
793 779 debugignore display the combined ignore pattern
794 780 debugindex dump the contents of an index file
795 781 debugindexdot
796 782 dump an index DAG as a graphviz dot file
797 783 debuginstall test Mercurial installation
798 784 debugknown test whether node ids are known to a repo
799 785 debuglabelcomplete
800 786 complete "labels" - tags, open branch names, bookmark names
801 787 debugobsolete
802 788 create arbitrary obsolete marker
803 789 debugoptDEP (no help text available)
804 790 debugpathcomplete
805 791 complete part or all of a tracked path
806 792 debugpushkey access the pushkey key/value protocol
807 793 debugpvec (no help text available)
808 794 debugrebuilddirstate
809 795 rebuild the dirstate as it would look like for the given
810 796 revision
811 797 debugrename dump rename information
812 798 debugrevlog show data and statistics about a revlog
813 799 debugrevspec parse and apply a revision specification
814 800 debugsetparents
815 801 manually set the parents of the current working directory
816 802 debugsub (no help text available)
817 803 debugsuccessorssets
818 804 show set of successors for revision
819 805 debugwalk show how files match on given patterns
820 806 debugwireargs
821 807 (no help text available)
822 808
823 809 use "hg -v help debug" to show builtin aliases and global options
824 810
825 811
826 812 Test list of commands with command with no help text
827 813
828 814 $ hg help helpext
829 815 helpext extension - no help text available
830 816
831 817 list of commands:
832 818
833 819 nohelp (no help text available)
834 820
835 821 use "hg -v help helpext" to show builtin aliases and global options
836 822
837 823
838 824 test deprecated option is hidden in command help
839 825 $ hg help debugoptDEP
840 826 hg debugoptDEP
841 827
842 828 (no help text available)
843 829
844 830 options:
845 831
846 832 (some details hidden, use --verbose to show complete help)
847 833
848 834 test deprecated option is shown with -v
849 835 $ hg help -v debugoptDEP | grep dopt
850 836 --dopt option is DEPRECATED
851 837
852 838 #if gettext
853 839 test deprecated option is hidden with translation with untranslated description
854 840 (use many globy for not failing on changed transaction)
855 841 $ LANGUAGE=sv hg help debugoptDEP
856 842 hg debugoptDEP
857 843
858 844 (*) (glob)
859 845
860 846 options:
861 847
862 848 (some details hidden, use --verbose to show complete help)
863 849 #endif
864 850
865 851 Test commands that collide with topics (issue4240)
866 852
867 853 $ hg config -hq
868 854 hg config [-u] [NAME]...
869 855
870 856 show combined config settings from all hgrc files
871 857 $ hg showconfig -hq
872 858 hg config [-u] [NAME]...
873 859
874 860 show combined config settings from all hgrc files
875 861
876 862 Test a help topic
877 863
878 864 $ hg help revs
879 865 Specifying Single Revisions
880 866 """""""""""""""""""""""""""
881 867
882 868 Mercurial supports several ways to specify individual revisions.
883 869
884 870 A plain integer is treated as a revision number. Negative integers are
885 871 treated as sequential offsets from the tip, with -1 denoting the tip, -2
886 872 denoting the revision prior to the tip, and so forth.
887 873
888 874 A 40-digit hexadecimal string is treated as a unique revision identifier.
889 875
890 876 A hexadecimal string less than 40 characters long is treated as a unique
891 877 revision identifier and is referred to as a short-form identifier. A
892 878 short-form identifier is only valid if it is the prefix of exactly one
893 879 full-length identifier.
894 880
895 881 Any other string is treated as a bookmark, tag, or branch name. A bookmark
896 882 is a movable pointer to a revision. A tag is a permanent name associated
897 883 with a revision. A branch name denotes the tipmost open branch head of
898 884 that branch - or if they are all closed, the tipmost closed head of the
899 885 branch. Bookmark, tag, and branch names must not contain the ":"
900 886 character.
901 887
902 888 The reserved name "tip" always identifies the most recent revision.
903 889
904 890 The reserved name "null" indicates the null revision. This is the revision
905 891 of an empty repository, and the parent of revision 0.
906 892
907 893 The reserved name "." indicates the working directory parent. If no
908 894 working directory is checked out, it is equivalent to null. If an
909 895 uncommitted merge is in progress, "." is the revision of the first parent.
910 896
911 897 Test templating help
912 898
913 899 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
914 900 desc String. The text of the changeset description.
915 901 diffstat String. Statistics of changes with the following format:
916 902 firstline Any text. Returns the first line of text.
917 903 nonempty Any text. Returns '(none)' if the string is empty.
918 904
919 905 Test help hooks
920 906
921 907 $ cat > helphook1.py <<EOF
922 908 > from mercurial import help
923 909 >
924 910 > def rewrite(topic, doc):
925 911 > return doc + '\nhelphook1\n'
926 912 >
927 913 > def extsetup(ui):
928 914 > help.addtopichook('revsets', rewrite)
929 915 > EOF
930 916 $ cat > helphook2.py <<EOF
931 917 > from mercurial import help
932 918 >
933 919 > def rewrite(topic, doc):
934 920 > return doc + '\nhelphook2\n'
935 921 >
936 922 > def extsetup(ui):
937 923 > help.addtopichook('revsets', rewrite)
938 924 > EOF
939 925 $ echo '[extensions]' >> $HGRCPATH
940 926 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
941 927 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
942 928 $ hg help revsets | grep helphook
943 929 helphook1
944 930 helphook2
945 931
946 932 Test keyword search help
947 933
948 934 $ cat > prefixedname.py <<EOF
949 935 > '''matched against word "clone"
950 936 > '''
951 937 > EOF
952 938 $ echo '[extensions]' >> $HGRCPATH
953 939 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
954 940 $ hg help -k clone
955 941 Topics:
956 942
957 943 config Configuration Files
958 944 extensions Using Additional Features
959 945 glossary Glossary
960 946 phases Working with Phases
961 947 subrepos Subrepositories
962 948 urls URL Paths
963 949
964 950 Commands:
965 951
966 952 bookmarks create a new bookmark or list existing bookmarks
967 953 clone make a copy of an existing repository
968 954 paths show aliases for remote repositories
969 955 update update working directory (or switch revisions)
970 956
971 957 Extensions:
972 958
973 959 prefixedname matched against word "clone"
974 960 relink recreates hardlinks between repository clones
975 961
976 962 Extension Commands:
977 963
978 964 qclone clone main and patch repository at same time
979 965
980 966 Test unfound topic
981 967
982 968 $ hg help nonexistingtopicthatwillneverexisteverever
983 969 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
984 970 (try "hg help --keyword nonexistingtopicthatwillneverexisteverever")
985 971 [255]
986 972
987 973 Test unfound keyword
988 974
989 975 $ hg help --keyword nonexistingwordthatwillneverexisteverever
990 976 abort: no matches
991 977 (try "hg help" for a list of topics)
992 978 [255]
993 979
994 980 Test omit indicating for help
995 981
996 982 $ cat > addverboseitems.py <<EOF
997 983 > '''extension to test omit indicating.
998 984 >
999 985 > This paragraph is never omitted (for extension)
1000 986 >
1001 987 > .. container:: verbose
1002 988 >
1003 989 > This paragraph is omitted,
1004 990 > if :hg:\`help\` is invoked witout \`\`-v\`\` (for extension)
1005 991 >
1006 992 > This paragraph is never omitted, too (for extension)
1007 993 > '''
1008 994 >
1009 995 > from mercurial import help, commands
1010 996 > testtopic = """This paragraph is never omitted (for topic).
1011 997 >
1012 998 > .. container:: verbose
1013 999 >
1014 1000 > This paragraph is omitted,
1015 1001 > if :hg:\`help\` is invoked witout \`\`-v\`\` (for topic)
1016 1002 >
1017 1003 > This paragraph is never omitted, too (for topic)
1018 1004 > """
1019 1005 > def extsetup(ui):
1020 1006 > help.helptable.append((["topic-containing-verbose"],
1021 1007 > "This is the topic to test omit indicating.",
1022 1008 > lambda : testtopic))
1023 1009 > EOF
1024 1010 $ echo '[extensions]' >> $HGRCPATH
1025 1011 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1026 1012 $ hg help addverboseitems
1027 1013 addverboseitems extension - extension to test omit indicating.
1028 1014
1029 1015 This paragraph is never omitted (for extension)
1030 1016
1031 1017 This paragraph is never omitted, too (for extension)
1032 1018
1033 1019 (some details hidden, use --verbose to show complete help)
1034 1020
1035 1021 no commands defined
1036 1022 $ hg help -v addverboseitems
1037 1023 addverboseitems extension - extension to test omit indicating.
1038 1024
1039 1025 This paragraph is never omitted (for extension)
1040 1026
1041 1027 This paragraph is omitted, if "hg help" is invoked witout "-v" (for extension)
1042 1028
1043 1029 This paragraph is never omitted, too (for extension)
1044 1030
1045 1031 no commands defined
1046 1032 $ hg help topic-containing-verbose
1047 1033 This is the topic to test omit indicating.
1048 1034 """"""""""""""""""""""""""""""""""""""""""
1049 1035
1050 1036 This paragraph is never omitted (for topic).
1051 1037
1052 1038 This paragraph is never omitted, too (for topic)
1053 1039
1054 1040 (some details hidden, use --verbose to show complete help)
1055 1041 $ hg help -v topic-containing-verbose
1056 1042 This is the topic to test omit indicating.
1057 1043 """"""""""""""""""""""""""""""""""""""""""
1058 1044
1059 1045 This paragraph is never omitted (for topic).
1060 1046
1061 1047 This paragraph is omitted, if "hg help" is invoked witout "-v" (for topic)
1062 1048
1063 1049 This paragraph is never omitted, too (for topic)
1064 1050
1065 1051 Test usage of section marks in help documents
1066 1052
1067 1053 $ cd "$TESTDIR"/../doc
1068 1054 $ python check-seclevel.py
1069 1055 $ cd $TESTTMP
1070 1056
1071 1057 #if serve
1072 1058
1073 1059 Test the help pages in hgweb.
1074 1060
1075 1061 Dish up an empty repo; serve it cold.
1076 1062
1077 1063 $ hg init "$TESTTMP/test"
1078 1064 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
1079 1065 $ cat hg.pid >> $DAEMON_PIDS
1080 1066
1081 1067 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help"
1082 1068 200 Script output follows
1083 1069
1084 1070 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1085 1071 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1086 1072 <head>
1087 1073 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1088 1074 <meta name="robots" content="index, nofollow" />
1089 1075 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1090 1076 <script type="text/javascript" src="/static/mercurial.js"></script>
1091 1077
1092 1078 <title>Help: Index</title>
1093 1079 </head>
1094 1080 <body>
1095 1081
1096 1082 <div class="container">
1097 1083 <div class="menu">
1098 1084 <div class="logo">
1099 1085 <a href="http://mercurial.selenic.com/">
1100 1086 <img src="/static/hglogo.png" alt="mercurial" /></a>
1101 1087 </div>
1102 1088 <ul>
1103 1089 <li><a href="/shortlog">log</a></li>
1104 1090 <li><a href="/graph">graph</a></li>
1105 1091 <li><a href="/tags">tags</a></li>
1106 1092 <li><a href="/bookmarks">bookmarks</a></li>
1107 1093 <li><a href="/branches">branches</a></li>
1108 1094 </ul>
1109 1095 <ul>
1110 1096 <li class="active">help</li>
1111 1097 </ul>
1112 1098 </div>
1113 1099
1114 1100 <div class="main">
1115 1101 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1116 1102 <form class="search" action="/log">
1117 1103
1118 1104 <p><input name="rev" id="search1" type="text" size="30" /></p>
1119 1105 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1120 1106 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1121 1107 </form>
1122 1108 <table class="bigtable">
1123 1109 <tr><td colspan="2"><h2><a name="main" href="#topics">Topics</a></h2></td></tr>
1124 1110
1125 1111 <tr><td>
1126 1112 <a href="/help/config">
1127 1113 config
1128 1114 </a>
1129 1115 </td><td>
1130 1116 Configuration Files
1131 1117 </td></tr>
1132 1118 <tr><td>
1133 1119 <a href="/help/dates">
1134 1120 dates
1135 1121 </a>
1136 1122 </td><td>
1137 1123 Date Formats
1138 1124 </td></tr>
1139 1125 <tr><td>
1140 1126 <a href="/help/diffs">
1141 1127 diffs
1142 1128 </a>
1143 1129 </td><td>
1144 1130 Diff Formats
1145 1131 </td></tr>
1146 1132 <tr><td>
1147 1133 <a href="/help/environment">
1148 1134 environment
1149 1135 </a>
1150 1136 </td><td>
1151 1137 Environment Variables
1152 1138 </td></tr>
1153 1139 <tr><td>
1154 1140 <a href="/help/extensions">
1155 1141 extensions
1156 1142 </a>
1157 1143 </td><td>
1158 1144 Using Additional Features
1159 1145 </td></tr>
1160 1146 <tr><td>
1161 1147 <a href="/help/filesets">
1162 1148 filesets
1163 1149 </a>
1164 1150 </td><td>
1165 1151 Specifying File Sets
1166 1152 </td></tr>
1167 1153 <tr><td>
1168 1154 <a href="/help/glossary">
1169 1155 glossary
1170 1156 </a>
1171 1157 </td><td>
1172 1158 Glossary
1173 1159 </td></tr>
1174 1160 <tr><td>
1175 1161 <a href="/help/hgignore">
1176 1162 hgignore
1177 1163 </a>
1178 1164 </td><td>
1179 1165 Syntax for Mercurial Ignore Files
1180 1166 </td></tr>
1181 1167 <tr><td>
1182 1168 <a href="/help/hgweb">
1183 1169 hgweb
1184 1170 </a>
1185 1171 </td><td>
1186 1172 Configuring hgweb
1187 1173 </td></tr>
1188 1174 <tr><td>
1189 1175 <a href="/help/merge-tools">
1190 1176 merge-tools
1191 1177 </a>
1192 1178 </td><td>
1193 1179 Merge Tools
1194 1180 </td></tr>
1195 1181 <tr><td>
1196 1182 <a href="/help/multirevs">
1197 1183 multirevs
1198 1184 </a>
1199 1185 </td><td>
1200 1186 Specifying Multiple Revisions
1201 1187 </td></tr>
1202 1188 <tr><td>
1203 1189 <a href="/help/patterns">
1204 1190 patterns
1205 1191 </a>
1206 1192 </td><td>
1207 1193 File Name Patterns
1208 1194 </td></tr>
1209 1195 <tr><td>
1210 1196 <a href="/help/phases">
1211 1197 phases
1212 1198 </a>
1213 1199 </td><td>
1214 1200 Working with Phases
1215 1201 </td></tr>
1216 1202 <tr><td>
1217 1203 <a href="/help/revisions">
1218 1204 revisions
1219 1205 </a>
1220 1206 </td><td>
1221 1207 Specifying Single Revisions
1222 1208 </td></tr>
1223 1209 <tr><td>
1224 1210 <a href="/help/revsets">
1225 1211 revsets
1226 1212 </a>
1227 1213 </td><td>
1228 1214 Specifying Revision Sets
1229 1215 </td></tr>
1230 1216 <tr><td>
1231 1217 <a href="/help/subrepos">
1232 1218 subrepos
1233 1219 </a>
1234 1220 </td><td>
1235 1221 Subrepositories
1236 1222 </td></tr>
1237 1223 <tr><td>
1238 1224 <a href="/help/templating">
1239 1225 templating
1240 1226 </a>
1241 1227 </td><td>
1242 1228 Template Usage
1243 1229 </td></tr>
1244 1230 <tr><td>
1245 1231 <a href="/help/urls">
1246 1232 urls
1247 1233 </a>
1248 1234 </td><td>
1249 1235 URL Paths
1250 1236 </td></tr>
1251 1237 <tr><td>
1252 1238 <a href="/help/topic-containing-verbose">
1253 1239 topic-containing-verbose
1254 1240 </a>
1255 1241 </td><td>
1256 1242 This is the topic to test omit indicating.
1257 1243 </td></tr>
1258 1244
1259 1245 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
1260 1246
1261 1247 <tr><td>
1262 1248 <a href="/help/add">
1263 1249 add
1264 1250 </a>
1265 1251 </td><td>
1266 1252 add the specified files on the next commit
1267 1253 </td></tr>
1268 1254 <tr><td>
1269 1255 <a href="/help/annotate">
1270 1256 annotate
1271 1257 </a>
1272 1258 </td><td>
1273 1259 show changeset information by line for each file
1274 1260 </td></tr>
1275 1261 <tr><td>
1276 1262 <a href="/help/clone">
1277 1263 clone
1278 1264 </a>
1279 1265 </td><td>
1280 1266 make a copy of an existing repository
1281 1267 </td></tr>
1282 1268 <tr><td>
1283 1269 <a href="/help/commit">
1284 1270 commit
1285 1271 </a>
1286 1272 </td><td>
1287 1273 commit the specified files or all outstanding changes
1288 1274 </td></tr>
1289 1275 <tr><td>
1290 1276 <a href="/help/diff">
1291 1277 diff
1292 1278 </a>
1293 1279 </td><td>
1294 1280 diff repository (or selected files)
1295 1281 </td></tr>
1296 1282 <tr><td>
1297 1283 <a href="/help/export">
1298 1284 export
1299 1285 </a>
1300 1286 </td><td>
1301 1287 dump the header and diffs for one or more changesets
1302 1288 </td></tr>
1303 1289 <tr><td>
1304 1290 <a href="/help/forget">
1305 1291 forget
1306 1292 </a>
1307 1293 </td><td>
1308 1294 forget the specified files on the next commit
1309 1295 </td></tr>
1310 1296 <tr><td>
1311 1297 <a href="/help/init">
1312 1298 init
1313 1299 </a>
1314 1300 </td><td>
1315 1301 create a new repository in the given directory
1316 1302 </td></tr>
1317 1303 <tr><td>
1318 1304 <a href="/help/log">
1319 1305 log
1320 1306 </a>
1321 1307 </td><td>
1322 1308 show revision history of entire repository or files
1323 1309 </td></tr>
1324 1310 <tr><td>
1325 1311 <a href="/help/merge">
1326 1312 merge
1327 1313 </a>
1328 1314 </td><td>
1329 1315 merge working directory with another revision
1330 1316 </td></tr>
1331 1317 <tr><td>
1332 1318 <a href="/help/pull">
1333 1319 pull
1334 1320 </a>
1335 1321 </td><td>
1336 1322 pull changes from the specified source
1337 1323 </td></tr>
1338 1324 <tr><td>
1339 1325 <a href="/help/push">
1340 1326 push
1341 1327 </a>
1342 1328 </td><td>
1343 1329 push changes to the specified destination
1344 1330 </td></tr>
1345 1331 <tr><td>
1346 1332 <a href="/help/remove">
1347 1333 remove
1348 1334 </a>
1349 1335 </td><td>
1350 1336 remove the specified files on the next commit
1351 1337 </td></tr>
1352 1338 <tr><td>
1353 1339 <a href="/help/serve">
1354 1340 serve
1355 1341 </a>
1356 1342 </td><td>
1357 1343 start stand-alone webserver
1358 1344 </td></tr>
1359 1345 <tr><td>
1360 1346 <a href="/help/status">
1361 1347 status
1362 1348 </a>
1363 1349 </td><td>
1364 1350 show changed files in the working directory
1365 1351 </td></tr>
1366 1352 <tr><td>
1367 1353 <a href="/help/summary">
1368 1354 summary
1369 1355 </a>
1370 1356 </td><td>
1371 1357 summarize working directory state
1372 1358 </td></tr>
1373 1359 <tr><td>
1374 1360 <a href="/help/update">
1375 1361 update
1376 1362 </a>
1377 1363 </td><td>
1378 1364 update working directory (or switch revisions)
1379 1365 </td></tr>
1380 1366
1381 1367 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
1382 1368
1383 1369 <tr><td>
1384 1370 <a href="/help/addremove">
1385 1371 addremove
1386 1372 </a>
1387 1373 </td><td>
1388 1374 add all new files, delete all missing files
1389 1375 </td></tr>
1390 1376 <tr><td>
1391 1377 <a href="/help/archive">
1392 1378 archive
1393 1379 </a>
1394 1380 </td><td>
1395 1381 create an unversioned archive of a repository revision
1396 1382 </td></tr>
1397 1383 <tr><td>
1398 1384 <a href="/help/backout">
1399 1385 backout
1400 1386 </a>
1401 1387 </td><td>
1402 1388 reverse effect of earlier changeset
1403 1389 </td></tr>
1404 1390 <tr><td>
1405 1391 <a href="/help/bisect">
1406 1392 bisect
1407 1393 </a>
1408 1394 </td><td>
1409 1395 subdivision search of changesets
1410 1396 </td></tr>
1411 1397 <tr><td>
1412 1398 <a href="/help/bookmarks">
1413 1399 bookmarks
1414 1400 </a>
1415 1401 </td><td>
1416 1402 create a new bookmark or list existing bookmarks
1417 1403 </td></tr>
1418 1404 <tr><td>
1419 1405 <a href="/help/branch">
1420 1406 branch
1421 1407 </a>
1422 1408 </td><td>
1423 1409 set or show the current branch name
1424 1410 </td></tr>
1425 1411 <tr><td>
1426 1412 <a href="/help/branches">
1427 1413 branches
1428 1414 </a>
1429 1415 </td><td>
1430 1416 list repository named branches
1431 1417 </td></tr>
1432 1418 <tr><td>
1433 1419 <a href="/help/bundle">
1434 1420 bundle
1435 1421 </a>
1436 1422 </td><td>
1437 1423 create a changegroup file
1438 1424 </td></tr>
1439 1425 <tr><td>
1440 1426 <a href="/help/cat">
1441 1427 cat
1442 1428 </a>
1443 1429 </td><td>
1444 1430 output the current or given revision of files
1445 1431 </td></tr>
1446 1432 <tr><td>
1447 1433 <a href="/help/config">
1448 1434 config
1449 1435 </a>
1450 1436 </td><td>
1451 1437 show combined config settings from all hgrc files
1452 1438 </td></tr>
1453 1439 <tr><td>
1454 1440 <a href="/help/copy">
1455 1441 copy
1456 1442 </a>
1457 1443 </td><td>
1458 1444 mark files as copied for the next commit
1459 1445 </td></tr>
1460 1446 <tr><td>
1461 1447 <a href="/help/graft">
1462 1448 graft
1463 1449 </a>
1464 1450 </td><td>
1465 1451 copy changes from other branches onto the current branch
1466 1452 </td></tr>
1467 1453 <tr><td>
1468 1454 <a href="/help/grep">
1469 1455 grep
1470 1456 </a>
1471 1457 </td><td>
1472 1458 search for a pattern in specified files and revisions
1473 1459 </td></tr>
1474 1460 <tr><td>
1475 1461 <a href="/help/heads">
1476 1462 heads
1477 1463 </a>
1478 1464 </td><td>
1479 1465 show branch heads
1480 1466 </td></tr>
1481 1467 <tr><td>
1482 1468 <a href="/help/help">
1483 1469 help
1484 1470 </a>
1485 1471 </td><td>
1486 1472 show help for a given topic or a help overview
1487 1473 </td></tr>
1488 1474 <tr><td>
1489 1475 <a href="/help/identify">
1490 1476 identify
1491 1477 </a>
1492 1478 </td><td>
1493 1479 identify the working copy or specified revision
1494 1480 </td></tr>
1495 1481 <tr><td>
1496 1482 <a href="/help/import">
1497 1483 import
1498 1484 </a>
1499 1485 </td><td>
1500 1486 import an ordered set of patches
1501 1487 </td></tr>
1502 1488 <tr><td>
1503 1489 <a href="/help/incoming">
1504 1490 incoming
1505 1491 </a>
1506 1492 </td><td>
1507 1493 show new changesets found in source
1508 1494 </td></tr>
1509 1495 <tr><td>
1510 1496 <a href="/help/locate">
1511 1497 locate
1512 1498 </a>
1513 1499 </td><td>
1514 1500 locate files matching specific patterns
1515 1501 </td></tr>
1516 1502 <tr><td>
1517 1503 <a href="/help/manifest">
1518 1504 manifest
1519 1505 </a>
1520 1506 </td><td>
1521 1507 output the current or given revision of the project manifest
1522 1508 </td></tr>
1523 1509 <tr><td>
1524 1510 <a href="/help/nohelp">
1525 1511 nohelp
1526 1512 </a>
1527 1513 </td><td>
1528 1514 (no help text available)
1529 1515 </td></tr>
1530 1516 <tr><td>
1531 1517 <a href="/help/outgoing">
1532 1518 outgoing
1533 1519 </a>
1534 1520 </td><td>
1535 1521 show changesets not found in the destination
1536 1522 </td></tr>
1537 1523 <tr><td>
1538 1524 <a href="/help/parents">
1539 1525 parents
1540 1526 </a>
1541 1527 </td><td>
1542 1528 show the parents of the working directory or revision
1543 1529 </td></tr>
1544 1530 <tr><td>
1545 1531 <a href="/help/paths">
1546 1532 paths
1547 1533 </a>
1548 1534 </td><td>
1549 1535 show aliases for remote repositories
1550 1536 </td></tr>
1551 1537 <tr><td>
1552 1538 <a href="/help/phase">
1553 1539 phase
1554 1540 </a>
1555 1541 </td><td>
1556 1542 set or show the current phase name
1557 1543 </td></tr>
1558 1544 <tr><td>
1559 1545 <a href="/help/recover">
1560 1546 recover
1561 1547 </a>
1562 1548 </td><td>
1563 1549 roll back an interrupted transaction
1564 1550 </td></tr>
1565 1551 <tr><td>
1566 1552 <a href="/help/rename">
1567 1553 rename
1568 1554 </a>
1569 1555 </td><td>
1570 1556 rename files; equivalent of copy + remove
1571 1557 </td></tr>
1572 1558 <tr><td>
1573 1559 <a href="/help/resolve">
1574 1560 resolve
1575 1561 </a>
1576 1562 </td><td>
1577 1563 redo merges or set/view the merge status of files
1578 1564 </td></tr>
1579 1565 <tr><td>
1580 1566 <a href="/help/revert">
1581 1567 revert
1582 1568 </a>
1583 1569 </td><td>
1584 1570 restore files to their checkout state
1585 1571 </td></tr>
1586 1572 <tr><td>
1587 1573 <a href="/help/root">
1588 1574 root
1589 1575 </a>
1590 1576 </td><td>
1591 1577 print the root (top) of the current working directory
1592 1578 </td></tr>
1593 1579 <tr><td>
1594 1580 <a href="/help/tag">
1595 1581 tag
1596 1582 </a>
1597 1583 </td><td>
1598 1584 add one or more tags for the current or given revision
1599 1585 </td></tr>
1600 1586 <tr><td>
1601 1587 <a href="/help/tags">
1602 1588 tags
1603 1589 </a>
1604 1590 </td><td>
1605 1591 list repository tags
1606 1592 </td></tr>
1607 1593 <tr><td>
1608 1594 <a href="/help/unbundle">
1609 1595 unbundle
1610 1596 </a>
1611 1597 </td><td>
1612 1598 apply one or more changegroup files
1613 1599 </td></tr>
1614 1600 <tr><td>
1615 1601 <a href="/help/verify">
1616 1602 verify
1617 1603 </a>
1618 1604 </td><td>
1619 1605 verify the integrity of the repository
1620 1606 </td></tr>
1621 1607 <tr><td>
1622 1608 <a href="/help/version">
1623 1609 version
1624 1610 </a>
1625 1611 </td><td>
1626 1612 output version and copyright information
1627 1613 </td></tr>
1628 1614 </table>
1629 1615 </div>
1630 1616 </div>
1631 1617
1632 1618 <script type="text/javascript">process_dates()</script>
1633 1619
1634 1620
1635 1621 </body>
1636 1622 </html>
1637 1623
1638 1624
1639 1625 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help/add"
1640 1626 200 Script output follows
1641 1627
1642 1628 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1643 1629 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1644 1630 <head>
1645 1631 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1646 1632 <meta name="robots" content="index, nofollow" />
1647 1633 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1648 1634 <script type="text/javascript" src="/static/mercurial.js"></script>
1649 1635
1650 1636 <title>Help: add</title>
1651 1637 </head>
1652 1638 <body>
1653 1639
1654 1640 <div class="container">
1655 1641 <div class="menu">
1656 1642 <div class="logo">
1657 1643 <a href="http://mercurial.selenic.com/">
1658 1644 <img src="/static/hglogo.png" alt="mercurial" /></a>
1659 1645 </div>
1660 1646 <ul>
1661 1647 <li><a href="/shortlog">log</a></li>
1662 1648 <li><a href="/graph">graph</a></li>
1663 1649 <li><a href="/tags">tags</a></li>
1664 1650 <li><a href="/bookmarks">bookmarks</a></li>
1665 1651 <li><a href="/branches">branches</a></li>
1666 1652 </ul>
1667 1653 <ul>
1668 1654 <li class="active"><a href="/help">help</a></li>
1669 1655 </ul>
1670 1656 </div>
1671 1657
1672 1658 <div class="main">
1673 1659 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1674 1660 <h3>Help: add</h3>
1675 1661
1676 1662 <form class="search" action="/log">
1677 1663
1678 1664 <p><input name="rev" id="search1" type="text" size="30" /></p>
1679 1665 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1680 1666 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1681 1667 </form>
1682 1668 <div id="doc">
1683 1669 <p>
1684 1670 hg add [OPTION]... [FILE]...
1685 1671 </p>
1686 1672 <p>
1687 1673 add the specified files on the next commit
1688 1674 </p>
1689 1675 <p>
1690 1676 Schedule files to be version controlled and added to the
1691 1677 repository.
1692 1678 </p>
1693 1679 <p>
1694 1680 The files will be added to the repository at the next commit. To
1695 1681 undo an add before that, see &quot;hg forget&quot;.
1696 1682 </p>
1697 1683 <p>
1698 1684 If no names are given, add all files to the repository.
1699 1685 </p>
1700 1686 <p>
1701 1687 An example showing how new (unknown) files are added
1702 1688 automatically by &quot;hg add&quot;:
1703 1689 </p>
1704 1690 <pre>
1705 1691 \$ ls (re)
1706 1692 foo.c
1707 1693 \$ hg status (re)
1708 1694 ? foo.c
1709 1695 \$ hg add (re)
1710 1696 adding foo.c
1711 1697 \$ hg status (re)
1712 1698 A foo.c
1713 1699 </pre>
1714 1700 <p>
1715 1701 Returns 0 if all files are successfully added.
1716 1702 </p>
1717 1703 <p>
1718 options:
1704 options ([+] can be repeated):
1719 1705 </p>
1720 1706 <table>
1721 1707 <tr><td>-I</td>
1722 1708 <td>--include PATTERN [+]</td>
1723 1709 <td>include names matching the given patterns</td></tr>
1724 1710 <tr><td>-X</td>
1725 1711 <td>--exclude PATTERN [+]</td>
1726 1712 <td>exclude names matching the given patterns</td></tr>
1727 1713 <tr><td>-S</td>
1728 1714 <td>--subrepos</td>
1729 1715 <td>recurse into subrepositories</td></tr>
1730 1716 <tr><td>-n</td>
1731 1717 <td>--dry-run</td>
1732 1718 <td>do not perform actions, just print output</td></tr>
1733 1719 </table>
1734 1720 <p>
1735 [+] marked option can be specified multiple times
1736 </p>
1737 <p>
1738 global options:
1721 global options ([+] can be repeated):
1739 1722 </p>
1740 1723 <table>
1741 1724 <tr><td>-R</td>
1742 1725 <td>--repository REPO</td>
1743 1726 <td>repository root directory or name of overlay bundle file</td></tr>
1744 1727 <tr><td></td>
1745 1728 <td>--cwd DIR</td>
1746 1729 <td>change working directory</td></tr>
1747 1730 <tr><td>-y</td>
1748 1731 <td>--noninteractive</td>
1749 1732 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
1750 1733 <tr><td>-q</td>
1751 1734 <td>--quiet</td>
1752 1735 <td>suppress output</td></tr>
1753 1736 <tr><td>-v</td>
1754 1737 <td>--verbose</td>
1755 1738 <td>enable additional output</td></tr>
1756 1739 <tr><td></td>
1757 1740 <td>--config CONFIG [+]</td>
1758 1741 <td>set/override config option (use 'section.name=value')</td></tr>
1759 1742 <tr><td></td>
1760 1743 <td>--debug</td>
1761 1744 <td>enable debugging output</td></tr>
1762 1745 <tr><td></td>
1763 1746 <td>--debugger</td>
1764 1747 <td>start debugger</td></tr>
1765 1748 <tr><td></td>
1766 1749 <td>--encoding ENCODE</td>
1767 1750 <td>set the charset encoding (default: ascii)</td></tr>
1768 1751 <tr><td></td>
1769 1752 <td>--encodingmode MODE</td>
1770 1753 <td>set the charset encoding mode (default: strict)</td></tr>
1771 1754 <tr><td></td>
1772 1755 <td>--traceback</td>
1773 1756 <td>always print a traceback on exception</td></tr>
1774 1757 <tr><td></td>
1775 1758 <td>--time</td>
1776 1759 <td>time how long the command takes</td></tr>
1777 1760 <tr><td></td>
1778 1761 <td>--profile</td>
1779 1762 <td>print command execution profile</td></tr>
1780 1763 <tr><td></td>
1781 1764 <td>--version</td>
1782 1765 <td>output version information and exit</td></tr>
1783 1766 <tr><td>-h</td>
1784 1767 <td>--help</td>
1785 1768 <td>display help and exit</td></tr>
1786 1769 <tr><td></td>
1787 1770 <td>--hidden</td>
1788 1771 <td>consider hidden changesets</td></tr>
1789 1772 </table>
1790 <p>
1791 [+] marked option can be specified multiple times
1792 </p>
1793 1773
1794 1774 </div>
1795 1775 </div>
1796 1776 </div>
1797 1777
1798 1778 <script type="text/javascript">process_dates()</script>
1799 1779
1800 1780
1801 1781 </body>
1802 1782 </html>
1803 1783
1804 1784
1805 1785 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help/remove"
1806 1786 200 Script output follows
1807 1787
1808 1788 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1809 1789 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1810 1790 <head>
1811 1791 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1812 1792 <meta name="robots" content="index, nofollow" />
1813 1793 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1814 1794 <script type="text/javascript" src="/static/mercurial.js"></script>
1815 1795
1816 1796 <title>Help: remove</title>
1817 1797 </head>
1818 1798 <body>
1819 1799
1820 1800 <div class="container">
1821 1801 <div class="menu">
1822 1802 <div class="logo">
1823 1803 <a href="http://mercurial.selenic.com/">
1824 1804 <img src="/static/hglogo.png" alt="mercurial" /></a>
1825 1805 </div>
1826 1806 <ul>
1827 1807 <li><a href="/shortlog">log</a></li>
1828 1808 <li><a href="/graph">graph</a></li>
1829 1809 <li><a href="/tags">tags</a></li>
1830 1810 <li><a href="/bookmarks">bookmarks</a></li>
1831 1811 <li><a href="/branches">branches</a></li>
1832 1812 </ul>
1833 1813 <ul>
1834 1814 <li class="active"><a href="/help">help</a></li>
1835 1815 </ul>
1836 1816 </div>
1837 1817
1838 1818 <div class="main">
1839 1819 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1840 1820 <h3>Help: remove</h3>
1841 1821
1842 1822 <form class="search" action="/log">
1843 1823
1844 1824 <p><input name="rev" id="search1" type="text" size="30" /></p>
1845 1825 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1846 1826 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1847 1827 </form>
1848 1828 <div id="doc">
1849 1829 <p>
1850 1830 hg remove [OPTION]... FILE...
1851 1831 </p>
1852 1832 <p>
1853 1833 aliases: rm
1854 1834 </p>
1855 1835 <p>
1856 1836 remove the specified files on the next commit
1857 1837 </p>
1858 1838 <p>
1859 1839 Schedule the indicated files for removal from the current branch.
1860 1840 </p>
1861 1841 <p>
1862 1842 This command schedules the files to be removed at the next commit.
1863 1843 To undo a remove before that, see &quot;hg revert&quot;. To undo added
1864 1844 files, see &quot;hg forget&quot;.
1865 1845 </p>
1866 1846 <p>
1867 1847 -A/--after can be used to remove only files that have already
1868 1848 been deleted, -f/--force can be used to force deletion, and -Af
1869 1849 can be used to remove files from the next revision without
1870 1850 deleting them from the working directory.
1871 1851 </p>
1872 1852 <p>
1873 1853 The following table details the behavior of remove for different
1874 1854 file states (columns) and option combinations (rows). The file
1875 1855 states are Added [A], Clean [C], Modified [M] and Missing [!]
1876 1856 (as reported by &quot;hg status&quot;). The actions are Warn, Remove
1877 1857 (from branch) and Delete (from disk):
1878 1858 </p>
1879 1859 <table>
1880 1860 <tr><td>opt/state</td>
1881 1861 <td>A</td>
1882 1862 <td>C</td>
1883 1863 <td>M</td>
1884 1864 <td>!</td></tr>
1885 1865 <tr><td>none</td>
1886 1866 <td>W</td>
1887 1867 <td>RD</td>
1888 1868 <td>W</td>
1889 1869 <td>R</td></tr>
1890 1870 <tr><td>-f</td>
1891 1871 <td>R</td>
1892 1872 <td>RD</td>
1893 1873 <td>RD</td>
1894 1874 <td>R</td></tr>
1895 1875 <tr><td>-A</td>
1896 1876 <td>W</td>
1897 1877 <td>W</td>
1898 1878 <td>W</td>
1899 1879 <td>R</td></tr>
1900 1880 <tr><td>-Af</td>
1901 1881 <td>R</td>
1902 1882 <td>R</td>
1903 1883 <td>R</td>
1904 1884 <td>R</td></tr>
1905 1885 </table>
1906 1886 <p>
1907 1887 Note that remove never deletes files in Added [A] state from the
1908 1888 working directory, not even if option --force is specified.
1909 1889 </p>
1910 1890 <p>
1911 1891 Returns 0 on success, 1 if any warnings encountered.
1912 1892 </p>
1913 1893 <p>
1914 options:
1894 options ([+] can be repeated):
1915 1895 </p>
1916 1896 <table>
1917 1897 <tr><td>-A</td>
1918 1898 <td>--after</td>
1919 1899 <td>record delete for missing files</td></tr>
1920 1900 <tr><td>-f</td>
1921 1901 <td>--force</td>
1922 1902 <td>remove (and delete) file even if added or modified</td></tr>
1923 1903 <tr><td>-I</td>
1924 1904 <td>--include PATTERN [+]</td>
1925 1905 <td>include names matching the given patterns</td></tr>
1926 1906 <tr><td>-X</td>
1927 1907 <td>--exclude PATTERN [+]</td>
1928 1908 <td>exclude names matching the given patterns</td></tr>
1929 1909 </table>
1930 1910 <p>
1931 [+] marked option can be specified multiple times
1932 </p>
1933 <p>
1934 global options:
1911 global options ([+] can be repeated):
1935 1912 </p>
1936 1913 <table>
1937 1914 <tr><td>-R</td>
1938 1915 <td>--repository REPO</td>
1939 1916 <td>repository root directory or name of overlay bundle file</td></tr>
1940 1917 <tr><td></td>
1941 1918 <td>--cwd DIR</td>
1942 1919 <td>change working directory</td></tr>
1943 1920 <tr><td>-y</td>
1944 1921 <td>--noninteractive</td>
1945 1922 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
1946 1923 <tr><td>-q</td>
1947 1924 <td>--quiet</td>
1948 1925 <td>suppress output</td></tr>
1949 1926 <tr><td>-v</td>
1950 1927 <td>--verbose</td>
1951 1928 <td>enable additional output</td></tr>
1952 1929 <tr><td></td>
1953 1930 <td>--config CONFIG [+]</td>
1954 1931 <td>set/override config option (use 'section.name=value')</td></tr>
1955 1932 <tr><td></td>
1956 1933 <td>--debug</td>
1957 1934 <td>enable debugging output</td></tr>
1958 1935 <tr><td></td>
1959 1936 <td>--debugger</td>
1960 1937 <td>start debugger</td></tr>
1961 1938 <tr><td></td>
1962 1939 <td>--encoding ENCODE</td>
1963 1940 <td>set the charset encoding (default: ascii)</td></tr>
1964 1941 <tr><td></td>
1965 1942 <td>--encodingmode MODE</td>
1966 1943 <td>set the charset encoding mode (default: strict)</td></tr>
1967 1944 <tr><td></td>
1968 1945 <td>--traceback</td>
1969 1946 <td>always print a traceback on exception</td></tr>
1970 1947 <tr><td></td>
1971 1948 <td>--time</td>
1972 1949 <td>time how long the command takes</td></tr>
1973 1950 <tr><td></td>
1974 1951 <td>--profile</td>
1975 1952 <td>print command execution profile</td></tr>
1976 1953 <tr><td></td>
1977 1954 <td>--version</td>
1978 1955 <td>output version information and exit</td></tr>
1979 1956 <tr><td>-h</td>
1980 1957 <td>--help</td>
1981 1958 <td>display help and exit</td></tr>
1982 1959 <tr><td></td>
1983 1960 <td>--hidden</td>
1984 1961 <td>consider hidden changesets</td></tr>
1985 1962 </table>
1986 <p>
1987 [+] marked option can be specified multiple times
1988 </p>
1989 1963
1990 1964 </div>
1991 1965 </div>
1992 1966 </div>
1993 1967
1994 1968 <script type="text/javascript">process_dates()</script>
1995 1969
1996 1970
1997 1971 </body>
1998 1972 </html>
1999 1973
2000 1974
2001 1975 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help/revisions"
2002 1976 200 Script output follows
2003 1977
2004 1978 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2005 1979 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2006 1980 <head>
2007 1981 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2008 1982 <meta name="robots" content="index, nofollow" />
2009 1983 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2010 1984 <script type="text/javascript" src="/static/mercurial.js"></script>
2011 1985
2012 1986 <title>Help: revisions</title>
2013 1987 </head>
2014 1988 <body>
2015 1989
2016 1990 <div class="container">
2017 1991 <div class="menu">
2018 1992 <div class="logo">
2019 1993 <a href="http://mercurial.selenic.com/">
2020 1994 <img src="/static/hglogo.png" alt="mercurial" /></a>
2021 1995 </div>
2022 1996 <ul>
2023 1997 <li><a href="/shortlog">log</a></li>
2024 1998 <li><a href="/graph">graph</a></li>
2025 1999 <li><a href="/tags">tags</a></li>
2026 2000 <li><a href="/bookmarks">bookmarks</a></li>
2027 2001 <li><a href="/branches">branches</a></li>
2028 2002 </ul>
2029 2003 <ul>
2030 2004 <li class="active"><a href="/help">help</a></li>
2031 2005 </ul>
2032 2006 </div>
2033 2007
2034 2008 <div class="main">
2035 2009 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2036 2010 <h3>Help: revisions</h3>
2037 2011
2038 2012 <form class="search" action="/log">
2039 2013
2040 2014 <p><input name="rev" id="search1" type="text" size="30" /></p>
2041 2015 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2042 2016 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2043 2017 </form>
2044 2018 <div id="doc">
2045 2019 <h1>Specifying Single Revisions</h1>
2046 2020 <p>
2047 2021 Mercurial supports several ways to specify individual revisions.
2048 2022 </p>
2049 2023 <p>
2050 2024 A plain integer is treated as a revision number. Negative integers are
2051 2025 treated as sequential offsets from the tip, with -1 denoting the tip,
2052 2026 -2 denoting the revision prior to the tip, and so forth.
2053 2027 </p>
2054 2028 <p>
2055 2029 A 40-digit hexadecimal string is treated as a unique revision
2056 2030 identifier.
2057 2031 </p>
2058 2032 <p>
2059 2033 A hexadecimal string less than 40 characters long is treated as a
2060 2034 unique revision identifier and is referred to as a short-form
2061 2035 identifier. A short-form identifier is only valid if it is the prefix
2062 2036 of exactly one full-length identifier.
2063 2037 </p>
2064 2038 <p>
2065 2039 Any other string is treated as a bookmark, tag, or branch name. A
2066 2040 bookmark is a movable pointer to a revision. A tag is a permanent name
2067 2041 associated with a revision. A branch name denotes the tipmost open branch head
2068 2042 of that branch - or if they are all closed, the tipmost closed head of the
2069 2043 branch. Bookmark, tag, and branch names must not contain the &quot;:&quot; character.
2070 2044 </p>
2071 2045 <p>
2072 2046 The reserved name &quot;tip&quot; always identifies the most recent revision.
2073 2047 </p>
2074 2048 <p>
2075 2049 The reserved name &quot;null&quot; indicates the null revision. This is the
2076 2050 revision of an empty repository, and the parent of revision 0.
2077 2051 </p>
2078 2052 <p>
2079 2053 The reserved name &quot;.&quot; indicates the working directory parent. If no
2080 2054 working directory is checked out, it is equivalent to null. If an
2081 2055 uncommitted merge is in progress, &quot;.&quot; is the revision of the first
2082 2056 parent.
2083 2057 </p>
2084 2058
2085 2059 </div>
2086 2060 </div>
2087 2061 </div>
2088 2062
2089 2063 <script type="text/javascript">process_dates()</script>
2090 2064
2091 2065
2092 2066 </body>
2093 2067 </html>
2094 2068
2095 2069
2096 2070 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
2097 2071
2098 2072 #endif
@@ -1,350 +1,346
1 1 Create configuration
2 2
3 3 $ echo "[ui]" >> $HGRCPATH
4 4 $ echo "interactive=true" >> $HGRCPATH
5 5
6 6 help qrefresh (no record)
7 7
8 8 $ echo "[extensions]" >> $HGRCPATH
9 9 $ echo "mq=" >> $HGRCPATH
10 10 $ hg help qrefresh
11 11 hg qrefresh [-I] [-X] [-e] [-m TEXT] [-l FILE] [-s] [FILE]...
12 12
13 13 update the current patch
14 14
15 15 If any file patterns are provided, the refreshed patch will contain only
16 16 the modifications that match those patterns; the remaining modifications
17 17 will remain in the working directory.
18 18
19 19 If -s/--short is specified, files currently included in the patch will be
20 20 refreshed just like matched files and remain in the patch.
21 21
22 22 If -e/--edit is specified, Mercurial will start your configured editor for
23 23 you to enter a message. In case qrefresh fails, you will find a backup of
24 24 your message in ".hg/last-message.txt".
25 25
26 26 hg add/remove/copy/rename work as usual, though you might want to use git-
27 27 style patches (-g/--git or [diff] git=1) to track copies and renames. See
28 28 the diffs help topic for more information on the git diff format.
29 29
30 30 Returns 0 on success.
31 31
32 options:
32 options ([+] can be repeated):
33 33
34 34 -e --edit invoke editor on commit messages
35 35 -g --git use git extended diff format
36 36 -s --short refresh only files already in the patch and
37 37 specified files
38 38 -U --currentuser add/update author field in patch with current user
39 39 -u --user USER add/update author field in patch with given user
40 40 -D --currentdate add/update date field in patch with current date
41 41 -d --date DATE add/update date field in patch with given date
42 42 -I --include PATTERN [+] include names matching the given patterns
43 43 -X --exclude PATTERN [+] exclude names matching the given patterns
44 44 -m --message TEXT use text as commit message
45 45 -l --logfile FILE read commit message from file
46 46
47 [+] marked option can be specified multiple times
48
49 47 (some details hidden, use --verbose to show complete help)
50 48
51 49 help qrefresh (record)
52 50
53 51 $ echo "record=" >> $HGRCPATH
54 52 $ hg help qrefresh
55 53 hg qrefresh [-I] [-X] [-e] [-m TEXT] [-l FILE] [-s] [FILE]...
56 54
57 55 update the current patch
58 56
59 57 If any file patterns are provided, the refreshed patch will contain only
60 58 the modifications that match those patterns; the remaining modifications
61 59 will remain in the working directory.
62 60
63 61 If -s/--short is specified, files currently included in the patch will be
64 62 refreshed just like matched files and remain in the patch.
65 63
66 64 If -e/--edit is specified, Mercurial will start your configured editor for
67 65 you to enter a message. In case qrefresh fails, you will find a backup of
68 66 your message in ".hg/last-message.txt".
69 67
70 68 hg add/remove/copy/rename work as usual, though you might want to use git-
71 69 style patches (-g/--git or [diff] git=1) to track copies and renames. See
72 70 the diffs help topic for more information on the git diff format.
73 71
74 72 Returns 0 on success.
75 73
76 options:
74 options ([+] can be repeated):
77 75
78 76 -e --edit invoke editor on commit messages
79 77 -g --git use git extended diff format
80 78 -s --short refresh only files already in the patch and
81 79 specified files
82 80 -U --currentuser add/update author field in patch with current user
83 81 -u --user USER add/update author field in patch with given user
84 82 -D --currentdate add/update date field in patch with current date
85 83 -d --date DATE add/update date field in patch with given date
86 84 -I --include PATTERN [+] include names matching the given patterns
87 85 -X --exclude PATTERN [+] exclude names matching the given patterns
88 86 -m --message TEXT use text as commit message
89 87 -l --logfile FILE read commit message from file
90 88 -i --interactive interactively select changes to refresh
91 89
92 [+] marked option can be specified multiple times
93
94 90 (some details hidden, use --verbose to show complete help)
95 91
96 92 $ hg init a
97 93 $ cd a
98 94
99 95 Base commit
100 96
101 97 $ cat > 1.txt <<EOF
102 98 > 1
103 99 > 2
104 100 > 3
105 101 > 4
106 102 > 5
107 103 > EOF
108 104 $ cat > 2.txt <<EOF
109 105 > a
110 106 > b
111 107 > c
112 108 > d
113 109 > e
114 110 > f
115 111 > EOF
116 112
117 113 $ mkdir dir
118 114 $ cat > dir/a.txt <<EOF
119 115 > hello world
120 116 >
121 117 > someone
122 118 > up
123 119 > there
124 120 > loves
125 121 > me
126 122 > EOF
127 123
128 124 $ hg add 1.txt 2.txt dir/a.txt
129 125 $ hg commit -m aaa
130 126 $ hg qnew -d '0 0' patch
131 127
132 128 Changing files
133 129
134 130 $ sed -e 's/2/2 2/;s/4/4 4/' 1.txt > 1.txt.new
135 131 $ sed -e 's/b/b b/' 2.txt > 2.txt.new
136 132 $ sed -e 's/hello world/hello world!/' dir/a.txt > dir/a.txt.new
137 133
138 134 $ mv -f 1.txt.new 1.txt
139 135 $ mv -f 2.txt.new 2.txt
140 136 $ mv -f dir/a.txt.new dir/a.txt
141 137
142 138 Whole diff
143 139
144 140 $ hg diff --nodates
145 141 diff -r ed27675cb5df 1.txt
146 142 --- a/1.txt
147 143 +++ b/1.txt
148 144 @@ -1,5 +1,5 @@
149 145 1
150 146 -2
151 147 +2 2
152 148 3
153 149 -4
154 150 +4 4
155 151 5
156 152 diff -r ed27675cb5df 2.txt
157 153 --- a/2.txt
158 154 +++ b/2.txt
159 155 @@ -1,5 +1,5 @@
160 156 a
161 157 -b
162 158 +b b
163 159 c
164 160 d
165 161 e
166 162 diff -r ed27675cb5df dir/a.txt
167 163 --- a/dir/a.txt
168 164 +++ b/dir/a.txt
169 165 @@ -1,4 +1,4 @@
170 166 -hello world
171 167 +hello world!
172 168
173 169 someone
174 170 up
175 171
176 172 partial qrefresh
177 173
178 174 $ hg qrefresh -i -d '0 0' <<EOF
179 175 > y
180 176 > y
181 177 > n
182 178 > y
183 179 > y
184 180 > n
185 181 > EOF
186 182 diff --git a/1.txt b/1.txt
187 183 2 hunks, 2 lines changed
188 184 examine changes to '1.txt'? [Ynesfdaq?]
189 185 @@ -1,3 +1,3 @@
190 186 1
191 187 -2
192 188 +2 2
193 189 3
194 190 record change 1/4 to '1.txt'? [Ynesfdaq?]
195 191 @@ -3,3 +3,3 @@
196 192 3
197 193 -4
198 194 +4 4
199 195 5
200 196 record change 2/4 to '1.txt'? [Ynesfdaq?]
201 197 diff --git a/2.txt b/2.txt
202 198 1 hunks, 1 lines changed
203 199 examine changes to '2.txt'? [Ynesfdaq?]
204 200 @@ -1,5 +1,5 @@
205 201 a
206 202 -b
207 203 +b b
208 204 c
209 205 d
210 206 e
211 207 record change 3/4 to '2.txt'? [Ynesfdaq?]
212 208 diff --git a/dir/a.txt b/dir/a.txt
213 209 1 hunks, 1 lines changed
214 210 examine changes to 'dir/a.txt'? [Ynesfdaq?]
215 211
216 212 After partial qrefresh 'tip'
217 213
218 214 $ hg tip -p
219 215 changeset: 1:0738af1a8211
220 216 tag: patch
221 217 tag: qbase
222 218 tag: qtip
223 219 tag: tip
224 220 user: test
225 221 date: Thu Jan 01 00:00:00 1970 +0000
226 222 summary: [mq]: patch
227 223
228 224 diff -r 1fd39ab63a33 -r 0738af1a8211 1.txt
229 225 --- a/1.txt Thu Jan 01 00:00:00 1970 +0000
230 226 +++ b/1.txt Thu Jan 01 00:00:00 1970 +0000
231 227 @@ -1,5 +1,5 @@
232 228 1
233 229 -2
234 230 +2 2
235 231 3
236 232 4
237 233 5
238 234 diff -r 1fd39ab63a33 -r 0738af1a8211 2.txt
239 235 --- a/2.txt Thu Jan 01 00:00:00 1970 +0000
240 236 +++ b/2.txt Thu Jan 01 00:00:00 1970 +0000
241 237 @@ -1,5 +1,5 @@
242 238 a
243 239 -b
244 240 +b b
245 241 c
246 242 d
247 243 e
248 244
249 245 After partial qrefresh 'diff'
250 246
251 247 $ hg diff --nodates
252 248 diff -r 0738af1a8211 1.txt
253 249 --- a/1.txt
254 250 +++ b/1.txt
255 251 @@ -1,5 +1,5 @@
256 252 1
257 253 2 2
258 254 3
259 255 -4
260 256 +4 4
261 257 5
262 258 diff -r 0738af1a8211 dir/a.txt
263 259 --- a/dir/a.txt
264 260 +++ b/dir/a.txt
265 261 @@ -1,4 +1,4 @@
266 262 -hello world
267 263 +hello world!
268 264
269 265 someone
270 266 up
271 267
272 268 qrefresh interactively everything else
273 269
274 270 $ hg qrefresh -i -d '0 0' <<EOF
275 271 > y
276 272 > y
277 273 > y
278 274 > y
279 275 > EOF
280 276 diff --git a/1.txt b/1.txt
281 277 1 hunks, 1 lines changed
282 278 examine changes to '1.txt'? [Ynesfdaq?]
283 279 @@ -1,5 +1,5 @@
284 280 1
285 281 2 2
286 282 3
287 283 -4
288 284 +4 4
289 285 5
290 286 record change 1/2 to '1.txt'? [Ynesfdaq?]
291 287 diff --git a/dir/a.txt b/dir/a.txt
292 288 1 hunks, 1 lines changed
293 289 examine changes to 'dir/a.txt'? [Ynesfdaq?]
294 290 @@ -1,4 +1,4 @@
295 291 -hello world
296 292 +hello world!
297 293
298 294 someone
299 295 up
300 296 record change 2/2 to 'dir/a.txt'? [Ynesfdaq?]
301 297
302 298 After final qrefresh 'tip'
303 299
304 300 $ hg tip -p
305 301 changeset: 1:2c3f66afeed9
306 302 tag: patch
307 303 tag: qbase
308 304 tag: qtip
309 305 tag: tip
310 306 user: test
311 307 date: Thu Jan 01 00:00:00 1970 +0000
312 308 summary: [mq]: patch
313 309
314 310 diff -r 1fd39ab63a33 -r 2c3f66afeed9 1.txt
315 311 --- a/1.txt Thu Jan 01 00:00:00 1970 +0000
316 312 +++ b/1.txt Thu Jan 01 00:00:00 1970 +0000
317 313 @@ -1,5 +1,5 @@
318 314 1
319 315 -2
320 316 +2 2
321 317 3
322 318 -4
323 319 +4 4
324 320 5
325 321 diff -r 1fd39ab63a33 -r 2c3f66afeed9 2.txt
326 322 --- a/2.txt Thu Jan 01 00:00:00 1970 +0000
327 323 +++ b/2.txt Thu Jan 01 00:00:00 1970 +0000
328 324 @@ -1,5 +1,5 @@
329 325 a
330 326 -b
331 327 +b b
332 328 c
333 329 d
334 330 e
335 331 diff -r 1fd39ab63a33 -r 2c3f66afeed9 dir/a.txt
336 332 --- a/dir/a.txt Thu Jan 01 00:00:00 1970 +0000
337 333 +++ b/dir/a.txt Thu Jan 01 00:00:00 1970 +0000
338 334 @@ -1,4 +1,4 @@
339 335 -hello world
340 336 +hello world!
341 337
342 338 someone
343 339 up
344 340
345 341
346 342 After qrefresh 'diff'
347 343
348 344 $ hg diff --nodates
349 345
350 346 $ cd ..
@@ -1,404 +1,400
1 1 Create configuration
2 2
3 3 $ echo "[ui]" >> $HGRCPATH
4 4 $ echo "interactive=true" >> $HGRCPATH
5 5
6 6 help record (no record)
7 7
8 8 $ hg help record
9 9 record extension - commands to interactively select changes for
10 10 commit/qrefresh
11 11
12 12 (use "hg help extensions" for information on enabling extensions)
13 13
14 14 help qrecord (no record)
15 15
16 16 $ hg help qrecord
17 17 'qrecord' is provided by the following extension:
18 18
19 19 record commands to interactively select changes for commit/qrefresh
20 20
21 21 (use "hg help extensions" for information on enabling extensions)
22 22
23 23 $ echo "[extensions]" >> $HGRCPATH
24 24 $ echo "record=" >> $HGRCPATH
25 25
26 26 help record (record)
27 27
28 28 $ hg help record
29 29 hg record [OPTION]... [FILE]...
30 30
31 31 interactively select changes to commit
32 32
33 33 If a list of files is omitted, all changes reported by "hg status" will be
34 34 candidates for recording.
35 35
36 36 See "hg help dates" for a list of formats valid for -d/--date.
37 37
38 38 You will be prompted for whether to record changes to each modified file,
39 39 and for files with multiple changes, for each change to use. For each
40 40 query, the following responses are possible:
41 41
42 42 y - record this change
43 43 n - skip this change
44 44 e - edit this change manually
45 45
46 46 s - skip remaining changes to this file
47 47 f - record remaining changes to this file
48 48
49 49 d - done, skip remaining changes and files
50 50 a - record all changes to all remaining files
51 51 q - quit, recording no changes
52 52
53 53 ? - display help
54 54
55 55 This command is not available when committing a merge.
56 56
57 options:
57 options ([+] can be repeated):
58 58
59 59 -A --addremove mark new/missing files as added/removed before
60 60 committing
61 61 --close-branch mark a branch as closed, hiding it from the branch
62 62 list
63 63 --amend amend the parent of the working dir
64 64 -s --secret use the secret phase for committing
65 65 -e --edit invoke editor on commit messages
66 66 -I --include PATTERN [+] include names matching the given patterns
67 67 -X --exclude PATTERN [+] exclude names matching the given patterns
68 68 -m --message TEXT use text as commit message
69 69 -l --logfile FILE read commit message from file
70 70 -d --date DATE record the specified date as commit date
71 71 -u --user USER record the specified user as committer
72 72 -S --subrepos recurse into subrepositories
73 73 -w --ignore-all-space ignore white space when comparing lines
74 74 -b --ignore-space-change ignore changes in the amount of white space
75 75 -B --ignore-blank-lines ignore changes whose lines are all blank
76 76
77 [+] marked option can be specified multiple times
78
79 77 (some details hidden, use --verbose to show complete help)
80 78
81 79 help (no mq, so no qrecord)
82 80
83 81 $ hg help qrecord
84 82 hg qrecord [OPTION]... PATCH [FILE]...
85 83
86 84 interactively record a new patch
87 85
88 86 See "hg help qnew" & "hg help record" for more information and usage.
89 87
90 88 (some details hidden, use --verbose to show complete help)
91 89
92 90 $ hg init a
93 91
94 92 qrecord (mq not present)
95 93
96 94 $ hg -R a qrecord
97 95 hg qrecord: invalid arguments
98 96 hg qrecord [OPTION]... PATCH [FILE]...
99 97
100 98 interactively record a new patch
101 99
102 100 (use "hg qrecord -h" to show more help)
103 101 [255]
104 102
105 103 qrecord patch (mq not present)
106 104
107 105 $ hg -R a qrecord patch
108 106 abort: 'mq' extension not loaded
109 107 [255]
110 108
111 109 help (bad mq)
112 110
113 111 $ echo "mq=nonexistent" >> $HGRCPATH
114 112 $ hg help qrecord
115 113 *** failed to import extension mq from nonexistent: [Errno *] * (glob)
116 114 hg qrecord [OPTION]... PATCH [FILE]...
117 115
118 116 interactively record a new patch
119 117
120 118 See "hg help qnew" & "hg help record" for more information and usage.
121 119
122 120 (some details hidden, use --verbose to show complete help)
123 121
124 122 help (mq present)
125 123
126 124 $ sed 's/mq=nonexistent/mq=/' $HGRCPATH > hgrc.tmp
127 125 $ mv hgrc.tmp $HGRCPATH
128 126
129 127 $ hg help qrecord
130 128 hg qrecord [OPTION]... PATCH [FILE]...
131 129
132 130 interactively record a new patch
133 131
134 132 See "hg help qnew" & "hg help record" for more information and usage.
135 133
136 options:
134 options ([+] can be repeated):
137 135
138 136 -e --edit invoke editor on commit messages
139 137 -g --git use git extended diff format
140 138 -U --currentuser add "From: <current user>" to patch
141 139 -u --user USER add "From: <USER>" to patch
142 140 -D --currentdate add "Date: <current date>" to patch
143 141 -d --date DATE add "Date: <DATE>" to patch
144 142 -I --include PATTERN [+] include names matching the given patterns
145 143 -X --exclude PATTERN [+] exclude names matching the given patterns
146 144 -m --message TEXT use text as commit message
147 145 -l --logfile FILE read commit message from file
148 146 -w --ignore-all-space ignore white space when comparing lines
149 147 -b --ignore-space-change ignore changes in the amount of white space
150 148 -B --ignore-blank-lines ignore changes whose lines are all blank
151 149 --mq operate on patch repository
152 150
153 [+] marked option can be specified multiple times
154
155 151 (some details hidden, use --verbose to show complete help)
156 152
157 153 $ cd a
158 154
159 155 Base commit
160 156
161 157 $ cat > 1.txt <<EOF
162 158 > 1
163 159 > 2
164 160 > 3
165 161 > 4
166 162 > 5
167 163 > EOF
168 164 $ cat > 2.txt <<EOF
169 165 > a
170 166 > b
171 167 > c
172 168 > d
173 169 > e
174 170 > f
175 171 > EOF
176 172
177 173 $ mkdir dir
178 174 $ cat > dir/a.txt <<EOF
179 175 > hello world
180 176 >
181 177 > someone
182 178 > up
183 179 > there
184 180 > loves
185 181 > me
186 182 > EOF
187 183
188 184 $ hg add 1.txt 2.txt dir/a.txt
189 185 $ hg commit -m 'initial checkin'
190 186
191 187 Changing files
192 188
193 189 $ sed -e 's/2/2 2/;s/4/4 4/' 1.txt > 1.txt.new
194 190 $ sed -e 's/b/b b/' 2.txt > 2.txt.new
195 191 $ sed -e 's/hello world/hello world!/' dir/a.txt > dir/a.txt.new
196 192
197 193 $ mv -f 1.txt.new 1.txt
198 194 $ mv -f 2.txt.new 2.txt
199 195 $ mv -f dir/a.txt.new dir/a.txt
200 196
201 197 Whole diff
202 198
203 199 $ hg diff --nodates
204 200 diff -r 1057167b20ef 1.txt
205 201 --- a/1.txt
206 202 +++ b/1.txt
207 203 @@ -1,5 +1,5 @@
208 204 1
209 205 -2
210 206 +2 2
211 207 3
212 208 -4
213 209 +4 4
214 210 5
215 211 diff -r 1057167b20ef 2.txt
216 212 --- a/2.txt
217 213 +++ b/2.txt
218 214 @@ -1,5 +1,5 @@
219 215 a
220 216 -b
221 217 +b b
222 218 c
223 219 d
224 220 e
225 221 diff -r 1057167b20ef dir/a.txt
226 222 --- a/dir/a.txt
227 223 +++ b/dir/a.txt
228 224 @@ -1,4 +1,4 @@
229 225 -hello world
230 226 +hello world!
231 227
232 228 someone
233 229 up
234 230
235 231 qrecord with bad patch name, should abort before prompting
236 232
237 233 $ hg qrecord .hg
238 234 abort: patch name cannot begin with ".hg"
239 235 [255]
240 236
241 237 qrecord a.patch
242 238
243 239 $ hg qrecord -d '0 0' -m aaa a.patch <<EOF
244 240 > y
245 241 > y
246 242 > n
247 243 > y
248 244 > y
249 245 > n
250 246 > EOF
251 247 diff --git a/1.txt b/1.txt
252 248 2 hunks, 2 lines changed
253 249 examine changes to '1.txt'? [Ynesfdaq?]
254 250 @@ -1,3 +1,3 @@
255 251 1
256 252 -2
257 253 +2 2
258 254 3
259 255 record change 1/4 to '1.txt'? [Ynesfdaq?]
260 256 @@ -3,3 +3,3 @@
261 257 3
262 258 -4
263 259 +4 4
264 260 5
265 261 record change 2/4 to '1.txt'? [Ynesfdaq?]
266 262 diff --git a/2.txt b/2.txt
267 263 1 hunks, 1 lines changed
268 264 examine changes to '2.txt'? [Ynesfdaq?]
269 265 @@ -1,5 +1,5 @@
270 266 a
271 267 -b
272 268 +b b
273 269 c
274 270 d
275 271 e
276 272 record change 3/4 to '2.txt'? [Ynesfdaq?]
277 273 diff --git a/dir/a.txt b/dir/a.txt
278 274 1 hunks, 1 lines changed
279 275 examine changes to 'dir/a.txt'? [Ynesfdaq?]
280 276
281 277 After qrecord a.patch 'tip'"
282 278
283 279 $ hg tip -p
284 280 changeset: 1:5d1ca63427ee
285 281 tag: a.patch
286 282 tag: qbase
287 283 tag: qtip
288 284 tag: tip
289 285 user: test
290 286 date: Thu Jan 01 00:00:00 1970 +0000
291 287 summary: aaa
292 288
293 289 diff -r 1057167b20ef -r 5d1ca63427ee 1.txt
294 290 --- a/1.txt Thu Jan 01 00:00:00 1970 +0000
295 291 +++ b/1.txt Thu Jan 01 00:00:00 1970 +0000
296 292 @@ -1,5 +1,5 @@
297 293 1
298 294 -2
299 295 +2 2
300 296 3
301 297 4
302 298 5
303 299 diff -r 1057167b20ef -r 5d1ca63427ee 2.txt
304 300 --- a/2.txt Thu Jan 01 00:00:00 1970 +0000
305 301 +++ b/2.txt Thu Jan 01 00:00:00 1970 +0000
306 302 @@ -1,5 +1,5 @@
307 303 a
308 304 -b
309 305 +b b
310 306 c
311 307 d
312 308 e
313 309
314 310
315 311 After qrecord a.patch 'diff'"
316 312
317 313 $ hg diff --nodates
318 314 diff -r 5d1ca63427ee 1.txt
319 315 --- a/1.txt
320 316 +++ b/1.txt
321 317 @@ -1,5 +1,5 @@
322 318 1
323 319 2 2
324 320 3
325 321 -4
326 322 +4 4
327 323 5
328 324 diff -r 5d1ca63427ee dir/a.txt
329 325 --- a/dir/a.txt
330 326 +++ b/dir/a.txt
331 327 @@ -1,4 +1,4 @@
332 328 -hello world
333 329 +hello world!
334 330
335 331 someone
336 332 up
337 333
338 334 qrecord b.patch
339 335
340 336 $ hg qrecord -d '0 0' -m bbb b.patch <<EOF
341 337 > y
342 338 > y
343 339 > y
344 340 > y
345 341 > EOF
346 342 diff --git a/1.txt b/1.txt
347 343 1 hunks, 1 lines changed
348 344 examine changes to '1.txt'? [Ynesfdaq?]
349 345 @@ -1,5 +1,5 @@
350 346 1
351 347 2 2
352 348 3
353 349 -4
354 350 +4 4
355 351 5
356 352 record change 1/2 to '1.txt'? [Ynesfdaq?]
357 353 diff --git a/dir/a.txt b/dir/a.txt
358 354 1 hunks, 1 lines changed
359 355 examine changes to 'dir/a.txt'? [Ynesfdaq?]
360 356 @@ -1,4 +1,4 @@
361 357 -hello world
362 358 +hello world!
363 359
364 360 someone
365 361 up
366 362 record change 2/2 to 'dir/a.txt'? [Ynesfdaq?]
367 363
368 364 After qrecord b.patch 'tip'
369 365
370 366 $ hg tip -p
371 367 changeset: 2:b056198bf878
372 368 tag: b.patch
373 369 tag: qtip
374 370 tag: tip
375 371 user: test
376 372 date: Thu Jan 01 00:00:00 1970 +0000
377 373 summary: bbb
378 374
379 375 diff -r 5d1ca63427ee -r b056198bf878 1.txt
380 376 --- a/1.txt Thu Jan 01 00:00:00 1970 +0000
381 377 +++ b/1.txt Thu Jan 01 00:00:00 1970 +0000
382 378 @@ -1,5 +1,5 @@
383 379 1
384 380 2 2
385 381 3
386 382 -4
387 383 +4 4
388 384 5
389 385 diff -r 5d1ca63427ee -r b056198bf878 dir/a.txt
390 386 --- a/dir/a.txt Thu Jan 01 00:00:00 1970 +0000
391 387 +++ b/dir/a.txt Thu Jan 01 00:00:00 1970 +0000
392 388 @@ -1,4 +1,4 @@
393 389 -hello world
394 390 +hello world!
395 391
396 392 someone
397 393 up
398 394
399 395
400 396 After qrecord b.patch 'diff'
401 397
402 398 $ hg diff --nodates
403 399
404 400 $ cd ..
@@ -1,551 +1,549
1 1 $ echo "[extensions]" >> $HGRCPATH
2 2 $ echo "strip=" >> $HGRCPATH
3 3
4 4 $ restore() {
5 5 > hg unbundle -q .hg/strip-backup/*
6 6 > rm .hg/strip-backup/*
7 7 > }
8 8 $ teststrip() {
9 9 > hg up -C $1
10 10 > echo % before update $1, strip $2
11 11 > hg parents
12 12 > hg --traceback strip $2
13 13 > echo % after update $1, strip $2
14 14 > hg parents
15 15 > restore
16 16 > }
17 17
18 18 $ hg init test
19 19 $ cd test
20 20
21 21 $ echo foo > bar
22 22 $ hg ci -Ama
23 23 adding bar
24 24
25 25 $ echo more >> bar
26 26 $ hg ci -Amb
27 27
28 28 $ echo blah >> bar
29 29 $ hg ci -Amc
30 30
31 31 $ hg up 1
32 32 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
33 33 $ echo blah >> bar
34 34 $ hg ci -Amd
35 35 created new head
36 36
37 37 $ echo final >> bar
38 38 $ hg ci -Ame
39 39
40 40 $ hg log
41 41 changeset: 4:443431ffac4f
42 42 tag: tip
43 43 user: test
44 44 date: Thu Jan 01 00:00:00 1970 +0000
45 45 summary: e
46 46
47 47 changeset: 3:65bd5f99a4a3
48 48 parent: 1:ef3a871183d7
49 49 user: test
50 50 date: Thu Jan 01 00:00:00 1970 +0000
51 51 summary: d
52 52
53 53 changeset: 2:264128213d29
54 54 user: test
55 55 date: Thu Jan 01 00:00:00 1970 +0000
56 56 summary: c
57 57
58 58 changeset: 1:ef3a871183d7
59 59 user: test
60 60 date: Thu Jan 01 00:00:00 1970 +0000
61 61 summary: b
62 62
63 63 changeset: 0:9ab35a2d17cb
64 64 user: test
65 65 date: Thu Jan 01 00:00:00 1970 +0000
66 66 summary: a
67 67
68 68
69 69 $ teststrip 4 4
70 70 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
71 71 % before update 4, strip 4
72 72 changeset: 4:443431ffac4f
73 73 tag: tip
74 74 user: test
75 75 date: Thu Jan 01 00:00:00 1970 +0000
76 76 summary: e
77 77
78 78 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
79 79 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
80 80 % after update 4, strip 4
81 81 changeset: 3:65bd5f99a4a3
82 82 tag: tip
83 83 parent: 1:ef3a871183d7
84 84 user: test
85 85 date: Thu Jan 01 00:00:00 1970 +0000
86 86 summary: d
87 87
88 88 $ teststrip 4 3
89 89 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
90 90 % before update 4, strip 3
91 91 changeset: 4:443431ffac4f
92 92 tag: tip
93 93 user: test
94 94 date: Thu Jan 01 00:00:00 1970 +0000
95 95 summary: e
96 96
97 97 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
98 98 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
99 99 % after update 4, strip 3
100 100 changeset: 1:ef3a871183d7
101 101 user: test
102 102 date: Thu Jan 01 00:00:00 1970 +0000
103 103 summary: b
104 104
105 105 $ teststrip 1 4
106 106 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
107 107 % before update 1, strip 4
108 108 changeset: 1:ef3a871183d7
109 109 user: test
110 110 date: Thu Jan 01 00:00:00 1970 +0000
111 111 summary: b
112 112
113 113 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
114 114 % after update 1, strip 4
115 115 changeset: 1:ef3a871183d7
116 116 user: test
117 117 date: Thu Jan 01 00:00:00 1970 +0000
118 118 summary: b
119 119
120 120 $ teststrip 4 2
121 121 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
122 122 % before update 4, strip 2
123 123 changeset: 4:443431ffac4f
124 124 tag: tip
125 125 user: test
126 126 date: Thu Jan 01 00:00:00 1970 +0000
127 127 summary: e
128 128
129 129 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
130 130 % after update 4, strip 2
131 131 changeset: 3:443431ffac4f
132 132 tag: tip
133 133 user: test
134 134 date: Thu Jan 01 00:00:00 1970 +0000
135 135 summary: e
136 136
137 137 $ teststrip 4 1
138 138 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
139 139 % before update 4, strip 1
140 140 changeset: 4:264128213d29
141 141 tag: tip
142 142 parent: 1:ef3a871183d7
143 143 user: test
144 144 date: Thu Jan 01 00:00:00 1970 +0000
145 145 summary: c
146 146
147 147 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
148 148 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
149 149 % after update 4, strip 1
150 150 changeset: 0:9ab35a2d17cb
151 151 tag: tip
152 152 user: test
153 153 date: Thu Jan 01 00:00:00 1970 +0000
154 154 summary: a
155 155
156 156 $ teststrip null 4
157 157 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
158 158 % before update null, strip 4
159 159 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
160 160 % after update null, strip 4
161 161
162 162 $ hg log
163 163 changeset: 4:264128213d29
164 164 tag: tip
165 165 parent: 1:ef3a871183d7
166 166 user: test
167 167 date: Thu Jan 01 00:00:00 1970 +0000
168 168 summary: c
169 169
170 170 changeset: 3:443431ffac4f
171 171 user: test
172 172 date: Thu Jan 01 00:00:00 1970 +0000
173 173 summary: e
174 174
175 175 changeset: 2:65bd5f99a4a3
176 176 user: test
177 177 date: Thu Jan 01 00:00:00 1970 +0000
178 178 summary: d
179 179
180 180 changeset: 1:ef3a871183d7
181 181 user: test
182 182 date: Thu Jan 01 00:00:00 1970 +0000
183 183 summary: b
184 184
185 185 changeset: 0:9ab35a2d17cb
186 186 user: test
187 187 date: Thu Jan 01 00:00:00 1970 +0000
188 188 summary: a
189 189
190 190
191 191 $ hg up -C 2
192 192 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
193 193 $ hg merge 4
194 194 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
195 195 (branch merge, don't forget to commit)
196 196
197 197 before strip of merge parent
198 198
199 199 $ hg parents
200 200 changeset: 2:65bd5f99a4a3
201 201 user: test
202 202 date: Thu Jan 01 00:00:00 1970 +0000
203 203 summary: d
204 204
205 205 changeset: 4:264128213d29
206 206 tag: tip
207 207 parent: 1:ef3a871183d7
208 208 user: test
209 209 date: Thu Jan 01 00:00:00 1970 +0000
210 210 summary: c
211 211
212 212 $ hg strip 4
213 213 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
214 214 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
215 215
216 216 after strip of merge parent
217 217
218 218 $ hg parents
219 219 changeset: 1:ef3a871183d7
220 220 user: test
221 221 date: Thu Jan 01 00:00:00 1970 +0000
222 222 summary: b
223 223
224 224 $ restore
225 225
226 226 $ hg up
227 227 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
228 228 $ hg log -G
229 229 @ changeset: 4:264128213d29
230 230 | tag: tip
231 231 | parent: 1:ef3a871183d7
232 232 | user: test
233 233 | date: Thu Jan 01 00:00:00 1970 +0000
234 234 | summary: c
235 235 |
236 236 | o changeset: 3:443431ffac4f
237 237 | | user: test
238 238 | | date: Thu Jan 01 00:00:00 1970 +0000
239 239 | | summary: e
240 240 | |
241 241 | o changeset: 2:65bd5f99a4a3
242 242 |/ user: test
243 243 | date: Thu Jan 01 00:00:00 1970 +0000
244 244 | summary: d
245 245 |
246 246 o changeset: 1:ef3a871183d7
247 247 | user: test
248 248 | date: Thu Jan 01 00:00:00 1970 +0000
249 249 | summary: b
250 250 |
251 251 o changeset: 0:9ab35a2d17cb
252 252 user: test
253 253 date: Thu Jan 01 00:00:00 1970 +0000
254 254 summary: a
255 255
256 256
257 257 2 is parent of 3, only one strip should happen
258 258
259 259 $ hg strip "roots(2)" 3
260 260 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
261 261 $ hg log -G
262 262 @ changeset: 2:264128213d29
263 263 | tag: tip
264 264 | user: test
265 265 | date: Thu Jan 01 00:00:00 1970 +0000
266 266 | summary: c
267 267 |
268 268 o changeset: 1:ef3a871183d7
269 269 | user: test
270 270 | date: Thu Jan 01 00:00:00 1970 +0000
271 271 | summary: b
272 272 |
273 273 o changeset: 0:9ab35a2d17cb
274 274 user: test
275 275 date: Thu Jan 01 00:00:00 1970 +0000
276 276 summary: a
277 277
278 278 $ restore
279 279 $ hg log -G
280 280 o changeset: 4:443431ffac4f
281 281 | tag: tip
282 282 | user: test
283 283 | date: Thu Jan 01 00:00:00 1970 +0000
284 284 | summary: e
285 285 |
286 286 o changeset: 3:65bd5f99a4a3
287 287 | parent: 1:ef3a871183d7
288 288 | user: test
289 289 | date: Thu Jan 01 00:00:00 1970 +0000
290 290 | summary: d
291 291 |
292 292 | @ changeset: 2:264128213d29
293 293 |/ user: test
294 294 | date: Thu Jan 01 00:00:00 1970 +0000
295 295 | summary: c
296 296 |
297 297 o changeset: 1:ef3a871183d7
298 298 | user: test
299 299 | date: Thu Jan 01 00:00:00 1970 +0000
300 300 | summary: b
301 301 |
302 302 o changeset: 0:9ab35a2d17cb
303 303 user: test
304 304 date: Thu Jan 01 00:00:00 1970 +0000
305 305 summary: a
306 306
307 307
308 308 2 different branches: 2 strips
309 309
310 310 $ hg strip 2 4
311 311 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
312 312 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
313 313 $ hg log -G
314 314 o changeset: 2:65bd5f99a4a3
315 315 | tag: tip
316 316 | user: test
317 317 | date: Thu Jan 01 00:00:00 1970 +0000
318 318 | summary: d
319 319 |
320 320 @ changeset: 1:ef3a871183d7
321 321 | user: test
322 322 | date: Thu Jan 01 00:00:00 1970 +0000
323 323 | summary: b
324 324 |
325 325 o changeset: 0:9ab35a2d17cb
326 326 user: test
327 327 date: Thu Jan 01 00:00:00 1970 +0000
328 328 summary: a
329 329
330 330 $ restore
331 331
332 332 2 different branches and a common ancestor: 1 strip
333 333
334 334 $ hg strip 1 "2|4"
335 335 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
336 336 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
337 337 $ restore
338 338
339 339 verify fncache is kept up-to-date
340 340
341 341 $ touch a
342 342 $ hg ci -qAm a
343 343 $ cat .hg/store/fncache | sort
344 344 data/a.i
345 345 data/bar.i
346 346 $ hg strip tip
347 347 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
348 348 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
349 349 $ cat .hg/store/fncache
350 350 data/bar.i
351 351
352 352 stripping an empty revset
353 353
354 354 $ hg strip "1 and not 1"
355 355 abort: empty revision set
356 356 [255]
357 357
358 358 remove branchy history for qimport tests
359 359
360 360 $ hg strip 3
361 361 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
362 362
363 363
364 364 strip of applied mq should cleanup status file
365 365
366 366 $ echo "mq=" >> $HGRCPATH
367 367 $ hg up -C 3
368 368 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
369 369 $ echo fooagain >> bar
370 370 $ hg ci -mf
371 371 $ hg qimport -r tip:2
372 372
373 373 applied patches before strip
374 374
375 375 $ hg qapplied
376 376 2.diff
377 377 3.diff
378 378 4.diff
379 379
380 380 stripping revision in queue
381 381
382 382 $ hg strip 3
383 383 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
384 384 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
385 385
386 386 applied patches after stripping rev in queue
387 387
388 388 $ hg qapplied
389 389 2.diff
390 390
391 391 stripping ancestor of queue
392 392
393 393 $ hg strip 1
394 394 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
395 395 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
396 396
397 397 applied patches after stripping ancestor of queue
398 398
399 399 $ hg qapplied
400 400
401 401 Verify strip protects against stripping wc parent when there are uncommitted mods
402 402
403 403 $ echo b > b
404 404 $ hg add b
405 405 $ hg ci -m 'b'
406 406 $ hg log --graph
407 407 @ changeset: 1:7519abd79d14
408 408 | tag: tip
409 409 | user: test
410 410 | date: Thu Jan 01 00:00:00 1970 +0000
411 411 | summary: b
412 412 |
413 413 o changeset: 0:9ab35a2d17cb
414 414 user: test
415 415 date: Thu Jan 01 00:00:00 1970 +0000
416 416 summary: a
417 417
418 418
419 419 $ echo c > b
420 420 $ echo c > bar
421 421 $ hg strip tip
422 422 abort: local changes found
423 423 [255]
424 424 $ hg strip tip --keep
425 425 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
426 426 $ hg log --graph
427 427 @ changeset: 0:9ab35a2d17cb
428 428 tag: tip
429 429 user: test
430 430 date: Thu Jan 01 00:00:00 1970 +0000
431 431 summary: a
432 432
433 433 $ hg status
434 434 M bar
435 435 ? b
436 436
437 437 Strip adds, removes, modifies with --keep
438 438
439 439 $ touch b
440 440 $ hg add b
441 441 $ hg commit -mb
442 442 $ touch c
443 443
444 444 ... with a clean working dir
445 445
446 446 $ hg add c
447 447 $ hg rm bar
448 448 $ hg commit -mc
449 449 $ hg status
450 450 $ hg strip --keep tip
451 451 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
452 452 $ hg status
453 453 ! bar
454 454 ? c
455 455
456 456 ... with a dirty working dir
457 457
458 458 $ hg add c
459 459 $ hg rm bar
460 460 $ hg commit -mc
461 461 $ hg status
462 462 $ echo b > b
463 463 $ echo d > d
464 464 $ hg strip --keep tip
465 465 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
466 466 $ hg status
467 467 M b
468 468 ! bar
469 469 ? c
470 470 ? d
471 471 $ cd ..
472 472
473 473 stripping many nodes on a complex graph (issue3299)
474 474
475 475 $ hg init issue3299
476 476 $ cd issue3299
477 477 $ hg debugbuilddag '@a.:a@b.:b.:x<a@a.:a<b@b.:b<a@a.:a'
478 478 $ hg strip 'not ancestors(x)'
479 479 saved backup bundle to $TESTTMP/issue3299/.hg/strip-backup/*-backup.hg (glob)
480 480
481 481 test hg strip -B bookmark
482 482
483 483 $ cd ..
484 484 $ hg init bookmarks
485 485 $ cd bookmarks
486 486 $ hg debugbuilddag '..<2.*1/2:m<2+3:c<m+3:a<2.:b'
487 487 $ hg bookmark -r 'a' 'todelete'
488 488 $ hg bookmark -r 'b' 'B'
489 489 $ hg bookmark -r 'b' 'nostrip'
490 490 $ hg bookmark -r 'c' 'delete'
491 491 $ hg up -C todelete
492 492 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
493 493 (activating bookmark todelete)
494 494 $ hg strip -B nostrip
495 495 bookmark 'nostrip' deleted
496 496 abort: empty revision set
497 497 [255]
498 498 $ hg strip -B todelete
499 499 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
500 500 saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/*-backup.hg (glob)
501 501 bookmark 'todelete' deleted
502 502 $ hg id -ir dcbb326fdec2
503 503 abort: unknown revision 'dcbb326fdec2'!
504 504 [255]
505 505 $ hg id -ir d62d843c9a01
506 506 d62d843c9a01
507 507 $ hg bookmarks
508 508 B 9:ff43616e5d0f
509 509 delete 6:2702dd0c91e7
510 510 $ hg strip -B delete
511 511 saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/*-backup.hg (glob)
512 512 bookmark 'delete' deleted
513 513 $ hg id -ir 6:2702dd0c91e7
514 514 abort: unknown revision '2702dd0c91e7'!
515 515 [255]
516 516 $ hg update B
517 517 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
518 518 (activating bookmark B)
519 519 $ echo a > a
520 520 $ hg add a
521 521 $ hg strip -B B
522 522 abort: local changes found
523 523 [255]
524 524 $ hg bookmarks
525 525 * B 6:ff43616e5d0f
526 526
527 527 Make sure no one adds back a -b option:
528 528
529 529 $ hg strip -b tip
530 530 hg strip: option -b not recognized
531 531 hg strip [-k] [-f] [-n] [-B bookmark] [-r] REV...
532 532
533 533 strip changesets and all their descendants from the repository
534 534
535 535 (use "hg help -e strip" to show help for the strip extension)
536 536
537 options:
537 options ([+] can be repeated):
538 538
539 539 -r --rev REV [+] strip specified revision (optional, can specify revisions
540 540 without this option)
541 541 -f --force force removal of changesets, discard uncommitted changes
542 542 (no backup)
543 543 --no-backup no backups
544 544 -k --keep do not modify working copy during strip
545 545 -B --bookmark VALUE remove revs only reachable from given bookmark
546 546 --mq operate on patch repository
547 547
548 [+] marked option can be specified multiple times
549
550 548 (use "hg strip -h" to show more help)
551 549 [255]
General Comments 0
You need to be logged in to leave comments. Login now