martinvonz created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches.
REVISION SUMMARY If the parent commit needs formatting but the working copy already has the correct formatting, then the working copy will be reported as modified even though it's clean (because the size in the dirstate is incorrect). Because the bug only occurs when the size changes, I modified the formatter used in the test case to remove repeated spaces. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D11208 AFFECTED FILES tests/test-fix.t CHANGE DETAILS diff --git a/tests/test-fix.t b/tests/test-fix.t --- a/tests/test-fix.t +++ b/tests/test-fix.t @@ -3,6 +3,7 @@ $ UPPERCASEPY="$TESTTMP/uppercase.py" $ cat > $UPPERCASEPY <<EOF + > import re > import sys > from mercurial.utils.procutil import setbinary > setbinary(sys.stdin) @@ -10,16 +11,18 @@ > stdin = getattr(sys.stdin, 'buffer', sys.stdin) > stdout = getattr(sys.stdout, 'buffer', sys.stdout) > lines = set() + > def format(text): + > return re.sub(b' +', b' ', text.upper()) > for arg in sys.argv[1:]: > if arg == 'all': - > stdout.write(stdin.read().upper()) + > stdout.write(format(stdin.read())) > sys.exit(0) > else: > first, last = arg.split('-') > lines.update(range(int(first), int(last) + 1)) > for i, line in enumerate(stdin.readlines()): > if i + 1 in lines: - > stdout.write(line.upper()) + > stdout.write(format(line)) > else: > stdout.write(line) > EOF @@ -354,6 +357,24 @@ $ cd .. +Test that the working copy is reported clean if formatting of the parent makes +it clean. + $ hg init wc-already-formatted + $ cd wc-already-formatted + + $ printf "hello world\n" > hello.whole + $ hg commit -Am initial + adding hello.whole + $ hg fix -w * + $ hg st + M hello.whole + $ hg fix -s . * + $ hg st + M hello.whole (known-bad-output !) + $ hg diff + + $ cd .. + Test the effect of fixing the working directory for each possible status, with and without providing explicit file arguments. To: martinvonz, #hg-reviewers Cc: mercurial-patches, mercurial-devel _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel