##// END OF EJS Templates
cmdutil: make_file to makefileobj
Matt Mackall -
r14291:1a791993 default
parent child Browse files
Show More
@@ -234,8 +234,8 b' def makefilename(repo, pat, node,'
234 raise util.Abort(_("invalid format spec '%%%s' in output filename") %
234 raise util.Abort(_("invalid format spec '%%%s' in output filename") %
235 inst.args[0])
235 inst.args[0])
236
236
237 def make_file(repo, pat, node=None,
237 def makefileobj(repo, pat, node=None, total=None,
238 total=None, seqno=None, revwidth=None, mode='wb', pathname=None):
238 seqno=None, revwidth=None, mode='wb', pathname=None):
239
239
240 writable = mode not in ('r', 'rb')
240 writable = mode not in ('r', 'rb')
241
241
@@ -541,8 +541,8 b" def export(repo, revs, template='hg-%h.p"
541
541
542 shouldclose = False
542 shouldclose = False
543 if not fp:
543 if not fp:
544 fp = make_file(repo, template, node, total=total, seqno=seqno,
544 fp = makefileobj(repo, template, node, total=total, seqno=seqno,
545 revwidth=revwidth, mode='ab')
545 revwidth=revwidth, mode='ab')
546 if fp != template:
546 if fp != template:
547 shouldclose = True
547 shouldclose = True
548 if fp != sys.stdout and hasattr(fp, 'name'):
548 if fp != sys.stdout and hasattr(fp, 'name'):
@@ -748,7 +748,8 b' def cat(ui, repo, file1, *pats, **opts):'
748 err = 1
748 err = 1
749 m = cmdutil.match(repo, (file1,) + pats, opts)
749 m = cmdutil.match(repo, (file1,) + pats, opts)
750 for abs in ctx.walk(m):
750 for abs in ctx.walk(m):
751 fp = cmdutil.make_file(repo, opts.get('output'), ctx.node(), pathname=abs)
751 fp = cmdutil.makefileobj(repo, opts.get('output'), ctx.node(),
752 pathname=abs)
752 data = ctx[abs].data()
753 data = ctx[abs].data()
753 if opts.get('decode'):
754 if opts.get('decode'):
754 data = repo.wwritedata(abs, data)
755 data = repo.wwritedata(abs, data)
General Comments 0
You need to be logged in to leave comments. Login now