~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to __init__.py

  • Committer: Aaron Bentley
  • Date: 2007-04-10 14:14:25 UTC
  • mto: (2520.4.1 bzr.mpbundle) (0.9.13 temp)
  • mto: This revision was merged to the branch mainline in revision 2631.
  • Revision ID: abentley@panoramicfeedback.com-20070410141425-86yh4m1cb6wwnwwm
Get trivial case passing

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
class MultiParent(object):
 
2
 
 
3
    def __init__(self):
 
4
        self.hunks = []
 
5
 
 
6
    @staticmethod
 
7
    def from_lines(text, parents=()):
 
8
        diff = MultiParent()
 
9
        diff.hunks.append(NewText(text))
 
10
        return diff
 
11
 
 
12
    @classmethod
 
13
    def from_texts(cls, text, parents=()):
 
14
        return cls.from_lines(text.splitlines(True),
 
15
                              [p.splitlines(True) for p in parents])
 
16
 
 
17
 
 
18
class NewText(object):
 
19
 
 
20
    def __init__(self, lines):
 
21
        self.lines = lines
 
22
 
 
23
    def __eq__(self, other):
 
24
        if self.__class__ is not other.__class__:
 
25
            return False
 
26
        return (other.lines == self.lines)