comparison mercurial/commands.py @ 2565:7f78ca2c7977

convert hg cat to new context api
author Matt Mackall <mpm@selenic.com>
date Wed, 28 Jun 2006 17:11:42 -0500
parents a020024c5870
children d8560b458f76
comparison
equal deleted inserted replaced
2564:55e592041076 2565:7f78ca2c7977
878 878
879 %s basename of file being printed 879 %s basename of file being printed
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
899 890
900 Create a copy of an existing repository in a new directory. 891 Create a copy of an existing repository in a new directory.