comparison mercurial/commands.py @ 281:574420507d8c

hg cat: relative file support -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 hg cat: relative file support also fix a bug in relpath From: K Thananchayan <thananck@yahoo.com> manifest hash: a443a66dfb90b38ea491de1e817b2877170bc9f8 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCp0AGywK+sNU5EO8RAgfVAJ9vlXfLKs1A/TegG3wuPeuxoSQMCACbBPGF RObiYj1st0k1zQYBlvSlQbk= =GZbB -----END PGP SIGNATURE-----
author mpm@selenic.com
date Wed, 08 Jun 2005 10:59:18 -0800
parents 10e325db7347
children bd9d1e93f8d6
comparison
equal deleted inserted replaced
280:a69c3b2957d1 281:574420507d8c
21 return l 21 return l
22 22
23 def relfilter(repo, files): 23 def relfilter(repo, files):
24 if os.getcwd() != repo.root: 24 if os.getcwd() != repo.root:
25 p = os.getcwd()[len(repo.root) + 1: ] 25 p = os.getcwd()[len(repo.root) + 1: ]
26 return filterfiles(p, files) 26 return filterfiles([p], files)
27 return files 27 return files
28 28
29 def relpath(repo, args): 29 def relpath(repo, args):
30 if os.getcwd() != repo.root: 30 if os.getcwd() != repo.root:
31 p = os.getcwd()[len(repo.root) + 1: ] 31 p = os.getcwd()[len(repo.root) + 1: ]
158 # this should eventually support remote repos 158 # this should eventually support remote repos
159 os.system("cp -al %s/.hg .hg" % path) 159 os.system("cp -al %s/.hg .hg" % path)
160 160
161 def cat(ui, repo, file, rev = []): 161 def cat(ui, repo, file, rev = []):
162 """output the latest or given revision of a file""" 162 """output the latest or given revision of a file"""
163 r = repo.file(file) 163 r = repo.file(relpath(repo, [file])[0])
164 n = r.tip() 164 n = r.tip()
165 if rev: n = r.lookup(rev) 165 if rev: n = r.lookup(rev)
166 sys.stdout.write(r.read(n)) 166 sys.stdout.write(r.read(n))
167 167
168 def commit(ui, repo, *files): 168 def commit(ui, repo, *files):