diff tests/test-context.py @ 23712:bfce25d25c96

context: override _dirstatestatus in workingcommitctx for correct matching Before this patch, the result of "status()" on "workingcommitctx" may incorrectly contain files other than ones to be committed, because "workingctx._dirstatestatus()" returns the result of "dirstate.status()" directly. For correct matching, this patch overrides "_dirstatestatus" in "workingcommitctx" and makes it return matched files only in "self._status". This patch uses empty list for "deleted", "unknown" and "ignored" of status, because status between "changectx"s also makes them empty.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Wed, 31 Dec 2014 17:55:43 +0900
parents 1e6fb8db666e
children d8e0c591781c
line wrap: on
line diff
--- a/tests/test-context.py	Wed Dec 31 17:55:43 2014 +0900
+++ b/tests/test-context.py	Wed Dec 31 17:55:43 2014 +0900
@@ -108,13 +108,31 @@
 print 'wcctx._status=%s' % (str(wcctx._status))
 
 print '=== with "always match":'
-actx1.status(other=wcctx)
+print actx1.status(other=wcctx)
 print 'wcctx._status=%s' % (str(wcctx._status))
-actx2.status(other=wcctx)
+print actx2.status(other=wcctx)
 print 'wcctx._status=%s' % (str(wcctx._status))
 
 print '=== with "always match" and "listclean=True":'
-actx1.status(other=wcctx, listclean=True)
+print actx1.status(other=wcctx, listclean=True)
+print 'wcctx._status=%s' % (str(wcctx._status))
+print actx2.status(other=wcctx, listclean=True)
+print 'wcctx._status=%s' % (str(wcctx._status))
+
+print '=== with "pattern match":'
+print actx1.status(other=wcctx,
+                   match=scmutil.matchfiles(repo, ['bar-m', 'foo']))
 print 'wcctx._status=%s' % (str(wcctx._status))
-actx2.status(other=wcctx, listclean=True)
+print actx2.status(other=wcctx,
+                   match=scmutil.matchfiles(repo, ['bar-m', 'foo']))
 print 'wcctx._status=%s' % (str(wcctx._status))
+
+print '=== with "pattern match" and "listclean=True":'
+print actx1.status(other=wcctx,
+                   match=scmutil.matchfiles(repo, ['bar-r', 'foo']),
+                   listclean=True)
+print 'wcctx._status=%s' % (str(wcctx._status))
+print actx2.status(other=wcctx,
+                   match=scmutil.matchfiles(repo, ['bar-r', 'foo']),
+                   listclean=True)
+print 'wcctx._status=%s' % (str(wcctx._status))