/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 breezy/tree.py

  • Committer: Jelmer Vernooij
  • Date: 2019-06-29 21:31:14 UTC
  • mto: This revision was merged to the branch mainline in revision 7390.
  • Revision ID: jelmer@jelmer.uk-20190629213114-ux6f3xcof8olitvr
Don't make TreeChange tuple-like objects anymore, so we can add and remove attributes as necessary.

Show diffs side-by-side

added added

removed removed

Lines of Context:
140
140
        self.executable = executable
141
141
 
142
142
    def __repr__(self):
143
 
        return "%s%r" % (self.__class__.__name__, tuple(self))
 
143
        return "%s%r" % (self.__class__.__name__, self._as_tuple())
144
144
 
145
145
    def __len__(self):
146
146
        return len(self.__slots__)
147
147
 
148
 
    def __tuple__(self):
 
148
    def _as_tuple(self):
149
149
        return (self.file_id, self.path, self.changed_content, self.versioned,
150
150
                self.parent_id, self.name, self.kind, self.executable)
151
151
 
152
152
    def __eq__(self, other):
153
153
        if isinstance(other, TreeChange):
154
 
            return tuple(self) == tuple(other)
 
154
            return self._as_tuple() == other._as_tuple()
155
155
        if isinstance(other, tuple):
156
 
            return tuple(self) == other
 
156
            return self._as_tuple() == other
157
157
        return False
158
158
 
159
159
    def __lt__(self, other):
160
 
        return tuple(self) < tuple(other)
161
 
 
162
 
    def __getitem__(self, i):
163
 
        if isinstance(i, slice):
164
 
            return tuple(self).__getitem__(i)
165
 
        return getattr(self, self.__slots__[i])
 
160
        return self._as_tuple() < other._as_tuple()
166
161
 
167
162
    def meta_modified(self):
168
163
        if self.versioned == (True, True):