equal
deleted
inserted
replaced
117 a = b[:len(a)] |
117 a = b[:len(a)] |
118 elif len(b) > len(a): |
118 elif len(b) > len(a): |
119 b = b[:len(a)] |
119 b = b[:len(a)] |
120 if a == b: |
120 if a == b: |
121 return a |
121 return a |
122 for i in xrange(len(a)): |
122 for i in pycompat.xrange(len(a)): |
123 if a[i] != b[i]: |
123 if a[i] != b[i]: |
124 return a[:i] |
124 return a[:i] |
125 return a |
125 return a |
126 try: |
126 try: |
127 if not filelist: |
127 if not filelist: |
264 '''indent each non-empty line of text after first with prefix.''' |
264 '''indent each non-empty line of text after first with prefix.''' |
265 lines = text.splitlines() |
265 lines = text.splitlines() |
266 num_lines = len(lines) |
266 num_lines = len(lines) |
267 endswithnewline = text[-1:] == '\n' |
267 endswithnewline = text[-1:] == '\n' |
268 def indenter(): |
268 def indenter(): |
269 for i in xrange(num_lines): |
269 for i in pycompat.xrange(num_lines): |
270 l = lines[i] |
270 l = lines[i] |
271 if i and l.strip(): |
271 if i and l.strip(): |
272 yield prefix |
272 yield prefix |
273 yield l |
273 yield l |
274 if i < num_lines - 1 or endswithnewline: |
274 if i < num_lines - 1 or endswithnewline: |