Patchwork D3152: upgrade: sniff for filelog type

login
register
mail settings
Submitter phabricator
Date April 6, 2018, 12:51 a.m.
Message ID <differential-rev-PHID-DREV-qckfx747iqtxgj5vfy6x-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/30418/
State Superseded
Headers show

Comments

phabricator - April 6, 2018, 12:51 a.m.
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The upgrade code should never encounter a vanilla revlog
  instance: only changelog, manifestrevlog, and filelog should
  be seen.
  
  The previous code assumed !changelog & !manifestrevlog meant
  file data. So this change feels pretty safe. If nothing else, it
  will help tease out typing issues.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/upgrade.py

CHANGE DETAILS




To: indygreg, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py
--- a/mercurial/upgrade.py
+++ b/mercurial/upgrade.py
@@ -480,11 +480,13 @@ 
             mrevcount += len(rl)
             msrcsize += datasize
             mrawsize += rawsize
-        elif isinstance(rl, revlog.revlog):
+        elif isinstance(rl, filelog.filelog):
             fcount += 1
             frevcount += len(rl)
             fsrcsize += datasize
             frawsize += rawsize
+        else:
+            error.ProgrammingError('unknown revlog type')
 
     if not revcount:
         return