##// END OF EJS Templates
allow specifying a file to hg parents, change the syntax to use -r/--rev
Benoit Boissinot -
r2644:b24efed2 default
parent child Browse files
Show More
@@ -2076,13 +2076,28 b' def outgoing(ui, repo, dest=None, **opts'
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
@@ -3025,9 +3040,10 b' table = {'
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,
General Comments 0
You need to be logged in to leave comments. Login now