/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: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2019-06-15 17:53:40 UTC
  • mfrom: (7322.1.8 objects-1)
  • Revision ID: breezy.the.bot@gmail.com-20190615175340-yxo036zu96wh8lcz
Use the new attributes on TreeChange rather than indexing.

Merged from https://code.launchpad.net/~jelmer/brz/objects-1/+merge/368859

Show diffs side-by-side

added added

removed removed

Lines of Context:
153
153
            return tuple(self) == other
154
154
        return False
155
155
 
 
156
    def __lt__(self, other):
 
157
        return tuple(self) < tuple(other)
 
158
 
156
159
    def __getitem__(self, i):
157
160
        if isinstance(i, slice):
158
161
            return tuple(self).__getitem__(i)
159
162
        return getattr(self, self.__slots__[i])
160
163
 
 
164
    def discard_new(self):
 
165
        return self.__class__(
 
166
            self.file_id, (self.path[0], None), self.changed_content,
 
167
            (self.versioned[0], None), (self.parent_id[0], None),
 
168
            (self.name[0], None), (self.kind[0], None),
 
169
            (self.executable[0], None))
 
170
 
161
171
 
162
172
class Tree(object):
163
173
    """Abstract file tree.
1094
1104
                new_parent_id = result[4][1]
1095
1105
                precise_file_ids.add(new_parent_id)
1096
1106
                if changes:
1097
 
                    if (result[6][0] == 'directory' and
1098
 
                            result[6][1] != 'directory'):
 
1107
                    if (result.kind[0] == 'directory' and
 
1108
                            result.kind[1] != 'directory'):
1099
1109
                        # This stopped being a directory, the old children have
1100
1110
                        # to be included.
1101
1111
                        if source_entry is None:
1102
1112
                            # Reusing a discarded change.
1103
1113
                            source_entry = self._get_entry(
1104
 
                                self.source, result[1][0])
 
1114
                                self.source, result.path[0])
1105
1115
                        precise_file_ids.update(
1106
1116
                            child.file_id
1107
 
                            for child in self.source.iter_child_entries(result[1][0]))
1108
 
                    changed_file_ids.add(result[0])
 
1117
                            for child in self.source.iter_child_entries(result.path[0]))
 
1118
                    changed_file_ids.add(result.file_id)
1109
1119
                    yield result
1110
1120
 
1111
1121
    def file_content_matches(