/breezy/unstable

To get this branch, use:
bzr branch https://code.breezy-vcs.org/breezy/unstable

« back to all changes in this revision

Viewing changes to breezy/patches.py

  • Committer: Jelmer Vernooij
  • Date: 2017-05-24 01:39:33 UTC
  • mfrom: (3815.3776.6)
  • Revision ID: jelmer@jelmer.uk-20170524013933-ir4y4tqtrsiz2ka2
New upstream snapshot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
from __future__ import absolute_import
19
19
 
20
 
from bzrlib.errors import (
 
20
from .errors import (
21
21
    BinaryFiles,
22
22
    MalformedHunkHeader,
23
23
    MalformedLine,
81
81
        raise MalformedHunkHeader("Does not match format.", line)
82
82
    try:
83
83
        (orig, mod) = matches.group(1).split(" ")
84
 
    except (ValueError, IndexError), e:
 
84
    except (ValueError, IndexError) as e:
85
85
        raise MalformedHunkHeader(str(e), line)
86
86
    if not orig.startswith('-') or not mod.startswith('+'):
87
87
        raise MalformedHunkHeader("Positions don't start with + or -.", line)
88
88
    try:
89
89
        (orig_pos, orig_range) = parse_range(orig[1:])
90
90
        (mod_pos, mod_range) = parse_range(mod[1:])
91
 
    except (ValueError, IndexError), e:
 
91
    except (ValueError, IndexError) as e:
92
92
        raise MalformedHunkHeader(str(e), line)
93
93
    if mod_range < 0 or orig_range < 0:
94
94
        raise MalformedHunkHeader("Hunk range is negative", line)
327
327
    iter_lines = iter_lines_handle_nl(iter_lines)
328
328
    try:
329
329
        (orig_name, mod_name) = get_patch_names(iter_lines)
330
 
    except BinaryFiles, e:
 
330
    except BinaryFiles as e:
331
331
        return BinaryPatch(e.orig_name, e.mod_name)
332
332
    else:
333
333
        patch = Patch(orig_name, mod_name)