[PATCH 07 of 10] export: flush the file pointer between patches

Dan Villiom Podlaski Christiansen danchr at gmail.com
Wed Dec 1 15:35:00 CST 2010


# HG changeset patch
# User Dan Villiom Podlaski Christiansen <danchr at gmail.com>
# Date 1291236368 -3600
# Node ID a175f79ccac721ad66b9e47aa7cfc6f2cbb64000
# Parent  401824d53a179b0855256ef829f1bb5abfd29501
export: flush the file pointer between patches

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -678,8 +678,7 @@ def export(repo, revs, template='hg-%h.p
             parents.reverse()
         prev = (parents and parents[0]) or nullid
 
-        localfp = not fp
-        if localfp:
+        if not fp:
             fp = make_file(repo, template, node, total=total, seqno=seqno,
                            revwidth=revwidth, mode='ab')
         if fp != sys.stdout and hasattr(fp, 'name'):
@@ -700,8 +699,7 @@ def export(repo, revs, template='hg-%h.p
         for chunk in patch.diff(repo, prev, node, opts=opts):
             fp.write(chunk)
 
-        if localfp:
-            fp.close()
+        fp.flush()
 
     for seqno, rev in enumerate(revs):
         single(rev, seqno + 1, fp)


More information about the Mercurial-devel mailing list