~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/changeset.py

  • Committer: Aaron Bentley
  • Date: 2005-08-10 15:05:26 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: abentley@panoramicfeedback.com-20050810150526-468a7e2e3dc299e4
Switched to using a set of interesting file_ids instead of SourceFile attribute

Show diffs side-by-side

added added

removed removed

Lines of Context:
1267
1267
        self.full_path = full_path
1268
1268
        self.stat_result = stat_result
1269
1269
 
1270
 
def generate_changeset(tree_a, tree_b, inventory_a=None, inventory_b=None):
1271
 
    return ChangesetGenerator(tree_a, tree_b, inventory_a, inventory_b)()
 
1270
def generate_changeset(tree_a, tree_b, inventory_a=None, inventory_b=None, 
 
1271
                       interesting_ids=None):
 
1272
    return ChangesetGenerator(tree_a, tree_b, inventory_a, inventory_b, 
 
1273
                              interesting_ids)()
1272
1274
 
1273
1275
class ChangesetGenerator(object):
1274
 
    def __init__(self, tree_a, tree_b, inventory_a=None, inventory_b=None):
 
1276
    def __init__(self, tree_a, tree_b, inventory_a=None, inventory_b=None, 
 
1277
                 interesting_ids=None):
1275
1278
        object.__init__(self)
1276
1279
        self.tree_a = tree_a
1277
1280
        self.tree_b = tree_b
1285
1288
            self.inventory_b = tree_b.inventory()
1286
1289
        self.r_inventory_a = self.reverse_inventory(self.inventory_a)
1287
1290
        self.r_inventory_b = self.reverse_inventory(self.inventory_b)
 
1291
        self._interesting_ids = interesting_ids
1288
1292
 
1289
1293
    def reverse_inventory(self, inventory):
1290
1294
        r_inventory = {}
1359
1363
        return cs_entry
1360
1364
 
1361
1365
    def is_interesting(self, entry_a, entry_b):
 
1366
        if self._interesting_ids is None:
 
1367
            return True
1362
1368
        if entry_a is not None:
1363
 
            if entry_a.interesting:
1364
 
                return True
1365
 
        if entry_b is not None:
1366
 
            if entry_b.interesting:
1367
 
                return True
1368
 
        return False
 
1369
            file_id = entry_a.id
 
1370
        elif entry_b is not None:
 
1371
            file_id = entry_b.id
 
1372
        else:
 
1373
            return False
 
1374
        return file_id in self._interesting_ids
1369
1375
 
1370
1376
    def make_boring_entry(self, id):
1371
1377
        cs_entry = self.make_basic_entry(id, only_interesting=False)