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