Show More
@@ -1359,8 +1359,7 b' def overridecat(orig, ui, repo, file1, *' | |||
|
1359 | 1359 | m.visitdir = lfvisitdirfn |
|
1360 | 1360 | |
|
1361 | 1361 | for f in ctx.walk(m): |
|
1362 |
with cmdutil.makefileobj( |
|
|
1363 | pathname=f) as fp: | |
|
1362 | with cmdutil.makefileobj(ctx, opts.get('output'), pathname=f) as fp: | |
|
1364 | 1363 | lf = lfutil.splitstandin(f) |
|
1365 | 1364 | if lf is None or origmatchfn(f): |
|
1366 | 1365 | # duplicating unreachable code from commands.cat |
@@ -956,19 +956,19 b' class _unclosablefile(object):' | |||
|
956 | 956 | def __exit__(self, exc_type, exc_value, exc_tb): |
|
957 | 957 | pass |
|
958 | 958 | |
|
959 |
def makefileobj( |
|
|
959 | def makefileobj(ctx, pat, desc=None, total=None, | |
|
960 | 960 | seqno=None, revwidth=None, mode='wb', modemap=None, |
|
961 | 961 | pathname=None): |
|
962 | 962 | |
|
963 | 963 | writable = mode not in ('r', 'rb') |
|
964 | 964 | |
|
965 | 965 | if isstdiofilename(pat): |
|
966 | repo = ctx.repo() | |
|
966 | 967 | if writable: |
|
967 | 968 | fp = repo.ui.fout |
|
968 | 969 | else: |
|
969 | 970 | fp = repo.ui.fin |
|
970 | 971 | return _unclosablefile(fp) |
|
971 | ctx = repo[node] | |
|
972 | 972 | fn = makefilename(ctx, pat, desc, total, seqno, revwidth, pathname) |
|
973 | 973 | if modemap is not None: |
|
974 | 974 | mode = modemap.get(fn, mode) |
@@ -1546,7 +1546,7 b" def export(repo, revs, fntemplate='hg-%h" | |||
|
1546 | 1546 | if not fp and fntemplate: |
|
1547 | 1547 | desc_lines = ctx.description().rstrip().split('\n') |
|
1548 | 1548 | desc = desc_lines[0] #Commit always has a first line. |
|
1549 |
fo = makefileobj( |
|
|
1549 | fo = makefileobj(ctx, fntemplate, desc=desc, | |
|
1550 | 1550 | total=total, seqno=seqno, revwidth=revwidth, |
|
1551 | 1551 | mode='wb', modemap=filemode) |
|
1552 | 1552 | dest = fo.name |
@@ -486,7 +486,7 b' def archive(ui, repo, dest, **opts):' | |||
|
486 | 486 | if dest == '-': |
|
487 | 487 | if kind == 'files': |
|
488 | 488 | raise error.Abort(_('cannot archive plain files to stdout')) |
|
489 |
dest = cmdutil.makefileobj( |
|
|
489 | dest = cmdutil.makefileobj(ctx, dest) | |
|
490 | 490 | if not prefix: |
|
491 | 491 | prefix = os.path.basename(repo.root) + '-%h' |
|
492 | 492 |
@@ -1642,8 +1642,7 b' class gitsubrepo(abstractsubrepo):' | |||
|
1642 | 1642 | # TODO: add support for non-plain formatter (see cmdutil.cat()) |
|
1643 | 1643 | for f in match.files(): |
|
1644 | 1644 | output = self._gitcommand(["show", "%s:%s" % (rev, f)]) |
|
1645 |
fp = cmdutil.makefileobj(self._ |
|
|
1646 | self._ctx.node(), | |
|
1645 | fp = cmdutil.makefileobj(self._ctx, fntemplate, | |
|
1647 | 1646 | pathname=self.wvfs.reljoin(prefix, f)) |
|
1648 | 1647 | fp.write(output) |
|
1649 | 1648 | fp.close() |
General Comments 0
You need to be logged in to leave comments.
Login now