##// END OF EJS Templates
filemerge: use revset notation for p1/p2 of local/other descriptions
timeless -
r28640:4fc640fd default
parent child Browse files
Show More
@@ -1,686 +1,686
1 1 # filemerge.py - file-level merge handling for Mercurial
2 2 #
3 3 # Copyright 2006, 2007, 2008 Matt Mackall <mpm@selenic.com>
4 4 #
5 5 # This software may be used and distributed according to the terms of the
6 6 # GNU General Public License version 2 or any later version.
7 7
8 8 from __future__ import absolute_import
9 9
10 10 import filecmp
11 11 import os
12 12 import re
13 13 import tempfile
14 14
15 15 from .i18n import _
16 16 from .node import nullid, short
17 17
18 18 from . import (
19 19 error,
20 20 match,
21 21 scmutil,
22 22 simplemerge,
23 23 tagmerge,
24 24 templatekw,
25 25 templater,
26 26 util,
27 27 )
28 28
29 29 def _toolstr(ui, tool, part, default=""):
30 30 return ui.config("merge-tools", tool + "." + part, default)
31 31
32 32 def _toolbool(ui, tool, part, default=False):
33 33 return ui.configbool("merge-tools", tool + "." + part, default)
34 34
35 35 def _toollist(ui, tool, part, default=[]):
36 36 return ui.configlist("merge-tools", tool + "." + part, default)
37 37
38 38 internals = {}
39 39 # Merge tools to document.
40 40 internalsdoc = {}
41 41
42 42 # internal tool merge types
43 43 nomerge = None
44 44 mergeonly = 'mergeonly' # just the full merge, no premerge
45 45 fullmerge = 'fullmerge' # both premerge and merge
46 46
47 47 class absentfilectx(object):
48 48 """Represents a file that's ostensibly in a context but is actually not
49 49 present in it.
50 50
51 51 This is here because it's very specific to the filemerge code for now --
52 52 other code is likely going to break with the values this returns."""
53 53 def __init__(self, ctx, f):
54 54 self._ctx = ctx
55 55 self._f = f
56 56
57 57 def path(self):
58 58 return self._f
59 59
60 60 def size(self):
61 61 return None
62 62
63 63 def data(self):
64 64 return None
65 65
66 66 def filenode(self):
67 67 return nullid
68 68
69 69 _customcmp = True
70 70 def cmp(self, fctx):
71 71 """compare with other file context
72 72
73 73 returns True if different from fctx.
74 74 """
75 75 return not (fctx.isabsent() and
76 76 fctx.ctx() == self.ctx() and
77 77 fctx.path() == self.path())
78 78
79 79 def flags(self):
80 80 return ''
81 81
82 82 def changectx(self):
83 83 return self._ctx
84 84
85 85 def isbinary(self):
86 86 return False
87 87
88 88 def isabsent(self):
89 89 return True
90 90
91 91 def internaltool(name, mergetype, onfailure=None, precheck=None):
92 92 '''return a decorator for populating internal merge tool table'''
93 93 def decorator(func):
94 94 fullname = ':' + name
95 95 func.__doc__ = "``%s``\n" % fullname + func.__doc__.strip()
96 96 internals[fullname] = func
97 97 internals['internal:' + name] = func
98 98 internalsdoc[fullname] = func
99 99 func.mergetype = mergetype
100 100 func.onfailure = onfailure
101 101 func.precheck = precheck
102 102 return func
103 103 return decorator
104 104
105 105 def _findtool(ui, tool):
106 106 if tool in internals:
107 107 return tool
108 108 return findexternaltool(ui, tool)
109 109
110 110 def findexternaltool(ui, tool):
111 111 for kn in ("regkey", "regkeyalt"):
112 112 k = _toolstr(ui, tool, kn)
113 113 if not k:
114 114 continue
115 115 p = util.lookupreg(k, _toolstr(ui, tool, "regname"))
116 116 if p:
117 117 p = util.findexe(p + _toolstr(ui, tool, "regappend"))
118 118 if p:
119 119 return p
120 120 exe = _toolstr(ui, tool, "executable", tool)
121 121 return util.findexe(util.expandpath(exe))
122 122
123 123 def _picktool(repo, ui, path, binary, symlink, changedelete):
124 124 def supportscd(tool):
125 125 return tool in internals and internals[tool].mergetype == nomerge
126 126
127 127 def check(tool, pat, symlink, binary, changedelete):
128 128 tmsg = tool
129 129 if pat:
130 130 tmsg += " specified for " + pat
131 131 if not _findtool(ui, tool):
132 132 if pat: # explicitly requested tool deserves a warning
133 133 ui.warn(_("couldn't find merge tool %s\n") % tmsg)
134 134 else: # configured but non-existing tools are more silent
135 135 ui.note(_("couldn't find merge tool %s\n") % tmsg)
136 136 elif symlink and not _toolbool(ui, tool, "symlink"):
137 137 ui.warn(_("tool %s can't handle symlinks\n") % tmsg)
138 138 elif binary and not _toolbool(ui, tool, "binary"):
139 139 ui.warn(_("tool %s can't handle binary\n") % tmsg)
140 140 elif changedelete and not supportscd(tool):
141 141 # the nomerge tools are the only tools that support change/delete
142 142 # conflicts
143 143 pass
144 144 elif not util.gui() and _toolbool(ui, tool, "gui"):
145 145 ui.warn(_("tool %s requires a GUI\n") % tmsg)
146 146 else:
147 147 return True
148 148 return False
149 149
150 150 # internal config: ui.forcemerge
151 151 # forcemerge comes from command line arguments, highest priority
152 152 force = ui.config('ui', 'forcemerge')
153 153 if force:
154 154 toolpath = _findtool(ui, force)
155 155 if changedelete and not supportscd(toolpath):
156 156 return ":prompt", None
157 157 else:
158 158 if toolpath:
159 159 return (force, util.shellquote(toolpath))
160 160 else:
161 161 # mimic HGMERGE if given tool not found
162 162 return (force, force)
163 163
164 164 # HGMERGE takes next precedence
165 165 hgmerge = os.environ.get("HGMERGE")
166 166 if hgmerge:
167 167 if changedelete and not supportscd(hgmerge):
168 168 return ":prompt", None
169 169 else:
170 170 return (hgmerge, hgmerge)
171 171
172 172 # then patterns
173 173 for pat, tool in ui.configitems("merge-patterns"):
174 174 mf = match.match(repo.root, '', [pat])
175 175 if mf(path) and check(tool, pat, symlink, False, changedelete):
176 176 toolpath = _findtool(ui, tool)
177 177 return (tool, util.shellquote(toolpath))
178 178
179 179 # then merge tools
180 180 tools = {}
181 181 disabled = set()
182 182 for k, v in ui.configitems("merge-tools"):
183 183 t = k.split('.')[0]
184 184 if t not in tools:
185 185 tools[t] = int(_toolstr(ui, t, "priority", "0"))
186 186 if _toolbool(ui, t, "disabled", False):
187 187 disabled.add(t)
188 188 names = tools.keys()
189 189 tools = sorted([(-p, t) for t, p in tools.items() if t not in disabled])
190 190 uimerge = ui.config("ui", "merge")
191 191 if uimerge:
192 192 # external tools defined in uimerge won't be able to handle
193 193 # change/delete conflicts
194 194 if uimerge not in names and not changedelete:
195 195 return (uimerge, uimerge)
196 196 tools.insert(0, (None, uimerge)) # highest priority
197 197 tools.append((None, "hgmerge")) # the old default, if found
198 198 for p, t in tools:
199 199 if check(t, None, symlink, binary, changedelete):
200 200 toolpath = _findtool(ui, t)
201 201 return (t, util.shellquote(toolpath))
202 202
203 203 # internal merge or prompt as last resort
204 204 if symlink or binary or changedelete:
205 205 return ":prompt", None
206 206 return ":merge", None
207 207
208 208 def _eoltype(data):
209 209 "Guess the EOL type of a file"
210 210 if '\0' in data: # binary
211 211 return None
212 212 if '\r\n' in data: # Windows
213 213 return '\r\n'
214 214 if '\r' in data: # Old Mac
215 215 return '\r'
216 216 if '\n' in data: # UNIX
217 217 return '\n'
218 218 return None # unknown
219 219
220 220 def _matcheol(file, origfile):
221 221 "Convert EOL markers in a file to match origfile"
222 222 tostyle = _eoltype(util.readfile(origfile))
223 223 if tostyle:
224 224 data = util.readfile(file)
225 225 style = _eoltype(data)
226 226 if style:
227 227 newdata = data.replace(style, tostyle)
228 228 if newdata != data:
229 229 util.writefile(file, newdata)
230 230
231 231 @internaltool('prompt', nomerge)
232 232 def _iprompt(repo, mynode, orig, fcd, fco, fca, toolconf):
233 """Asks the user which of the local (p1) or the other (p2) version to keep
234 as the merged version."""
233 """Asks the user which of the local `p1()` or the other `p2()` version to
234 keep as the merged version."""
235 235 ui = repo.ui
236 236 fd = fcd.path()
237 237
238 238 try:
239 239 if fco.isabsent():
240 240 index = ui.promptchoice(
241 241 _("local changed %s which remote deleted\n"
242 242 "use (c)hanged version, (d)elete, or leave (u)nresolved?"
243 243 "$$ &Changed $$ &Delete $$ &Unresolved") % fd, 2)
244 244 choice = ['local', 'other', 'unresolved'][index]
245 245 elif fcd.isabsent():
246 246 index = ui.promptchoice(
247 247 _("remote changed %s which local deleted\n"
248 248 "use (c)hanged version, leave (d)eleted, or "
249 249 "leave (u)nresolved?"
250 250 "$$ &Changed $$ &Deleted $$ &Unresolved") % fd, 2)
251 251 choice = ['other', 'local', 'unresolved'][index]
252 252 else:
253 253 index = ui.promptchoice(
254 254 _("no tool found to merge %s\n"
255 255 "keep (l)ocal, take (o)ther, or leave (u)nresolved?"
256 256 "$$ &Local $$ &Other $$ &Unresolved") % fd, 2)
257 257 choice = ['local', 'other', 'unresolved'][index]
258 258
259 259 if choice == 'other':
260 260 return _iother(repo, mynode, orig, fcd, fco, fca, toolconf)
261 261 elif choice == 'local':
262 262 return _ilocal(repo, mynode, orig, fcd, fco, fca, toolconf)
263 263 elif choice == 'unresolved':
264 264 return _ifail(repo, mynode, orig, fcd, fco, fca, toolconf)
265 265 except error.ResponseExpected:
266 266 ui.write("\n")
267 267 return _ifail(repo, mynode, orig, fcd, fco, fca, toolconf)
268 268
269 269 @internaltool('local', nomerge)
270 270 def _ilocal(repo, mynode, orig, fcd, fco, fca, toolconf):
271 """Uses the local (p1) version of files as the merged version."""
271 """Uses the local `p1()` version of files as the merged version."""
272 272 return 0, fcd.isabsent()
273 273
274 274 @internaltool('other', nomerge)
275 275 def _iother(repo, mynode, orig, fcd, fco, fca, toolconf):
276 """Uses the other (p2) version of files as the merged version."""
276 """Uses the other `p2()` version of files as the merged version."""
277 277 if fco.isabsent():
278 278 # local changed, remote deleted -- 'deleted' picked
279 279 repo.wvfs.unlinkpath(fcd.path())
280 280 deleted = True
281 281 else:
282 282 repo.wwrite(fcd.path(), fco.data(), fco.flags())
283 283 deleted = False
284 284 return 0, deleted
285 285
286 286 @internaltool('fail', nomerge)
287 287 def _ifail(repo, mynode, orig, fcd, fco, fca, toolconf):
288 288 """
289 289 Rather than attempting to merge files that were modified on both
290 290 branches, it marks them as unresolved. The resolve command must be
291 291 used to resolve these conflicts."""
292 292 # for change/delete conflicts write out the changed version, then fail
293 293 if fcd.isabsent():
294 294 repo.wwrite(fcd.path(), fco.data(), fco.flags())
295 295 return 1, False
296 296
297 297 def _premerge(repo, fcd, fco, fca, toolconf, files, labels=None):
298 298 tool, toolpath, binary, symlink = toolconf
299 299 if symlink or fcd.isabsent() or fco.isabsent():
300 300 return 1
301 301 a, b, c, back = files
302 302
303 303 ui = repo.ui
304 304
305 305 validkeep = ['keep', 'keep-merge3']
306 306
307 307 # do we attempt to simplemerge first?
308 308 try:
309 309 premerge = _toolbool(ui, tool, "premerge", not binary)
310 310 except error.ConfigError:
311 311 premerge = _toolstr(ui, tool, "premerge").lower()
312 312 if premerge not in validkeep:
313 313 _valid = ', '.join(["'" + v + "'" for v in validkeep])
314 314 raise error.ConfigError(_("%s.premerge not valid "
315 315 "('%s' is neither boolean nor %s)") %
316 316 (tool, premerge, _valid))
317 317
318 318 if premerge:
319 319 if premerge == 'keep-merge3':
320 320 if not labels:
321 321 labels = _defaultconflictlabels
322 322 if len(labels) < 3:
323 323 labels.append('base')
324 324 r = simplemerge.simplemerge(ui, a, b, c, quiet=True, label=labels)
325 325 if not r:
326 326 ui.debug(" premerge successful\n")
327 327 return 0
328 328 if premerge not in validkeep:
329 329 util.copyfile(back, a) # restore from backup and try again
330 330 return 1 # continue merging
331 331
332 332 def _mergecheck(repo, mynode, orig, fcd, fco, fca, toolconf):
333 333 tool, toolpath, binary, symlink = toolconf
334 334 if symlink:
335 335 repo.ui.warn(_('warning: internal %s cannot merge symlinks '
336 336 'for %s\n') % (tool, fcd.path()))
337 337 return False
338 338 if fcd.isabsent() or fco.isabsent():
339 339 repo.ui.warn(_('warning: internal %s cannot merge change/delete '
340 340 'conflict for %s\n') % (tool, fcd.path()))
341 341 return False
342 342 return True
343 343
344 344 def _merge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels, mode):
345 345 """
346 346 Uses the internal non-interactive simple merge algorithm for merging
347 347 files. It will fail if there are any conflicts and leave markers in
348 348 the partially merged file. Markers will have two sections, one for each side
349 349 of merge, unless mode equals 'union' which suppresses the markers."""
350 350 a, b, c, back = files
351 351
352 352 ui = repo.ui
353 353
354 354 r = simplemerge.simplemerge(ui, a, b, c, label=labels, mode=mode)
355 355 return True, r, False
356 356
357 357 @internaltool('union', fullmerge,
358 358 _("warning: conflicts while merging %s! "
359 359 "(edit, then use 'hg resolve --mark')\n"),
360 360 precheck=_mergecheck)
361 361 def _iunion(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
362 362 """
363 363 Uses the internal non-interactive simple merge algorithm for merging
364 364 files. It will use both left and right sides for conflict regions.
365 365 No markers are inserted."""
366 366 return _merge(repo, mynode, orig, fcd, fco, fca, toolconf,
367 367 files, labels, 'union')
368 368
369 369 @internaltool('merge', fullmerge,
370 370 _("warning: conflicts while merging %s! "
371 371 "(edit, then use 'hg resolve --mark')\n"),
372 372 precheck=_mergecheck)
373 373 def _imerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
374 374 """
375 375 Uses the internal non-interactive simple merge algorithm for merging
376 376 files. It will fail if there are any conflicts and leave markers in
377 377 the partially merged file. Markers will have two sections, one for each side
378 378 of merge."""
379 379 return _merge(repo, mynode, orig, fcd, fco, fca, toolconf,
380 380 files, labels, 'merge')
381 381
382 382 @internaltool('merge3', fullmerge,
383 383 _("warning: conflicts while merging %s! "
384 384 "(edit, then use 'hg resolve --mark')\n"),
385 385 precheck=_mergecheck)
386 386 def _imerge3(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
387 387 """
388 388 Uses the internal non-interactive simple merge algorithm for merging
389 389 files. It will fail if there are any conflicts and leave markers in
390 390 the partially merged file. Marker will have three sections, one from each
391 391 side of the merge and one for the base content."""
392 392 if not labels:
393 393 labels = _defaultconflictlabels
394 394 if len(labels) < 3:
395 395 labels.append('base')
396 396 return _imerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels)
397 397
398 398 def _imergeauto(repo, mynode, orig, fcd, fco, fca, toolconf, files,
399 399 labels=None, localorother=None):
400 400 """
401 401 Generic driver for _imergelocal and _imergeother
402 402 """
403 403 assert localorother is not None
404 404 tool, toolpath, binary, symlink = toolconf
405 405 a, b, c, back = files
406 406 r = simplemerge.simplemerge(repo.ui, a, b, c, label=labels,
407 407 localorother=localorother)
408 408 return True, r
409 409
410 410 @internaltool('merge-local', mergeonly, precheck=_mergecheck)
411 411 def _imergelocal(*args, **kwargs):
412 412 """
413 413 Like :merge, but resolve all conflicts non-interactively in favor
414 of the local (p1) changes."""
414 of the local `p1()` changes."""
415 415 success, status = _imergeauto(localorother='local', *args, **kwargs)
416 416 return success, status, False
417 417
418 418 @internaltool('merge-other', mergeonly, precheck=_mergecheck)
419 419 def _imergeother(*args, **kwargs):
420 420 """
421 421 Like :merge, but resolve all conflicts non-interactively in favor
422 of the other (p2) changes."""
422 of the other `p2()` changes."""
423 423 success, status = _imergeauto(localorother='other', *args, **kwargs)
424 424 return success, status, False
425 425
426 426 @internaltool('tagmerge', mergeonly,
427 427 _("automatic tag merging of %s failed! "
428 428 "(use 'hg resolve --tool :merge' or another merge "
429 429 "tool of your choice)\n"))
430 430 def _itagmerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
431 431 """
432 432 Uses the internal tag merge algorithm (experimental).
433 433 """
434 434 success, status = tagmerge.merge(repo, fcd, fco, fca)
435 435 return success, status, False
436 436
437 437 @internaltool('dump', fullmerge)
438 438 def _idump(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
439 439 """
440 440 Creates three versions of the files to merge, containing the
441 441 contents of local, other and base. These files can then be used to
442 442 perform a merge manually. If the file to be merged is named
443 443 ``a.txt``, these files will accordingly be named ``a.txt.local``,
444 444 ``a.txt.other`` and ``a.txt.base`` and they will be placed in the
445 445 same directory as ``a.txt``."""
446 446 a, b, c, back = files
447 447
448 448 fd = fcd.path()
449 449
450 450 util.copyfile(a, a + ".local")
451 451 repo.wwrite(fd + ".other", fco.data(), fco.flags())
452 452 repo.wwrite(fd + ".base", fca.data(), fca.flags())
453 453 return False, 1, False
454 454
455 455 def _xmerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
456 456 tool, toolpath, binary, symlink = toolconf
457 457 if fcd.isabsent() or fco.isabsent():
458 458 repo.ui.warn(_('warning: %s cannot merge change/delete conflict '
459 459 'for %s\n') % (tool, fcd.path()))
460 460 return False, 1, None
461 461 a, b, c, back = files
462 462 out = ""
463 463 env = {'HG_FILE': fcd.path(),
464 464 'HG_MY_NODE': short(mynode),
465 465 'HG_OTHER_NODE': str(fco.changectx()),
466 466 'HG_BASE_NODE': str(fca.changectx()),
467 467 'HG_MY_ISLINK': 'l' in fcd.flags(),
468 468 'HG_OTHER_ISLINK': 'l' in fco.flags(),
469 469 'HG_BASE_ISLINK': 'l' in fca.flags(),
470 470 }
471 471
472 472 ui = repo.ui
473 473
474 474 args = _toolstr(ui, tool, "args", '$local $base $other')
475 475 if "$output" in args:
476 476 out, a = a, back # read input from backup, write to original
477 477 replace = {'local': a, 'base': b, 'other': c, 'output': out}
478 478 args = util.interpolate(r'\$', replace, args,
479 479 lambda s: util.shellquote(util.localpath(s)))
480 480 cmd = toolpath + ' ' + args
481 481 repo.ui.debug('launching merge tool: %s\n' % cmd)
482 482 r = ui.system(cmd, cwd=repo.root, environ=env)
483 483 repo.ui.debug('merge tool returned: %s\n' % r)
484 484 return True, r, False
485 485
486 486 def _formatconflictmarker(repo, ctx, template, label, pad):
487 487 """Applies the given template to the ctx, prefixed by the label.
488 488
489 489 Pad is the minimum width of the label prefix, so that multiple markers
490 490 can have aligned templated parts.
491 491 """
492 492 if ctx.node() is None:
493 493 ctx = ctx.p1()
494 494
495 495 props = templatekw.keywords.copy()
496 496 props['templ'] = template
497 497 props['ctx'] = ctx
498 498 props['repo'] = repo
499 499 templateresult = template('conflictmarker', **props)
500 500
501 501 label = ('%s:' % label).ljust(pad + 1)
502 502 mark = '%s %s' % (label, templater.stringify(templateresult))
503 503
504 504 if mark:
505 505 mark = mark.splitlines()[0] # split for safety
506 506
507 507 # 8 for the prefix of conflict marker lines (e.g. '<<<<<<< ')
508 508 return util.ellipsis(mark, 80 - 8)
509 509
510 510 _defaultconflictmarker = ('{node|short} ' +
511 511 '{ifeq(tags, "tip", "", "{tags} ")}' +
512 512 '{if(bookmarks, "{bookmarks} ")}' +
513 513 '{ifeq(branch, "default", "", "{branch} ")}' +
514 514 '- {author|user}: {desc|firstline}')
515 515
516 516 _defaultconflictlabels = ['local', 'other']
517 517
518 518 def _formatlabels(repo, fcd, fco, fca, labels):
519 519 """Formats the given labels using the conflict marker template.
520 520
521 521 Returns a list of formatted labels.
522 522 """
523 523 cd = fcd.changectx()
524 524 co = fco.changectx()
525 525 ca = fca.changectx()
526 526
527 527 ui = repo.ui
528 528 template = ui.config('ui', 'mergemarkertemplate', _defaultconflictmarker)
529 529 tmpl = templater.templater(None, cache={'conflictmarker': template})
530 530
531 531 pad = max(len(l) for l in labels)
532 532
533 533 newlabels = [_formatconflictmarker(repo, cd, tmpl, labels[0], pad),
534 534 _formatconflictmarker(repo, co, tmpl, labels[1], pad)]
535 535 if len(labels) > 2:
536 536 newlabels.append(_formatconflictmarker(repo, ca, tmpl, labels[2], pad))
537 537 return newlabels
538 538
539 539 def _filemerge(premerge, repo, mynode, orig, fcd, fco, fca, labels=None):
540 540 """perform a 3-way merge in the working directory
541 541
542 542 premerge = whether this is a premerge
543 543 mynode = parent node before merge
544 544 orig = original local filename before merge
545 545 fco = other file context
546 546 fca = ancestor file context
547 547 fcd = local file context for current/destination file
548 548
549 549 Returns whether the merge is complete, the return value of the merge, and
550 550 a boolean indicating whether the file was deleted from disk."""
551 551
552 552 def temp(prefix, ctx):
553 553 pre = "%s~%s." % (os.path.basename(ctx.path()), prefix)
554 554 (fd, name) = tempfile.mkstemp(prefix=pre)
555 555 data = repo.wwritedata(ctx.path(), ctx.data())
556 556 f = os.fdopen(fd, "wb")
557 557 f.write(data)
558 558 f.close()
559 559 return name
560 560
561 561 if not fco.cmp(fcd): # files identical?
562 562 return True, None, False
563 563
564 564 ui = repo.ui
565 565 fd = fcd.path()
566 566 binary = fcd.isbinary() or fco.isbinary() or fca.isbinary()
567 567 symlink = 'l' in fcd.flags() + fco.flags()
568 568 changedelete = fcd.isabsent() or fco.isabsent()
569 569 tool, toolpath = _picktool(repo, ui, fd, binary, symlink, changedelete)
570 570 if tool in internals and tool.startswith('internal:'):
571 571 # normalize to new-style names (':merge' etc)
572 572 tool = tool[len('internal'):]
573 573 ui.debug("picked tool '%s' for %s (binary %s symlink %s changedelete %s)\n"
574 574 % (tool, fd, binary, symlink, changedelete))
575 575
576 576 if tool in internals:
577 577 func = internals[tool]
578 578 mergetype = func.mergetype
579 579 onfailure = func.onfailure
580 580 precheck = func.precheck
581 581 else:
582 582 func = _xmerge
583 583 mergetype = fullmerge
584 584 onfailure = _("merging %s failed!\n")
585 585 precheck = None
586 586
587 587 toolconf = tool, toolpath, binary, symlink
588 588
589 589 if mergetype == nomerge:
590 590 r, deleted = func(repo, mynode, orig, fcd, fco, fca, toolconf)
591 591 return True, r, deleted
592 592
593 593 if premerge:
594 594 if orig != fco.path():
595 595 ui.status(_("merging %s and %s to %s\n") % (orig, fco.path(), fd))
596 596 else:
597 597 ui.status(_("merging %s\n") % fd)
598 598
599 599 ui.debug("my %s other %s ancestor %s\n" % (fcd, fco, fca))
600 600
601 601 if precheck and not precheck(repo, mynode, orig, fcd, fco, fca,
602 602 toolconf):
603 603 if onfailure:
604 604 ui.warn(onfailure % fd)
605 605 return True, 1, False
606 606
607 607 a = repo.wjoin(fd)
608 608 b = temp("base", fca)
609 609 c = temp("other", fco)
610 610 if not fcd.isabsent():
611 611 back = scmutil.origpath(ui, repo, a)
612 612 if premerge:
613 613 util.copyfile(a, back)
614 614 else:
615 615 back = None
616 616 files = (a, b, c, back)
617 617
618 618 r = 1
619 619 try:
620 620 markerstyle = ui.config('ui', 'mergemarkers', 'basic')
621 621 if not labels:
622 622 labels = _defaultconflictlabels
623 623 if markerstyle != 'basic':
624 624 labels = _formatlabels(repo, fcd, fco, fca, labels)
625 625
626 626 if premerge and mergetype == fullmerge:
627 627 r = _premerge(repo, fcd, fco, fca, toolconf, files, labels=labels)
628 628 # complete if premerge successful (r is 0)
629 629 return not r, r, False
630 630
631 631 needcheck, r, deleted = func(repo, mynode, orig, fcd, fco, fca,
632 632 toolconf, files, labels=labels)
633 633
634 634 if needcheck:
635 635 r = _check(r, ui, tool, fcd, files)
636 636
637 637 if r:
638 638 if onfailure:
639 639 ui.warn(onfailure % fd)
640 640
641 641 return True, r, deleted
642 642 finally:
643 643 if not r and back is not None:
644 644 util.unlink(back)
645 645 util.unlink(b)
646 646 util.unlink(c)
647 647
648 648 def _check(r, ui, tool, fcd, files):
649 649 fd = fcd.path()
650 650 a, b, c, back = files
651 651
652 652 if not r and (_toolbool(ui, tool, "checkconflicts") or
653 653 'conflicts' in _toollist(ui, tool, "check")):
654 654 if re.search("^(<<<<<<< .*|=======|>>>>>>> .*)$", fcd.data(),
655 655 re.MULTILINE):
656 656 r = 1
657 657
658 658 checked = False
659 659 if 'prompt' in _toollist(ui, tool, "check"):
660 660 checked = True
661 661 if ui.promptchoice(_("was merge of '%s' successful (yn)?"
662 662 "$$ &Yes $$ &No") % fd, 1):
663 663 r = 1
664 664
665 665 if not r and not checked and (_toolbool(ui, tool, "checkchanged") or
666 666 'changed' in
667 667 _toollist(ui, tool, "check")):
668 668 if back is not None and filecmp.cmp(a, back):
669 669 if ui.promptchoice(_(" output file %s appears unchanged\n"
670 670 "was merge successful (yn)?"
671 671 "$$ &Yes $$ &No") % fd, 1):
672 672 r = 1
673 673
674 674 if back is not None and _toolbool(ui, tool, "fixeol"):
675 675 _matcheol(a, back)
676 676
677 677 return r
678 678
679 679 def premerge(repo, mynode, orig, fcd, fco, fca, labels=None):
680 680 return _filemerge(True, repo, mynode, orig, fcd, fco, fca, labels=labels)
681 681
682 682 def filemerge(repo, mynode, orig, fcd, fco, fca, labels=None):
683 683 return _filemerge(False, repo, mynode, orig, fcd, fco, fca, labels=labels)
684 684
685 685 # tell hggettext to extract docstrings from these functions:
686 686 i18nfunctions = internals.values()
@@ -1,3005 +1,3005
1 1 Short help:
2 2
3 3 $ hg
4 4 Mercurial Distributed SCM
5 5
6 6 basic commands:
7 7
8 8 add add the specified files on the next commit
9 9 annotate show changeset information by line for each file
10 10 clone make a copy of an existing repository
11 11 commit commit the specified files or all outstanding changes
12 12 diff diff repository (or selected files)
13 13 export dump the header and diffs for one or more changesets
14 14 forget forget the specified files on the next commit
15 15 init create a new repository in the given directory
16 16 log show revision history of entire repository or files
17 17 merge merge another revision into working directory
18 18 pull pull changes from the specified source
19 19 push push changes to the specified destination
20 20 remove remove the specified files on the next commit
21 21 serve start stand-alone webserver
22 22 status show changed files in the working directory
23 23 summary summarize working directory state
24 24 update update working directory (or switch revisions)
25 25
26 26 (use "hg help" for the full list of commands or "hg -v" for details)
27 27
28 28 $ hg -q
29 29 add add the specified files on the next commit
30 30 annotate show changeset information by line for each file
31 31 clone make a copy of an existing repository
32 32 commit commit the specified files or all outstanding changes
33 33 diff diff repository (or selected files)
34 34 export dump the header and diffs for one or more changesets
35 35 forget forget the specified files on the next commit
36 36 init create a new repository in the given directory
37 37 log show revision history of entire repository or files
38 38 merge merge another revision into working directory
39 39 pull pull changes from the specified source
40 40 push push changes to the specified destination
41 41 remove remove the specified files on the next commit
42 42 serve start stand-alone webserver
43 43 status show changed files in the working directory
44 44 summary summarize working directory state
45 45 update update working directory (or switch revisions)
46 46
47 47 $ 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 files list tracked files
70 70 forget forget the specified files on the next commit
71 71 graft copy changes from other branches onto the current branch
72 72 grep search for a pattern in specified files and revisions
73 73 heads show branch heads
74 74 help show help for a given topic or a help overview
75 75 identify identify the working directory or specified revision
76 76 import import an ordered set of patches
77 77 incoming show new changesets found in source
78 78 init create a new repository in the given directory
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 another revision into working directory
82 82 outgoing show changesets not found in the destination
83 83 paths show aliases for remote repositories
84 84 phase set or show the current phase name
85 85 pull pull changes from the specified source
86 86 push push changes to the specified destination
87 87 recover roll back an interrupted transaction
88 88 remove remove the specified files on the next commit
89 89 rename rename files; equivalent of copy + remove
90 90 resolve redo merges or set/view the merge status of files
91 91 revert restore files to their checkout state
92 92 root print the root (top) of the current working directory
93 93 serve start stand-alone webserver
94 94 status show changed files in the working directory
95 95 summary summarize working directory state
96 96 tag add one or more tags for the current or given revision
97 97 tags list repository tags
98 98 unbundle apply one or more changegroup files
99 99 update update working directory (or switch revisions)
100 100 verify verify the integrity of the repository
101 101 version output version and copyright information
102 102
103 103 additional help topics:
104 104
105 105 config Configuration Files
106 106 dates Date Formats
107 107 diffs Diff Formats
108 108 environment Environment Variables
109 109 extensions Using Additional Features
110 110 filesets Specifying File Sets
111 111 glossary Glossary
112 112 hgignore Syntax for Mercurial Ignore Files
113 113 hgweb Configuring hgweb
114 114 internals Technical implementation topics
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 scripting Using Mercurial from scripts and automation
122 122 subrepos Subrepositories
123 123 templating Template Usage
124 124 urls URL Paths
125 125
126 126 (use "hg help -v" to show built-in aliases and global options)
127 127
128 128 $ hg -q help
129 129 add add the specified files on the next commit
130 130 addremove add all new files, delete all missing files
131 131 annotate show changeset information by line for each file
132 132 archive create an unversioned archive of a repository revision
133 133 backout reverse effect of earlier changeset
134 134 bisect subdivision search of changesets
135 135 bookmarks create a new bookmark or list existing bookmarks
136 136 branch set or show the current branch name
137 137 branches list repository named branches
138 138 bundle create a changegroup file
139 139 cat output the current or given revision of files
140 140 clone make a copy of an existing repository
141 141 commit commit the specified files or all outstanding changes
142 142 config show combined config settings from all hgrc files
143 143 copy mark files as copied for the next commit
144 144 diff diff repository (or selected files)
145 145 export dump the header and diffs for one or more changesets
146 146 files list tracked files
147 147 forget forget the specified files on the next commit
148 148 graft copy changes from other branches onto the current branch
149 149 grep search for a pattern in specified files and revisions
150 150 heads show branch heads
151 151 help show help for a given topic or a help overview
152 152 identify identify the working directory or specified revision
153 153 import import an ordered set of patches
154 154 incoming show new changesets found in source
155 155 init create a new repository in the given directory
156 156 log show revision history of entire repository or files
157 157 manifest output the current or given revision of the project manifest
158 158 merge merge another revision into working directory
159 159 outgoing show changesets not found in the destination
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 internals Technical implementation topics
192 192 merge-tools Merge Tools
193 193 multirevs Specifying Multiple Revisions
194 194 patterns File Name Patterns
195 195 phases Working with Phases
196 196 revisions Specifying Single Revisions
197 197 revsets Specifying Revision Sets
198 198 scripting Using Mercurial from scripts and automation
199 199 subrepos Subrepositories
200 200 templating Template Usage
201 201 urls URL Paths
202 202
203 203 Test extension help:
204 204 $ hg help extensions --config extensions.rebase= --config extensions.children=
205 205 Using Additional Features
206 206 """""""""""""""""""""""""
207 207
208 208 Mercurial has the ability to add new features through the use of
209 209 extensions. Extensions may add new commands, add options to existing
210 210 commands, change the default behavior of commands, or implement hooks.
211 211
212 212 To enable the "foo" extension, either shipped with Mercurial or in the
213 213 Python search path, create an entry for it in your configuration file,
214 214 like this:
215 215
216 216 [extensions]
217 217 foo =
218 218
219 219 You may also specify the full path to an extension:
220 220
221 221 [extensions]
222 222 myfeature = ~/.hgext/myfeature.py
223 223
224 224 See 'hg help config' for more information on configuration files.
225 225
226 226 Extensions are not loaded by default for a variety of reasons: they can
227 227 increase startup overhead; they may be meant for advanced usage only; they
228 228 may provide potentially dangerous abilities (such as letting you destroy
229 229 or modify history); they might not be ready for prime time; or they may
230 230 alter some usual behaviors of stock Mercurial. It is thus up to the user
231 231 to activate extensions as needed.
232 232
233 233 To explicitly disable an extension enabled in a configuration file of
234 234 broader scope, prepend its path with !:
235 235
236 236 [extensions]
237 237 # disabling extension bar residing in /path/to/extension/bar.py
238 238 bar = !/path/to/extension/bar.py
239 239 # ditto, but no path was supplied for extension baz
240 240 baz = !
241 241
242 242 enabled extensions:
243 243
244 244 chgserver command server extension for cHg (EXPERIMENTAL) (?)
245 245 children command to display child changesets (DEPRECATED)
246 246 rebase command to move sets of revisions to a different ancestor
247 247
248 248 disabled extensions:
249 249
250 250 acl hooks for controlling repository access
251 251 blackbox log repository events to a blackbox for debugging
252 252 bugzilla hooks for integrating with the Bugzilla bug tracker
253 253 censor erase file content at a given revision
254 254 churn command to display statistics about repository history
255 255 clonebundles advertise pre-generated bundles to seed clones
256 256 color colorize output from some commands
257 257 convert import revisions from foreign VCS repositories into
258 258 Mercurial
259 259 eol automatically manage newlines in repository files
260 260 extdiff command to allow external programs to compare revisions
261 261 factotum http authentication with factotum
262 262 gpg commands to sign and verify changesets
263 263 hgcia hooks for integrating with the CIA.vc notification service
264 264 hgk browse the repository in a graphical way
265 265 highlight syntax highlighting for hgweb (requires Pygments)
266 266 histedit interactive history editing
267 267 keyword expand keywords in tracked files
268 268 largefiles track large binary files
269 269 mq manage a stack of patches
270 270 notify hooks for sending email push notifications
271 271 pager browse command output with an external pager
272 272 patchbomb command to send changesets as (a series of) patch emails
273 273 purge command to delete untracked files from the working
274 274 directory
275 275 record commands to interactively select changes for
276 276 commit/qrefresh
277 277 relink recreates hardlinks between repository clones
278 278 schemes extend schemes with shortcuts to repository swarms
279 279 share share a common history between several working directories
280 280 shelve save and restore changes to the working directory
281 281 strip strip changesets and their descendants from history
282 282 transplant command to transplant changesets from another branch
283 283 win32mbcs allow the use of MBCS paths with problematic encodings
284 284 zeroconf discover and advertise repositories on the local network
285 285
286 286 Verify that extension keywords appear in help templates
287 287
288 288 $ hg help --config extensions.transplant= templating|grep transplant > /dev/null
289 289
290 290 Test short command list with verbose option
291 291
292 292 $ hg -v help shortlist
293 293 Mercurial Distributed SCM
294 294
295 295 basic commands:
296 296
297 297 add add the specified files on the next commit
298 298 annotate, blame
299 299 show changeset information by line for each file
300 300 clone make a copy of an existing repository
301 301 commit, ci commit the specified files or all outstanding changes
302 302 diff diff repository (or selected files)
303 303 export dump the header and diffs for one or more changesets
304 304 forget forget the specified files on the next commit
305 305 init create a new repository in the given directory
306 306 log, history show revision history of entire repository or files
307 307 merge merge another revision into working directory
308 308 pull pull changes from the specified source
309 309 push push changes to the specified destination
310 310 remove, rm remove the specified files on the next commit
311 311 serve start stand-alone webserver
312 312 status, st show changed files in the working directory
313 313 summary, sum summarize working directory state
314 314 update, up, checkout, co
315 315 update working directory (or switch revisions)
316 316
317 317 global options ([+] can be repeated):
318 318
319 319 -R --repository REPO repository root directory or name of overlay bundle
320 320 file
321 321 --cwd DIR change working directory
322 322 -y --noninteractive do not prompt, automatically pick the first choice for
323 323 all prompts
324 324 -q --quiet suppress output
325 325 -v --verbose enable additional output
326 326 --config CONFIG [+] set/override config option (use 'section.name=value')
327 327 --debug enable debugging output
328 328 --debugger start debugger
329 329 --encoding ENCODE set the charset encoding (default: ascii)
330 330 --encodingmode MODE set the charset encoding mode (default: strict)
331 331 --traceback always print a traceback on exception
332 332 --time time how long the command takes
333 333 --profile print command execution profile
334 334 --version output version information and exit
335 335 -h --help display help and exit
336 336 --hidden consider hidden changesets
337 337
338 338 (use "hg help" for the full list of commands)
339 339
340 340 $ hg add -h
341 341 hg add [OPTION]... [FILE]...
342 342
343 343 add the specified files on the next commit
344 344
345 345 Schedule files to be version controlled and added to the repository.
346 346
347 347 The files will be added to the repository at the next commit. To undo an
348 348 add before that, see 'hg forget'.
349 349
350 350 If no names are given, add all files to the repository (except files
351 351 matching ".hgignore").
352 352
353 353 Returns 0 if all files are successfully added.
354 354
355 355 options ([+] can be repeated):
356 356
357 357 -I --include PATTERN [+] include names matching the given patterns
358 358 -X --exclude PATTERN [+] exclude names matching the given patterns
359 359 -S --subrepos recurse into subrepositories
360 360 -n --dry-run do not perform actions, just print output
361 361
362 362 (some details hidden, use --verbose to show complete help)
363 363
364 364 Verbose help for add
365 365
366 366 $ hg add -hv
367 367 hg add [OPTION]... [FILE]...
368 368
369 369 add the specified files on the next commit
370 370
371 371 Schedule files to be version controlled and added to the repository.
372 372
373 373 The files will be added to the repository at the next commit. To undo an
374 374 add before that, see 'hg forget'.
375 375
376 376 If no names are given, add all files to the repository (except files
377 377 matching ".hgignore").
378 378
379 379 Examples:
380 380
381 381 - New (unknown) files are added automatically by 'hg add':
382 382
383 383 $ ls
384 384 foo.c
385 385 $ hg status
386 386 ? foo.c
387 387 $ hg add
388 388 adding foo.c
389 389 $ hg status
390 390 A foo.c
391 391
392 392 - Specific files to be added can be specified:
393 393
394 394 $ ls
395 395 bar.c foo.c
396 396 $ hg status
397 397 ? bar.c
398 398 ? foo.c
399 399 $ hg add bar.c
400 400 $ hg status
401 401 A bar.c
402 402 ? foo.c
403 403
404 404 Returns 0 if all files are successfully added.
405 405
406 406 options ([+] can be repeated):
407 407
408 408 -I --include PATTERN [+] include names matching the given patterns
409 409 -X --exclude PATTERN [+] exclude names matching the given patterns
410 410 -S --subrepos recurse into subrepositories
411 411 -n --dry-run do not perform actions, just print output
412 412
413 413 global options ([+] can be repeated):
414 414
415 415 -R --repository REPO repository root directory or name of overlay bundle
416 416 file
417 417 --cwd DIR change working directory
418 418 -y --noninteractive do not prompt, automatically pick the first choice for
419 419 all prompts
420 420 -q --quiet suppress output
421 421 -v --verbose enable additional output
422 422 --config CONFIG [+] set/override config option (use 'section.name=value')
423 423 --debug enable debugging output
424 424 --debugger start debugger
425 425 --encoding ENCODE set the charset encoding (default: ascii)
426 426 --encodingmode MODE set the charset encoding mode (default: strict)
427 427 --traceback always print a traceback on exception
428 428 --time time how long the command takes
429 429 --profile print command execution profile
430 430 --version output version information and exit
431 431 -h --help display help and exit
432 432 --hidden consider hidden changesets
433 433
434 434 Test help option with version option
435 435
436 436 $ hg add -h --version
437 437 Mercurial Distributed SCM (version *) (glob)
438 438 (see https://mercurial-scm.org for more information)
439 439
440 440 Copyright (C) 2005-2016 Matt Mackall and others
441 441 This is free software; see the source for copying conditions. There is NO
442 442 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
443 443
444 444 $ hg add --skjdfks
445 445 hg add: option --skjdfks not recognized
446 446 hg add [OPTION]... [FILE]...
447 447
448 448 add the specified files on the next commit
449 449
450 450 options ([+] can be repeated):
451 451
452 452 -I --include PATTERN [+] include names matching the given patterns
453 453 -X --exclude PATTERN [+] exclude names matching the given patterns
454 454 -S --subrepos recurse into subrepositories
455 455 -n --dry-run do not perform actions, just print output
456 456
457 457 (use "hg add -h" to show more help)
458 458 [255]
459 459
460 460 Test ambiguous command help
461 461
462 462 $ hg help ad
463 463 list of commands:
464 464
465 465 add add the specified files on the next commit
466 466 addremove add all new files, delete all missing files
467 467
468 468 (use "hg help -v ad" to show built-in aliases and global options)
469 469
470 470 Test command without options
471 471
472 472 $ hg help verify
473 473 hg verify
474 474
475 475 verify the integrity of the repository
476 476
477 477 Verify the integrity of the current repository.
478 478
479 479 This will perform an extensive check of the repository's integrity,
480 480 validating the hashes and checksums of each entry in the changelog,
481 481 manifest, and tracked files, as well as the integrity of their crosslinks
482 482 and indices.
483 483
484 484 Please see https://mercurial-scm.org/wiki/RepositoryCorruption for more
485 485 information about recovery from corruption of the repository.
486 486
487 487 Returns 0 on success, 1 if errors are encountered.
488 488
489 489 (some details hidden, use --verbose to show complete help)
490 490
491 491 $ hg help diff
492 492 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
493 493
494 494 diff repository (or selected files)
495 495
496 496 Show differences between revisions for the specified files.
497 497
498 498 Differences between files are shown using the unified diff format.
499 499
500 500 Note:
501 501 'hg diff' may generate unexpected results for merges, as it will
502 502 default to comparing against the working directory's first parent
503 503 changeset if no revisions are specified.
504 504
505 505 When two revision arguments are given, then changes are shown between
506 506 those revisions. If only one revision is specified then that revision is
507 507 compared to the working directory, and, when no revisions are specified,
508 508 the working directory files are compared to its first parent.
509 509
510 510 Alternatively you can specify -c/--change with a revision to see the
511 511 changes in that changeset relative to its first parent.
512 512
513 513 Without the -a/--text option, diff will avoid generating diffs of files it
514 514 detects as binary. With -a, diff will generate a diff anyway, probably
515 515 with undesirable results.
516 516
517 517 Use the -g/--git option to generate diffs in the git extended diff format.
518 518 For more information, read 'hg help diffs'.
519 519
520 520 Returns 0 on success.
521 521
522 522 options ([+] can be repeated):
523 523
524 524 -r --rev REV [+] revision
525 525 -c --change REV change made by revision
526 526 -a --text treat all files as text
527 527 -g --git use git extended diff format
528 528 --nodates omit dates from diff headers
529 529 --noprefix omit a/ and b/ prefixes from filenames
530 530 -p --show-function show which function each change is in
531 531 --reverse produce a diff that undoes the changes
532 532 -w --ignore-all-space ignore white space when comparing lines
533 533 -b --ignore-space-change ignore changes in the amount of white space
534 534 -B --ignore-blank-lines ignore changes whose lines are all blank
535 535 -U --unified NUM number of lines of context to show
536 536 --stat output diffstat-style summary of changes
537 537 --root DIR produce diffs relative to subdirectory
538 538 -I --include PATTERN [+] include names matching the given patterns
539 539 -X --exclude PATTERN [+] exclude names matching the given patterns
540 540 -S --subrepos recurse into subrepositories
541 541
542 542 (some details hidden, use --verbose to show complete help)
543 543
544 544 $ hg help status
545 545 hg status [OPTION]... [FILE]...
546 546
547 547 aliases: st
548 548
549 549 show changed files in the working directory
550 550
551 551 Show status of files in the repository. If names are given, only files
552 552 that match are shown. Files that are clean or ignored or the source of a
553 553 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
554 554 -C/--copies or -A/--all are given. Unless options described with "show
555 555 only ..." are given, the options -mardu are used.
556 556
557 557 Option -q/--quiet hides untracked (unknown and ignored) files unless
558 558 explicitly requested with -u/--unknown or -i/--ignored.
559 559
560 560 Note:
561 561 'hg status' may appear to disagree with diff if permissions have
562 562 changed or a merge has occurred. The standard diff format does not
563 563 report permission changes and diff only reports changes relative to one
564 564 merge parent.
565 565
566 566 If one revision is given, it is used as the base revision. If two
567 567 revisions are given, the differences between them are shown. The --change
568 568 option can also be used as a shortcut to list the changed files of a
569 569 revision from its first parent.
570 570
571 571 The codes used to show the status of files are:
572 572
573 573 M = modified
574 574 A = added
575 575 R = removed
576 576 C = clean
577 577 ! = missing (deleted by non-hg command, but still tracked)
578 578 ? = not tracked
579 579 I = ignored
580 580 = origin of the previous file (with --copies)
581 581
582 582 Returns 0 on success.
583 583
584 584 options ([+] can be repeated):
585 585
586 586 -A --all show status of all files
587 587 -m --modified show only modified files
588 588 -a --added show only added files
589 589 -r --removed show only removed files
590 590 -d --deleted show only deleted (but tracked) files
591 591 -c --clean show only files without changes
592 592 -u --unknown show only unknown (not tracked) files
593 593 -i --ignored show only ignored files
594 594 -n --no-status hide status prefix
595 595 -C --copies show source of copied files
596 596 -0 --print0 end filenames with NUL, for use with xargs
597 597 --rev REV [+] show difference from revision
598 598 --change REV list the changed files of a revision
599 599 -I --include PATTERN [+] include names matching the given patterns
600 600 -X --exclude PATTERN [+] exclude names matching the given patterns
601 601 -S --subrepos recurse into subrepositories
602 602
603 603 (some details hidden, use --verbose to show complete help)
604 604
605 605 $ hg -q help status
606 606 hg status [OPTION]... [FILE]...
607 607
608 608 show changed files in the working directory
609 609
610 610 $ hg help foo
611 611 abort: no such help topic: foo
612 612 (try "hg help --keyword foo")
613 613 [255]
614 614
615 615 $ hg skjdfks
616 616 hg: unknown command 'skjdfks'
617 617 Mercurial Distributed SCM
618 618
619 619 basic commands:
620 620
621 621 add add the specified files on the next commit
622 622 annotate show changeset information by line for each file
623 623 clone make a copy of an existing repository
624 624 commit commit the specified files or all outstanding changes
625 625 diff diff repository (or selected files)
626 626 export dump the header and diffs for one or more changesets
627 627 forget forget the specified files on the next commit
628 628 init create a new repository in the given directory
629 629 log show revision history of entire repository or files
630 630 merge merge another revision into working directory
631 631 pull pull changes from the specified source
632 632 push push changes to the specified destination
633 633 remove remove the specified files on the next commit
634 634 serve start stand-alone webserver
635 635 status show changed files in the working directory
636 636 summary summarize working directory state
637 637 update update working directory (or switch revisions)
638 638
639 639 (use "hg help" for the full list of commands or "hg -v" for details)
640 640 [255]
641 641
642 642
643 643 Make sure that we don't run afoul of the help system thinking that
644 644 this is a section and erroring out weirdly.
645 645
646 646 $ hg .log
647 647 hg: unknown command '.log'
648 648 (did you mean log?)
649 649 [255]
650 650
651 651 $ hg log.
652 652 hg: unknown command 'log.'
653 653 (did you mean log?)
654 654 [255]
655 655 $ hg pu.lh
656 656 hg: unknown command 'pu.lh'
657 657 (did you mean one of pull, push?)
658 658 [255]
659 659
660 660 $ cat > helpext.py <<EOF
661 661 > import os
662 662 > from mercurial import cmdutil, commands
663 663 >
664 664 > cmdtable = {}
665 665 > command = cmdutil.command(cmdtable)
666 666 >
667 667 > @command('nohelp',
668 668 > [('', 'longdesc', 3, 'x'*90),
669 669 > ('n', '', None, 'normal desc'),
670 670 > ('', 'newline', '', 'line1\nline2')],
671 671 > 'hg nohelp',
672 672 > norepo=True)
673 673 > @command('debugoptDEP', [('', 'dopt', None, 'option is (DEPRECATED)')])
674 674 > @command('debugoptEXP', [('', 'eopt', None, 'option is (EXPERIMENTAL)')])
675 675 > def nohelp(ui, *args, **kwargs):
676 676 > pass
677 677 >
678 678 > EOF
679 679 $ echo '[extensions]' >> $HGRCPATH
680 680 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
681 681
682 682 Test command with no help text
683 683
684 684 $ hg help nohelp
685 685 hg nohelp
686 686
687 687 (no help text available)
688 688
689 689 options:
690 690
691 691 --longdesc VALUE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
692 692 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (default: 3)
693 693 -n -- normal desc
694 694 --newline VALUE line1 line2
695 695
696 696 (some details hidden, use --verbose to show complete help)
697 697
698 698 $ hg help -k nohelp
699 699 Commands:
700 700
701 701 nohelp hg nohelp
702 702
703 703 Extension Commands:
704 704
705 705 nohelp (no help text available)
706 706
707 707 Test that default list of commands omits extension commands
708 708
709 709 $ hg help
710 710 Mercurial Distributed SCM
711 711
712 712 list of commands:
713 713
714 714 add add the specified files on the next commit
715 715 addremove add all new files, delete all missing files
716 716 annotate show changeset information by line for each file
717 717 archive create an unversioned archive of a repository revision
718 718 backout reverse effect of earlier changeset
719 719 bisect subdivision search of changesets
720 720 bookmarks create a new bookmark or list existing bookmarks
721 721 branch set or show the current branch name
722 722 branches list repository named branches
723 723 bundle create a changegroup file
724 724 cat output the current or given revision of files
725 725 clone make a copy of an existing repository
726 726 commit commit the specified files or all outstanding changes
727 727 config show combined config settings from all hgrc files
728 728 copy mark files as copied for the next commit
729 729 diff diff repository (or selected files)
730 730 export dump the header and diffs for one or more changesets
731 731 files list tracked files
732 732 forget forget the specified files on the next commit
733 733 graft copy changes from other branches onto the current branch
734 734 grep search for a pattern in specified files and revisions
735 735 heads show branch heads
736 736 help show help for a given topic or a help overview
737 737 identify identify the working directory or specified revision
738 738 import import an ordered set of patches
739 739 incoming show new changesets found in source
740 740 init create a new repository in the given directory
741 741 log show revision history of entire repository or files
742 742 manifest output the current or given revision of the project manifest
743 743 merge merge another revision into working directory
744 744 outgoing show changesets not found in the destination
745 745 paths show aliases for remote repositories
746 746 phase set or show the current phase name
747 747 pull pull changes from the specified source
748 748 push push changes to the specified destination
749 749 recover roll back an interrupted transaction
750 750 remove remove the specified files on the next commit
751 751 rename rename files; equivalent of copy + remove
752 752 resolve redo merges or set/view the merge status of files
753 753 revert restore files to their checkout state
754 754 root print the root (top) of the current working directory
755 755 serve start stand-alone webserver
756 756 status show changed files in the working directory
757 757 summary summarize working directory state
758 758 tag add one or more tags for the current or given revision
759 759 tags list repository tags
760 760 unbundle apply one or more changegroup files
761 761 update update working directory (or switch revisions)
762 762 verify verify the integrity of the repository
763 763 version output version and copyright information
764 764
765 765 enabled extensions:
766 766
767 767 helpext (no help text available)
768 768
769 769 additional help topics:
770 770
771 771 config Configuration Files
772 772 dates Date Formats
773 773 diffs Diff Formats
774 774 environment Environment Variables
775 775 extensions Using Additional Features
776 776 filesets Specifying File Sets
777 777 glossary Glossary
778 778 hgignore Syntax for Mercurial Ignore Files
779 779 hgweb Configuring hgweb
780 780 internals Technical implementation topics
781 781 merge-tools Merge Tools
782 782 multirevs Specifying Multiple Revisions
783 783 patterns File Name Patterns
784 784 phases Working with Phases
785 785 revisions Specifying Single Revisions
786 786 revsets Specifying Revision Sets
787 787 scripting Using Mercurial from scripts and automation
788 788 subrepos Subrepositories
789 789 templating Template Usage
790 790 urls URL Paths
791 791
792 792 (use "hg help -v" to show built-in aliases and global options)
793 793
794 794
795 795 Test list of internal help commands
796 796
797 797 $ hg help debug
798 798 debug commands (internal and unsupported):
799 799
800 800 debugancestor
801 801 find the ancestor revision of two revisions in a given index
802 802 debugapplystreamclonebundle
803 803 apply a stream clone bundle file
804 804 debugbuilddag
805 805 builds a repo with a given DAG from scratch in the current
806 806 empty repo
807 807 debugbundle lists the contents of a bundle
808 808 debugcheckstate
809 809 validate the correctness of the current dirstate
810 810 debugcommands
811 811 list all available commands and options
812 812 debugcomplete
813 813 returns the completion list associated with the given command
814 814 debugcreatestreamclonebundle
815 815 create a stream clone bundle file
816 816 debugdag format the changelog or an index DAG as a concise textual
817 817 description
818 818 debugdata dump the contents of a data file revision
819 819 debugdate parse and display a date
820 820 debugdeltachain
821 821 dump information about delta chains in a revlog
822 822 debugdirstate
823 823 show the contents of the current dirstate
824 824 debugdiscovery
825 825 runs the changeset discovery protocol in isolation
826 826 debugextensions
827 827 show information about active extensions
828 828 debugfileset parse and apply a fileset specification
829 829 debugfsinfo show information detected about current filesystem
830 830 debuggetbundle
831 831 retrieves a bundle from a repo
832 832 debugignore display the combined ignore pattern and information about
833 833 ignored files
834 834 debugindex dump the contents of an index file
835 835 debugindexdot
836 836 dump an index DAG as a graphviz dot file
837 837 debuginstall test Mercurial installation
838 838 debugknown test whether node ids are known to a repo
839 839 debuglocks show or modify state of locks
840 840 debugmergestate
841 841 print merge state
842 842 debugnamecomplete
843 843 complete "names" - tags, open branch names, bookmark names
844 844 debugobsolete
845 845 create arbitrary obsolete marker
846 846 debugoptDEP (no help text available)
847 847 debugoptEXP (no help text available)
848 848 debugpathcomplete
849 849 complete part or all of a tracked path
850 850 debugpushkey access the pushkey key/value protocol
851 851 debugpvec (no help text available)
852 852 debugrebuilddirstate
853 853 rebuild the dirstate as it would look like for the given
854 854 revision
855 855 debugrebuildfncache
856 856 rebuild the fncache file
857 857 debugrename dump rename information
858 858 debugrevlog show data and statistics about a revlog
859 859 debugrevspec parse and apply a revision specification
860 860 debugsetparents
861 861 manually set the parents of the current working directory
862 862 debugsub (no help text available)
863 863 debugsuccessorssets
864 864 show set of successors for revision
865 865 debugtemplate
866 866 parse and apply a template
867 867 debugwalk show how files match on given patterns
868 868 debugwireargs
869 869 (no help text available)
870 870
871 871 (use "hg help -v debug" to show built-in aliases and global options)
872 872
873 873 internals topic renders index of available sub-topics
874 874
875 875 $ hg help internals
876 876 Technical implementation topics
877 877 """""""""""""""""""""""""""""""
878 878
879 879 bundles container for exchange of repository data
880 880 changegroups representation of revlog data
881 881 requirements repository requirements
882 882 revlogs revision storage mechanism
883 883
884 884 sub-topics can be accessed
885 885
886 886 $ hg help internals.changegroups
887 887 Changegroups
888 888 ============
889 889
890 890 Changegroups are representations of repository revlog data, specifically
891 891 the changelog, manifest, and filelogs.
892 892
893 893 There are 3 versions of changegroups: "1", "2", and "3". From a high-
894 894 level, versions "1" and "2" are almost exactly the same, with the only
895 895 difference being a header on entries in the changeset segment. Version "3"
896 896 adds support for exchanging treemanifests and includes revlog flags in the
897 897 delta header.
898 898
899 899 Changegroups consists of 3 logical segments:
900 900
901 901 +---------------------------------+
902 902 | | | |
903 903 | changeset | manifest | filelogs |
904 904 | | | |
905 905 +---------------------------------+
906 906
907 907 The principle building block of each segment is a *chunk*. A *chunk* is a
908 908 framed piece of data:
909 909
910 910 +---------------------------------------+
911 911 | | |
912 912 | length | data |
913 913 | (32 bits) | <length> bytes |
914 914 | | |
915 915 +---------------------------------------+
916 916
917 917 Each chunk starts with a 32-bit big-endian signed integer indicating the
918 918 length of the raw data that follows.
919 919
920 920 There is a special case chunk that has 0 length ("0x00000000"). We call
921 921 this an *empty chunk*.
922 922
923 923 Delta Groups
924 924 ------------
925 925
926 926 A *delta group* expresses the content of a revlog as a series of deltas,
927 927 or patches against previous revisions.
928 928
929 929 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
930 930 to signal the end of the delta group:
931 931
932 932 +------------------------------------------------------------------------+
933 933 | | | | | |
934 934 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
935 935 | (32 bits) | (various) | (32 bits) | (various) | (32 bits) |
936 936 | | | | | |
937 937 +------------------------------------------------------------+-----------+
938 938
939 939 Each *chunk*'s data consists of the following:
940 940
941 941 +-----------------------------------------+
942 942 | | | |
943 943 | delta header | mdiff header | delta |
944 944 | (various) | (12 bytes) | (various) |
945 945 | | | |
946 946 +-----------------------------------------+
947 947
948 948 The *length* field is the byte length of the remaining 3 logical pieces of
949 949 data. The *delta* is a diff from an existing entry in the changelog.
950 950
951 951 The *delta header* is different between versions "1", "2", and "3" of the
952 952 changegroup format.
953 953
954 954 Version 1:
955 955
956 956 +------------------------------------------------------+
957 957 | | | | |
958 958 | node | p1 node | p2 node | link node |
959 959 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
960 960 | | | | |
961 961 +------------------------------------------------------+
962 962
963 963 Version 2:
964 964
965 965 +------------------------------------------------------------------+
966 966 | | | | | |
967 967 | node | p1 node | p2 node | base node | link node |
968 968 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
969 969 | | | | | |
970 970 +------------------------------------------------------------------+
971 971
972 972 Version 3:
973 973
974 974 +------------------------------------------------------------------------------+
975 975 | | | | | | |
976 976 | node | p1 node | p2 node | base node | link node | flags |
977 977 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
978 978 | | | | | | |
979 979 +------------------------------------------------------------------------------+
980 980
981 981 The *mdiff header* consists of 3 32-bit big-endian signed integers
982 982 describing offsets at which to apply the following delta content:
983 983
984 984 +-------------------------------------+
985 985 | | | |
986 986 | offset | old length | new length |
987 987 | (32 bits) | (32 bits) | (32 bits) |
988 988 | | | |
989 989 +-------------------------------------+
990 990
991 991 In version 1, the delta is always applied against the previous node from
992 992 the changegroup or the first parent if this is the first entry in the
993 993 changegroup.
994 994
995 995 In version 2, the delta base node is encoded in the entry in the
996 996 changegroup. This allows the delta to be expressed against any parent,
997 997 which can result in smaller deltas and more efficient encoding of data.
998 998
999 999 Changeset Segment
1000 1000 -----------------
1001 1001
1002 1002 The *changeset segment* consists of a single *delta group* holding
1003 1003 changelog data. It is followed by an *empty chunk* to denote the boundary
1004 1004 to the *manifests segment*.
1005 1005
1006 1006 Manifest Segment
1007 1007 ----------------
1008 1008
1009 1009 The *manifest segment* consists of a single *delta group* holding manifest
1010 1010 data. It is followed by an *empty chunk* to denote the boundary to the
1011 1011 *filelogs segment*.
1012 1012
1013 1013 Filelogs Segment
1014 1014 ----------------
1015 1015
1016 1016 The *filelogs* segment consists of multiple sub-segments, each
1017 1017 corresponding to an individual file whose data is being described:
1018 1018
1019 1019 +--------------------------------------+
1020 1020 | | | | |
1021 1021 | filelog0 | filelog1 | filelog2 | ... |
1022 1022 | | | | |
1023 1023 +--------------------------------------+
1024 1024
1025 1025 In version "3" of the changegroup format, filelogs may include directory
1026 1026 logs when treemanifests are in use. directory logs are identified by
1027 1027 having a trailing '/' on their filename (see below).
1028 1028
1029 1029 The final filelog sub-segment is followed by an *empty chunk* to denote
1030 1030 the end of the segment and the overall changegroup.
1031 1031
1032 1032 Each filelog sub-segment consists of the following:
1033 1033
1034 1034 +------------------------------------------+
1035 1035 | | | |
1036 1036 | filename size | filename | delta group |
1037 1037 | (32 bits) | (various) | (various) |
1038 1038 | | | |
1039 1039 +------------------------------------------+
1040 1040
1041 1041 That is, a *chunk* consisting of the filename (not terminated or padded)
1042 1042 followed by N chunks constituting the *delta group* for this file.
1043 1043
1044 1044 Test list of commands with command with no help text
1045 1045
1046 1046 $ hg help helpext
1047 1047 helpext extension - no help text available
1048 1048
1049 1049 list of commands:
1050 1050
1051 1051 nohelp (no help text available)
1052 1052
1053 1053 (use "hg help -v helpext" to show built-in aliases and global options)
1054 1054
1055 1055
1056 1056 test deprecated and experimental options are hidden in command help
1057 1057 $ hg help debugoptDEP
1058 1058 hg debugoptDEP
1059 1059
1060 1060 (no help text available)
1061 1061
1062 1062 options:
1063 1063
1064 1064 (some details hidden, use --verbose to show complete help)
1065 1065
1066 1066 $ hg help debugoptEXP
1067 1067 hg debugoptEXP
1068 1068
1069 1069 (no help text available)
1070 1070
1071 1071 options:
1072 1072
1073 1073 (some details hidden, use --verbose to show complete help)
1074 1074
1075 1075 test deprecated and experimental options is shown with -v
1076 1076 $ hg help -v debugoptDEP | grep dopt
1077 1077 --dopt option is (DEPRECATED)
1078 1078 $ hg help -v debugoptEXP | grep eopt
1079 1079 --eopt option is (EXPERIMENTAL)
1080 1080
1081 1081 #if gettext
1082 1082 test deprecated option is hidden with translation with untranslated description
1083 1083 (use many globy for not failing on changed transaction)
1084 1084 $ LANGUAGE=sv hg help debugoptDEP
1085 1085 hg debugoptDEP
1086 1086
1087 1087 (*) (glob)
1088 1088
1089 1089 options:
1090 1090
1091 1091 (some details hidden, use --verbose to show complete help)
1092 1092 #endif
1093 1093
1094 1094 Test commands that collide with topics (issue4240)
1095 1095
1096 1096 $ hg config -hq
1097 1097 hg config [-u] [NAME]...
1098 1098
1099 1099 show combined config settings from all hgrc files
1100 1100 $ hg showconfig -hq
1101 1101 hg config [-u] [NAME]...
1102 1102
1103 1103 show combined config settings from all hgrc files
1104 1104
1105 1105 Test a help topic
1106 1106
1107 1107 $ hg help revs
1108 1108 Specifying Single Revisions
1109 1109 """""""""""""""""""""""""""
1110 1110
1111 1111 Mercurial supports several ways to specify individual revisions.
1112 1112
1113 1113 A plain integer is treated as a revision number. Negative integers are
1114 1114 treated as sequential offsets from the tip, with -1 denoting the tip, -2
1115 1115 denoting the revision prior to the tip, and so forth.
1116 1116
1117 1117 A 40-digit hexadecimal string is treated as a unique revision identifier.
1118 1118
1119 1119 A hexadecimal string less than 40 characters long is treated as a unique
1120 1120 revision identifier and is referred to as a short-form identifier. A
1121 1121 short-form identifier is only valid if it is the prefix of exactly one
1122 1122 full-length identifier.
1123 1123
1124 1124 Any other string is treated as a bookmark, tag, or branch name. A bookmark
1125 1125 is a movable pointer to a revision. A tag is a permanent name associated
1126 1126 with a revision. A branch name denotes the tipmost open branch head of
1127 1127 that branch - or if they are all closed, the tipmost closed head of the
1128 1128 branch. Bookmark, tag, and branch names must not contain the ":"
1129 1129 character.
1130 1130
1131 1131 The reserved name "tip" always identifies the most recent revision.
1132 1132
1133 1133 The reserved name "null" indicates the null revision. This is the revision
1134 1134 of an empty repository, and the parent of revision 0.
1135 1135
1136 1136 The reserved name "." indicates the working directory parent. If no
1137 1137 working directory is checked out, it is equivalent to null. If an
1138 1138 uncommitted merge is in progress, "." is the revision of the first parent.
1139 1139
1140 1140 Test repeated config section name
1141 1141
1142 1142 $ hg help config.host
1143 1143 "http_proxy.host"
1144 1144 Host name and (optional) port of the proxy server, for example
1145 1145 "myproxy:8000".
1146 1146
1147 1147 "smtp.host"
1148 1148 Host name of mail server, e.g. "mail.example.com".
1149 1149
1150 1150 Unrelated trailing paragraphs shouldn't be included
1151 1151
1152 1152 $ hg help config.extramsg | grep '^$'
1153 1153
1154 1154
1155 1155 Test capitalized section name
1156 1156
1157 1157 $ hg help scripting.HGPLAIN > /dev/null
1158 1158
1159 1159 Help subsection:
1160 1160
1161 1161 $ hg help config.charsets |grep "Email example:" > /dev/null
1162 1162 [1]
1163 1163
1164 1164 Show nested definitions
1165 1165 ("profiling.type"[break]"ls"[break]"stat"[break])
1166 1166
1167 1167 $ hg help config.type | egrep '^$'|wc -l
1168 1168 \s*3 (re)
1169 1169
1170 1170 Separate sections from subsections
1171 1171
1172 1172 $ hg help config.format | egrep '^ ("|-)|^\s*$' | uniq
1173 1173 "format"
1174 1174 --------
1175 1175
1176 1176 "usegeneraldelta"
1177 1177
1178 1178 "dotencode"
1179 1179
1180 1180 "usefncache"
1181 1181
1182 1182 "usestore"
1183 1183
1184 1184 "profiling"
1185 1185 -----------
1186 1186
1187 1187 "format"
1188 1188
1189 1189 "progress"
1190 1190 ----------
1191 1191
1192 1192 "format"
1193 1193
1194 1194
1195 1195 Last item in help config.*:
1196 1196
1197 1197 $ hg help config.`hg help config|grep '^ "'| \
1198 1198 > tail -1|sed 's![ "]*!!g'`| \
1199 1199 > grep "hg help -c config" > /dev/null
1200 1200 [1]
1201 1201
1202 1202 note to use help -c for general hg help config:
1203 1203
1204 1204 $ hg help config |grep "hg help -c config" > /dev/null
1205 1205
1206 1206 Test templating help
1207 1207
1208 1208 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
1209 1209 desc String. The text of the changeset description.
1210 1210 diffstat String. Statistics of changes with the following format:
1211 1211 firstline Any text. Returns the first line of text.
1212 1212 nonempty Any text. Returns '(none)' if the string is empty.
1213 1213
1214 1214 Test deprecated items
1215 1215
1216 1216 $ hg help -v templating | grep currentbookmark
1217 1217 currentbookmark
1218 1218 $ hg help templating | (grep currentbookmark || true)
1219 1219
1220 1220 Test help hooks
1221 1221
1222 1222 $ cat > helphook1.py <<EOF
1223 1223 > from mercurial import help
1224 1224 >
1225 1225 > def rewrite(ui, topic, doc):
1226 1226 > return doc + '\nhelphook1\n'
1227 1227 >
1228 1228 > def extsetup(ui):
1229 1229 > help.addtopichook('revsets', rewrite)
1230 1230 > EOF
1231 1231 $ cat > helphook2.py <<EOF
1232 1232 > from mercurial import help
1233 1233 >
1234 1234 > def rewrite(ui, topic, doc):
1235 1235 > return doc + '\nhelphook2\n'
1236 1236 >
1237 1237 > def extsetup(ui):
1238 1238 > help.addtopichook('revsets', rewrite)
1239 1239 > EOF
1240 1240 $ echo '[extensions]' >> $HGRCPATH
1241 1241 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
1242 1242 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
1243 1243 $ hg help revsets | grep helphook
1244 1244 helphook1
1245 1245 helphook2
1246 1246
1247 1247 help -c should only show debug --debug
1248 1248
1249 1249 $ hg help -c --debug|egrep debug|wc -l|egrep '^\s*0\s*$'
1250 1250 [1]
1251 1251
1252 1252 help -c should only show deprecated for -v
1253 1253
1254 1254 $ hg help -c -v|egrep DEPRECATED|wc -l|egrep '^\s*0\s*$'
1255 1255 [1]
1256 1256
1257 1257 Test -s / --system
1258 1258
1259 1259 $ hg help config.files -s windows |grep 'etc/mercurial' | \
1260 1260 > wc -l | sed -e 's/ //g'
1261 1261 0
1262 1262 $ hg help config.files --system unix | grep 'USER' | \
1263 1263 > wc -l | sed -e 's/ //g'
1264 1264 0
1265 1265
1266 1266 Test -e / -c / -k combinations
1267 1267
1268 1268 $ hg help -c|egrep '^[A-Z].*:|^ debug'
1269 1269 Commands:
1270 1270 $ hg help -e|egrep '^[A-Z].*:|^ debug'
1271 1271 Extensions:
1272 1272 $ hg help -k|egrep '^[A-Z].*:|^ debug'
1273 1273 Topics:
1274 1274 Commands:
1275 1275 Extensions:
1276 1276 Extension Commands:
1277 1277 $ hg help -c schemes
1278 1278 abort: no such help topic: schemes
1279 1279 (try "hg help --keyword schemes")
1280 1280 [255]
1281 1281 $ hg help -e schemes |head -1
1282 1282 schemes extension - extend schemes with shortcuts to repository swarms
1283 1283 $ hg help -c -k dates |egrep '^(Topics|Extensions|Commands):'
1284 1284 Commands:
1285 1285 $ hg help -e -k a |egrep '^(Topics|Extensions|Commands):'
1286 1286 Extensions:
1287 1287 $ hg help -e -c -k date |egrep '^(Topics|Extensions|Commands):'
1288 1288 Extensions:
1289 1289 Commands:
1290 1290 $ hg help -c commit > /dev/null
1291 1291 $ hg help -e -c commit > /dev/null
1292 1292 $ hg help -e commit > /dev/null
1293 1293 abort: no such help topic: commit
1294 1294 (try "hg help --keyword commit")
1295 1295 [255]
1296 1296
1297 1297 Test keyword search help
1298 1298
1299 1299 $ cat > prefixedname.py <<EOF
1300 1300 > '''matched against word "clone"
1301 1301 > '''
1302 1302 > EOF
1303 1303 $ echo '[extensions]' >> $HGRCPATH
1304 1304 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
1305 1305 $ hg help -k clone
1306 1306 Topics:
1307 1307
1308 1308 config Configuration Files
1309 1309 extensions Using Additional Features
1310 1310 glossary Glossary
1311 1311 phases Working with Phases
1312 1312 subrepos Subrepositories
1313 1313 urls URL Paths
1314 1314
1315 1315 Commands:
1316 1316
1317 1317 bookmarks create a new bookmark or list existing bookmarks
1318 1318 clone make a copy of an existing repository
1319 1319 paths show aliases for remote repositories
1320 1320 update update working directory (or switch revisions)
1321 1321
1322 1322 Extensions:
1323 1323
1324 1324 clonebundles advertise pre-generated bundles to seed clones
1325 1325 prefixedname matched against word "clone"
1326 1326 relink recreates hardlinks between repository clones
1327 1327
1328 1328 Extension Commands:
1329 1329
1330 1330 qclone clone main and patch repository at same time
1331 1331
1332 1332 Test unfound topic
1333 1333
1334 1334 $ hg help nonexistingtopicthatwillneverexisteverever
1335 1335 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
1336 1336 (try "hg help --keyword nonexistingtopicthatwillneverexisteverever")
1337 1337 [255]
1338 1338
1339 1339 Test unfound keyword
1340 1340
1341 1341 $ hg help --keyword nonexistingwordthatwillneverexisteverever
1342 1342 abort: no matches
1343 1343 (try "hg help" for a list of topics)
1344 1344 [255]
1345 1345
1346 1346 Test omit indicating for help
1347 1347
1348 1348 $ cat > addverboseitems.py <<EOF
1349 1349 > '''extension to test omit indicating.
1350 1350 >
1351 1351 > This paragraph is never omitted (for extension)
1352 1352 >
1353 1353 > .. container:: verbose
1354 1354 >
1355 1355 > This paragraph is omitted,
1356 1356 > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension)
1357 1357 >
1358 1358 > This paragraph is never omitted, too (for extension)
1359 1359 > '''
1360 1360 >
1361 1361 > from mercurial import help, commands
1362 1362 > testtopic = """This paragraph is never omitted (for topic).
1363 1363 >
1364 1364 > .. container:: verbose
1365 1365 >
1366 1366 > This paragraph is omitted,
1367 1367 > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic)
1368 1368 >
1369 1369 > This paragraph is never omitted, too (for topic)
1370 1370 > """
1371 1371 > def extsetup(ui):
1372 1372 > help.helptable.append((["topic-containing-verbose"],
1373 1373 > "This is the topic to test omit indicating.",
1374 1374 > lambda ui: testtopic))
1375 1375 > EOF
1376 1376 $ echo '[extensions]' >> $HGRCPATH
1377 1377 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1378 1378 $ hg help addverboseitems
1379 1379 addverboseitems extension - extension to test omit indicating.
1380 1380
1381 1381 This paragraph is never omitted (for extension)
1382 1382
1383 1383 This paragraph is never omitted, too (for extension)
1384 1384
1385 1385 (some details hidden, use --verbose to show complete help)
1386 1386
1387 1387 no commands defined
1388 1388 $ hg help -v addverboseitems
1389 1389 addverboseitems extension - extension to test omit indicating.
1390 1390
1391 1391 This paragraph is never omitted (for extension)
1392 1392
1393 1393 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1394 1394 extension)
1395 1395
1396 1396 This paragraph is never omitted, too (for extension)
1397 1397
1398 1398 no commands defined
1399 1399 $ hg help topic-containing-verbose
1400 1400 This is the topic to test omit indicating.
1401 1401 """"""""""""""""""""""""""""""""""""""""""
1402 1402
1403 1403 This paragraph is never omitted (for topic).
1404 1404
1405 1405 This paragraph is never omitted, too (for topic)
1406 1406
1407 1407 (some details hidden, use --verbose to show complete help)
1408 1408 $ hg help -v topic-containing-verbose
1409 1409 This is the topic to test omit indicating.
1410 1410 """"""""""""""""""""""""""""""""""""""""""
1411 1411
1412 1412 This paragraph is never omitted (for topic).
1413 1413
1414 1414 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1415 1415 topic)
1416 1416
1417 1417 This paragraph is never omitted, too (for topic)
1418 1418
1419 1419 Test section lookup
1420 1420
1421 1421 $ hg help revset.merge
1422 1422 "merge()"
1423 1423 Changeset is a merge changeset.
1424 1424
1425 1425 $ hg help glossary.dag
1426 1426 DAG
1427 1427 The repository of changesets of a distributed version control system
1428 1428 (DVCS) can be described as a directed acyclic graph (DAG), consisting
1429 1429 of nodes and edges, where nodes correspond to changesets and edges
1430 1430 imply a parent -> child relation. This graph can be visualized by
1431 1431 graphical tools such as 'hg log --graph'. In Mercurial, the DAG is
1432 1432 limited by the requirement for children to have at most two parents.
1433 1433
1434 1434
1435 1435 $ hg help hgrc.paths
1436 1436 "paths"
1437 1437 -------
1438 1438
1439 1439 Assigns symbolic names and behavior to repositories.
1440 1440
1441 1441 Options are symbolic names defining the URL or directory that is the
1442 1442 location of the repository. Example:
1443 1443
1444 1444 [paths]
1445 1445 my_server = https://example.com/my_repo
1446 1446 local_path = /home/me/repo
1447 1447
1448 1448 These symbolic names can be used from the command line. To pull from
1449 1449 "my_server": 'hg pull my_server'. To push to "local_path": 'hg push
1450 1450 local_path'.
1451 1451
1452 1452 Options containing colons (":") denote sub-options that can influence
1453 1453 behavior for that specific path. Example:
1454 1454
1455 1455 [paths]
1456 1456 my_server = https://example.com/my_path
1457 1457 my_server:pushurl = ssh://example.com/my_path
1458 1458
1459 1459 The following sub-options can be defined:
1460 1460
1461 1461 "pushurl"
1462 1462 The URL to use for push operations. If not defined, the location
1463 1463 defined by the path's main entry is used.
1464 1464
1465 1465 The following special named paths exist:
1466 1466
1467 1467 "default"
1468 1468 The URL or directory to use when no source or remote is specified.
1469 1469
1470 1470 'hg clone' will automatically define this path to the location the
1471 1471 repository was cloned from.
1472 1472
1473 1473 "default-push"
1474 1474 (deprecated) The URL or directory for the default 'hg push' location.
1475 1475 "default:pushurl" should be used instead.
1476 1476
1477 1477 $ hg help glossary.mcguffin
1478 1478 abort: help section not found
1479 1479 [255]
1480 1480
1481 1481 $ hg help glossary.mc.guffin
1482 1482 abort: help section not found
1483 1483 [255]
1484 1484
1485 1485 $ hg help template.files
1486 1486 files List of strings. All files modified, added, or removed by
1487 1487 this changeset.
1488 1488
1489 1489 Test dynamic list of merge tools only shows up once
1490 1490 $ hg help merge-tools
1491 1491 Merge Tools
1492 1492 """""""""""
1493 1493
1494 1494 To merge files Mercurial uses merge tools.
1495 1495
1496 1496 A merge tool combines two different versions of a file into a merged file.
1497 1497 Merge tools are given the two files and the greatest common ancestor of
1498 1498 the two file versions, so they can determine the changes made on both
1499 1499 branches.
1500 1500
1501 1501 Merge tools are used both for 'hg resolve', 'hg merge', 'hg update', 'hg
1502 1502 backout' and in several extensions.
1503 1503
1504 1504 Usually, the merge tool tries to automatically reconcile the files by
1505 1505 combining all non-overlapping changes that occurred separately in the two
1506 1506 different evolutions of the same initial base file. Furthermore, some
1507 1507 interactive merge programs make it easier to manually resolve conflicting
1508 1508 merges, either in a graphical way, or by inserting some conflict markers.
1509 1509 Mercurial does not include any interactive merge programs but relies on
1510 1510 external tools for that.
1511 1511
1512 1512 Available merge tools
1513 1513 =====================
1514 1514
1515 1515 External merge tools and their properties are configured in the merge-
1516 1516 tools configuration section - see hgrc(5) - but they can often just be
1517 1517 named by their executable.
1518 1518
1519 1519 A merge tool is generally usable if its executable can be found on the
1520 1520 system and if it can handle the merge. The executable is found if it is an
1521 1521 absolute or relative executable path or the name of an application in the
1522 1522 executable search path. The tool is assumed to be able to handle the merge
1523 1523 if it can handle symlinks if the file is a symlink, if it can handle
1524 1524 binary files if the file is binary, and if a GUI is available if the tool
1525 1525 requires a GUI.
1526 1526
1527 1527 There are some internal merge tools which can be used. The internal merge
1528 1528 tools are:
1529 1529
1530 1530 ":dump"
1531 1531 Creates three versions of the files to merge, containing the contents of
1532 1532 local, other and base. These files can then be used to perform a merge
1533 1533 manually. If the file to be merged is named "a.txt", these files will
1534 1534 accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and
1535 1535 they will be placed in the same directory as "a.txt".
1536 1536
1537 1537 ":fail"
1538 1538 Rather than attempting to merge files that were modified on both
1539 1539 branches, it marks them as unresolved. The resolve command must be used
1540 1540 to resolve these conflicts.
1541 1541
1542 1542 ":local"
1543 Uses the local (p1) version of files as the merged version.
1543 Uses the local 'p1()' version of files as the merged version.
1544 1544
1545 1545 ":merge"
1546 1546 Uses the internal non-interactive simple merge algorithm for merging
1547 1547 files. It will fail if there are any conflicts and leave markers in the
1548 1548 partially merged file. Markers will have two sections, one for each side
1549 1549 of merge.
1550 1550
1551 1551 ":merge-local"
1552 1552 Like :merge, but resolve all conflicts non-interactively in favor of the
1553 local (p1) changes.
1553 local 'p1()' changes.
1554 1554
1555 1555 ":merge-other"
1556 1556 Like :merge, but resolve all conflicts non-interactively in favor of the
1557 other (p2) changes.
1557 other 'p2()' changes.
1558 1558
1559 1559 ":merge3"
1560 1560 Uses the internal non-interactive simple merge algorithm for merging
1561 1561 files. It will fail if there are any conflicts and leave markers in the
1562 1562 partially merged file. Marker will have three sections, one from each
1563 1563 side of the merge and one for the base content.
1564 1564
1565 1565 ":other"
1566 Uses the other (p2) version of files as the merged version.
1566 Uses the other 'p2()' version of files as the merged version.
1567 1567
1568 1568 ":prompt"
1569 Asks the user which of the local (p1) or the other (p2) version to keep
1570 as the merged version.
1569 Asks the user which of the local 'p1()' or the other 'p2()' version to
1570 keep as the merged version.
1571 1571
1572 1572 ":tagmerge"
1573 1573 Uses the internal tag merge algorithm (experimental).
1574 1574
1575 1575 ":union"
1576 1576 Uses the internal non-interactive simple merge algorithm for merging
1577 1577 files. It will use both left and right sides for conflict regions. No
1578 1578 markers are inserted.
1579 1579
1580 1580 Internal tools are always available and do not require a GUI but will by
1581 1581 default not handle symlinks or binary files.
1582 1582
1583 1583 Choosing a merge tool
1584 1584 =====================
1585 1585
1586 1586 Mercurial uses these rules when deciding which merge tool to use:
1587 1587
1588 1588 1. If a tool has been specified with the --tool option to merge or
1589 1589 resolve, it is used. If it is the name of a tool in the merge-tools
1590 1590 configuration, its configuration is used. Otherwise the specified tool
1591 1591 must be executable by the shell.
1592 1592 2. If the "HGMERGE" environment variable is present, its value is used and
1593 1593 must be executable by the shell.
1594 1594 3. If the filename of the file to be merged matches any of the patterns in
1595 1595 the merge-patterns configuration section, the first usable merge tool
1596 1596 corresponding to a matching pattern is used. Here, binary capabilities
1597 1597 of the merge tool are not considered.
1598 1598 4. If ui.merge is set it will be considered next. If the value is not the
1599 1599 name of a configured tool, the specified value is used and must be
1600 1600 executable by the shell. Otherwise the named tool is used if it is
1601 1601 usable.
1602 1602 5. If any usable merge tools are present in the merge-tools configuration
1603 1603 section, the one with the highest priority is used.
1604 1604 6. If a program named "hgmerge" can be found on the system, it is used -
1605 1605 but it will by default not be used for symlinks and binary files.
1606 1606 7. If the file to be merged is not binary and is not a symlink, then
1607 1607 internal ":merge" is used.
1608 1608 8. The merge of the file fails and must be resolved before commit.
1609 1609
1610 1610 Note:
1611 1611 After selecting a merge program, Mercurial will by default attempt to
1612 1612 merge the files using a simple merge algorithm first. Only if it
1613 1613 doesn't succeed because of conflicting changes Mercurial will actually
1614 1614 execute the merge program. Whether to use the simple merge algorithm
1615 1615 first can be controlled by the premerge setting of the merge tool.
1616 1616 Premerge is enabled by default unless the file is binary or a symlink.
1617 1617
1618 1618 See the merge-tools and ui sections of hgrc(5) for details on the
1619 1619 configuration of merge tools.
1620 1620
1621 1621 Test usage of section marks in help documents
1622 1622
1623 1623 $ cd "$TESTDIR"/../doc
1624 1624 $ python check-seclevel.py
1625 1625 $ cd $TESTTMP
1626 1626
1627 1627 #if serve
1628 1628
1629 1629 Test the help pages in hgweb.
1630 1630
1631 1631 Dish up an empty repo; serve it cold.
1632 1632
1633 1633 $ hg init "$TESTTMP/test"
1634 1634 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
1635 1635 $ cat hg.pid >> $DAEMON_PIDS
1636 1636
1637 1637 $ get-with-headers.py 127.0.0.1:$HGPORT "help"
1638 1638 200 Script output follows
1639 1639
1640 1640 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1641 1641 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1642 1642 <head>
1643 1643 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1644 1644 <meta name="robots" content="index, nofollow" />
1645 1645 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1646 1646 <script type="text/javascript" src="/static/mercurial.js"></script>
1647 1647
1648 1648 <title>Help: Index</title>
1649 1649 </head>
1650 1650 <body>
1651 1651
1652 1652 <div class="container">
1653 1653 <div class="menu">
1654 1654 <div class="logo">
1655 1655 <a href="https://mercurial-scm.org/">
1656 1656 <img src="/static/hglogo.png" alt="mercurial" /></a>
1657 1657 </div>
1658 1658 <ul>
1659 1659 <li><a href="/shortlog">log</a></li>
1660 1660 <li><a href="/graph">graph</a></li>
1661 1661 <li><a href="/tags">tags</a></li>
1662 1662 <li><a href="/bookmarks">bookmarks</a></li>
1663 1663 <li><a href="/branches">branches</a></li>
1664 1664 </ul>
1665 1665 <ul>
1666 1666 <li class="active">help</li>
1667 1667 </ul>
1668 1668 </div>
1669 1669
1670 1670 <div class="main">
1671 1671 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1672 1672 <form class="search" action="/log">
1673 1673
1674 1674 <p><input name="rev" id="search1" type="text" size="30" /></p>
1675 1675 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1676 1676 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1677 1677 </form>
1678 1678 <table class="bigtable">
1679 1679 <tr><td colspan="2"><h2><a name="main" href="#topics">Topics</a></h2></td></tr>
1680 1680
1681 1681 <tr><td>
1682 1682 <a href="/help/config">
1683 1683 config
1684 1684 </a>
1685 1685 </td><td>
1686 1686 Configuration Files
1687 1687 </td></tr>
1688 1688 <tr><td>
1689 1689 <a href="/help/dates">
1690 1690 dates
1691 1691 </a>
1692 1692 </td><td>
1693 1693 Date Formats
1694 1694 </td></tr>
1695 1695 <tr><td>
1696 1696 <a href="/help/diffs">
1697 1697 diffs
1698 1698 </a>
1699 1699 </td><td>
1700 1700 Diff Formats
1701 1701 </td></tr>
1702 1702 <tr><td>
1703 1703 <a href="/help/environment">
1704 1704 environment
1705 1705 </a>
1706 1706 </td><td>
1707 1707 Environment Variables
1708 1708 </td></tr>
1709 1709 <tr><td>
1710 1710 <a href="/help/extensions">
1711 1711 extensions
1712 1712 </a>
1713 1713 </td><td>
1714 1714 Using Additional Features
1715 1715 </td></tr>
1716 1716 <tr><td>
1717 1717 <a href="/help/filesets">
1718 1718 filesets
1719 1719 </a>
1720 1720 </td><td>
1721 1721 Specifying File Sets
1722 1722 </td></tr>
1723 1723 <tr><td>
1724 1724 <a href="/help/glossary">
1725 1725 glossary
1726 1726 </a>
1727 1727 </td><td>
1728 1728 Glossary
1729 1729 </td></tr>
1730 1730 <tr><td>
1731 1731 <a href="/help/hgignore">
1732 1732 hgignore
1733 1733 </a>
1734 1734 </td><td>
1735 1735 Syntax for Mercurial Ignore Files
1736 1736 </td></tr>
1737 1737 <tr><td>
1738 1738 <a href="/help/hgweb">
1739 1739 hgweb
1740 1740 </a>
1741 1741 </td><td>
1742 1742 Configuring hgweb
1743 1743 </td></tr>
1744 1744 <tr><td>
1745 1745 <a href="/help/internals">
1746 1746 internals
1747 1747 </a>
1748 1748 </td><td>
1749 1749 Technical implementation topics
1750 1750 </td></tr>
1751 1751 <tr><td>
1752 1752 <a href="/help/merge-tools">
1753 1753 merge-tools
1754 1754 </a>
1755 1755 </td><td>
1756 1756 Merge Tools
1757 1757 </td></tr>
1758 1758 <tr><td>
1759 1759 <a href="/help/multirevs">
1760 1760 multirevs
1761 1761 </a>
1762 1762 </td><td>
1763 1763 Specifying Multiple Revisions
1764 1764 </td></tr>
1765 1765 <tr><td>
1766 1766 <a href="/help/patterns">
1767 1767 patterns
1768 1768 </a>
1769 1769 </td><td>
1770 1770 File Name Patterns
1771 1771 </td></tr>
1772 1772 <tr><td>
1773 1773 <a href="/help/phases">
1774 1774 phases
1775 1775 </a>
1776 1776 </td><td>
1777 1777 Working with Phases
1778 1778 </td></tr>
1779 1779 <tr><td>
1780 1780 <a href="/help/revisions">
1781 1781 revisions
1782 1782 </a>
1783 1783 </td><td>
1784 1784 Specifying Single Revisions
1785 1785 </td></tr>
1786 1786 <tr><td>
1787 1787 <a href="/help/revsets">
1788 1788 revsets
1789 1789 </a>
1790 1790 </td><td>
1791 1791 Specifying Revision Sets
1792 1792 </td></tr>
1793 1793 <tr><td>
1794 1794 <a href="/help/scripting">
1795 1795 scripting
1796 1796 </a>
1797 1797 </td><td>
1798 1798 Using Mercurial from scripts and automation
1799 1799 </td></tr>
1800 1800 <tr><td>
1801 1801 <a href="/help/subrepos">
1802 1802 subrepos
1803 1803 </a>
1804 1804 </td><td>
1805 1805 Subrepositories
1806 1806 </td></tr>
1807 1807 <tr><td>
1808 1808 <a href="/help/templating">
1809 1809 templating
1810 1810 </a>
1811 1811 </td><td>
1812 1812 Template Usage
1813 1813 </td></tr>
1814 1814 <tr><td>
1815 1815 <a href="/help/urls">
1816 1816 urls
1817 1817 </a>
1818 1818 </td><td>
1819 1819 URL Paths
1820 1820 </td></tr>
1821 1821 <tr><td>
1822 1822 <a href="/help/topic-containing-verbose">
1823 1823 topic-containing-verbose
1824 1824 </a>
1825 1825 </td><td>
1826 1826 This is the topic to test omit indicating.
1827 1827 </td></tr>
1828 1828
1829 1829
1830 1830 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
1831 1831
1832 1832 <tr><td>
1833 1833 <a href="/help/add">
1834 1834 add
1835 1835 </a>
1836 1836 </td><td>
1837 1837 add the specified files on the next commit
1838 1838 </td></tr>
1839 1839 <tr><td>
1840 1840 <a href="/help/annotate">
1841 1841 annotate
1842 1842 </a>
1843 1843 </td><td>
1844 1844 show changeset information by line for each file
1845 1845 </td></tr>
1846 1846 <tr><td>
1847 1847 <a href="/help/clone">
1848 1848 clone
1849 1849 </a>
1850 1850 </td><td>
1851 1851 make a copy of an existing repository
1852 1852 </td></tr>
1853 1853 <tr><td>
1854 1854 <a href="/help/commit">
1855 1855 commit
1856 1856 </a>
1857 1857 </td><td>
1858 1858 commit the specified files or all outstanding changes
1859 1859 </td></tr>
1860 1860 <tr><td>
1861 1861 <a href="/help/diff">
1862 1862 diff
1863 1863 </a>
1864 1864 </td><td>
1865 1865 diff repository (or selected files)
1866 1866 </td></tr>
1867 1867 <tr><td>
1868 1868 <a href="/help/export">
1869 1869 export
1870 1870 </a>
1871 1871 </td><td>
1872 1872 dump the header and diffs for one or more changesets
1873 1873 </td></tr>
1874 1874 <tr><td>
1875 1875 <a href="/help/forget">
1876 1876 forget
1877 1877 </a>
1878 1878 </td><td>
1879 1879 forget the specified files on the next commit
1880 1880 </td></tr>
1881 1881 <tr><td>
1882 1882 <a href="/help/init">
1883 1883 init
1884 1884 </a>
1885 1885 </td><td>
1886 1886 create a new repository in the given directory
1887 1887 </td></tr>
1888 1888 <tr><td>
1889 1889 <a href="/help/log">
1890 1890 log
1891 1891 </a>
1892 1892 </td><td>
1893 1893 show revision history of entire repository or files
1894 1894 </td></tr>
1895 1895 <tr><td>
1896 1896 <a href="/help/merge">
1897 1897 merge
1898 1898 </a>
1899 1899 </td><td>
1900 1900 merge another revision into working directory
1901 1901 </td></tr>
1902 1902 <tr><td>
1903 1903 <a href="/help/pull">
1904 1904 pull
1905 1905 </a>
1906 1906 </td><td>
1907 1907 pull changes from the specified source
1908 1908 </td></tr>
1909 1909 <tr><td>
1910 1910 <a href="/help/push">
1911 1911 push
1912 1912 </a>
1913 1913 </td><td>
1914 1914 push changes to the specified destination
1915 1915 </td></tr>
1916 1916 <tr><td>
1917 1917 <a href="/help/remove">
1918 1918 remove
1919 1919 </a>
1920 1920 </td><td>
1921 1921 remove the specified files on the next commit
1922 1922 </td></tr>
1923 1923 <tr><td>
1924 1924 <a href="/help/serve">
1925 1925 serve
1926 1926 </a>
1927 1927 </td><td>
1928 1928 start stand-alone webserver
1929 1929 </td></tr>
1930 1930 <tr><td>
1931 1931 <a href="/help/status">
1932 1932 status
1933 1933 </a>
1934 1934 </td><td>
1935 1935 show changed files in the working directory
1936 1936 </td></tr>
1937 1937 <tr><td>
1938 1938 <a href="/help/summary">
1939 1939 summary
1940 1940 </a>
1941 1941 </td><td>
1942 1942 summarize working directory state
1943 1943 </td></tr>
1944 1944 <tr><td>
1945 1945 <a href="/help/update">
1946 1946 update
1947 1947 </a>
1948 1948 </td><td>
1949 1949 update working directory (or switch revisions)
1950 1950 </td></tr>
1951 1951
1952 1952
1953 1953
1954 1954 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
1955 1955
1956 1956 <tr><td>
1957 1957 <a href="/help/addremove">
1958 1958 addremove
1959 1959 </a>
1960 1960 </td><td>
1961 1961 add all new files, delete all missing files
1962 1962 </td></tr>
1963 1963 <tr><td>
1964 1964 <a href="/help/archive">
1965 1965 archive
1966 1966 </a>
1967 1967 </td><td>
1968 1968 create an unversioned archive of a repository revision
1969 1969 </td></tr>
1970 1970 <tr><td>
1971 1971 <a href="/help/backout">
1972 1972 backout
1973 1973 </a>
1974 1974 </td><td>
1975 1975 reverse effect of earlier changeset
1976 1976 </td></tr>
1977 1977 <tr><td>
1978 1978 <a href="/help/bisect">
1979 1979 bisect
1980 1980 </a>
1981 1981 </td><td>
1982 1982 subdivision search of changesets
1983 1983 </td></tr>
1984 1984 <tr><td>
1985 1985 <a href="/help/bookmarks">
1986 1986 bookmarks
1987 1987 </a>
1988 1988 </td><td>
1989 1989 create a new bookmark or list existing bookmarks
1990 1990 </td></tr>
1991 1991 <tr><td>
1992 1992 <a href="/help/branch">
1993 1993 branch
1994 1994 </a>
1995 1995 </td><td>
1996 1996 set or show the current branch name
1997 1997 </td></tr>
1998 1998 <tr><td>
1999 1999 <a href="/help/branches">
2000 2000 branches
2001 2001 </a>
2002 2002 </td><td>
2003 2003 list repository named branches
2004 2004 </td></tr>
2005 2005 <tr><td>
2006 2006 <a href="/help/bundle">
2007 2007 bundle
2008 2008 </a>
2009 2009 </td><td>
2010 2010 create a changegroup file
2011 2011 </td></tr>
2012 2012 <tr><td>
2013 2013 <a href="/help/cat">
2014 2014 cat
2015 2015 </a>
2016 2016 </td><td>
2017 2017 output the current or given revision of files
2018 2018 </td></tr>
2019 2019 <tr><td>
2020 2020 <a href="/help/config">
2021 2021 config
2022 2022 </a>
2023 2023 </td><td>
2024 2024 show combined config settings from all hgrc files
2025 2025 </td></tr>
2026 2026 <tr><td>
2027 2027 <a href="/help/copy">
2028 2028 copy
2029 2029 </a>
2030 2030 </td><td>
2031 2031 mark files as copied for the next commit
2032 2032 </td></tr>
2033 2033 <tr><td>
2034 2034 <a href="/help/files">
2035 2035 files
2036 2036 </a>
2037 2037 </td><td>
2038 2038 list tracked files
2039 2039 </td></tr>
2040 2040 <tr><td>
2041 2041 <a href="/help/graft">
2042 2042 graft
2043 2043 </a>
2044 2044 </td><td>
2045 2045 copy changes from other branches onto the current branch
2046 2046 </td></tr>
2047 2047 <tr><td>
2048 2048 <a href="/help/grep">
2049 2049 grep
2050 2050 </a>
2051 2051 </td><td>
2052 2052 search for a pattern in specified files and revisions
2053 2053 </td></tr>
2054 2054 <tr><td>
2055 2055 <a href="/help/heads">
2056 2056 heads
2057 2057 </a>
2058 2058 </td><td>
2059 2059 show branch heads
2060 2060 </td></tr>
2061 2061 <tr><td>
2062 2062 <a href="/help/help">
2063 2063 help
2064 2064 </a>
2065 2065 </td><td>
2066 2066 show help for a given topic or a help overview
2067 2067 </td></tr>
2068 2068 <tr><td>
2069 2069 <a href="/help/identify">
2070 2070 identify
2071 2071 </a>
2072 2072 </td><td>
2073 2073 identify the working directory or specified revision
2074 2074 </td></tr>
2075 2075 <tr><td>
2076 2076 <a href="/help/import">
2077 2077 import
2078 2078 </a>
2079 2079 </td><td>
2080 2080 import an ordered set of patches
2081 2081 </td></tr>
2082 2082 <tr><td>
2083 2083 <a href="/help/incoming">
2084 2084 incoming
2085 2085 </a>
2086 2086 </td><td>
2087 2087 show new changesets found in source
2088 2088 </td></tr>
2089 2089 <tr><td>
2090 2090 <a href="/help/manifest">
2091 2091 manifest
2092 2092 </a>
2093 2093 </td><td>
2094 2094 output the current or given revision of the project manifest
2095 2095 </td></tr>
2096 2096 <tr><td>
2097 2097 <a href="/help/nohelp">
2098 2098 nohelp
2099 2099 </a>
2100 2100 </td><td>
2101 2101 (no help text available)
2102 2102 </td></tr>
2103 2103 <tr><td>
2104 2104 <a href="/help/outgoing">
2105 2105 outgoing
2106 2106 </a>
2107 2107 </td><td>
2108 2108 show changesets not found in the destination
2109 2109 </td></tr>
2110 2110 <tr><td>
2111 2111 <a href="/help/paths">
2112 2112 paths
2113 2113 </a>
2114 2114 </td><td>
2115 2115 show aliases for remote repositories
2116 2116 </td></tr>
2117 2117 <tr><td>
2118 2118 <a href="/help/phase">
2119 2119 phase
2120 2120 </a>
2121 2121 </td><td>
2122 2122 set or show the current phase name
2123 2123 </td></tr>
2124 2124 <tr><td>
2125 2125 <a href="/help/recover">
2126 2126 recover
2127 2127 </a>
2128 2128 </td><td>
2129 2129 roll back an interrupted transaction
2130 2130 </td></tr>
2131 2131 <tr><td>
2132 2132 <a href="/help/rename">
2133 2133 rename
2134 2134 </a>
2135 2135 </td><td>
2136 2136 rename files; equivalent of copy + remove
2137 2137 </td></tr>
2138 2138 <tr><td>
2139 2139 <a href="/help/resolve">
2140 2140 resolve
2141 2141 </a>
2142 2142 </td><td>
2143 2143 redo merges or set/view the merge status of files
2144 2144 </td></tr>
2145 2145 <tr><td>
2146 2146 <a href="/help/revert">
2147 2147 revert
2148 2148 </a>
2149 2149 </td><td>
2150 2150 restore files to their checkout state
2151 2151 </td></tr>
2152 2152 <tr><td>
2153 2153 <a href="/help/root">
2154 2154 root
2155 2155 </a>
2156 2156 </td><td>
2157 2157 print the root (top) of the current working directory
2158 2158 </td></tr>
2159 2159 <tr><td>
2160 2160 <a href="/help/tag">
2161 2161 tag
2162 2162 </a>
2163 2163 </td><td>
2164 2164 add one or more tags for the current or given revision
2165 2165 </td></tr>
2166 2166 <tr><td>
2167 2167 <a href="/help/tags">
2168 2168 tags
2169 2169 </a>
2170 2170 </td><td>
2171 2171 list repository tags
2172 2172 </td></tr>
2173 2173 <tr><td>
2174 2174 <a href="/help/unbundle">
2175 2175 unbundle
2176 2176 </a>
2177 2177 </td><td>
2178 2178 apply one or more changegroup files
2179 2179 </td></tr>
2180 2180 <tr><td>
2181 2181 <a href="/help/verify">
2182 2182 verify
2183 2183 </a>
2184 2184 </td><td>
2185 2185 verify the integrity of the repository
2186 2186 </td></tr>
2187 2187 <tr><td>
2188 2188 <a href="/help/version">
2189 2189 version
2190 2190 </a>
2191 2191 </td><td>
2192 2192 output version and copyright information
2193 2193 </td></tr>
2194 2194
2195 2195
2196 2196 </table>
2197 2197 </div>
2198 2198 </div>
2199 2199
2200 2200 <script type="text/javascript">process_dates()</script>
2201 2201
2202 2202
2203 2203 </body>
2204 2204 </html>
2205 2205
2206 2206
2207 2207 $ get-with-headers.py 127.0.0.1:$HGPORT "help/add"
2208 2208 200 Script output follows
2209 2209
2210 2210 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2211 2211 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2212 2212 <head>
2213 2213 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2214 2214 <meta name="robots" content="index, nofollow" />
2215 2215 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2216 2216 <script type="text/javascript" src="/static/mercurial.js"></script>
2217 2217
2218 2218 <title>Help: add</title>
2219 2219 </head>
2220 2220 <body>
2221 2221
2222 2222 <div class="container">
2223 2223 <div class="menu">
2224 2224 <div class="logo">
2225 2225 <a href="https://mercurial-scm.org/">
2226 2226 <img src="/static/hglogo.png" alt="mercurial" /></a>
2227 2227 </div>
2228 2228 <ul>
2229 2229 <li><a href="/shortlog">log</a></li>
2230 2230 <li><a href="/graph">graph</a></li>
2231 2231 <li><a href="/tags">tags</a></li>
2232 2232 <li><a href="/bookmarks">bookmarks</a></li>
2233 2233 <li><a href="/branches">branches</a></li>
2234 2234 </ul>
2235 2235 <ul>
2236 2236 <li class="active"><a href="/help">help</a></li>
2237 2237 </ul>
2238 2238 </div>
2239 2239
2240 2240 <div class="main">
2241 2241 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2242 2242 <h3>Help: add</h3>
2243 2243
2244 2244 <form class="search" action="/log">
2245 2245
2246 2246 <p><input name="rev" id="search1" type="text" size="30" /></p>
2247 2247 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2248 2248 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2249 2249 </form>
2250 2250 <div id="doc">
2251 2251 <p>
2252 2252 hg add [OPTION]... [FILE]...
2253 2253 </p>
2254 2254 <p>
2255 2255 add the specified files on the next commit
2256 2256 </p>
2257 2257 <p>
2258 2258 Schedule files to be version controlled and added to the
2259 2259 repository.
2260 2260 </p>
2261 2261 <p>
2262 2262 The files will be added to the repository at the next commit. To
2263 2263 undo an add before that, see 'hg forget'.
2264 2264 </p>
2265 2265 <p>
2266 2266 If no names are given, add all files to the repository (except
2267 2267 files matching &quot;.hgignore&quot;).
2268 2268 </p>
2269 2269 <p>
2270 2270 Examples:
2271 2271 </p>
2272 2272 <ul>
2273 2273 <li> New (unknown) files are added automatically by 'hg add':
2274 2274 <pre>
2275 2275 \$ ls (re)
2276 2276 foo.c
2277 2277 \$ hg status (re)
2278 2278 ? foo.c
2279 2279 \$ hg add (re)
2280 2280 adding foo.c
2281 2281 \$ hg status (re)
2282 2282 A foo.c
2283 2283 </pre>
2284 2284 <li> Specific files to be added can be specified:
2285 2285 <pre>
2286 2286 \$ ls (re)
2287 2287 bar.c foo.c
2288 2288 \$ hg status (re)
2289 2289 ? bar.c
2290 2290 ? foo.c
2291 2291 \$ hg add bar.c (re)
2292 2292 \$ hg status (re)
2293 2293 A bar.c
2294 2294 ? foo.c
2295 2295 </pre>
2296 2296 </ul>
2297 2297 <p>
2298 2298 Returns 0 if all files are successfully added.
2299 2299 </p>
2300 2300 <p>
2301 2301 options ([+] can be repeated):
2302 2302 </p>
2303 2303 <table>
2304 2304 <tr><td>-I</td>
2305 2305 <td>--include PATTERN [+]</td>
2306 2306 <td>include names matching the given patterns</td></tr>
2307 2307 <tr><td>-X</td>
2308 2308 <td>--exclude PATTERN [+]</td>
2309 2309 <td>exclude names matching the given patterns</td></tr>
2310 2310 <tr><td>-S</td>
2311 2311 <td>--subrepos</td>
2312 2312 <td>recurse into subrepositories</td></tr>
2313 2313 <tr><td>-n</td>
2314 2314 <td>--dry-run</td>
2315 2315 <td>do not perform actions, just print output</td></tr>
2316 2316 </table>
2317 2317 <p>
2318 2318 global options ([+] can be repeated):
2319 2319 </p>
2320 2320 <table>
2321 2321 <tr><td>-R</td>
2322 2322 <td>--repository REPO</td>
2323 2323 <td>repository root directory or name of overlay bundle file</td></tr>
2324 2324 <tr><td></td>
2325 2325 <td>--cwd DIR</td>
2326 2326 <td>change working directory</td></tr>
2327 2327 <tr><td>-y</td>
2328 2328 <td>--noninteractive</td>
2329 2329 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2330 2330 <tr><td>-q</td>
2331 2331 <td>--quiet</td>
2332 2332 <td>suppress output</td></tr>
2333 2333 <tr><td>-v</td>
2334 2334 <td>--verbose</td>
2335 2335 <td>enable additional output</td></tr>
2336 2336 <tr><td></td>
2337 2337 <td>--config CONFIG [+]</td>
2338 2338 <td>set/override config option (use 'section.name=value')</td></tr>
2339 2339 <tr><td></td>
2340 2340 <td>--debug</td>
2341 2341 <td>enable debugging output</td></tr>
2342 2342 <tr><td></td>
2343 2343 <td>--debugger</td>
2344 2344 <td>start debugger</td></tr>
2345 2345 <tr><td></td>
2346 2346 <td>--encoding ENCODE</td>
2347 2347 <td>set the charset encoding (default: ascii)</td></tr>
2348 2348 <tr><td></td>
2349 2349 <td>--encodingmode MODE</td>
2350 2350 <td>set the charset encoding mode (default: strict)</td></tr>
2351 2351 <tr><td></td>
2352 2352 <td>--traceback</td>
2353 2353 <td>always print a traceback on exception</td></tr>
2354 2354 <tr><td></td>
2355 2355 <td>--time</td>
2356 2356 <td>time how long the command takes</td></tr>
2357 2357 <tr><td></td>
2358 2358 <td>--profile</td>
2359 2359 <td>print command execution profile</td></tr>
2360 2360 <tr><td></td>
2361 2361 <td>--version</td>
2362 2362 <td>output version information and exit</td></tr>
2363 2363 <tr><td>-h</td>
2364 2364 <td>--help</td>
2365 2365 <td>display help and exit</td></tr>
2366 2366 <tr><td></td>
2367 2367 <td>--hidden</td>
2368 2368 <td>consider hidden changesets</td></tr>
2369 2369 </table>
2370 2370
2371 2371 </div>
2372 2372 </div>
2373 2373 </div>
2374 2374
2375 2375 <script type="text/javascript">process_dates()</script>
2376 2376
2377 2377
2378 2378 </body>
2379 2379 </html>
2380 2380
2381 2381
2382 2382 $ get-with-headers.py 127.0.0.1:$HGPORT "help/remove"
2383 2383 200 Script output follows
2384 2384
2385 2385 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2386 2386 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2387 2387 <head>
2388 2388 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2389 2389 <meta name="robots" content="index, nofollow" />
2390 2390 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2391 2391 <script type="text/javascript" src="/static/mercurial.js"></script>
2392 2392
2393 2393 <title>Help: remove</title>
2394 2394 </head>
2395 2395 <body>
2396 2396
2397 2397 <div class="container">
2398 2398 <div class="menu">
2399 2399 <div class="logo">
2400 2400 <a href="https://mercurial-scm.org/">
2401 2401 <img src="/static/hglogo.png" alt="mercurial" /></a>
2402 2402 </div>
2403 2403 <ul>
2404 2404 <li><a href="/shortlog">log</a></li>
2405 2405 <li><a href="/graph">graph</a></li>
2406 2406 <li><a href="/tags">tags</a></li>
2407 2407 <li><a href="/bookmarks">bookmarks</a></li>
2408 2408 <li><a href="/branches">branches</a></li>
2409 2409 </ul>
2410 2410 <ul>
2411 2411 <li class="active"><a href="/help">help</a></li>
2412 2412 </ul>
2413 2413 </div>
2414 2414
2415 2415 <div class="main">
2416 2416 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2417 2417 <h3>Help: remove</h3>
2418 2418
2419 2419 <form class="search" action="/log">
2420 2420
2421 2421 <p><input name="rev" id="search1" type="text" size="30" /></p>
2422 2422 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2423 2423 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2424 2424 </form>
2425 2425 <div id="doc">
2426 2426 <p>
2427 2427 hg remove [OPTION]... FILE...
2428 2428 </p>
2429 2429 <p>
2430 2430 aliases: rm
2431 2431 </p>
2432 2432 <p>
2433 2433 remove the specified files on the next commit
2434 2434 </p>
2435 2435 <p>
2436 2436 Schedule the indicated files for removal from the current branch.
2437 2437 </p>
2438 2438 <p>
2439 2439 This command schedules the files to be removed at the next commit.
2440 2440 To undo a remove before that, see 'hg revert'. To undo added
2441 2441 files, see 'hg forget'.
2442 2442 </p>
2443 2443 <p>
2444 2444 -A/--after can be used to remove only files that have already
2445 2445 been deleted, -f/--force can be used to force deletion, and -Af
2446 2446 can be used to remove files from the next revision without
2447 2447 deleting them from the working directory.
2448 2448 </p>
2449 2449 <p>
2450 2450 The following table details the behavior of remove for different
2451 2451 file states (columns) and option combinations (rows). The file
2452 2452 states are Added [A], Clean [C], Modified [M] and Missing [!]
2453 2453 (as reported by 'hg status'). The actions are Warn, Remove
2454 2454 (from branch) and Delete (from disk):
2455 2455 </p>
2456 2456 <table>
2457 2457 <tr><td>opt/state</td>
2458 2458 <td>A</td>
2459 2459 <td>C</td>
2460 2460 <td>M</td>
2461 2461 <td>!</td></tr>
2462 2462 <tr><td>none</td>
2463 2463 <td>W</td>
2464 2464 <td>RD</td>
2465 2465 <td>W</td>
2466 2466 <td>R</td></tr>
2467 2467 <tr><td>-f</td>
2468 2468 <td>R</td>
2469 2469 <td>RD</td>
2470 2470 <td>RD</td>
2471 2471 <td>R</td></tr>
2472 2472 <tr><td>-A</td>
2473 2473 <td>W</td>
2474 2474 <td>W</td>
2475 2475 <td>W</td>
2476 2476 <td>R</td></tr>
2477 2477 <tr><td>-Af</td>
2478 2478 <td>R</td>
2479 2479 <td>R</td>
2480 2480 <td>R</td>
2481 2481 <td>R</td></tr>
2482 2482 </table>
2483 2483 <p>
2484 2484 <b>Note:</b>
2485 2485 </p>
2486 2486 <p>
2487 2487 'hg remove' never deletes files in Added [A] state from the
2488 2488 working directory, not even if &quot;--force&quot; is specified.
2489 2489 </p>
2490 2490 <p>
2491 2491 Returns 0 on success, 1 if any warnings encountered.
2492 2492 </p>
2493 2493 <p>
2494 2494 options ([+] can be repeated):
2495 2495 </p>
2496 2496 <table>
2497 2497 <tr><td>-A</td>
2498 2498 <td>--after</td>
2499 2499 <td>record delete for missing files</td></tr>
2500 2500 <tr><td>-f</td>
2501 2501 <td>--force</td>
2502 2502 <td>remove (and delete) file even if added or modified</td></tr>
2503 2503 <tr><td>-S</td>
2504 2504 <td>--subrepos</td>
2505 2505 <td>recurse into subrepositories</td></tr>
2506 2506 <tr><td>-I</td>
2507 2507 <td>--include PATTERN [+]</td>
2508 2508 <td>include names matching the given patterns</td></tr>
2509 2509 <tr><td>-X</td>
2510 2510 <td>--exclude PATTERN [+]</td>
2511 2511 <td>exclude names matching the given patterns</td></tr>
2512 2512 </table>
2513 2513 <p>
2514 2514 global options ([+] can be repeated):
2515 2515 </p>
2516 2516 <table>
2517 2517 <tr><td>-R</td>
2518 2518 <td>--repository REPO</td>
2519 2519 <td>repository root directory or name of overlay bundle file</td></tr>
2520 2520 <tr><td></td>
2521 2521 <td>--cwd DIR</td>
2522 2522 <td>change working directory</td></tr>
2523 2523 <tr><td>-y</td>
2524 2524 <td>--noninteractive</td>
2525 2525 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2526 2526 <tr><td>-q</td>
2527 2527 <td>--quiet</td>
2528 2528 <td>suppress output</td></tr>
2529 2529 <tr><td>-v</td>
2530 2530 <td>--verbose</td>
2531 2531 <td>enable additional output</td></tr>
2532 2532 <tr><td></td>
2533 2533 <td>--config CONFIG [+]</td>
2534 2534 <td>set/override config option (use 'section.name=value')</td></tr>
2535 2535 <tr><td></td>
2536 2536 <td>--debug</td>
2537 2537 <td>enable debugging output</td></tr>
2538 2538 <tr><td></td>
2539 2539 <td>--debugger</td>
2540 2540 <td>start debugger</td></tr>
2541 2541 <tr><td></td>
2542 2542 <td>--encoding ENCODE</td>
2543 2543 <td>set the charset encoding (default: ascii)</td></tr>
2544 2544 <tr><td></td>
2545 2545 <td>--encodingmode MODE</td>
2546 2546 <td>set the charset encoding mode (default: strict)</td></tr>
2547 2547 <tr><td></td>
2548 2548 <td>--traceback</td>
2549 2549 <td>always print a traceback on exception</td></tr>
2550 2550 <tr><td></td>
2551 2551 <td>--time</td>
2552 2552 <td>time how long the command takes</td></tr>
2553 2553 <tr><td></td>
2554 2554 <td>--profile</td>
2555 2555 <td>print command execution profile</td></tr>
2556 2556 <tr><td></td>
2557 2557 <td>--version</td>
2558 2558 <td>output version information and exit</td></tr>
2559 2559 <tr><td>-h</td>
2560 2560 <td>--help</td>
2561 2561 <td>display help and exit</td></tr>
2562 2562 <tr><td></td>
2563 2563 <td>--hidden</td>
2564 2564 <td>consider hidden changesets</td></tr>
2565 2565 </table>
2566 2566
2567 2567 </div>
2568 2568 </div>
2569 2569 </div>
2570 2570
2571 2571 <script type="text/javascript">process_dates()</script>
2572 2572
2573 2573
2574 2574 </body>
2575 2575 </html>
2576 2576
2577 2577
2578 2578 $ get-with-headers.py 127.0.0.1:$HGPORT "help/revisions"
2579 2579 200 Script output follows
2580 2580
2581 2581 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2582 2582 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2583 2583 <head>
2584 2584 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2585 2585 <meta name="robots" content="index, nofollow" />
2586 2586 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2587 2587 <script type="text/javascript" src="/static/mercurial.js"></script>
2588 2588
2589 2589 <title>Help: revisions</title>
2590 2590 </head>
2591 2591 <body>
2592 2592
2593 2593 <div class="container">
2594 2594 <div class="menu">
2595 2595 <div class="logo">
2596 2596 <a href="https://mercurial-scm.org/">
2597 2597 <img src="/static/hglogo.png" alt="mercurial" /></a>
2598 2598 </div>
2599 2599 <ul>
2600 2600 <li><a href="/shortlog">log</a></li>
2601 2601 <li><a href="/graph">graph</a></li>
2602 2602 <li><a href="/tags">tags</a></li>
2603 2603 <li><a href="/bookmarks">bookmarks</a></li>
2604 2604 <li><a href="/branches">branches</a></li>
2605 2605 </ul>
2606 2606 <ul>
2607 2607 <li class="active"><a href="/help">help</a></li>
2608 2608 </ul>
2609 2609 </div>
2610 2610
2611 2611 <div class="main">
2612 2612 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2613 2613 <h3>Help: revisions</h3>
2614 2614
2615 2615 <form class="search" action="/log">
2616 2616
2617 2617 <p><input name="rev" id="search1" type="text" size="30" /></p>
2618 2618 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2619 2619 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2620 2620 </form>
2621 2621 <div id="doc">
2622 2622 <h1>Specifying Single Revisions</h1>
2623 2623 <p>
2624 2624 Mercurial supports several ways to specify individual revisions.
2625 2625 </p>
2626 2626 <p>
2627 2627 A plain integer is treated as a revision number. Negative integers are
2628 2628 treated as sequential offsets from the tip, with -1 denoting the tip,
2629 2629 -2 denoting the revision prior to the tip, and so forth.
2630 2630 </p>
2631 2631 <p>
2632 2632 A 40-digit hexadecimal string is treated as a unique revision
2633 2633 identifier.
2634 2634 </p>
2635 2635 <p>
2636 2636 A hexadecimal string less than 40 characters long is treated as a
2637 2637 unique revision identifier and is referred to as a short-form
2638 2638 identifier. A short-form identifier is only valid if it is the prefix
2639 2639 of exactly one full-length identifier.
2640 2640 </p>
2641 2641 <p>
2642 2642 Any other string is treated as a bookmark, tag, or branch name. A
2643 2643 bookmark is a movable pointer to a revision. A tag is a permanent name
2644 2644 associated with a revision. A branch name denotes the tipmost open branch head
2645 2645 of that branch - or if they are all closed, the tipmost closed head of the
2646 2646 branch. Bookmark, tag, and branch names must not contain the &quot;:&quot; character.
2647 2647 </p>
2648 2648 <p>
2649 2649 The reserved name &quot;tip&quot; always identifies the most recent revision.
2650 2650 </p>
2651 2651 <p>
2652 2652 The reserved name &quot;null&quot; indicates the null revision. This is the
2653 2653 revision of an empty repository, and the parent of revision 0.
2654 2654 </p>
2655 2655 <p>
2656 2656 The reserved name &quot;.&quot; indicates the working directory parent. If no
2657 2657 working directory is checked out, it is equivalent to null. If an
2658 2658 uncommitted merge is in progress, &quot;.&quot; is the revision of the first
2659 2659 parent.
2660 2660 </p>
2661 2661
2662 2662 </div>
2663 2663 </div>
2664 2664 </div>
2665 2665
2666 2666 <script type="text/javascript">process_dates()</script>
2667 2667
2668 2668
2669 2669 </body>
2670 2670 </html>
2671 2671
2672 2672
2673 2673 Sub-topic indexes rendered properly
2674 2674
2675 2675 $ get-with-headers.py 127.0.0.1:$HGPORT "help/internals"
2676 2676 200 Script output follows
2677 2677
2678 2678 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2679 2679 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2680 2680 <head>
2681 2681 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2682 2682 <meta name="robots" content="index, nofollow" />
2683 2683 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2684 2684 <script type="text/javascript" src="/static/mercurial.js"></script>
2685 2685
2686 2686 <title>Help: internals</title>
2687 2687 </head>
2688 2688 <body>
2689 2689
2690 2690 <div class="container">
2691 2691 <div class="menu">
2692 2692 <div class="logo">
2693 2693 <a href="https://mercurial-scm.org/">
2694 2694 <img src="/static/hglogo.png" alt="mercurial" /></a>
2695 2695 </div>
2696 2696 <ul>
2697 2697 <li><a href="/shortlog">log</a></li>
2698 2698 <li><a href="/graph">graph</a></li>
2699 2699 <li><a href="/tags">tags</a></li>
2700 2700 <li><a href="/bookmarks">bookmarks</a></li>
2701 2701 <li><a href="/branches">branches</a></li>
2702 2702 </ul>
2703 2703 <ul>
2704 2704 <li><a href="/help">help</a></li>
2705 2705 </ul>
2706 2706 </div>
2707 2707
2708 2708 <div class="main">
2709 2709 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2710 2710 <form class="search" action="/log">
2711 2711
2712 2712 <p><input name="rev" id="search1" type="text" size="30" /></p>
2713 2713 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2714 2714 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2715 2715 </form>
2716 2716 <table class="bigtable">
2717 2717 <tr><td colspan="2"><h2><a name="main" href="#topics">Topics</a></h2></td></tr>
2718 2718
2719 2719 <tr><td>
2720 2720 <a href="/help/internals.bundles">
2721 2721 bundles
2722 2722 </a>
2723 2723 </td><td>
2724 2724 container for exchange of repository data
2725 2725 </td></tr>
2726 2726 <tr><td>
2727 2727 <a href="/help/internals.changegroups">
2728 2728 changegroups
2729 2729 </a>
2730 2730 </td><td>
2731 2731 representation of revlog data
2732 2732 </td></tr>
2733 2733 <tr><td>
2734 2734 <a href="/help/internals.requirements">
2735 2735 requirements
2736 2736 </a>
2737 2737 </td><td>
2738 2738 repository requirements
2739 2739 </td></tr>
2740 2740 <tr><td>
2741 2741 <a href="/help/internals.revlogs">
2742 2742 revlogs
2743 2743 </a>
2744 2744 </td><td>
2745 2745 revision storage mechanism
2746 2746 </td></tr>
2747 2747
2748 2748
2749 2749
2750 2750
2751 2751
2752 2752 </table>
2753 2753 </div>
2754 2754 </div>
2755 2755
2756 2756 <script type="text/javascript">process_dates()</script>
2757 2757
2758 2758
2759 2759 </body>
2760 2760 </html>
2761 2761
2762 2762
2763 2763 Sub-topic topics rendered properly
2764 2764
2765 2765 $ get-with-headers.py 127.0.0.1:$HGPORT "help/internals.changegroups"
2766 2766 200 Script output follows
2767 2767
2768 2768 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2769 2769 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2770 2770 <head>
2771 2771 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2772 2772 <meta name="robots" content="index, nofollow" />
2773 2773 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2774 2774 <script type="text/javascript" src="/static/mercurial.js"></script>
2775 2775
2776 2776 <title>Help: internals.changegroups</title>
2777 2777 </head>
2778 2778 <body>
2779 2779
2780 2780 <div class="container">
2781 2781 <div class="menu">
2782 2782 <div class="logo">
2783 2783 <a href="https://mercurial-scm.org/">
2784 2784 <img src="/static/hglogo.png" alt="mercurial" /></a>
2785 2785 </div>
2786 2786 <ul>
2787 2787 <li><a href="/shortlog">log</a></li>
2788 2788 <li><a href="/graph">graph</a></li>
2789 2789 <li><a href="/tags">tags</a></li>
2790 2790 <li><a href="/bookmarks">bookmarks</a></li>
2791 2791 <li><a href="/branches">branches</a></li>
2792 2792 </ul>
2793 2793 <ul>
2794 2794 <li class="active"><a href="/help">help</a></li>
2795 2795 </ul>
2796 2796 </div>
2797 2797
2798 2798 <div class="main">
2799 2799 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2800 2800 <h3>Help: internals.changegroups</h3>
2801 2801
2802 2802 <form class="search" action="/log">
2803 2803
2804 2804 <p><input name="rev" id="search1" type="text" size="30" /></p>
2805 2805 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2806 2806 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2807 2807 </form>
2808 2808 <div id="doc">
2809 2809 <h1>representation of revlog data</h1>
2810 2810 <h2>Changegroups</h2>
2811 2811 <p>
2812 2812 Changegroups are representations of repository revlog data, specifically
2813 2813 the changelog, manifest, and filelogs.
2814 2814 </p>
2815 2815 <p>
2816 2816 There are 3 versions of changegroups: &quot;1&quot;, &quot;2&quot;, and &quot;3&quot;. From a
2817 2817 high-level, versions &quot;1&quot; and &quot;2&quot; are almost exactly the same, with
2818 2818 the only difference being a header on entries in the changeset
2819 2819 segment. Version &quot;3&quot; adds support for exchanging treemanifests and
2820 2820 includes revlog flags in the delta header.
2821 2821 </p>
2822 2822 <p>
2823 2823 Changegroups consists of 3 logical segments:
2824 2824 </p>
2825 2825 <pre>
2826 2826 +---------------------------------+
2827 2827 | | | |
2828 2828 | changeset | manifest | filelogs |
2829 2829 | | | |
2830 2830 +---------------------------------+
2831 2831 </pre>
2832 2832 <p>
2833 2833 The principle building block of each segment is a *chunk*. A *chunk*
2834 2834 is a framed piece of data:
2835 2835 </p>
2836 2836 <pre>
2837 2837 +---------------------------------------+
2838 2838 | | |
2839 2839 | length | data |
2840 2840 | (32 bits) | &lt;length&gt; bytes |
2841 2841 | | |
2842 2842 +---------------------------------------+
2843 2843 </pre>
2844 2844 <p>
2845 2845 Each chunk starts with a 32-bit big-endian signed integer indicating
2846 2846 the length of the raw data that follows.
2847 2847 </p>
2848 2848 <p>
2849 2849 There is a special case chunk that has 0 length (&quot;0x00000000&quot;). We
2850 2850 call this an *empty chunk*.
2851 2851 </p>
2852 2852 <h3>Delta Groups</h3>
2853 2853 <p>
2854 2854 A *delta group* expresses the content of a revlog as a series of deltas,
2855 2855 or patches against previous revisions.
2856 2856 </p>
2857 2857 <p>
2858 2858 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
2859 2859 to signal the end of the delta group:
2860 2860 </p>
2861 2861 <pre>
2862 2862 +------------------------------------------------------------------------+
2863 2863 | | | | | |
2864 2864 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
2865 2865 | (32 bits) | (various) | (32 bits) | (various) | (32 bits) |
2866 2866 | | | | | |
2867 2867 +------------------------------------------------------------+-----------+
2868 2868 </pre>
2869 2869 <p>
2870 2870 Each *chunk*'s data consists of the following:
2871 2871 </p>
2872 2872 <pre>
2873 2873 +-----------------------------------------+
2874 2874 | | | |
2875 2875 | delta header | mdiff header | delta |
2876 2876 | (various) | (12 bytes) | (various) |
2877 2877 | | | |
2878 2878 +-----------------------------------------+
2879 2879 </pre>
2880 2880 <p>
2881 2881 The *length* field is the byte length of the remaining 3 logical pieces
2882 2882 of data. The *delta* is a diff from an existing entry in the changelog.
2883 2883 </p>
2884 2884 <p>
2885 2885 The *delta header* is different between versions &quot;1&quot;, &quot;2&quot;, and
2886 2886 &quot;3&quot; of the changegroup format.
2887 2887 </p>
2888 2888 <p>
2889 2889 Version 1:
2890 2890 </p>
2891 2891 <pre>
2892 2892 +------------------------------------------------------+
2893 2893 | | | | |
2894 2894 | node | p1 node | p2 node | link node |
2895 2895 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
2896 2896 | | | | |
2897 2897 +------------------------------------------------------+
2898 2898 </pre>
2899 2899 <p>
2900 2900 Version 2:
2901 2901 </p>
2902 2902 <pre>
2903 2903 +------------------------------------------------------------------+
2904 2904 | | | | | |
2905 2905 | node | p1 node | p2 node | base node | link node |
2906 2906 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
2907 2907 | | | | | |
2908 2908 +------------------------------------------------------------------+
2909 2909 </pre>
2910 2910 <p>
2911 2911 Version 3:
2912 2912 </p>
2913 2913 <pre>
2914 2914 +------------------------------------------------------------------------------+
2915 2915 | | | | | | |
2916 2916 | node | p1 node | p2 node | base node | link node | flags |
2917 2917 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
2918 2918 | | | | | | |
2919 2919 +------------------------------------------------------------------------------+
2920 2920 </pre>
2921 2921 <p>
2922 2922 The *mdiff header* consists of 3 32-bit big-endian signed integers
2923 2923 describing offsets at which to apply the following delta content:
2924 2924 </p>
2925 2925 <pre>
2926 2926 +-------------------------------------+
2927 2927 | | | |
2928 2928 | offset | old length | new length |
2929 2929 | (32 bits) | (32 bits) | (32 bits) |
2930 2930 | | | |
2931 2931 +-------------------------------------+
2932 2932 </pre>
2933 2933 <p>
2934 2934 In version 1, the delta is always applied against the previous node from
2935 2935 the changegroup or the first parent if this is the first entry in the
2936 2936 changegroup.
2937 2937 </p>
2938 2938 <p>
2939 2939 In version 2, the delta base node is encoded in the entry in the
2940 2940 changegroup. This allows the delta to be expressed against any parent,
2941 2941 which can result in smaller deltas and more efficient encoding of data.
2942 2942 </p>
2943 2943 <h3>Changeset Segment</h3>
2944 2944 <p>
2945 2945 The *changeset segment* consists of a single *delta group* holding
2946 2946 changelog data. It is followed by an *empty chunk* to denote the
2947 2947 boundary to the *manifests segment*.
2948 2948 </p>
2949 2949 <h3>Manifest Segment</h3>
2950 2950 <p>
2951 2951 The *manifest segment* consists of a single *delta group* holding
2952 2952 manifest data. It is followed by an *empty chunk* to denote the boundary
2953 2953 to the *filelogs segment*.
2954 2954 </p>
2955 2955 <h3>Filelogs Segment</h3>
2956 2956 <p>
2957 2957 The *filelogs* segment consists of multiple sub-segments, each
2958 2958 corresponding to an individual file whose data is being described:
2959 2959 </p>
2960 2960 <pre>
2961 2961 +--------------------------------------+
2962 2962 | | | | |
2963 2963 | filelog0 | filelog1 | filelog2 | ... |
2964 2964 | | | | |
2965 2965 +--------------------------------------+
2966 2966 </pre>
2967 2967 <p>
2968 2968 In version &quot;3&quot; of the changegroup format, filelogs may include
2969 2969 directory logs when treemanifests are in use. directory logs are
2970 2970 identified by having a trailing '/' on their filename (see below).
2971 2971 </p>
2972 2972 <p>
2973 2973 The final filelog sub-segment is followed by an *empty chunk* to denote
2974 2974 the end of the segment and the overall changegroup.
2975 2975 </p>
2976 2976 <p>
2977 2977 Each filelog sub-segment consists of the following:
2978 2978 </p>
2979 2979 <pre>
2980 2980 +------------------------------------------+
2981 2981 | | | |
2982 2982 | filename size | filename | delta group |
2983 2983 | (32 bits) | (various) | (various) |
2984 2984 | | | |
2985 2985 +------------------------------------------+
2986 2986 </pre>
2987 2987 <p>
2988 2988 That is, a *chunk* consisting of the filename (not terminated or padded)
2989 2989 followed by N chunks constituting the *delta group* for this file.
2990 2990 </p>
2991 2991
2992 2992 </div>
2993 2993 </div>
2994 2994 </div>
2995 2995
2996 2996 <script type="text/javascript">process_dates()</script>
2997 2997
2998 2998
2999 2999 </body>
3000 3000 </html>
3001 3001
3002 3002
3003 3003 $ killdaemons.py
3004 3004
3005 3005 #endif
General Comments 0
You need to be logged in to leave comments. Login now