comparison mercurial/commands.py @ 2655:ddf404954092

merge with tonfa-experimental
author Matt Mackall <mpm@selenic.com>
date Wed, 19 Jul 2006 14:22:08 -0500
parents 001703ec311d 9bd3d44c32f6
children e57df017640d
comparison
equal deleted inserted replaced
2640:02b6fa7bbfbf 2655:ddf404954092
941 941
942 %s basename of file being printed 942 %s basename of file being printed
943 %d dirname of file being printed, or '.' if in repo root 943 %d dirname of file being printed, or '.' if in repo root
944 %p root-relative path name of file being printed 944 %p root-relative path name of file being printed
945 """ 945 """
946 ctx = repo.changectx(opts['rev'] or -1) 946 ctx = repo.changectx(opts['rev'] or "-1")
947 for src, abs, rel, exact in walk(repo, (file1,) + pats, opts, ctx.node()): 947 for src, abs, rel, exact in walk(repo, (file1,) + pats, opts, ctx.node()):
948 fp = make_file(repo, opts['output'], ctx.node(), pathname=abs) 948 fp = make_file(repo, opts['output'], ctx.node(), pathname=abs)
949 fp.write(ctx.filectx(abs).data()) 949 fp.write(ctx.filectx(abs).data())
950 950
951 def clone(ui, source, dest=None, **opts): 951 def clone(ui, source, dest=None, **opts):
2086 if opts['patch']: 2086 if opts['patch']:
2087 prev = (parents and parents[0]) or nullid 2087 prev = (parents and parents[0]) or nullid
2088 dodiff(ui, ui, repo, prev, n) 2088 dodiff(ui, ui, repo, prev, n)
2089 ui.write("\n") 2089 ui.write("\n")
2090 2090
2091 def parents(ui, repo, rev=None, branches=None, **opts): 2091 def parents(ui, repo, file_=None, rev=None, branches=None, **opts):
2092 """show the parents of the working dir or revision 2092 """show the parents of the working dir or revision
2093 2093
2094 Print the working directory's parent revisions. 2094 Print the working directory's parent revisions.
2095 """ 2095 """
2096 # legacy
2097 if file_ and not rev:
2098 try:
2099 rev = repo.lookup(file_)
2100 file_ = None
2101 except hg.RepoError:
2102 pass
2103 else:
2104 ui.warn(_("'hg parent REV' is deprecated, "
2105 "please use 'hg parents -r REV instead\n"))
2106
2096 if rev: 2107 if rev:
2097 p = repo.changelog.parents(repo.lookup(rev)) 2108 if file_:
2109 ctx = repo.filectx(file_, changeid=rev)
2110 else:
2111 ctx = repo.changectx(rev)
2112 p = [cp.node() for cp in ctx.parents()]
2098 else: 2113 else:
2099 p = repo.dirstate.parents() 2114 p = repo.dirstate.parents()
2100 2115
2101 br = None 2116 br = None
2102 if branches is not None: 2117 if branches is not None:
3042 _('specify hg command to run on the remote side'))], 3057 _('specify hg command to run on the remote side'))],
3043 _('hg outgoing [-M] [-p] [-n] [-r REV]... [DEST]')), 3058 _('hg outgoing [-M] [-p] [-n] [-r REV]... [DEST]')),
3044 "^parents": 3059 "^parents":
3045 (parents, 3060 (parents,
3046 [('b', 'branches', None, _('show branches')), 3061 [('b', 'branches', None, _('show branches')),
3062 ('r', 'rev', '', _('show parents from the specified rev')),
3047 ('', 'style', '', _('display using template map file')), 3063 ('', 'style', '', _('display using template map file')),
3048 ('', 'template', '', _('display with template'))], 3064 ('', 'template', '', _('display with template'))],
3049 _('hg parents [-b] [REV]')), 3065 _('hg parents [-b] [-r REV] [FILE]')),
3050 "paths": (paths, [], _('hg paths [NAME]')), 3066 "paths": (paths, [], _('hg paths [NAME]')),
3051 "^pull": 3067 "^pull":
3052 (pull, 3068 (pull,
3053 [('u', 'update', None, 3069 [('u', 'update', None,
3054 _('update the working directory to tip after pull')), 3070 _('update the working directory to tip after pull')),