/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 bzrlib/delta.py

  • Committer: Robert Collins
  • Date: 2007-03-02 03:47:56 UTC
  • mto: (2255.11.3 dirstate)
  • mto: This revision was merged to the branch mainline in revision 2322.
  • Revision ID: robertc@robertcollins.net-20070302034756-kkqil9dftr9t14sv
Add unversioned path reporting to TreeDelta.

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
201
206
 
202
207
 
203
208
def _compare_trees(old_tree, new_tree, want_unchanged, specific_files,
204
 
                   include_root, extra_trees=None):
 
209
                   include_root, extra_trees=None,
 
210
                   want_unversioned=False):
 
211
    """Worker function that implements Tree.changes_from."""
205
212
    delta = TreeDelta()
206
213
    # mutter('start compare_trees')
207
214
 
208
215
    for (file_id, path, content_change, versioned, parent_id, name, kind,
209
216
         executable) in new_tree._iter_changes(old_tree, want_unchanged,
210
 
            specific_files, extra_trees=extra_trees):
 
217
            specific_files, extra_trees=extra_trees,
 
218
            want_unversioned=want_unversioned):
 
219
        if versioned == (False, False):
 
220
            delta.unversioned.append((path, kind[1]))
 
221
            continue
211
222
        if not include_root and (None, None) == parent_id:
212
223
            continue
213
224
        fully_present = tuple((versioned[x] and kind[x] is not None) for