##// END OF EJS Templates
test-contrib: add a test for shrink-revlog...
Augie Fackler -
r14033:33e04d3d default
parent child Browse files
Show More
@@ -1,279 +1,302 b''
1 Set vars:
1 Set vars:
2
2
3 $ CONTRIBDIR=$TESTDIR/../contrib
3 $ CONTRIBDIR=$TESTDIR/../contrib
4
4
5 Prepare repo-a:
5 Prepare repo-a:
6
6
7 $ hg init repo-a
7 $ hg init repo-a
8 $ cd repo-a
8 $ cd repo-a
9
9
10 $ echo this is file a > a
10 $ echo this is file a > a
11 $ hg add a
11 $ hg add a
12 $ hg commit -m first
12 $ hg commit -m first
13
13
14 $ echo adding to file a >> a
14 $ echo adding to file a >> a
15 $ hg commit -m second
15 $ hg commit -m second
16
16
17 $ echo adding more to file a >> a
17 $ echo adding more to file a >> a
18 $ hg commit -m third
18 $ hg commit -m third
19
19
20 $ hg verify
20 $ hg verify
21 checking changesets
21 checking changesets
22 checking manifests
22 checking manifests
23 crosschecking files in changesets and manifests
23 crosschecking files in changesets and manifests
24 checking files
24 checking files
25 1 files, 3 changesets, 3 total revisions
25 1 files, 3 changesets, 3 total revisions
26
26
27 Dumping revlog of file a to stdout:
27 Dumping revlog of file a to stdout:
28
28
29 $ python $CONTRIBDIR/dumprevlog .hg/store/data/a.i
29 $ python $CONTRIBDIR/dumprevlog .hg/store/data/a.i
30 file: .hg/store/data/a.i
30 file: .hg/store/data/a.i
31 node: 183d2312b35066fb6b3b449b84efc370d50993d0
31 node: 183d2312b35066fb6b3b449b84efc370d50993d0
32 linkrev: 0
32 linkrev: 0
33 parents: 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000
33 parents: 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000
34 length: 15
34 length: 15
35 -start-
35 -start-
36 this is file a
36 this is file a
37
37
38 -end-
38 -end-
39 node: b1047953b6e6b633c0d8197eaa5116fbdfd3095b
39 node: b1047953b6e6b633c0d8197eaa5116fbdfd3095b
40 linkrev: 1
40 linkrev: 1
41 parents: 183d2312b35066fb6b3b449b84efc370d50993d0 0000000000000000000000000000000000000000
41 parents: 183d2312b35066fb6b3b449b84efc370d50993d0 0000000000000000000000000000000000000000
42 length: 32
42 length: 32
43 -start-
43 -start-
44 this is file a
44 this is file a
45 adding to file a
45 adding to file a
46
46
47 -end-
47 -end-
48 node: 8c4fd1f7129b8cdec6c7f58bf48fb5237a4030c1
48 node: 8c4fd1f7129b8cdec6c7f58bf48fb5237a4030c1
49 linkrev: 2
49 linkrev: 2
50 parents: b1047953b6e6b633c0d8197eaa5116fbdfd3095b 0000000000000000000000000000000000000000
50 parents: b1047953b6e6b633c0d8197eaa5116fbdfd3095b 0000000000000000000000000000000000000000
51 length: 54
51 length: 54
52 -start-
52 -start-
53 this is file a
53 this is file a
54 adding to file a
54 adding to file a
55 adding more to file a
55 adding more to file a
56
56
57 -end-
57 -end-
58
58
59 Dump all revlogs to file repo.dump:
59 Dump all revlogs to file repo.dump:
60
60
61 $ find .hg/store -name "*.i" | sort | xargs python $CONTRIBDIR/dumprevlog > ../repo.dump
61 $ find .hg/store -name "*.i" | sort | xargs python $CONTRIBDIR/dumprevlog > ../repo.dump
62 $ cd ..
62 $ cd ..
63
63
64 Undumping into repo-b:
64 Undumping into repo-b:
65
65
66 $ hg init repo-b
66 $ hg init repo-b
67 $ cd repo-b
67 $ cd repo-b
68 $ python $CONTRIBDIR/undumprevlog < ../repo.dump
68 $ python $CONTRIBDIR/undumprevlog < ../repo.dump
69 .hg/store/00changelog.i
69 .hg/store/00changelog.i
70 .hg/store/00manifest.i
70 .hg/store/00manifest.i
71 .hg/store/data/a.i
71 .hg/store/data/a.i
72 $ cd ..
72 $ cd ..
73
73
74 Rebuild fncache with clone --pull:
74 Rebuild fncache with clone --pull:
75
75
76 $ hg clone --pull -U repo-b repo-c
76 $ hg clone --pull -U repo-b repo-c
77 requesting all changes
77 requesting all changes
78 adding changesets
78 adding changesets
79 adding manifests
79 adding manifests
80 adding file changes
80 adding file changes
81 added 3 changesets with 3 changes to 1 files
81 added 3 changesets with 3 changes to 1 files
82
82
83 Verify:
83 Verify:
84
84
85 $ hg -R repo-c verify
85 $ hg -R repo-c verify
86 checking changesets
86 checking changesets
87 checking manifests
87 checking manifests
88 crosschecking files in changesets and manifests
88 crosschecking files in changesets and manifests
89 checking files
89 checking files
90 1 files, 3 changesets, 3 total revisions
90 1 files, 3 changesets, 3 total revisions
91
91
92 Compare repos:
92 Compare repos:
93
93
94 $ hg -R repo-c incoming repo-a
94 $ hg -R repo-c incoming repo-a
95 comparing with repo-a
95 comparing with repo-a
96 searching for changes
96 searching for changes
97 no changes found
97 no changes found
98 [1]
98 [1]
99
99
100 $ hg -R repo-a incoming repo-c
100 $ hg -R repo-a incoming repo-c
101 comparing with repo-c
101 comparing with repo-c
102 searching for changes
102 searching for changes
103 no changes found
103 no changes found
104 [1]
104 [1]
105
105
106
106
107 Test shrink-revlog:
108 $ cd repo-a
109 $ hg --config extensions.shrink=$CONTRIBDIR/shrink-revlog.py shrink
110 shrinking $TESTTMP/repo-a/.hg/store/00manifest.i
111 reading revs
112 sorting revs
113 writing revs
114 old file size: 324 bytes ( 0.0 MiB)
115 new file size: 324 bytes ( 0.0 MiB)
116 shrinkage: 0.0% (1.0x)
117 note: old revlog saved in:
118 $TESTTMP/repo-a/.hg/store/00manifest.i.old
119 $TESTTMP/repo-a/.hg/store/00manifest.d.old
120 (You can delete those files when you are satisfied that your
121 repository is still sane. Running 'hg verify' is strongly recommended.)
122 $ hg verify
123 checking changesets
124 checking manifests
125 crosschecking files in changesets and manifests
126 checking files
127 1 files, 3 changesets, 3 total revisions
128 $ cd ..
129
107 Test simplemerge command:
130 Test simplemerge command:
108
131
109 $ cp "$CONTRIBDIR/simplemerge" .
132 $ cp "$CONTRIBDIR/simplemerge" .
110 $ echo base > base
133 $ echo base > base
111 $ echo local > local
134 $ echo local > local
112 $ cat base >> local
135 $ cat base >> local
113 $ cp local orig
136 $ cp local orig
114 $ cat base > other
137 $ cat base > other
115 $ echo other >> other
138 $ echo other >> other
116
139
117 changing local directly
140 changing local directly
118
141
119 $ python simplemerge local base other && echo "merge succeeded"
142 $ python simplemerge local base other && echo "merge succeeded"
120 merge succeeded
143 merge succeeded
121 $ cat local
144 $ cat local
122 local
145 local
123 base
146 base
124 other
147 other
125 $ cp orig local
148 $ cp orig local
126
149
127 printing to stdout
150 printing to stdout
128
151
129 $ python simplemerge -p local base other
152 $ python simplemerge -p local base other
130 local
153 local
131 base
154 base
132 other
155 other
133
156
134 local:
157 local:
135
158
136 $ cat local
159 $ cat local
137 local
160 local
138 base
161 base
139
162
140 conflicts
163 conflicts
141
164
142 $ cp base conflict-local
165 $ cp base conflict-local
143 $ cp other conflict-other
166 $ cp other conflict-other
144 $ echo not other >> conflict-local
167 $ echo not other >> conflict-local
145 $ echo end >> conflict-local
168 $ echo end >> conflict-local
146 $ echo end >> conflict-other
169 $ echo end >> conflict-other
147 $ python simplemerge -p conflict-local base conflict-other
170 $ python simplemerge -p conflict-local base conflict-other
148 base
171 base
149 <<<<<<< conflict-local
172 <<<<<<< conflict-local
150 not other
173 not other
151 =======
174 =======
152 other
175 other
153 >>>>>>> conflict-other
176 >>>>>>> conflict-other
154 end
177 end
155 warning: conflicts during merge.
178 warning: conflicts during merge.
156 [1]
179 [1]
157
180
158 --no-minimal
181 --no-minimal
159
182
160 $ python simplemerge -p --no-minimal conflict-local base conflict-other
183 $ python simplemerge -p --no-minimal conflict-local base conflict-other
161 base
184 base
162 <<<<<<< conflict-local
185 <<<<<<< conflict-local
163 not other
186 not other
164 end
187 end
165 =======
188 =======
166 other
189 other
167 end
190 end
168 >>>>>>> conflict-other
191 >>>>>>> conflict-other
169 warning: conflicts during merge.
192 warning: conflicts during merge.
170 [1]
193 [1]
171
194
172 1 label
195 1 label
173
196
174 $ python simplemerge -p -L foo conflict-local base conflict-other
197 $ python simplemerge -p -L foo conflict-local base conflict-other
175 base
198 base
176 <<<<<<< foo
199 <<<<<<< foo
177 not other
200 not other
178 =======
201 =======
179 other
202 other
180 >>>>>>> conflict-other
203 >>>>>>> conflict-other
181 end
204 end
182 warning: conflicts during merge.
205 warning: conflicts during merge.
183 [1]
206 [1]
184
207
185 2 labels
208 2 labels
186
209
187 $ python simplemerge -p -L foo -L bar conflict-local base conflict-other
210 $ python simplemerge -p -L foo -L bar conflict-local base conflict-other
188 base
211 base
189 <<<<<<< foo
212 <<<<<<< foo
190 not other
213 not other
191 =======
214 =======
192 other
215 other
193 >>>>>>> bar
216 >>>>>>> bar
194 end
217 end
195 warning: conflicts during merge.
218 warning: conflicts during merge.
196 [1]
219 [1]
197
220
198 too many labels
221 too many labels
199
222
200 $ python simplemerge -p -L foo -L bar -L baz conflict-local base conflict-other
223 $ python simplemerge -p -L foo -L bar -L baz conflict-local base conflict-other
201 abort: can only specify two labels.
224 abort: can only specify two labels.
202 [255]
225 [255]
203
226
204 binary file
227 binary file
205
228
206 $ python -c "f = file('binary-local', 'w'); f.write('\x00'); f.close()"
229 $ python -c "f = file('binary-local', 'w'); f.write('\x00'); f.close()"
207 $ cat orig >> binary-local
230 $ cat orig >> binary-local
208 $ python simplemerge -p binary-local base other
231 $ python simplemerge -p binary-local base other
209 abort: binary-local looks like a binary file.
232 abort: binary-local looks like a binary file.
210 [255]
233 [255]
211
234
212 binary file --text
235 binary file --text
213
236
214 $ python simplemerge -a -p binary-local base other 2>&1
237 $ python simplemerge -a -p binary-local base other 2>&1
215 warning: binary-local looks like a binary file.
238 warning: binary-local looks like a binary file.
216 \x00local (esc)
239 \x00local (esc)
217 base
240 base
218 other
241 other
219
242
220 help
243 help
221
244
222 $ python simplemerge --help
245 $ python simplemerge --help
223 simplemerge [OPTS] LOCAL BASE OTHER
246 simplemerge [OPTS] LOCAL BASE OTHER
224
247
225 Simple three-way file merge utility with a minimal feature set.
248 Simple three-way file merge utility with a minimal feature set.
226
249
227 Apply to LOCAL the changes necessary to go from BASE to OTHER.
250 Apply to LOCAL the changes necessary to go from BASE to OTHER.
228
251
229 By default, LOCAL is overwritten with the results of this operation.
252 By default, LOCAL is overwritten with the results of this operation.
230
253
231 options:
254 options:
232 -L --label labels to use on conflict markers
255 -L --label labels to use on conflict markers
233 -a --text treat all files as text
256 -a --text treat all files as text
234 -p --print print results instead of overwriting LOCAL
257 -p --print print results instead of overwriting LOCAL
235 --no-minimal do not try to minimize conflict regions
258 --no-minimal do not try to minimize conflict regions
236 -h --help display help and exit
259 -h --help display help and exit
237 -q --quiet suppress output
260 -q --quiet suppress output
238
261
239 wrong number of arguments
262 wrong number of arguments
240
263
241 $ python simplemerge
264 $ python simplemerge
242 simplemerge: wrong number of arguments
265 simplemerge: wrong number of arguments
243 simplemerge [OPTS] LOCAL BASE OTHER
266 simplemerge [OPTS] LOCAL BASE OTHER
244
267
245 Simple three-way file merge utility with a minimal feature set.
268 Simple three-way file merge utility with a minimal feature set.
246
269
247 Apply to LOCAL the changes necessary to go from BASE to OTHER.
270 Apply to LOCAL the changes necessary to go from BASE to OTHER.
248
271
249 By default, LOCAL is overwritten with the results of this operation.
272 By default, LOCAL is overwritten with the results of this operation.
250
273
251 options:
274 options:
252 -L --label labels to use on conflict markers
275 -L --label labels to use on conflict markers
253 -a --text treat all files as text
276 -a --text treat all files as text
254 -p --print print results instead of overwriting LOCAL
277 -p --print print results instead of overwriting LOCAL
255 --no-minimal do not try to minimize conflict regions
278 --no-minimal do not try to minimize conflict regions
256 -h --help display help and exit
279 -h --help display help and exit
257 -q --quiet suppress output
280 -q --quiet suppress output
258 [1]
281 [1]
259
282
260 bad option
283 bad option
261
284
262 $ python simplemerge --foo -p local base other
285 $ python simplemerge --foo -p local base other
263 simplemerge: option --foo not recognized
286 simplemerge: option --foo not recognized
264 simplemerge [OPTS] LOCAL BASE OTHER
287 simplemerge [OPTS] LOCAL BASE OTHER
265
288
266 Simple three-way file merge utility with a minimal feature set.
289 Simple three-way file merge utility with a minimal feature set.
267
290
268 Apply to LOCAL the changes necessary to go from BASE to OTHER.
291 Apply to LOCAL the changes necessary to go from BASE to OTHER.
269
292
270 By default, LOCAL is overwritten with the results of this operation.
293 By default, LOCAL is overwritten with the results of this operation.
271
294
272 options:
295 options:
273 -L --label labels to use on conflict markers
296 -L --label labels to use on conflict markers
274 -a --text treat all files as text
297 -a --text treat all files as text
275 -p --print print results instead of overwriting LOCAL
298 -p --print print results instead of overwriting LOCAL
276 --no-minimal do not try to minimize conflict regions
299 --no-minimal do not try to minimize conflict regions
277 -h --help display help and exit
300 -h --help display help and exit
278 -q --quiet suppress output
301 -q --quiet suppress output
279 [1]
302 [1]
General Comments 0
You need to be logged in to leave comments. Login now