##// END OF EJS Templates
fix issue 1763: strip chars from end of line when parsing gitpatch lines
Bill Barry -
r9243:df21a009 default
parent child Browse files
Show More
@@ -182,6 +182,7 b' def readgitpatch(lr):'
182 lineno = 0
182 lineno = 0
183 for line in lr:
183 for line in lr:
184 lineno += 1
184 lineno += 1
185 line = line.rstrip(' \r\n')
185 if line.startswith('diff --git'):
186 if line.startswith('diff --git'):
186 m = gitre.match(line)
187 m = gitre.match(line)
187 if m:
188 if m:
@@ -200,23 +201,23 b' def readgitpatch(lr):'
200 continue
201 continue
201 if line.startswith('rename from '):
202 if line.startswith('rename from '):
202 gp.op = 'RENAME'
203 gp.op = 'RENAME'
203 gp.oldpath = line[12:].rstrip()
204 gp.oldpath = line[12:]
204 elif line.startswith('rename to '):
205 elif line.startswith('rename to '):
205 gp.path = line[10:].rstrip()
206 gp.path = line[10:]
206 elif line.startswith('copy from '):
207 elif line.startswith('copy from '):
207 gp.op = 'COPY'
208 gp.op = 'COPY'
208 gp.oldpath = line[10:].rstrip()
209 gp.oldpath = line[10:]
209 elif line.startswith('copy to '):
210 elif line.startswith('copy to '):
210 gp.path = line[8:].rstrip()
211 gp.path = line[8:]
211 elif line.startswith('deleted file'):
212 elif line.startswith('deleted file'):
212 gp.op = 'DELETE'
213 gp.op = 'DELETE'
213 # is the deleted file a symlink?
214 # is the deleted file a symlink?
214 gp.setmode(int(line.rstrip()[-6:], 8))
215 gp.setmode(int(line[-6:], 8))
215 elif line.startswith('new file mode '):
216 elif line.startswith('new file mode '):
216 gp.op = 'ADD'
217 gp.op = 'ADD'
217 gp.setmode(int(line.rstrip()[-6:], 8))
218 gp.setmode(int(line[-6:], 8))
218 elif line.startswith('new mode '):
219 elif line.startswith('new mode '):
219 gp.setmode(int(line.rstrip()[-6:], 8))
220 gp.setmode(int(line[-6:], 8))
220 elif line.startswith('GIT binary patch'):
221 elif line.startswith('GIT binary patch'):
221 dopatch |= GP_BINARY
222 dopatch |= GP_BINARY
222 gp.binary = True
223 gp.binary = True
General Comments 0
You need to be logged in to leave comments. Login now