54
55
self.lockable_thing = lockable_thing
57
return ('ReturnsUnlockable(lockable_thing=%s)' %
58
return ('ReturnsUnlockable(lockable_thing=%s)' %
58
59
self.lockable_thing)
60
61
def match(self, lock_method):
131
132
"""Get the (path, file_id) pairs for the current tree."""
134
return [(path, ie.file_id) for path, ie
135
in tree.iter_entries_by_dir()]
135
for path, ie in tree.iter_entries_by_dir():
136
if ie.parent_id is None:
137
yield (u"", ie.file_id)
139
yield (path+ie.kind_character(), ie.file_id)
144
def _strip_unreferenced_directories(entries):
146
for entry in entries:
147
if isinstance(entry, basestring):
151
if path == u"" or path[-1] == "/":
153
directories.append((path, entry))
155
# Yield the referenced parent directories
156
for dirpath, direntry in directories:
157
if osutils.is_inside(dirpath, path):
139
162
def __str__(self):
140
return ('HasLayout(%r)' % self.entries)
163
return 'HasLayout(%r)' % self.entries
142
165
def match(self, tree):
143
actual = self.get_tree_layout(tree)
166
actual = list(self.get_tree_layout(tree))
144
167
if self.entries and isinstance(self.entries[0], basestring):
145
168
actual = [path for (path, fileid) in actual]
146
return Equals(actual).match(self.entries)
169
if not tree.has_versioned_directories():
170
entries = list(self._strip_unreferenced_directories(self.entries))
172
entries = self.entries
173
return Equals(actual).match(entries)