##// END OF EJS Templates
test-patch-offset: Don't use unified diff...
Mads Kiilerich -
r10265:0d8577e1 stable
parent child Browse files
Show More
@@ -1,67 +1,67
1 1 #!/bin/sh
2 2
3 3 cat > writepatterns.py <<EOF
4 4 import sys
5 5
6 6 path = sys.argv[1]
7 7 patterns = sys.argv[2:]
8 8
9 9 fp = file(path, 'wb')
10 10 for pattern in patterns:
11 11 count = int(pattern[0:-1])
12 12 char = pattern[-1] + '\n'
13 13 fp.write(char*count)
14 14 fp.close()
15 15 EOF
16 16
17 17 echo % prepare repo
18 18 hg init a
19 19 cd a
20 20
21 21 # These initial lines of Xs were not in the original file used to generate
22 22 # the patch. So all the patch hunks need to be applied to a constant offset
23 23 # within this file. If the offset isn't tracked then the hunks can be
24 24 # applied to the wrong lines of this file.
25 25 python ../writepatterns.py a 34X 10A 1B 10A 1C 10A 1B 10A 1D 10A 1B 10A 1E 10A 1B 10A
26 26 hg commit -Am adda
27 27
28 28 # This is a cleaner patch generated via diff
29 29 # In this case it reproduces the problem when
30 30 # the output of hg export does not
31 31 echo % import patch
32 32 hg import -v -m 'b' -d '2 0' - <<EOF
33 33 --- a/a 2009-12-08 19:26:17.000000000 -0800
34 34 +++ b/a 2009-12-08 19:26:17.000000000 -0800
35 35 @@ -9,7 +9,7 @@
36 36 A
37 37 A
38 38 B
39 39 -A
40 40 +a
41 41 A
42 42 A
43 43 A
44 44 @@ -53,7 +53,7 @@
45 45 A
46 46 A
47 47 B
48 48 -A
49 49 +a
50 50 A
51 51 A
52 52 A
53 53 @@ -75,7 +75,7 @@
54 54 A
55 55 A
56 56 B
57 57 -A
58 58 +a
59 59 A
60 60 A
61 61 A
62 62 EOF
63 63
64 64 echo % compare imported changes against reference file
65 65 python ../writepatterns.py aref 34X 10A 1B 1a 9A 1C 10A 1B 10A 1D 10A 1B 1a 9A 1E 10A 1B 1a 9A
66 diff -u aref a
66 diff aref a
67 67
General Comments 0
You need to be logged in to leave comments. Login now