convert having problems with bazaar repository of Emacs?

Giorgos Keramidas keramida at ceid.upatras.gr
Sat Mar 31 16:06:10 CDT 2012


On Sat, 31 Mar 2012 13:25:55 -0500, Matt Mackall <mpm at selenic.com> wrote:
>On Sat, 2012-03-31 at 20:18 +0200, Giorgos Keramidas wrote:
>> Hi all,
>>
>> Is anyone else having problems with Bazaar repositories and recent
>> crew repository builds?
>>
>> I'm trying to convert a bzr repository of the Emacs trunk, which used
>> to work with previous versions and failing:
>>
>> % /home/gkeramidas/bzr/emacs/trunk does not look like a Bazaar repository
>
> Here's the relevant code:
>
> http://www.selenic.com/hg/file/b95b006e18cc/hgext/convert/bzr.py#l51
>
> If you see this message, the bzr library is returning a
> NoRepositoryPresent error. Which probably means they broke their
> library by changing their repository format again.

After a bit of testing, I can see that changeset f84dda152a55 in crew
changed the access method of the path passed to it from bzrlib.branch to
bzrlib.bzrdir.

It looks like I have to pass the parent directory for this to succeed:

% gkeramidas at kobe:/hg/mercurial/crew$ python
% Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41)
% [GCC 4.4.3] on linux2
% Type "help", "copyright", "credits" or "license" for more information.
% >>> from bzrlib import bzrdir
% >>> repo = bzrdir.BzrDir.open("/home/gkeramidas/bzr/emacs/trunk")
% >>> repo.open_repository()
% Traceback (most recent call last):
%   File "<stdin>", line 1, in <module>
%   File "/usr/lib/python2.6/dist-packages/bzrlib/bzrdir.py", line 1751, in open_repository
%     format = RepositoryFormat.find_format(self)
%   File "/usr/lib/python2.6/dist-packages/bzrlib/repository.py", line 3112, in find_format
%     raise errors.NoRepositoryPresent(a_bzrdir)
% bzrlib.errors.NoRepositoryPresent: No repository present: "file:///home/gkeramidas/bzr/emacs/trunk/"
% >>> repo = bzrdir.BzrDir.open("/home/gkeramidas/bzr/emacs")
% >>> repo.open_repository()
% CHKInventoryRepository('file:///home/gkeramidas/bzr/emacs/.bzr/repository/')

I'll try converting from the parent of emacs/trunk/.bzr/ and see if this
works better.  It looks like we should be able to convert only a single
branch directory too though, so I'll also experiment with something like
this change:

gkeramidas at kobe:/hg/mercurial/crew$ hg diff . | cdiff
diff -r f84dda152a55 hgext/convert/bzr.py
--- a/hgext/convert/bzr.py       Thu Feb 02 10:15:12 2012 +0100
+++ b/hgext/convert/bzr.py       Sat Mar 31 23:05:39 2012 +0200
@@ -23,7 +23,7 @@ from common import NoRepo, commit, conve
 
 try:
     # bazaar imports
-    from bzrlib import bzrdir, revision, errors
+    from bzrlib import branch, bzrdir, revision, errors
     from bzrlib.revisionspec import RevisionSpec
 except ImportError:
     pass
@@ -48,9 +48,18 @@ class bzr_source(converter_source):
 
         path = os.path.abspath(path)
         self._checkrepotype(path)
+        self.sourcerepo = None
         try:
             self.sourcerepo = bzrdir.BzrDir.open(path).open_repository()
         except errors.NoRepositoryPresent:
+            self.sourcerepo = None
+        if self.sourcerepo is None:
+            try:
+                branch = branch.Branch.open(path)
+                self.sourcerepo = self.branch.repository
+            except errors.NoRepositoryPresent:
+                self.sourcerepo = None
+        if self.sourcerepo is None:
             raise NoRepo(_('%s does not look like a Bazaar repository')
                          % path)
         self._parentids = {}
gkeramidas at kobe:/hg/mercurial/crew$ 


More information about the Mercurial-devel mailing list