1677
1677
entry = state._get_entry(0, path_utf8='a')
1678
1678
return state, entry
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])
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])
1680
1702
def test_update_entry(self):
1681
1703
state, entry = self.get_state_with_a()
1682
1704
self.build_tree(['a'])