[PATCH STABLE] debugrevlog: improve handling of empty manifests/changelogs
timeless
timeless at gmail.com
Fri Jan 29 16:38:04 UTC 2016
> Why checking numerator?
If it's 0, then I'm happy saying the value is 0. If it's not zero,
then I don't want to decide how to handle it. I.e. from my perspective
0/x should be treated as 0, people can understand that. 1/0 otoh
should be Inf, and that's too hard to reason through. If we manage to
hit that case, I'd like someone else to solve it.
diff -r 8b7958075035 tests/test-debugcommands.t
--- a/tests/test-debugcommands.t Mon Jan 25 20:40:38 2016 +0000
+++ b/tests/test-debugcommands.t Fri Jan 29 16:24:05 2016 +0000
@@ -1,5 +1,3 @@
-#require test-repo
-
$ cat << EOF >> $HGRCPATH
> [format]
> usegeneraldelta=yes
Removing the require is correct (and I'll do it if I can resend
something useful).
> You can make an empty commit by "--config ui.allowemptycommit=True" or
> "hg branch foo && hg ci".
@@ -13,48 +11,23 @@
$ hg debugrevlog -m
abort: repository manifest is empty
[255]
- $ hg pull "$TESTDIR/bundles/issue5062.hg" -r 0
- pulling from *issue5062.hg (glob)
- adding changesets
- adding manifests
- adding file changes
- added 1 changesets with 0 changes to 0 files
- (run 'hg update' to get a working copy)
+ $ hg commit --config ui.allowemptycommit=True -m 'empty'
+ $ hg debugrevlog -m
+ abort: repository manifest is empty
+ [255]
+
+ $ echo a > a
+ $ hg ci -Am adda
+ adding a
$ hg debugrevlog -m
format : 1
flags : inline, generaldelta
- revisions : 1
- merges : 0 ( 0.00%)
- normal : 1 (100.00%)
- revisions : 1
- full : 1 (100.00%)
- deltas : 0 ( 0.00%)
- revision size : 0
- full : 0 (100.00%)
- deltas : 0 (100.00%)
-
- avg chain length : 0
- max chain length : 0
- compression ratio : 1
-
- uncompressed data size (min/max/avg) : 0 / 0 / 0
- full revision size (min/max/avg) : 0 / 0 / 0
- delta size (min/max/avg) : 0 / 0 / 0
-
- $ echo a > a
- $ hg ci -Am adda
- adding a
- created new head
- $ hg debugrevlog -m
- format : 1
- flags : inline, generaldelta
-
- revisions : 2
+ revisions : 1
merges : 0 ( 0.00%)
- normal : 2 (100.00%)
- revisions : 2
- full : 2 (100.00%)
+ normal : 1 (100.00%)
+ revisions : 1
+ full : 1 (100.00%)
deltas : 0 ( 0.00%)
revision size : 44
full : 44 (100.00%)
This doesn't seem to match what I was expecting at all. Apparently an
empty commit isn't considered a revision (?!).
@@ -64,8 +37,8 @@
max chain length : 0
compression ratio : 0
- uncompressed data size (min/max/avg) : 0 / 43 / 21
- full revision size (min/max/avg) : 0 / 44 / 22
+ uncompressed data size (min/max/avg) : 43 / 43 / 43
+ full revision size (min/max/avg) : 44 / 44 / 44
delta size (min/max/avg) : 0 / 0 / 0
Test debugindex, with and without the --debug flag
@@ -86,32 +59,16 @@
$ hg debugdeltachain -m
rev chain# chainlen prev delta size rawsize
chainsize ratio lindist extradist extraratio
- 0 1 1 -1 base 0 0
0 0.00000 0 0 0.00000
- 1 2 1 -1 base 44 43
44 1.02326 44 0 0.00000
+ 0 1 1 -1 base 44 43
44 1.02326 44 0 0.00000
$ hg debugdeltachain -m -T '{rev} {chainid} {chainlen}\n'
0 1 1
- 1 2 1
$ hg debugdeltachain -m -Tjson
[
{
"chainid": 1,
"chainlen": 1,
- "chainratio": 0.0,
- "chainsize": 0,
- "compsize": 0,
- "deltatype": "base",
- "extradist": 0,
- "extraratio": 0.0,
- "lindist": 0,
- "prevrev": -1,
- "rev": 0,
- "uncompsize": 0
- },
- {
- "chainid": 2,
- "chainlen": 1,
"chainratio": 1.02325581395,
"chainsize": 44,
"compsize": 44,
@@ -120,7 +77,7 @@
"extraratio": 0.0,
"lindist": 44,
"prevrev": -1,
- "rev": 1,
+ "rev": 0,
"uncompsize": 43
}
]
More information about the Mercurial-devel
mailing list