/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/workingtree_4.py

  • Committer: Jelmer Vernooij
  • Date: 2011-03-13 21:30:33 UTC
  • mto: This revision was merged to the branch mainline in revision 5724.
  • Revision ID: jelmer@samba.org-20110313213033-ud9t11mm8e3idtti
Add test for per-file-timestamp zipfiles.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007-2010 Canonical Ltd
 
1
# Copyright (C) 2007-2011 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
1247
1247
        # have to change the legacy inventory too.
1248
1248
        if self._inventory is not None:
1249
1249
            for file_id in file_ids:
1250
 
                self._inventory.remove_recursive_id(file_id)
 
1250
                if self._inventory.has_id(file_id):
 
1251
                    self._inventory.remove_recursive_id(file_id)
1251
1252
 
1252
1253
    @needs_tree_write_lock
1253
1254
    def rename_one(self, from_rel, to_rel, after=False):
1292
1293
            self._inventory = inv
1293
1294
        self.flush()
1294
1295
 
 
1296
    @needs_tree_write_lock
 
1297
    def reset_state(self, revision_ids=None):
 
1298
        """Reset the state of the working tree.
 
1299
 
 
1300
        This does a hard-reset to a last-known-good state. This is a way to
 
1301
        fix if something got corrupted (like the .bzr/checkout/dirstate file)
 
1302
        """
 
1303
        if revision_ids is None:
 
1304
            revision_ids = self.get_parent_ids()
 
1305
        if not revision_ids:
 
1306
            base_tree = self.branch.repository.revision_tree(
 
1307
                _mod_revision.NULL_REVISION)
 
1308
            trees = []
 
1309
        else:
 
1310
            trees = zip(revision_ids,
 
1311
                        self.branch.repository.revision_trees(revision_ids))
 
1312
            base_tree = trees[0][1]
 
1313
        state = self.current_dirstate()
 
1314
        # We don't support ghosts yet
 
1315
        state.set_state_from_scratch(base_tree.inventory, trees, [])
 
1316
 
1295
1317
 
1296
1318
class ContentFilterAwareSHA1Provider(dirstate.SHA1Provider):
1297
1319
 
1329
1351
    def _file_content_summary(self, path, stat_result):
1330
1352
        # This is to support the somewhat obsolete path_content_summary method
1331
1353
        # with content filtering: see
1332
 
        # <https://bugs.edge.launchpad.net/bzr/+bug/415508>.
 
1354
        # <https://bugs.launchpad.net/bzr/+bug/415508>.
1333
1355
        #
1334
1356
        # If the dirstate cache is up to date and knows the hash and size,
1335
1357
        # return that.
1384
1406
 
1385
1407
class DirStateWorkingTreeFormat(WorkingTreeFormat3):
1386
1408
 
 
1409
    missing_parent_conflicts = True
 
1410
 
1387
1411
    def initialize(self, a_bzrdir, revision_id=None, from_branch=None,
1388
1412
                   accelerator_tree=None, hardlink=False):
1389
1413
        """See WorkingTreeFormat.initialize().
1737
1761
                elif kind == 'directory':
1738
1762
                    parent_ies[(dirname + '/' + name).strip('/')] = inv_entry
1739
1763
                elif kind == 'symlink':
1740
 
                    inv_entry.executable = False
1741
 
                    inv_entry.text_size = None
1742
1764
                    inv_entry.symlink_target = utf8_decode(fingerprint)[0]
1743
1765
                elif kind == 'tree-reference':
1744
1766
                    inv_entry.reference_revision = fingerprint or None
1868
1890
    def is_executable(self, file_id, path=None):
1869
1891
        ie = self.inventory[file_id]
1870
1892
        if ie.kind != "file":
1871
 
            return None
 
1893
            return False
1872
1894
        return ie.executable
1873
1895
 
1874
1896
    def is_locked(self):