/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/patches.py

  • Committer: Martin Pool
  • Date: 2009-03-03 03:01:49 UTC
  • mfrom: (4070 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4073.
  • Revision ID: mbp@sourcefrog.net-20090303030149-8p8o8hszdtqa7w8f
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
92
92
    range = int(range)
93
93
    return (pos, range)
94
94
 
95
 
 
 
95
 
96
96
def hunk_from_header(line):
97
97
    import re
98
98
    matches = re.match(r'\@\@ ([^@]*) \@\@( (.*))?\n', line)
164
164
        return InsertLine(line[1:])
165
165
    elif line.startswith("-"):
166
166
        return RemoveLine(line[1:])
167
 
    elif line == NO_NL:
168
 
        return NO_NL
169
167
    else:
170
168
        raise MalformedLine("Unknown line type", line)
171
169
__pychecker__=""
268
266
        self.hunks = []
269
267
 
270
268
    def __str__(self):
271
 
        ret = self.get_header() 
 
269
        ret = self.get_header()
272
270
        ret += "".join([str(h) for h in self.hunks])
273
271
        return ret
274
272
 
300
298
                return None
301
299
            newpos += shift
302
300
        return newpos
303
 
            
 
301
 
304
302
    def iter_inserted(self):
305
303
        """Iteraties through inserted lines
306
 
        
 
304
 
307
305
        :return: Pair of line number, line
308
306
        :rtype: iterator of (int, InsertLine)
309
307
        """
318
316
 
319
317
 
320
318
def parse_patch(iter_lines):
 
319
    iter_lines = iter_lines_handle_nl(iter_lines)
321
320
    (orig_name, mod_name) = get_patch_names(iter_lines)
322
321
    patch = Patch(orig_name, mod_name)
323
322
    for hunk in iter_hunks(iter_lines):
370
369
 
371
370
 
372
371
def parse_patches(iter_lines):
373
 
    iter_lines = iter_lines_handle_nl(iter_lines)
374
372
    return [parse_patch(f.__iter__()) for f in iter_file_patch(iter_lines)]
375
373
 
376
374