Show More
@@ -3,6 +3,7 b' approximates the behavior of code format' | |||
|
3 | 3 | |
|
4 | 4 | $ UPPERCASEPY="$TESTTMP/uppercase.py" |
|
5 | 5 | $ cat > $UPPERCASEPY <<EOF |
|
6 | > import re | |
|
6 | 7 | > import sys |
|
7 | 8 | > from mercurial.utils.procutil import setbinary |
|
8 | 9 | > setbinary(sys.stdin) |
@@ -10,16 +11,18 b' approximates the behavior of code format' | |||
|
10 | 11 | > stdin = getattr(sys.stdin, 'buffer', sys.stdin) |
|
11 | 12 | > stdout = getattr(sys.stdout, 'buffer', sys.stdout) |
|
12 | 13 | > lines = set() |
|
14 | > def format(text): | |
|
15 | > return re.sub(b' +', b' ', text.upper()) | |
|
13 | 16 | > for arg in sys.argv[1:]: |
|
14 | 17 | > if arg == 'all': |
|
15 |
> stdout.write(stdin.read() |
|
|
18 | > stdout.write(format(stdin.read())) | |
|
16 | 19 | > sys.exit(0) |
|
17 | 20 | > else: |
|
18 | 21 | > first, last = arg.split('-') |
|
19 | 22 | > lines.update(range(int(first), int(last) + 1)) |
|
20 | 23 | > for i, line in enumerate(stdin.readlines()): |
|
21 | 24 | > if i + 1 in lines: |
|
22 |
> stdout.write(line |
|
|
25 | > stdout.write(format(line)) | |
|
23 | 26 | > else: |
|
24 | 27 | > stdout.write(line) |
|
25 | 28 | > EOF |
@@ -354,6 +357,24 b' Fixing the working directory should stil' | |||
|
354 | 357 | |
|
355 | 358 | $ cd .. |
|
356 | 359 | |
|
360 | Test that the working copy is reported clean if formatting of the parent makes | |
|
361 | it clean. | |
|
362 | $ hg init wc-already-formatted | |
|
363 | $ cd wc-already-formatted | |
|
364 | ||
|
365 | $ printf "hello world\n" > hello.whole | |
|
366 | $ hg commit -Am initial | |
|
367 | adding hello.whole | |
|
368 | $ hg fix -w * | |
|
369 | $ hg st | |
|
370 | M hello.whole | |
|
371 | $ hg fix -s . * | |
|
372 | $ hg st | |
|
373 | M hello.whole (known-bad-output !) | |
|
374 | $ hg diff | |
|
375 | ||
|
376 | $ cd .. | |
|
377 | ||
|
357 | 378 | Test the effect of fixing the working directory for each possible status, with |
|
358 | 379 | and without providing explicit file arguments. |
|
359 | 380 |
General Comments 0
You need to be logged in to leave comments.
Login now