# HG changeset patch # User Idan Kamara # Date 2011-07-25 19:19:28 # Node ID b4c06b97dfe0cae28497bc3ab85c075a173de8e6 # Parent ec18cd2541565979c0b69ba14e2baf9b3af04c0d 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). diff --git a/mercurial/commandserver.py b/mercurial/commandserver.py --- a/mercurial/commandserver.py +++ b/mercurial/commandserver.py @@ -185,6 +185,7 @@ class server(object): 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) diff --git a/tests/test-commandserver.py b/tests/test-commandserver.py --- a/tests/test-commandserver.py +++ b/tests/test-commandserver.py @@ -154,6 +154,30 @@ def hookoutput(server): '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 @@ if __name__ == '__main__': hgrc.close() check(localhgrc) check(hookoutput) + check(outsidechanges) + check(bookmarks) + check(tagscache) diff --git a/tests/test-commandserver.py.out b/tests/test-commandserver.py.out --- a/tests/test-commandserver.py.out +++ b/tests/test-commandserver.py.out @@ -52,3 +52,16 @@ ui.slash=True 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