Patchwork D6934: revlog: explicitly set revlogv0 in vfs options

login
register
mail settings
Submitter phabricator
Date Oct. 1, 2019, 12:34 p.m.
Message ID <differential-rev-PHID-DREV-z3sbqoetpay622mm6ggz-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/41886/
State Superseded
Headers show

Comments

phabricator - Oct. 1, 2019, 12:34 p.m.
marmoute created this revision.
marmoute added reviewers: martinvonz, durin42.
Herald added a reviewer: indygreg.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Relying on having an attribute or not for something so fundamental seems too
  fragile to me. (And indeed I had issue with that later in this series). So we
  explicitly record the fact the repository use revlog-v0.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6934

AFFECTED FILES
  mercurial/localrepo.py
  mercurial/revlog.py

CHANGE DETAILS




To: marmoute, martinvonz, durin42, indygreg, #hg-reviewers
Cc: mercurial-devel
phabricator - Oct. 1, 2019, 4:25 p.m.
martinvonz added inline comments.

INLINE COMMENTS

> revlog.py:367-369
>              # If options provided but no 'revlog*' found, the repository
>              # would have no 'requires' file in it, which means we have to
>              # stick to the old format.

Needs updating

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6934/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D6934

To: marmoute, martinvonz, durin42, indygreg, #hg-reviewers, pulkit
Cc: mercurial-devel

Patch

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -363,7 +363,7 @@ 
             newversionflags = REVLOGV1 | FLAG_INLINE_DATA
             if 'generaldelta' in opts:
                 newversionflags |= FLAG_GENERALDELTA
-        elif getattr(self.opener, 'options', None) is not None:
+        elif 'revlogv0' in getattr(self.opener, 'options', {}):
             # If options provided but no 'revlog*' found, the repository
             # would have no 'requires' file in it, which means we have to
             # stick to the old format.
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -748,6 +748,8 @@ 
     # meaningful on such old repos.
     if b'revlogv1' in requirements or REVLOGV2_REQUIREMENT in requirements:
         options.update(resolverevlogstorevfsoptions(ui, requirements, features))
+    else: # explicitly mark repo as using revlogv0
+        options['revlogv0'] = True
 
     return options