~jameinel/bzr-explorer/wt_model

« back to all changes in this revision

Viewing changes to lib/wt_model.py

  • Committer: John Arbash Meinel
  • Date: 2009-07-09 19:15:58 UTC
  • Revision ID: john@arbash-meinel.com-20090709191558-63uuu9670ku37uth
Include the full set of values that are given from iter_changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
    :type children: A list of _WTItem objects
33
33
    """
34
34
 
35
 
    def __init__(self, path, name, kind, file_id, old_kind, parent):
 
35
    def __init__(self, file_id, is_modified, path, name, kind, versioned,
 
36
                 executable, parent, old_path, old_name, old_kind,
 
37
                 was_versioned, old_parent_id):
36
38
        """Create a new _WTItem
37
39
        """
 
40
        self.file_id = file_id
38
41
        self.path = path
39
42
        self.name = name
40
43
        self.kind = kind
41
 
        self.file_id = file_id
 
44
        self.versioned = versioned
 
45
        self.is_modified = is_modified
 
46
        self.executable = executable
 
47
        self.parent = parent
 
48
        self.old_path = old_path
42
49
        self.old_kind = old_kind
 
50
        self.old_name = old_name
 
51
        self.was_versioned = was_versioned
 
52
        self.old_parent_id = old_parent_id
43
53
        # Note: this creates a cyclical reference, consider using parent
44
54
        #       instead
45
 
        self.parent = parent
46
55
        self.children = []
47
56
        self.status = None
48
57
 
60
69
        # By file-id
61
70
        dir_by_id = {}
62
71
        dir_by_path = {}
63
 
        for (file_id, paths, did_change, versions, parents, names, kinds,
 
72
        for (file_id, paths, did_change, versions, parent_ids, names, kinds,
64
73
             executables) in changes:
65
74
            if file_id is None:
66
75
                # not versioned
69
78
                    raise ValueError('not supported yet')
70
79
                parent = dir_by_path[parent_dir]
71
80
            else:
72
 
                if parents[1] is None: # Root entry
 
81
                if parent_ids[1] is None: # Root entry
73
82
                    # Or maybe this happens for unversioned files?
74
83
                    assert names[1] == ''
75
84
                    parent = self
76
85
                else:
77
 
                    parent = dir_by_id[parents[1]]
78
 
            item = _WTItem(paths[1], names[1], kinds[1], file_id, kinds[0],
79
 
                           parent)
 
86
                    parent = dir_by_id[parent_ids[1]]
 
87
            item = _WTItem(file_id, did_change, paths[1], names[1], kinds[1],
 
88
                           versions[1], executables[1], parent,
 
89
                           paths[0], names[0], kinds[0], versions[0],
 
90
                           parent_ids[0])
80
91
            parent.children.append(item)
81
92
            if kinds[1] == 'directory':
82
93
                dir_by_id[file_id] = item
90
101
            basis_tree = wt.basis_tree()
91
102
            basis_tree.lock_read()
92
103
            try:
93
 
                root_wt_item = cls(None, None, None, None, None, None)
 
104
                root_wt_item = cls(*([None]*13))
94
105
                changes = wt.iter_changes(basis_tree, include_unchanged=True,
95
106
                    require_versioned=False, want_unversioned=True)
96
107
                root_wt_item._from_iter_changes(changes)