comparison mercurial/commands.py @ 2653:b24efed24e8f

allow specifying a file to hg parents, change the syntax to use -r/--rev
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Mon, 17 Jul 2006 02:00:49 +0200
parents f84e166eb0de
children 9bd3d44c32f6
comparison
equal deleted inserted replaced
2652:f23973ea3107 2653:b24efed24e8f
2074 if opts['patch']: 2074 if opts['patch']:
2075 prev = (parents and parents[0]) or nullid 2075 prev = (parents and parents[0]) or nullid
2076 dodiff(ui, ui, repo, prev, n) 2076 dodiff(ui, ui, repo, prev, n)
2077 ui.write("\n") 2077 ui.write("\n")
2078 2078
2079 def parents(ui, repo, rev=None, branches=None, **opts): 2079 def parents(ui, repo, file_=None, rev=None, branches=None, **opts):
2080 """show the parents of the working dir or revision 2080 """show the parents of the working dir or revision
2081 2081
2082 Print the working directory's parent revisions. 2082 Print the working directory's parent revisions.
2083 """ 2083 """
2084 # legacy
2085 if file_ and not rev:
2086 try:
2087 rev = repo.lookup(file_)
2088 file_ = None
2089 except hg.RepoError:
2090 pass
2091 else:
2092 ui.warn(_("'hg parent REV' is deprecated, "
2093 "please use 'hg parents -r REV instead\n"))
2094
2084 if rev: 2095 if rev:
2085 p = repo.changelog.parents(repo.lookup(rev)) 2096 if file_:
2097 ctx = repo.filectx(file_, changeid=rev)
2098 else:
2099 ctx = repo.changectx(rev)
2100 p = [cp.node() for cp in ctx.parents()]
2086 else: 2101 else:
2087 p = repo.dirstate.parents() 2102 p = repo.dirstate.parents()
2088 2103
2089 br = None 2104 br = None
2090 if branches is not None: 2105 if branches is not None:
3023 _('specify hg command to run on the remote side'))], 3038 _('specify hg command to run on the remote side'))],
3024 _('hg outgoing [-M] [-p] [-n] [-r REV]... [DEST]')), 3039 _('hg outgoing [-M] [-p] [-n] [-r REV]... [DEST]')),
3025 "^parents": 3040 "^parents":
3026 (parents, 3041 (parents,
3027 [('b', 'branches', None, _('show branches')), 3042 [('b', 'branches', None, _('show branches')),
3043 ('r', 'rev', '', _('show parents from the specified rev')),
3028 ('', 'style', '', _('display using template map file')), 3044 ('', 'style', '', _('display using template map file')),
3029 ('', 'template', '', _('display with template'))], 3045 ('', 'template', '', _('display with template'))],
3030 _('hg parents [-b] [REV]')), 3046 _('hg parents [-b] [-r REV] [FILE]')),
3031 "paths": (paths, [], _('hg paths [NAME]')), 3047 "paths": (paths, [], _('hg paths [NAME]')),
3032 "^pull": 3048 "^pull":
3033 (pull, 3049 (pull,
3034 [('u', 'update', None, 3050 [('u', 'update', None,
3035 _('update the working directory to tip after pull')), 3051 _('update the working directory to tip after pull')),