# HG changeset patch # User Martin von Zweigbergk # Date 2014-10-24 20:52:20 # Node ID c586cb50872bb2b863519e1cc2cb7252ab510a54 # Parent c4ce50a3d6341cb7370f1a2e3137cdef21b6bc29 context.status: remove incorrect swapping of added/removed in workingctx The comment in workingctx.status() says that "calling 'super' subtly reveresed the contexts", but that is simply not true, so we should not be swapping added and removed fields. diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -1499,13 +1499,9 @@ class workingctx(committablectx): listclean=False, listunknown=False, listsubrepos=False): # yet to be determined: what to do if 'other' is a 'workingctx' or a # 'memctx'? - s = super(workingctx, self).status(other, match, listignored, listclean, - listunknown, listsubrepos) - # calling 'super' subtly reveresed the contexts, so we flip the results - # (s[1] is 'added' and s[2] is 'removed') - s = list(s) - s[1], s[2] = s[2], s[1] - return scmutil.status(*s) + return super(workingctx, self).status(other, match, listignored, + listclean, listunknown, + listsubrepos) class committablefilectx(basefilectx): """A committablefilectx provides common functionality for a file context diff --git a/tests/test-diff-reverse.t b/tests/test-diff-reverse.t --- a/tests/test-diff-reverse.t +++ b/tests/test-diff-reverse.t @@ -42,3 +42,24 @@ -g -h +should show removed file 'a' as being added + $ hg revert a + $ hg rm a + $ hg diff --reverse --nodates a + diff -r 2855cdcfcbb7 a + --- /dev/null + +++ b/a + @@ -0,0 +1,3 @@ + +d + +e + +f + +should show added file 'b' as being removed + $ echo b >> b + $ hg add b + $ hg diff --reverse --nodates b + diff -r 2855cdcfcbb7 b + --- a/b + +++ /dev/null + @@ -1,1 +0,0 @@ + -b