diff mercurial/patch.py @ 9248:ac02b43bc08a

Merge with crew
author Matt Mackall <mpm@selenic.com>
date Mon, 27 Jul 2009 18:38:20 -0500
parents 6d1f9238824e df21a009c9c4
children 648d6a1a1cf2
line wrap: on
line diff
--- a/mercurial/patch.py	Mon Jul 27 18:38:03 2009 -0500
+++ b/mercurial/patch.py	Mon Jul 27 18:38:20 2009 -0500
@@ -182,6 +182,7 @@
     lineno = 0
     for line in lr:
         lineno += 1
+        line = line.rstrip(' \r\n')
         if line.startswith('diff --git'):
             m = gitre.match(line)
             if m:
@@ -200,23 +201,23 @@
                 continue
             if line.startswith('rename from '):
                 gp.op = 'RENAME'
-                gp.oldpath = line[12:].rstrip()
+                gp.oldpath = line[12:]
             elif line.startswith('rename to '):
-                gp.path = line[10:].rstrip()
+                gp.path = line[10:]
             elif line.startswith('copy from '):
                 gp.op = 'COPY'
-                gp.oldpath = line[10:].rstrip()
+                gp.oldpath = line[10:]
             elif line.startswith('copy to '):
-                gp.path = line[8:].rstrip()
+                gp.path = line[8:]
             elif line.startswith('deleted file'):
                 gp.op = 'DELETE'
                 # is the deleted file a symlink?
-                gp.setmode(int(line.rstrip()[-6:], 8))
+                gp.setmode(int(line[-6:], 8))
             elif line.startswith('new file mode '):
                 gp.op = 'ADD'
-                gp.setmode(int(line.rstrip()[-6:], 8))
+                gp.setmode(int(line[-6:], 8))
             elif line.startswith('new mode '):
-                gp.setmode(int(line.rstrip()[-6:], 8))
+                gp.setmode(int(line[-6:], 8))
             elif line.startswith('GIT binary patch'):
                 dopatch |= GP_BINARY
                 gp.binary = True