tests/test-filecache.py
changeset 18313 3e4a944c0d04
parent 16688 cfb6682961b8
child 18316 f36375576ed5
--- a/tests/test-filecache.py	Fri Jan 11 00:05:52 2013 +0200
+++ b/tests/test-filecache.py	Wed Jan 09 20:37:44 2013 +0200
@@ -4,7 +4,7 @@
                     'cacheable']):
     sys.exit(80)
 
-from mercurial import util, scmutil, extensions
+from mercurial import util, scmutil, extensions, hg, ui
 
 filecache = scmutil.filecache
 
@@ -86,6 +86,21 @@
     util.cachestat.cacheable = origcacheable
     util.cachestat.__init__ = originit
 
+def test_filecache_synced():
+    # test old behaviour that caused filecached properties to go out of sync
+    os.system('hg init && echo a >> a && hg ci -qAm.')
+    repo = hg.repository(ui.ui())
+    # first rollback clears the filecache, but changelog to stays in __dict__
+    repo.rollback()
+    repo.commit('.')
+    # second rollback comes along and touches the changelog externally
+    # (file is moved)
+    repo.rollback()
+    # but since changelog isn't under the filecache control anymore, we don't
+    # see that it changed, and return the old changelog without reconstructing
+    # it
+    repo.commit('.')
+
 print 'basic:'
 print
 basic(fakerepo())
@@ -93,3 +108,4 @@
 print 'fakeuncacheable:'
 print
 fakeuncacheable()
+test_filecache_synced()