Commit 353e8571 authored by Eric S. Raymond's avatar Eric S. Raymond

Enable >> for append in output redirection.

parent a9100a4a
reposurgeon project news
Repository head:
Output redirect with '>>' appends to the output file.
3.25: 2015-06-03
Reading hg is now supported through an extractor class, no plugin required.
Now 'blob' command allows creating new content from lift scripts.
......@@ -6913,16 +6913,20 @@ def __enter__(self):
self.line = self.line[:m.start(0)] + self.line[m.end(0)+1:]
self.redirected = True
# Output redirection
m =">\S+", self.line)
m =">>?\S+", self.line)
if m:
if "stdout" not in self.capabilities:
raise Recoverable(b"no support for > redirection")
self.outfile =[1:]
self.outfile =['>'):]
if self.outfile and self.outfile != b'-':
if os.path.exists(self.outfile) and not os.path.isfile(self.outfile):
raise Recoverable(b"not a plain file")
self.stdout = open(self.outfile, b"wb")
if'>') > 1:
mode = b"ab"
mode = b"wb"
self.stdout = open(self.outfile, mode)
except (IOError, OSError):
raise Recoverable(b"can't open %s for write" \
......@@ -875,7 +875,8 @@ repository.</para>
<para>The output of these commands can individually be redirected to
a named output file. Where indicated in the syntax, you can prefix the
output filename with <quote>&gt;</quote> and give it as a following
argument. If you use <quote>&gt;&gt;</quote> the file is opened
for append rather than write.</para>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment