##// END OF EJS Templates
convert hg cat to new context api
Matt Mackall -
r2565:7f78ca2c default
parent child Browse files
Show More
@@ -880,19 +880,10 b' def cat(ui, repo, file1, *pats, **opts):'
880 %d dirname of file being printed, or '.' if in repo root
880 %d dirname of file being printed, or '.' if in repo root
881 %p root-relative path name of file being printed
881 %p root-relative path name of file being printed
882 """
882 """
883 mf = {}
883 ctx = repo.changectx(opts['rev'] or -1)
884 rev = opts['rev']
884 for src, abs, rel, exact in walk(repo, (file1,) + pats, opts, ctx.node()):
885 if rev:
885 fp = make_file(repo, opts['output'], ctx.node(), pathname=abs)
886 node = repo.lookup(rev)
886 fp.write(ctx.filectx(abs).data())
887 else:
888 node = repo.changelog.tip()
889 change = repo.changelog.read(node)
890 mf = repo.manifest.read(change[0])
891 for src, abs, rel, exact in walk(repo, (file1,) + pats, opts, node):
892 r = repo.file(abs)
893 n = mf[abs]
894 fp = make_file(repo, opts['output'], node, pathname=abs)
895 fp.write(r.read(n))
896
887
897 def clone(ui, source, dest=None, **opts):
888 def clone(ui, source, dest=None, **opts):
898 """make a copy of an existing repository
889 """make a copy of an existing repository
General Comments 0
You need to be logged in to leave comments. Login now