Show More
@@ -209,6 +209,11 b' class filemap_source(converter_source):' | |||||
209 | self.children[p] = self.children.get(p, 0) + 1 |
|
209 | self.children[p] = self.children.get(p, 0) + 1 | |
210 | return c |
|
210 | return c | |
211 |
|
211 | |||
|
212 | def _cachedcommit(self, rev): | |||
|
213 | if rev in self.commits: | |||
|
214 | return self.commits[rev] | |||
|
215 | return self.base.getcommit(rev) | |||
|
216 | ||||
212 | def _discard(self, *revs): |
|
217 | def _discard(self, *revs): | |
213 | for r in revs: |
|
218 | for r in revs: | |
214 | if r is None: |
|
219 | if r is None: | |
@@ -308,7 +313,14 b' class filemap_source(converter_source):' | |||||
308 |
|
313 | |||
309 | self.origparents[rev] = parents |
|
314 | self.origparents[rev] = parents | |
310 |
|
315 | |||
311 | closed = 'close' in self.commits[rev].extra |
|
316 | closed = False | |
|
317 | if 'close' in self.commits[rev].extra: | |||
|
318 | # A branch closing revision is only useful if one of its | |||
|
319 | # parents belong to the branch being closed | |||
|
320 | branch = self.commits[rev].branch | |||
|
321 | pbranches = [self._cachedcommit(p).branch for p in mparents] | |||
|
322 | if branch in pbranches: | |||
|
323 | closed = True | |||
312 |
|
324 | |||
313 | if len(mparents) < 2 and not closed and not self.wanted(rev, wp): |
|
325 | if len(mparents) < 2 and not closed and not self.wanted(rev, wp): | |
314 | # We don't want this revision. |
|
326 | # We don't want this revision. |
@@ -282,3 +282,83 b' filemap errors' | |||||
282 | errors.fmap:5: path to exclude is missing |
|
282 | errors.fmap:5: path to exclude is missing | |
283 | abort: errors in filemap |
|
283 | abort: errors in filemap | |
284 | [255] |
|
284 | [255] | |
|
285 | ||||
|
286 | test branch closing revision pruning if branch is pruned | |||
|
287 | ||||
|
288 | $ hg init branchpruning | |||
|
289 | $ cd branchpruning | |||
|
290 | $ hg branch foo | |||
|
291 | marked working directory as branch foo | |||
|
292 | $ echo a > a | |||
|
293 | $ hg ci -Am adda | |||
|
294 | adding a | |||
|
295 | $ hg ci --close-branch -m closefoo | |||
|
296 | $ hg up 0 | |||
|
297 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
298 | $ hg branch empty | |||
|
299 | marked working directory as branch empty | |||
|
300 | $ hg ci -m emptybranch | |||
|
301 | $ hg ci --close-branch -m closeempty | |||
|
302 | $ hg up 0 | |||
|
303 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
304 | $ hg branch default | |||
|
305 | marked working directory as branch default | |||
|
306 | $ echo b > b | |||
|
307 | $ hg ci -Am addb | |||
|
308 | adding b | |||
|
309 | $ hg ci --close-branch -m closedefault | |||
|
310 | $ cat > filemap <<EOF | |||
|
311 | > include b | |||
|
312 | > EOF | |||
|
313 | $ cd .. | |||
|
314 | $ hg convert branchpruning branchpruning-hg1 | |||
|
315 | initializing destination branchpruning-hg1 repository | |||
|
316 | scanning source... | |||
|
317 | sorting... | |||
|
318 | converting... | |||
|
319 | 5 adda | |||
|
320 | 4 closefoo | |||
|
321 | 3 emptybranch | |||
|
322 | 2 closeempty | |||
|
323 | 1 addb | |||
|
324 | 0 closedefault | |||
|
325 | $ glog -R branchpruning-hg1 | |||
|
326 | o 5 "closedefault" files: | |||
|
327 | | | |||
|
328 | o 4 "addb" files: b | |||
|
329 | | | |||
|
330 | | o 3 "closeempty" files: | |||
|
331 | | | | |||
|
332 | | o 2 "emptybranch" files: | |||
|
333 | |/ | |||
|
334 | | o 1 "closefoo" files: | |||
|
335 | |/ | |||
|
336 | o 0 "adda" files: a | |||
|
337 | ||||
|
338 | ||||
|
339 | exercise incremental conversion at the same time | |||
|
340 | ||||
|
341 | $ hg convert -r0 --filemap branchpruning/filemap branchpruning branchpruning-hg2 | |||
|
342 | initializing destination branchpruning-hg2 repository | |||
|
343 | scanning source... | |||
|
344 | sorting... | |||
|
345 | converting... | |||
|
346 | 0 adda | |||
|
347 | $ hg convert -r4 --filemap branchpruning/filemap branchpruning branchpruning-hg2 | |||
|
348 | scanning source... | |||
|
349 | sorting... | |||
|
350 | converting... | |||
|
351 | 0 addb | |||
|
352 | $ hg convert --filemap branchpruning/filemap branchpruning branchpruning-hg2 | |||
|
353 | scanning source... | |||
|
354 | sorting... | |||
|
355 | converting... | |||
|
356 | 3 closefoo | |||
|
357 | 2 emptybranch | |||
|
358 | 1 closeempty | |||
|
359 | 0 closedefault | |||
|
360 | $ glog -R branchpruning-hg2 | |||
|
361 | o 1 "closedefault" files: | |||
|
362 | | | |||
|
363 | o 0 "addb" files: b | |||
|
364 |
@@ -34,24 +34,18 b'' | |||||
34 | created new head |
|
34 | created new head | |
35 | $ chmod +x baz |
|
35 | $ chmod +x baz | |
36 | $ hg ci -m 'mark baz executable' -d '5 0' |
|
36 | $ hg ci -m 'mark baz executable' -d '5 0' | |
37 | $ hg branch foo |
|
|||
38 | marked working directory as branch foo |
|
|||
39 | $ hg ci -m 'branch foo' -d '6 0' |
|
|||
40 | $ hg ci --close-branch -m 'close' -d '7 0' |
|
|||
41 | $ cd .. |
|
37 | $ cd .. | |
42 | $ hg convert --datesort orig new 2>&1 | grep -v 'subversion python bindings could not be loaded' |
|
38 | $ hg convert --datesort orig new 2>&1 | grep -v 'subversion python bindings could not be loaded' | |
43 | initializing destination new repository |
|
39 | initializing destination new repository | |
44 | scanning source... |
|
40 | scanning source... | |
45 | sorting... |
|
41 | sorting... | |
46 | converting... |
|
42 | converting... | |
47 |
|
|
43 | 5 add foo bar | |
48 |
|
|
44 | 4 change foo | |
49 |
|
|
45 | 3 make bar and baz copies of foo | |
50 |
|
|
46 | 2 merge local copy | |
51 |
|
|
47 | 1 merge remote copy | |
52 |
|
|
48 | 0 mark baz executable | |
53 | 1 branch foo |
|
|||
54 | 0 close |
|
|||
55 | updating bookmarks |
|
49 | updating bookmarks | |
56 | $ cd new |
|
50 | $ cd new | |
57 | $ hg out ../orig |
|
51 | $ hg out ../orig | |
@@ -61,7 +55,7 b'' | |||||
61 | [1] |
|
55 | [1] | |
62 | $ hg bookmarks |
|
56 | $ hg bookmarks | |
63 | premerge1 3:973ef48a98a4 |
|
57 | premerge1 3:973ef48a98a4 | |
64 |
premerge2 |
|
58 | premerge2 5:13d9b87cf8f8 | |
65 | $ cd .. |
|
59 | $ cd .. | |
66 |
|
60 | |||
67 | check shamap LF and CRLF handling |
|
61 | check shamap LF and CRLF handling |
General Comments 0
You need to be logged in to leave comments.
Login now