##// END OF EJS Templates
py3: fix test-import-context.t
Matt Harbison -
r40386:633da713 default
parent child Browse files
Show More
@@ -1,126 +1,129
1 1 Test applying context diffs
2 2
3 3 $ cat > writepatterns.py <<EOF
4 4 > import sys
5 5 >
6 6 > path = sys.argv[1]
7 7 > lasteol = sys.argv[2] == '1'
8 8 > patterns = sys.argv[3:]
9 9 >
10 10 > fp = open(path, 'wb')
11 11 > for i, pattern in enumerate(patterns):
12 12 > count = int(pattern[0:-1])
13 13 > char = pattern[-1].encode('utf8') + b'\n'
14 14 > if not lasteol and i == len(patterns) - 1:
15 15 > fp.write((char*count)[:-1])
16 16 > else:
17 17 > fp.write(char*count)
18 18 > fp.close()
19 19 > EOF
20 20 $ cat > cat.py <<EOF
21 21 > import sys
22 > sys.stdout.write(repr(open(sys.argv[1], 'rb').read()) + '\n')
22 > from mercurial import pycompat
23 > from mercurial.utils import stringutil
24 > pycompat.stdout.write(b'%s\n'
25 > % stringutil.pprint(open(sys.argv[1], 'rb').read()))
23 26 > EOF
24 27
25 28 Initialize the test repository
26 29
27 30 $ hg init repo
28 31 $ cd repo
29 32 $ "$PYTHON" ../writepatterns.py a 0 5A 1B 5C 1D
30 33 $ "$PYTHON" ../writepatterns.py b 1 1A 1B
31 34 $ "$PYTHON" ../writepatterns.py c 1 5A
32 35 $ "$PYTHON" ../writepatterns.py d 1 5A 1B
33 36 $ hg add
34 37 adding a
35 38 adding b
36 39 adding c
37 40 adding d
38 41 $ hg ci -m addfiles
39 42
40 43 Add file, missing a last end of line
41 44
42 45 $ hg import --no-commit - <<EOF
43 46 > *** /dev/null 2010-10-16 18:05:49.000000000 +0200
44 47 > --- b/newnoeol 2010-10-16 18:23:26.000000000 +0200
45 48 > ***************
46 49 > *** 0 ****
47 50 > --- 1,2 ----
48 51 > + a
49 52 > + b
50 53 > \ No newline at end of file
51 54 > *** a/a Sat Oct 16 16:35:51 2010
52 55 > --- b/a Sat Oct 16 16:35:51 2010
53 56 > ***************
54 57 > *** 3,12 ****
55 58 > A
56 59 > A
57 60 > A
58 61 > ! B
59 62 > C
60 63 > C
61 64 > C
62 65 > C
63 66 > C
64 67 > ! D
65 68 > \ No newline at end of file
66 69 > --- 3,13 ----
67 70 > A
68 71 > A
69 72 > A
70 73 > ! E
71 74 > C
72 75 > C
73 76 > C
74 77 > C
75 78 > C
76 79 > ! F
77 80 > ! F
78 81 >
79 82 > *** a/b 2010-10-16 18:40:38.000000000 +0200
80 83 > --- /dev/null 2010-10-16 18:05:49.000000000 +0200
81 84 > ***************
82 85 > *** 1,2 ****
83 86 > - A
84 87 > - B
85 88 > --- 0 ----
86 89 > *** a/c Sat Oct 16 21:34:26 2010
87 90 > --- b/c Sat Oct 16 21:34:27 2010
88 91 > ***************
89 92 > *** 3,5 ****
90 93 > --- 3,7 ----
91 94 > A
92 95 > A
93 96 > A
94 97 > + B
95 98 > + B
96 99 > *** a/d Sat Oct 16 21:47:20 2010
97 100 > --- b/d Sat Oct 16 21:47:22 2010
98 101 > ***************
99 102 > *** 2,6 ****
100 103 > A
101 104 > A
102 105 > A
103 106 > - A
104 107 > - B
105 108 > --- 2,4 ----
106 109 > EOF
107 110 applying patch from stdin
108 111 $ hg st
109 112 M a
110 113 M c
111 114 M d
112 115 A newnoeol
113 116 R b
114 117
115 118 What's in a
116 119
117 120 $ "$PYTHON" ../cat.py a
118 121 'A\nA\nA\nA\nA\nE\nC\nC\nC\nC\nC\nF\nF\n'
119 122 $ "$PYTHON" ../cat.py newnoeol
120 123 'a\nb'
121 124 $ "$PYTHON" ../cat.py c
122 125 'A\nA\nA\nA\nA\nB\nB\n'
123 126 $ "$PYTHON" ../cat.py d
124 127 'A\nA\nA\nA\n'
125 128
126 129 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now