~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_dirstate.py

  • Committer: Robert Collins
  • Date: 2008-09-19 06:53:41 UTC
  • mto: (3696.5.1 commit-updates)
  • mto: This revision was merged to the branch mainline in revision 3741.
  • Revision ID: robertc@robertcollins.net-20080919065341-5t5w1p2gi926nfia
First cut - make it work - at updating the tree stat cache during commit.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1677
1677
        entry = state._get_entry(0, path_utf8='a')
1678
1678
        return state, entry
1679
1679
 
 
1680
    def test_observed_sha1_cachable(self):
 
1681
        state, entry = self.get_state_with_a()
 
1682
        atime = time.time() - 10
 
1683
        self.build_tree(['a'])
 
1684
        statvalue = os.lstat('a')
 
1685
        statvalue = _FakeStat(statvalue.st_size, atime, atime,
 
1686
            statvalue.st_dev, statvalue.st_ino, statvalue.st_mode)
 
1687
        state._observed_sha1(entry, "foo", statvalue)
 
1688
        self.assertEqual('foo', entry[1][0][1])
 
1689
        packed_stat = dirstate.pack_stat(statvalue)
 
1690
        self.assertEqual(packed_stat, entry[1][0][4])
 
1691
 
 
1692
    def test_observed_sha1_not_cachable(self):
 
1693
        state, entry = self.get_state_with_a()
 
1694
        oldval = entry[1][0][1]
 
1695
        oldstat = entry[1][0][4]
 
1696
        self.build_tree(['a'])
 
1697
        statvalue = os.lstat('a')
 
1698
        state._observed_sha1(entry, "foo", statvalue)
 
1699
        self.assertEqual(oldval, entry[1][0][1])
 
1700
        self.assertEqual(oldstat, entry[1][0][4])
 
1701
 
1680
1702
    def test_update_entry(self):
1681
1703
        state, entry = self.get_state_with_a()
1682
1704
        self.build_tree(['a'])