Commits

Martin Scharrer  committed e9fe39f

Improvements for keep-seperation-lines option: Discard NL after text-content. Keep empty lines at eof.

  • Participants
  • Parent commits 6358335

Comments (0)

Files changed (1)

File py/SvnDumpLoad/Format.py

 
     def reademptylines(self):
         """ Returns all following non-empty lines. """
-        nonemptylines = list()
-        line = self.readline(rstrip='')
-        while line.rstrip() == '':
-            nonemptylines.append(line)
+        emptylines = list()
+        try:
             line = self.readline(rstrip='')
-        return (nonemptylines, line.rstrip())
+            while line.rstrip() == '':
+                emptylines.append(line)
+                line = self.readline(rstrip='')
+        except EOFError as e:
+            Infile._eoflines = emptylines
+            raise e
+        return (emptylines, line.rstrip())
 
     def unreadline(self, line):
         self._linebuffer.append(line)
             return self
         try:
             self._content = infile.read( int(self._headers['Text-content-length']) )
+            infile.read(1)
         except KeyError:
             pass
         return self
                     if extraversion is None and extrauuid is None:
                         raise SvnDumpfileUnknownRecord
         except EOFError:
+            if infile.get_option("keep_seperation_lines", False):
+                self._eoflines = getattr(infile, '_eoflines', list())
+
             pass
         except SvnDumpfileUnknownRecord as e:
             sys.stderr.write("Unknown record on line " + str(infile.lineno()) + "!\n")
             for node in rev.get_nodes():
                 node.write(outfile)
                 #outfile.write("\n")
+        if hasattr(self, '_eoflines'):
+            for line in self._eoflines:
+                outfile.write(line)