# HG changeset patch # User Idan Kamara # Date 1330616999 -7200 # Node ID 53e2cd303ecf8ca7c7eeebd785c34e5ed6b0f4a4 # Parent fb7c4c14223fce0b8e8c782f3f29eac53e75afed dirstate: filecacheify _ignore (issue3278) This still doesn't handle the case where a command is run with --config ui.ignore=path since we only look for changes in .hgignore. diff -r fb7c4c14223f -r 53e2cd303ecf mercurial/dirstate.py --- a/mercurial/dirstate.py Thu Mar 01 17:42:49 2012 +0200 +++ b/mercurial/dirstate.py Thu Mar 01 17:49:59 2012 +0200 @@ -21,6 +21,11 @@ def join(self, obj, fname): return obj._opener.join(fname) +class rootcache(filecache): + """filecache for files in the repository root""" + def join(self, obj, fname): + return obj._join(fname) + def _finddirs(path): pos = path.rfind('/') while pos != -1: @@ -120,7 +125,7 @@ def dirs(self): return self._dirs - @propertycache + @rootcache('.hgignore') def _ignore(self): files = [self._join('.hgignore')] for name, path in self._ui.configitems("ui"): diff -r fb7c4c14223f -r 53e2cd303ecf tests/test-commandserver.py --- a/tests/test-commandserver.py Thu Mar 01 17:42:49 2012 +0200 +++ b/tests/test-commandserver.py Thu Mar 01 17:49:59 2012 +0200 @@ -219,6 +219,20 @@ runcommand(server, ['branch']) os.system('hg branch default') +def hgignore(server): + readchannel(server) + f = open('.hgignore', 'ab') + f.write('') + f.close() + runcommand(server, ['commit', '-Am.']) + f = open('ignored-file', 'ab') + f.write('') + f.close() + f = open('.hgignore', 'ab') + f.write('ignored-file') + f.close() + runcommand(server, ['status', '-i', '-u']) + if __name__ == '__main__': os.system('hg init') @@ -240,3 +254,4 @@ check(setphase) check(rollback) check(branch) + check(hgignore) diff -r fb7c4c14223f -r 53e2cd303ecf tests/test-commandserver.py.out --- a/tests/test-commandserver.py.out Thu Mar 01 17:42:49 2012 +0200 +++ b/tests/test-commandserver.py.out Thu Mar 01 17:49:59 2012 +0200 @@ -156,3 +156,10 @@ foo marked working directory as branch default (branches are permanent and global, did you want a bookmark?) + +testing hgignore: + + runcommand commit -Am. +adding .hgignore + runcommand status -i -u +I ignored-file