1293
1293
def reverse_inventory(self, inventory):
1294
1294
r_inventory = {}
1295
1295
for entry in inventory.itervalues():
1296
if entry.id is None:
1296
if entry.file_id is None:
1298
r_inventory[entry.id] = entry
1298
r_inventory[entry.file_id] = entry
1299
1299
return r_inventory
1301
1301
def __call__(self):
1302
1302
cset = Changeset()
1303
1303
for entry in self.inventory_a.itervalues():
1304
if entry.id is None:
1304
if entry.file_id is None:
1306
cs_entry = self.make_entry(entry.id)
1306
cs_entry = self.make_entry(entry.file_id)
1307
1307
if cs_entry is not None and not cs_entry.is_boring():
1308
1308
cset.add_entry(cs_entry)
1310
1310
for entry in self.inventory_b.itervalues():
1311
if entry.id is None:
1311
if entry.file_id is None:
1313
if not self.r_inventory_a.has_key(entry.id):
1314
cs_entry = self.make_entry(entry.id)
1313
if not self.r_inventory_a.has_key(entry.file_id):
1314
cs_entry = self.make_entry(entry.file_id)
1315
1315
if cs_entry is not None and not cs_entry.is_boring():
1316
1316
cset.add_entry(cs_entry)
1317
1317
for entry in list(cset.entries.itervalues()):
1330
1330
def get_entry_parent(self, entry, inventory):
1331
1331
if entry is None:
1333
if entry.path == "./.":
1335
dirname = os.path.dirname(entry.path)
1338
parent = inventory[dirname]
1341
def get_path(self, entry, tree):
1344
if entry.path == ".":
1348
def make_basic_entry(self, id, only_interesting):
1349
entry_a = self.r_inventory_a.get(id)
1350
entry_b = self.r_inventory_b.get(id)
1333
return entry.parent_id
1335
def get_path(self, file_id, tree):
1336
if not tree.has_id(file_id):
1338
path = tree.id2path(file_id)
1344
def make_basic_entry(self, file_id, only_interesting):
1345
entry_a = self.r_inventory_a.get(file_id)
1346
entry_b = self.r_inventory_b.get(file_id)
1351
1347
if only_interesting and not self.is_interesting(entry_a, entry_b):
1353
1349
parent = self.get_entry_parent(entry_a, self.inventory_a)
1354
path = self.get_path(entry_a, self.tree_a)
1355
cs_entry = ChangesetEntry(id, parent, path)
1350
path = self.get_path(file_id, self.tree_a)
1351
cs_entry = ChangesetEntry(file_id, parent, path)
1356
1352
new_parent = self.get_entry_parent(entry_b, self.inventory_b)
1359
new_path = self.get_path(entry_b, self.tree_b)
1354
new_path = self.get_path(file_id, self.tree_b)
1361
1356
cs_entry.new_path = new_path
1362
1357
cs_entry.new_parent = new_parent
1366
1361
if self._interesting_ids is None:
1368
1363
if entry_a is not None:
1369
file_id = entry_a.id
1364
file_id = entry_a.file_id
1370
1365
elif entry_b is not None:
1371
file_id = entry_b.id
1366
file_id = entry_b.file_id
1374
1369
return file_id in self._interesting_ids