1120
1120
w = self._get_inventory_weave( )
1121
1121
from_set = set(w.inclusions([w.lookup(from_revid)]))
1122
1122
to_set = set(w.inclusions([w.lookup(to_revid)]))
1123
changed = to_set.difference(from_set)
1124
return self.fileid_involved_by_set(changed)
1123
included = to_set.difference(from_set)
1124
changed = map(w.idx_to_name,included)
1125
return self._fileid_involved_by_set(changed)
1126
1127
def fileid_involved(self, last_revid=None):
1127
1128
""" This function returns the file_id(s) involved in the
1132
1133
w = self._get_inventory_weave( )
1133
1134
if not last_revid:
1134
changed = set(w.inclusions([w.numversions( )-1]))
1135
changed = set(w._names)
1136
changed = w.inclusions([w.lookup(last_revid)])
1137
return self.fileid_involved_by_set(changed)
1137
included = w.inclusions([w.lookup(last_revid)])
1138
changed = map(w.idx_to_name, included)
1139
return self._fileid_involved_by_set(changed)
1139
1141
def fileid_involved_by_set(self, changes):
1140
1142
""" This function returns the file_id(s) involved in the
1141
1143
changese present in the set changes
1143
1145
w = self._get_inventory_weave( )
1146
return self._fileid_involved_by_set(changes)
1148
def _fileid_involved_by_set(self, changes):
1149
w = self._get_inventory_weave( )
1144
1150
file_ids = set( )
1146
for lineno, insert, deleteset, line in w._walk():
1147
if insert in changes:
1149
start = line.find('file_id="')+9
1150
if start < 9: continue
1151
end = line.find('"',start)
1153
file_id = line[start:end]
1151
for line in w._weave:
1153
# it is ugly, but it is due to the weave structure
1154
if not isinstance(line,basestring): continue
1156
start = line.find('file_id="')+9
1157
if start < 9: continue
1158
end = line.find('"',start)
1160
file_id = line[start:end]
1162
# check if file_id is already present
1163
if file_id in file_ids: continue
1165
start = line.find('revision="')+10
1166
if start < 10: continue
1167
end = line.find('"',start)
1169
revision_id = line[start:end]
1171
if revision_id in changes:
1155
1172
file_ids.add(file_id)
1157
1174
return file_ids