~thomir-deactivatedaccount/wikkid/wikkid-error-page

« back to all changes in this revision

Viewing changes to wikkid/filestore/bzr.py

  • Committer: Tim Penhey
  • Date: 2010-10-17 21:04:36 UTC
  • mfrom: (49.1.1 empty-page)
  • Revision ID: tim@penhey.net-20101017210436-guaakorifktmtz8t
Allow the replacing of an existing file with an empty file - Jelmer Vernooij

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
 
30
30
def get_line_ending(lines):
31
31
    """Work out the line ending used in lines."""
 
32
    if len(lines) == 0:
 
33
        return '\n'
32
34
    first = lines[0]
33
35
    if first.endswith('\r\n'):
34
36
        return '\r\n'
148
150
                # first.
149
151
                content = normalize_line_endings(content, ending)
150
152
                new_lines = split_lines(content)
151
 
            if not new_lines[-1].endswith(ending):
 
153
            if len(new_lines) > 0 and not new_lines[-1].endswith(ending):
152
154
                new_lines[-1] += ending
153
155
            merge = Merge3(basis_lines, new_lines, current_lines)
154
156
            result = list(merge.merge_lines()) # or merge_regions or whatever