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