~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree_4.py

  • Committer: John Arbash Meinel
  • Date: 2010-01-13 16:23:07 UTC
  • mto: (4634.119.7 2.0)
  • mto: This revision was merged to the branch mainline in revision 4959.
  • Revision ID: john@arbash-meinel.com-20100113162307-0bs82td16gzih827
Update the MANIFEST.in file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1267
1267
        if self._dirty:
1268
1268
            raise AssertionError("attempting to write an inventory when the "
1269
1269
                "dirstate is dirty will lose pending changes")
1270
 
        self.current_dirstate().set_state_from_inventory(inv)
1271
 
        self._make_dirty(reset_inventory=False)
1272
 
        if self._inventory is not None:
 
1270
        had_inventory = self._inventory is not None
 
1271
        # Setting self._inventory = None forces the dirstate to regenerate the
 
1272
        # working inventory. We do this because self.inventory may be inv, or
 
1273
        # may have been modified, and either case would prevent a clean delta
 
1274
        # being created.
 
1275
        self._inventory = None
 
1276
        # generate a delta,
 
1277
        delta = inv._make_delta(self.inventory)
 
1278
        # and apply it.
 
1279
        self.apply_inventory_delta(delta)
 
1280
        if had_inventory:
1273
1281
            self._inventory = inv
1274
1282
        self.flush()
1275
1283
 
1300
1308
        return statvalue, sha1
1301
1309
 
1302
1310
 
 
1311
class ContentFilteringDirStateWorkingTree(DirStateWorkingTree):
 
1312
    """Dirstate working tree that supports content filtering.
 
1313
 
 
1314
    The dirstate holds the hash and size of the canonical form of the file, 
 
1315
    and most methods must return that.
 
1316
    """
 
1317
 
 
1318
    def _file_content_summary(self, path, stat_result):
 
1319
        # This is to support the somewhat obsolete path_content_summary method
 
1320
        # with content filtering: see
 
1321
        # <https://bugs.edge.launchpad.net/bzr/+bug/415508>.
 
1322
        #
 
1323
        # If the dirstate cache is up to date and knows the hash and size,
 
1324
        # return that.
 
1325
        # Otherwise if there are no content filters, return the on-disk size
 
1326
        # and leave the hash blank.
 
1327
        # Otherwise, read and filter the on-disk file and use its size and
 
1328
        # hash.
 
1329
        #
 
1330
        # The dirstate doesn't store the size of the canonical form so we
 
1331
        # can't trust it for content-filtered trees.  We just return None.
 
1332
        dirstate_sha1 = self._dirstate.sha1_from_stat(path, stat_result)
 
1333
        executable = self._is_executable_from_path_and_stat(path, stat_result)
 
1334
        return ('file', None, executable, dirstate_sha1)
 
1335
 
 
1336
 
1303
1337
class WorkingTree4(DirStateWorkingTree):
1304
1338
    """This is the Format 4 working tree.
1305
1339
 
1313
1347
    """
1314
1348
 
1315
1349
 
1316
 
class WorkingTree5(DirStateWorkingTree):
 
1350
class WorkingTree5(ContentFilteringDirStateWorkingTree):
1317
1351
    """This is the Format 5 working tree.
1318
1352
 
1319
1353
    This differs from WorkingTree4 by:
1323
1357
    """
1324
1358
 
1325
1359
 
1326
 
class WorkingTree6(DirStateWorkingTree):
 
1360
class WorkingTree6(ContentFilteringDirStateWorkingTree):
1327
1361
    """This is the Format 6 working tree.
1328
1362
 
1329
1363
    This differs from WorkingTree5 by:
1423
1457
                # applied so we can't safely build the inventory delta from
1424
1458
                # the source tree.
1425
1459
                if wt.supports_content_filtering():
 
1460
                    if hardlink:
 
1461
                        # see https://bugs.edge.launchpad.net/bzr/+bug/408193
 
1462
                        trace.warning("hardlinking working copy files is not currently "
 
1463
                            "supported in %r" % (wt,))
1426
1464
                    accelerator_tree = None
1427
1465
                    delta_from_tree = False
1428
1466
                else:
1546
1584
 
1547
1585
 
1548
1586
class DirStateRevisionTree(Tree):
1549
 
    """A revision tree pulling the inventory from a dirstate."""
 
1587
    """A revision tree pulling the inventory from a dirstate.
 
1588
    
 
1589
    Note that this is one of the historical (ie revision) trees cached in the
 
1590
    dirstate for easy access, not the workingtree.
 
1591
    """
1550
1592
 
1551
1593
    def __init__(self, dirstate, revision_id, repository):
1552
1594
        self._dirstate = dirstate