@@ -1575,6 +1575,18 @@
super(workingctx, self).__init__(repo, text, user, date, extra,
changes)
+ def _buildstatus(self, other, s, match,
+ listignored, listclean, listunknown):
+ """Prevent ``workingctx._buildstatus`` from changing ``self._status``
+ """
+ s = self._dirstatestatus(match, listignored, listclean, listunknown)
+ if other != self._repo['.']:
+ # workingctx._buildstatus doesn't change self._status in this case
+ superself = super(workingcommitctx, self)
+ s = superself._buildstatus(other, s, match,
+ listignored, listclean, listunknown)
+ return s
+
class memctx(committablectx):
"""Use memctx to perform in-memory commits via localrepo.commitctx().
@@ -430,6 +430,34 @@
[255]
$ cat >> .hg/hgrc <<EOF
+ > [committemplate]
+ > changeset = {desc}
+ > HG: files={files}
+ > HG:
+ > {splitlines(diff()) % ''
+ > }HG:
+ > HG: files={files}\n
+ > EOF
+ $ hg status -amr
+ M changed
+ A added
+ R removed
+ $ HGEDITOR=cat hg commit -q -e -m "foo bar" changed
+ foo bar
+ HG: files=changed
+ HG:
+ HG:
+ HG: files=changed
+ $ hg status -amr
+ A added
+ R removed
+ $ hg parents --template "M {file_mods}\nA {file_adds}\nR {file_dels}\n"
+ M changed
+ A
+ R
+ $ hg rollback -q
+
+ $ cat >> .hg/hgrc <<EOF
> # disable customizing for subsequent tests
> [committemplate]
> changeset =
@@ -96,3 +96,25 @@
print 'wctx._status=%s' % (str(wctx._status))
print actx2.status(other=wctx, listclean=True)
print 'wctx._status=%s' % (str(wctx._status))
+
+print "== checking workingcommitctx.status:"
+
+wcctx = context.workingcommitctx(repo,
+ scmutil.status(['bar-m'],
+ ['bar-a'],
+ [],
+ [], [], [], []),
+ text='', date='0 0')
+print 'wcctx._status=%s' % (str(wcctx._status))
+
+print '=== with "always match":'
+actx1.status(other=wcctx)
+print 'wcctx._status=%s' % (str(wcctx._status))
+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 'wcctx._status=%s' % (str(wcctx._status))
+actx2.status(other=wcctx, listclean=True)
+print 'wcctx._status=%s' % (str(wcctx._status))
@@ -24,3 +24,11 @@
wctx._status=<status modified=['bar-m'], added=['bar-a'], removed=['bar-r'], deleted=[], unknown=[], ignored=[], clean=[]>
<status modified=[], added=['bar-a', 'bar-m'], removed=[], deleted=[], unknown=[], ignored=[], clean=['foo']>
wctx._status=<status modified=['bar-m'], added=['bar-a'], removed=['bar-r'], deleted=[], unknown=[], ignored=[], clean=[]>
+== checking workingcommitctx.status:
+wcctx._status=<status modified=['bar-m'], added=['bar-a'], removed=[], deleted=[], unknown=[], ignored=[], clean=[]>
+=== with "always match":
+wcctx._status=<status modified=['bar-m'], added=['bar-a'], removed=[], deleted=[], unknown=[], ignored=[], clean=[]>
+wcctx._status=<status modified=['bar-m'], added=['bar-a'], removed=[], deleted=[], unknown=[], ignored=[], clean=[]>
+=== with "always match" and "listclean=True":
+wcctx._status=<status modified=['bar-m'], added=['bar-a'], removed=[], deleted=[], unknown=[], ignored=[], clean=[]>
+wcctx._status=<status modified=['bar-m'], added=['bar-a'], removed=[], deleted=[], unknown=[], ignored=[], clean=[]>