[PATCH 5 of 5 STABLE] dirstate: add filecache support to _ignore (issue3278)

Idan Kamara idankk86 at gmail.com
Tue Feb 28 09:53:36 CST 2012


# HG changeset patch
# User Idan Kamara <idankk86 at gmail.com>
# Date 1330444191 -7200
# Branch stable
# Node ID 72854289dca86060070e665469d351e7a2e132e1
# Parent  6f1784d8264a556017872a8bb9cbecbc993ceeb7
dirstate: add filecache support to _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 --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -116,7 +116,7 @@
     def dirs(self):
         return self._dirs
 
-    @propertycache
+    @filecache('.hgignore', '_join')
     def _ignore(self):
         files = [self._join('.hgignore')]
         for name, path in self._ui.configitems("ui"):
diff --git a/tests/test-commandserver.py b/tests/test-commandserver.py
--- a/tests/test-commandserver.py
+++ b/tests/test-commandserver.py
@@ -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 --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
@@ -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


More information about the Mercurial-devel mailing list