changeset 11377:9916263d9a60

patch: inline small, single-use 'write' function
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Thu, 17 Jun 2010 15:51:27 +0200
parents ad764a6a2eed
children cb21fb1b55ba 2bb6dbf04757
files mercurial/patch.py
diffstat 1 files changed, 2 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/patch.py	Thu Jun 17 15:50:35 2010 +0200
+++ b/mercurial/patch.py	Thu Jun 17 15:51:27 2010 +0200
@@ -527,13 +527,6 @@
 
         self.writelines(fname, rejlines())
 
-    def write(self, dest=None):
-        if not self.dirty:
-            return
-        if not dest:
-            dest = self.fname
-        self.writelines(dest, self.lines)
-
     def apply(self, h):
         if not h.complete():
             raise PatchError(_("bad hunk #%d %s (%d %d %d %d)") %
@@ -1155,7 +1148,8 @@
     def closefile():
         if not current_file:
             return 0
-        current_file.write()
+        if current_file.dirty:
+            current_file.writelines(current_file.fname, current_file.lines)
         current_file.write_rej()
         return len(current_file.rej)