~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/delta.py

merge dirstate

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
        (path, id, kind, text_modified, meta_modified)
39
39
    unchanged
40
40
        (path, id, kind)
 
41
    unversioned
 
42
        (path, kind)
41
43
 
42
44
    Each id is listed only once.
43
45
 
59
61
        self.kind_changed = []
60
62
        self.modified = []
61
63
        self.unchanged = []
 
64
        self.unversioned = []
62
65
 
63
66
    def __eq__(self, other):
64
67
        if not isinstance(other, TreeDelta):
68
71
               and self.renamed == other.renamed \
69
72
               and self.modified == other.modified \
70
73
               and self.unchanged == other.unchanged \
71
 
               and self.kind_changed == other.kind_changed
 
74
               and self.kind_changed == other.kind_changed \
 
75
               and self.unversioned == other.unversioned
72
76
 
73
77
    def __ne__(self, other):
74
78
        return not (self == other)
75
79
 
76
80
    def __repr__(self):
77
81
        return "TreeDelta(added=%r, removed=%r, renamed=%r," \
78
 
            " kind_changed=%r, modified=%r, unchanged=%r)" % (self.added,
 
82
            " kind_changed=%r, modified=%r, unchanged=%r," \
 
83
            " unversioned=%r)" % (self.added,
79
84
            self.removed, self.renamed, self.kind_changed, self.modified,
80
 
            self.unchanged)
 
85
            self.unchanged, self.unversioned)
81
86
 
82
87
    def has_changed(self):
83
88
        return bool(self.modified
186
191
            else:
187
192
                show_list(self.unchanged, 'S')
188
193
 
 
194
        if self.unversioned:
 
195
            print >>to_file, 'unknown:'
 
196
            show_list(self.unversioned)
 
197
 
189
198
 
190
199
@deprecated_function(zero_nine)
191
200
def compare_trees(old_tree, new_tree, want_unchanged=False,
201
210
 
202
211
 
203
212
def _compare_trees(old_tree, new_tree, want_unchanged, specific_files,
204
 
                   include_root, extra_trees=None):
 
213
                   include_root, extra_trees=None,
 
214
                   want_unversioned=False):
 
215
    """Worker function that implements Tree.changes_from."""
205
216
    delta = TreeDelta()
206
217
    # mutter('start compare_trees')
207
218
 
208
219
    for (file_id, path, content_change, versioned, parent_id, name, kind,
209
220
         executable) in new_tree._iter_changes(old_tree, want_unchanged,
210
 
            specific_files, extra_trees=extra_trees):
 
221
            specific_files, extra_trees=extra_trees,
 
222
            want_unversioned=want_unversioned):
 
223
        if versioned == (False, False):
 
224
            delta.unversioned.append((path, None, kind[1]))
 
225
            continue
211
226
        if not include_root and (None, None) == parent_id:
212
227
            continue
213
228
        fully_present = tuple((versioned[x] and kind[x] is not None) for