comparison mercurial/commands.py @ 1763:fa34a74efc40

Make option --branch vs. --branches more consistent. As you can abbreviate --branches to --branch, old scripts using the long name will still work.
author Thomas Arendsen Hein <thomas@intevation.de>
date Tue, 21 Feb 2006 13:14:03 +0100
parents 8eaa8e06a364
children 4671078dbfe7
comparison
equal deleted inserted replaced
1762:8eaa8e06a364 1763:fa34a74efc40
1648 miss = 1 1648 miss = 1
1649 break 1649 break
1650 if miss: 1650 if miss:
1651 continue 1651 continue
1652 1652
1653 if opts['branch']: 1653 if opts['branches']:
1654 br = repo.branchlookup([repo.changelog.node(rev)]) 1654 br = repo.branchlookup([repo.changelog.node(rev)])
1655 1655
1656 show_changeset(du, repo, rev, brinfo=br) 1656 show_changeset(du, repo, rev, brinfo=br)
1657 if opts['patch']: 1657 if opts['patch']:
1658 prev = (parents and parents[0]) or nullid 1658 prev = (parents and parents[0]) or nullid
1711 if opts['patch']: 1711 if opts['patch']:
1712 prev = (parents and parents[0]) or nullid 1712 prev = (parents and parents[0]) or nullid
1713 dodiff(ui, ui, repo, prev, n) 1713 dodiff(ui, ui, repo, prev, n)
1714 ui.write("\n") 1714 ui.write("\n")
1715 1715
1716 def parents(ui, repo, rev=None, branch=None): 1716 def parents(ui, repo, rev=None, branches=None):
1717 """show the parents of the working dir or revision 1717 """show the parents of the working dir or revision
1718 1718
1719 Print the working directory's parent revisions. 1719 Print the working directory's parent revisions.
1720 """ 1720 """
1721 if rev: 1721 if rev:
1722 p = repo.changelog.parents(repo.lookup(rev)) 1722 p = repo.changelog.parents(repo.lookup(rev))
1723 else: 1723 else:
1724 p = repo.dirstate.parents() 1724 p = repo.dirstate.parents()
1725 1725
1726 br = None 1726 br = None
1727 if branch is not None: 1727 if branches is not None:
1728 br = repo.branchlookup(p) 1728 br = repo.branchlookup(p)
1729 for n in p: 1729 for n in p:
1730 if n != nullid: 1730 if n != nullid:
1731 show_changeset(ui, repo, changenode=n, brinfo=br) 1731 show_changeset(ui, repo, changenode=n, brinfo=br)
1732 1732
2224 2224
2225 Show the tip revision. 2225 Show the tip revision.
2226 """ 2226 """
2227 n = repo.changelog.tip() 2227 n = repo.changelog.tip()
2228 br = None 2228 br = None
2229 if opts['branch']: 2229 if opts['branches']:
2230 br = repo.branchlookup([n]) 2230 br = repo.branchlookup([n])
2231 show_changeset(ui, repo, changenode=n, brinfo=br) 2231 show_changeset(ui, repo, changenode=n, brinfo=br)
2232 if opts['patch']: 2232 if opts['patch']:
2233 dodiff(ui, ui, repo, repo.changelog.parents(n)[0], n) 2233 dodiff(ui, ui, repo, repo.changelog.parents(n)[0], n)
2234 2234
2441 ('r', 'rev', [], _('search in given revision range')), 2441 ('r', 'rev', [], _('search in given revision range')),
2442 ('u', 'user', None, _('print user who committed change'))], 2442 ('u', 'user', None, _('print user who committed change'))],
2443 _('hg grep [OPTION]... PATTERN [FILE]...')), 2443 _('hg grep [OPTION]... PATTERN [FILE]...')),
2444 "heads": 2444 "heads":
2445 (heads, 2445 (heads,
2446 [('b', 'branches', None, _('find branch info')), 2446 [('b', 'branches', None, _('show branches')),
2447 ('r', 'rev', '', _('show only heads which are descendants of rev'))], 2447 ('r', 'rev', '', _('show only heads which are descendants of rev'))],
2448 _('hg heads [-b] [-r <rev>]')), 2448 _('hg heads [-b] [-r <rev>]')),
2449 "help": (help_, [], _('hg help [COMMAND]')), 2449 "help": (help_, [], _('hg help [COMMAND]')),
2450 "identify|id": (identify, [], _('hg identify')), 2450 "identify|id": (identify, [], _('hg identify')),
2451 "import|patch": 2451 "import|patch":
2475 _('hg locate [OPTION]... [PATTERN]...')), 2475 _('hg locate [OPTION]... [PATTERN]...')),
2476 "^log|history": 2476 "^log|history":
2477 (log, 2477 (log,
2478 [('I', 'include', [], _('include names matching the given patterns')), 2478 [('I', 'include', [], _('include names matching the given patterns')),
2479 ('X', 'exclude', [], _('exclude names matching the given patterns')), 2479 ('X', 'exclude', [], _('exclude names matching the given patterns')),
2480 ('b', 'branch', None, _('show branches')), 2480 ('b', 'branches', None, _('show branches')),
2481 ('k', 'keyword', [], _('search for a keyword')), 2481 ('k', 'keyword', [], _('search for a keyword')),
2482 ('l', 'limit', '', _('limit number of changes displayed')), 2482 ('l', 'limit', '', _('limit number of changes displayed')),
2483 ('r', 'rev', [], _('show the specified revision or range')), 2483 ('r', 'rev', [], _('show the specified revision or range')),
2484 ('M', 'no-merges', None, _('do not show merges')), 2484 ('M', 'no-merges', None, _('do not show merges')),
2485 ('m', 'only-merges', None, _('show only merges')), 2485 ('m', 'only-merges', None, _('show only merges')),
2491 ('p', 'patch', None, _('show patch')), 2491 ('p', 'patch', None, _('show patch')),
2492 ('n', 'newest-first', None, _('show newest record first'))], 2492 ('n', 'newest-first', None, _('show newest record first'))],
2493 _('hg outgoing [-p] [-n] [-M] [DEST]')), 2493 _('hg outgoing [-p] [-n] [-M] [DEST]')),
2494 "^parents": 2494 "^parents":
2495 (parents, 2495 (parents,
2496 [('b', 'branch', None, _('show branches'))], 2496 [('b', 'branches', None, _('show branches'))],
2497 _('hg parents [-b] [REV]')), 2497 _('hg parents [-b] [REV]')),
2498 "paths": (paths, [], _('hg paths [NAME]')), 2498 "paths": (paths, [], _('hg paths [NAME]')),
2499 "^pull": 2499 "^pull":
2500 (pull, 2500 (pull,
2501 [('u', 'update', None, 2501 [('u', 'update', None,
2580 ('r', 'rev', '', _('revision to tag'))], 2580 ('r', 'rev', '', _('revision to tag'))],
2581 _('hg tag [-r REV] [OPTION]... NAME')), 2581 _('hg tag [-r REV] [OPTION]... NAME')),
2582 "tags": (tags, [], _('hg tags')), 2582 "tags": (tags, [], _('hg tags')),
2583 "tip": 2583 "tip":
2584 (tip, 2584 (tip,
2585 [('b', 'branch', None, _('show branches')), 2585 [('b', 'branches', None, _('show branches')),
2586 ('p', 'patch', None, _('show patch'))], 2586 ('p', 'patch', None, _('show patch'))],
2587 _('hg [-b] [-p] tip')), 2587 _('hg [-b] [-p] tip')),
2588 "unbundle": 2588 "unbundle":
2589 (unbundle, 2589 (unbundle,
2590 [('u', 'update', None, 2590 [('u', 'update', None,