debugobsconvert: fix 6f08a8f6bb1d and add proper test
The changeset adding deduplication (6f08a8f6bb1d) was super buggy and dropped
all obsmarkers in the repo. We update the test to check this case and fix the
deduplication.
--- a/hgext/evolve.py Thu Nov 20 15:34:34 2014 -0800
+++ b/hgext/evolve.py Thu Nov 20 15:49:52 2014 -0800
@@ -2776,10 +2776,10 @@
origmarkers = repo.obsstore._all
known = set()
markers = []
- for m in markers:
+ for m in origmarkers:
if m in known:
continue
- know.add(m)
+ known.add(m)
markers.append(m)
ui.write(_('Old store is version %d, will rewrite in version %d\n') % (
repo.obsstore._version, new_format))
--- a/tests/test-obsconvert.t Thu Nov 20 15:34:34 2014 -0800
+++ b/tests/test-obsconvert.t Thu Nov 20 15:49:52 2014 -0800
@@ -15,15 +15,51 @@
> done
Test conversion between obsolete marker formats
+ $ hg debugobsolete
+ e63c23eaa88ae77967edcf4ea194d31167c478b0 b81ac6b9d2a55f9a7a6b90a006b1aab0568d6d34 0 (*) {'user': 'test'} (glob)
+ a5b276878fa564da042b4b9efef3713ceea20350 0 {e63c23eaa88ae77967edcf4ea194d31167c478b0} (*) {'user': 'test'} (glob)
+ b81ac6b9d2a55f9a7a6b90a006b1aab0568d6d34 384fc811182687231962e486f23ea8c5bab7a2d3 0 (*) {'user': 'test'} (glob)
+ 2291082406feb57d0f83b9b0a6777b6074f3fde6 0 {b81ac6b9d2a55f9a7a6b90a006b1aab0568d6d34} (*) {'user': 'test'} (glob)
+ 384fc811182687231962e486f23ea8c5bab7a2d3 949d379b3c3bf051906bc3528c049cb536e2ec86 0 (*) {'user': 'test'} (glob)
+ 1616bdbe82d3fd1fb7c4e068aee277835672ffdc 0 {384fc811182687231962e486f23ea8c5bab7a2d3} (*) {'user': 'test'} (glob)
+ 949d379b3c3bf051906bc3528c049cb536e2ec86 f2e4c45b2a4a58ccf7ef6825b8fa5685873cd2f7 0 (*) {'user': 'test'} (glob)
+ 8668d55aac650158bb510be6d47d21e3db9e5c75 0 {949d379b3c3bf051906bc3528c049cb536e2ec86} (*) {'user': 'test'} (glob)
$ hg debugobsconvert --new-format 0
Old store is version 1, will rewrite in version 0
Done!
+ $ hg debugobsolete
+ e63c23eaa88ae77967edcf4ea194d31167c478b0 b81ac6b9d2a55f9a7a6b90a006b1aab0568d6d34 0 (*) {'user': 'test'} (glob)
+ a5b276878fa564da042b4b9efef3713ceea20350 0 {e63c23eaa88ae77967edcf4ea194d31167c478b0} (*) {'user': 'test'} (glob)
+ b81ac6b9d2a55f9a7a6b90a006b1aab0568d6d34 384fc811182687231962e486f23ea8c5bab7a2d3 0 (*) {'user': 'test'} (glob)
+ 2291082406feb57d0f83b9b0a6777b6074f3fde6 0 {b81ac6b9d2a55f9a7a6b90a006b1aab0568d6d34} (*) {'user': 'test'} (glob)
+ 384fc811182687231962e486f23ea8c5bab7a2d3 949d379b3c3bf051906bc3528c049cb536e2ec86 0 (*) {'user': 'test'} (glob)
+ 1616bdbe82d3fd1fb7c4e068aee277835672ffdc 0 {384fc811182687231962e486f23ea8c5bab7a2d3} (*) {'user': 'test'} (glob)
+ 949d379b3c3bf051906bc3528c049cb536e2ec86 f2e4c45b2a4a58ccf7ef6825b8fa5685873cd2f7 0 (*) {'user': 'test'} (glob)
+ 8668d55aac650158bb510be6d47d21e3db9e5c75 0 {949d379b3c3bf051906bc3528c049cb536e2ec86} (*) {'user': 'test'} (glob)
$ hg debugobsconvert --new-format 0
abort: New format is the same as the old format, not upgrading!
[255]
+ $ hg debugobsolete
+ e63c23eaa88ae77967edcf4ea194d31167c478b0 b81ac6b9d2a55f9a7a6b90a006b1aab0568d6d34 0 (*) {'user': 'test'} (glob)
+ a5b276878fa564da042b4b9efef3713ceea20350 0 {e63c23eaa88ae77967edcf4ea194d31167c478b0} (*) {'user': 'test'} (glob)
+ b81ac6b9d2a55f9a7a6b90a006b1aab0568d6d34 384fc811182687231962e486f23ea8c5bab7a2d3 0 (*) {'user': 'test'} (glob)
+ 2291082406feb57d0f83b9b0a6777b6074f3fde6 0 {b81ac6b9d2a55f9a7a6b90a006b1aab0568d6d34} (*) {'user': 'test'} (glob)
+ 384fc811182687231962e486f23ea8c5bab7a2d3 949d379b3c3bf051906bc3528c049cb536e2ec86 0 (*) {'user': 'test'} (glob)
+ 1616bdbe82d3fd1fb7c4e068aee277835672ffdc 0 {384fc811182687231962e486f23ea8c5bab7a2d3} (*) {'user': 'test'} (glob)
+ 949d379b3c3bf051906bc3528c049cb536e2ec86 f2e4c45b2a4a58ccf7ef6825b8fa5685873cd2f7 0 (*) {'user': 'test'} (glob)
+ 8668d55aac650158bb510be6d47d21e3db9e5c75 0 {949d379b3c3bf051906bc3528c049cb536e2ec86} (*) {'user': 'test'} (glob)
$ hg debugobsconvert --new-format 1
Old store is version 0, will rewrite in version 1
Done!
+ $ hg debugobsolete
+ e63c23eaa88ae77967edcf4ea194d31167c478b0 b81ac6b9d2a55f9a7a6b90a006b1aab0568d6d34 0 (*) {'user': 'test'} (glob)
+ a5b276878fa564da042b4b9efef3713ceea20350 0 {e63c23eaa88ae77967edcf4ea194d31167c478b0} (*) {'user': 'test'} (glob)
+ b81ac6b9d2a55f9a7a6b90a006b1aab0568d6d34 384fc811182687231962e486f23ea8c5bab7a2d3 0 (*) {'user': 'test'} (glob)
+ 2291082406feb57d0f83b9b0a6777b6074f3fde6 0 {b81ac6b9d2a55f9a7a6b90a006b1aab0568d6d34} (*) {'user': 'test'} (glob)
+ 384fc811182687231962e486f23ea8c5bab7a2d3 949d379b3c3bf051906bc3528c049cb536e2ec86 0 (*) {'user': 'test'} (glob)
+ 1616bdbe82d3fd1fb7c4e068aee277835672ffdc 0 {384fc811182687231962e486f23ea8c5bab7a2d3} (*) {'user': 'test'} (glob)
+ 949d379b3c3bf051906bc3528c049cb536e2ec86 f2e4c45b2a4a58ccf7ef6825b8fa5685873cd2f7 0 (*) {'user': 'test'} (glob)
+ 8668d55aac650158bb510be6d47d21e3db9e5c75 0 {949d379b3c3bf051906bc3528c049cb536e2ec86} (*) {'user': 'test'} (glob)
Test that the default is some reasonably modern format (first downgrade)
$ hg debugobsconvert --new-format 0
@@ -32,3 +68,12 @@
$ hg debugobsconvert
Old store is version 0, will rewrite in version 1
Done!
+ $ hg debugobsolete
+ e63c23eaa88ae77967edcf4ea194d31167c478b0 b81ac6b9d2a55f9a7a6b90a006b1aab0568d6d34 0 (*) {'user': 'test'} (glob)
+ a5b276878fa564da042b4b9efef3713ceea20350 0 {e63c23eaa88ae77967edcf4ea194d31167c478b0} (*) {'user': 'test'} (glob)
+ b81ac6b9d2a55f9a7a6b90a006b1aab0568d6d34 384fc811182687231962e486f23ea8c5bab7a2d3 0 (*) {'user': 'test'} (glob)
+ 2291082406feb57d0f83b9b0a6777b6074f3fde6 0 {b81ac6b9d2a55f9a7a6b90a006b1aab0568d6d34} (*) {'user': 'test'} (glob)
+ 384fc811182687231962e486f23ea8c5bab7a2d3 949d379b3c3bf051906bc3528c049cb536e2ec86 0 (*) {'user': 'test'} (glob)
+ 1616bdbe82d3fd1fb7c4e068aee277835672ffdc 0 {384fc811182687231962e486f23ea8c5bab7a2d3} (*) {'user': 'test'} (glob)
+ 949d379b3c3bf051906bc3528c049cb536e2ec86 f2e4c45b2a4a58ccf7ef6825b8fa5685873cd2f7 0 (*) {'user': 'test'} (glob)
+ 8668d55aac650158bb510be6d47d21e3db9e5c75 0 {949d379b3c3bf051906bc3528c049cb536e2ec86} (*) {'user': 'test'} (glob)