Comment 6 for bug 408824

Revision history for this message
Martin Pool (mbp) wrote :

So in the case of upgrade_explicit_knit, the strange thing is that the source directory does in fact seem to contain weaves, so I'm not sure why it's complaining

BadConversionTarget: Cannot convert from format <RepositoryFormat2a> to format <RepositoryFormatKnit1>. Does not support rich root data.

I can reproduce this interactively:

mbp@lithe% ./bzr init --metaweave /tmp/meta
default2a plugin set default format to 2a
Format <RepositoryFormat7> for file:///tmp/meta/.bzr/ is deprecated - please use 'bzr upgrade' to get better performance
Created a standalone tree (format: metaweave)
mbp@lithe% ./bzr info /tmp/meta
default2a plugin set default format to 2a
Format <RepositoryFormat7> for file:///tmp/meta/.bzr/ is deprecated - please use 'bzr upgrade' to get better performance
Standalone tree (format: metaweave)
Location:
  branch root: /tmp/meta
mbp@lithe% ./bzr upgrade --knit /tmp/meta
default2a plugin set default format to 2a
Format <RepositoryFormat7> for file:///tmp/meta/.bzr/ is deprecated - please use 'bzr upgrade' to get better performance
bzr: ERROR: Cannot convert from format <RepositoryFormat2a> to format <RepositoryFormatKnit1>. Does not support rich root data.

however with the default2a plugin removed, it succeeds.

The problem seems to be that the BzrDirFormat object for the source doesn't reflect the formats that are actually present:

(Pdb) l
130
131 def check_conversion_target(self, target_format):
132 target_repo_format = target_format.repository_format
133 source_repo_format = self._format.repository_format
134 import pdb;pdb.set_trace()
135 -> source_repo_format.check_conversion_target(target_repo_format)
136
137 @staticmethod
138 def _check_supported(format, allow_unsupported,
139 recommend_upgrade=True,
140 basedir=None):
(Pdb) p source_repo_format
<bzrlib.repofmt.groupcompress_repo.RepositoryFormat2a object at 0xa2a212c>
(Pdb) p self
<bzrlib.bzrdir.BzrDirMeta1 object at 0xb798ca0c>
(Pdb) p self._format
<bzrlib.bzrdir.BzrDirMetaFormat1 object at 0xa257d6c>
(Pdb) p self._format.repository_format
<bzrlib.repofmt.groupcompress_repo.RepositoryFormat2a object at 0xa350bec>
(Pdb) p self.open_repository()
WeaveMetaDirRepository('file:///tmp/meta/.bzr/repository/')
(Pdb) p self.open_repository()._format
<bzrlib.repofmt.weaverepo.RepositoryFormat7 object at 0xa350ecc>

I suspect that line 133 should be asking what format is actually there - or indeed perhaps this whole thing should be delegated to the source repository object.

There are several check_conversion_target methods on random RepositoryFormats and I suspect they shouldn't be overriding to remove the checks.