~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/changeset.py

  • Committer: aaron.bentley at utoronto
  • Date: 2005-08-05 02:53:57 UTC
  • mto: (1092.1.41) (1185.3.4) (974.1.47)
  • mto: This revision was merged to the branch mainline in revision 1110.
  • Revision ID: aaron.bentley@utoronto.ca-20050805025357-9d90b2e4c066eb4b
Switched from text-id to hashcache for merge optimization

Show diffs side-by-side

added added

removed removed

Lines of Context:
1382
1382
        parent = inventory[dirname]
1383
1383
        return parent.id
1384
1384
 
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)
 
1389
            return ""
 
1390
        return entry.path
1392
1391
 
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)
 
1396
            return 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)
1402
1401
 
1403
1402
 
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)
1405
1404
 
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)
 
1407
        return cs_entry
1409
1408
 
1410
1409
    def is_interesting(self, entry_a, entry_b):
1411
1410
        if entry_a is not None:
1417
1416
        return False
1418
1417
 
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)
1424
1422
        else:
1426
1424
        
1427
1425
 
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)
1431
1428
 
1432
1429
        if cs_entry is None:
1433
1430
            return None
1434
 
       
 
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:
 
1435
                return cs_entry
 
1436
 
 
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: