##// END OF EJS Templates
tests: cleanup of echo statements left over from test conversion
Mads Kiilerich -
r15243:1e945147 default
parent child Browse files
Show More
@@ -1,375 +1,374 b''
1
1
2 $ HGMERGE=true; export HGMERGE
2 $ HGMERGE=true; export HGMERGE
3 $ echo '[extensions]' >> $HGRCPATH
3 $ echo '[extensions]' >> $HGRCPATH
4 $ echo 'graphlog =' >> $HGRCPATH
4 $ echo 'graphlog =' >> $HGRCPATH
5 $ echo 'convert =' >> $HGRCPATH
5 $ echo 'convert =' >> $HGRCPATH
6 $ glog()
6 $ glog()
7 > {
7 > {
8 > hg glog --template '{rev} "{desc}" files: {files}\n' "$@"
8 > hg glog --template '{rev} "{desc}" files: {files}\n' "$@"
9 > }
9 > }
10 $ hg init source
10 $ hg init source
11 $ cd source
11 $ cd source
12 $ echo foo > foo
12 $ echo foo > foo
13 $ echo baz > baz
13 $ echo baz > baz
14 $ mkdir -p dir/subdir
14 $ mkdir -p dir/subdir
15 $ echo dir/file >> dir/file
15 $ echo dir/file >> dir/file
16 $ echo dir/file2 >> dir/file2
16 $ echo dir/file2 >> dir/file2
17 $ echo dir/file3 >> dir/file3 # to be corrupted in rev 0
17 $ echo dir/file3 >> dir/file3 # to be corrupted in rev 0
18 $ echo dir/subdir/file3 >> dir/subdir/file3
18 $ echo dir/subdir/file3 >> dir/subdir/file3
19 $ echo dir/subdir/file4 >> dir/subdir/file4
19 $ echo dir/subdir/file4 >> dir/subdir/file4
20 $ hg ci -d '0 0' -qAm '0: add foo baz dir/'
20 $ hg ci -d '0 0' -qAm '0: add foo baz dir/'
21 $ echo bar > bar
21 $ echo bar > bar
22 $ echo quux > quux
22 $ echo quux > quux
23 $ echo dir/file4 >> dir/file4 # to be corrupted in rev 1
23 $ echo dir/file4 >> dir/file4 # to be corrupted in rev 1
24 $ hg copy foo copied
24 $ hg copy foo copied
25 $ hg ci -d '1 0' -qAm '1: add bar quux; copy foo to copied'
25 $ hg ci -d '1 0' -qAm '1: add bar quux; copy foo to copied'
26 $ echo >> foo
26 $ echo >> foo
27 $ hg ci -d '2 0' -m '2: change foo'
27 $ hg ci -d '2 0' -m '2: change foo'
28 $ hg up -qC 1
28 $ hg up -qC 1
29 $ echo >> bar
29 $ echo >> bar
30 $ echo >> quux
30 $ echo >> quux
31 $ hg ci -d '3 0' -m '3: change bar quux'
31 $ hg ci -d '3 0' -m '3: change bar quux'
32 created new head
32 created new head
33 $ hg up -qC 2
33 $ hg up -qC 2
34 $ hg merge -qr 3
34 $ hg merge -qr 3
35 $ echo >> bar
35 $ echo >> bar
36 $ echo >> baz
36 $ echo >> baz
37 $ hg ci -d '4 0' -m '4: first merge; change bar baz'
37 $ hg ci -d '4 0' -m '4: first merge; change bar baz'
38 $ echo >> bar
38 $ echo >> bar
39 $ echo 1 >> baz
39 $ echo 1 >> baz
40 $ echo >> quux
40 $ echo >> quux
41 $ hg ci -d '5 0' -m '5: change bar baz quux'
41 $ hg ci -d '5 0' -m '5: change bar baz quux'
42 $ hg up -qC 4
42 $ hg up -qC 4
43 $ echo >> foo
43 $ echo >> foo
44 $ echo 2 >> baz
44 $ echo 2 >> baz
45 $ hg ci -d '6 0' -m '6: change foo baz'
45 $ hg ci -d '6 0' -m '6: change foo baz'
46 created new head
46 created new head
47 $ hg up -qC 5
47 $ hg up -qC 5
48 $ hg merge -qr 6
48 $ hg merge -qr 6
49 $ echo >> bar
49 $ echo >> bar
50 $ hg ci -d '7 0' -m '7: second merge; change bar'
50 $ hg ci -d '7 0' -m '7: second merge; change bar'
51 $ echo >> foo
51 $ echo >> foo
52 $ hg ci -m '8: change foo'
52 $ hg ci -m '8: change foo'
53 $ glog
53 $ glog
54 @ 8 "8: change foo" files: foo
54 @ 8 "8: change foo" files: foo
55 |
55 |
56 o 7 "7: second merge; change bar" files: bar baz
56 o 7 "7: second merge; change bar" files: bar baz
57 |\
57 |\
58 | o 6 "6: change foo baz" files: baz foo
58 | o 6 "6: change foo baz" files: baz foo
59 | |
59 | |
60 o | 5 "5: change bar baz quux" files: bar baz quux
60 o | 5 "5: change bar baz quux" files: bar baz quux
61 |/
61 |/
62 o 4 "4: first merge; change bar baz" files: bar baz
62 o 4 "4: first merge; change bar baz" files: bar baz
63 |\
63 |\
64 | o 3 "3: change bar quux" files: bar quux
64 | o 3 "3: change bar quux" files: bar quux
65 | |
65 | |
66 o | 2 "2: change foo" files: foo
66 o | 2 "2: change foo" files: foo
67 |/
67 |/
68 o 1 "1: add bar quux; copy foo to copied" files: bar copied dir/file4 quux
68 o 1 "1: add bar quux; copy foo to copied" files: bar copied dir/file4 quux
69 |
69 |
70 o 0 "0: add foo baz dir/" files: baz dir/file dir/file2 dir/file3 dir/subdir/file3 dir/subdir/file4 foo
70 o 0 "0: add foo baz dir/" files: baz dir/file dir/file2 dir/file3 dir/subdir/file3 dir/subdir/file4 foo
71
71
72
72
73 final file versions in this repo:
73 final file versions in this repo:
74
74
75 $ hg manifest --debug
75 $ hg manifest --debug
76 9463f52fe115e377cf2878d4fc548117211063f2 644 bar
76 9463f52fe115e377cf2878d4fc548117211063f2 644 bar
77 94c1be4dfde2ee8d78db8bbfcf81210813307c3d 644 baz
77 94c1be4dfde2ee8d78db8bbfcf81210813307c3d 644 baz
78 7711d36246cc83e61fb29cd6d4ef394c63f1ceaf 644 copied
78 7711d36246cc83e61fb29cd6d4ef394c63f1ceaf 644 copied
79 3e20847584beff41d7cd16136b7331ab3d754be0 644 dir/file
79 3e20847584beff41d7cd16136b7331ab3d754be0 644 dir/file
80 75e6d3f8328f5f6ace6bf10b98df793416a09dca 644 dir/file2
80 75e6d3f8328f5f6ace6bf10b98df793416a09dca 644 dir/file2
81 e96dce0bc6a217656a3a410e5e6bec2c4f42bf7c 644 dir/file3
81 e96dce0bc6a217656a3a410e5e6bec2c4f42bf7c 644 dir/file3
82 6edd55f559cdce67132b12ca09e09cee08b60442 644 dir/file4
82 6edd55f559cdce67132b12ca09e09cee08b60442 644 dir/file4
83 5fe139720576e18e34bcc9f79174db8897c8afe9 644 dir/subdir/file3
83 5fe139720576e18e34bcc9f79174db8897c8afe9 644 dir/subdir/file3
84 57a1c1511590f3de52874adfa04effe8a77d64af 644 dir/subdir/file4
84 57a1c1511590f3de52874adfa04effe8a77d64af 644 dir/subdir/file4
85 9a7b52012991e4873687192c3e17e61ba3e837a3 644 foo
85 9a7b52012991e4873687192c3e17e61ba3e837a3 644 foo
86 bc3eca3f47023a3e70ca0d8cc95a22a6827db19d 644 quux
86 bc3eca3f47023a3e70ca0d8cc95a22a6827db19d 644 quux
87 $ hg debugrename copied
87 $ hg debugrename copied
88 copied renamed from foo:2ed2a3912a0b24502043eae84ee4b279c18b90dd
88 copied renamed from foo:2ed2a3912a0b24502043eae84ee4b279c18b90dd
89 $ echo
90
89
91 $ cd ..
90 $ cd ..
92 $ splitrepo()
91 $ splitrepo()
93 > {
92 > {
94 > msg="$1"
93 > msg="$1"
95 > files="$2"
94 > files="$2"
96 > opts=$3
95 > opts=$3
97 > echo "% $files: $msg"
96 > echo "% $files: $msg"
98 > prefix=`echo "$files" | sed -e 's/ /-/g'`
97 > prefix=`echo "$files" | sed -e 's/ /-/g'`
99 > fmap="$prefix.fmap"
98 > fmap="$prefix.fmap"
100 > repo="$prefix.repo"
99 > repo="$prefix.repo"
101 > for i in $files; do
100 > for i in $files; do
102 > echo "include $i" >> "$fmap"
101 > echo "include $i" >> "$fmap"
103 > done
102 > done
104 > hg -q convert $opts --filemap "$fmap" --datesort source "$repo"
103 > hg -q convert $opts --filemap "$fmap" --datesort source "$repo"
105 > hg up -q -R "$repo"
104 > hg up -q -R "$repo"
106 > glog -R "$repo"
105 > glog -R "$repo"
107 > hg -R "$repo" manifest --debug
106 > hg -R "$repo" manifest --debug
108 > }
107 > }
109 $ splitrepo 'skip unwanted merges; use 1st parent in 1st merge, 2nd in 2nd' foo
108 $ splitrepo 'skip unwanted merges; use 1st parent in 1st merge, 2nd in 2nd' foo
110 % foo: skip unwanted merges; use 1st parent in 1st merge, 2nd in 2nd
109 % foo: skip unwanted merges; use 1st parent in 1st merge, 2nd in 2nd
111 @ 3 "8: change foo" files: foo
110 @ 3 "8: change foo" files: foo
112 |
111 |
113 o 2 "6: change foo baz" files: foo
112 o 2 "6: change foo baz" files: foo
114 |
113 |
115 o 1 "2: change foo" files: foo
114 o 1 "2: change foo" files: foo
116 |
115 |
117 o 0 "0: add foo baz dir/" files: foo
116 o 0 "0: add foo baz dir/" files: foo
118
117
119 9a7b52012991e4873687192c3e17e61ba3e837a3 644 foo
118 9a7b52012991e4873687192c3e17e61ba3e837a3 644 foo
120 $ splitrepo 'merges are not merges anymore' bar
119 $ splitrepo 'merges are not merges anymore' bar
121 % bar: merges are not merges anymore
120 % bar: merges are not merges anymore
122 @ 4 "7: second merge; change bar" files: bar
121 @ 4 "7: second merge; change bar" files: bar
123 |
122 |
124 o 3 "5: change bar baz quux" files: bar
123 o 3 "5: change bar baz quux" files: bar
125 |
124 |
126 o 2 "4: first merge; change bar baz" files: bar
125 o 2 "4: first merge; change bar baz" files: bar
127 |
126 |
128 o 1 "3: change bar quux" files: bar
127 o 1 "3: change bar quux" files: bar
129 |
128 |
130 o 0 "1: add bar quux; copy foo to copied" files: bar
129 o 0 "1: add bar quux; copy foo to copied" files: bar
131
130
132 9463f52fe115e377cf2878d4fc548117211063f2 644 bar
131 9463f52fe115e377cf2878d4fc548117211063f2 644 bar
133 $ splitrepo '1st merge is not a merge anymore; 2nd still is' baz
132 $ splitrepo '1st merge is not a merge anymore; 2nd still is' baz
134 % baz: 1st merge is not a merge anymore; 2nd still is
133 % baz: 1st merge is not a merge anymore; 2nd still is
135 @ 4 "7: second merge; change bar" files: baz
134 @ 4 "7: second merge; change bar" files: baz
136 |\
135 |\
137 | o 3 "6: change foo baz" files: baz
136 | o 3 "6: change foo baz" files: baz
138 | |
137 | |
139 o | 2 "5: change bar baz quux" files: baz
138 o | 2 "5: change bar baz quux" files: baz
140 |/
139 |/
141 o 1 "4: first merge; change bar baz" files: baz
140 o 1 "4: first merge; change bar baz" files: baz
142 |
141 |
143 o 0 "0: add foo baz dir/" files: baz
142 o 0 "0: add foo baz dir/" files: baz
144
143
145 94c1be4dfde2ee8d78db8bbfcf81210813307c3d 644 baz
144 94c1be4dfde2ee8d78db8bbfcf81210813307c3d 644 baz
146 $ splitrepo 'we add additional merges when they are interesting' 'foo quux'
145 $ splitrepo 'we add additional merges when they are interesting' 'foo quux'
147 % foo quux: we add additional merges when they are interesting
146 % foo quux: we add additional merges when they are interesting
148 @ 8 "8: change foo" files: foo
147 @ 8 "8: change foo" files: foo
149 |
148 |
150 o 7 "7: second merge; change bar" files:
149 o 7 "7: second merge; change bar" files:
151 |\
150 |\
152 | o 6 "6: change foo baz" files: foo
151 | o 6 "6: change foo baz" files: foo
153 | |
152 | |
154 o | 5 "5: change bar baz quux" files: quux
153 o | 5 "5: change bar baz quux" files: quux
155 |/
154 |/
156 o 4 "4: first merge; change bar baz" files:
155 o 4 "4: first merge; change bar baz" files:
157 |\
156 |\
158 | o 3 "3: change bar quux" files: quux
157 | o 3 "3: change bar quux" files: quux
159 | |
158 | |
160 o | 2 "2: change foo" files: foo
159 o | 2 "2: change foo" files: foo
161 |/
160 |/
162 o 1 "1: add bar quux; copy foo to copied" files: quux
161 o 1 "1: add bar quux; copy foo to copied" files: quux
163 |
162 |
164 o 0 "0: add foo baz dir/" files: foo
163 o 0 "0: add foo baz dir/" files: foo
165
164
166 9a7b52012991e4873687192c3e17e61ba3e837a3 644 foo
165 9a7b52012991e4873687192c3e17e61ba3e837a3 644 foo
167 bc3eca3f47023a3e70ca0d8cc95a22a6827db19d 644 quux
166 bc3eca3f47023a3e70ca0d8cc95a22a6827db19d 644 quux
168 $ splitrepo 'partial conversion' 'bar quux' '-r 3'
167 $ splitrepo 'partial conversion' 'bar quux' '-r 3'
169 % bar quux: partial conversion
168 % bar quux: partial conversion
170 @ 1 "3: change bar quux" files: bar quux
169 @ 1 "3: change bar quux" files: bar quux
171 |
170 |
172 o 0 "1: add bar quux; copy foo to copied" files: bar quux
171 o 0 "1: add bar quux; copy foo to copied" files: bar quux
173
172
174 b79105bedc55102f394e90a789c9c380117c1b4a 644 bar
173 b79105bedc55102f394e90a789c9c380117c1b4a 644 bar
175 db0421cc6b685a458c8d86c7d5c004f94429ea23 644 quux
174 db0421cc6b685a458c8d86c7d5c004f94429ea23 644 quux
176 $ splitrepo 'complete the partial conversion' 'bar quux'
175 $ splitrepo 'complete the partial conversion' 'bar quux'
177 % bar quux: complete the partial conversion
176 % bar quux: complete the partial conversion
178 @ 4 "7: second merge; change bar" files: bar
177 @ 4 "7: second merge; change bar" files: bar
179 |
178 |
180 o 3 "5: change bar baz quux" files: bar quux
179 o 3 "5: change bar baz quux" files: bar quux
181 |
180 |
182 o 2 "4: first merge; change bar baz" files: bar
181 o 2 "4: first merge; change bar baz" files: bar
183 |
182 |
184 o 1 "3: change bar quux" files: bar quux
183 o 1 "3: change bar quux" files: bar quux
185 |
184 |
186 o 0 "1: add bar quux; copy foo to copied" files: bar quux
185 o 0 "1: add bar quux; copy foo to copied" files: bar quux
187
186
188 9463f52fe115e377cf2878d4fc548117211063f2 644 bar
187 9463f52fe115e377cf2878d4fc548117211063f2 644 bar
189 bc3eca3f47023a3e70ca0d8cc95a22a6827db19d 644 quux
188 bc3eca3f47023a3e70ca0d8cc95a22a6827db19d 644 quux
190 $ rm -r foo.repo
189 $ rm -r foo.repo
191 $ splitrepo 'partial conversion' 'foo' '-r 3'
190 $ splitrepo 'partial conversion' 'foo' '-r 3'
192 % foo: partial conversion
191 % foo: partial conversion
193 @ 0 "0: add foo baz dir/" files: foo
192 @ 0 "0: add foo baz dir/" files: foo
194
193
195 2ed2a3912a0b24502043eae84ee4b279c18b90dd 644 foo
194 2ed2a3912a0b24502043eae84ee4b279c18b90dd 644 foo
196 $ splitrepo 'complete the partial conversion' 'foo'
195 $ splitrepo 'complete the partial conversion' 'foo'
197 % foo: complete the partial conversion
196 % foo: complete the partial conversion
198 @ 3 "8: change foo" files: foo
197 @ 3 "8: change foo" files: foo
199 |
198 |
200 o 2 "6: change foo baz" files: foo
199 o 2 "6: change foo baz" files: foo
201 |
200 |
202 o 1 "2: change foo" files: foo
201 o 1 "2: change foo" files: foo
203 |
202 |
204 o 0 "0: add foo baz dir/" files: foo
203 o 0 "0: add foo baz dir/" files: foo
205
204
206 9a7b52012991e4873687192c3e17e61ba3e837a3 644 foo
205 9a7b52012991e4873687192c3e17e61ba3e837a3 644 foo
207 $ splitrepo 'copied file; source not included in new repo' copied
206 $ splitrepo 'copied file; source not included in new repo' copied
208 % copied: copied file; source not included in new repo
207 % copied: copied file; source not included in new repo
209 @ 0 "1: add bar quux; copy foo to copied" files: copied
208 @ 0 "1: add bar quux; copy foo to copied" files: copied
210
209
211 2ed2a3912a0b24502043eae84ee4b279c18b90dd 644 copied
210 2ed2a3912a0b24502043eae84ee4b279c18b90dd 644 copied
212 $ hg --cwd copied.repo debugrename copied
211 $ hg --cwd copied.repo debugrename copied
213 copied not renamed
212 copied not renamed
214 $ splitrepo 'copied file; source included in new repo' 'foo copied'
213 $ splitrepo 'copied file; source included in new repo' 'foo copied'
215 % foo copied: copied file; source included in new repo
214 % foo copied: copied file; source included in new repo
216 @ 4 "8: change foo" files: foo
215 @ 4 "8: change foo" files: foo
217 |
216 |
218 o 3 "6: change foo baz" files: foo
217 o 3 "6: change foo baz" files: foo
219 |
218 |
220 o 2 "2: change foo" files: foo
219 o 2 "2: change foo" files: foo
221 |
220 |
222 o 1 "1: add bar quux; copy foo to copied" files: copied
221 o 1 "1: add bar quux; copy foo to copied" files: copied
223 |
222 |
224 o 0 "0: add foo baz dir/" files: foo
223 o 0 "0: add foo baz dir/" files: foo
225
224
226 7711d36246cc83e61fb29cd6d4ef394c63f1ceaf 644 copied
225 7711d36246cc83e61fb29cd6d4ef394c63f1ceaf 644 copied
227 9a7b52012991e4873687192c3e17e61ba3e837a3 644 foo
226 9a7b52012991e4873687192c3e17e61ba3e837a3 644 foo
228 $ hg --cwd foo-copied.repo debugrename copied
227 $ hg --cwd foo-copied.repo debugrename copied
229 copied renamed from foo:2ed2a3912a0b24502043eae84ee4b279c18b90dd
228 copied renamed from foo:2ed2a3912a0b24502043eae84ee4b279c18b90dd
230 $ cat > renames.fmap <<EOF
229 $ cat > renames.fmap <<EOF
231 > include dir
230 > include dir
232 > exclude dir/file2
231 > exclude dir/file2
233 > rename dir dir2
232 > rename dir dir2
234 > include foo
233 > include foo
235 > include copied
234 > include copied
236 > rename foo foo2
235 > rename foo foo2
237 > rename copied copied2
236 > rename copied copied2
238 > exclude dir/subdir
237 > exclude dir/subdir
239 > include dir/subdir/file3
238 > include dir/subdir/file3
240 > EOF
239 > EOF
241 $ rm source/.hg/store/data/dir/file3.i
240 $ rm source/.hg/store/data/dir/file3.i
242 $ rm source/.hg/store/data/dir/file4.i
241 $ rm source/.hg/store/data/dir/file4.i
243 $ hg -q convert --filemap renames.fmap --datesort source dummydest
242 $ hg -q convert --filemap renames.fmap --datesort source dummydest
244 abort: data/dir/file3.i@e96dce0bc6a2: no match found!
243 abort: data/dir/file3.i@e96dce0bc6a2: no match found!
245 [255]
244 [255]
246 $ hg -q convert --filemap renames.fmap --datesort --config convert.hg.ignoreerrors=1 source renames.repo
245 $ hg -q convert --filemap renames.fmap --datesort --config convert.hg.ignoreerrors=1 source renames.repo
247 ignoring: data/dir/file3.i@e96dce0bc6a2: no match found
246 ignoring: data/dir/file3.i@e96dce0bc6a2: no match found
248 ignoring: data/dir/file4.i@6edd55f559cd: no match found
247 ignoring: data/dir/file4.i@6edd55f559cd: no match found
249 $ hg up -q -R renames.repo
248 $ hg up -q -R renames.repo
250 $ glog -R renames.repo
249 $ glog -R renames.repo
251 @ 4 "8: change foo" files: foo2
250 @ 4 "8: change foo" files: foo2
252 |
251 |
253 o 3 "6: change foo baz" files: foo2
252 o 3 "6: change foo baz" files: foo2
254 |
253 |
255 o 2 "2: change foo" files: foo2
254 o 2 "2: change foo" files: foo2
256 |
255 |
257 o 1 "1: add bar quux; copy foo to copied" files: copied2
256 o 1 "1: add bar quux; copy foo to copied" files: copied2
258 |
257 |
259 o 0 "0: add foo baz dir/" files: dir2/file dir2/subdir/file3 foo2
258 o 0 "0: add foo baz dir/" files: dir2/file dir2/subdir/file3 foo2
260
259
261 $ hg -R renames.repo manifest --debug
260 $ hg -R renames.repo manifest --debug
262 d43feacba7a4f1f2080dde4a4b985bd8a0236d46 644 copied2
261 d43feacba7a4f1f2080dde4a4b985bd8a0236d46 644 copied2
263 3e20847584beff41d7cd16136b7331ab3d754be0 644 dir2/file
262 3e20847584beff41d7cd16136b7331ab3d754be0 644 dir2/file
264 5fe139720576e18e34bcc9f79174db8897c8afe9 644 dir2/subdir/file3
263 5fe139720576e18e34bcc9f79174db8897c8afe9 644 dir2/subdir/file3
265 9a7b52012991e4873687192c3e17e61ba3e837a3 644 foo2
264 9a7b52012991e4873687192c3e17e61ba3e837a3 644 foo2
266 $ hg --cwd renames.repo debugrename copied2
265 $ hg --cwd renames.repo debugrename copied2
267 copied2 renamed from foo2:2ed2a3912a0b24502043eae84ee4b279c18b90dd
266 copied2 renamed from foo2:2ed2a3912a0b24502043eae84ee4b279c18b90dd
268
267
269 copied:
268 copied:
270
269
271 $ hg --cwd source cat copied
270 $ hg --cwd source cat copied
272 foo
271 foo
273
272
274 copied2:
273 copied2:
275
274
276 $ hg --cwd renames.repo cat copied2
275 $ hg --cwd renames.repo cat copied2
277 foo
276 foo
278
277
279 filemap errors
278 filemap errors
280
279
281 $ cat > errors.fmap <<EOF
280 $ cat > errors.fmap <<EOF
282 > include dir/ # beware that comments changes error line numbers!
281 > include dir/ # beware that comments changes error line numbers!
283 > exclude /dir
282 > exclude /dir
284 > rename dir//dir /dir//dir/ "out of sync"
283 > rename dir//dir /dir//dir/ "out of sync"
285 > include
284 > include
286 > EOF
285 > EOF
287 $ hg -q convert --filemap errors.fmap source errors.repo
286 $ hg -q convert --filemap errors.fmap source errors.repo
288 errors.fmap:1: superfluous / in exclude 'dir/'
287 errors.fmap:1: superfluous / in exclude 'dir/'
289 errors.fmap:3: superfluous / in include '/dir'
288 errors.fmap:3: superfluous / in include '/dir'
290 errors.fmap:3: superfluous / in rename '/dir'
289 errors.fmap:3: superfluous / in rename '/dir'
291 errors.fmap:3: superfluous / in exclude 'dir//dir'
290 errors.fmap:3: superfluous / in exclude 'dir//dir'
292 errors.fmap:4: unknown directive 'out of sync'
291 errors.fmap:4: unknown directive 'out of sync'
293 errors.fmap:5: path to exclude is missing
292 errors.fmap:5: path to exclude is missing
294 abort: errors in filemap
293 abort: errors in filemap
295 [255]
294 [255]
296
295
297 test branch closing revision pruning if branch is pruned
296 test branch closing revision pruning if branch is pruned
298
297
299 $ hg init branchpruning
298 $ hg init branchpruning
300 $ cd branchpruning
299 $ cd branchpruning
301 $ hg branch foo
300 $ hg branch foo
302 marked working directory as branch foo
301 marked working directory as branch foo
303 $ echo a > a
302 $ echo a > a
304 $ hg ci -Am adda
303 $ hg ci -Am adda
305 adding a
304 adding a
306 $ hg ci --close-branch -m closefoo
305 $ hg ci --close-branch -m closefoo
307 $ hg up 0
306 $ hg up 0
308 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
307 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
309 $ hg branch empty
308 $ hg branch empty
310 marked working directory as branch empty
309 marked working directory as branch empty
311 $ hg ci -m emptybranch
310 $ hg ci -m emptybranch
312 $ hg ci --close-branch -m closeempty
311 $ hg ci --close-branch -m closeempty
313 $ hg up 0
312 $ hg up 0
314 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
313 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
315 $ hg branch default
314 $ hg branch default
316 marked working directory as branch default
315 marked working directory as branch default
317 $ echo b > b
316 $ echo b > b
318 $ hg ci -Am addb
317 $ hg ci -Am addb
319 adding b
318 adding b
320 $ hg ci --close-branch -m closedefault
319 $ hg ci --close-branch -m closedefault
321 $ cat > filemap <<EOF
320 $ cat > filemap <<EOF
322 > include b
321 > include b
323 > EOF
322 > EOF
324 $ cd ..
323 $ cd ..
325 $ hg convert branchpruning branchpruning-hg1
324 $ hg convert branchpruning branchpruning-hg1
326 initializing destination branchpruning-hg1 repository
325 initializing destination branchpruning-hg1 repository
327 scanning source...
326 scanning source...
328 sorting...
327 sorting...
329 converting...
328 converting...
330 5 adda
329 5 adda
331 4 closefoo
330 4 closefoo
332 3 emptybranch
331 3 emptybranch
333 2 closeempty
332 2 closeempty
334 1 addb
333 1 addb
335 0 closedefault
334 0 closedefault
336 $ glog -R branchpruning-hg1
335 $ glog -R branchpruning-hg1
337 o 5 "closedefault" files:
336 o 5 "closedefault" files:
338 |
337 |
339 o 4 "addb" files: b
338 o 4 "addb" files: b
340 |
339 |
341 | o 3 "closeempty" files:
340 | o 3 "closeempty" files:
342 | |
341 | |
343 | o 2 "emptybranch" files:
342 | o 2 "emptybranch" files:
344 |/
343 |/
345 | o 1 "closefoo" files:
344 | o 1 "closefoo" files:
346 |/
345 |/
347 o 0 "adda" files: a
346 o 0 "adda" files: a
348
347
349
348
350 exercise incremental conversion at the same time
349 exercise incremental conversion at the same time
351
350
352 $ hg convert -r0 --filemap branchpruning/filemap branchpruning branchpruning-hg2
351 $ hg convert -r0 --filemap branchpruning/filemap branchpruning branchpruning-hg2
353 initializing destination branchpruning-hg2 repository
352 initializing destination branchpruning-hg2 repository
354 scanning source...
353 scanning source...
355 sorting...
354 sorting...
356 converting...
355 converting...
357 0 adda
356 0 adda
358 $ hg convert -r4 --filemap branchpruning/filemap branchpruning branchpruning-hg2
357 $ hg convert -r4 --filemap branchpruning/filemap branchpruning branchpruning-hg2
359 scanning source...
358 scanning source...
360 sorting...
359 sorting...
361 converting...
360 converting...
362 0 addb
361 0 addb
363 $ hg convert --filemap branchpruning/filemap branchpruning branchpruning-hg2
362 $ hg convert --filemap branchpruning/filemap branchpruning branchpruning-hg2
364 scanning source...
363 scanning source...
365 sorting...
364 sorting...
366 converting...
365 converting...
367 3 closefoo
366 3 closefoo
368 2 emptybranch
367 2 emptybranch
369 1 closeempty
368 1 closeempty
370 0 closedefault
369 0 closedefault
371 $ glog -R branchpruning-hg2
370 $ glog -R branchpruning-hg2
372 o 1 "closedefault" files:
371 o 1 "closedefault" files:
373 |
372 |
374 o 0 "addb" files: b
373 o 0 "addb" files: b
375
374
@@ -1,297 +1,293 b''
1
1
2 $ "$TESTDIR/hghave" git || exit 80
2 $ "$TESTDIR/hghave" git || exit 80
3 $ echo "[extensions]" >> $HGRCPATH
3 $ echo "[extensions]" >> $HGRCPATH
4 $ echo "convert=" >> $HGRCPATH
4 $ echo "convert=" >> $HGRCPATH
5 $ echo 'hgext.graphlog =' >> $HGRCPATH
5 $ echo 'hgext.graphlog =' >> $HGRCPATH
6 $ GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME
6 $ GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME
7 $ GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL
7 $ GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL
8 $ GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0000"; export GIT_AUTHOR_DATE
8 $ GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0000"; export GIT_AUTHOR_DATE
9 $ GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME
9 $ GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME
10 $ GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL
10 $ GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL
11 $ GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE
11 $ GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE
12 $ count=10
12 $ count=10
13 $ commit()
13 $ commit()
14 > {
14 > {
15 > GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000"
15 > GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000"
16 > GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
16 > GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
17 > git commit "$@" >/dev/null 2>/dev/null || echo "git commit error"
17 > git commit "$@" >/dev/null 2>/dev/null || echo "git commit error"
18 > count=`expr $count + 1`
18 > count=`expr $count + 1`
19 > }
19 > }
20 $ mkdir git-repo
20 $ mkdir git-repo
21 $ cd git-repo
21 $ cd git-repo
22 $ git init-db >/dev/null 2>/dev/null
22 $ git init-db >/dev/null 2>/dev/null
23 $ echo a > a
23 $ echo a > a
24 $ mkdir d
24 $ mkdir d
25 $ echo b > d/b
25 $ echo b > d/b
26 $ git add a d
26 $ git add a d
27 $ commit -a -m t1
27 $ commit -a -m t1
28
28
29 Remove the directory, then try to replace it with a file
29 Remove the directory, then try to replace it with a file
30 (issue 754)
30 (issue 754)
31
31
32 $ git rm -f d/b
32 $ git rm -f d/b
33 rm 'd/b'
33 rm 'd/b'
34 $ commit -m t2
34 $ commit -m t2
35 $ echo d > d
35 $ echo d > d
36 $ git add d
36 $ git add d
37 $ commit -m t3
37 $ commit -m t3
38 $ echo b >> a
38 $ echo b >> a
39 $ commit -a -m t4.1
39 $ commit -a -m t4.1
40 $ git checkout -b other HEAD~ >/dev/null 2>/dev/null
40 $ git checkout -b other HEAD~ >/dev/null 2>/dev/null
41 $ echo c > a
41 $ echo c > a
42 $ echo a >> a
42 $ echo a >> a
43 $ commit -a -m t4.2
43 $ commit -a -m t4.2
44 $ git checkout master >/dev/null 2>/dev/null
44 $ git checkout master >/dev/null 2>/dev/null
45 $ git pull --no-commit . other > /dev/null 2>/dev/null
45 $ git pull --no-commit . other > /dev/null 2>/dev/null
46 $ commit -m 'Merge branch other'
46 $ commit -m 'Merge branch other'
47 $ cd ..
47 $ cd ..
48 $ hg convert --datesort git-repo
48 $ hg convert --datesort git-repo
49 assuming destination git-repo-hg
49 assuming destination git-repo-hg
50 initializing destination git-repo-hg repository
50 initializing destination git-repo-hg repository
51 scanning source...
51 scanning source...
52 sorting...
52 sorting...
53 converting...
53 converting...
54 5 t1
54 5 t1
55 4 t2
55 4 t2
56 3 t3
56 3 t3
57 2 t4.1
57 2 t4.1
58 1 t4.2
58 1 t4.2
59 0 Merge branch other
59 0 Merge branch other
60 updating bookmarks
60 updating bookmarks
61 $ hg up -q -R git-repo-hg
61 $ hg up -q -R git-repo-hg
62 $ hg -R git-repo-hg tip -v
62 $ hg -R git-repo-hg tip -v
63 changeset: 5:c78094926be2
63 changeset: 5:c78094926be2
64 bookmark: master
64 bookmark: master
65 tag: tip
65 tag: tip
66 parent: 3:f5f5cb45432b
66 parent: 3:f5f5cb45432b
67 parent: 4:4e174f80c67c
67 parent: 4:4e174f80c67c
68 user: test <test@example.org>
68 user: test <test@example.org>
69 date: Mon Jan 01 00:00:15 2007 +0000
69 date: Mon Jan 01 00:00:15 2007 +0000
70 files: a
70 files: a
71 description:
71 description:
72 Merge branch other
72 Merge branch other
73
73
74
74
75 $ count=10
75 $ count=10
76 $ mkdir git-repo2
76 $ mkdir git-repo2
77 $ cd git-repo2
77 $ cd git-repo2
78 $ git init-db >/dev/null 2>/dev/null
78 $ git init-db >/dev/null 2>/dev/null
79 $ echo foo > foo
79 $ echo foo > foo
80 $ git add foo
80 $ git add foo
81 $ commit -a -m 'add foo'
81 $ commit -a -m 'add foo'
82 $ echo >> foo
82 $ echo >> foo
83 $ commit -a -m 'change foo'
83 $ commit -a -m 'change foo'
84 $ git checkout -b Bar HEAD~ >/dev/null 2>/dev/null
84 $ git checkout -b Bar HEAD~ >/dev/null 2>/dev/null
85 $ echo quux >> quux
85 $ echo quux >> quux
86 $ git add quux
86 $ git add quux
87 $ commit -a -m 'add quux'
87 $ commit -a -m 'add quux'
88 $ echo bar > bar
88 $ echo bar > bar
89 $ git add bar
89 $ git add bar
90 $ commit -a -m 'add bar'
90 $ commit -a -m 'add bar'
91 $ git checkout -b Baz HEAD~ >/dev/null 2>/dev/null
91 $ git checkout -b Baz HEAD~ >/dev/null 2>/dev/null
92 $ echo baz > baz
92 $ echo baz > baz
93 $ git add baz
93 $ git add baz
94 $ commit -a -m 'add baz'
94 $ commit -a -m 'add baz'
95 $ git checkout master >/dev/null 2>/dev/null
95 $ git checkout master >/dev/null 2>/dev/null
96 $ git pull --no-commit . Bar Baz > /dev/null 2>/dev/null
96 $ git pull --no-commit . Bar Baz > /dev/null 2>/dev/null
97 $ commit -m 'Octopus merge'
97 $ commit -m 'Octopus merge'
98 $ echo bar >> bar
98 $ echo bar >> bar
99 $ commit -a -m 'change bar'
99 $ commit -a -m 'change bar'
100 $ git checkout -b Foo HEAD~ >/dev/null 2>/dev/null
100 $ git checkout -b Foo HEAD~ >/dev/null 2>/dev/null
101 $ echo >> foo
101 $ echo >> foo
102 $ commit -a -m 'change foo'
102 $ commit -a -m 'change foo'
103 $ git checkout master >/dev/null 2>/dev/null
103 $ git checkout master >/dev/null 2>/dev/null
104 $ git pull --no-commit -s ours . Foo > /dev/null 2>/dev/null
104 $ git pull --no-commit -s ours . Foo > /dev/null 2>/dev/null
105 $ commit -m 'Discard change to foo'
105 $ commit -m 'Discard change to foo'
106 $ cd ..
106 $ cd ..
107 $ glog()
107 $ glog()
108 > {
108 > {
109 > hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@"
109 > hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@"
110 > }
110 > }
111 $ splitrepo()
111 $ splitrepo()
112 > {
112 > {
113 > msg="$1"
113 > msg="$1"
114 > files="$2"
114 > files="$2"
115 > opts=$3
115 > opts=$3
116 > echo "% $files: $msg"
116 > echo "% $files: $msg"
117 > prefix=`echo "$files" | sed -e 's/ /-/g'`
117 > prefix=`echo "$files" | sed -e 's/ /-/g'`
118 > fmap="$prefix.fmap"
118 > fmap="$prefix.fmap"
119 > repo="$prefix.repo"
119 > repo="$prefix.repo"
120 > for i in $files; do
120 > for i in $files; do
121 > echo "include $i" >> "$fmap"
121 > echo "include $i" >> "$fmap"
122 > done
122 > done
123 > hg -q convert $opts --filemap "$fmap" --datesort git-repo2 "$repo"
123 > hg -q convert $opts --filemap "$fmap" --datesort git-repo2 "$repo"
124 > hg up -q -R "$repo"
124 > hg up -q -R "$repo"
125 > glog -R "$repo"
125 > glog -R "$repo"
126 > hg -R "$repo" manifest --debug
126 > hg -R "$repo" manifest --debug
127 > }
127 > }
128
128
129 full conversion
129 full conversion
130
130
131 $ hg -q convert --datesort git-repo2 fullrepo
131 $ hg -q convert --datesort git-repo2 fullrepo
132 $ hg up -q -R fullrepo
132 $ hg up -q -R fullrepo
133 $ glog -R fullrepo
133 $ glog -R fullrepo
134 @ 9 "Discard change to foo" files: foo
134 @ 9 "Discard change to foo" files: foo
135 |\
135 |\
136 | o 8 "change foo" files: foo
136 | o 8 "change foo" files: foo
137 | |
137 | |
138 o | 7 "change bar" files: bar
138 o | 7 "change bar" files: bar
139 |/
139 |/
140 o 6 "(octopus merge fixup)" files:
140 o 6 "(octopus merge fixup)" files:
141 |\
141 |\
142 | o 5 "Octopus merge" files: baz
142 | o 5 "Octopus merge" files: baz
143 | |\
143 | |\
144 o | | 4 "add baz" files: baz
144 o | | 4 "add baz" files: baz
145 | | |
145 | | |
146 +---o 3 "add bar" files: bar
146 +---o 3 "add bar" files: bar
147 | |
147 | |
148 o | 2 "add quux" files: quux
148 o | 2 "add quux" files: quux
149 | |
149 | |
150 | o 1 "change foo" files: foo
150 | o 1 "change foo" files: foo
151 |/
151 |/
152 o 0 "add foo" files: foo
152 o 0 "add foo" files: foo
153
153
154 $ hg -R fullrepo manifest --debug
154 $ hg -R fullrepo manifest --debug
155 245a3b8bc653999c2b22cdabd517ccb47aecafdf 644 bar
155 245a3b8bc653999c2b22cdabd517ccb47aecafdf 644 bar
156 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz
156 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz
157 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo
157 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo
158 88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux
158 88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux
159 $ splitrepo 'octopus merge' 'foo bar baz'
159 $ splitrepo 'octopus merge' 'foo bar baz'
160 % foo bar baz: octopus merge
160 % foo bar baz: octopus merge
161 @ 8 "Discard change to foo" files: foo
161 @ 8 "Discard change to foo" files: foo
162 |\
162 |\
163 | o 7 "change foo" files: foo
163 | o 7 "change foo" files: foo
164 | |
164 | |
165 o | 6 "change bar" files: bar
165 o | 6 "change bar" files: bar
166 |/
166 |/
167 o 5 "(octopus merge fixup)" files:
167 o 5 "(octopus merge fixup)" files:
168 |\
168 |\
169 | o 4 "Octopus merge" files: baz
169 | o 4 "Octopus merge" files: baz
170 | |\
170 | |\
171 o | | 3 "add baz" files: baz
171 o | | 3 "add baz" files: baz
172 | | |
172 | | |
173 +---o 2 "add bar" files: bar
173 +---o 2 "add bar" files: bar
174 | |
174 | |
175 | o 1 "change foo" files: foo
175 | o 1 "change foo" files: foo
176 |/
176 |/
177 o 0 "add foo" files: foo
177 o 0 "add foo" files: foo
178
178
179 245a3b8bc653999c2b22cdabd517ccb47aecafdf 644 bar
179 245a3b8bc653999c2b22cdabd517ccb47aecafdf 644 bar
180 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz
180 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz
181 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo
181 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo
182 $ splitrepo 'only some parents of an octopus merge; "discard" a head' 'foo baz quux'
182 $ splitrepo 'only some parents of an octopus merge; "discard" a head' 'foo baz quux'
183 % foo baz quux: only some parents of an octopus merge; "discard" a head
183 % foo baz quux: only some parents of an octopus merge; "discard" a head
184 @ 6 "Discard change to foo" files: foo
184 @ 6 "Discard change to foo" files: foo
185 |
185 |
186 o 5 "change foo" files: foo
186 o 5 "change foo" files: foo
187 |
187 |
188 o 4 "Octopus merge" files:
188 o 4 "Octopus merge" files:
189 |\
189 |\
190 | o 3 "add baz" files: baz
190 | o 3 "add baz" files: baz
191 | |
191 | |
192 | o 2 "add quux" files: quux
192 | o 2 "add quux" files: quux
193 | |
193 | |
194 o | 1 "change foo" files: foo
194 o | 1 "change foo" files: foo
195 |/
195 |/
196 o 0 "add foo" files: foo
196 o 0 "add foo" files: foo
197
197
198 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz
198 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz
199 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo
199 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo
200 88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux
200 88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux
201 $ echo
202
203
201
204 test binary conversion (issue 1359)
202 test binary conversion (issue 1359)
205
203
206 $ mkdir git-repo3
204 $ mkdir git-repo3
207 $ cd git-repo3
205 $ cd git-repo3
208 $ git init-db >/dev/null 2>/dev/null
206 $ git init-db >/dev/null 2>/dev/null
209 $ python -c 'file("b", "wb").write("".join([chr(i) for i in range(256)])*16)'
207 $ python -c 'file("b", "wb").write("".join([chr(i) for i in range(256)])*16)'
210 $ git add b
208 $ git add b
211 $ commit -a -m addbinary
209 $ commit -a -m addbinary
212 $ cd ..
210 $ cd ..
213
211
214 convert binary file
212 convert binary file
215
213
216 $ hg convert git-repo3 git-repo3-hg
214 $ hg convert git-repo3 git-repo3-hg
217 initializing destination git-repo3-hg repository
215 initializing destination git-repo3-hg repository
218 scanning source...
216 scanning source...
219 sorting...
217 sorting...
220 converting...
218 converting...
221 0 addbinary
219 0 addbinary
222 updating bookmarks
220 updating bookmarks
223 $ cd git-repo3-hg
221 $ cd git-repo3-hg
224 $ hg up -C
222 $ hg up -C
225 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
223 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
226 $ python -c 'print len(file("b", "rb").read())'
224 $ python -c 'print len(file("b", "rb").read())'
227 4096
225 4096
228 $ cd ..
226 $ cd ..
229 $ echo
230
231
227
232 test author vs committer
228 test author vs committer
233
229
234 $ mkdir git-repo4
230 $ mkdir git-repo4
235 $ cd git-repo4
231 $ cd git-repo4
236 $ git init-db >/dev/null 2>/dev/null
232 $ git init-db >/dev/null 2>/dev/null
237 $ echo >> foo
233 $ echo >> foo
238 $ git add foo
234 $ git add foo
239 $ commit -a -m addfoo
235 $ commit -a -m addfoo
240 $ echo >> foo
236 $ echo >> foo
241 $ GIT_AUTHOR_NAME="nottest"
237 $ GIT_AUTHOR_NAME="nottest"
242 $ commit -a -m addfoo2
238 $ commit -a -m addfoo2
243 $ cd ..
239 $ cd ..
244
240
245 convert author committer
241 convert author committer
246
242
247 $ hg convert git-repo4 git-repo4-hg
243 $ hg convert git-repo4 git-repo4-hg
248 initializing destination git-repo4-hg repository
244 initializing destination git-repo4-hg repository
249 scanning source...
245 scanning source...
250 sorting...
246 sorting...
251 converting...
247 converting...
252 1 addfoo
248 1 addfoo
253 0 addfoo2
249 0 addfoo2
254 updating bookmarks
250 updating bookmarks
255 $ hg -R git-repo4-hg log -v
251 $ hg -R git-repo4-hg log -v
256 changeset: 1:d63e967f93da
252 changeset: 1:d63e967f93da
257 bookmark: master
253 bookmark: master
258 tag: tip
254 tag: tip
259 user: nottest <test@example.org>
255 user: nottest <test@example.org>
260 date: Mon Jan 01 00:00:21 2007 +0000
256 date: Mon Jan 01 00:00:21 2007 +0000
261 files: foo
257 files: foo
262 description:
258 description:
263 addfoo2
259 addfoo2
264
260
265 committer: test <test@example.org>
261 committer: test <test@example.org>
266
262
267
263
268 changeset: 0:0735477b0224
264 changeset: 0:0735477b0224
269 user: test <test@example.org>
265 user: test <test@example.org>
270 date: Mon Jan 01 00:00:20 2007 +0000
266 date: Mon Jan 01 00:00:20 2007 +0000
271 files: foo
267 files: foo
272 description:
268 description:
273 addfoo
269 addfoo
274
270
275
271
276
272
277 --sourceorder should fail
273 --sourceorder should fail
278
274
279 $ hg convert --sourcesort git-repo4 git-repo4-sourcesort-hg
275 $ hg convert --sourcesort git-repo4 git-repo4-sourcesort-hg
280 initializing destination git-repo4-sourcesort-hg repository
276 initializing destination git-repo4-sourcesort-hg repository
281 abort: --sourcesort is not supported by this data source
277 abort: --sourcesort is not supported by this data source
282 [255]
278 [255]
283
279
284 damage git repository and convert again
280 damage git repository and convert again
285
281
286 $ cat > damage.py <<EOF
282 $ cat > damage.py <<EOF
287 > import os
283 > import os
288 > for root, dirs, files in os.walk('git-repo4/.git/objects'):
284 > for root, dirs, files in os.walk('git-repo4/.git/objects'):
289 > if files:
285 > if files:
290 > path = os.path.join(root, files[0])
286 > path = os.path.join(root, files[0])
291 > os.remove(path)
287 > os.remove(path)
292 > break
288 > break
293 > EOF
289 > EOF
294 $ python damage.py
290 $ python damage.py
295 $ hg convert git-repo4 git-repo4-broken-hg 2>&1 | \
291 $ hg convert git-repo4 git-repo4-broken-hg 2>&1 | \
296 > grep 'abort:' | sed 's/abort:.*/abort:/g'
292 > grep 'abort:' | sed 's/abort:.*/abort:/g'
297 abort:
293 abort:
@@ -1,548 +1,549 b''
1
1
2 $ "$TESTDIR/hghave" svn no-outer-repo || exit 80
2 $ "$TESTDIR/hghave" svn no-outer-repo || exit 80
3
3
4 $ fixpath()
4 $ fixpath()
5 > {
5 > {
6 > tr '\\' /
6 > tr '\\' /
7 > }
7 > }
8 $ svnupanddisplay()
8 $ svnupanddisplay()
9 > {
9 > {
10 > (
10 > (
11 > cd $1;
11 > cd $1;
12 > svn up;
12 > svn up;
13 > svn st -v | fixpath | sed 's/ */ /g'
13 > svn st -v | fixpath | sed 's/ */ /g'
14 > limit=''
14 > limit=''
15 > if [ $2 -gt 0 ]; then
15 > if [ $2 -gt 0 ]; then
16 > limit="--limit=$2"
16 > limit="--limit=$2"
17 > fi
17 > fi
18 > svn log --xml -v $limit \
18 > svn log --xml -v $limit \
19 > | fixpath \
19 > | fixpath \
20 > | sed 's,<date>.*,<date/>,' \
20 > | sed 's,<date>.*,<date/>,' \
21 > | grep -v 'kind="'
21 > | grep -v 'kind="'
22 > )
22 > )
23 > }
23 > }
24
24
25 $ cat >> $HGRCPATH <<EOF
25 $ cat >> $HGRCPATH <<EOF
26 > [extensions]
26 > [extensions]
27 > convert =
27 > convert =
28 > graphlog =
28 > graphlog =
29 > EOF
29 > EOF
30
30
31 $ hg init a
31 $ hg init a
32
32
33 Add
33 Add
34
34
35 $ echo a > a/a
35 $ echo a > a/a
36 $ mkdir -p a/d1/d2
36 $ mkdir -p a/d1/d2
37 $ echo b > a/d1/d2/b
37 $ echo b > a/d1/d2/b
38 $ ln -s a/missing a/link
38 $ ln -s a/missing a/link
39 $ hg --cwd a ci -d '0 0' -A -m 'add a file'
39 $ hg --cwd a ci -d '0 0' -A -m 'add a file'
40 adding a
40 adding a
41 adding d1/d2/b
41 adding d1/d2/b
42 adding link
42 adding link
43
43
44 Modify
44 Modify
45
45
46 $ "$TESTDIR/svn-safe-append.py" a a/a
46 $ "$TESTDIR/svn-safe-append.py" a a/a
47 $ hg --cwd a ci -d '1 0' -m 'modify a file'
47 $ hg --cwd a ci -d '1 0' -m 'modify a file'
48 $ hg --cwd a tip -q
48 $ hg --cwd a tip -q
49 1:8231f652da37
49 1:8231f652da37
50
50
51 $ hg convert -d svn a
51 $ hg convert -d svn a
52 assuming destination a-hg
52 assuming destination a-hg
53 initializing svn repository 'a-hg'
53 initializing svn repository 'a-hg'
54 initializing svn working copy 'a-hg-wc'
54 initializing svn working copy 'a-hg-wc'
55 scanning source...
55 scanning source...
56 sorting...
56 sorting...
57 converting...
57 converting...
58 1 add a file
58 1 add a file
59 0 modify a file
59 0 modify a file
60 $ svnupanddisplay a-hg-wc 2
60 $ svnupanddisplay a-hg-wc 2
61 At revision 2.
61 At revision 2.
62 2 2 test .
62 2 2 test .
63 2 2 test a
63 2 2 test a
64 2 1 test d1
64 2 1 test d1
65 2 1 test d1/d2
65 2 1 test d1/d2
66 2 1 test d1/d2/b
66 2 1 test d1/d2/b
67 2 1 test link
67 2 1 test link
68 <?xml version="1.0"?>
68 <?xml version="1.0"?>
69 <log>
69 <log>
70 <logentry
70 <logentry
71 revision="2">
71 revision="2">
72 <author>test</author>
72 <author>test</author>
73 <date/>
73 <date/>
74 <paths>
74 <paths>
75 <path
75 <path
76 action="M">/a</path>
76 action="M">/a</path>
77 </paths>
77 </paths>
78 <msg>modify a file</msg>
78 <msg>modify a file</msg>
79 </logentry>
79 </logentry>
80 <logentry
80 <logentry
81 revision="1">
81 revision="1">
82 <author>test</author>
82 <author>test</author>
83 <date/>
83 <date/>
84 <paths>
84 <paths>
85 <path
85 <path
86 action="A">/a</path>
86 action="A">/a</path>
87 <path
87 <path
88 action="A">/d1</path>
88 action="A">/d1</path>
89 <path
89 <path
90 action="A">/d1/d2</path>
90 action="A">/d1/d2</path>
91 <path
91 <path
92 action="A">/d1/d2/b</path>
92 action="A">/d1/d2/b</path>
93 <path
93 <path
94 action="A">/link</path>
94 action="A">/link</path>
95 </paths>
95 </paths>
96 <msg>add a file</msg>
96 <msg>add a file</msg>
97 </logentry>
97 </logentry>
98 </log>
98 </log>
99 $ ls a a-hg-wc
99 $ ls a a-hg-wc
100 a:
100 a:
101 a
101 a
102 d1
102 d1
103 link
103 link
104
104
105 a-hg-wc:
105 a-hg-wc:
106 a
106 a
107 d1
107 d1
108 link
108 link
109 $ cmp a/a a-hg-wc/a
109 $ cmp a/a a-hg-wc/a
110
110
111 Rename
111 Rename
112
112
113 $ hg --cwd a mv a b
113 $ hg --cwd a mv a b
114 $ hg --cwd a mv link newlink
114 $ hg --cwd a mv link newlink
115
115
116 $ hg --cwd a ci -d '2 0' -m 'rename a file'
116 $ hg --cwd a ci -d '2 0' -m 'rename a file'
117 $ hg --cwd a tip -q
117 $ hg --cwd a tip -q
118 2:a67e26ccec09
118 2:a67e26ccec09
119
119
120 $ hg convert -d svn a
120 $ hg convert -d svn a
121 assuming destination a-hg
121 assuming destination a-hg
122 initializing svn working copy 'a-hg-wc'
122 initializing svn working copy 'a-hg-wc'
123 scanning source...
123 scanning source...
124 sorting...
124 sorting...
125 converting...
125 converting...
126 0 rename a file
126 0 rename a file
127 $ svnupanddisplay a-hg-wc 1
127 $ svnupanddisplay a-hg-wc 1
128 At revision 3.
128 At revision 3.
129 3 3 test .
129 3 3 test .
130 3 3 test b
130 3 3 test b
131 3 1 test d1
131 3 1 test d1
132 3 1 test d1/d2
132 3 1 test d1/d2
133 3 1 test d1/d2/b
133 3 1 test d1/d2/b
134 3 3 test newlink
134 3 3 test newlink
135 <?xml version="1.0"?>
135 <?xml version="1.0"?>
136 <log>
136 <log>
137 <logentry
137 <logentry
138 revision="3">
138 revision="3">
139 <author>test</author>
139 <author>test</author>
140 <date/>
140 <date/>
141 <paths>
141 <paths>
142 <path
142 <path
143 action="D">/a</path>
143 action="D">/a</path>
144 <path
144 <path
145 copyfrom-path="/a"
145 copyfrom-path="/a"
146 copyfrom-rev="2"
146 copyfrom-rev="2"
147 action="A">/b</path>
147 action="A">/b</path>
148 <path
148 <path
149 copyfrom-path="/link"
149 copyfrom-path="/link"
150 copyfrom-rev="2"
150 copyfrom-rev="2"
151 action="A">/newlink</path>
151 action="A">/newlink</path>
152 <path
152 <path
153 action="D">/link</path>
153 action="D">/link</path>
154 </paths>
154 </paths>
155 <msg>rename a file</msg>
155 <msg>rename a file</msg>
156 </logentry>
156 </logentry>
157 </log>
157 </log>
158 $ ls a a-hg-wc
158 $ ls a a-hg-wc
159 a:
159 a:
160 b
160 b
161 d1
161 d1
162 newlink
162 newlink
163
163
164 a-hg-wc:
164 a-hg-wc:
165 b
165 b
166 d1
166 d1
167 newlink
167 newlink
168
168
169 Copy
169 Copy
170
170
171 $ hg --cwd a cp b c
171 $ hg --cwd a cp b c
172
172
173 $ hg --cwd a ci -d '3 0' -m 'copy a file'
173 $ hg --cwd a ci -d '3 0' -m 'copy a file'
174 $ hg --cwd a tip -q
174 $ hg --cwd a tip -q
175 3:0cf087b9ab02
175 3:0cf087b9ab02
176
176
177 $ hg convert -d svn a
177 $ hg convert -d svn a
178 assuming destination a-hg
178 assuming destination a-hg
179 initializing svn working copy 'a-hg-wc'
179 initializing svn working copy 'a-hg-wc'
180 scanning source...
180 scanning source...
181 sorting...
181 sorting...
182 converting...
182 converting...
183 0 copy a file
183 0 copy a file
184 $ svnupanddisplay a-hg-wc 1
184 $ svnupanddisplay a-hg-wc 1
185 At revision 4.
185 At revision 4.
186 4 4 test .
186 4 4 test .
187 4 3 test b
187 4 3 test b
188 4 4 test c
188 4 4 test c
189 4 1 test d1
189 4 1 test d1
190 4 1 test d1/d2
190 4 1 test d1/d2
191 4 1 test d1/d2/b
191 4 1 test d1/d2/b
192 4 3 test newlink
192 4 3 test newlink
193 <?xml version="1.0"?>
193 <?xml version="1.0"?>
194 <log>
194 <log>
195 <logentry
195 <logentry
196 revision="4">
196 revision="4">
197 <author>test</author>
197 <author>test</author>
198 <date/>
198 <date/>
199 <paths>
199 <paths>
200 <path
200 <path
201 copyfrom-path="/b"
201 copyfrom-path="/b"
202 copyfrom-rev="3"
202 copyfrom-rev="3"
203 action="A">/c</path>
203 action="A">/c</path>
204 </paths>
204 </paths>
205 <msg>copy a file</msg>
205 <msg>copy a file</msg>
206 </logentry>
206 </logentry>
207 </log>
207 </log>
208 $ ls a a-hg-wc
208 $ ls a a-hg-wc
209 a:
209 a:
210 b
210 b
211 c
211 c
212 d1
212 d1
213 newlink
213 newlink
214
214
215 a-hg-wc:
215 a-hg-wc:
216 b
216 b
217 c
217 c
218 d1
218 d1
219 newlink
219 newlink
220
220
221 $ hg --cwd a rm b
221 $ hg --cwd a rm b
222 $ echo % remove
222
223 % remove
223 Remove
224
224 $ hg --cwd a ci -d '4 0' -m 'remove a file'
225 $ hg --cwd a ci -d '4 0' -m 'remove a file'
225 $ hg --cwd a tip -q
226 $ hg --cwd a tip -q
226 4:07b2e34a5b17
227 4:07b2e34a5b17
227
228
228 $ hg convert -d svn a
229 $ hg convert -d svn a
229 assuming destination a-hg
230 assuming destination a-hg
230 initializing svn working copy 'a-hg-wc'
231 initializing svn working copy 'a-hg-wc'
231 scanning source...
232 scanning source...
232 sorting...
233 sorting...
233 converting...
234 converting...
234 0 remove a file
235 0 remove a file
235 $ svnupanddisplay a-hg-wc 1
236 $ svnupanddisplay a-hg-wc 1
236 At revision 5.
237 At revision 5.
237 5 5 test .
238 5 5 test .
238 5 4 test c
239 5 4 test c
239 5 1 test d1
240 5 1 test d1
240 5 1 test d1/d2
241 5 1 test d1/d2
241 5 1 test d1/d2/b
242 5 1 test d1/d2/b
242 5 3 test newlink
243 5 3 test newlink
243 <?xml version="1.0"?>
244 <?xml version="1.0"?>
244 <log>
245 <log>
245 <logentry
246 <logentry
246 revision="5">
247 revision="5">
247 <author>test</author>
248 <author>test</author>
248 <date/>
249 <date/>
249 <paths>
250 <paths>
250 <path
251 <path
251 action="D">/b</path>
252 action="D">/b</path>
252 </paths>
253 </paths>
253 <msg>remove a file</msg>
254 <msg>remove a file</msg>
254 </logentry>
255 </logentry>
255 </log>
256 </log>
256 $ ls a a-hg-wc
257 $ ls a a-hg-wc
257 a:
258 a:
258 c
259 c
259 d1
260 d1
260 newlink
261 newlink
261
262
262 a-hg-wc:
263 a-hg-wc:
263 c
264 c
264 d1
265 d1
265 newlink
266 newlink
266
267
267 Exectutable
268 Exectutable
268
269
269 $ chmod +x a/c
270 $ chmod +x a/c
270 $ hg --cwd a ci -d '5 0' -m 'make a file executable'
271 $ hg --cwd a ci -d '5 0' -m 'make a file executable'
271 $ hg --cwd a tip -q
272 $ hg --cwd a tip -q
272 5:31093672760b
273 5:31093672760b
273
274
274 $ hg convert -d svn a
275 $ hg convert -d svn a
275 assuming destination a-hg
276 assuming destination a-hg
276 initializing svn working copy 'a-hg-wc'
277 initializing svn working copy 'a-hg-wc'
277 scanning source...
278 scanning source...
278 sorting...
279 sorting...
279 converting...
280 converting...
280 0 make a file executable
281 0 make a file executable
281 $ svnupanddisplay a-hg-wc 1
282 $ svnupanddisplay a-hg-wc 1
282 At revision 6.
283 At revision 6.
283 6 6 test .
284 6 6 test .
284 6 6 test c
285 6 6 test c
285 6 1 test d1
286 6 1 test d1
286 6 1 test d1/d2
287 6 1 test d1/d2
287 6 1 test d1/d2/b
288 6 1 test d1/d2/b
288 6 3 test newlink
289 6 3 test newlink
289 <?xml version="1.0"?>
290 <?xml version="1.0"?>
290 <log>
291 <log>
291 <logentry
292 <logentry
292 revision="6">
293 revision="6">
293 <author>test</author>
294 <author>test</author>
294 <date/>
295 <date/>
295 <paths>
296 <paths>
296 <path
297 <path
297 action="M">/c</path>
298 action="M">/c</path>
298 </paths>
299 </paths>
299 <msg>make a file executable</msg>
300 <msg>make a file executable</msg>
300 </logentry>
301 </logentry>
301 </log>
302 </log>
302 $ test -x a-hg-wc/c
303 $ test -x a-hg-wc/c
303
304
304 Executable in new directory
305 Executable in new directory
305
306
306 $ rm -rf a a-hg a-hg-wc
307 $ rm -rf a a-hg a-hg-wc
307 $ hg init a
308 $ hg init a
308
309
309 $ mkdir a/d1
310 $ mkdir a/d1
310 $ echo a > a/d1/a
311 $ echo a > a/d1/a
311 $ chmod +x a/d1/a
312 $ chmod +x a/d1/a
312 $ hg --cwd a ci -d '0 0' -A -m 'add executable file in new directory'
313 $ hg --cwd a ci -d '0 0' -A -m 'add executable file in new directory'
313 adding d1/a
314 adding d1/a
314
315
315 $ hg convert -d svn a
316 $ hg convert -d svn a
316 assuming destination a-hg
317 assuming destination a-hg
317 initializing svn repository 'a-hg'
318 initializing svn repository 'a-hg'
318 initializing svn working copy 'a-hg-wc'
319 initializing svn working copy 'a-hg-wc'
319 scanning source...
320 scanning source...
320 sorting...
321 sorting...
321 converting...
322 converting...
322 0 add executable file in new directory
323 0 add executable file in new directory
323 $ svnupanddisplay a-hg-wc 1
324 $ svnupanddisplay a-hg-wc 1
324 At revision 1.
325 At revision 1.
325 1 1 test .
326 1 1 test .
326 1 1 test d1
327 1 1 test d1
327 1 1 test d1/a
328 1 1 test d1/a
328 <?xml version="1.0"?>
329 <?xml version="1.0"?>
329 <log>
330 <log>
330 <logentry
331 <logentry
331 revision="1">
332 revision="1">
332 <author>test</author>
333 <author>test</author>
333 <date/>
334 <date/>
334 <paths>
335 <paths>
335 <path
336 <path
336 action="A">/d1</path>
337 action="A">/d1</path>
337 <path
338 <path
338 action="A">/d1/a</path>
339 action="A">/d1/a</path>
339 </paths>
340 </paths>
340 <msg>add executable file in new directory</msg>
341 <msg>add executable file in new directory</msg>
341 </logentry>
342 </logentry>
342 </log>
343 </log>
343 $ test -x a-hg-wc/d1/a
344 $ test -x a-hg-wc/d1/a
344
345
345 Copy to new directory
346 Copy to new directory
346
347
347 $ mkdir a/d2
348 $ mkdir a/d2
348 $ hg --cwd a cp d1/a d2/a
349 $ hg --cwd a cp d1/a d2/a
349 $ hg --cwd a ci -d '1 0' -A -m 'copy file to new directory'
350 $ hg --cwd a ci -d '1 0' -A -m 'copy file to new directory'
350
351
351 $ hg convert -d svn a
352 $ hg convert -d svn a
352 assuming destination a-hg
353 assuming destination a-hg
353 initializing svn working copy 'a-hg-wc'
354 initializing svn working copy 'a-hg-wc'
354 scanning source...
355 scanning source...
355 sorting...
356 sorting...
356 converting...
357 converting...
357 0 copy file to new directory
358 0 copy file to new directory
358 $ svnupanddisplay a-hg-wc 1
359 $ svnupanddisplay a-hg-wc 1
359 At revision 2.
360 At revision 2.
360 2 2 test .
361 2 2 test .
361 2 1 test d1
362 2 1 test d1
362 2 1 test d1/a
363 2 1 test d1/a
363 2 2 test d2
364 2 2 test d2
364 2 2 test d2/a
365 2 2 test d2/a
365 <?xml version="1.0"?>
366 <?xml version="1.0"?>
366 <log>
367 <log>
367 <logentry
368 <logentry
368 revision="2">
369 revision="2">
369 <author>test</author>
370 <author>test</author>
370 <date/>
371 <date/>
371 <paths>
372 <paths>
372 <path
373 <path
373 action="A">/d2</path>
374 action="A">/d2</path>
374 <path
375 <path
375 copyfrom-path="/d1/a"
376 copyfrom-path="/d1/a"
376 copyfrom-rev="1"
377 copyfrom-rev="1"
377 action="A">/d2/a</path>
378 action="A">/d2/a</path>
378 </paths>
379 </paths>
379 <msg>copy file to new directory</msg>
380 <msg>copy file to new directory</msg>
380 </logentry>
381 </logentry>
381 </log>
382 </log>
382
383
383 Branchy history
384 Branchy history
384
385
385 $ hg init b
386 $ hg init b
386 $ echo base > b/b
387 $ echo base > b/b
387 $ hg --cwd b ci -d '0 0' -Ambase
388 $ hg --cwd b ci -d '0 0' -Ambase
388 adding b
389 adding b
389
390
390 $ "$TESTDIR/svn-safe-append.py" left-1 b/b
391 $ "$TESTDIR/svn-safe-append.py" left-1 b/b
391 $ echo left-1 > b/left-1
392 $ echo left-1 > b/left-1
392 $ hg --cwd b ci -d '1 0' -Amleft-1
393 $ hg --cwd b ci -d '1 0' -Amleft-1
393 adding left-1
394 adding left-1
394
395
395 $ "$TESTDIR/svn-safe-append.py" left-2 b/b
396 $ "$TESTDIR/svn-safe-append.py" left-2 b/b
396 $ echo left-2 > b/left-2
397 $ echo left-2 > b/left-2
397 $ hg --cwd b ci -d '2 0' -Amleft-2
398 $ hg --cwd b ci -d '2 0' -Amleft-2
398 adding left-2
399 adding left-2
399
400
400 $ hg --cwd b up 0
401 $ hg --cwd b up 0
401 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
402 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
402
403
403 $ "$TESTDIR/svn-safe-append.py" right-1 b/b
404 $ "$TESTDIR/svn-safe-append.py" right-1 b/b
404 $ echo right-1 > b/right-1
405 $ echo right-1 > b/right-1
405 $ hg --cwd b ci -d '3 0' -Amright-1
406 $ hg --cwd b ci -d '3 0' -Amright-1
406 adding right-1
407 adding right-1
407 created new head
408 created new head
408
409
409 $ "$TESTDIR/svn-safe-append.py" right-2 b/b
410 $ "$TESTDIR/svn-safe-append.py" right-2 b/b
410 $ echo right-2 > b/right-2
411 $ echo right-2 > b/right-2
411 $ hg --cwd b ci -d '4 0' -Amright-2
412 $ hg --cwd b ci -d '4 0' -Amright-2
412 adding right-2
413 adding right-2
413
414
414 $ hg --cwd b up -C 2
415 $ hg --cwd b up -C 2
415 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
416 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
416 $ hg --cwd b merge
417 $ hg --cwd b merge
417 merging b
418 merging b
418 warning: conflicts during merge.
419 warning: conflicts during merge.
419 merging b failed!
420 merging b failed!
420 2 files updated, 0 files merged, 0 files removed, 1 files unresolved
421 2 files updated, 0 files merged, 0 files removed, 1 files unresolved
421 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
422 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
422 [1]
423 [1]
423 $ hg --cwd b revert -r 2 b
424 $ hg --cwd b revert -r 2 b
424 $ hg resolve -m b
425 $ hg resolve -m b
425 $ hg --cwd b ci -d '5 0' -m 'merge'
426 $ hg --cwd b ci -d '5 0' -m 'merge'
426
427
427 Expect 4 changes
428 Expect 4 changes
428
429
429 $ hg convert -d svn b
430 $ hg convert -d svn b
430 assuming destination b-hg
431 assuming destination b-hg
431 initializing svn repository 'b-hg'
432 initializing svn repository 'b-hg'
432 initializing svn working copy 'b-hg-wc'
433 initializing svn working copy 'b-hg-wc'
433 scanning source...
434 scanning source...
434 sorting...
435 sorting...
435 converting...
436 converting...
436 5 base
437 5 base
437 4 left-1
438 4 left-1
438 3 left-2
439 3 left-2
439 2 right-1
440 2 right-1
440 1 right-2
441 1 right-2
441 0 merge
442 0 merge
442
443
443 $ svnupanddisplay b-hg-wc 0
444 $ svnupanddisplay b-hg-wc 0
444 At revision 4.
445 At revision 4.
445 4 4 test .
446 4 4 test .
446 4 3 test b
447 4 3 test b
447 4 2 test left-1
448 4 2 test left-1
448 4 3 test left-2
449 4 3 test left-2
449 4 4 test right-1
450 4 4 test right-1
450 4 4 test right-2
451 4 4 test right-2
451 <?xml version="1.0"?>
452 <?xml version="1.0"?>
452 <log>
453 <log>
453 <logentry
454 <logentry
454 revision="4">
455 revision="4">
455 <author>test</author>
456 <author>test</author>
456 <date/>
457 <date/>
457 <paths>
458 <paths>
458 <path
459 <path
459 action="A">/right-1</path>
460 action="A">/right-1</path>
460 <path
461 <path
461 action="A">/right-2</path>
462 action="A">/right-2</path>
462 </paths>
463 </paths>
463 <msg>merge</msg>
464 <msg>merge</msg>
464 </logentry>
465 </logentry>
465 <logentry
466 <logentry
466 revision="3">
467 revision="3">
467 <author>test</author>
468 <author>test</author>
468 <date/>
469 <date/>
469 <paths>
470 <paths>
470 <path
471 <path
471 action="M">/b</path>
472 action="M">/b</path>
472 <path
473 <path
473 action="A">/left-2</path>
474 action="A">/left-2</path>
474 </paths>
475 </paths>
475 <msg>left-2</msg>
476 <msg>left-2</msg>
476 </logentry>
477 </logentry>
477 <logentry
478 <logentry
478 revision="2">
479 revision="2">
479 <author>test</author>
480 <author>test</author>
480 <date/>
481 <date/>
481 <paths>
482 <paths>
482 <path
483 <path
483 action="M">/b</path>
484 action="M">/b</path>
484 <path
485 <path
485 action="A">/left-1</path>
486 action="A">/left-1</path>
486 </paths>
487 </paths>
487 <msg>left-1</msg>
488 <msg>left-1</msg>
488 </logentry>
489 </logentry>
489 <logentry
490 <logentry
490 revision="1">
491 revision="1">
491 <author>test</author>
492 <author>test</author>
492 <date/>
493 <date/>
493 <paths>
494 <paths>
494 <path
495 <path
495 action="A">/b</path>
496 action="A">/b</path>
496 </paths>
497 </paths>
497 <msg>base</msg>
498 <msg>base</msg>
498 </logentry>
499 </logentry>
499 </log>
500 </log>
500
501
501 Tags are not supported, but must not break conversion
502 Tags are not supported, but must not break conversion
502
503
503 $ rm -rf a a-hg a-hg-wc
504 $ rm -rf a a-hg a-hg-wc
504 $ hg init a
505 $ hg init a
505 $ echo a > a/a
506 $ echo a > a/a
506 $ hg --cwd a ci -d '0 0' -A -m 'Add file a'
507 $ hg --cwd a ci -d '0 0' -A -m 'Add file a'
507 adding a
508 adding a
508 $ hg --cwd a tag -d '1 0' -m 'Tagged as v1.0' v1.0
509 $ hg --cwd a tag -d '1 0' -m 'Tagged as v1.0' v1.0
509
510
510 $ hg convert -d svn a
511 $ hg convert -d svn a
511 assuming destination a-hg
512 assuming destination a-hg
512 initializing svn repository 'a-hg'
513 initializing svn repository 'a-hg'
513 initializing svn working copy 'a-hg-wc'
514 initializing svn working copy 'a-hg-wc'
514 scanning source...
515 scanning source...
515 sorting...
516 sorting...
516 converting...
517 converting...
517 1 Add file a
518 1 Add file a
518 0 Tagged as v1.0
519 0 Tagged as v1.0
519 writing Subversion tags is not yet implemented
520 writing Subversion tags is not yet implemented
520 $ svnupanddisplay a-hg-wc 2
521 $ svnupanddisplay a-hg-wc 2
521 At revision 2.
522 At revision 2.
522 2 2 test .
523 2 2 test .
523 2 1 test a
524 2 1 test a
524 2 2 test .hgtags
525 2 2 test .hgtags
525 <?xml version="1.0"?>
526 <?xml version="1.0"?>
526 <log>
527 <log>
527 <logentry
528 <logentry
528 revision="2">
529 revision="2">
529 <author>test</author>
530 <author>test</author>
530 <date/>
531 <date/>
531 <paths>
532 <paths>
532 <path
533 <path
533 action="A">/.hgtags</path>
534 action="A">/.hgtags</path>
534 </paths>
535 </paths>
535 <msg>Tagged as v1.0</msg>
536 <msg>Tagged as v1.0</msg>
536 </logentry>
537 </logentry>
537 <logentry
538 <logentry
538 revision="1">
539 revision="1">
539 <author>test</author>
540 <author>test</author>
540 <date/>
541 <date/>
541 <paths>
542 <paths>
542 <path
543 <path
543 action="A">/a</path>
544 action="A">/a</path>
544 </paths>
545 </paths>
545 <msg>Add file a</msg>
546 <msg>Add file a</msg>
546 </logentry>
547 </logentry>
547 </log>
548 </log>
548 $ rm -rf a a-hg a-hg-wc
549 $ rm -rf a a-hg a-hg-wc
@@ -1,127 +1,124 b''
1 Setup
1 Setup
2
2
3 $ echo "[color]" >> $HGRCPATH
3 $ echo "[color]" >> $HGRCPATH
4 $ echo "mode = ansi" >> $HGRCPATH
4 $ echo "mode = ansi" >> $HGRCPATH
5 $ echo "[extensions]" >> $HGRCPATH
5 $ echo "[extensions]" >> $HGRCPATH
6 $ echo "color=" >> $HGRCPATH
6 $ echo "color=" >> $HGRCPATH
7 $ hg init repo
7 $ hg init repo
8 $ cd repo
8 $ cd repo
9 $ cat > a <<EOF
9 $ cat > a <<EOF
10 > c
10 > c
11 > c
11 > c
12 > a
12 > a
13 > a
13 > a
14 > b
14 > b
15 > a
15 > a
16 > a
16 > a
17 > c
17 > c
18 > c
18 > c
19 > EOF
19 > EOF
20 $ hg ci -Am adda
20 $ hg ci -Am adda
21 adding a
21 adding a
22 $ cat > a <<EOF
22 $ cat > a <<EOF
23 > c
23 > c
24 > c
24 > c
25 > a
25 > a
26 > a
26 > a
27 > dd
27 > dd
28 > a
28 > a
29 > a
29 > a
30 > c
30 > c
31 > c
31 > c
32 > EOF
32 > EOF
33
33
34 default context
34 default context
35
35
36 $ hg diff --nodates --color=always
36 $ hg diff --nodates --color=always
37 \x1b[0;1mdiff -r cf9f4ba66af2 a\x1b[0m (esc)
37 \x1b[0;1mdiff -r cf9f4ba66af2 a\x1b[0m (esc)
38 \x1b[0;31;1m--- a/a\x1b[0m (esc)
38 \x1b[0;31;1m--- a/a\x1b[0m (esc)
39 \x1b[0;32;1m+++ b/a\x1b[0m (esc)
39 \x1b[0;32;1m+++ b/a\x1b[0m (esc)
40 \x1b[0;35m@@ -2,7 +2,7 @@\x1b[0m (esc)
40 \x1b[0;35m@@ -2,7 +2,7 @@\x1b[0m (esc)
41 c
41 c
42 a
42 a
43 a
43 a
44 \x1b[0;31m-b\x1b[0m (esc)
44 \x1b[0;31m-b\x1b[0m (esc)
45 \x1b[0;32m+dd\x1b[0m (esc)
45 \x1b[0;32m+dd\x1b[0m (esc)
46 a
46 a
47 a
47 a
48 c
48 c
49
49
50 --unified=2
50 --unified=2
51
51
52 $ hg diff --nodates -U 2 --color=always
52 $ hg diff --nodates -U 2 --color=always
53 \x1b[0;1mdiff -r cf9f4ba66af2 a\x1b[0m (esc)
53 \x1b[0;1mdiff -r cf9f4ba66af2 a\x1b[0m (esc)
54 \x1b[0;31;1m--- a/a\x1b[0m (esc)
54 \x1b[0;31;1m--- a/a\x1b[0m (esc)
55 \x1b[0;32;1m+++ b/a\x1b[0m (esc)
55 \x1b[0;32;1m+++ b/a\x1b[0m (esc)
56 \x1b[0;35m@@ -3,5 +3,5 @@\x1b[0m (esc)
56 \x1b[0;35m@@ -3,5 +3,5 @@\x1b[0m (esc)
57 a
57 a
58 a
58 a
59 \x1b[0;31m-b\x1b[0m (esc)
59 \x1b[0;31m-b\x1b[0m (esc)
60 \x1b[0;32m+dd\x1b[0m (esc)
60 \x1b[0;32m+dd\x1b[0m (esc)
61 a
61 a
62 a
62 a
63
63
64 diffstat
64 diffstat
65
65
66 $ hg diff --stat --color=always
66 $ hg diff --stat --color=always
67 a | 2 \x1b[0;32m+\x1b[0m\x1b[0;31m-\x1b[0m (esc)
67 a | 2 \x1b[0;32m+\x1b[0m\x1b[0;31m-\x1b[0m (esc)
68 1 files changed, 1 insertions(+), 1 deletions(-)
68 1 files changed, 1 insertions(+), 1 deletions(-)
69 $ echo "record=" >> $HGRCPATH
69 $ echo "record=" >> $HGRCPATH
70 $ echo "[ui]" >> $HGRCPATH
70 $ echo "[ui]" >> $HGRCPATH
71 $ echo "interactive=true" >> $HGRCPATH
71 $ echo "interactive=true" >> $HGRCPATH
72 $ echo "[diff]" >> $HGRCPATH
72 $ echo "[diff]" >> $HGRCPATH
73 $ echo "git=True" >> $HGRCPATH
73 $ echo "git=True" >> $HGRCPATH
74
74
75 record
75 record
76
76
77 $ chmod 0755 a
77 $ chmod 0755 a
78 $ hg record --color=always -m moda a <<EOF
78 $ hg record --color=always -m moda a <<EOF
79 > y
79 > y
80 > y
80 > y
81 > EOF
81 > EOF
82 \x1b[0;1mdiff --git a/a b/a\x1b[0m (esc)
82 \x1b[0;1mdiff --git a/a b/a\x1b[0m (esc)
83 \x1b[0;36;1mold mode 100644\x1b[0m (esc)
83 \x1b[0;36;1mold mode 100644\x1b[0m (esc)
84 \x1b[0;36;1mnew mode 100755\x1b[0m (esc)
84 \x1b[0;36;1mnew mode 100755\x1b[0m (esc)
85 1 hunks, 1 lines changed
85 1 hunks, 1 lines changed
86 \x1b[0;33mexamine changes to 'a'? [Ynsfdaq?]\x1b[0m (esc)
86 \x1b[0;33mexamine changes to 'a'? [Ynsfdaq?]\x1b[0m (esc)
87 \x1b[0;35m@@ -2,7 +2,7 @@\x1b[0m (esc)
87 \x1b[0;35m@@ -2,7 +2,7 @@\x1b[0m (esc)
88 c
88 c
89 a
89 a
90 a
90 a
91 \x1b[0;31m-b\x1b[0m (esc)
91 \x1b[0;31m-b\x1b[0m (esc)
92 \x1b[0;32m+dd\x1b[0m (esc)
92 \x1b[0;32m+dd\x1b[0m (esc)
93 a
93 a
94 a
94 a
95 c
95 c
96 \x1b[0;33mrecord this change to 'a'? [Ynsfdaq?]\x1b[0m (esc)
96 \x1b[0;33mrecord this change to 'a'? [Ynsfdaq?]\x1b[0m (esc)
97 $ echo
98
97
99 $ echo "[extensions]" >> $HGRCPATH
98 $ echo "[extensions]" >> $HGRCPATH
100 $ echo "mq=" >> $HGRCPATH
99 $ echo "mq=" >> $HGRCPATH
101 $ hg rollback
100 $ hg rollback
102 repository tip rolled back to revision 0 (undo commit)
101 repository tip rolled back to revision 0 (undo commit)
103 working directory now based on revision 0
102 working directory now based on revision 0
104
103
105 qrecord
104 qrecord
106
105
107 $ hg qrecord --color=always -m moda patch <<EOF
106 $ hg qrecord --color=always -m moda patch <<EOF
108 > y
107 > y
109 > y
108 > y
110 > EOF
109 > EOF
111 \x1b[0;1mdiff --git a/a b/a\x1b[0m (esc)
110 \x1b[0;1mdiff --git a/a b/a\x1b[0m (esc)
112 \x1b[0;36;1mold mode 100644\x1b[0m (esc)
111 \x1b[0;36;1mold mode 100644\x1b[0m (esc)
113 \x1b[0;36;1mnew mode 100755\x1b[0m (esc)
112 \x1b[0;36;1mnew mode 100755\x1b[0m (esc)
114 1 hunks, 1 lines changed
113 1 hunks, 1 lines changed
115 \x1b[0;33mexamine changes to 'a'? [Ynsfdaq?]\x1b[0m (esc)
114 \x1b[0;33mexamine changes to 'a'? [Ynsfdaq?]\x1b[0m (esc)
116 \x1b[0;35m@@ -2,7 +2,7 @@\x1b[0m (esc)
115 \x1b[0;35m@@ -2,7 +2,7 @@\x1b[0m (esc)
117 c
116 c
118 a
117 a
119 a
118 a
120 \x1b[0;31m-b\x1b[0m (esc)
119 \x1b[0;31m-b\x1b[0m (esc)
121 \x1b[0;32m+dd\x1b[0m (esc)
120 \x1b[0;32m+dd\x1b[0m (esc)
122 a
121 a
123 a
122 a
124 c
123 c
125 \x1b[0;33mrecord this change to 'a'? [Ynsfdaq?]\x1b[0m (esc)
124 \x1b[0;33mrecord this change to 'a'? [Ynsfdaq?]\x1b[0m (esc)
126 $ echo
127
@@ -1,418 +1,410 b''
1 adjust to non-default HGPORT, e.g. with run-tests.py -j
1 adjust to non-default HGPORT, e.g. with run-tests.py -j
2
2
3 $ echo "[extensions]" >> $HGRCPATH
3 $ echo "[extensions]" >> $HGRCPATH
4 $ echo "fetch=" >> $HGRCPATH
4 $ echo "fetch=" >> $HGRCPATH
5
5
6 test fetch with default branches only
6 test fetch with default branches only
7
7
8 $ hg init a
8 $ hg init a
9 $ echo a > a/a
9 $ echo a > a/a
10 $ hg --cwd a commit -d '1 0' -Ama
10 $ hg --cwd a commit -d '1 0' -Ama
11 adding a
11 adding a
12 $ hg clone a b
12 $ hg clone a b
13 updating to branch default
13 updating to branch default
14 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
14 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
15 $ hg clone a c
15 $ hg clone a c
16 updating to branch default
16 updating to branch default
17 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
17 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
18 $ echo b > a/b
18 $ echo b > a/b
19 $ hg --cwd a commit -d '2 0' -Amb
19 $ hg --cwd a commit -d '2 0' -Amb
20 adding b
20 adding b
21 $ hg --cwd a parents -q
21 $ hg --cwd a parents -q
22 1:97d72e5f12c7
22 1:97d72e5f12c7
23
23
24 should pull one change
24 should pull one change
25
25
26 $ hg --cwd b fetch ../a
26 $ hg --cwd b fetch ../a
27 pulling from ../a
27 pulling from ../a
28 searching for changes
28 searching for changes
29 adding changesets
29 adding changesets
30 adding manifests
30 adding manifests
31 adding file changes
31 adding file changes
32 added 1 changesets with 1 changes to 1 files
32 added 1 changesets with 1 changes to 1 files
33 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
33 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
34 $ hg --cwd b parents -q
34 $ hg --cwd b parents -q
35 1:97d72e5f12c7
35 1:97d72e5f12c7
36 $ echo c > c/c
36 $ echo c > c/c
37 $ hg --cwd c commit -d '3 0' -Amc
37 $ hg --cwd c commit -d '3 0' -Amc
38 adding c
38 adding c
39 $ hg clone c d
39 $ hg clone c d
40 updating to branch default
40 updating to branch default
41 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
41 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
42 $ hg clone c e
42 $ hg clone c e
43 updating to branch default
43 updating to branch default
44 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
44 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
45
45
46 We cannot use the default commit message if fetching from a local
46 We cannot use the default commit message if fetching from a local
47 repo, because the path of the repo will be included in the commit
47 repo, because the path of the repo will be included in the commit
48 message, making every commit appear different.
48 message, making every commit appear different.
49 should merge c into a
49 should merge c into a
50
50
51 $ hg --cwd c fetch -d '4 0' -m 'automated merge' ../a
51 $ hg --cwd c fetch -d '4 0' -m 'automated merge' ../a
52 pulling from ../a
52 pulling from ../a
53 searching for changes
53 searching for changes
54 adding changesets
54 adding changesets
55 adding manifests
55 adding manifests
56 adding file changes
56 adding file changes
57 added 1 changesets with 1 changes to 1 files (+1 heads)
57 added 1 changesets with 1 changes to 1 files (+1 heads)
58 updating to 2:97d72e5f12c7
58 updating to 2:97d72e5f12c7
59 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
59 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
60 merging with 1:5e056962225c
60 merging with 1:5e056962225c
61 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
61 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
62 new changeset 3:cd3a41621cf0 merges remote changes with local
62 new changeset 3:cd3a41621cf0 merges remote changes with local
63 $ ls c
63 $ ls c
64 a
64 a
65 b
65 b
66 c
66 c
67 $ netstat -tnap 2>/dev/null | grep $HGPORT | grep LISTEN
67 $ netstat -tnap 2>/dev/null | grep $HGPORT | grep LISTEN
68 [1]
68 [1]
69 $ hg --cwd a serve -a localhost -p $HGPORT -d --pid-file=hg.pid
69 $ hg --cwd a serve -a localhost -p $HGPORT -d --pid-file=hg.pid
70 $ cat a/hg.pid >> "$DAEMON_PIDS"
70 $ cat a/hg.pid >> "$DAEMON_PIDS"
71
71
72 fetch over http, no auth
72 fetch over http, no auth
73
73
74 $ hg --cwd d fetch -d '5 0' http://localhost:$HGPORT/
74 $ hg --cwd d fetch -d '5 0' http://localhost:$HGPORT/
75 pulling from http://localhost:$HGPORT/
75 pulling from http://localhost:$HGPORT/
76 searching for changes
76 searching for changes
77 adding changesets
77 adding changesets
78 adding manifests
78 adding manifests
79 adding file changes
79 adding file changes
80 added 1 changesets with 1 changes to 1 files (+1 heads)
80 added 1 changesets with 1 changes to 1 files (+1 heads)
81 updating to 2:97d72e5f12c7
81 updating to 2:97d72e5f12c7
82 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
82 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
83 merging with 1:5e056962225c
83 merging with 1:5e056962225c
84 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
84 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
85 new changeset 3:* merges remote changes with local (glob)
85 new changeset 3:* merges remote changes with local (glob)
86 $ hg --cwd d tip --template '{desc}\n'
86 $ hg --cwd d tip --template '{desc}\n'
87 Automated merge with http://localhost:$HGPORT/
87 Automated merge with http://localhost:$HGPORT/
88
88
89 fetch over http with auth (should be hidden in desc)
89 fetch over http with auth (should be hidden in desc)
90
90
91 $ hg --cwd e fetch -d '5 0' http://user:password@localhost:$HGPORT/
91 $ hg --cwd e fetch -d '5 0' http://user:password@localhost:$HGPORT/
92 pulling from http://user:***@localhost:$HGPORT/
92 pulling from http://user:***@localhost:$HGPORT/
93 searching for changes
93 searching for changes
94 adding changesets
94 adding changesets
95 adding manifests
95 adding manifests
96 adding file changes
96 adding file changes
97 added 1 changesets with 1 changes to 1 files (+1 heads)
97 added 1 changesets with 1 changes to 1 files (+1 heads)
98 updating to 2:97d72e5f12c7
98 updating to 2:97d72e5f12c7
99 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
99 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
100 merging with 1:5e056962225c
100 merging with 1:5e056962225c
101 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
101 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
102 new changeset 3:* merges remote changes with local (glob)
102 new changeset 3:* merges remote changes with local (glob)
103 $ hg --cwd e tip --template '{desc}\n'
103 $ hg --cwd e tip --template '{desc}\n'
104 Automated merge with http://localhost:$HGPORT/
104 Automated merge with http://localhost:$HGPORT/
105 $ hg clone a f
105 $ hg clone a f
106 updating to branch default
106 updating to branch default
107 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
107 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
108 $ hg clone a g
108 $ hg clone a g
109 updating to branch default
109 updating to branch default
110 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
110 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
111 $ echo f > f/f
111 $ echo f > f/f
112 $ hg --cwd f ci -d '6 0' -Amf
112 $ hg --cwd f ci -d '6 0' -Amf
113 adding f
113 adding f
114 $ echo g > g/g
114 $ echo g > g/g
115 $ hg --cwd g ci -d '6 0' -Amg
115 $ hg --cwd g ci -d '6 0' -Amg
116 adding g
116 adding g
117 $ hg clone -q f h
117 $ hg clone -q f h
118 $ hg clone -q g i
118 $ hg clone -q g i
119
119
120 should merge f into g
120 should merge f into g
121
121
122 $ hg --cwd g fetch -d '7 0' --switch -m 'automated merge' ../f
122 $ hg --cwd g fetch -d '7 0' --switch -m 'automated merge' ../f
123 pulling from ../f
123 pulling from ../f
124 searching for changes
124 searching for changes
125 adding changesets
125 adding changesets
126 adding manifests
126 adding manifests
127 adding file changes
127 adding file changes
128 added 1 changesets with 1 changes to 1 files (+1 heads)
128 added 1 changesets with 1 changes to 1 files (+1 heads)
129 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
129 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
130 merging with 3:cc6a3744834d
130 merging with 3:cc6a3744834d
131 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
131 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
132 new changeset 4:55aa4f32ec59 merges remote changes with local
132 new changeset 4:55aa4f32ec59 merges remote changes with local
133 $ rm i/g
133 $ rm i/g
134
134
135 should abort, because i is modified
135 should abort, because i is modified
136
136
137 $ hg --cwd i fetch ../h
137 $ hg --cwd i fetch ../h
138 abort: working directory is missing some files
138 abort: working directory is missing some files
139 [255]
139 [255]
140
140
141 test fetch with named branches
141 test fetch with named branches
142
142
143 $ hg init nbase
143 $ hg init nbase
144 $ echo base > nbase/a
144 $ echo base > nbase/a
145 $ hg -R nbase ci -d '1 0' -Am base
145 $ hg -R nbase ci -d '1 0' -Am base
146 adding a
146 adding a
147 $ hg -R nbase branch a
147 $ hg -R nbase branch a
148 marked working directory as branch a
148 marked working directory as branch a
149 $ echo a > nbase/a
149 $ echo a > nbase/a
150 $ hg -R nbase ci -d '2 0' -m a
150 $ hg -R nbase ci -d '2 0' -m a
151 $ hg -R nbase up -C 0
151 $ hg -R nbase up -C 0
152 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
152 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
153 $ hg -R nbase branch b
153 $ hg -R nbase branch b
154 marked working directory as branch b
154 marked working directory as branch b
155 $ echo b > nbase/b
155 $ echo b > nbase/b
156 $ hg -R nbase ci -Ad '3 0' -m b
156 $ hg -R nbase ci -Ad '3 0' -m b
157 adding b
157 adding b
158 $ echo
159
160
158
161 pull in change on foreign branch
159 pull in change on foreign branch
162
160
163 $ hg clone nbase n1
161 $ hg clone nbase n1
164 updating to branch default
162 updating to branch default
165 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
163 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
166 $ hg clone nbase n2
164 $ hg clone nbase n2
167 updating to branch default
165 updating to branch default
168 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
166 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
169 $ hg -R n1 up -C a
167 $ hg -R n1 up -C a
170 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
168 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
171 $ echo aa > n1/a
169 $ echo aa > n1/a
172 $ hg -R n1 ci -d '4 0' -m a1
170 $ hg -R n1 ci -d '4 0' -m a1
173 $ hg -R n2 up -C b
171 $ hg -R n2 up -C b
174 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
172 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
175 $ hg -R n2 fetch -d '9 0' -m 'merge' n1
173 $ hg -R n2 fetch -d '9 0' -m 'merge' n1
176 pulling from n1
174 pulling from n1
177 searching for changes
175 searching for changes
178 adding changesets
176 adding changesets
179 adding manifests
177 adding manifests
180 adding file changes
178 adding file changes
181 added 1 changesets with 1 changes to 1 files
179 added 1 changesets with 1 changes to 1 files
182
180
183 parent should be 2 (no automatic update)
181 parent should be 2 (no automatic update)
184
182
185 $ hg -R n2 parents --template '{rev}\n'
183 $ hg -R n2 parents --template '{rev}\n'
186 2
184 2
187 $ rm -fr n1 n2
185 $ rm -fr n1 n2
188 $ echo
189
190
186
191 pull in changes on both foreign and local branches
187 pull in changes on both foreign and local branches
192
188
193 $ hg clone nbase n1
189 $ hg clone nbase n1
194 updating to branch default
190 updating to branch default
195 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
191 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
196 $ hg clone nbase n2
192 $ hg clone nbase n2
197 updating to branch default
193 updating to branch default
198 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
194 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
199 $ hg -R n1 up -C a
195 $ hg -R n1 up -C a
200 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
196 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
201 $ echo aa > n1/a
197 $ echo aa > n1/a
202 $ hg -R n1 ci -d '4 0' -m a1
198 $ hg -R n1 ci -d '4 0' -m a1
203 $ hg -R n1 up -C b
199 $ hg -R n1 up -C b
204 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
200 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
205 $ echo bb > n1/b
201 $ echo bb > n1/b
206 $ hg -R n1 ci -d '5 0' -m b1
202 $ hg -R n1 ci -d '5 0' -m b1
207 $ hg -R n2 up -C b
203 $ hg -R n2 up -C b
208 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
204 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
209 $ hg -R n2 fetch -d '9 0' -m 'merge' n1
205 $ hg -R n2 fetch -d '9 0' -m 'merge' n1
210 pulling from n1
206 pulling from n1
211 searching for changes
207 searching for changes
212 adding changesets
208 adding changesets
213 adding manifests
209 adding manifests
214 adding file changes
210 adding file changes
215 added 2 changesets with 2 changes to 2 files
211 added 2 changesets with 2 changes to 2 files
216 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
212 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
217
213
218 parent should be 4 (fast forward)
214 parent should be 4 (fast forward)
219
215
220 $ hg -R n2 parents --template '{rev}\n'
216 $ hg -R n2 parents --template '{rev}\n'
221 4
217 4
222 $ rm -fr n1 n2
218 $ rm -fr n1 n2
223 $ echo
224
225
219
226 pull changes on foreign (2 new heads) and local (1 new head) branches
220 pull changes on foreign (2 new heads) and local (1 new head) branches
227 with a local change
221 with a local change
228
222
229 $ hg clone nbase n1
223 $ hg clone nbase n1
230 updating to branch default
224 updating to branch default
231 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
225 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
232 $ hg clone nbase n2
226 $ hg clone nbase n2
233 updating to branch default
227 updating to branch default
234 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
228 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
235 $ hg -R n1 up -C a
229 $ hg -R n1 up -C a
236 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
230 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
237 $ echo a1 > n1/a
231 $ echo a1 > n1/a
238 $ hg -R n1 ci -d '4 0' -m a1
232 $ hg -R n1 ci -d '4 0' -m a1
239 $ hg -R n1 up -C b
233 $ hg -R n1 up -C b
240 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
234 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
241 $ echo bb > n1/b
235 $ echo bb > n1/b
242 $ hg -R n1 ci -d '5 0' -m b1
236 $ hg -R n1 ci -d '5 0' -m b1
243 $ hg -R n1 up -C 1
237 $ hg -R n1 up -C 1
244 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
238 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
245 $ echo a2 > n1/a
239 $ echo a2 > n1/a
246 $ hg -R n1 ci -d '6 0' -m a2
240 $ hg -R n1 ci -d '6 0' -m a2
247 created new head
241 created new head
248 $ hg -R n2 up -C b
242 $ hg -R n2 up -C b
249 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
243 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
250 $ echo change >> n2/c
244 $ echo change >> n2/c
251 $ hg -R n2 ci -Ad '7 0' -m local
245 $ hg -R n2 ci -Ad '7 0' -m local
252 adding c
246 adding c
253 $ hg -R n2 fetch -d '9 0' -m 'merge' n1
247 $ hg -R n2 fetch -d '9 0' -m 'merge' n1
254 pulling from n1
248 pulling from n1
255 searching for changes
249 searching for changes
256 adding changesets
250 adding changesets
257 adding manifests
251 adding manifests
258 adding file changes
252 adding file changes
259 added 3 changesets with 3 changes to 2 files (+2 heads)
253 added 3 changesets with 3 changes to 2 files (+2 heads)
260 updating to 5:708c6cce3d26
254 updating to 5:708c6cce3d26
261 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
255 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
262 merging with 3:d83427717b1f
256 merging with 3:d83427717b1f
263 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
257 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
264 new changeset 7:48f1a33f52af merges remote changes with local
258 new changeset 7:48f1a33f52af merges remote changes with local
265
259
266 parent should be 7 (new merge changeset)
260 parent should be 7 (new merge changeset)
267
261
268 $ hg -R n2 parents --template '{rev}\n'
262 $ hg -R n2 parents --template '{rev}\n'
269 7
263 7
270 $ rm -fr n1 n2
264 $ rm -fr n1 n2
271
265
272 pull in changes on foreign (merge of local branch) and local (2 new
266 pull in changes on foreign (merge of local branch) and local (2 new
273 heads) with a local change
267 heads) with a local change
274
268
275 $ hg clone nbase n1
269 $ hg clone nbase n1
276 updating to branch default
270 updating to branch default
277 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
271 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
278 $ hg clone nbase n2
272 $ hg clone nbase n2
279 updating to branch default
273 updating to branch default
280 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
274 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
281 $ hg -R n1 up -C a
275 $ hg -R n1 up -C a
282 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
276 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
283 $ hg -R n1 merge b
277 $ hg -R n1 merge b
284 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
278 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
285 (branch merge, don't forget to commit)
279 (branch merge, don't forget to commit)
286 $ hg -R n1 ci -d '4 0' -m merge
280 $ hg -R n1 ci -d '4 0' -m merge
287 $ hg -R n1 up -C 2
281 $ hg -R n1 up -C 2
288 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
282 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
289 $ echo c > n1/a
283 $ echo c > n1/a
290 $ hg -R n1 ci -d '5 0' -m c
284 $ hg -R n1 ci -d '5 0' -m c
291 $ hg -R n1 up -C 2
285 $ hg -R n1 up -C 2
292 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
286 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
293 $ echo cc > n1/a
287 $ echo cc > n1/a
294 $ hg -R n1 ci -d '6 0' -m cc
288 $ hg -R n1 ci -d '6 0' -m cc
295 created new head
289 created new head
296 $ hg -R n2 up -C b
290 $ hg -R n2 up -C b
297 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
291 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
298 $ echo change >> n2/b
292 $ echo change >> n2/b
299 $ hg -R n2 ci -Ad '7 0' -m local
293 $ hg -R n2 ci -Ad '7 0' -m local
300 $ hg -R n2 fetch -d '9 0' -m 'merge' n1
294 $ hg -R n2 fetch -d '9 0' -m 'merge' n1
301 pulling from n1
295 pulling from n1
302 searching for changes
296 searching for changes
303 adding changesets
297 adding changesets
304 adding manifests
298 adding manifests
305 adding file changes
299 adding file changes
306 added 3 changesets with 2 changes to 1 files (+2 heads)
300 added 3 changesets with 2 changes to 1 files (+2 heads)
307 not merging with 1 other new branch heads (use "hg heads ." and "hg merge" to merge them)
301 not merging with 1 other new branch heads (use "hg heads ." and "hg merge" to merge them)
308 [1]
302 [1]
309
303
310 parent should be 3 (fetch did not merge anything)
304 parent should be 3 (fetch did not merge anything)
311
305
312 $ hg -R n2 parents --template '{rev}\n'
306 $ hg -R n2 parents --template '{rev}\n'
313 3
307 3
314 $ rm -fr n1 n2
308 $ rm -fr n1 n2
315
309
316 pull in change on different branch than dirstate
310 pull in change on different branch than dirstate
317
311
318 $ hg init n1
312 $ hg init n1
319 $ echo a > n1/a
313 $ echo a > n1/a
320 $ hg -R n1 ci -Am initial
314 $ hg -R n1 ci -Am initial
321 adding a
315 adding a
322 $ hg clone n1 n2
316 $ hg clone n1 n2
323 updating to branch default
317 updating to branch default
324 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
318 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
325 $ echo b > n1/a
319 $ echo b > n1/a
326 $ hg -R n1 ci -m next
320 $ hg -R n1 ci -m next
327 $ hg -R n2 branch topic
321 $ hg -R n2 branch topic
328 marked working directory as branch topic
322 marked working directory as branch topic
329 $ hg -R n2 fetch -d '0 0' -m merge n1
323 $ hg -R n2 fetch -d '0 0' -m merge n1
330 abort: working dir not at branch tip (use "hg update" to check out branch tip)
324 abort: working dir not at branch tip (use "hg update" to check out branch tip)
331 [255]
325 [255]
332
326
333 parent should be 0 (fetch did not update or merge anything)
327 parent should be 0 (fetch did not update or merge anything)
334
328
335 $ hg -R n2 parents --template '{rev}\n'
329 $ hg -R n2 parents --template '{rev}\n'
336 0
330 0
337 $ rm -fr n1 n2
331 $ rm -fr n1 n2
338
332
339 test fetch with inactive branches
333 test fetch with inactive branches
340
334
341 $ hg init ib1
335 $ hg init ib1
342 $ echo a > ib1/a
336 $ echo a > ib1/a
343 $ hg --cwd ib1 ci -Am base
337 $ hg --cwd ib1 ci -Am base
344 adding a
338 adding a
345 $ hg --cwd ib1 branch second
339 $ hg --cwd ib1 branch second
346 marked working directory as branch second
340 marked working directory as branch second
347 $ echo b > ib1/b
341 $ echo b > ib1/b
348 $ hg --cwd ib1 ci -Am onsecond
342 $ hg --cwd ib1 ci -Am onsecond
349 adding b
343 adding b
350 $ hg --cwd ib1 branch -f default
344 $ hg --cwd ib1 branch -f default
351 marked working directory as branch default
345 marked working directory as branch default
352 $ echo c > ib1/c
346 $ echo c > ib1/c
353 $ hg --cwd ib1 ci -Am newdefault
347 $ hg --cwd ib1 ci -Am newdefault
354 adding c
348 adding c
355 created new head
349 created new head
356 $ hg clone ib1 ib2
350 $ hg clone ib1 ib2
357 updating to branch default
351 updating to branch default
358 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
352 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
359
353
360 fetch should succeed
354 fetch should succeed
361
355
362 $ hg --cwd ib2 fetch ../ib1
356 $ hg --cwd ib2 fetch ../ib1
363 pulling from ../ib1
357 pulling from ../ib1
364 searching for changes
358 searching for changes
365 no changes found
359 no changes found
366 $ rm -fr ib1 ib2
360 $ rm -fr ib1 ib2
367
361
368 test issue1726
362 test issue1726
369
363
370 $ hg init i1726r1
364 $ hg init i1726r1
371 $ echo a > i1726r1/a
365 $ echo a > i1726r1/a
372 $ hg --cwd i1726r1 ci -Am base
366 $ hg --cwd i1726r1 ci -Am base
373 adding a
367 adding a
374 $ hg clone i1726r1 i1726r2
368 $ hg clone i1726r1 i1726r2
375 updating to branch default
369 updating to branch default
376 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
370 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
377 $ echo b > i1726r1/a
371 $ echo b > i1726r1/a
378 $ hg --cwd i1726r1 ci -m second
372 $ hg --cwd i1726r1 ci -m second
379 $ echo c > i1726r2/a
373 $ echo c > i1726r2/a
380 $ hg --cwd i1726r2 ci -m third
374 $ hg --cwd i1726r2 ci -m third
381 $ HGMERGE=true hg --cwd i1726r2 fetch ../i1726r1
375 $ HGMERGE=true hg --cwd i1726r2 fetch ../i1726r1
382 pulling from ../i1726r1
376 pulling from ../i1726r1
383 searching for changes
377 searching for changes
384 adding changesets
378 adding changesets
385 adding manifests
379 adding manifests
386 adding file changes
380 adding file changes
387 added 1 changesets with 1 changes to 1 files (+1 heads)
381 added 1 changesets with 1 changes to 1 files (+1 heads)
388 updating to 2:7837755a2789
382 updating to 2:7837755a2789
389 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
383 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
390 merging with 1:d1f0c6c48ebd
384 merging with 1:d1f0c6c48ebd
391 merging a
385 merging a
392 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
386 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
393 new changeset 3:* merges remote changes with local (glob)
387 new changeset 3:* merges remote changes with local (glob)
394 $ hg --cwd i1726r2 heads default --template '{rev}\n'
388 $ hg --cwd i1726r2 heads default --template '{rev}\n'
395 3
389 3
396 $ echo
397
398
390
399 test issue2047
391 test issue2047
400
392
401 $ hg -q init i2047a
393 $ hg -q init i2047a
402 $ cd i2047a
394 $ cd i2047a
403 $ echo a > a
395 $ echo a > a
404 $ hg -q ci -Am a
396 $ hg -q ci -Am a
405 $ hg -q branch stable
397 $ hg -q branch stable
406 $ echo b > b
398 $ echo b > b
407 $ hg -q ci -Am b
399 $ hg -q ci -Am b
408 $ cd ..
400 $ cd ..
409 $ hg -q clone -r 0 i2047a i2047b
401 $ hg -q clone -r 0 i2047a i2047b
410 $ cd i2047b
402 $ cd i2047b
411 $ hg fetch ../i2047a
403 $ hg fetch ../i2047a
412 pulling from ../i2047a
404 pulling from ../i2047a
413 searching for changes
405 searching for changes
414 adding changesets
406 adding changesets
415 adding manifests
407 adding manifests
416 adding file changes
408 adding file changes
417 added 1 changesets with 1 changes to 1 files
409 added 1 changesets with 1 changes to 1 files
418 $ "$TESTDIR/killdaemons.py"
410 $ "$TESTDIR/killdaemons.py"
@@ -1,609 +1,605 b''
1
1
2 $ "$TESTDIR/hghave" pygments || exit 80
2 $ "$TESTDIR/hghave" pygments || exit 80
3 $ cat <<EOF >> $HGRCPATH
3 $ cat <<EOF >> $HGRCPATH
4 > [extensions]
4 > [extensions]
5 > highlight =
5 > highlight =
6 > [web]
6 > [web]
7 > pygments_style = friendly
7 > pygments_style = friendly
8 > EOF
8 > EOF
9 $ hg init test
9 $ hg init test
10 $ cd test
10 $ cd test
11
11
12 create random Python file to exercise Pygments
12 create random Python file to exercise Pygments
13
13
14 $ cat <<EOF > primes.py
14 $ cat <<EOF > primes.py
15 > #!/usr/bin/env python
15 > #!/usr/bin/env python
16 >
16 >
17 > """Fun with generators. Corresponding Haskell implementation:
17 > """Fun with generators. Corresponding Haskell implementation:
18 >
18 >
19 > primes = 2 : sieve [3, 5..]
19 > primes = 2 : sieve [3, 5..]
20 > where sieve (p:ns) = p : sieve [n | n <- ns, mod n p /= 0]
20 > where sieve (p:ns) = p : sieve [n | n <- ns, mod n p /= 0]
21 > """
21 > """
22 >
22 >
23 > from itertools import dropwhile, ifilter, islice, count, chain
23 > from itertools import dropwhile, ifilter, islice, count, chain
24 >
24 >
25 > def primes():
25 > def primes():
26 > """Generate all primes."""
26 > """Generate all primes."""
27 > def sieve(ns):
27 > def sieve(ns):
28 > p = ns.next()
28 > p = ns.next()
29 > # It is important to yield *here* in order to stop the
29 > # It is important to yield *here* in order to stop the
30 > # infinite recursion.
30 > # infinite recursion.
31 > yield p
31 > yield p
32 > ns = ifilter(lambda n: n % p != 0, ns)
32 > ns = ifilter(lambda n: n % p != 0, ns)
33 > for n in sieve(ns):
33 > for n in sieve(ns):
34 > yield n
34 > yield n
35 >
35 >
36 > odds = ifilter(lambda i: i % 2 == 1, count())
36 > odds = ifilter(lambda i: i % 2 == 1, count())
37 > return chain([2], sieve(dropwhile(lambda n: n < 3, odds)))
37 > return chain([2], sieve(dropwhile(lambda n: n < 3, odds)))
38 >
38 >
39 > if __name__ == "__main__":
39 > if __name__ == "__main__":
40 > import sys
40 > import sys
41 > try:
41 > try:
42 > n = int(sys.argv[1])
42 > n = int(sys.argv[1])
43 > except (ValueError, IndexError):
43 > except (ValueError, IndexError):
44 > n = 10
44 > n = 10
45 > p = primes()
45 > p = primes()
46 > print "The first %d primes: %s" % (n, list(islice(p, n)))
46 > print "The first %d primes: %s" % (n, list(islice(p, n)))
47 > EOF
47 > EOF
48 $ hg ci -Ama
48 $ hg ci -Ama
49 adding primes.py
49 adding primes.py
50
50
51 hg serve
51 hg serve
52
52
53 $ hg serve -p $HGPORT -d -n test --pid-file=hg.pid -A access.log -E errors.log
53 $ hg serve -p $HGPORT -d -n test --pid-file=hg.pid -A access.log -E errors.log
54 $ cat hg.pid >> $DAEMON_PIDS
54 $ cat hg.pid >> $DAEMON_PIDS
55
55
56 hgweb filerevision, html
56 hgweb filerevision, html
57
57
58 $ ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/primes.py') \
58 $ ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/primes.py') \
59 > | sed "s/class=\"k\"/class=\"kn\"/g" | sed "s/class=\"mf\"/class=\"mi\"/g"
59 > | sed "s/class=\"k\"/class=\"kn\"/g" | sed "s/class=\"mf\"/class=\"mi\"/g"
60 200 Script output follows
60 200 Script output follows
61
61
62 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
62 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
63 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
63 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
64 <head>
64 <head>
65 <link rel="icon" href="/static/hgicon.png" type="image/png" />
65 <link rel="icon" href="/static/hgicon.png" type="image/png" />
66 <meta name="robots" content="index, nofollow" />
66 <meta name="robots" content="index, nofollow" />
67 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
67 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
68 <script type="text/javascript" src="/static/mercurial.js"></script>
68 <script type="text/javascript" src="/static/mercurial.js"></script>
69
69
70 <link rel="stylesheet" href="/highlightcss" type="text/css" />
70 <link rel="stylesheet" href="/highlightcss" type="text/css" />
71 <title>test: 853dcd4de2a6 primes.py</title>
71 <title>test: 853dcd4de2a6 primes.py</title>
72 </head>
72 </head>
73 <body>
73 <body>
74
74
75 <div class="container">
75 <div class="container">
76 <div class="menu">
76 <div class="menu">
77 <div class="logo">
77 <div class="logo">
78 <a href="http://mercurial.selenic.com/">
78 <a href="http://mercurial.selenic.com/">
79 <img src="/static/hglogo.png" alt="mercurial" /></a>
79 <img src="/static/hglogo.png" alt="mercurial" /></a>
80 </div>
80 </div>
81 <ul>
81 <ul>
82 <li><a href="/shortlog/853dcd4de2a6">log</a></li>
82 <li><a href="/shortlog/853dcd4de2a6">log</a></li>
83 <li><a href="/graph/853dcd4de2a6">graph</a></li>
83 <li><a href="/graph/853dcd4de2a6">graph</a></li>
84 <li><a href="/tags">tags</a></li>
84 <li><a href="/tags">tags</a></li>
85 <li><a href="/branches">branches</a></li>
85 <li><a href="/branches">branches</a></li>
86 </ul>
86 </ul>
87 <ul>
87 <ul>
88 <li><a href="/rev/853dcd4de2a6">changeset</a></li>
88 <li><a href="/rev/853dcd4de2a6">changeset</a></li>
89 <li><a href="/file/853dcd4de2a6/">browse</a></li>
89 <li><a href="/file/853dcd4de2a6/">browse</a></li>
90 </ul>
90 </ul>
91 <ul>
91 <ul>
92 <li class="active">file</li>
92 <li class="active">file</li>
93 <li><a href="/file/tip/primes.py">latest</a></li>
93 <li><a href="/file/tip/primes.py">latest</a></li>
94 <li><a href="/diff/853dcd4de2a6/primes.py">diff</a></li>
94 <li><a href="/diff/853dcd4de2a6/primes.py">diff</a></li>
95 <li><a href="/annotate/853dcd4de2a6/primes.py">annotate</a></li>
95 <li><a href="/annotate/853dcd4de2a6/primes.py">annotate</a></li>
96 <li><a href="/log/853dcd4de2a6/primes.py">file log</a></li>
96 <li><a href="/log/853dcd4de2a6/primes.py">file log</a></li>
97 <li><a href="/raw-file/853dcd4de2a6/primes.py">raw</a></li>
97 <li><a href="/raw-file/853dcd4de2a6/primes.py">raw</a></li>
98 </ul>
98 </ul>
99 <ul>
99 <ul>
100 <li><a href="/help">help</a></li>
100 <li><a href="/help">help</a></li>
101 </ul>
101 </ul>
102 </div>
102 </div>
103
103
104 <div class="main">
104 <div class="main">
105 <h2><a href="/">test</a></h2>
105 <h2><a href="/">test</a></h2>
106 <h3>view primes.py @ 0:853dcd4de2a6</h3>
106 <h3>view primes.py @ 0:853dcd4de2a6</h3>
107
107
108 <form class="search" action="/log">
108 <form class="search" action="/log">
109
109
110 <p><input name="rev" id="search1" type="text" size="30" /></p>
110 <p><input name="rev" id="search1" type="text" size="30" /></p>
111 <div id="hint">find changesets by author, revision,
111 <div id="hint">find changesets by author, revision,
112 files, or words in the commit message</div>
112 files, or words in the commit message</div>
113 </form>
113 </form>
114
114
115 <div class="description">a</div>
115 <div class="description">a</div>
116
116
117 <table id="changesetEntry">
117 <table id="changesetEntry">
118 <tr>
118 <tr>
119 <th class="author">author</th>
119 <th class="author">author</th>
120 <td class="author">&#116;&#101;&#115;&#116;</td>
120 <td class="author">&#116;&#101;&#115;&#116;</td>
121 </tr>
121 </tr>
122 <tr>
122 <tr>
123 <th class="date">date</th>
123 <th class="date">date</th>
124 <td class="date age">Thu Jan 01 00:00:00 1970 +0000</td>
124 <td class="date age">Thu Jan 01 00:00:00 1970 +0000</td>
125 </tr>
125 </tr>
126 <tr>
126 <tr>
127 <th class="author">parents</th>
127 <th class="author">parents</th>
128 <td class="author"></td>
128 <td class="author"></td>
129 </tr>
129 </tr>
130 <tr>
130 <tr>
131 <th class="author">children</th>
131 <th class="author">children</th>
132 <td class="author"></td>
132 <td class="author"></td>
133 </tr>
133 </tr>
134
134
135 </table>
135 </table>
136
136
137 <div class="overflow">
137 <div class="overflow">
138 <div class="sourcefirst"> line source</div>
138 <div class="sourcefirst"> line source</div>
139
139
140 <div class="parity0 source"><a href="#l1" id="l1"> 1</a> <span class="c">#!/usr/bin/env python</span></div>
140 <div class="parity0 source"><a href="#l1" id="l1"> 1</a> <span class="c">#!/usr/bin/env python</span></div>
141 <div class="parity1 source"><a href="#l2" id="l2"> 2</a> </div>
141 <div class="parity1 source"><a href="#l2" id="l2"> 2</a> </div>
142 <div class="parity0 source"><a href="#l3" id="l3"> 3</a> <span class="sd">&quot;&quot;&quot;Fun with generators. Corresponding Haskell implementation:</span></div>
142 <div class="parity0 source"><a href="#l3" id="l3"> 3</a> <span class="sd">&quot;&quot;&quot;Fun with generators. Corresponding Haskell implementation:</span></div>
143 <div class="parity1 source"><a href="#l4" id="l4"> 4</a> </div>
143 <div class="parity1 source"><a href="#l4" id="l4"> 4</a> </div>
144 <div class="parity0 source"><a href="#l5" id="l5"> 5</a> <span class="sd">primes = 2 : sieve [3, 5..]</span></div>
144 <div class="parity0 source"><a href="#l5" id="l5"> 5</a> <span class="sd">primes = 2 : sieve [3, 5..]</span></div>
145 <div class="parity1 source"><a href="#l6" id="l6"> 6</a> <span class="sd"> where sieve (p:ns) = p : sieve [n | n &lt;- ns, mod n p /= 0]</span></div>
145 <div class="parity1 source"><a href="#l6" id="l6"> 6</a> <span class="sd"> where sieve (p:ns) = p : sieve [n | n &lt;- ns, mod n p /= 0]</span></div>
146 <div class="parity0 source"><a href="#l7" id="l7"> 7</a> <span class="sd">&quot;&quot;&quot;</span></div>
146 <div class="parity0 source"><a href="#l7" id="l7"> 7</a> <span class="sd">&quot;&quot;&quot;</span></div>
147 <div class="parity1 source"><a href="#l8" id="l8"> 8</a> </div>
147 <div class="parity1 source"><a href="#l8" id="l8"> 8</a> </div>
148 <div class="parity0 source"><a href="#l9" id="l9"> 9</a> <span class="kn">from</span> <span class="nn">itertools</span> <span class="kn">import</span> <span class="n">dropwhile</span><span class="p">,</span> <span class="n">ifilter</span><span class="p">,</span> <span class="n">islice</span><span class="p">,</span> <span class="n">count</span><span class="p">,</span> <span class="n">chain</span></div>
148 <div class="parity0 source"><a href="#l9" id="l9"> 9</a> <span class="kn">from</span> <span class="nn">itertools</span> <span class="kn">import</span> <span class="n">dropwhile</span><span class="p">,</span> <span class="n">ifilter</span><span class="p">,</span> <span class="n">islice</span><span class="p">,</span> <span class="n">count</span><span class="p">,</span> <span class="n">chain</span></div>
149 <div class="parity1 source"><a href="#l10" id="l10"> 10</a> </div>
149 <div class="parity1 source"><a href="#l10" id="l10"> 10</a> </div>
150 <div class="parity0 source"><a href="#l11" id="l11"> 11</a> <span class="kn">def</span> <span class="nf">primes</span><span class="p">():</span></div>
150 <div class="parity0 source"><a href="#l11" id="l11"> 11</a> <span class="kn">def</span> <span class="nf">primes</span><span class="p">():</span></div>
151 <div class="parity1 source"><a href="#l12" id="l12"> 12</a> <span class="sd">&quot;&quot;&quot;Generate all primes.&quot;&quot;&quot;</span></div>
151 <div class="parity1 source"><a href="#l12" id="l12"> 12</a> <span class="sd">&quot;&quot;&quot;Generate all primes.&quot;&quot;&quot;</span></div>
152 <div class="parity0 source"><a href="#l13" id="l13"> 13</a> <span class="kn">def</span> <span class="nf">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></div>
152 <div class="parity0 source"><a href="#l13" id="l13"> 13</a> <span class="kn">def</span> <span class="nf">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></div>
153 <div class="parity1 source"><a href="#l14" id="l14"> 14</a> <span class="n">p</span> <span class="o">=</span> <span class="n">ns</span><span class="o">.</span><span class="n">next</span><span class="p">()</span></div>
153 <div class="parity1 source"><a href="#l14" id="l14"> 14</a> <span class="n">p</span> <span class="o">=</span> <span class="n">ns</span><span class="o">.</span><span class="n">next</span><span class="p">()</span></div>
154 <div class="parity0 source"><a href="#l15" id="l15"> 15</a> <span class="c"># It is important to yield *here* in order to stop the</span></div>
154 <div class="parity0 source"><a href="#l15" id="l15"> 15</a> <span class="c"># It is important to yield *here* in order to stop the</span></div>
155 <div class="parity1 source"><a href="#l16" id="l16"> 16</a> <span class="c"># infinite recursion.</span></div>
155 <div class="parity1 source"><a href="#l16" id="l16"> 16</a> <span class="c"># infinite recursion.</span></div>
156 <div class="parity0 source"><a href="#l17" id="l17"> 17</a> <span class="kn">yield</span> <span class="n">p</span></div>
156 <div class="parity0 source"><a href="#l17" id="l17"> 17</a> <span class="kn">yield</span> <span class="n">p</span></div>
157 <div class="parity1 source"><a href="#l18" id="l18"> 18</a> <span class="n">ns</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o">%</span> <span class="n">p</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">,</span> <span class="n">ns</span><span class="p">)</span></div>
157 <div class="parity1 source"><a href="#l18" id="l18"> 18</a> <span class="n">ns</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o">%</span> <span class="n">p</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">,</span> <span class="n">ns</span><span class="p">)</span></div>
158 <div class="parity0 source"><a href="#l19" id="l19"> 19</a> <span class="kn">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></div>
158 <div class="parity0 source"><a href="#l19" id="l19"> 19</a> <span class="kn">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></div>
159 <div class="parity1 source"><a href="#l20" id="l20"> 20</a> <span class="kn">yield</span> <span class="n">n</span></div>
159 <div class="parity1 source"><a href="#l20" id="l20"> 20</a> <span class="kn">yield</span> <span class="n">n</span></div>
160 <div class="parity0 source"><a href="#l21" id="l21"> 21</a> </div>
160 <div class="parity0 source"><a href="#l21" id="l21"> 21</a> </div>
161 <div class="parity1 source"><a href="#l22" id="l22"> 22</a> <span class="n">odds</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">i</span><span class="p">:</span> <span class="n">i</span> <span class="o">%</span> <span class="mi">2</span> <span class="o">==</span> <span class="mi">1</span><span class="p">,</span> <span class="n">count</span><span class="p">())</span></div>
161 <div class="parity1 source"><a href="#l22" id="l22"> 22</a> <span class="n">odds</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">i</span><span class="p">:</span> <span class="n">i</span> <span class="o">%</span> <span class="mi">2</span> <span class="o">==</span> <span class="mi">1</span><span class="p">,</span> <span class="n">count</span><span class="p">())</span></div>
162 <div class="parity0 source"><a href="#l23" id="l23"> 23</a> <span class="kn">return</span> <span class="n">chain</span><span class="p">([</span><span class="mi">2</span><span class="p">],</span> <span class="n">sieve</span><span class="p">(</span><span class="n">dropwhile</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o">&lt;</span> <span class="mi">3</span><span class="p">,</span> <span class="n">odds</span><span class="p">)))</span></div>
162 <div class="parity0 source"><a href="#l23" id="l23"> 23</a> <span class="kn">return</span> <span class="n">chain</span><span class="p">([</span><span class="mi">2</span><span class="p">],</span> <span class="n">sieve</span><span class="p">(</span><span class="n">dropwhile</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o">&lt;</span> <span class="mi">3</span><span class="p">,</span> <span class="n">odds</span><span class="p">)))</span></div>
163 <div class="parity1 source"><a href="#l24" id="l24"> 24</a> </div>
163 <div class="parity1 source"><a href="#l24" id="l24"> 24</a> </div>
164 <div class="parity0 source"><a href="#l25" id="l25"> 25</a> <span class="kn">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;__main__&quot;</span><span class="p">:</span></div>
164 <div class="parity0 source"><a href="#l25" id="l25"> 25</a> <span class="kn">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;__main__&quot;</span><span class="p">:</span></div>
165 <div class="parity1 source"><a href="#l26" id="l26"> 26</a> <span class="kn">import</span> <span class="nn">sys</span></div>
165 <div class="parity1 source"><a href="#l26" id="l26"> 26</a> <span class="kn">import</span> <span class="nn">sys</span></div>
166 <div class="parity0 source"><a href="#l27" id="l27"> 27</a> <span class="kn">try</span><span class="p">:</span></div>
166 <div class="parity0 source"><a href="#l27" id="l27"> 27</a> <span class="kn">try</span><span class="p">:</span></div>
167 <div class="parity1 source"><a href="#l28" id="l28"> 28</a> <span class="n">n</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span></div>
167 <div class="parity1 source"><a href="#l28" id="l28"> 28</a> <span class="n">n</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span></div>
168 <div class="parity0 source"><a href="#l29" id="l29"> 29</a> <span class="kn">except</span> <span class="p">(</span><span class="ne">ValueError</span><span class="p">,</span> <span class="ne">IndexError</span><span class="p">):</span></div>
168 <div class="parity0 source"><a href="#l29" id="l29"> 29</a> <span class="kn">except</span> <span class="p">(</span><span class="ne">ValueError</span><span class="p">,</span> <span class="ne">IndexError</span><span class="p">):</span></div>
169 <div class="parity1 source"><a href="#l30" id="l30"> 30</a> <span class="n">n</span> <span class="o">=</span> <span class="mi">10</span></div>
169 <div class="parity1 source"><a href="#l30" id="l30"> 30</a> <span class="n">n</span> <span class="o">=</span> <span class="mi">10</span></div>
170 <div class="parity0 source"><a href="#l31" id="l31"> 31</a> <span class="n">p</span> <span class="o">=</span> <span class="n">primes</span><span class="p">()</span></div>
170 <div class="parity0 source"><a href="#l31" id="l31"> 31</a> <span class="n">p</span> <span class="o">=</span> <span class="n">primes</span><span class="p">()</span></div>
171 <div class="parity1 source"><a href="#l32" id="l32"> 32</a> <span class="kn">print</span> <span class="s">&quot;The first </span><span class="si">%d</span><span class="s"> primes: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">n</span><span class="p">,</span> <span class="nb">list</span><span class="p">(</span><span class="n">islice</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">n</span><span class="p">)))</span></div>
171 <div class="parity1 source"><a href="#l32" id="l32"> 32</a> <span class="kn">print</span> <span class="s">&quot;The first </span><span class="si">%d</span><span class="s"> primes: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">n</span><span class="p">,</span> <span class="nb">list</span><span class="p">(</span><span class="n">islice</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">n</span><span class="p">)))</span></div>
172 <div class="sourcelast"></div>
172 <div class="sourcelast"></div>
173 </div>
173 </div>
174 </div>
174 </div>
175 </div>
175 </div>
176
176
177 <script type="text/javascript">process_dates()</script>
177 <script type="text/javascript">process_dates()</script>
178
178
179
179
180 </body>
180 </body>
181 </html>
181 </html>
182
182
183
183
184 hgweb fileannotate, html
184 hgweb fileannotate, html
185
185
186 $ ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/annotate/tip/primes.py') \
186 $ ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/annotate/tip/primes.py') \
187 > | sed "s/class=\"k\"/class=\"kn\"/g" | sed "s/class=\"mi\"/class=\"mf\"/g"
187 > | sed "s/class=\"k\"/class=\"kn\"/g" | sed "s/class=\"mi\"/class=\"mf\"/g"
188 200 Script output follows
188 200 Script output follows
189
189
190 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
190 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
191 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
191 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
192 <head>
192 <head>
193 <link rel="icon" href="/static/hgicon.png" type="image/png" />
193 <link rel="icon" href="/static/hgicon.png" type="image/png" />
194 <meta name="robots" content="index, nofollow" />
194 <meta name="robots" content="index, nofollow" />
195 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
195 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
196 <script type="text/javascript" src="/static/mercurial.js"></script>
196 <script type="text/javascript" src="/static/mercurial.js"></script>
197
197
198 <link rel="stylesheet" href="/highlightcss" type="text/css" />
198 <link rel="stylesheet" href="/highlightcss" type="text/css" />
199 <title>test: primes.py annotate</title>
199 <title>test: primes.py annotate</title>
200 </head>
200 </head>
201 <body>
201 <body>
202
202
203 <div class="container">
203 <div class="container">
204 <div class="menu">
204 <div class="menu">
205 <div class="logo">
205 <div class="logo">
206 <a href="http://mercurial.selenic.com/">
206 <a href="http://mercurial.selenic.com/">
207 <img src="/static/hglogo.png" alt="mercurial" /></a>
207 <img src="/static/hglogo.png" alt="mercurial" /></a>
208 </div>
208 </div>
209 <ul>
209 <ul>
210 <li><a href="/shortlog/853dcd4de2a6">log</a></li>
210 <li><a href="/shortlog/853dcd4de2a6">log</a></li>
211 <li><a href="/graph/853dcd4de2a6">graph</a></li>
211 <li><a href="/graph/853dcd4de2a6">graph</a></li>
212 <li><a href="/tags">tags</a></li>
212 <li><a href="/tags">tags</a></li>
213 <li><a href="/bookmarks">bookmarks</a></li>
213 <li><a href="/bookmarks">bookmarks</a></li>
214 <li><a href="/branches">branches</a></li>
214 <li><a href="/branches">branches</a></li>
215 </ul>
215 </ul>
216
216
217 <ul>
217 <ul>
218 <li><a href="/rev/853dcd4de2a6">changeset</a></li>
218 <li><a href="/rev/853dcd4de2a6">changeset</a></li>
219 <li><a href="/file/853dcd4de2a6/">browse</a></li>
219 <li><a href="/file/853dcd4de2a6/">browse</a></li>
220 </ul>
220 </ul>
221 <ul>
221 <ul>
222 <li><a href="/file/853dcd4de2a6/primes.py">file</a></li>
222 <li><a href="/file/853dcd4de2a6/primes.py">file</a></li>
223 <li><a href="/file/tip/primes.py">latest</a></li>
223 <li><a href="/file/tip/primes.py">latest</a></li>
224 <li><a href="/diff/853dcd4de2a6/primes.py">diff</a></li>
224 <li><a href="/diff/853dcd4de2a6/primes.py">diff</a></li>
225 <li class="active">annotate</li>
225 <li class="active">annotate</li>
226 <li><a href="/log/853dcd4de2a6/primes.py">file log</a></li>
226 <li><a href="/log/853dcd4de2a6/primes.py">file log</a></li>
227 <li><a href="/raw-annotate/853dcd4de2a6/primes.py">raw</a></li>
227 <li><a href="/raw-annotate/853dcd4de2a6/primes.py">raw</a></li>
228 </ul>
228 </ul>
229 <ul>
229 <ul>
230 <li><a href="/help">help</a></li>
230 <li><a href="/help">help</a></li>
231 </ul>
231 </ul>
232 </div>
232 </div>
233
233
234 <div class="main">
234 <div class="main">
235 <h2><a href="/">test</a></h2>
235 <h2><a href="/">test</a></h2>
236 <h3>annotate primes.py @ 0:853dcd4de2a6</h3>
236 <h3>annotate primes.py @ 0:853dcd4de2a6</h3>
237
237
238 <form class="search" action="/log">
238 <form class="search" action="/log">
239
239
240 <p><input name="rev" id="search1" type="text" size="30" /></p>
240 <p><input name="rev" id="search1" type="text" size="30" /></p>
241 <div id="hint">find changesets by author, revision,
241 <div id="hint">find changesets by author, revision,
242 files, or words in the commit message</div>
242 files, or words in the commit message</div>
243 </form>
243 </form>
244
244
245 <div class="description">a</div>
245 <div class="description">a</div>
246
246
247 <table id="changesetEntry">
247 <table id="changesetEntry">
248 <tr>
248 <tr>
249 <th class="author">author</th>
249 <th class="author">author</th>
250 <td class="author">&#116;&#101;&#115;&#116;</td>
250 <td class="author">&#116;&#101;&#115;&#116;</td>
251 </tr>
251 </tr>
252 <tr>
252 <tr>
253 <th class="date">date</th>
253 <th class="date">date</th>
254 <td class="date age">Thu Jan 01 00:00:00 1970 +0000</td>
254 <td class="date age">Thu Jan 01 00:00:00 1970 +0000</td>
255 </tr>
255 </tr>
256 <tr>
256 <tr>
257 <th class="author">parents</th>
257 <th class="author">parents</th>
258 <td class="author"></td>
258 <td class="author"></td>
259 </tr>
259 </tr>
260 <tr>
260 <tr>
261 <th class="author">children</th>
261 <th class="author">children</th>
262 <td class="author"></td>
262 <td class="author"></td>
263 </tr>
263 </tr>
264
264
265 </table>
265 </table>
266
266
267 <div class="overflow">
267 <div class="overflow">
268 <table class="bigtable">
268 <table class="bigtable">
269 <tr>
269 <tr>
270 <th class="annotate">rev</th>
270 <th class="annotate">rev</th>
271 <th class="line">&nbsp;&nbsp;line source</th>
271 <th class="line">&nbsp;&nbsp;line source</th>
272 </tr>
272 </tr>
273
273
274 <tr class="parity0">
274 <tr class="parity0">
275 <td class="annotate">
275 <td class="annotate">
276 <a href="/annotate/853dcd4de2a6/primes.py#1"
276 <a href="/annotate/853dcd4de2a6/primes.py#1"
277 title="853dcd4de2a6: a">test@0</a>
277 title="853dcd4de2a6: a">test@0</a>
278 </td>
278 </td>
279 <td class="source"><a href="#l1" id="l1"> 1</a> <span class="c">#!/usr/bin/env python</span></td>
279 <td class="source"><a href="#l1" id="l1"> 1</a> <span class="c">#!/usr/bin/env python</span></td>
280 </tr>
280 </tr>
281 <tr class="parity1">
281 <tr class="parity1">
282 <td class="annotate">
282 <td class="annotate">
283 <a href="/annotate/853dcd4de2a6/primes.py#2"
283 <a href="/annotate/853dcd4de2a6/primes.py#2"
284 title="853dcd4de2a6: a">test@0</a>
284 title="853dcd4de2a6: a">test@0</a>
285 </td>
285 </td>
286 <td class="source"><a href="#l2" id="l2"> 2</a> </td>
286 <td class="source"><a href="#l2" id="l2"> 2</a> </td>
287 </tr>
287 </tr>
288 <tr class="parity0">
288 <tr class="parity0">
289 <td class="annotate">
289 <td class="annotate">
290 <a href="/annotate/853dcd4de2a6/primes.py#3"
290 <a href="/annotate/853dcd4de2a6/primes.py#3"
291 title="853dcd4de2a6: a">test@0</a>
291 title="853dcd4de2a6: a">test@0</a>
292 </td>
292 </td>
293 <td class="source"><a href="#l3" id="l3"> 3</a> <span class="sd">&quot;&quot;&quot;Fun with generators. Corresponding Haskell implementation:</span></td>
293 <td class="source"><a href="#l3" id="l3"> 3</a> <span class="sd">&quot;&quot;&quot;Fun with generators. Corresponding Haskell implementation:</span></td>
294 </tr>
294 </tr>
295 <tr class="parity1">
295 <tr class="parity1">
296 <td class="annotate">
296 <td class="annotate">
297 <a href="/annotate/853dcd4de2a6/primes.py#4"
297 <a href="/annotate/853dcd4de2a6/primes.py#4"
298 title="853dcd4de2a6: a">test@0</a>
298 title="853dcd4de2a6: a">test@0</a>
299 </td>
299 </td>
300 <td class="source"><a href="#l4" id="l4"> 4</a> </td>
300 <td class="source"><a href="#l4" id="l4"> 4</a> </td>
301 </tr>
301 </tr>
302 <tr class="parity0">
302 <tr class="parity0">
303 <td class="annotate">
303 <td class="annotate">
304 <a href="/annotate/853dcd4de2a6/primes.py#5"
304 <a href="/annotate/853dcd4de2a6/primes.py#5"
305 title="853dcd4de2a6: a">test@0</a>
305 title="853dcd4de2a6: a">test@0</a>
306 </td>
306 </td>
307 <td class="source"><a href="#l5" id="l5"> 5</a> <span class="sd">primes = 2 : sieve [3, 5..]</span></td>
307 <td class="source"><a href="#l5" id="l5"> 5</a> <span class="sd">primes = 2 : sieve [3, 5..]</span></td>
308 </tr>
308 </tr>
309 <tr class="parity1">
309 <tr class="parity1">
310 <td class="annotate">
310 <td class="annotate">
311 <a href="/annotate/853dcd4de2a6/primes.py#6"
311 <a href="/annotate/853dcd4de2a6/primes.py#6"
312 title="853dcd4de2a6: a">test@0</a>
312 title="853dcd4de2a6: a">test@0</a>
313 </td>
313 </td>
314 <td class="source"><a href="#l6" id="l6"> 6</a> <span class="sd"> where sieve (p:ns) = p : sieve [n | n &lt;- ns, mod n p /= 0]</span></td>
314 <td class="source"><a href="#l6" id="l6"> 6</a> <span class="sd"> where sieve (p:ns) = p : sieve [n | n &lt;- ns, mod n p /= 0]</span></td>
315 </tr>
315 </tr>
316 <tr class="parity0">
316 <tr class="parity0">
317 <td class="annotate">
317 <td class="annotate">
318 <a href="/annotate/853dcd4de2a6/primes.py#7"
318 <a href="/annotate/853dcd4de2a6/primes.py#7"
319 title="853dcd4de2a6: a">test@0</a>
319 title="853dcd4de2a6: a">test@0</a>
320 </td>
320 </td>
321 <td class="source"><a href="#l7" id="l7"> 7</a> <span class="sd">&quot;&quot;&quot;</span></td>
321 <td class="source"><a href="#l7" id="l7"> 7</a> <span class="sd">&quot;&quot;&quot;</span></td>
322 </tr>
322 </tr>
323 <tr class="parity1">
323 <tr class="parity1">
324 <td class="annotate">
324 <td class="annotate">
325 <a href="/annotate/853dcd4de2a6/primes.py#8"
325 <a href="/annotate/853dcd4de2a6/primes.py#8"
326 title="853dcd4de2a6: a">test@0</a>
326 title="853dcd4de2a6: a">test@0</a>
327 </td>
327 </td>
328 <td class="source"><a href="#l8" id="l8"> 8</a> </td>
328 <td class="source"><a href="#l8" id="l8"> 8</a> </td>
329 </tr>
329 </tr>
330 <tr class="parity0">
330 <tr class="parity0">
331 <td class="annotate">
331 <td class="annotate">
332 <a href="/annotate/853dcd4de2a6/primes.py#9"
332 <a href="/annotate/853dcd4de2a6/primes.py#9"
333 title="853dcd4de2a6: a">test@0</a>
333 title="853dcd4de2a6: a">test@0</a>
334 </td>
334 </td>
335 <td class="source"><a href="#l9" id="l9"> 9</a> <span class="kn">from</span> <span class="nn">itertools</span> <span class="kn">import</span> <span class="n">dropwhile</span><span class="p">,</span> <span class="n">ifilter</span><span class="p">,</span> <span class="n">islice</span><span class="p">,</span> <span class="n">count</span><span class="p">,</span> <span class="n">chain</span></td>
335 <td class="source"><a href="#l9" id="l9"> 9</a> <span class="kn">from</span> <span class="nn">itertools</span> <span class="kn">import</span> <span class="n">dropwhile</span><span class="p">,</span> <span class="n">ifilter</span><span class="p">,</span> <span class="n">islice</span><span class="p">,</span> <span class="n">count</span><span class="p">,</span> <span class="n">chain</span></td>
336 </tr>
336 </tr>
337 <tr class="parity1">
337 <tr class="parity1">
338 <td class="annotate">
338 <td class="annotate">
339 <a href="/annotate/853dcd4de2a6/primes.py#10"
339 <a href="/annotate/853dcd4de2a6/primes.py#10"
340 title="853dcd4de2a6: a">test@0</a>
340 title="853dcd4de2a6: a">test@0</a>
341 </td>
341 </td>
342 <td class="source"><a href="#l10" id="l10"> 10</a> </td>
342 <td class="source"><a href="#l10" id="l10"> 10</a> </td>
343 </tr>
343 </tr>
344 <tr class="parity0">
344 <tr class="parity0">
345 <td class="annotate">
345 <td class="annotate">
346 <a href="/annotate/853dcd4de2a6/primes.py#11"
346 <a href="/annotate/853dcd4de2a6/primes.py#11"
347 title="853dcd4de2a6: a">test@0</a>
347 title="853dcd4de2a6: a">test@0</a>
348 </td>
348 </td>
349 <td class="source"><a href="#l11" id="l11"> 11</a> <span class="kn">def</span> <span class="nf">primes</span><span class="p">():</span></td>
349 <td class="source"><a href="#l11" id="l11"> 11</a> <span class="kn">def</span> <span class="nf">primes</span><span class="p">():</span></td>
350 </tr>
350 </tr>
351 <tr class="parity1">
351 <tr class="parity1">
352 <td class="annotate">
352 <td class="annotate">
353 <a href="/annotate/853dcd4de2a6/primes.py#12"
353 <a href="/annotate/853dcd4de2a6/primes.py#12"
354 title="853dcd4de2a6: a">test@0</a>
354 title="853dcd4de2a6: a">test@0</a>
355 </td>
355 </td>
356 <td class="source"><a href="#l12" id="l12"> 12</a> <span class="sd">&quot;&quot;&quot;Generate all primes.&quot;&quot;&quot;</span></td>
356 <td class="source"><a href="#l12" id="l12"> 12</a> <span class="sd">&quot;&quot;&quot;Generate all primes.&quot;&quot;&quot;</span></td>
357 </tr>
357 </tr>
358 <tr class="parity0">
358 <tr class="parity0">
359 <td class="annotate">
359 <td class="annotate">
360 <a href="/annotate/853dcd4de2a6/primes.py#13"
360 <a href="/annotate/853dcd4de2a6/primes.py#13"
361 title="853dcd4de2a6: a">test@0</a>
361 title="853dcd4de2a6: a">test@0</a>
362 </td>
362 </td>
363 <td class="source"><a href="#l13" id="l13"> 13</a> <span class="kn">def</span> <span class="nf">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></td>
363 <td class="source"><a href="#l13" id="l13"> 13</a> <span class="kn">def</span> <span class="nf">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></td>
364 </tr>
364 </tr>
365 <tr class="parity1">
365 <tr class="parity1">
366 <td class="annotate">
366 <td class="annotate">
367 <a href="/annotate/853dcd4de2a6/primes.py#14"
367 <a href="/annotate/853dcd4de2a6/primes.py#14"
368 title="853dcd4de2a6: a">test@0</a>
368 title="853dcd4de2a6: a">test@0</a>
369 </td>
369 </td>
370 <td class="source"><a href="#l14" id="l14"> 14</a> <span class="n">p</span> <span class="o">=</span> <span class="n">ns</span><span class="o">.</span><span class="n">next</span><span class="p">()</span></td>
370 <td class="source"><a href="#l14" id="l14"> 14</a> <span class="n">p</span> <span class="o">=</span> <span class="n">ns</span><span class="o">.</span><span class="n">next</span><span class="p">()</span></td>
371 </tr>
371 </tr>
372 <tr class="parity0">
372 <tr class="parity0">
373 <td class="annotate">
373 <td class="annotate">
374 <a href="/annotate/853dcd4de2a6/primes.py#15"
374 <a href="/annotate/853dcd4de2a6/primes.py#15"
375 title="853dcd4de2a6: a">test@0</a>
375 title="853dcd4de2a6: a">test@0</a>
376 </td>
376 </td>
377 <td class="source"><a href="#l15" id="l15"> 15</a> <span class="c"># It is important to yield *here* in order to stop the</span></td>
377 <td class="source"><a href="#l15" id="l15"> 15</a> <span class="c"># It is important to yield *here* in order to stop the</span></td>
378 </tr>
378 </tr>
379 <tr class="parity1">
379 <tr class="parity1">
380 <td class="annotate">
380 <td class="annotate">
381 <a href="/annotate/853dcd4de2a6/primes.py#16"
381 <a href="/annotate/853dcd4de2a6/primes.py#16"
382 title="853dcd4de2a6: a">test@0</a>
382 title="853dcd4de2a6: a">test@0</a>
383 </td>
383 </td>
384 <td class="source"><a href="#l16" id="l16"> 16</a> <span class="c"># infinite recursion.</span></td>
384 <td class="source"><a href="#l16" id="l16"> 16</a> <span class="c"># infinite recursion.</span></td>
385 </tr>
385 </tr>
386 <tr class="parity0">
386 <tr class="parity0">
387 <td class="annotate">
387 <td class="annotate">
388 <a href="/annotate/853dcd4de2a6/primes.py#17"
388 <a href="/annotate/853dcd4de2a6/primes.py#17"
389 title="853dcd4de2a6: a">test@0</a>
389 title="853dcd4de2a6: a">test@0</a>
390 </td>
390 </td>
391 <td class="source"><a href="#l17" id="l17"> 17</a> <span class="kn">yield</span> <span class="n">p</span></td>
391 <td class="source"><a href="#l17" id="l17"> 17</a> <span class="kn">yield</span> <span class="n">p</span></td>
392 </tr>
392 </tr>
393 <tr class="parity1">
393 <tr class="parity1">
394 <td class="annotate">
394 <td class="annotate">
395 <a href="/annotate/853dcd4de2a6/primes.py#18"
395 <a href="/annotate/853dcd4de2a6/primes.py#18"
396 title="853dcd4de2a6: a">test@0</a>
396 title="853dcd4de2a6: a">test@0</a>
397 </td>
397 </td>
398 <td class="source"><a href="#l18" id="l18"> 18</a> <span class="n">ns</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o">%</span> <span class="n">p</span> <span class="o">!=</span> <span class="mf">0</span><span class="p">,</span> <span class="n">ns</span><span class="p">)</span></td>
398 <td class="source"><a href="#l18" id="l18"> 18</a> <span class="n">ns</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o">%</span> <span class="n">p</span> <span class="o">!=</span> <span class="mf">0</span><span class="p">,</span> <span class="n">ns</span><span class="p">)</span></td>
399 </tr>
399 </tr>
400 <tr class="parity0">
400 <tr class="parity0">
401 <td class="annotate">
401 <td class="annotate">
402 <a href="/annotate/853dcd4de2a6/primes.py#19"
402 <a href="/annotate/853dcd4de2a6/primes.py#19"
403 title="853dcd4de2a6: a">test@0</a>
403 title="853dcd4de2a6: a">test@0</a>
404 </td>
404 </td>
405 <td class="source"><a href="#l19" id="l19"> 19</a> <span class="kn">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></td>
405 <td class="source"><a href="#l19" id="l19"> 19</a> <span class="kn">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></td>
406 </tr>
406 </tr>
407 <tr class="parity1">
407 <tr class="parity1">
408 <td class="annotate">
408 <td class="annotate">
409 <a href="/annotate/853dcd4de2a6/primes.py#20"
409 <a href="/annotate/853dcd4de2a6/primes.py#20"
410 title="853dcd4de2a6: a">test@0</a>
410 title="853dcd4de2a6: a">test@0</a>
411 </td>
411 </td>
412 <td class="source"><a href="#l20" id="l20"> 20</a> <span class="kn">yield</span> <span class="n">n</span></td>
412 <td class="source"><a href="#l20" id="l20"> 20</a> <span class="kn">yield</span> <span class="n">n</span></td>
413 </tr>
413 </tr>
414 <tr class="parity0">
414 <tr class="parity0">
415 <td class="annotate">
415 <td class="annotate">
416 <a href="/annotate/853dcd4de2a6/primes.py#21"
416 <a href="/annotate/853dcd4de2a6/primes.py#21"
417 title="853dcd4de2a6: a">test@0</a>
417 title="853dcd4de2a6: a">test@0</a>
418 </td>
418 </td>
419 <td class="source"><a href="#l21" id="l21"> 21</a> </td>
419 <td class="source"><a href="#l21" id="l21"> 21</a> </td>
420 </tr>
420 </tr>
421 <tr class="parity1">
421 <tr class="parity1">
422 <td class="annotate">
422 <td class="annotate">
423 <a href="/annotate/853dcd4de2a6/primes.py#22"
423 <a href="/annotate/853dcd4de2a6/primes.py#22"
424 title="853dcd4de2a6: a">test@0</a>
424 title="853dcd4de2a6: a">test@0</a>
425 </td>
425 </td>
426 <td class="source"><a href="#l22" id="l22"> 22</a> <span class="n">odds</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">i</span><span class="p">:</span> <span class="n">i</span> <span class="o">%</span> <span class="mf">2</span> <span class="o">==</span> <span class="mf">1</span><span class="p">,</span> <span class="n">count</span><span class="p">())</span></td>
426 <td class="source"><a href="#l22" id="l22"> 22</a> <span class="n">odds</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">i</span><span class="p">:</span> <span class="n">i</span> <span class="o">%</span> <span class="mf">2</span> <span class="o">==</span> <span class="mf">1</span><span class="p">,</span> <span class="n">count</span><span class="p">())</span></td>
427 </tr>
427 </tr>
428 <tr class="parity0">
428 <tr class="parity0">
429 <td class="annotate">
429 <td class="annotate">
430 <a href="/annotate/853dcd4de2a6/primes.py#23"
430 <a href="/annotate/853dcd4de2a6/primes.py#23"
431 title="853dcd4de2a6: a">test@0</a>
431 title="853dcd4de2a6: a">test@0</a>
432 </td>
432 </td>
433 <td class="source"><a href="#l23" id="l23"> 23</a> <span class="kn">return</span> <span class="n">chain</span><span class="p">([</span><span class="mf">2</span><span class="p">],</span> <span class="n">sieve</span><span class="p">(</span><span class="n">dropwhile</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o">&lt;</span> <span class="mf">3</span><span class="p">,</span> <span class="n">odds</span><span class="p">)))</span></td>
433 <td class="source"><a href="#l23" id="l23"> 23</a> <span class="kn">return</span> <span class="n">chain</span><span class="p">([</span><span class="mf">2</span><span class="p">],</span> <span class="n">sieve</span><span class="p">(</span><span class="n">dropwhile</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o">&lt;</span> <span class="mf">3</span><span class="p">,</span> <span class="n">odds</span><span class="p">)))</span></td>
434 </tr>
434 </tr>
435 <tr class="parity1">
435 <tr class="parity1">
436 <td class="annotate">
436 <td class="annotate">
437 <a href="/annotate/853dcd4de2a6/primes.py#24"
437 <a href="/annotate/853dcd4de2a6/primes.py#24"
438 title="853dcd4de2a6: a">test@0</a>
438 title="853dcd4de2a6: a">test@0</a>
439 </td>
439 </td>
440 <td class="source"><a href="#l24" id="l24"> 24</a> </td>
440 <td class="source"><a href="#l24" id="l24"> 24</a> </td>
441 </tr>
441 </tr>
442 <tr class="parity0">
442 <tr class="parity0">
443 <td class="annotate">
443 <td class="annotate">
444 <a href="/annotate/853dcd4de2a6/primes.py#25"
444 <a href="/annotate/853dcd4de2a6/primes.py#25"
445 title="853dcd4de2a6: a">test@0</a>
445 title="853dcd4de2a6: a">test@0</a>
446 </td>
446 </td>
447 <td class="source"><a href="#l25" id="l25"> 25</a> <span class="kn">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;__main__&quot;</span><span class="p">:</span></td>
447 <td class="source"><a href="#l25" id="l25"> 25</a> <span class="kn">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;__main__&quot;</span><span class="p">:</span></td>
448 </tr>
448 </tr>
449 <tr class="parity1">
449 <tr class="parity1">
450 <td class="annotate">
450 <td class="annotate">
451 <a href="/annotate/853dcd4de2a6/primes.py#26"
451 <a href="/annotate/853dcd4de2a6/primes.py#26"
452 title="853dcd4de2a6: a">test@0</a>
452 title="853dcd4de2a6: a">test@0</a>
453 </td>
453 </td>
454 <td class="source"><a href="#l26" id="l26"> 26</a> <span class="kn">import</span> <span class="nn">sys</span></td>
454 <td class="source"><a href="#l26" id="l26"> 26</a> <span class="kn">import</span> <span class="nn">sys</span></td>
455 </tr>
455 </tr>
456 <tr class="parity0">
456 <tr class="parity0">
457 <td class="annotate">
457 <td class="annotate">
458 <a href="/annotate/853dcd4de2a6/primes.py#27"
458 <a href="/annotate/853dcd4de2a6/primes.py#27"
459 title="853dcd4de2a6: a">test@0</a>
459 title="853dcd4de2a6: a">test@0</a>
460 </td>
460 </td>
461 <td class="source"><a href="#l27" id="l27"> 27</a> <span class="kn">try</span><span class="p">:</span></td>
461 <td class="source"><a href="#l27" id="l27"> 27</a> <span class="kn">try</span><span class="p">:</span></td>
462 </tr>
462 </tr>
463 <tr class="parity1">
463 <tr class="parity1">
464 <td class="annotate">
464 <td class="annotate">
465 <a href="/annotate/853dcd4de2a6/primes.py#28"
465 <a href="/annotate/853dcd4de2a6/primes.py#28"
466 title="853dcd4de2a6: a">test@0</a>
466 title="853dcd4de2a6: a">test@0</a>
467 </td>
467 </td>
468 <td class="source"><a href="#l28" id="l28"> 28</a> <span class="n">n</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mf">1</span><span class="p">])</span></td>
468 <td class="source"><a href="#l28" id="l28"> 28</a> <span class="n">n</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mf">1</span><span class="p">])</span></td>
469 </tr>
469 </tr>
470 <tr class="parity0">
470 <tr class="parity0">
471 <td class="annotate">
471 <td class="annotate">
472 <a href="/annotate/853dcd4de2a6/primes.py#29"
472 <a href="/annotate/853dcd4de2a6/primes.py#29"
473 title="853dcd4de2a6: a">test@0</a>
473 title="853dcd4de2a6: a">test@0</a>
474 </td>
474 </td>
475 <td class="source"><a href="#l29" id="l29"> 29</a> <span class="kn">except</span> <span class="p">(</span><span class="ne">ValueError</span><span class="p">,</span> <span class="ne">IndexError</span><span class="p">):</span></td>
475 <td class="source"><a href="#l29" id="l29"> 29</a> <span class="kn">except</span> <span class="p">(</span><span class="ne">ValueError</span><span class="p">,</span> <span class="ne">IndexError</span><span class="p">):</span></td>
476 </tr>
476 </tr>
477 <tr class="parity1">
477 <tr class="parity1">
478 <td class="annotate">
478 <td class="annotate">
479 <a href="/annotate/853dcd4de2a6/primes.py#30"
479 <a href="/annotate/853dcd4de2a6/primes.py#30"
480 title="853dcd4de2a6: a">test@0</a>
480 title="853dcd4de2a6: a">test@0</a>
481 </td>
481 </td>
482 <td class="source"><a href="#l30" id="l30"> 30</a> <span class="n">n</span> <span class="o">=</span> <span class="mf">10</span></td>
482 <td class="source"><a href="#l30" id="l30"> 30</a> <span class="n">n</span> <span class="o">=</span> <span class="mf">10</span></td>
483 </tr>
483 </tr>
484 <tr class="parity0">
484 <tr class="parity0">
485 <td class="annotate">
485 <td class="annotate">
486 <a href="/annotate/853dcd4de2a6/primes.py#31"
486 <a href="/annotate/853dcd4de2a6/primes.py#31"
487 title="853dcd4de2a6: a">test@0</a>
487 title="853dcd4de2a6: a">test@0</a>
488 </td>
488 </td>
489 <td class="source"><a href="#l31" id="l31"> 31</a> <span class="n">p</span> <span class="o">=</span> <span class="n">primes</span><span class="p">()</span></td>
489 <td class="source"><a href="#l31" id="l31"> 31</a> <span class="n">p</span> <span class="o">=</span> <span class="n">primes</span><span class="p">()</span></td>
490 </tr>
490 </tr>
491 <tr class="parity1">
491 <tr class="parity1">
492 <td class="annotate">
492 <td class="annotate">
493 <a href="/annotate/853dcd4de2a6/primes.py#32"
493 <a href="/annotate/853dcd4de2a6/primes.py#32"
494 title="853dcd4de2a6: a">test@0</a>
494 title="853dcd4de2a6: a">test@0</a>
495 </td>
495 </td>
496 <td class="source"><a href="#l32" id="l32"> 32</a> <span class="kn">print</span> <span class="s">&quot;The first </span><span class="si">%d</span><span class="s"> primes: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">n</span><span class="p">,</span> <span class="nb">list</span><span class="p">(</span><span class="n">islice</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">n</span><span class="p">)))</span></td>
496 <td class="source"><a href="#l32" id="l32"> 32</a> <span class="kn">print</span> <span class="s">&quot;The first </span><span class="si">%d</span><span class="s"> primes: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">n</span><span class="p">,</span> <span class="nb">list</span><span class="p">(</span><span class="n">islice</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">n</span><span class="p">)))</span></td>
497 </tr>
497 </tr>
498 </table>
498 </table>
499 </div>
499 </div>
500 </div>
500 </div>
501 </div>
501 </div>
502
502
503 <script type="text/javascript">process_dates()</script>
503 <script type="text/javascript">process_dates()</script>
504
504
505
505
506 </body>
506 </body>
507 </html>
507 </html>
508
508
509
509
510 hgweb fileannotate, raw
510 hgweb fileannotate, raw
511
511
512 $ ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/annotate/tip/primes.py?style=raw') \
512 $ ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/annotate/tip/primes.py?style=raw') \
513 > | sed "s/test@//" > a
513 > | sed "s/test@//" > a
514 $ echo "200 Script output follows" > b
514 $ echo "200 Script output follows" > b
515 $ echo "" >> b
515 $ echo "" >> b
516 $ echo "" >> b
516 $ echo "" >> b
517 $ hg annotate "primes.py" >> b
517 $ hg annotate "primes.py" >> b
518 $ echo "" >> b
518 $ echo "" >> b
519 $ echo "" >> b
519 $ echo "" >> b
520 $ echo "" >> b
520 $ echo "" >> b
521 $ echo "" >> b
521 $ echo "" >> b
522 $ diff -u b a
522 $ diff -u b a
523 $ echo
524
525
523
526 hgweb filerevision, raw
524 hgweb filerevision, raw
527
525
528 $ ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/primes.py?style=raw') \
526 $ ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/primes.py?style=raw') \
529 > > a
527 > > a
530 $ echo "200 Script output follows" > b
528 $ echo "200 Script output follows" > b
531 $ echo "" >> b
529 $ echo "" >> b
532 $ hg cat primes.py >> b
530 $ hg cat primes.py >> b
533 $ diff -u b a
531 $ diff -u b a
534 $ echo
535
536
532
537 hgweb highlightcss friendly
533 hgweb highlightcss friendly
538
534
539 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/highlightcss' > out
535 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/highlightcss' > out
540 $ head -n 4 out
536 $ head -n 4 out
541 200 Script output follows
537 200 Script output follows
542
538
543 /* pygments_style = friendly */
539 /* pygments_style = friendly */
544
540
545 $ rm out
541 $ rm out
546
542
547 errors encountered
543 errors encountered
548
544
549 $ cat errors.log
545 $ cat errors.log
550 $ "$TESTDIR/killdaemons.py"
546 $ "$TESTDIR/killdaemons.py"
551
547
552 Change the pygments style
548 Change the pygments style
553
549
554 $ cat > .hg/hgrc <<EOF
550 $ cat > .hg/hgrc <<EOF
555 > [web]
551 > [web]
556 > pygments_style = fruity
552 > pygments_style = fruity
557 > EOF
553 > EOF
558
554
559 hg serve again
555 hg serve again
560
556
561 $ hg serve -p $HGPORT -d -n test --pid-file=hg.pid -A access.log -E errors.log
557 $ hg serve -p $HGPORT -d -n test --pid-file=hg.pid -A access.log -E errors.log
562 $ cat hg.pid >> $DAEMON_PIDS
558 $ cat hg.pid >> $DAEMON_PIDS
563
559
564 hgweb highlightcss fruity
560 hgweb highlightcss fruity
565
561
566 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/highlightcss' > out
562 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/highlightcss' > out
567 $ head -n 4 out
563 $ head -n 4 out
568 200 Script output follows
564 200 Script output follows
569
565
570 /* pygments_style = fruity */
566 /* pygments_style = fruity */
571
567
572 $ rm out
568 $ rm out
573
569
574 errors encountered
570 errors encountered
575
571
576 $ cat errors.log
572 $ cat errors.log
577 $ cd ..
573 $ cd ..
578 $ hg init eucjp
574 $ hg init eucjp
579 $ cd eucjp
575 $ cd eucjp
580 $ python -c 'print("\265\376")' >> eucjp.txt # Japanese kanji "Kyo"
576 $ python -c 'print("\265\376")' >> eucjp.txt # Japanese kanji "Kyo"
581 $ hg ci -Ama
577 $ hg ci -Ama
582 adding eucjp.txt
578 adding eucjp.txt
583 $ hgserveget () {
579 $ hgserveget () {
584 > "$TESTDIR/killdaemons.py"
580 > "$TESTDIR/killdaemons.py"
585 > echo % HGENCODING="$1" hg serve
581 > echo % HGENCODING="$1" hg serve
586 > HGENCODING="$1" hg serve -p $HGPORT -d -n test --pid-file=hg.pid -E errors.log
582 > HGENCODING="$1" hg serve -p $HGPORT -d -n test --pid-file=hg.pid -E errors.log
587 > cat hg.pid >> $DAEMON_PIDS
583 > cat hg.pid >> $DAEMON_PIDS
588 >
584 >
589 > echo % hgweb filerevision, html
585 > echo % hgweb filerevision, html
590 > "$TESTDIR/get-with-headers.py" localhost:$HGPORT "/file/tip/$2" \
586 > "$TESTDIR/get-with-headers.py" localhost:$HGPORT "/file/tip/$2" \
591 > | grep '<div class="parity0 source">'
587 > | grep '<div class="parity0 source">'
592 > echo % errors encountered
588 > echo % errors encountered
593 > cat errors.log
589 > cat errors.log
594 > }
590 > }
595 $ hgserveget euc-jp eucjp.txt
591 $ hgserveget euc-jp eucjp.txt
596 % HGENCODING=euc-jp hg serve
592 % HGENCODING=euc-jp hg serve
597 % hgweb filerevision, html
593 % hgweb filerevision, html
598 <div class="parity0 source"><a href="#l1" id="l1"> 1</a> \xb5\xfe</div> (esc)
594 <div class="parity0 source"><a href="#l1" id="l1"> 1</a> \xb5\xfe</div> (esc)
599 % errors encountered
595 % errors encountered
600 $ hgserveget utf-8 eucjp.txt
596 $ hgserveget utf-8 eucjp.txt
601 % HGENCODING=utf-8 hg serve
597 % HGENCODING=utf-8 hg serve
602 % hgweb filerevision, html
598 % hgweb filerevision, html
603 <div class="parity0 source"><a href="#l1" id="l1"> 1</a> \xef\xbf\xbd\xef\xbf\xbd</div> (esc)
599 <div class="parity0 source"><a href="#l1" id="l1"> 1</a> \xef\xbf\xbd\xef\xbf\xbd</div> (esc)
604 % errors encountered
600 % errors encountered
605 $ hgserveget us-ascii eucjp.txt
601 $ hgserveget us-ascii eucjp.txt
606 % HGENCODING=us-ascii hg serve
602 % HGENCODING=us-ascii hg serve
607 % hgweb filerevision, html
603 % hgweb filerevision, html
608 <div class="parity0 source"><a href="#l1" id="l1"> 1</a> ??</div>
604 <div class="parity0 source"><a href="#l1" id="l1"> 1</a> ??</div>
609 % errors encountered
605 % errors encountered
@@ -1,40 +1,38 b''
1
1
2 $ cat > unix2mac.py <<EOF
2 $ cat > unix2mac.py <<EOF
3 > import sys
3 > import sys
4 >
4 >
5 > for path in sys.argv[1:]:
5 > for path in sys.argv[1:]:
6 > data = file(path, 'rb').read()
6 > data = file(path, 'rb').read()
7 > data = data.replace('\n', '\r')
7 > data = data.replace('\n', '\r')
8 > file(path, 'wb').write(data)
8 > file(path, 'wb').write(data)
9 > EOF
9 > EOF
10 $ cat > print.py <<EOF
10 $ cat > print.py <<EOF
11 > import sys
11 > import sys
12 > print(sys.stdin.read().replace('\n', '<LF>').replace('\r', '<CR>').replace('\0', '<NUL>'))
12 > print(sys.stdin.read().replace('\n', '<LF>').replace('\r', '<CR>').replace('\0', '<NUL>'))
13 > EOF
13 > EOF
14 $ hg init
14 $ hg init
15 $ echo '[hooks]' >> .hg/hgrc
15 $ echo '[hooks]' >> .hg/hgrc
16 $ echo 'pretxncommit.cr = python:hgext.win32text.forbidcr' >> .hg/hgrc
16 $ echo 'pretxncommit.cr = python:hgext.win32text.forbidcr' >> .hg/hgrc
17 $ echo 'pretxnchangegroup.cr = python:hgext.win32text.forbidcr' >> .hg/hgrc
17 $ echo 'pretxnchangegroup.cr = python:hgext.win32text.forbidcr' >> .hg/hgrc
18 $ cat .hg/hgrc
18 $ cat .hg/hgrc
19 [hooks]
19 [hooks]
20 pretxncommit.cr = python:hgext.win32text.forbidcr
20 pretxncommit.cr = python:hgext.win32text.forbidcr
21 pretxnchangegroup.cr = python:hgext.win32text.forbidcr
21 pretxnchangegroup.cr = python:hgext.win32text.forbidcr
22 $ echo
23
22
24 $ echo hello > f
23 $ echo hello > f
25 $ hg add f
24 $ hg add f
26 $ hg ci -m 1
25 $ hg ci -m 1
27 $ echo
28
26
29 $ python unix2mac.py f
27 $ python unix2mac.py f
30 $ hg ci -m 2
28 $ hg ci -m 2
31 Attempt to commit or push text file(s) using CR line endings
29 Attempt to commit or push text file(s) using CR line endings
32 in dea860dc51ec: f
30 in dea860dc51ec: f
33 transaction abort!
31 transaction abort!
34 rollback completed
32 rollback completed
35 abort: pretxncommit.cr hook failed
33 abort: pretxncommit.cr hook failed
36 [255]
34 [255]
37 $ hg cat f | python print.py
35 $ hg cat f | python print.py
38 hello<LF>
36 hello<LF>
39 $ cat f | python print.py
37 $ cat f | python print.py
40 hello<CR>
38 hello<CR>
@@ -1,778 +1,720 b''
1 test merge-tools configuration - mostly exercising filemerge.py
1 test merge-tools configuration - mostly exercising filemerge.py
2
2
3 $ unset HGMERGE # make sure HGMERGE doesn't interfere with the test
3 $ unset HGMERGE # make sure HGMERGE doesn't interfere with the test
4 $ hg init
4 $ hg init
5
5
6 revision 0
6 revision 0
7
7
8 $ echo "revision 0" > f
8 $ echo "revision 0" > f
9 $ echo "space" >> f
9 $ echo "space" >> f
10 $ hg commit -Am "revision 0"
10 $ hg commit -Am "revision 0"
11 adding f
11 adding f
12
12
13 revision 1
13 revision 1
14
14
15 $ echo "revision 1" > f
15 $ echo "revision 1" > f
16 $ echo "space" >> f
16 $ echo "space" >> f
17 $ hg commit -Am "revision 1"
17 $ hg commit -Am "revision 1"
18 $ hg update 0 > /dev/null
18 $ hg update 0 > /dev/null
19
19
20 revision 2
20 revision 2
21
21
22 $ echo "revision 2" > f
22 $ echo "revision 2" > f
23 $ echo "space" >> f
23 $ echo "space" >> f
24 $ hg commit -Am "revision 2"
24 $ hg commit -Am "revision 2"
25 created new head
25 created new head
26 $ hg update 0 > /dev/null
26 $ hg update 0 > /dev/null
27
27
28 revision 3 - simple to merge
28 revision 3 - simple to merge
29
29
30 $ echo "revision 3" >> f
30 $ echo "revision 3" >> f
31 $ hg commit -Am "revision 3"
31 $ hg commit -Am "revision 3"
32 created new head
32 created new head
33 $ echo "[merge-tools]" > .hg/hgrc
33 $ echo "[merge-tools]" > .hg/hgrc
34 $ echo
35
34
36 $ beforemerge() {
35 $ beforemerge() {
37 > cat .hg/hgrc
36 > cat .hg/hgrc
38 > echo "# hg update -C 1"
37 > echo "# hg update -C 1"
39 > hg update -C 1 > /dev/null
38 > hg update -C 1 > /dev/null
40 > }
39 > }
41 $ aftermerge() {
40 $ aftermerge() {
42 > echo "# cat f"
41 > echo "# cat f"
43 > cat f
42 > cat f
44 > echo "# hg stat"
43 > echo "# hg stat"
45 > hg stat
44 > hg stat
46 > rm -f f.orig
45 > rm -f f.orig
47 > echo
48 > }
46 > }
49 $ domerge() {
47 $ domerge() {
50 > beforemerge
48 > beforemerge
51 > echo "# hg merge $*"
49 > echo "# hg merge $*"
52 > hg merge $*
50 > hg merge $*
53 > aftermerge
51 > aftermerge
54 > }
52 > }
55 $ echo
56
57
53
58 Tool selection
54 Tool selection
59
55
60 $ echo
61
62
63 default is internal merge:
56 default is internal merge:
64
57
65 $ beforemerge
58 $ beforemerge
66 [merge-tools]
59 [merge-tools]
67 # hg update -C 1
60 # hg update -C 1
68
61
69 hg merge -r 2
62 hg merge -r 2
70 override $PATH to ensure hgmerge not visible; use $PYTHON in case we're
63 override $PATH to ensure hgmerge not visible; use $PYTHON in case we're
71 running from a devel copy, not a temp installation
64 running from a devel copy, not a temp installation
72
65
73 $ PATH="$BINDIR" $PYTHON "$BINDIR"/hg merge -r 2
66 $ PATH="$BINDIR" $PYTHON "$BINDIR"/hg merge -r 2
74 merging f
67 merging f
75 warning: conflicts during merge.
68 warning: conflicts during merge.
76 merging f failed!
69 merging f failed!
77 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
70 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
78 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
71 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
79 [1]
72 [1]
80 $ aftermerge
73 $ aftermerge
81 # cat f
74 # cat f
82 <<<<<<< local
75 <<<<<<< local
83 revision 1
76 revision 1
84 =======
77 =======
85 revision 2
78 revision 2
86 >>>>>>> other
79 >>>>>>> other
87 space
80 space
88 # hg stat
81 # hg stat
89 M f
82 M f
90 ? f.orig
83 ? f.orig
91
84
92
93 simplest hgrc using false for merge:
85 simplest hgrc using false for merge:
94
86
95 $ echo "false.whatever=" >> .hg/hgrc
87 $ echo "false.whatever=" >> .hg/hgrc
96 $ domerge -r 2
88 $ domerge -r 2
97 [merge-tools]
89 [merge-tools]
98 false.whatever=
90 false.whatever=
99 # hg update -C 1
91 # hg update -C 1
100 # hg merge -r 2
92 # hg merge -r 2
101 merging f
93 merging f
102 merging f failed!
94 merging f failed!
103 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
95 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
104 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
96 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
105 # cat f
97 # cat f
106 revision 1
98 revision 1
107 space
99 space
108 # hg stat
100 # hg stat
109 M f
101 M f
110 ? f.orig
102 ? f.orig
111
103
112
113 true with higher .priority gets precedence:
104 true with higher .priority gets precedence:
114
105
115 $ echo "true.priority=1" >> .hg/hgrc
106 $ echo "true.priority=1" >> .hg/hgrc
116 $ domerge -r 2
107 $ domerge -r 2
117 [merge-tools]
108 [merge-tools]
118 false.whatever=
109 false.whatever=
119 true.priority=1
110 true.priority=1
120 # hg update -C 1
111 # hg update -C 1
121 # hg merge -r 2
112 # hg merge -r 2
122 merging f
113 merging f
123 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
114 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
124 (branch merge, don't forget to commit)
115 (branch merge, don't forget to commit)
125 # cat f
116 # cat f
126 revision 1
117 revision 1
127 space
118 space
128 # hg stat
119 # hg stat
129 M f
120 M f
130
121
131
132 unless lowered on command line:
122 unless lowered on command line:
133
123
134 $ domerge -r 2 --config merge-tools.true.priority=-7
124 $ domerge -r 2 --config merge-tools.true.priority=-7
135 [merge-tools]
125 [merge-tools]
136 false.whatever=
126 false.whatever=
137 true.priority=1
127 true.priority=1
138 # hg update -C 1
128 # hg update -C 1
139 # hg merge -r 2 --config merge-tools.true.priority=-7
129 # hg merge -r 2 --config merge-tools.true.priority=-7
140 merging f
130 merging f
141 merging f failed!
131 merging f failed!
142 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
132 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
143 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
133 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
144 # cat f
134 # cat f
145 revision 1
135 revision 1
146 space
136 space
147 # hg stat
137 # hg stat
148 M f
138 M f
149 ? f.orig
139 ? f.orig
150
140
151
152 or false set higher on command line:
141 or false set higher on command line:
153
142
154 $ domerge -r 2 --config merge-tools.false.priority=117
143 $ domerge -r 2 --config merge-tools.false.priority=117
155 [merge-tools]
144 [merge-tools]
156 false.whatever=
145 false.whatever=
157 true.priority=1
146 true.priority=1
158 # hg update -C 1
147 # hg update -C 1
159 # hg merge -r 2 --config merge-tools.false.priority=117
148 # hg merge -r 2 --config merge-tools.false.priority=117
160 merging f
149 merging f
161 merging f failed!
150 merging f failed!
162 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
151 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
163 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
152 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
164 # cat f
153 # cat f
165 revision 1
154 revision 1
166 space
155 space
167 # hg stat
156 # hg stat
168 M f
157 M f
169 ? f.orig
158 ? f.orig
170
159
171
172 or true.executable not found in PATH:
160 or true.executable not found in PATH:
173
161
174 $ domerge -r 2 --config merge-tools.true.executable=nonexistingmergetool
162 $ domerge -r 2 --config merge-tools.true.executable=nonexistingmergetool
175 [merge-tools]
163 [merge-tools]
176 false.whatever=
164 false.whatever=
177 true.priority=1
165 true.priority=1
178 # hg update -C 1
166 # hg update -C 1
179 # hg merge -r 2 --config merge-tools.true.executable=nonexistingmergetool
167 # hg merge -r 2 --config merge-tools.true.executable=nonexistingmergetool
180 merging f
168 merging f
181 merging f failed!
169 merging f failed!
182 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
170 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
183 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
171 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
184 # cat f
172 # cat f
185 revision 1
173 revision 1
186 space
174 space
187 # hg stat
175 # hg stat
188 M f
176 M f
189 ? f.orig
177 ? f.orig
190
178
191
192 or true.executable with bogus path:
179 or true.executable with bogus path:
193
180
194 $ domerge -r 2 --config merge-tools.true.executable=/nonexisting/mergetool
181 $ domerge -r 2 --config merge-tools.true.executable=/nonexisting/mergetool
195 [merge-tools]
182 [merge-tools]
196 false.whatever=
183 false.whatever=
197 true.priority=1
184 true.priority=1
198 # hg update -C 1
185 # hg update -C 1
199 # hg merge -r 2 --config merge-tools.true.executable=/nonexisting/mergetool
186 # hg merge -r 2 --config merge-tools.true.executable=/nonexisting/mergetool
200 merging f
187 merging f
201 merging f failed!
188 merging f failed!
202 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
189 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
203 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
190 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
204 # cat f
191 # cat f
205 revision 1
192 revision 1
206 space
193 space
207 # hg stat
194 # hg stat
208 M f
195 M f
209 ? f.orig
196 ? f.orig
210
197
211
212 but true.executable set to cat found in PATH works:
198 but true.executable set to cat found in PATH works:
213
199
214 $ echo "true.executable=cat" >> .hg/hgrc
200 $ echo "true.executable=cat" >> .hg/hgrc
215 $ domerge -r 2
201 $ domerge -r 2
216 [merge-tools]
202 [merge-tools]
217 false.whatever=
203 false.whatever=
218 true.priority=1
204 true.priority=1
219 true.executable=cat
205 true.executable=cat
220 # hg update -C 1
206 # hg update -C 1
221 # hg merge -r 2
207 # hg merge -r 2
222 merging f
208 merging f
223 revision 1
209 revision 1
224 space
210 space
225 revision 0
211 revision 0
226 space
212 space
227 revision 2
213 revision 2
228 space
214 space
229 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
215 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
230 (branch merge, don't forget to commit)
216 (branch merge, don't forget to commit)
231 # cat f
217 # cat f
232 revision 1
218 revision 1
233 space
219 space
234 # hg stat
220 # hg stat
235 M f
221 M f
236
222
237
238 and true.executable set to cat with path works:
223 and true.executable set to cat with path works:
239
224
240 $ domerge -r 2 --config merge-tools.true.executable=cat
225 $ domerge -r 2 --config merge-tools.true.executable=cat
241 [merge-tools]
226 [merge-tools]
242 false.whatever=
227 false.whatever=
243 true.priority=1
228 true.priority=1
244 true.executable=cat
229 true.executable=cat
245 # hg update -C 1
230 # hg update -C 1
246 # hg merge -r 2 --config merge-tools.true.executable=cat
231 # hg merge -r 2 --config merge-tools.true.executable=cat
247 merging f
232 merging f
248 revision 1
233 revision 1
249 space
234 space
250 revision 0
235 revision 0
251 space
236 space
252 revision 2
237 revision 2
253 space
238 space
254 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
239 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
255 (branch merge, don't forget to commit)
240 (branch merge, don't forget to commit)
256 # cat f
241 # cat f
257 revision 1
242 revision 1
258 space
243 space
259 # hg stat
244 # hg stat
260 M f
245 M f
261
246
262 $ echo
263
264
265 Tool selection and merge-patterns
247 Tool selection and merge-patterns
266
248
267 $ echo
268
269
270 merge-patterns specifies new tool false:
249 merge-patterns specifies new tool false:
271
250
272 $ domerge -r 2 --config merge-patterns.f=false
251 $ domerge -r 2 --config merge-patterns.f=false
273 [merge-tools]
252 [merge-tools]
274 false.whatever=
253 false.whatever=
275 true.priority=1
254 true.priority=1
276 true.executable=cat
255 true.executable=cat
277 # hg update -C 1
256 # hg update -C 1
278 # hg merge -r 2 --config merge-patterns.f=false
257 # hg merge -r 2 --config merge-patterns.f=false
279 merging f
258 merging f
280 merging f failed!
259 merging f failed!
281 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
260 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
282 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
261 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
283 # cat f
262 # cat f
284 revision 1
263 revision 1
285 space
264 space
286 # hg stat
265 # hg stat
287 M f
266 M f
288 ? f.orig
267 ? f.orig
289
268
290
291 merge-patterns specifies executable not found in PATH and gets warning:
269 merge-patterns specifies executable not found in PATH and gets warning:
292
270
293 $ domerge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=nonexistingmergetool
271 $ domerge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=nonexistingmergetool
294 [merge-tools]
272 [merge-tools]
295 false.whatever=
273 false.whatever=
296 true.priority=1
274 true.priority=1
297 true.executable=cat
275 true.executable=cat
298 # hg update -C 1
276 # hg update -C 1
299 # hg merge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=nonexistingmergetool
277 # hg merge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=nonexistingmergetool
300 couldn't find merge tool true specified for f
278 couldn't find merge tool true specified for f
301 merging f
279 merging f
302 merging f failed!
280 merging f failed!
303 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
281 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
304 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
282 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
305 # cat f
283 # cat f
306 revision 1
284 revision 1
307 space
285 space
308 # hg stat
286 # hg stat
309 M f
287 M f
310 ? f.orig
288 ? f.orig
311
289
312
313 merge-patterns specifies executable with bogus path and gets warning:
290 merge-patterns specifies executable with bogus path and gets warning:
314
291
315 $ domerge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=/nonexisting/mergetool
292 $ domerge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=/nonexisting/mergetool
316 [merge-tools]
293 [merge-tools]
317 false.whatever=
294 false.whatever=
318 true.priority=1
295 true.priority=1
319 true.executable=cat
296 true.executable=cat
320 # hg update -C 1
297 # hg update -C 1
321 # hg merge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=/nonexisting/mergetool
298 # hg merge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=/nonexisting/mergetool
322 couldn't find merge tool true specified for f
299 couldn't find merge tool true specified for f
323 merging f
300 merging f
324 merging f failed!
301 merging f failed!
325 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
302 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
326 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
303 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
327 # cat f
304 # cat f
328 revision 1
305 revision 1
329 space
306 space
330 # hg stat
307 # hg stat
331 M f
308 M f
332 ? f.orig
309 ? f.orig
333
310
334 $ echo
335
336
337 ui.merge overrules priority
311 ui.merge overrules priority
338
312
339 $ echo
340
341
342 ui.merge specifies false:
313 ui.merge specifies false:
343
314
344 $ domerge -r 2 --config ui.merge=false
315 $ domerge -r 2 --config ui.merge=false
345 [merge-tools]
316 [merge-tools]
346 false.whatever=
317 false.whatever=
347 true.priority=1
318 true.priority=1
348 true.executable=cat
319 true.executable=cat
349 # hg update -C 1
320 # hg update -C 1
350 # hg merge -r 2 --config ui.merge=false
321 # hg merge -r 2 --config ui.merge=false
351 merging f
322 merging f
352 merging f failed!
323 merging f failed!
353 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
324 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
354 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
325 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
355 # cat f
326 # cat f
356 revision 1
327 revision 1
357 space
328 space
358 # hg stat
329 # hg stat
359 M f
330 M f
360 ? f.orig
331 ? f.orig
361
332
362
363 ui.merge specifies internal:fail:
333 ui.merge specifies internal:fail:
364
334
365 $ domerge -r 2 --config ui.merge=internal:fail
335 $ domerge -r 2 --config ui.merge=internal:fail
366 [merge-tools]
336 [merge-tools]
367 false.whatever=
337 false.whatever=
368 true.priority=1
338 true.priority=1
369 true.executable=cat
339 true.executable=cat
370 # hg update -C 1
340 # hg update -C 1
371 # hg merge -r 2 --config ui.merge=internal:fail
341 # hg merge -r 2 --config ui.merge=internal:fail
372 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
342 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
373 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
343 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
374 # cat f
344 # cat f
375 revision 1
345 revision 1
376 space
346 space
377 # hg stat
347 # hg stat
378 M f
348 M f
379
349
380
381 ui.merge specifies internal:local:
350 ui.merge specifies internal:local:
382
351
383 $ domerge -r 2 --config ui.merge=internal:local
352 $ domerge -r 2 --config ui.merge=internal:local
384 [merge-tools]
353 [merge-tools]
385 false.whatever=
354 false.whatever=
386 true.priority=1
355 true.priority=1
387 true.executable=cat
356 true.executable=cat
388 # hg update -C 1
357 # hg update -C 1
389 # hg merge -r 2 --config ui.merge=internal:local
358 # hg merge -r 2 --config ui.merge=internal:local
390 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
359 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
391 (branch merge, don't forget to commit)
360 (branch merge, don't forget to commit)
392 # cat f
361 # cat f
393 revision 1
362 revision 1
394 space
363 space
395 # hg stat
364 # hg stat
396 M f
365 M f
397
366
398
399 ui.merge specifies internal:other:
367 ui.merge specifies internal:other:
400
368
401 $ domerge -r 2 --config ui.merge=internal:other
369 $ domerge -r 2 --config ui.merge=internal:other
402 [merge-tools]
370 [merge-tools]
403 false.whatever=
371 false.whatever=
404 true.priority=1
372 true.priority=1
405 true.executable=cat
373 true.executable=cat
406 # hg update -C 1
374 # hg update -C 1
407 # hg merge -r 2 --config ui.merge=internal:other
375 # hg merge -r 2 --config ui.merge=internal:other
408 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
376 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
409 (branch merge, don't forget to commit)
377 (branch merge, don't forget to commit)
410 # cat f
378 # cat f
411 revision 2
379 revision 2
412 space
380 space
413 # hg stat
381 # hg stat
414 M f
382 M f
415
383
416
417 ui.merge specifies internal:prompt:
384 ui.merge specifies internal:prompt:
418
385
419 $ domerge -r 2 --config ui.merge=internal:prompt
386 $ domerge -r 2 --config ui.merge=internal:prompt
420 [merge-tools]
387 [merge-tools]
421 false.whatever=
388 false.whatever=
422 true.priority=1
389 true.priority=1
423 true.executable=cat
390 true.executable=cat
424 # hg update -C 1
391 # hg update -C 1
425 # hg merge -r 2 --config ui.merge=internal:prompt
392 # hg merge -r 2 --config ui.merge=internal:prompt
426 no tool found to merge f
393 no tool found to merge f
427 keep (l)ocal or take (o)ther? l
394 keep (l)ocal or take (o)ther? l
428 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
395 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
429 (branch merge, don't forget to commit)
396 (branch merge, don't forget to commit)
430 # cat f
397 # cat f
431 revision 1
398 revision 1
432 space
399 space
433 # hg stat
400 # hg stat
434 M f
401 M f
435
402
436
437 ui.merge specifies internal:dump:
403 ui.merge specifies internal:dump:
438
404
439 $ domerge -r 2 --config ui.merge=internal:dump
405 $ domerge -r 2 --config ui.merge=internal:dump
440 [merge-tools]
406 [merge-tools]
441 false.whatever=
407 false.whatever=
442 true.priority=1
408 true.priority=1
443 true.executable=cat
409 true.executable=cat
444 # hg update -C 1
410 # hg update -C 1
445 # hg merge -r 2 --config ui.merge=internal:dump
411 # hg merge -r 2 --config ui.merge=internal:dump
446 merging f
412 merging f
447 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
413 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
448 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
414 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
449 # cat f
415 # cat f
450 revision 1
416 revision 1
451 space
417 space
452 # hg stat
418 # hg stat
453 M f
419 M f
454 ? f.base
420 ? f.base
455 ? f.local
421 ? f.local
456 ? f.orig
422 ? f.orig
457 ? f.other
423 ? f.other
458
424
459
460 f.base:
425 f.base:
461
426
462 $ cat f.base
427 $ cat f.base
463 revision 0
428 revision 0
464 space
429 space
465
430
466 f.local:
431 f.local:
467
432
468 $ cat f.local
433 $ cat f.local
469 revision 1
434 revision 1
470 space
435 space
471
436
472 f.other:
437 f.other:
473
438
474 $ cat f.other
439 $ cat f.other
475 revision 2
440 revision 2
476 space
441 space
477 $ rm f.base f.local f.other
442 $ rm f.base f.local f.other
478 $ echo
479
480
443
481 ui.merge specifies internal:other but is overruled by pattern for false:
444 ui.merge specifies internal:other but is overruled by pattern for false:
482
445
483 $ domerge -r 2 --config ui.merge=internal:other --config merge-patterns.f=false
446 $ domerge -r 2 --config ui.merge=internal:other --config merge-patterns.f=false
484 [merge-tools]
447 [merge-tools]
485 false.whatever=
448 false.whatever=
486 true.priority=1
449 true.priority=1
487 true.executable=cat
450 true.executable=cat
488 # hg update -C 1
451 # hg update -C 1
489 # hg merge -r 2 --config ui.merge=internal:other --config merge-patterns.f=false
452 # hg merge -r 2 --config ui.merge=internal:other --config merge-patterns.f=false
490 merging f
453 merging f
491 merging f failed!
454 merging f failed!
492 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
455 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
493 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
456 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
494 # cat f
457 # cat f
495 revision 1
458 revision 1
496 space
459 space
497 # hg stat
460 # hg stat
498 M f
461 M f
499 ? f.orig
462 ? f.orig
500
463
501 $ echo
502
503
504 Premerge
464 Premerge
505
465
506 $ echo
507
508
509 ui.merge specifies internal:other but is overruled by --tool=false
466 ui.merge specifies internal:other but is overruled by --tool=false
510
467
511 $ domerge -r 2 --config ui.merge=internal:other --tool=false
468 $ domerge -r 2 --config ui.merge=internal:other --tool=false
512 [merge-tools]
469 [merge-tools]
513 false.whatever=
470 false.whatever=
514 true.priority=1
471 true.priority=1
515 true.executable=cat
472 true.executable=cat
516 # hg update -C 1
473 # hg update -C 1
517 # hg merge -r 2 --config ui.merge=internal:other --tool=false
474 # hg merge -r 2 --config ui.merge=internal:other --tool=false
518 merging f
475 merging f
519 merging f failed!
476 merging f failed!
520 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
477 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
521 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
478 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
522 # cat f
479 # cat f
523 revision 1
480 revision 1
524 space
481 space
525 # hg stat
482 # hg stat
526 M f
483 M f
527 ? f.orig
484 ? f.orig
528
485
529 HGMERGE specifies internal:other but is overruled by --tool=false
486 HGMERGE specifies internal:other but is overruled by --tool=false
530
487
531 $ HGMERGE=internal:other ; export HGMERGE
488 $ HGMERGE=internal:other ; export HGMERGE
532 $ domerge -r 2 --tool=false
489 $ domerge -r 2 --tool=false
533 [merge-tools]
490 [merge-tools]
534 false.whatever=
491 false.whatever=
535 true.priority=1
492 true.priority=1
536 true.executable=cat
493 true.executable=cat
537 # hg update -C 1
494 # hg update -C 1
538 # hg merge -r 2 --tool=false
495 # hg merge -r 2 --tool=false
539 merging f
496 merging f
540 merging f failed!
497 merging f failed!
541 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
498 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
542 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
499 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
543 # cat f
500 # cat f
544 revision 1
501 revision 1
545 space
502 space
546 # hg stat
503 # hg stat
547 M f
504 M f
548 ? f.orig
505 ? f.orig
549
506
550 $ unset HGMERGE # make sure HGMERGE doesn't interfere with remaining tests
507 $ unset HGMERGE # make sure HGMERGE doesn't interfere with remaining tests
551
508
552 Default is silent simplemerge:
509 Default is silent simplemerge:
553
510
554 $ domerge -r 3
511 $ domerge -r 3
555 [merge-tools]
512 [merge-tools]
556 false.whatever=
513 false.whatever=
557 true.priority=1
514 true.priority=1
558 true.executable=cat
515 true.executable=cat
559 # hg update -C 1
516 # hg update -C 1
560 # hg merge -r 3
517 # hg merge -r 3
561 merging f
518 merging f
562 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
519 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
563 (branch merge, don't forget to commit)
520 (branch merge, don't forget to commit)
564 # cat f
521 # cat f
565 revision 1
522 revision 1
566 space
523 space
567 revision 3
524 revision 3
568 # hg stat
525 # hg stat
569 M f
526 M f
570
527
571
572 .premerge=True is same:
528 .premerge=True is same:
573
529
574 $ domerge -r 3 --config merge-tools.true.premerge=True
530 $ domerge -r 3 --config merge-tools.true.premerge=True
575 [merge-tools]
531 [merge-tools]
576 false.whatever=
532 false.whatever=
577 true.priority=1
533 true.priority=1
578 true.executable=cat
534 true.executable=cat
579 # hg update -C 1
535 # hg update -C 1
580 # hg merge -r 3 --config merge-tools.true.premerge=True
536 # hg merge -r 3 --config merge-tools.true.premerge=True
581 merging f
537 merging f
582 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
538 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
583 (branch merge, don't forget to commit)
539 (branch merge, don't forget to commit)
584 # cat f
540 # cat f
585 revision 1
541 revision 1
586 space
542 space
587 revision 3
543 revision 3
588 # hg stat
544 # hg stat
589 M f
545 M f
590
546
591
592 .premerge=False executes merge-tool:
547 .premerge=False executes merge-tool:
593
548
594 $ domerge -r 3 --config merge-tools.true.premerge=False
549 $ domerge -r 3 --config merge-tools.true.premerge=False
595 [merge-tools]
550 [merge-tools]
596 false.whatever=
551 false.whatever=
597 true.priority=1
552 true.priority=1
598 true.executable=cat
553 true.executable=cat
599 # hg update -C 1
554 # hg update -C 1
600 # hg merge -r 3 --config merge-tools.true.premerge=False
555 # hg merge -r 3 --config merge-tools.true.premerge=False
601 merging f
556 merging f
602 revision 1
557 revision 1
603 space
558 space
604 revision 0
559 revision 0
605 space
560 space
606 revision 0
561 revision 0
607 space
562 space
608 revision 3
563 revision 3
609 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
564 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
610 (branch merge, don't forget to commit)
565 (branch merge, don't forget to commit)
611 # cat f
566 # cat f
612 revision 1
567 revision 1
613 space
568 space
614 # hg stat
569 # hg stat
615 M f
570 M f
616
571
617 $ echo
618
619
620 Tool execution
572 Tool execution
621
573
622 $ echo
574 set tools.args explicit to include $base $local $other $output:
623
575
624 $ echo '# set tools.args explicit to include $base $local $other $output:' # default '$local $base $other'
625 # set tools.args explicit to include $base $local $other $output:
626 $ beforemerge
576 $ beforemerge
627 [merge-tools]
577 [merge-tools]
628 false.whatever=
578 false.whatever=
629 true.priority=1
579 true.priority=1
630 true.executable=cat
580 true.executable=cat
631 # hg update -C 1
581 # hg update -C 1
632 $ hg merge -r 2 --config merge-tools.true.executable=head --config merge-tools.true.args='$base $local $other $output' \
582 $ hg merge -r 2 --config merge-tools.true.executable=head --config merge-tools.true.args='$base $local $other $output' \
633 > | sed 's,==> .* <==,==> ... <==,g'
583 > | sed 's,==> .* <==,==> ... <==,g'
634 merging f
584 merging f
635 ==> ... <==
585 ==> ... <==
636 revision 0
586 revision 0
637 space
587 space
638
588
639 ==> ... <==
589 ==> ... <==
640 revision 1
590 revision 1
641 space
591 space
642
592
643 ==> ... <==
593 ==> ... <==
644 revision 2
594 revision 2
645 space
595 space
646
596
647 ==> ... <==
597 ==> ... <==
648 revision 1
598 revision 1
649 space
599 space
650 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
600 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
651 (branch merge, don't forget to commit)
601 (branch merge, don't forget to commit)
652 $ aftermerge
602 $ aftermerge
653 # cat f
603 # cat f
654 revision 1
604 revision 1
655 space
605 space
656 # hg stat
606 # hg stat
657 M f
607 M f
658
608
659 $ echo '# Merge with "echo mergeresult > $local":'
609 Merge with "echo mergeresult > $local":
660 # Merge with "echo mergeresult > $local":
610
661 $ beforemerge
611 $ beforemerge
662 [merge-tools]
612 [merge-tools]
663 false.whatever=
613 false.whatever=
664 true.priority=1
614 true.priority=1
665 true.executable=cat
615 true.executable=cat
666 # hg update -C 1
616 # hg update -C 1
667 $ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > $local'
617 $ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > $local'
668 merging f
618 merging f
669 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
619 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
670 (branch merge, don't forget to commit)
620 (branch merge, don't forget to commit)
671 $ aftermerge
621 $ aftermerge
672 # cat f
622 # cat f
673 mergeresult
623 mergeresult
674 # hg stat
624 # hg stat
675 M f
625 M f
676
626
677 $ echo '# - and $local is the file f:'
627 - and $local is the file f:
678 # - and $local is the file f:
628
679 $ beforemerge
629 $ beforemerge
680 [merge-tools]
630 [merge-tools]
681 false.whatever=
631 false.whatever=
682 true.priority=1
632 true.priority=1
683 true.executable=cat
633 true.executable=cat
684 # hg update -C 1
634 # hg update -C 1
685 $ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > f'
635 $ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > f'
686 merging f
636 merging f
687 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
637 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
688 (branch merge, don't forget to commit)
638 (branch merge, don't forget to commit)
689 $ aftermerge
639 $ aftermerge
690 # cat f
640 # cat f
691 mergeresult
641 mergeresult
692 # hg stat
642 # hg stat
693 M f
643 M f
694
644
695 $ echo '# Merge with "echo mergeresult > $output" - the variable is a bit magic:'
645 Merge with "echo mergeresult > $output" - the variable is a bit magic:
696 # Merge with "echo mergeresult > $output" - the variable is a bit magic:
646
697 $ beforemerge
647 $ beforemerge
698 [merge-tools]
648 [merge-tools]
699 false.whatever=
649 false.whatever=
700 true.priority=1
650 true.priority=1
701 true.executable=cat
651 true.executable=cat
702 # hg update -C 1
652 # hg update -C 1
703 $ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > $output'
653 $ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > $output'
704 merging f
654 merging f
705 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
655 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
706 (branch merge, don't forget to commit)
656 (branch merge, don't forget to commit)
707 $ aftermerge
657 $ aftermerge
708 # cat f
658 # cat f
709 mergeresult
659 mergeresult
710 # hg stat
660 # hg stat
711 M f
661 M f
712
662
713
714 Merge using tool with a path that must be quoted:
663 Merge using tool with a path that must be quoted:
715
664
716 $ beforemerge
665 $ beforemerge
717 [merge-tools]
666 [merge-tools]
718 false.whatever=
667 false.whatever=
719 true.priority=1
668 true.priority=1
720 true.executable=cat
669 true.executable=cat
721 # hg update -C 1
670 # hg update -C 1
722 $ cat <<EOF > 'my merge tool'
671 $ cat <<EOF > 'my merge tool'
723 > #!/bin/sh
672 > #!/bin/sh
724 > cat "\$1" "\$2" "\$3" > "\$4"
673 > cat "\$1" "\$2" "\$3" > "\$4"
725 > EOF
674 > EOF
726 $ chmod +x 'my merge tool'
675 $ chmod +x 'my merge tool'
727 $ hg merge -r 2 --config merge-tools.true.executable='./my merge tool' --config merge-tools.true.args='$base $local $other $output'
676 $ hg merge -r 2 --config merge-tools.true.executable='./my merge tool' --config merge-tools.true.args='$base $local $other $output'
728 merging f
677 merging f
729 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
678 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
730 (branch merge, don't forget to commit)
679 (branch merge, don't forget to commit)
731 $ rm -f 'my merge tool'
680 $ rm -f 'my merge tool'
732 $ aftermerge
681 $ aftermerge
733 # cat f
682 # cat f
734 revision 0
683 revision 0
735 space
684 space
736 revision 1
685 revision 1
737 space
686 space
738 revision 2
687 revision 2
739 space
688 space
740 # hg stat
689 # hg stat
741 M f
690 M f
742
691
743 $ echo
744
745
746 Merge post-processing
692 Merge post-processing
747
693
748 $ echo
749
750
751 cat is a bad merge-tool and doesn't change:
694 cat is a bad merge-tool and doesn't change:
752
695
753 $ domerge -y -r 2 --config merge-tools.true.checkchanged=1
696 $ domerge -y -r 2 --config merge-tools.true.checkchanged=1
754 [merge-tools]
697 [merge-tools]
755 false.whatever=
698 false.whatever=
756 true.priority=1
699 true.priority=1
757 true.executable=cat
700 true.executable=cat
758 # hg update -C 1
701 # hg update -C 1
759 # hg merge -y -r 2 --config merge-tools.true.checkchanged=1
702 # hg merge -y -r 2 --config merge-tools.true.checkchanged=1
760 merging f
703 merging f
761 revision 1
704 revision 1
762 space
705 space
763 revision 0
706 revision 0
764 space
707 space
765 revision 2
708 revision 2
766 space
709 space
767 output file f appears unchanged
710 output file f appears unchanged
768 was merge successful (yn)? n
711 was merge successful (yn)? n
769 merging f failed!
712 merging f failed!
770 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
713 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
771 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
714 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
772 # cat f
715 # cat f
773 revision 1
716 revision 1
774 space
717 space
775 # hg stat
718 # hg stat
776 M f
719 M f
777 ? f.orig
720 ? f.orig
778
@@ -1,172 +1,171 b''
1 $ cat <<EOF > merge
1 $ cat <<EOF > merge
2 > import sys, os
2 > import sys, os
3 >
3 >
4 > try:
4 > try:
5 > import msvcrt
5 > import msvcrt
6 > msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
6 > msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
7 > msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY)
7 > msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY)
8 > except ImportError:
8 > except ImportError:
9 > pass
9 > pass
10 >
10 >
11 > print "merging for", os.path.basename(sys.argv[1])
11 > print "merging for", os.path.basename(sys.argv[1])
12 > EOF
12 > EOF
13 $ HGMERGE="python ../merge"; export HGMERGE
13 $ HGMERGE="python ../merge"; export HGMERGE
14
14
15 $ hg init t
15 $ hg init t
16 $ cd t
16 $ cd t
17 $ echo This is file a1 > a
17 $ echo This is file a1 > a
18 $ hg add a
18 $ hg add a
19 $ hg commit -m "commit #0"
19 $ hg commit -m "commit #0"
20 $ echo This is file b1 > b
20 $ echo This is file b1 > b
21 $ hg add b
21 $ hg add b
22 $ hg commit -m "commit #1"
22 $ hg commit -m "commit #1"
23
23
24 $ hg update 0
24 $ hg update 0
25 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
25 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
26 $ echo This is file c1 > c
26 $ echo This is file c1 > c
27 $ hg add c
27 $ hg add c
28 $ hg commit -m "commit #2"
28 $ hg commit -m "commit #2"
29 created new head
29 created new head
30 $ echo This is file b1 > b
30 $ echo This is file b1 > b
31 no merges expected
31 no merges expected
32 $ hg merge -P 1
32 $ hg merge -P 1
33 changeset: 1:b8bb4a988f25
33 changeset: 1:b8bb4a988f25
34 user: test
34 user: test
35 date: Thu Jan 01 00:00:00 1970 +0000
35 date: Thu Jan 01 00:00:00 1970 +0000
36 summary: commit #1
36 summary: commit #1
37
37
38 $ hg merge 1
38 $ hg merge 1
39 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
39 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
40 (branch merge, don't forget to commit)
40 (branch merge, don't forget to commit)
41 $ hg diff --nodates
41 $ hg diff --nodates
42 diff -r 49035e18a8e6 b
42 diff -r 49035e18a8e6 b
43 --- /dev/null
43 --- /dev/null
44 +++ b/b
44 +++ b/b
45 @@ -0,0 +1,1 @@
45 @@ -0,0 +1,1 @@
46 +This is file b1
46 +This is file b1
47 $ hg status
47 $ hg status
48 M b
48 M b
49 $ cd ..; rm -r t
49 $ cd ..; rm -r t
50
50
51 $ hg init t
51 $ hg init t
52 $ cd t
52 $ cd t
53 $ echo This is file a1 > a
53 $ echo This is file a1 > a
54 $ hg add a
54 $ hg add a
55 $ hg commit -m "commit #0"
55 $ hg commit -m "commit #0"
56 $ echo This is file b1 > b
56 $ echo This is file b1 > b
57 $ hg add b
57 $ hg add b
58 $ hg commit -m "commit #1"
58 $ hg commit -m "commit #1"
59
59
60 $ hg update 0
60 $ hg update 0
61 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
61 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
62 $ echo This is file c1 > c
62 $ echo This is file c1 > c
63 $ hg add c
63 $ hg add c
64 $ hg commit -m "commit #2"
64 $ hg commit -m "commit #2"
65 created new head
65 created new head
66 $ echo This is file b2 > b
66 $ echo This is file b2 > b
67 merge should fail
67 merge should fail
68 $ hg merge 1
68 $ hg merge 1
69 abort: untracked file in working directory differs from file in requested revision: 'b'
69 abort: untracked file in working directory differs from file in requested revision: 'b'
70 [255]
70 [255]
71 merge of b expected
71 merge of b expected
72 $ hg merge -f 1
72 $ hg merge -f 1
73 merging b
73 merging b
74 merging for b
74 merging for b
75 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
75 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
76 (branch merge, don't forget to commit)
76 (branch merge, don't forget to commit)
77 $ hg diff --nodates
77 $ hg diff --nodates
78 diff -r 49035e18a8e6 b
78 diff -r 49035e18a8e6 b
79 --- /dev/null
79 --- /dev/null
80 +++ b/b
80 +++ b/b
81 @@ -0,0 +1,1 @@
81 @@ -0,0 +1,1 @@
82 +This is file b2
82 +This is file b2
83 $ hg status
83 $ hg status
84 M b
84 M b
85 $ cd ..; rm -r t
85 $ cd ..; rm -r t
86
86
87 $ hg init t
87 $ hg init t
88 $ cd t
88 $ cd t
89 $ echo This is file a1 > a
89 $ echo This is file a1 > a
90 $ hg add a
90 $ hg add a
91 $ hg commit -m "commit #0"
91 $ hg commit -m "commit #0"
92 $ echo This is file b1 > b
92 $ echo This is file b1 > b
93 $ hg add b
93 $ hg add b
94 $ hg commit -m "commit #1"
94 $ hg commit -m "commit #1"
95 $ echo This is file b22 > b
95 $ echo This is file b22 > b
96 $ hg commit -m "commit #2"
96 $ hg commit -m "commit #2"
97 $ hg update 1
97 $ hg update 1
98 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
98 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
99 $ echo This is file c1 > c
99 $ echo This is file c1 > c
100 $ hg add c
100 $ hg add c
101 $ hg commit -m "commit #3"
101 $ hg commit -m "commit #3"
102 created new head
102 created new head
103
103
104 Contents of b should be "this is file b1"
104 Contents of b should be "this is file b1"
105 $ cat b
105 $ cat b
106 This is file b1
106 This is file b1
107
107
108 $ echo This is file b22 > b
108 $ echo This is file b22 > b
109 merge fails
109 merge fails
110 $ hg merge 2
110 $ hg merge 2
111 abort: outstanding uncommitted changes (use 'hg status' to list changes)
111 abort: outstanding uncommitted changes (use 'hg status' to list changes)
112 [255]
112 [255]
113 $ echo %% merge expected!
113 merge expected!
114 %% merge expected!
115 $ hg merge -f 2
114 $ hg merge -f 2
116 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
115 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
117 (branch merge, don't forget to commit)
116 (branch merge, don't forget to commit)
118 $ hg diff --nodates
117 $ hg diff --nodates
119 diff -r 85de557015a8 b
118 diff -r 85de557015a8 b
120 --- a/b
119 --- a/b
121 +++ b/b
120 +++ b/b
122 @@ -1,1 +1,1 @@
121 @@ -1,1 +1,1 @@
123 -This is file b1
122 -This is file b1
124 +This is file b22
123 +This is file b22
125 $ hg status
124 $ hg status
126 M b
125 M b
127 $ cd ..; rm -r t
126 $ cd ..; rm -r t
128
127
129 $ hg init t
128 $ hg init t
130 $ cd t
129 $ cd t
131 $ echo This is file a1 > a
130 $ echo This is file a1 > a
132 $ hg add a
131 $ hg add a
133 $ hg commit -m "commit #0"
132 $ hg commit -m "commit #0"
134 $ echo This is file b1 > b
133 $ echo This is file b1 > b
135 $ hg add b
134 $ hg add b
136 $ hg commit -m "commit #1"
135 $ hg commit -m "commit #1"
137 $ echo This is file b22 > b
136 $ echo This is file b22 > b
138 $ hg commit -m "commit #2"
137 $ hg commit -m "commit #2"
139 $ hg update 1
138 $ hg update 1
140 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
139 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
141 $ echo This is file c1 > c
140 $ echo This is file c1 > c
142 $ hg add c
141 $ hg add c
143 $ hg commit -m "commit #3"
142 $ hg commit -m "commit #3"
144 created new head
143 created new head
145 $ echo This is file b33 > b
144 $ echo This is file b33 > b
146 merge of b should fail
145 merge of b should fail
147 $ hg merge 2
146 $ hg merge 2
148 abort: outstanding uncommitted changes (use 'hg status' to list changes)
147 abort: outstanding uncommitted changes (use 'hg status' to list changes)
149 [255]
148 [255]
150 merge of b expected
149 merge of b expected
151 $ hg merge -f 2
150 $ hg merge -f 2
152 merging b
151 merging b
153 merging for b
152 merging for b
154 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
153 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
155 (branch merge, don't forget to commit)
154 (branch merge, don't forget to commit)
156 $ hg diff --nodates
155 $ hg diff --nodates
157 diff -r 85de557015a8 b
156 diff -r 85de557015a8 b
158 --- a/b
157 --- a/b
159 +++ b/b
158 +++ b/b
160 @@ -1,1 +1,1 @@
159 @@ -1,1 +1,1 @@
161 -This is file b1
160 -This is file b1
162 +This is file b33
161 +This is file b33
163 $ hg status
162 $ hg status
164 M b
163 M b
165
164
166 Test for issue2364
165 Test for issue2364
167
166
168 $ hg up -qC .
167 $ hg up -qC .
169 $ hg rm b
168 $ hg rm b
170 $ hg ci -md
169 $ hg ci -md
171 $ hg revert -r -2 b
170 $ hg revert -r -2 b
172 $ hg up -q -- -2
171 $ hg up -q -- -2
@@ -1,40 +1,34 b''
1 Failed qimport of patches from files should cleanup by recording successfully
1 Failed qimport of patches from files should cleanup by recording successfully
2 imported patches in series file.
2 imported patches in series file.
3
3
4 $ echo "[extensions]" >> $HGRCPATH
4 $ echo "[extensions]" >> $HGRCPATH
5 $ echo "mq=" >> $HGRCPATH
5 $ echo "mq=" >> $HGRCPATH
6 $ hg init repo
6 $ hg init repo
7 $ cd repo
7 $ cd repo
8 $ echo a > a
8 $ echo a > a
9 $ hg ci -Am'add a'
9 $ hg ci -Am'add a'
10 adding a
10 adding a
11 $ cat >b.patch<<EOF
11 $ cat >b.patch<<EOF
12 > diff --git a/a b/a
12 > diff --git a/a b/a
13 > --- a/a
13 > --- a/a
14 > +++ b/a
14 > +++ b/a
15 > @@ -1,1 +1,2 @@
15 > @@ -1,1 +1,2 @@
16 > a
16 > a
17 > +b
17 > +b
18 > EOF
18 > EOF
19 $ echo
20
21
19
22 empty series
20 empty series
23
21
24 $ hg qseries
22 $ hg qseries
25 $ echo
26
27
23
28 qimport valid patch followed by invalid patch
24 qimport valid patch followed by invalid patch
29
25
30 $ hg qimport b.patch fakepatch
26 $ hg qimport b.patch fakepatch
31 adding b.patch to series file
27 adding b.patch to series file
32 abort: unable to read file fakepatch
28 abort: unable to read file fakepatch
33 [255]
29 [255]
34 $ echo
35
36
30
37 valid patches before fail added to series
31 valid patches before fail added to series
38
32
39 $ hg qseries
33 $ hg qseries
40 b.patch
34 b.patch
@@ -1,382 +1,380 b''
1 Helper functions:
1 Helper functions:
2
2
3 $ cacheexists() {
3 $ cacheexists() {
4 > [ -f .hg/cache/tags ] && echo "tag cache exists" || echo "no tag cache"
4 > [ -f .hg/cache/tags ] && echo "tag cache exists" || echo "no tag cache"
5 > }
5 > }
6
6
7 $ dumptags() {
7 $ dumptags() {
8 > rev=$1
8 > rev=$1
9 > echo "rev $rev: .hgtags:"
9 > echo "rev $rev: .hgtags:"
10 > hg cat -r$rev .hgtags
10 > hg cat -r$rev .hgtags
11 > }
11 > }
12
12
13 # XXX need to test that the tag cache works when we strip an old head
13 # XXX need to test that the tag cache works when we strip an old head
14 # and add a new one rooted off non-tip: i.e. node and rev of tip are the
14 # and add a new one rooted off non-tip: i.e. node and rev of tip are the
15 # same, but stuff has changed behind tip.
15 # same, but stuff has changed behind tip.
16
16
17 Setup:
17 Setup:
18
18
19 $ hg init t
19 $ hg init t
20 $ cd t
20 $ cd t
21 $ cacheexists
21 $ cacheexists
22 no tag cache
22 no tag cache
23 $ hg id
23 $ hg id
24 000000000000 tip
24 000000000000 tip
25 $ cacheexists
25 $ cacheexists
26 no tag cache
26 no tag cache
27 $ echo a > a
27 $ echo a > a
28 $ hg add a
28 $ hg add a
29 $ hg commit -m "test"
29 $ hg commit -m "test"
30 $ hg co
30 $ hg co
31 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
31 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
32 $ hg identify
32 $ hg identify
33 acb14030fe0a tip
33 acb14030fe0a tip
34 $ cacheexists
34 $ cacheexists
35 tag cache exists
35 tag cache exists
36
36
37 Try corrupting the cache
37 Try corrupting the cache
38
38
39 $ printf 'a b' > .hg/cache/tags
39 $ printf 'a b' > .hg/cache/tags
40 $ hg identify
40 $ hg identify
41 .hg/cache/tags is corrupt, rebuilding it
41 .hg/cache/tags is corrupt, rebuilding it
42 acb14030fe0a tip
42 acb14030fe0a tip
43 $ cacheexists
43 $ cacheexists
44 tag cache exists
44 tag cache exists
45 $ hg identify
45 $ hg identify
46 acb14030fe0a tip
46 acb14030fe0a tip
47
47
48 Create local tag with long name:
48 Create local tag with long name:
49
49
50 $ T=`hg identify --debug --id`
50 $ T=`hg identify --debug --id`
51 $ hg tag -l "This is a local tag with a really long name!"
51 $ hg tag -l "This is a local tag with a really long name!"
52 $ hg tags
52 $ hg tags
53 tip 0:acb14030fe0a
53 tip 0:acb14030fe0a
54 This is a local tag with a really long name! 0:acb14030fe0a
54 This is a local tag with a really long name! 0:acb14030fe0a
55 $ rm .hg/localtags
55 $ rm .hg/localtags
56
56
57 Create a tag behind hg's back:
57 Create a tag behind hg's back:
58
58
59 $ echo "$T first" > .hgtags
59 $ echo "$T first" > .hgtags
60 $ cat .hgtags
60 $ cat .hgtags
61 acb14030fe0a21b60322c440ad2d20cf7685a376 first
61 acb14030fe0a21b60322c440ad2d20cf7685a376 first
62 $ hg add .hgtags
62 $ hg add .hgtags
63 $ hg commit -m "add tags"
63 $ hg commit -m "add tags"
64 $ hg tags
64 $ hg tags
65 tip 1:b9154636be93
65 tip 1:b9154636be93
66 first 0:acb14030fe0a
66 first 0:acb14030fe0a
67 $ hg identify
67 $ hg identify
68 b9154636be93 tip
68 b9154636be93 tip
69
69
70 Repeat with cold tag cache:
70 Repeat with cold tag cache:
71
71
72 $ rm -f .hg/cache/tags
72 $ rm -f .hg/cache/tags
73 $ hg identify
73 $ hg identify
74 b9154636be93 tip
74 b9154636be93 tip
75
75
76 And again, but now unable to write tag cache:
76 And again, but now unable to write tag cache:
77
77
78 $ rm -f .hg/cache/tags
78 $ rm -f .hg/cache/tags
79 $ chmod 555 .hg
79 $ chmod 555 .hg
80 $ hg identify
80 $ hg identify
81 b9154636be93 tip
81 b9154636be93 tip
82 $ chmod 755 .hg
82 $ chmod 755 .hg
83
83
84 Create a branch:
84 Create a branch:
85
85
86 $ echo bb > a
86 $ echo bb > a
87 $ hg status
87 $ hg status
88 M a
88 M a
89 $ hg identify
89 $ hg identify
90 b9154636be93+ tip
90 b9154636be93+ tip
91 $ hg co first
91 $ hg co first
92 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
92 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
93 $ hg id
93 $ hg id
94 acb14030fe0a+ first
94 acb14030fe0a+ first
95 $ hg -v id
95 $ hg -v id
96 acb14030fe0a+ first
96 acb14030fe0a+ first
97 $ hg status
97 $ hg status
98 M a
98 M a
99 $ echo 1 > b
99 $ echo 1 > b
100 $ hg add b
100 $ hg add b
101 $ hg commit -m "branch"
101 $ hg commit -m "branch"
102 created new head
102 created new head
103 $ hg id
103 $ hg id
104 c8edf04160c7 tip
104 c8edf04160c7 tip
105
105
106 Merge the two heads:
106 Merge the two heads:
107
107
108 $ hg merge 1
108 $ hg merge 1
109 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
109 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
110 (branch merge, don't forget to commit)
110 (branch merge, don't forget to commit)
111 $ hg id
111 $ hg id
112 c8edf04160c7+b9154636be93+ tip
112 c8edf04160c7+b9154636be93+ tip
113 $ hg status
113 $ hg status
114 M .hgtags
114 M .hgtags
115 $ hg commit -m "merge"
115 $ hg commit -m "merge"
116
116
117 Create a fake head, make sure tag not visible afterwards:
117 Create a fake head, make sure tag not visible afterwards:
118
118
119 $ cp .hgtags tags
119 $ cp .hgtags tags
120 $ hg tag last
120 $ hg tag last
121 $ hg rm .hgtags
121 $ hg rm .hgtags
122 $ hg commit -m "remove"
122 $ hg commit -m "remove"
123
123
124 $ mv tags .hgtags
124 $ mv tags .hgtags
125 $ hg add .hgtags
125 $ hg add .hgtags
126 $ hg commit -m "readd"
126 $ hg commit -m "readd"
127 $
127 $
128 $ hg tags
128 $ hg tags
129 tip 6:35ff301afafe
129 tip 6:35ff301afafe
130 first 0:acb14030fe0a
130 first 0:acb14030fe0a
131
131
132 Add invalid tags:
132 Add invalid tags:
133
133
134 $ echo "spam" >> .hgtags
134 $ echo "spam" >> .hgtags
135 $ echo >> .hgtags
135 $ echo >> .hgtags
136 $ echo "foo bar" >> .hgtags
136 $ echo "foo bar" >> .hgtags
137 $ echo "a5a5 invalid" >> .hg/localtags
137 $ echo "a5a5 invalid" >> .hg/localtags
138 $ echo "committing .hgtags:"
139 committing .hgtags:
140 $ cat .hgtags
138 $ cat .hgtags
141 acb14030fe0a21b60322c440ad2d20cf7685a376 first
139 acb14030fe0a21b60322c440ad2d20cf7685a376 first
142 spam
140 spam
143
141
144 foo bar
142 foo bar
145 $ hg commit -m "tags"
143 $ hg commit -m "tags"
146
144
147 Report tag parse error on other head:
145 Report tag parse error on other head:
148
146
149 $ hg up 3
147 $ hg up 3
150 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
148 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
151 $ echo 'x y' >> .hgtags
149 $ echo 'x y' >> .hgtags
152 $ hg commit -m "head"
150 $ hg commit -m "head"
153 created new head
151 created new head
154
152
155 $ hg tags
153 $ hg tags
156 .hgtags@75d9f02dfe28, line 2: cannot parse entry
154 .hgtags@75d9f02dfe28, line 2: cannot parse entry
157 .hgtags@75d9f02dfe28, line 4: node 'foo' is not well formed
155 .hgtags@75d9f02dfe28, line 4: node 'foo' is not well formed
158 .hgtags@c4be69a18c11, line 2: node 'x' is not well formed
156 .hgtags@c4be69a18c11, line 2: node 'x' is not well formed
159 tip 8:c4be69a18c11
157 tip 8:c4be69a18c11
160 first 0:acb14030fe0a
158 first 0:acb14030fe0a
161 $ hg tip
159 $ hg tip
162 changeset: 8:c4be69a18c11
160 changeset: 8:c4be69a18c11
163 tag: tip
161 tag: tip
164 parent: 3:ac5e980c4dc0
162 parent: 3:ac5e980c4dc0
165 user: test
163 user: test
166 date: Thu Jan 01 00:00:00 1970 +0000
164 date: Thu Jan 01 00:00:00 1970 +0000
167 summary: head
165 summary: head
168
166
169
167
170 Test tag precedence rules:
168 Test tag precedence rules:
171
169
172 $ cd ..
170 $ cd ..
173 $ hg init t2
171 $ hg init t2
174 $ cd t2
172 $ cd t2
175 $ echo foo > foo
173 $ echo foo > foo
176 $ hg add foo
174 $ hg add foo
177 $ hg ci -m 'add foo' # rev 0
175 $ hg ci -m 'add foo' # rev 0
178 $ hg tag bar # rev 1
176 $ hg tag bar # rev 1
179 $ echo >> foo
177 $ echo >> foo
180 $ hg ci -m 'change foo 1' # rev 2
178 $ hg ci -m 'change foo 1' # rev 2
181 $ hg up -C 1
179 $ hg up -C 1
182 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
180 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
183 $ hg tag -r 1 -f bar # rev 3
181 $ hg tag -r 1 -f bar # rev 3
184 $ hg up -C 1
182 $ hg up -C 1
185 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
183 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
186 $ echo >> foo
184 $ echo >> foo
187 $ hg ci -m 'change foo 2' # rev 4
185 $ hg ci -m 'change foo 2' # rev 4
188 created new head
186 created new head
189 $ hg tags
187 $ hg tags
190 tip 4:0c192d7d5e6b
188 tip 4:0c192d7d5e6b
191 bar 1:78391a272241
189 bar 1:78391a272241
192
190
193 Repeat in case of cache effects:
191 Repeat in case of cache effects:
194
192
195 $ hg tags
193 $ hg tags
196 tip 4:0c192d7d5e6b
194 tip 4:0c192d7d5e6b
197 bar 1:78391a272241
195 bar 1:78391a272241
198
196
199 Detailed dump of tag info:
197 Detailed dump of tag info:
200
198
201 $ hg heads -q # expect 4, 3, 2
199 $ hg heads -q # expect 4, 3, 2
202 4:0c192d7d5e6b
200 4:0c192d7d5e6b
203 3:6fa450212aeb
201 3:6fa450212aeb
204 2:7a94127795a3
202 2:7a94127795a3
205 $ dumptags 2
203 $ dumptags 2
206 rev 2: .hgtags:
204 rev 2: .hgtags:
207 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
205 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
208 $ dumptags 3
206 $ dumptags 3
209 rev 3: .hgtags:
207 rev 3: .hgtags:
210 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
208 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
211 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
209 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
212 78391a272241d70354aa14c874552cad6b51bb42 bar
210 78391a272241d70354aa14c874552cad6b51bb42 bar
213 $ dumptags 4
211 $ dumptags 4
214 rev 4: .hgtags:
212 rev 4: .hgtags:
215 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
213 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
216
214
217 Dump cache:
215 Dump cache:
218
216
219 $ cat .hg/cache/tags
217 $ cat .hg/cache/tags
220 4 0c192d7d5e6b78a714de54a2e9627952a877e25a 0c04f2a8af31de17fab7422878ee5a2dadbc943d
218 4 0c192d7d5e6b78a714de54a2e9627952a877e25a 0c04f2a8af31de17fab7422878ee5a2dadbc943d
221 3 6fa450212aeb2a21ed616a54aea39a4a27894cd7 7d3b718c964ef37b89e550ebdafd5789e76ce1b0
219 3 6fa450212aeb2a21ed616a54aea39a4a27894cd7 7d3b718c964ef37b89e550ebdafd5789e76ce1b0
222 2 7a94127795a33c10a370c93f731fd9fea0b79af6 0c04f2a8af31de17fab7422878ee5a2dadbc943d
220 2 7a94127795a33c10a370c93f731fd9fea0b79af6 0c04f2a8af31de17fab7422878ee5a2dadbc943d
223
221
224 78391a272241d70354aa14c874552cad6b51bb42 bar
222 78391a272241d70354aa14c874552cad6b51bb42 bar
225
223
226 Test tag removal:
224 Test tag removal:
227
225
228 $ hg tag --remove bar # rev 5
226 $ hg tag --remove bar # rev 5
229 $ hg tip -vp
227 $ hg tip -vp
230 changeset: 5:5f6e8655b1c7
228 changeset: 5:5f6e8655b1c7
231 tag: tip
229 tag: tip
232 user: test
230 user: test
233 date: Thu Jan 01 00:00:00 1970 +0000
231 date: Thu Jan 01 00:00:00 1970 +0000
234 files: .hgtags
232 files: .hgtags
235 description:
233 description:
236 Removed tag bar
234 Removed tag bar
237
235
238
236
239 diff -r 0c192d7d5e6b -r 5f6e8655b1c7 .hgtags
237 diff -r 0c192d7d5e6b -r 5f6e8655b1c7 .hgtags
240 --- a/.hgtags Thu Jan 01 00:00:00 1970 +0000
238 --- a/.hgtags Thu Jan 01 00:00:00 1970 +0000
241 +++ b/.hgtags Thu Jan 01 00:00:00 1970 +0000
239 +++ b/.hgtags Thu Jan 01 00:00:00 1970 +0000
242 @@ -1,1 +1,3 @@
240 @@ -1,1 +1,3 @@
243 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
241 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
244 +78391a272241d70354aa14c874552cad6b51bb42 bar
242 +78391a272241d70354aa14c874552cad6b51bb42 bar
245 +0000000000000000000000000000000000000000 bar
243 +0000000000000000000000000000000000000000 bar
246
244
247 $ hg tags
245 $ hg tags
248 tip 5:5f6e8655b1c7
246 tip 5:5f6e8655b1c7
249 $ hg tags # again, try to expose cache bugs
247 $ hg tags # again, try to expose cache bugs
250 tip 5:5f6e8655b1c7
248 tip 5:5f6e8655b1c7
251
249
252 Remove nonexistent tag:
250 Remove nonexistent tag:
253
251
254 $ hg tag --remove foobar
252 $ hg tag --remove foobar
255 abort: tag 'foobar' does not exist
253 abort: tag 'foobar' does not exist
256 [255]
254 [255]
257 $ hg tip
255 $ hg tip
258 changeset: 5:5f6e8655b1c7
256 changeset: 5:5f6e8655b1c7
259 tag: tip
257 tag: tip
260 user: test
258 user: test
261 date: Thu Jan 01 00:00:00 1970 +0000
259 date: Thu Jan 01 00:00:00 1970 +0000
262 summary: Removed tag bar
260 summary: Removed tag bar
263
261
264
262
265 Undo a tag with rollback:
263 Undo a tag with rollback:
266
264
267 $ hg rollback # destroy rev 5 (restore bar)
265 $ hg rollback # destroy rev 5 (restore bar)
268 repository tip rolled back to revision 4 (undo commit)
266 repository tip rolled back to revision 4 (undo commit)
269 working directory now based on revision 4
267 working directory now based on revision 4
270 $ hg tags
268 $ hg tags
271 tip 4:0c192d7d5e6b
269 tip 4:0c192d7d5e6b
272 bar 1:78391a272241
270 bar 1:78391a272241
273 $ hg tags
271 $ hg tags
274 tip 4:0c192d7d5e6b
272 tip 4:0c192d7d5e6b
275 bar 1:78391a272241
273 bar 1:78391a272241
276
274
277 Test tag rank:
275 Test tag rank:
278
276
279 $ cd ..
277 $ cd ..
280 $ hg init t3
278 $ hg init t3
281 $ cd t3
279 $ cd t3
282 $ echo foo > foo
280 $ echo foo > foo
283 $ hg add foo
281 $ hg add foo
284 $ hg ci -m 'add foo' # rev 0
282 $ hg ci -m 'add foo' # rev 0
285 $ hg tag -f bar # rev 1 bar -> 0
283 $ hg tag -f bar # rev 1 bar -> 0
286 $ hg tag -f bar # rev 2 bar -> 1
284 $ hg tag -f bar # rev 2 bar -> 1
287 $ hg tag -fr 0 bar # rev 3 bar -> 0
285 $ hg tag -fr 0 bar # rev 3 bar -> 0
288 $ hg tag -fr 1 bar # rev 4 bar -> 1
286 $ hg tag -fr 1 bar # rev 4 bar -> 1
289 $ hg tag -fr 0 bar # rev 5 bar -> 0
287 $ hg tag -fr 0 bar # rev 5 bar -> 0
290 $ hg tags
288 $ hg tags
291 tip 5:85f05169d91d
289 tip 5:85f05169d91d
292 bar 0:bbd179dfa0a7
290 bar 0:bbd179dfa0a7
293 $ hg co 3
291 $ hg co 3
294 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
292 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
295 $ echo barbar > foo
293 $ echo barbar > foo
296 $ hg ci -m 'change foo' # rev 6
294 $ hg ci -m 'change foo' # rev 6
297 created new head
295 created new head
298 $ hg tags
296 $ hg tags
299 tip 6:735c3ca72986
297 tip 6:735c3ca72986
300 bar 0:bbd179dfa0a7
298 bar 0:bbd179dfa0a7
301
299
302 Don't allow moving tag without -f:
300 Don't allow moving tag without -f:
303
301
304 $ hg tag -r 3 bar
302 $ hg tag -r 3 bar
305 abort: tag 'bar' already exists (use -f to force)
303 abort: tag 'bar' already exists (use -f to force)
306 [255]
304 [255]
307 $ hg tags
305 $ hg tags
308 tip 6:735c3ca72986
306 tip 6:735c3ca72986
309 bar 0:bbd179dfa0a7
307 bar 0:bbd179dfa0a7
310
308
311 Strip 1: expose an old head:
309 Strip 1: expose an old head:
312
310
313 $ hg --config extensions.mq= strip 5
311 $ hg --config extensions.mq= strip 5
314 saved backup bundle to $TESTTMP/t3/.hg/strip-backup/*-backup.hg (glob)
312 saved backup bundle to $TESTTMP/t3/.hg/strip-backup/*-backup.hg (glob)
315 $ hg tags # partly stale cache
313 $ hg tags # partly stale cache
316 tip 5:735c3ca72986
314 tip 5:735c3ca72986
317 bar 1:78391a272241
315 bar 1:78391a272241
318 $ hg tags # up-to-date cache
316 $ hg tags # up-to-date cache
319 tip 5:735c3ca72986
317 tip 5:735c3ca72986
320 bar 1:78391a272241
318 bar 1:78391a272241
321
319
322 Strip 2: destroy whole branch, no old head exposed
320 Strip 2: destroy whole branch, no old head exposed
323
321
324 $ hg --config extensions.mq= strip 4
322 $ hg --config extensions.mq= strip 4
325 saved backup bundle to $TESTTMP/t3/.hg/strip-backup/*-backup.hg (glob)
323 saved backup bundle to $TESTTMP/t3/.hg/strip-backup/*-backup.hg (glob)
326 $ hg tags # partly stale
324 $ hg tags # partly stale
327 tip 4:735c3ca72986
325 tip 4:735c3ca72986
328 bar 0:bbd179dfa0a7
326 bar 0:bbd179dfa0a7
329 $ rm -f .hg/cache/tags
327 $ rm -f .hg/cache/tags
330 $ hg tags # cold cache
328 $ hg tags # cold cache
331 tip 4:735c3ca72986
329 tip 4:735c3ca72986
332 bar 0:bbd179dfa0a7
330 bar 0:bbd179dfa0a7
333
331
334 Test tag rank with 3 heads:
332 Test tag rank with 3 heads:
335
333
336 $ cd ..
334 $ cd ..
337 $ hg init t4
335 $ hg init t4
338 $ cd t4
336 $ cd t4
339 $ echo foo > foo
337 $ echo foo > foo
340 $ hg add
338 $ hg add
341 adding foo
339 adding foo
342 $ hg ci -m 'add foo' # rev 0
340 $ hg ci -m 'add foo' # rev 0
343 $ hg tag bar # rev 1 bar -> 0
341 $ hg tag bar # rev 1 bar -> 0
344 $ hg tag -f bar # rev 2 bar -> 1
342 $ hg tag -f bar # rev 2 bar -> 1
345 $ hg up -qC 0
343 $ hg up -qC 0
346 $ hg tag -fr 2 bar # rev 3 bar -> 2
344 $ hg tag -fr 2 bar # rev 3 bar -> 2
347 $ hg tags
345 $ hg tags
348 tip 3:197c21bbbf2c
346 tip 3:197c21bbbf2c
349 bar 2:6fa450212aeb
347 bar 2:6fa450212aeb
350 $ hg up -qC 0
348 $ hg up -qC 0
351 $ hg tag -m 'retag rev 0' -fr 0 bar # rev 4 bar -> 0, but bar stays at 2
349 $ hg tag -m 'retag rev 0' -fr 0 bar # rev 4 bar -> 0, but bar stays at 2
352
350
353 Bar should still point to rev 2:
351 Bar should still point to rev 2:
354
352
355 $ hg tags
353 $ hg tags
356 tip 4:3b4b14ed0202
354 tip 4:3b4b14ed0202
357 bar 2:6fa450212aeb
355 bar 2:6fa450212aeb
358
356
359 Test that removing global/local tags does not get confused when trying
357 Test that removing global/local tags does not get confused when trying
360 to remove a tag of type X which actually only exists as a type Y:
358 to remove a tag of type X which actually only exists as a type Y:
361
359
362 $ cd ..
360 $ cd ..
363 $ hg init t5
361 $ hg init t5
364 $ cd t5
362 $ cd t5
365 $ echo foo > foo
363 $ echo foo > foo
366 $ hg add
364 $ hg add
367 adding foo
365 adding foo
368 $ hg ci -m 'add foo' # rev 0
366 $ hg ci -m 'add foo' # rev 0
369
367
370 $ hg tag -r 0 -l localtag
368 $ hg tag -r 0 -l localtag
371 $ hg tag --remove localtag
369 $ hg tag --remove localtag
372 abort: tag 'localtag' is not a global tag
370 abort: tag 'localtag' is not a global tag
373 [255]
371 [255]
374 $
372 $
375 $ hg tag -r 0 globaltag
373 $ hg tag -r 0 globaltag
376 $ hg tag --remove -l globaltag
374 $ hg tag --remove -l globaltag
377 abort: tag 'globaltag' is not a local tag
375 abort: tag 'globaltag' is not a local tag
378 [255]
376 [255]
379 $ hg tags -v
377 $ hg tags -v
380 tip 1:a0b6fe111088
378 tip 1:a0b6fe111088
381 localtag 0:bbd179dfa0a7 local
379 localtag 0:bbd179dfa0a7 local
382 globaltag 0:bbd179dfa0a7
380 globaltag 0:bbd179dfa0a7
@@ -1,446 +1,424 b''
1
1
2 $ hg init t
2 $ hg init t
3 $ cd t
3 $ cd t
4 $ cat > unix2dos.py <<EOF
4 $ cat > unix2dos.py <<EOF
5 > import sys
5 > import sys
6 >
6 >
7 > for path in sys.argv[1:]:
7 > for path in sys.argv[1:]:
8 > data = file(path, 'rb').read()
8 > data = file(path, 'rb').read()
9 > data = data.replace('\n', '\r\n')
9 > data = data.replace('\n', '\r\n')
10 > file(path, 'wb').write(data)
10 > file(path, 'wb').write(data)
11 > EOF
11 > EOF
12 $ echo '[hooks]' >> .hg/hgrc
12 $ echo '[hooks]' >> .hg/hgrc
13 $ echo 'pretxncommit.crlf = python:hgext.win32text.forbidcrlf' >> .hg/hgrc
13 $ echo 'pretxncommit.crlf = python:hgext.win32text.forbidcrlf' >> .hg/hgrc
14 $ echo 'pretxnchangegroup.crlf = python:hgext.win32text.forbidcrlf' >> .hg/hgrc
14 $ echo 'pretxnchangegroup.crlf = python:hgext.win32text.forbidcrlf' >> .hg/hgrc
15 $ cat .hg/hgrc
15 $ cat .hg/hgrc
16 [hooks]
16 [hooks]
17 pretxncommit.crlf = python:hgext.win32text.forbidcrlf
17 pretxncommit.crlf = python:hgext.win32text.forbidcrlf
18 pretxnchangegroup.crlf = python:hgext.win32text.forbidcrlf
18 pretxnchangegroup.crlf = python:hgext.win32text.forbidcrlf
19 $ echo
20
19
21 $ echo hello > f
20 $ echo hello > f
22 $ hg add f
21 $ hg add f
23
22
24 commit should succeed
23 commit should succeed
25
24
26 $ hg ci -m 1
25 $ hg ci -m 1
27 $ echo
28
26
29 $ hg clone . ../zoz
27 $ hg clone . ../zoz
30 updating to branch default
28 updating to branch default
31 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
29 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
32 $ cp .hg/hgrc ../zoz/.hg
30 $ cp .hg/hgrc ../zoz/.hg
33 $ python unix2dos.py f
31 $ python unix2dos.py f
34
32
35 commit should fail
33 commit should fail
36
34
37 $ hg ci -m 2.1
35 $ hg ci -m 2.1
38 Attempt to commit or push text file(s) using CRLF line endings
36 Attempt to commit or push text file(s) using CRLF line endings
39 in f583ea08d42a: f
37 in f583ea08d42a: f
40 transaction abort!
38 transaction abort!
41 rollback completed
39 rollback completed
42 abort: pretxncommit.crlf hook failed
40 abort: pretxncommit.crlf hook failed
43 [255]
41 [255]
44 $ echo
45
42
46 $ mv .hg/hgrc .hg/hgrc.bak
43 $ mv .hg/hgrc .hg/hgrc.bak
47
44
48 commits should succeed
45 commits should succeed
49
46
50 $ hg ci -m 2
47 $ hg ci -m 2
51 $ hg cp f g
48 $ hg cp f g
52 $ hg ci -m 2.2
49 $ hg ci -m 2.2
53 $ echo
54
55
50
56 push should fail
51 push should fail
57
52
58 $ hg push ../zoz
53 $ hg push ../zoz
59 pushing to ../zoz
54 pushing to ../zoz
60 searching for changes
55 searching for changes
61 adding changesets
56 adding changesets
62 adding manifests
57 adding manifests
63 adding file changes
58 adding file changes
64 added 2 changesets with 2 changes to 2 files
59 added 2 changesets with 2 changes to 2 files
65 Attempt to commit or push text file(s) using CRLF line endings
60 Attempt to commit or push text file(s) using CRLF line endings
66 in bc2d09796734: g
61 in bc2d09796734: g
67 in b1aa5cde7ff4: f
62 in b1aa5cde7ff4: f
68
63
69 To prevent this mistake in your local repository,
64 To prevent this mistake in your local repository,
70 add to Mercurial.ini or .hg/hgrc:
65 add to Mercurial.ini or .hg/hgrc:
71
66
72 [hooks]
67 [hooks]
73 pretxncommit.crlf = python:hgext.win32text.forbidcrlf
68 pretxncommit.crlf = python:hgext.win32text.forbidcrlf
74
69
75 and also consider adding:
70 and also consider adding:
76
71
77 [extensions]
72 [extensions]
78 win32text =
73 win32text =
79 [encode]
74 [encode]
80 ** = cleverencode:
75 ** = cleverencode:
81 [decode]
76 [decode]
82 ** = cleverdecode:
77 ** = cleverdecode:
83 transaction abort!
78 transaction abort!
84 rollback completed
79 rollback completed
85 abort: pretxnchangegroup.crlf hook failed
80 abort: pretxnchangegroup.crlf hook failed
86 [255]
81 [255]
87 $ echo
88
82
89 $ mv .hg/hgrc.bak .hg/hgrc
83 $ mv .hg/hgrc.bak .hg/hgrc
90 $ echo hello > f
84 $ echo hello > f
91 $ hg rm g
85 $ hg rm g
92
86
93 commit should succeed
87 commit should succeed
94
88
95 $ hg ci -m 2.3
89 $ hg ci -m 2.3
96 $ echo
97
98
90
99 push should succeed
91 push should succeed
100
92
101 $ hg push ../zoz
93 $ hg push ../zoz
102 pushing to ../zoz
94 pushing to ../zoz
103 searching for changes
95 searching for changes
104 adding changesets
96 adding changesets
105 adding manifests
97 adding manifests
106 adding file changes
98 adding file changes
107 added 3 changesets with 3 changes to 2 files
99 added 3 changesets with 3 changes to 2 files
108 $ echo
109
110
100
111 and now for something completely different
101 and now for something completely different
112
102
113 $ mkdir d
103 $ mkdir d
114 $ echo hello > d/f2
104 $ echo hello > d/f2
115 $ python unix2dos.py d/f2
105 $ python unix2dos.py d/f2
116 $ hg add d/f2
106 $ hg add d/f2
117 $ hg ci -m 3
107 $ hg ci -m 3
118 Attempt to commit or push text file(s) using CRLF line endings
108 Attempt to commit or push text file(s) using CRLF line endings
119 in 053ba1a3035a: d/f2
109 in 053ba1a3035a: d/f2
120 transaction abort!
110 transaction abort!
121 rollback completed
111 rollback completed
122 abort: pretxncommit.crlf hook failed
112 abort: pretxncommit.crlf hook failed
123 [255]
113 [255]
124 $ hg revert -a
114 $ hg revert -a
125 forgetting d/f2
115 forgetting d/f2
126 $ rm d/f2
116 $ rm d/f2
127 $ echo
128
117
129 $ hg rem f
118 $ hg rem f
130 $ hg ci -m 4
119 $ hg ci -m 4
131 $ echo
132
120
133 $ python -c 'file("bin", "wb").write("hello\x00\x0D\x0A")'
121 $ python -c 'file("bin", "wb").write("hello\x00\x0D\x0A")'
134 $ hg add bin
122 $ hg add bin
135 $ hg ci -m 5
123 $ hg ci -m 5
136 $ hg log -v
124 $ hg log -v
137 changeset: 5:f0b1c8d75fce
125 changeset: 5:f0b1c8d75fce
138 tag: tip
126 tag: tip
139 user: test
127 user: test
140 date: Thu Jan 01 00:00:00 1970 +0000
128 date: Thu Jan 01 00:00:00 1970 +0000
141 files: bin
129 files: bin
142 description:
130 description:
143 5
131 5
144
132
145
133
146 changeset: 4:77796dbcd4ad
134 changeset: 4:77796dbcd4ad
147 user: test
135 user: test
148 date: Thu Jan 01 00:00:00 1970 +0000
136 date: Thu Jan 01 00:00:00 1970 +0000
149 files: f
137 files: f
150 description:
138 description:
151 4
139 4
152
140
153
141
154 changeset: 3:7c1b5430b350
142 changeset: 3:7c1b5430b350
155 user: test
143 user: test
156 date: Thu Jan 01 00:00:00 1970 +0000
144 date: Thu Jan 01 00:00:00 1970 +0000
157 files: f g
145 files: f g
158 description:
146 description:
159 2.3
147 2.3
160
148
161
149
162 changeset: 2:bc2d09796734
150 changeset: 2:bc2d09796734
163 user: test
151 user: test
164 date: Thu Jan 01 00:00:00 1970 +0000
152 date: Thu Jan 01 00:00:00 1970 +0000
165 files: g
153 files: g
166 description:
154 description:
167 2.2
155 2.2
168
156
169
157
170 changeset: 1:b1aa5cde7ff4
158 changeset: 1:b1aa5cde7ff4
171 user: test
159 user: test
172 date: Thu Jan 01 00:00:00 1970 +0000
160 date: Thu Jan 01 00:00:00 1970 +0000
173 files: f
161 files: f
174 description:
162 description:
175 2
163 2
176
164
177
165
178 changeset: 0:fcf06d5c4e1d
166 changeset: 0:fcf06d5c4e1d
179 user: test
167 user: test
180 date: Thu Jan 01 00:00:00 1970 +0000
168 date: Thu Jan 01 00:00:00 1970 +0000
181 files: f
169 files: f
182 description:
170 description:
183 1
171 1
184
172
185
173
186 $ echo
187
188 $ hg clone . dupe
174 $ hg clone . dupe
189 updating to branch default
175 updating to branch default
190 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
176 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
191 $ echo
192
177
193 $ for x in a b c d; do echo content > dupe/$x; done
178 $ for x in a b c d; do echo content > dupe/$x; done
194 $ hg -R dupe add
179 $ hg -R dupe add
195 adding dupe/a
180 adding dupe/a
196 adding dupe/b
181 adding dupe/b
197 adding dupe/c
182 adding dupe/c
198 adding dupe/d
183 adding dupe/d
199 $ python unix2dos.py dupe/b dupe/c dupe/d
184 $ python unix2dos.py dupe/b dupe/c dupe/d
200 $ hg -R dupe ci -m a dupe/a
185 $ hg -R dupe ci -m a dupe/a
201 $ hg -R dupe ci -m b/c dupe/[bc]
186 $ hg -R dupe ci -m b/c dupe/[bc]
202 $ hg -R dupe ci -m d dupe/d
187 $ hg -R dupe ci -m d dupe/d
203 $ hg -R dupe log -v
188 $ hg -R dupe log -v
204 changeset: 8:67ac5962ab43
189 changeset: 8:67ac5962ab43
205 tag: tip
190 tag: tip
206 user: test
191 user: test
207 date: Thu Jan 01 00:00:00 1970 +0000
192 date: Thu Jan 01 00:00:00 1970 +0000
208 files: d
193 files: d
209 description:
194 description:
210 d
195 d
211
196
212
197
213 changeset: 7:68c127d1834e
198 changeset: 7:68c127d1834e
214 user: test
199 user: test
215 date: Thu Jan 01 00:00:00 1970 +0000
200 date: Thu Jan 01 00:00:00 1970 +0000
216 files: b c
201 files: b c
217 description:
202 description:
218 b/c
203 b/c
219
204
220
205
221 changeset: 6:adbf8bf7f31d
206 changeset: 6:adbf8bf7f31d
222 user: test
207 user: test
223 date: Thu Jan 01 00:00:00 1970 +0000
208 date: Thu Jan 01 00:00:00 1970 +0000
224 files: a
209 files: a
225 description:
210 description:
226 a
211 a
227
212
228
213
229 changeset: 5:f0b1c8d75fce
214 changeset: 5:f0b1c8d75fce
230 user: test
215 user: test
231 date: Thu Jan 01 00:00:00 1970 +0000
216 date: Thu Jan 01 00:00:00 1970 +0000
232 files: bin
217 files: bin
233 description:
218 description:
234 5
219 5
235
220
236
221
237 changeset: 4:77796dbcd4ad
222 changeset: 4:77796dbcd4ad
238 user: test
223 user: test
239 date: Thu Jan 01 00:00:00 1970 +0000
224 date: Thu Jan 01 00:00:00 1970 +0000
240 files: f
225 files: f
241 description:
226 description:
242 4
227 4
243
228
244
229
245 changeset: 3:7c1b5430b350
230 changeset: 3:7c1b5430b350
246 user: test
231 user: test
247 date: Thu Jan 01 00:00:00 1970 +0000
232 date: Thu Jan 01 00:00:00 1970 +0000
248 files: f g
233 files: f g
249 description:
234 description:
250 2.3
235 2.3
251
236
252
237
253 changeset: 2:bc2d09796734
238 changeset: 2:bc2d09796734
254 user: test
239 user: test
255 date: Thu Jan 01 00:00:00 1970 +0000
240 date: Thu Jan 01 00:00:00 1970 +0000
256 files: g
241 files: g
257 description:
242 description:
258 2.2
243 2.2
259
244
260
245
261 changeset: 1:b1aa5cde7ff4
246 changeset: 1:b1aa5cde7ff4
262 user: test
247 user: test
263 date: Thu Jan 01 00:00:00 1970 +0000
248 date: Thu Jan 01 00:00:00 1970 +0000
264 files: f
249 files: f
265 description:
250 description:
266 2
251 2
267
252
268
253
269 changeset: 0:fcf06d5c4e1d
254 changeset: 0:fcf06d5c4e1d
270 user: test
255 user: test
271 date: Thu Jan 01 00:00:00 1970 +0000
256 date: Thu Jan 01 00:00:00 1970 +0000
272 files: f
257 files: f
273 description:
258 description:
274 1
259 1
275
260
276
261
277 $ echo
278
279 $ hg pull dupe
262 $ hg pull dupe
280 pulling from dupe
263 pulling from dupe
281 searching for changes
264 searching for changes
282 adding changesets
265 adding changesets
283 adding manifests
266 adding manifests
284 adding file changes
267 adding file changes
285 added 3 changesets with 4 changes to 4 files
268 added 3 changesets with 4 changes to 4 files
286 Attempt to commit or push text file(s) using CRLF line endings
269 Attempt to commit or push text file(s) using CRLF line endings
287 in 67ac5962ab43: d
270 in 67ac5962ab43: d
288 in 68c127d1834e: b
271 in 68c127d1834e: b
289 in 68c127d1834e: c
272 in 68c127d1834e: c
290
273
291 To prevent this mistake in your local repository,
274 To prevent this mistake in your local repository,
292 add to Mercurial.ini or .hg/hgrc:
275 add to Mercurial.ini or .hg/hgrc:
293
276
294 [hooks]
277 [hooks]
295 pretxncommit.crlf = python:hgext.win32text.forbidcrlf
278 pretxncommit.crlf = python:hgext.win32text.forbidcrlf
296
279
297 and also consider adding:
280 and also consider adding:
298
281
299 [extensions]
282 [extensions]
300 win32text =
283 win32text =
301 [encode]
284 [encode]
302 ** = cleverencode:
285 ** = cleverencode:
303 [decode]
286 [decode]
304 ** = cleverdecode:
287 ** = cleverdecode:
305 transaction abort!
288 transaction abort!
306 rollback completed
289 rollback completed
307 abort: pretxnchangegroup.crlf hook failed
290 abort: pretxnchangegroup.crlf hook failed
308 [255]
291 [255]
309 $ echo
310
292
311 $ hg log -v
293 $ hg log -v
312 changeset: 5:f0b1c8d75fce
294 changeset: 5:f0b1c8d75fce
313 tag: tip
295 tag: tip
314 user: test
296 user: test
315 date: Thu Jan 01 00:00:00 1970 +0000
297 date: Thu Jan 01 00:00:00 1970 +0000
316 files: bin
298 files: bin
317 description:
299 description:
318 5
300 5
319
301
320
302
321 changeset: 4:77796dbcd4ad
303 changeset: 4:77796dbcd4ad
322 user: test
304 user: test
323 date: Thu Jan 01 00:00:00 1970 +0000
305 date: Thu Jan 01 00:00:00 1970 +0000
324 files: f
306 files: f
325 description:
307 description:
326 4
308 4
327
309
328
310
329 changeset: 3:7c1b5430b350
311 changeset: 3:7c1b5430b350
330 user: test
312 user: test
331 date: Thu Jan 01 00:00:00 1970 +0000
313 date: Thu Jan 01 00:00:00 1970 +0000
332 files: f g
314 files: f g
333 description:
315 description:
334 2.3
316 2.3
335
317
336
318
337 changeset: 2:bc2d09796734
319 changeset: 2:bc2d09796734
338 user: test
320 user: test
339 date: Thu Jan 01 00:00:00 1970 +0000
321 date: Thu Jan 01 00:00:00 1970 +0000
340 files: g
322 files: g
341 description:
323 description:
342 2.2
324 2.2
343
325
344
326
345 changeset: 1:b1aa5cde7ff4
327 changeset: 1:b1aa5cde7ff4
346 user: test
328 user: test
347 date: Thu Jan 01 00:00:00 1970 +0000
329 date: Thu Jan 01 00:00:00 1970 +0000
348 files: f
330 files: f
349 description:
331 description:
350 2
332 2
351
333
352
334
353 changeset: 0:fcf06d5c4e1d
335 changeset: 0:fcf06d5c4e1d
354 user: test
336 user: test
355 date: Thu Jan 01 00:00:00 1970 +0000
337 date: Thu Jan 01 00:00:00 1970 +0000
356 files: f
338 files: f
357 description:
339 description:
358 1
340 1
359
341
360
342
361 $ echo
362
363 $ rm .hg/hgrc
343 $ rm .hg/hgrc
364 $ (echo some; echo text) > f3
344 $ (echo some; echo text) > f3
365 $ python -c 'file("f4.bat", "wb").write("rem empty\x0D\x0A")'
345 $ python -c 'file("f4.bat", "wb").write("rem empty\x0D\x0A")'
366 $ hg add f3 f4.bat
346 $ hg add f3 f4.bat
367 $ hg ci -m 6
347 $ hg ci -m 6
368 $ cat bin
348 $ cat bin
369 hello\x00\r (esc)
349 hello\x00\r (esc)
370 $ cat f3
350 $ cat f3
371 some
351 some
372 text
352 text
373 $ cat f4.bat
353 $ cat f4.bat
374 rem empty\r (esc)
354 rem empty\r (esc)
375 $ echo
376
355
377 $ echo '[extensions]' >> .hg/hgrc
356 $ echo '[extensions]' >> .hg/hgrc
378 $ echo 'win32text = ' >> .hg/hgrc
357 $ echo 'win32text = ' >> .hg/hgrc
379 $ echo '[decode]' >> .hg/hgrc
358 $ echo '[decode]' >> .hg/hgrc
380 $ echo '** = cleverdecode:' >> .hg/hgrc
359 $ echo '** = cleverdecode:' >> .hg/hgrc
381 $ echo '[encode]' >> .hg/hgrc
360 $ echo '[encode]' >> .hg/hgrc
382 $ echo '** = cleverencode:' >> .hg/hgrc
361 $ echo '** = cleverencode:' >> .hg/hgrc
383 $ cat .hg/hgrc
362 $ cat .hg/hgrc
384 [extensions]
363 [extensions]
385 win32text =
364 win32text =
386 [decode]
365 [decode]
387 ** = cleverdecode:
366 ** = cleverdecode:
388 [encode]
367 [encode]
389 ** = cleverencode:
368 ** = cleverencode:
390
369
391 Trigger deprecation warning:
370 Trigger deprecation warning:
392
371
393 $ hg id -t
372 $ hg id -t
394 win32text is deprecated: http://mercurial.selenic.com/wiki/Win32TextExtension
373 win32text is deprecated: http://mercurial.selenic.com/wiki/Win32TextExtension
395 tip
374 tip
396
375
397 Disable warning:
376 Disable warning:
398
377
399 $ echo '[win32text]' >> .hg/hgrc
378 $ echo '[win32text]' >> .hg/hgrc
400 $ echo 'warn = no' >> .hg/hgrc
379 $ echo 'warn = no' >> .hg/hgrc
401 $ hg id -t
380 $ hg id -t
402 tip
381 tip
403
382
404 $ rm f3 f4.bat bin
383 $ rm f3 f4.bat bin
405 $ hg co -C
384 $ hg co -C
406 WARNING: f4.bat already has CRLF line endings
385 WARNING: f4.bat already has CRLF line endings
407 and does not need EOL conversion by the win32text plugin.
386 and does not need EOL conversion by the win32text plugin.
408 Before your next commit, please reconsider your encode/decode settings in
387 Before your next commit, please reconsider your encode/decode settings in
409 Mercurial.ini or $TESTTMP/t/.hg/hgrc.
388 Mercurial.ini or $TESTTMP/t/.hg/hgrc.
410 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
389 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
411 $ cat bin
390 $ cat bin
412 hello\x00\r (esc)
391 hello\x00\r (esc)
413 $ cat f3
392 $ cat f3
414 some\r (esc)
393 some\r (esc)
415 text\r (esc)
394 text\r (esc)
416 $ cat f4.bat
395 $ cat f4.bat
417 rem empty\r (esc)
396 rem empty\r (esc)
418 $ echo
419
397
420 $ python -c 'file("f5.sh", "wb").write("# empty\x0D\x0A")'
398 $ python -c 'file("f5.sh", "wb").write("# empty\x0D\x0A")'
421 $ hg add f5.sh
399 $ hg add f5.sh
422 $ hg ci -m 7
400 $ hg ci -m 7
423 $ cat f5.sh
401 $ cat f5.sh
424 # empty\r (esc)
402 # empty\r (esc)
425 $ hg cat f5.sh
403 $ hg cat f5.sh
426 # empty
404 # empty
427 $ echo '% just linefeed' > linefeed
405 $ echo '% just linefeed' > linefeed
428 $ hg ci -qAm 8 linefeed
406 $ hg ci -qAm 8 linefeed
429 $ cat linefeed
407 $ cat linefeed
430 % just linefeed
408 % just linefeed
431 $ hg cat linefeed
409 $ hg cat linefeed
432 % just linefeed
410 % just linefeed
433 $ hg st -q
411 $ hg st -q
434 $ hg revert -a linefeed
412 $ hg revert -a linefeed
435 no changes needed to linefeed
413 no changes needed to linefeed
436 $ cat linefeed
414 $ cat linefeed
437 % just linefeed
415 % just linefeed
438 $ hg st -q
416 $ hg st -q
439 $ echo modified >> linefeed
417 $ echo modified >> linefeed
440 $ hg st -q
418 $ hg st -q
441 M linefeed
419 M linefeed
442 $ hg revert -a
420 $ hg revert -a
443 reverting linefeed
421 reverting linefeed
444 $ hg st -q
422 $ hg st -q
445 $ cat linefeed
423 $ cat linefeed
446 % just linefeed\r (esc)
424 % just linefeed\r (esc)
General Comments 0
You need to be logged in to leave comments. Login now