Show More
@@ -1014,7 +1014,7 b' class _unclosablefile(object):' | |||||
1014 | def __exit__(self, exc_type, exc_value, exc_tb): |
|
1014 | def __exit__(self, exc_type, exc_value, exc_tb): | |
1015 | pass |
|
1015 | pass | |
1016 |
|
1016 | |||
1017 |
def makefileobj(ctx, pat, mode='wb', |
|
1017 | def makefileobj(ctx, pat, mode='wb', **props): | |
1018 | writable = mode not in ('r', 'rb') |
|
1018 | writable = mode not in ('r', 'rb') | |
1019 |
|
1019 | |||
1020 | if isstdiofilename(pat): |
|
1020 | if isstdiofilename(pat): | |
@@ -1025,10 +1025,6 b" def makefileobj(ctx, pat, mode='wb', mod" | |||||
1025 | fp = repo.ui.fin |
|
1025 | fp = repo.ui.fin | |
1026 | return _unclosablefile(fp) |
|
1026 | return _unclosablefile(fp) | |
1027 | fn = makefilename(ctx, pat, **props) |
|
1027 | fn = makefilename(ctx, pat, **props) | |
1028 | if modemap is not None: |
|
|||
1029 | mode = modemap.get(fn, mode) |
|
|||
1030 | if mode == 'wb': |
|
|||
1031 | modemap[fn] = 'ab' |
|
|||
1032 | return open(fn, mode) |
|
1028 | return open(fn, mode) | |
1033 |
|
1029 | |||
1034 | def openrevlog(repo, cmd, file_, opts): |
|
1030 | def openrevlog(repo, cmd, file_, opts): | |
@@ -1579,18 +1575,23 b' def _exportfntemplate(repo, revs, fntemp' | |||||
1579 | """Export changesets to possibly multiple files""" |
|
1575 | """Export changesets to possibly multiple files""" | |
1580 | total = len(revs) |
|
1576 | total = len(revs) | |
1581 | revwidth = max(len(str(rev)) for rev in revs) |
|
1577 | revwidth = max(len(str(rev)) for rev in revs) | |
1582 | filemode = {} |
|
1578 | filemap = util.sortdict() # filename: [(seqno, rev), ...] | |
1583 |
|
1579 | |||
1584 | for seqno, rev in enumerate(revs, 1): |
|
1580 | for seqno, rev in enumerate(revs, 1): | |
1585 | ctx = repo[rev] |
|
1581 | ctx = repo[rev] | |
1586 |
|
|
1582 | dest = makefilename(ctx, fntemplate, | |
1587 | total=total, seqno=seqno, revwidth=revwidth) |
|
1583 | total=total, seqno=seqno, revwidth=revwidth) | |
1588 | dest = fo.name |
|
1584 | filemap.setdefault(dest, []).append((seqno, rev)) | |
|
1585 | ||||
|
1586 | for dest in filemap: | |||
|
1587 | with open(dest, 'wb') as fo: | |||
|
1588 | repo.ui.note("%s\n" % dest) | |||
1589 | def write(s, **kw): |
|
1589 | def write(s, **kw): | |
1590 | fo.write(s) |
|
1590 | fo.write(s) | |
1591 | repo.ui.note("%s\n" % dest) |
|
1591 | for seqno, rev in filemap[dest]: | |
1592 | _exportsingle(repo, ctx, match, switch_parent, seqno, write, diffopts) |
|
1592 | ctx = repo[rev] | |
1593 | fo.close() |
|
1593 | _exportsingle(repo, ctx, match, switch_parent, seqno, write, | |
|
1594 | diffopts) | |||
1594 |
|
1595 | |||
1595 | def export(repo, revs, fntemplate='hg-%h.patch', fp=None, switch_parent=False, |
|
1596 | def export(repo, revs, fntemplate='hg-%h.patch', fp=None, switch_parent=False, | |
1596 | opts=None, match=None): |
|
1597 | opts=None, match=None): |
General Comments 0
You need to be logged in to leave comments.
Login now