1382
1382
parent = inventory[dirname]
1383
1383
return parent.id
1385
def get_paths(self, entry, tree):
1385
def get_path(self, entry, tree):
1386
1386
if entry is None:
1387
1387
return (None, None)
1388
full_path = tree.readonly_path(entry.id)
1389
1388
if entry.path == ".":
1390
return ("", full_path)
1391
return (entry.path, full_path)
1393
1392
def make_basic_entry(self, id, only_interesting):
1394
1393
entry_a = self.r_inventory_a.get(id)
1395
1394
entry_b = self.r_inventory_b.get(id)
1396
1395
if only_interesting and not self.is_interesting(entry_a, entry_b):
1397
return (None, None, None)
1398
1397
parent = self.get_entry_parent(entry_a, self.inventory_a)
1399
(path, full_path_a) = self.get_paths(entry_a, self.tree_a)
1398
path = self.get_path(entry_a, self.tree_a)
1400
1399
cs_entry = ChangesetEntry(id, parent, path)
1401
1400
new_parent = self.get_entry_parent(entry_b, self.inventory_b)
1404
(new_path, full_path_b) = self.get_paths(entry_b, self.tree_b)
1403
new_path = self.get_path(entry_b, self.tree_b)
1406
1405
cs_entry.new_path = new_path
1407
1406
cs_entry.new_parent = new_parent
1408
return (cs_entry, full_path_a, full_path_b)
1410
1409
def is_interesting(self, entry_a, entry_b):
1411
1410
if entry_a is not None:
1419
1418
def make_boring_entry(self, id):
1420
(cs_entry, full_path_a, full_path_b) = \
1421
self.make_basic_entry(id, only_interesting=False)
1419
cs_entry = self.make_basic_entry(id, only_interesting=False)
1422
1420
if cs_entry.is_creation_or_deletion():
1423
1421
return self.make_entry(id, only_interesting=False)
1428
1426
def make_entry(self, id, only_interesting=True):
1429
(cs_entry, full_path_a, full_path_b) = \
1430
self.make_basic_entry(id, only_interesting)
1427
cs_entry = self.make_basic_entry(id, only_interesting)
1432
1429
if cs_entry is None:
1431
if id in self.tree_a and id in self.tree_b:
1432
a_sha1 = self.tree_a.get_file_sha1(id)
1433
b_sha1 = self.tree_b.get_file_sha1(id)
1434
if None not in (a_sha1, b_sha1) and a_sha1 == b_sha1:
1437
full_path_a = self.tree_a.readonly_path(id)
1438
full_path_b = self.tree_b.readonly_path(id)
1435
1439
stat_a = self.lstat(full_path_a)
1436
1440
stat_b = self.lstat(full_path_b)
1437
1441
if stat_b is None: