# HG changeset patch # User mpm@selenic.com # Date 1118257158 28800 # Node ID 574420507d8c771261156c812082e9ff10ddc991 # Parent a69c3b2957d1ad68c19332b7268cb476668cb220 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 manifest hash: a443a66dfb90b38ea491de1e817b2877170bc9f8 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCp0AGywK+sNU5EO8RAgfVAJ9vlXfLKs1A/TegG3wuPeuxoSQMCACbBPGF RObiYj1st0k1zQYBlvSlQbk= =GZbB -----END PGP SIGNATURE----- diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -23,7 +23,7 @@ def filterfiles(filters, files): def relfilter(repo, files): if os.getcwd() != repo.root: p = os.getcwd()[len(repo.root) + 1: ] - return filterfiles(p, files) + return filterfiles([p], files) return files def relpath(repo, args): @@ -160,7 +160,7 @@ def branch(ui, path): def cat(ui, repo, file, rev = []): """output the latest or given revision of a file""" - r = repo.file(file) + r = repo.file(relpath(repo, [file])[0]) n = r.tip() if rev: n = r.lookup(rev) sys.stdout.write(r.read(n))