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