Show More
@@ -214,9 +214,12 b' def make_filename(repo, pat, node,' | |||||
214 |
|
214 | |||
215 | def make_file(repo, pat, node=None, |
|
215 | def make_file(repo, pat, node=None, | |
216 | total=None, seqno=None, revwidth=None, mode='wb', pathname=None): |
|
216 | total=None, seqno=None, revwidth=None, mode='wb', pathname=None): | |
|
217 | ||||
|
218 | writable = 'w' in mode or 'a' in mode | |||
|
219 | ||||
217 | if not pat or pat == '-': |
|
220 | if not pat or pat == '-': | |
218 |
return |
|
221 | return writable and sys.stdout or sys.stdin | |
219 |
if hasattr(pat, 'write') and |
|
222 | if hasattr(pat, 'write') and writable: | |
220 | return pat |
|
223 | return pat | |
221 | if hasattr(pat, 'read') and 'r' in mode: |
|
224 | if hasattr(pat, 'read') and 'r' in mode: | |
222 | return pat |
|
225 | return pat |
@@ -1294,7 +1294,8 b" def export(repo, revs, template='hg-%h.p" | |||||
1294 |
|
1294 | |||
1295 | if not fp: |
|
1295 | if not fp: | |
1296 | fp = cmdutil.make_file(repo, template, node, total=total, |
|
1296 | fp = cmdutil.make_file(repo, template, node, total=total, | |
1297 |
seqno=seqno, revwidth=revwidth |
|
1297 | seqno=seqno, revwidth=revwidth, | |
|
1298 | mode='ab') | |||
1298 | if fp != sys.stdout and hasattr(fp, 'name'): |
|
1299 | if fp != sys.stdout and hasattr(fp, 'name'): | |
1299 | repo.ui.note("%s\n" % fp.name) |
|
1300 | repo.ui.note("%s\n" % fp.name) | |
1300 |
|
1301 |
@@ -13,3 +13,9 b' for out in "%nof%N" "%%%H" "%b-%R" "%h" ' | |||||
13 | echo "# foo-$out.patch" |
|
13 | echo "# foo-$out.patch" | |
14 | hg export -v -o "foo-$out.patch" 2:tip |
|
14 | hg export -v -o "foo-$out.patch" 2:tip | |
15 | done |
|
15 | done | |
|
16 | ||||
|
17 | echo "# exporting 4 changesets to a file" | |||
|
18 | hg export -o export_internal 1 2 3 4 | |||
|
19 | grep HG export_internal | wc -l | |||
|
20 | echo "# exporting 4 changesets to a file" | |||
|
21 | hg export 1 2 3 4 | grep HG | wc -l |
General Comments 0
You need to be logged in to leave comments.
Login now