##// END OF EJS Templates
py3: make sure we open the file in bytes mode...
Pulkit Goyal -
r35967:80e5210d default
parent child Browse files
Show More
@@ -1,29 +1,29
1 1 #require test-repo
2 2
3 3 $ . "$TESTDIR/helpers-testrepo.sh"
4 4
5 5 $ cat <<'EOF' > scanhelptopics.py
6 6 > from __future__ import absolute_import, print_function
7 7 > import re
8 8 > import sys
9 9 > if sys.platform == "win32":
10 10 > import os, msvcrt
11 11 > msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
12 12 > topics = set()
13 13 > topicre = re.compile(br':hg:`help ([a-z0-9\-.]+)`')
14 14 > for fname in sys.argv:
15 > with open(fname) as f:
15 > with open(fname, 'rb') as f:
16 16 > topics.update(m.group(1) for m in topicre.finditer(f.read()))
17 17 > for s in sorted(topics):
18 18 > print(s)
19 19 > EOF
20 20
21 21 $ cd "$TESTDIR"/..
22 22
23 23 Check if ":hg:`help TOPIC`" is valid:
24 24 (use "xargs -n1 -t" to see which help commands are executed)
25 25
26 26 $ testrepohg files 'glob:{hgdemandimport,hgext,mercurial}/**/*.py' \
27 27 > | sed 's|\\|/|g' \
28 28 > | xargs $PYTHON "$TESTTMP/scanhelptopics.py" \
29 29 > | xargs -n1 hg help > /dev/null
@@ -1,298 +1,298
1 1 $ hg init
2 2 $ cat << EOF > a
3 3 > Small Mathematical Series.
4 4 > One
5 5 > Two
6 6 > Three
7 7 > Four
8 8 > Five
9 9 > Hop we are done.
10 10 > EOF
11 11 $ hg add a
12 12 $ hg commit -m ancestor
13 13 $ cat << EOF > a
14 14 > Small Mathematical Series.
15 15 > 1
16 16 > 2
17 17 > 3
18 18 > 4
19 19 > 5
20 20 > Hop we are done.
21 21 > EOF
22 22 $ hg commit -m branch1
23 23 $ hg co 0
24 24 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
25 25 $ cat << EOF > a
26 26 > Small Mathematical Series.
27 27 > 1
28 28 > 2
29 29 > 3
30 30 > 6
31 31 > 8
32 32 > Hop we are done.
33 33 > EOF
34 34 $ hg commit -m branch2
35 35 created new head
36 36
37 37 $ hg merge 1
38 38 merging a
39 39 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
40 40 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
41 41 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
42 42 [1]
43 43
44 44 $ hg id
45 45 618808747361+c0c68e4fe667+ tip
46 46
47 47 $ echo "[commands]" >> $HGRCPATH
48 48 $ echo "status.verbose=true" >> $HGRCPATH
49 49 $ hg status
50 50 M a
51 51 ? a.orig
52 52 # The repository is in an unfinished *merge* state.
53 53
54 54 # Unresolved merge conflicts:
55 55 #
56 56 # a
57 57 #
58 58 # To mark files as resolved: hg resolve --mark FILE
59 59
60 60 # To continue: hg commit
61 61 # To abort: hg update --clean . (warning: this will discard uncommitted changes)
62 62
63 63
64 64 $ cat a
65 65 Small Mathematical Series.
66 66 1
67 67 2
68 68 3
69 69 <<<<<<< working copy: 618808747361 - test: branch2
70 70 6
71 71 8
72 72 =======
73 73 4
74 74 5
75 75 >>>>>>> merge rev: c0c68e4fe667 - test: branch1
76 76 Hop we are done.
77 77
78 78 $ hg status --config commands.status.verbose=0
79 79 M a
80 80 ? a.orig
81 81
82 82 Verify custom conflict markers
83 83
84 84 $ hg up -q --clean .
85 85 $ cat <<EOF >> .hg/hgrc
86 86 > [ui]
87 87 > mergemarkertemplate = '{author} {rev}'
88 88 > EOF
89 89
90 90 $ hg merge 1
91 91 merging a
92 92 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
93 93 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
94 94 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
95 95 [1]
96 96
97 97 $ cat a
98 98 Small Mathematical Series.
99 99 1
100 100 2
101 101 3
102 102 <<<<<<< working copy: test 2
103 103 6
104 104 8
105 105 =======
106 106 4
107 107 5
108 108 >>>>>>> merge rev: test 1
109 109 Hop we are done.
110 110
111 111 Verify line splitting of custom conflict marker which causes multiple lines
112 112
113 113 $ hg up -q --clean .
114 114 $ cat >> .hg/hgrc <<EOF
115 115 > [ui]
116 116 > mergemarkertemplate={author} {rev}\nfoo\nbar\nbaz
117 117 > EOF
118 118
119 119 $ hg -q merge 1
120 120 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
121 121 [1]
122 122
123 123 $ cat a
124 124 Small Mathematical Series.
125 125 1
126 126 2
127 127 3
128 128 <<<<<<< working copy: test 2
129 129 6
130 130 8
131 131 =======
132 132 4
133 133 5
134 134 >>>>>>> merge rev: test 1
135 135 Hop we are done.
136 136
137 137 Verify line trimming of custom conflict marker using multi-byte characters
138 138
139 139 $ hg up -q --clean .
140 140 $ $PYTHON <<EOF
141 > fp = open('logfile', 'w')
141 > fp = open('logfile', 'wb')
142 142 > fp.write(b'12345678901234567890123456789012345678901234567890' +
143 143 > b'1234567890') # there are 5 more columns for 80 columns
144 144 >
145 145 > # 2 x 4 = 8 columns, but 3 x 4 = 12 bytes
146 146 > fp.write(u'\u3042\u3044\u3046\u3048'.encode('utf-8'))
147 147 >
148 148 > fp.close()
149 149 > EOF
150 150 $ hg add logfile
151 151 $ hg --encoding utf-8 commit --logfile logfile
152 152
153 153 $ cat >> .hg/hgrc <<EOF
154 154 > [ui]
155 155 > mergemarkertemplate={desc|firstline}
156 156 > EOF
157 157
158 158 $ hg -q --encoding utf-8 merge 1
159 159 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
160 160 [1]
161 161
162 162 $ cat a
163 163 Small Mathematical Series.
164 164 1
165 165 2
166 166 3
167 167 <<<<<<< working copy: 1234567890123456789012345678901234567890123456789012345...
168 168 6
169 169 8
170 170 =======
171 171 4
172 172 5
173 173 >>>>>>> merge rev: branch1
174 174 Hop we are done.
175 175
176 176 Verify basic conflict markers
177 177
178 178 $ hg up -q --clean 2
179 179 $ printf "\n[ui]\nmergemarkers=basic\n" >> .hg/hgrc
180 180
181 181 $ hg merge 1
182 182 merging a
183 183 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
184 184 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
185 185 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
186 186 [1]
187 187
188 188 $ cat a
189 189 Small Mathematical Series.
190 190 1
191 191 2
192 192 3
193 193 <<<<<<< working copy
194 194 6
195 195 8
196 196 =======
197 197 4
198 198 5
199 199 >>>>>>> merge rev
200 200 Hop we are done.
201 201
202 202 internal:merge3
203 203
204 204 $ hg up -q --clean .
205 205
206 206 $ hg merge 1 --tool internal:merge3
207 207 merging a
208 208 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
209 209 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
210 210 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
211 211 [1]
212 212 $ cat a
213 213 Small Mathematical Series.
214 214 <<<<<<< working copy
215 215 1
216 216 2
217 217 3
218 218 6
219 219 8
220 220 ||||||| base
221 221 One
222 222 Two
223 223 Three
224 224 Four
225 225 Five
226 226 =======
227 227 1
228 228 2
229 229 3
230 230 4
231 231 5
232 232 >>>>>>> merge rev
233 233 Hop we are done.
234 234
235 235 Add some unconflicting changes on each head, to make sure we really
236 236 are merging, unlike :local and :other
237 237
238 238 $ hg up -C
239 239 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
240 240 updated to "e0693e20f496: 123456789012345678901234567890123456789012345678901234567890????"
241 241 1 other heads for branch "default"
242 242 $ printf "\n\nEnd of file\n" >> a
243 243 $ hg ci -m "Add some stuff at the end"
244 244 $ hg up -r 1
245 245 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
246 246 $ printf "Start of file\n\n\n" > tmp
247 247 $ cat a >> tmp
248 248 $ mv tmp a
249 249 $ hg ci -m "Add some stuff at the beginning"
250 250
251 251 Now test :merge-other and :merge-local
252 252
253 253 $ hg merge
254 254 merging a
255 255 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
256 256 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
257 257 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
258 258 [1]
259 259 $ hg resolve --tool :merge-other a
260 260 merging a
261 261 (no more unresolved files)
262 262 $ cat a
263 263 Start of file
264 264
265 265
266 266 Small Mathematical Series.
267 267 1
268 268 2
269 269 3
270 270 6
271 271 8
272 272 Hop we are done.
273 273
274 274
275 275 End of file
276 276
277 277 $ hg up -C
278 278 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
279 279 updated to "18b51d585961: Add some stuff at the beginning"
280 280 1 other heads for branch "default"
281 281 $ hg merge --tool :merge-local
282 282 merging a
283 283 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
284 284 (branch merge, don't forget to commit)
285 285 $ cat a
286 286 Start of file
287 287
288 288
289 289 Small Mathematical Series.
290 290 1
291 291 2
292 292 3
293 293 4
294 294 5
295 295 Hop we are done.
296 296
297 297
298 298 End of file
General Comments 0
You need to be logged in to leave comments. Login now