Show More
@@ -3,6 +3,7 b' approximates the behavior of code format' | |||||
3 |
|
3 | |||
4 | $ UPPERCASEPY="$TESTTMP/uppercase.py" |
|
4 | $ UPPERCASEPY="$TESTTMP/uppercase.py" | |
5 | $ cat > $UPPERCASEPY <<EOF |
|
5 | $ cat > $UPPERCASEPY <<EOF | |
|
6 | > import re | |||
6 | > import sys |
|
7 | > import sys | |
7 | > from mercurial.utils.procutil import setbinary |
|
8 | > from mercurial.utils.procutil import setbinary | |
8 | > setbinary(sys.stdin) |
|
9 | > setbinary(sys.stdin) | |
@@ -10,16 +11,18 b' approximates the behavior of code format' | |||||
10 | > stdin = getattr(sys.stdin, 'buffer', sys.stdin) |
|
11 | > stdin = getattr(sys.stdin, 'buffer', sys.stdin) | |
11 | > stdout = getattr(sys.stdout, 'buffer', sys.stdout) |
|
12 | > stdout = getattr(sys.stdout, 'buffer', sys.stdout) | |
12 | > lines = set() |
|
13 | > lines = set() | |
|
14 | > def format(text): | |||
|
15 | > return re.sub(b' +', b' ', text.upper()) | |||
13 | > for arg in sys.argv[1:]: |
|
16 | > for arg in sys.argv[1:]: | |
14 | > if arg == 'all': |
|
17 | > if arg == 'all': | |
15 |
> stdout.write(stdin.read() |
|
18 | > stdout.write(format(stdin.read())) | |
16 | > sys.exit(0) |
|
19 | > sys.exit(0) | |
17 | > else: |
|
20 | > else: | |
18 | > first, last = arg.split('-') |
|
21 | > first, last = arg.split('-') | |
19 | > lines.update(range(int(first), int(last) + 1)) |
|
22 | > lines.update(range(int(first), int(last) + 1)) | |
20 | > for i, line in enumerate(stdin.readlines()): |
|
23 | > for i, line in enumerate(stdin.readlines()): | |
21 | > if i + 1 in lines: |
|
24 | > if i + 1 in lines: | |
22 |
> stdout.write(line |
|
25 | > stdout.write(format(line)) | |
23 | > else: |
|
26 | > else: | |
24 | > stdout.write(line) |
|
27 | > stdout.write(line) | |
25 | > EOF |
|
28 | > EOF | |
@@ -354,6 +357,24 b' Fixing the working directory should stil' | |||||
354 |
|
357 | |||
355 | $ cd .. |
|
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 | Test the effect of fixing the working directory for each possible status, with |
|
378 | Test the effect of fixing the working directory for each possible status, with | |
358 | and without providing explicit file arguments. |
|
379 | and without providing explicit file arguments. | |
359 |
|
380 |
General Comments 0
You need to be logged in to leave comments.
Login now