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