'HgRepository' object has no attribute '_fallback_repositories'

Bug #310310 reported by Roger Light
2
Affects Status Importance Assigned to Milestone
Bazaar Hg Plugin
Fix Released
High
Jelmer Vernooij

Bug Description

I've been trying to use bzr-hg with bzr 1.10 and python 2.4.4. I've tried with hg 0.94 and 1.1.1 with the same results. I did:

$ bzr init
$ bzr pull /home/oojah/hgroot/ralcalc

It crashes like this:

bzr: ERROR: exceptions.AttributeError: 'HgRepository' object has no attribute '_fallback_repositories'

Traceback (most recent call last):
  File "/home/oojah/local/lib/python/bzrlib/commands.py", line 893, in run_bzr_catch_errors
    return run_bzr(argv)
  File "/home/oojah/local/lib/python/bzrlib/commands.py", line 839, in run_bzr
    ret = run(*run_argv)
  File "/home/oojah/local/lib/python/bzrlib/commands.py", line 539, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/home/oojah/local/lib/python/bzrlib/builtins.py", line 790, in run
    possible_transports=possible_transports)
  File "/home/oojah/local/lib/python/bzrlib/decorators.py", line 192, in write_locked
    result = unbound(self, *args, **kwargs)
  File "/home/oojah/local/lib/python/bzrlib/workingtree.py", line 1537, in pull
    possible_transports=possible_transports)
  File "/home/oojah/local/lib/python/bzrlib/decorators.py", line 192, in write_locked
    result = unbound(self, *args, **kwargs)
  File "/home/oojah/local/lib/python/bzrlib/branch.py", line 1957, in pull
    _override_hook_target=_override_hook_target)
  File "/home/oojah/local/lib/python/bzrlib/decorators.py", line 192, in write_locked
    result = unbound(self, *args, **kwargs)
  File "/home/oojah/local/lib/python/bzrlib/branch.py", line 1757, in pull
    graph=graph)
  File "/home/oojah/local/lib/python/bzrlib/decorators.py", line 192, in write_locked
    result = unbound(self, *args, **kwargs)
  File "/home/oojah/local/lib/python/bzrlib/branch.py", line 524, in update_revisions
    self.fetch(other, stop_revision)
  File "/home/oojah/local/lib/python/bzrlib/decorators.py", line 192, in write_locked
    result = unbound(self, *args, **kwargs)
  File "/home/oojah/local/lib/python/bzrlib/branch.py", line 286, in fetch
    pb=nested_pb)
  File "/home/oojah/local/lib/python/bzrlib/repository.py", line 1021, in fetch
    find_ghosts=find_ghosts)
  File "/home/oojah/local/lib/python/bzrlib/decorators.py", line 190, in write_locked
    self.lock_write()
  File "/home/oojah/local/lib/python/bzrlib/inter.py", line 100, in lock_write
    self._double_lock(self.source.lock_read, self.target.lock_write)
  File "/home/oojah/local/lib/python/bzrlib/inter.py", line 61, in _double_lock
    lock_source()
  File "/home/oojah/local/lib/python/bzrlib/repository.py", line 812, in lock_read
    for repo in self._fallback_repositories:
AttributeError: 'HgRepository' object has no attribute '_fallback_repositories'

bzr 1.10 on python 2.4.4 (linux2)
arguments: ['/home/oojah/local/bin/bzr', 'pull', '/home/oojah/hgroot/ralcalc']
encoding: 'ISO-8859-1', fsenc: 'ISO-8859-1', lang: 'en_US'
plugins:
  hg /home/oojah/local/lib/python/bzrlib/plugins/hg [unknown]
  launchpad /home/oojah/local/lib/python/bzrlib/plugins/launchpad [unknown]
*** Bazaar has encountered an internal error.
    Please report a bug at https://bugs.launchpad.net/bzr/+filebug
    including this traceback, and a description of what you
    were doing when the error occurred.

Related branches

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

Thanks for the report; I think this is failing because bzr-hg is out of date with bzr.dev.

_fallback_repositories is defined in Repository.__init__ and so should be expected to be provided by subclasses. Possibly it should be in the ForeignRepository base and bzr-hg should use that.

To work around this problem you can: add this line

 _fallback_repositories = []

into the Repository subclass in bzr-hg.

Changed in bzr-hg:
importance: Undecided → High
status: New → Confirmed
Revision history for this message
Roger Light (roger.light) wrote :

That helps, thanks. I modified the code like the below:

=== modified file '__init__.py'
--- __init__.py 2007-11-12 17:08:29 +0000
+++ __init__.py 2008-12-22 08:43:14 +0000
@@ -133,6 +133,7 @@
         self.control_files = lockfiles
         self._format = HgRepositoryFormat()
         self.base = hgdir.root_transport.base
+ self._fallback_repositories = []

     def _check(self, revision_ids):
         # TODO: Call out to mercurial for consistency checking?

...and was then hit by bug #189182. After fixing that I get another error which I can post here (or in another bug) if you'd like, but I'd like to try it with an earlier version of mercurial first.

Jelmer Vernooij (jelmer)
Changed in bzr-hg:
status: Confirmed → Fix Committed
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

This particular fix is now in trunk.

Changed in bzr-hg:
status: Fix Committed → Fix Released
Jelmer Vernooij (jelmer)
Changed in bzr-hg:
assignee: nobody → Jelmer Vernooij (jelmer)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.