changeset 14939:b4c06b97dfe0

cmdserver: repo.invalidate() on every runcommand This will trigger the filecache and recreate every cached property that was changed by something other than this cmdserver instance (e.g. by running 'hg commit' at the cmdline).
author Idan Kamara <idankk86@gmail.com>
date Mon, 25 Jul 2011 22:19:28 +0300
parents ec18cd254156
children d78b92353f26 4a28cb4df1f8
files mercurial/commandserver.py tests/test-commandserver.py tests/test-commandserver.py.out
diffstat 3 files changed, 41 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commandserver.py	Mon Jul 25 08:28:37 2011 +0200
+++ b/mercurial/commandserver.py	Mon Jul 25 22:19:28 2011 +0300
@@ -185,6 +185,7 @@
         copiedui = self.ui.copy()
         self.repo.baseui = copiedui
         self.repo.ui = self.repo.dirstate._ui = self.repoui.copy()
+        self.repo.invalidate()
 
         req = dispatch.request(args[:], copiedui, self.repo, self.cin,
                                self.cout, self.cerr)
--- a/tests/test-commandserver.py	Mon Jul 25 08:28:37 2011 +0200
+++ b/tests/test-commandserver.py	Mon Jul 25 22:19:28 2011 +0300
@@ -154,6 +154,30 @@
                         'hooks.pre-identify=python:test-commandserver.hook', 'id'],
                input=cStringIO.StringIO('some input'))
 
+def outsidechanges(server):
+    readchannel(server)
+    os.system('echo a >> a && hg ci -Am2')
+    runcommand(server, ['tip'])
+
+def bookmarks(server):
+    readchannel(server)
+    runcommand(server, ['bookmarks'])
+
+    # changes .hg/bookmarks
+    os.system('hg bookmark -i bm1')
+    os.system('hg bookmark -i bm2')
+    runcommand(server, ['bookmarks'])
+
+    # changes .hg/bookmarks.current
+    os.system('hg upd bm1 -q')
+    runcommand(server, ['bookmarks'])
+
+def tagscache(server):
+    readchannel(server)
+    runcommand(server, ['id', '-t', '-r', '0'])
+    os.system('hg tag -r 0 foo')
+    runcommand(server, ['id', '-t', '-r', '0'])
+
 if __name__ == '__main__':
     os.system('hg init')
 
@@ -169,3 +193,6 @@
     hgrc.close()
     check(localhgrc)
     check(hookoutput)
+    check(outsidechanges)
+    check(bookmarks)
+    check(tagscache)
--- a/tests/test-commandserver.py.out	Mon Jul 25 08:28:37 2011 +0200
+++ b/tests/test-commandserver.py.out	Mon Jul 25 22:19:28 2011 +0300
@@ -52,3 +52,16 @@
 hook talking
 now try to read something: 'some input'
 eff892de26ec tip
+changeset:   1:d3a0a68be6de
+tag:         tip
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     2
+
+no bookmarks set
+   bm1                       1:d3a0a68be6de
+   bm2                       1:d3a0a68be6de
+ * bm1                       1:d3a0a68be6de
+   bm2                       1:d3a0a68be6de
+
+foo