Patchwork [01,of,10] debugrevlog: fix for non-manifest object

login
register
mail settings
Submitter Boris Feld
Date Aug. 16, 2018, 1:43 p.m.
Message ID <4c025c62ceb8de0f5872.1534426988@FB-lair>
Download mbox | patch
Permalink /patch/33779/
State Accepted
Headers show

Comments

Boris Feld - Aug. 16, 2018, 1:43 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1534339244 -7200
#      Wed Aug 15 15:20:44 2018 +0200
# Node ID 4c025c62ceb8de0f58721f7edd4448b7ef95006d
# Parent  46da52f4b820f2668b120fcf93f09fb730065da6
# EXP-Topic sparse-snapshot
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 4c025c62ceb8
debugrevlog: fix for non-manifest object

The `filelog` object is no longer an actual revlog. Instead, the actual revlog
is stored in the `_revlog` attribute.
Gregory Szorc - Aug. 18, 2018, 1:35 a.m.
On Thu, Aug 16, 2018 at 6:43 AM, Boris Feld <boris.feld@octobus.net> wrote:

> # HG changeset patch
> # User Boris Feld <boris.feld@octobus.net>
> # Date 1534339244 -7200
> #      Wed Aug 15 15:20:44 2018 +0200
> # Node ID 4c025c62ceb8de0f58721f7edd4448b7ef95006d
> # Parent  46da52f4b820f2668b120fcf93f09fb730065da6
> # EXP-Topic sparse-snapshot
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r
> 4c025c62ceb8
> debugrevlog: fix for non-manifest object
>

Queued this series.

I understand the value of what this is trying to do. But please try to work
numbers into future commit messages so the changes can be justified more
easily.

Also, I'll be introducing a non-revlog store soon. You may have seen
various work I'm doing trying to remove the dependency on revlogs from
storage. At some point we'll want this delta generation and selection logic
to be somewhat generic so it can be used in a store agnostic manner. If you
or anyone want to send patches to extract this functionality outside of
revlog.py, I will happily review those patches :)


>
> The `filelog` object is no longer an actual revlog. Instead, the actual
> revlog
> is stored in the `_revlog` attribute.
>
> diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
> --- a/mercurial/debugcommands.py
> +++ b/mercurial/debugcommands.py
> @@ -2170,7 +2170,10 @@ def debugrevlog(ui, repo, file_=None, **
>                      numother += 1
>
>          # Obtain data on the raw chunks in the revlog.
> -        segment = r._getsegmentforrevs(rev, rev)[1]
> +        if util.safehasattr(r, '_getsegmentforrevs'):
> +            segment = r._getsegmentforrevs(rev, rev)[1]
> +        else:
> +            segment = r._revlog._getsegmentforrevs(rev, rev)[1]
>          if segment:
>              chunktype = bytes(segment[0:1])
>          else:
> diff --git a/tests/test-debugcommands.t b/tests/test-debugcommands.t
> --- a/tests/test-debugcommands.t
> +++ b/tests/test-debugcommands.t
> @@ -15,6 +15,36 @@
>    adding a
>    $ hg ci -Am make-it-full
>  #if reporevlogstore
> +  $ hg debugrevlog -c
> +  format : 1
> +  flags  : inline
> +
> +  revisions     :   3
> +      merges    :   0 ( 0.00%)
> +      normal    :   3 (100.00%)
> +  revisions     :   3
> +      empty     :   0 ( 0.00%)
> +                     text  :   0 (100.00%)
> +                     delta :   0 (100.00%)
> +      full      :   3 (100.00%)
> +      deltas    :   0 ( 0.00%)
> +  revision size : 191
> +      full      : 191 (100.00%)
> +      deltas    :   0 ( 0.00%)
> +
> +  chunks        :   3
> +      0x75 (u)  :   3 (100.00%)
> +  chunks size   : 191
> +      0x75 (u)  : 191 (100.00%)
> +
> +  avg chain length  :  0
> +  max chain length  :  0
> +  max chain reach   : 67
> +  compression ratio :  0
> +
> +  uncompressed data size (min/max/avg) : 57 / 66 / 62
> +  full revision size (min/max/avg)     : 58 / 67 / 63
> +  delta size (min/max/avg)             : 0 / 0 / 0
>    $ hg debugrevlog -m
>    format : 1
>    flags  : inline, generaldelta
> @@ -47,6 +77,36 @@
>    uncompressed data size (min/max/avg) : 0 / 43 / 28
>    full revision size (min/max/avg)     : 44 / 44 / 44
>    delta size (min/max/avg)             : 0 / 0 / 0
> +  $ hg debugrevlog a
> +  format : 1
> +  flags  : inline, generaldelta
> +
> +  revisions     : 1
> +      merges    : 0 ( 0.00%)
> +      normal    : 1 (100.00%)
> +  revisions     : 1
> +      empty     : 0 ( 0.00%)
> +                     text  : 0 (100.00%)
> +                     delta : 0 (100.00%)
> +      full      : 1 (100.00%)
> +      deltas    : 0 ( 0.00%)
> +  revision size : 3
> +      full      : 3 (100.00%)
> +      deltas    : 0 ( 0.00%)
> +
> +  chunks        : 1
> +      0x75 (u)  : 1 (100.00%)
> +  chunks size   : 3
> +      0x75 (u)  : 3 (100.00%)
> +
> +  avg chain length  : 0
> +  max chain length  : 0
> +  max chain reach   : 3
> +  compression ratio : 0
> +
> +  uncompressed data size (min/max/avg) : 2 / 2 / 2
> +  full revision size (min/max/avg)     : 3 / 3 / 3
> +  delta size (min/max/avg)             : 0 / 0 / 0
>  #endif
>
>  Test debugindex, with and without the --verbose/--debug flag
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>
Boris FELD - Aug. 18, 2018, 8:50 a.m.
On 18/08/2018 03:35, Gregory Szorc wrote:
> On Thu, Aug 16, 2018 at 6:43 AM, Boris Feld <boris.feld@octobus.net 
> <mailto:boris.feld@octobus.net>> wrote:
>
>     # HG changeset patch
>     # User Boris Feld <boris.feld@octobus.net
>     <mailto:boris.feld@octobus.net>>
>     # Date 1534339244 -7200
>     #      Wed Aug 15 15:20:44 2018 +0200
>     # Node ID 4c025c62ceb8de0f58721f7edd4448b7ef95006d
>     # Parent  46da52f4b820f2668b120fcf93f09fb730065da6
>     # EXP-Topic sparse-snapshot
>     # Available At https://bitbucket.org/octobus/mercurial-devel/
>     <https://bitbucket.org/octobus/mercurial-devel/>
>     #              hg pull
>     https://bitbucket.org/octobus/mercurial-devel/
>     <https://bitbucket.org/octobus/mercurial-devel/> -r 4c025c62ceb8
>     debugrevlog: fix for non-manifest object
>
>
> Queued this series.
>
> I understand the value of what this is trying to do. But please try to 
> work numbers into future commit messages so the changes can be 
> justified more easily.
>
> Also, I'll be introducing a non-revlog store soon. You may have seen 
> various work I'm doing trying to remove the dependency on revlogs from 
> storage. At some point we'll want this delta generation and selection 
> logic to be somewhat generic so it can be used in a store agnostic 
> manner. If you or anyone want to send patches to extract this 
> functionality outside of revlog.py, I will happily review those patches :)
Indeed, the next series to be sent is about extracting delta related 
logic out of revlog.py. It will still depend on revlog object, but this 
is a step in the right direction.

The series after that movement + cleanup series, should be about the 
actual generation of intermediate snapshots.
>
>
>     The `filelog` object is no longer an actual revlog. Instead, the
>     actual revlog
>     is stored in the `_revlog` attribute.
>
>     diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
>     --- a/mercurial/debugcommands.py
>     +++ b/mercurial/debugcommands.py
>     @@ -2170,7 +2170,10 @@ def debugrevlog(ui, repo, file_=None, **
>                          numother += 1
>
>              # Obtain data on the raw chunks in the revlog.
>     -        segment = r._getsegmentforrevs(rev, rev)[1]
>     +        if util.safehasattr(r, '_getsegmentforrevs'):
>     +            segment = r._getsegmentforrevs(rev, rev)[1]
>     +        else:
>     +            segment = r._revlog._getsegmentforrevs(rev, rev)[1]
>              if segment:
>                  chunktype = bytes(segment[0:1])
>              else:
>     diff --git a/tests/test-debugcommands.t b/tests/test-debugcommands.t
>     --- a/tests/test-debugcommands.t
>     +++ b/tests/test-debugcommands.t
>     @@ -15,6 +15,36 @@
>        adding a
>        $ hg ci -Am make-it-full
>      #if reporevlogstore
>     +  $ hg debugrevlog -c
>     +  format : 1
>     +  flags  : inline
>     +
>     +  revisions     :   3
>     +      merges    :   0 ( 0.00%)
>     +      normal    :   3 (100.00%)
>     +  revisions     :   3
>     +      empty     :   0 ( 0.00%)
>     +                     text  :   0 (100.00%)
>     +                     delta :   0 (100.00%)
>     +      full      :   3 (100.00%)
>     +      deltas    :   0 ( 0.00%)
>     +  revision size : 191
>     +      full      : 191 (100.00%)
>     +      deltas    :   0 ( 0.00%)
>     +
>     +  chunks        :   3
>     +      0x75 (u)  :   3 (100.00%)
>     +  chunks size   : 191
>     +      0x75 (u)  : 191 (100.00%)
>     +
>     +  avg chain length  :  0
>     +  max chain length  :  0
>     +  max chain reach   : 67
>     +  compression ratio :  0
>     +
>     +  uncompressed data size (min/max/avg) : 57 / 66 / 62
>     +  full revision size (min/max/avg)     : 58 / 67 / 63
>     +  delta size (min/max/avg)             : 0 / 0 / 0
>        $ hg debugrevlog -m
>        format : 1
>        flags  : inline, generaldelta
>     @@ -47,6 +77,36 @@
>        uncompressed data size (min/max/avg) : 0 / 43 / 28
>        full revision size (min/max/avg)     : 44 / 44 / 44
>        delta size (min/max/avg)             : 0 / 0 / 0
>     +  $ hg debugrevlog a
>     +  format : 1
>     +  flags  : inline, generaldelta
>     +
>     +  revisions     : 1
>     +      merges    : 0 ( 0.00%)
>     +      normal    : 1 (100.00%)
>     +  revisions     : 1
>     +      empty     : 0 ( 0.00%)
>     +                     text  : 0 (100.00%)
>     +                     delta : 0 (100.00%)
>     +      full      : 1 (100.00%)
>     +      deltas    : 0 ( 0.00%)
>     +  revision size : 3
>     +      full      : 3 (100.00%)
>     +      deltas    : 0 ( 0.00%)
>     +
>     +  chunks        : 1
>     +      0x75 (u)  : 1 (100.00%)
>     +  chunks size   : 3
>     +      0x75 (u)  : 3 (100.00%)
>     +
>     +  avg chain length  : 0
>     +  max chain length  : 0
>     +  max chain reach   : 3
>     +  compression ratio : 0
>     +
>     +  uncompressed data size (min/max/avg) : 2 / 2 / 2
>     +  full revision size (min/max/avg)     : 3 / 3 / 3
>     +  delta size (min/max/avg)             : 0 / 0 / 0
>      #endif
>
>      Test debugindex, with and without the --verbose/--debug flag
>     _______________________________________________
>     Mercurial-devel mailing list
>     Mercurial-devel@mercurial-scm.org
>     <mailto:Mercurial-devel@mercurial-scm.org>
>     https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>     <https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel>
>
>
>
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -2170,7 +2170,10 @@  def debugrevlog(ui, repo, file_=None, **
                     numother += 1
 
         # Obtain data on the raw chunks in the revlog.
-        segment = r._getsegmentforrevs(rev, rev)[1]
+        if util.safehasattr(r, '_getsegmentforrevs'):
+            segment = r._getsegmentforrevs(rev, rev)[1]
+        else:
+            segment = r._revlog._getsegmentforrevs(rev, rev)[1]
         if segment:
             chunktype = bytes(segment[0:1])
         else:
diff --git a/tests/test-debugcommands.t b/tests/test-debugcommands.t
--- a/tests/test-debugcommands.t
+++ b/tests/test-debugcommands.t
@@ -15,6 +15,36 @@ 
   adding a
   $ hg ci -Am make-it-full
 #if reporevlogstore
+  $ hg debugrevlog -c
+  format : 1
+  flags  : inline
+  
+  revisions     :   3
+      merges    :   0 ( 0.00%)
+      normal    :   3 (100.00%)
+  revisions     :   3
+      empty     :   0 ( 0.00%)
+                     text  :   0 (100.00%)
+                     delta :   0 (100.00%)
+      full      :   3 (100.00%)
+      deltas    :   0 ( 0.00%)
+  revision size : 191
+      full      : 191 (100.00%)
+      deltas    :   0 ( 0.00%)
+  
+  chunks        :   3
+      0x75 (u)  :   3 (100.00%)
+  chunks size   : 191
+      0x75 (u)  : 191 (100.00%)
+  
+  avg chain length  :  0
+  max chain length  :  0
+  max chain reach   : 67
+  compression ratio :  0
+  
+  uncompressed data size (min/max/avg) : 57 / 66 / 62
+  full revision size (min/max/avg)     : 58 / 67 / 63
+  delta size (min/max/avg)             : 0 / 0 / 0
   $ hg debugrevlog -m
   format : 1
   flags  : inline, generaldelta
@@ -47,6 +77,36 @@ 
   uncompressed data size (min/max/avg) : 0 / 43 / 28
   full revision size (min/max/avg)     : 44 / 44 / 44
   delta size (min/max/avg)             : 0 / 0 / 0
+  $ hg debugrevlog a
+  format : 1
+  flags  : inline, generaldelta
+  
+  revisions     : 1
+      merges    : 0 ( 0.00%)
+      normal    : 1 (100.00%)
+  revisions     : 1
+      empty     : 0 ( 0.00%)
+                     text  : 0 (100.00%)
+                     delta : 0 (100.00%)
+      full      : 1 (100.00%)
+      deltas    : 0 ( 0.00%)
+  revision size : 3
+      full      : 3 (100.00%)
+      deltas    : 0 ( 0.00%)
+  
+  chunks        : 1
+      0x75 (u)  : 1 (100.00%)
+  chunks size   : 3
+      0x75 (u)  : 3 (100.00%)
+  
+  avg chain length  : 0
+  max chain length  : 0
+  max chain reach   : 3
+  compression ratio : 0
+  
+  uncompressed data size (min/max/avg) : 2 / 2 / 2
+  full revision size (min/max/avg)     : 3 / 3 / 3
+  delta size (min/max/avg)             : 0 / 0 / 0
 #endif
 
 Test debugindex, with and without the --verbose/--debug flag