103
103
self._inventory = inv
105
105
def get_file_mtime(self, file_id, path=None):
106
ie = self._inventory[file_id]
106
inv, inv_file_id = self._unpack_file_id(file_id)
107
ie = inv[inv_file_id]
108
109
revision = self._repository.get_revision(ie.revision)
109
110
except errors.NoSuchRevision:
111
112
return revision.timestamp
113
114
def get_file_size(self, file_id):
114
return self._inventory[file_id].text_size
115
inv, inv_file_id = self._unpack_file_id(file_id)
116
return inv[inv_file_id].text_size
116
118
def get_file_sha1(self, file_id, path=None, stat_value=None):
117
ie = self._inventory[file_id]
119
inv, inv_file_id = self._unpack_file_id(file_id)
120
ie = inv[inv_file_id]
118
121
if ie.kind == "file":
119
122
return ie.text_sha1
122
125
def get_file_revision(self, file_id, path=None):
123
ie = self._inventory[file_id]
126
inv, inv_file_id = self._unpack_file_id(file_id)
127
ie = inv[inv_file_id]
124
128
return ie.revision
126
130
def is_executable(self, file_id, path=None):
127
ie = self._inventory[file_id]
131
inv, inv_file_id = self._unpack_file_id(file_id)
132
ie = inv[inv_file_id]
128
133
if ie.kind != "file":
130
135
return ie.executable
132
137
def has_filename(self, filename):
133
return bool(self.inventory.path2id(filename))
138
return bool(self.path2id(filename))
135
140
def list_files(self, include_root=False, from_dir=None, recursive=True):
136
141
# The only files returned by this are those from the version
150
155
yield path, 'V', entry.kind, entry.file_id, entry
152
157
def get_symlink_target(self, file_id, path=None):
153
ie = self._inventory[file_id]
158
inv, inv_file_id = self._unpack_file_id(file_id)
159
ie = inv[inv_file_id]
154
160
# Inventories store symlink targets in unicode
155
161
return ie.symlink_target
157
163
def get_reference_revision(self, file_id, path=None):
158
return self.inventory[file_id].reference_revision
164
inv, inv_file_id = self._unpack_file_id(file_id)
165
return inv[inv_file_id].reference_revision
160
167
def get_root_id(self):
161
168
if self.inventory.root:
162
169
return self.inventory.root.file_id
164
171
def kind(self, file_id):
165
return self._inventory[file_id].kind
172
inv, inv_file_id = self._unpack_file_id(file_id)
173
return inv[inv_file_id].kind
167
175
def path_content_summary(self, path):
168
176
"""See Tree.path_content_summary."""
169
id = self.inventory.path2id(path)
177
id = self.path2id(path)
171
179
return ('missing', None, None, None)
172
entry = self._inventory[id]
180
inv, inv_file_id = self._unpack_file_id(id)
181
entry = inv[inv_file_id]
173
182
kind = entry.kind
174
183
if kind == 'file':
175
184
return (kind, entry.text_size, entry.executable, entry.text_sha1)