~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/multiparent.py

  • Committer: Danny van Heumen
  • Date: 2010-03-09 21:42:11 UTC
  • mto: (4634.139.5 2.0)
  • mto: This revision was merged to the branch mainline in revision 5160.
  • Revision ID: danny@dannyvanheumen.nl-20100309214211-iqh42x6qcikgd9p3
Reverted now-useless TODO list.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007-2010 Canonical Ltd
 
1
# Copyright (C) 2007 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
76
76
class MultiParent(object):
77
77
    """A multi-parent diff"""
78
78
 
79
 
    __slots__ = ['hunks']
80
 
 
81
79
    def __init__(self, hunks=None):
82
80
        if hunks is not None:
83
81
            self.hunks = hunks
260
258
class NewText(object):
261
259
    """The contents of text that is introduced by this text"""
262
260
 
263
 
    __slots__ = ['lines']
264
 
 
265
261
    def __init__(self, lines):
266
262
        self.lines = lines
267
263
 
283
279
class ParentText(object):
284
280
    """A reference to text present in a parent text"""
285
281
 
286
 
    __slots__ = ['parent', 'parent_pos', 'child_pos', 'num_lines']
287
 
 
288
282
    def __init__(self, parent, parent_pos, child_pos, num_lines):
289
283
        self.parent = parent
290
284
        self.parent_pos = parent_pos
291
285
        self.child_pos = child_pos
292
286
        self.num_lines = num_lines
293
287
 
294
 
    def _as_dict(self):
295
 
        return dict(parent=self.parent, parent_pos=self.parent_pos,
296
 
                    child_pos=self.child_pos, num_lines=self.num_lines)
297
 
 
298
288
    def __repr__(self):
299
 
        return ('ParentText(%(parent)r, %(parent_pos)r, %(child_pos)r,'
300
 
                ' %(num_lines)r)' % self._as_dict())
 
289
        return 'ParentText(%(parent)r, %(parent_pos)r, %(child_pos)r,'\
 
290
            ' %(num_lines)r)' % self.__dict__
301
291
 
302
292
    def __eq__(self, other):
303
293
        if self.__class__ is not other.__class__:
304
294
            return False
305
 
        return self._as_dict() == other._as_dict()
 
295
        return (self.__dict__ == other.__dict__)
306
296
 
307
297
    def to_patch(self):
308
 
        yield ('c %(parent)d %(parent_pos)d %(child_pos)d %(num_lines)d\n'
309
 
               % self._as_dict())
 
298
        yield 'c %(parent)d %(parent_pos)d %(child_pos)d %(num_lines)d\n'\
 
299
            % self.__dict__
310
300
 
311
301
 
312
302
class BaseVersionedFile(object):