1395
1395
parent = inventory[dirname]
1396
1396
return parent.id
1398
def get_paths(self, entry, tree):
1398
def get_path(self, entry, tree):
1399
1399
if entry is None:
1400
1400
return (None, None)
1401
full_path = tree.readonly_path(entry.id)
1402
1401
if entry.path == ".":
1403
return ("", full_path)
1404
return (entry.path, full_path)
1406
1405
def make_basic_entry(self, id, only_interesting):
1407
1406
entry_a = self.r_inventory_a.get(id)
1408
1407
entry_b = self.r_inventory_b.get(id)
1409
1408
if only_interesting and not self.is_interesting(entry_a, entry_b):
1410
return (None, None, None)
1411
1410
parent = self.get_entry_parent(entry_a, self.inventory_a)
1412
(path, full_path_a) = self.get_paths(entry_a, self.tree_a)
1411
path = self.get_path(entry_a, self.tree_a)
1413
1412
cs_entry = ChangesetEntry(id, parent, path)
1414
1413
new_parent = self.get_entry_parent(entry_b, self.inventory_b)
1417
(new_path, full_path_b) = self.get_paths(entry_b, self.tree_b)
1416
new_path = self.get_path(entry_b, self.tree_b)
1419
1418
cs_entry.new_path = new_path
1420
1419
cs_entry.new_parent = new_parent
1421
return (cs_entry, full_path_a, full_path_b)
1423
1422
def is_interesting(self, entry_a, entry_b):
1424
1423
if entry_a is not None:
1432
1431
def make_boring_entry(self, id):
1433
(cs_entry, full_path_a, full_path_b) = \
1434
self.make_basic_entry(id, only_interesting=False)
1432
cs_entry = self.make_basic_entry(id, only_interesting=False)
1435
1433
if cs_entry.is_creation_or_deletion():
1436
1434
return self.make_entry(id, only_interesting=False)
1441
1439
def make_entry(self, id, only_interesting=True):
1442
(cs_entry, full_path_a, full_path_b) = \
1443
self.make_basic_entry(id, only_interesting)
1440
cs_entry = self.make_basic_entry(id, only_interesting)
1445
1442
if cs_entry is None:
1444
if id in self.tree_a and id in self.tree_b:
1445
a_sha1 = self.tree_a.get_file_sha1(id)
1446
b_sha1 = self.tree_b.get_file_sha1(id)
1447
if None not in (a_sha1, b_sha1) and a_sha1 == b_sha1:
1450
full_path_a = self.tree_a.readonly_path(id)
1451
full_path_b = self.tree_b.readonly_path(id)
1448
1452
stat_a = self.lstat(full_path_a)
1449
1453
stat_b = self.lstat(full_path_b)
1450
1454
if stat_b is None: