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