mercurial/cmdutil.py
changeset 32573 f4cd4c49e302
parent 32572 447bbd970047
child 32608 7f4435078a8f
equal deleted inserted replaced
32572:447bbd970047 32573:f4cd4c49e302
  2630         for warning in warnings:
  2630         for warning in warnings:
  2631             ui.warn(warning)
  2631             ui.warn(warning)
  2632 
  2632 
  2633     return ret
  2633     return ret
  2634 
  2634 
  2635 def cat(ui, repo, ctx, matcher, prefix, **opts):
  2635 def cat(ui, repo, ctx, matcher, fntemplate, prefix, **opts):
  2636     err = 1
  2636     err = 1
  2637 
  2637 
  2638     def write(path):
  2638     def write(path):
  2639         fp = makefileobj(repo, opts.get('output'), ctx.node(),
  2639         fp = makefileobj(repo, fntemplate, ctx.node(),
  2640                          pathname=os.path.join(prefix, path))
  2640                          pathname=os.path.join(prefix, path))
  2641         data = ctx[path].data()
  2641         data = ctx[path].data()
  2642         if opts.get('decode'):
  2642         if opts.get('decode'):
  2643             data = repo.wwritedata(path, data)
  2643             data = repo.wwritedata(path, data)
  2644         fp.write(data)
  2644         fp.write(data)
  2664     for subpath in sorted(ctx.substate):
  2664     for subpath in sorted(ctx.substate):
  2665         sub = ctx.sub(subpath)
  2665         sub = ctx.sub(subpath)
  2666         try:
  2666         try:
  2667             submatch = matchmod.subdirmatcher(subpath, matcher)
  2667             submatch = matchmod.subdirmatcher(subpath, matcher)
  2668 
  2668 
  2669             if not sub.cat(submatch, os.path.join(prefix, sub._path),
  2669             if not sub.cat(submatch, fntemplate,
  2670                            **opts):
  2670                            os.path.join(prefix, sub._path), **opts):
  2671                 err = 0
  2671                 err = 0
  2672         except error.RepoLookupError:
  2672         except error.RepoLookupError:
  2673             ui.status(_("skipping missing subrepository: %s\n")
  2673             ui.status(_("skipping missing subrepository: %s\n")
  2674                            % os.path.join(prefix, subpath))
  2674                            % os.path.join(prefix, subpath))
  2675 
  2675