qbrowse show log crashes: AttributeError: 'BzrBranch7' object has no attribute 'startswith'

Bug #647204 reported by Simon Kersey
36
This bug affects 5 people
Affects Status Importance Assigned to Milestone
QBzr
Fix Released
High
Gary van der Merwe

Bug Description

The following exception was raised when using qbrowse show log. The error is only shown the first time that show log is selected after qbrowse is started.

bzr: ERROR: exceptions.AttributeError: 'BzrBranch7' object has no attribute 'startswith'

Traceback (most recent call last):
  File "C:/Program Files/Bazaar/plugins\qbzr\lib\trace.py", line 300, in reports_exception_decorate
  File "C:/Program Files/Bazaar/plugins\qbzr\lib\log.py", line 223, in load
  File "C:/Program Files/Bazaar/plugins\qbzr\lib\log.py", line 390, in _locations_for_title
  File "bzrlib\directory_service.pyo", line 54, in dereference
  File "bzrlib\registry.pyo", line 183, in get_prefix
AttributeError: 'BzrBranch7' object has no attribute 'startswith'

bzr 2.1.0 on python 2.5.4 (win32)
arguments: ['bzr', 'qbrowse']
encoding: 'cp1252', fsenc: 'mbcs', lang: None
plugins:
  bzrtools C:\Program Files\Bazaar\plugins\bzrtools [2.1.0]
  explorer C:\Program Files\Bazaar\plugins\explorer [1.1.0dev2]
  launchpad C:\Program Files\Bazaar\plugins\launchpad [2.1.0]
  netrc_credential_store C:\Program Files\Bazaar\plugins\netrc_credential_store [2.1.0]
  news_merge C:\Program Files\Bazaar\plugins\news_merge [2.1.0]
  qbzr C:\Program Files\Bazaar\plugins\qbzr [0.20.0dev1]
  rebase C:\Program Files\Bazaar\plugins\rebase [0.5.5]
  upload C:\Program Files\Bazaar\plugins\upload [1.0.0dev]
  xmloutput C:\Program Files\Bazaar\plugins\xmloutput [0.8.6]

Related branches

Revision history for this message
Alexander Belchenko (bialix) wrote : Re: [Bug 647204] [NEW] qbrowse show log crashes

Simon Kersey пишет:
> bzr 2.1.0 on python 2.5.4 (win32)

> qbzr C:\Program Files\Bazaar\plugins\qbzr [0.20.0dev1]

I'm pretty sure that qbzr 0.20 is targeting bzr 2.3, not bzr 2.1. The
companion release for bzr 2.1 is qbzr 0.18.x.

Can you test the same procedure with qbzr 0.18.latest and 0.19.2, please?

Revision history for this message
Simon Kersey (simon-kersey) wrote : Re: qbrowse show log crashes

Results for 0.18.latest:
No window shown and following error shown in command window

C:\bazaar\bazaar_plugin_dev\qbzr\0.18>bzr qbrowse
bzr: ERROR: exceptions.ImportError: cannot import name InfoWidget

Traceback (most recent call last):
  File "C:/Program Files/Bazaar/plugins\qbzr\lib\commands.py", line 166, in run
  File "C:/Program Files/Bazaar/plugins\qbzr\lib\commands.py", line 334, in _qbz
r_run
  File "bzrlib\lazy_import.pyo", line 122, in __call__
  File "bzrlib\lazy_import.pyo", line 89, in _replace
  File "bzrlib\lazy_import.pyo", line 192, in _import
  File "C:/Program Files/Bazaar/plugins\qbzr\lib\browse.py", line 41, in <module
>
  File "C:/Program Files/Bazaar/plugins\qbzr\lib\diff.py", line 24, in <module>
  File "C:/Program Files/Bazaar/plugins\qbzr\lib\subprocess.py", line 30, in <mo
dule>
ImportError: cannot import name InfoWidget

bzr 2.1.0 on python 2.5.4 (Windows-Vista-6.1.7600)
arguments: ['bzr', 'qbrowse']
encoding: 'cp1252', fsenc: 'mbcs', lang: None
plugins:
  bzrtools C:\Program Files\Bazaar\plugins\bzrtools [2.1.0]
  explorer C:\Program Files\Bazaar\plugins\explorer [1.1.0dev2]
  launchpad C:\Program Files\Bazaar\plugins\launchpad [2.1.0]
  netrc_credential_store C:\Program Files\Bazaar\plugins\netrc_credential_store
[2.1.0]
  news_merge C:\Program Files\Bazaar\plugins\news_merge [2.1.0]
  qbzr C:\Program Files\Bazaar\plugins\qbzr [0.18.8dev]
  rebase C:\Program Files\Bazaar\plugins\rebase [0.5.5]
  upload C:\Program Files\Bazaar\plugins\upload [1.0.0dev]
  xmloutput C:\Program Files\Bazaar\plugins\xmloutput [0.8.6]

*** Bazaar has encountered an internal error. This probably indicates a
    bug in Bazaar. You can help us fix it by filing a bug report at
        https://bugs.launchpad.net/bzr/+filebug
    including this traceback and a description of the problem.

Revision history for this message
Simon Kersey (simon-kersey) wrote :

Results of test with 0.19.2:

QBrowse window is shown but when you select "show log" the following error is displayed:

bzr: ERROR: exceptions.AttributeError: 'BzrBranch7' object has no attribute 'startswith'

Traceback (most recent call last):
  File "C:/Program Files/Bazaar/plugins\qbzr\lib\trace.py", line 300, in reports_exception_decorate
  File "C:/Program Files/Bazaar/plugins\qbzr\lib\log.py", line 223, in load
  File "C:/Program Files/Bazaar/plugins\qbzr\lib\log.py", line 390, in _locations_for_title
  File "bzrlib\directory_service.pyo", line 54, in dereference
  File "bzrlib\registry.pyo", line 183, in get_prefix
AttributeError: 'BzrBranch7' object has no attribute 'startswith'

bzr 2.1.0 on python 2.5.4 (win32)
arguments: ['bzr', 'qbrowse']
encoding: 'cp1252', fsenc: 'mbcs', lang: None
plugins:
  bzrtools C:\Program Files\Bazaar\plugins\bzrtools [2.1.0]
  explorer C:\Program Files\Bazaar\plugins\explorer [1.1.0dev2]
  launchpad C:\Program Files\Bazaar\plugins\launchpad [2.1.0]
  netrc_credential_store C:\Program Files\Bazaar\plugins\netrc_credential_store [2.1.0]
  news_merge C:\Program Files\Bazaar\plugins\news_merge [2.1.0]
  qbzr C:\Program Files\Bazaar\plugins\qbzr [0.19.2]
  rebase C:\Program Files\Bazaar\plugins\rebase [0.5.5]
  upload C:\Program Files\Bazaar\plugins\upload [1.0.0dev]
  xmloutput C:\Program Files\Bazaar\plugins\xmloutput [0.8.6]

If you close the error window then reselect "Show Log" the log window is displayed correctly.

Revision history for this message
Alexander Belchenko (bialix) wrote : Re: [Bug 647204] Re: qbrowse show log crashes

Thank you for testing.

Revision history for this message
Simon Kersey (simon-kersey) wrote : Re: qbrowse show log crashes

Did a quick bit of looking at 0.19.2:
First time through (line 388) isinstance(locations[0], Branch) is false, second time it is true. However both times through locations[0].__class__ = <class 'bzrlib.branch.BzrBranch7'>.

Not sure how to fix this.

Have put in try catch and just attempted to assign locations[0].base to location and then in except just done original code. This works but seems unsatisfactory.

Changed in qbzr:
status: New → Confirmed
importance: Undecided → High
summary: - qbrowse show log crashes
+ qbrowse show log crashes: AttributeError: 'BzrBranch7' object has no
+ attribute 'startswith'
Revision history for this message
Gary van der Merwe (garyvdm) wrote :

I'm not able to reproduce this :-(

Using Simon's diagnosis, I've made a patch: lp:~garyvdm/qbzr/bug647204 . If you are able to reproduce this, please test my patch.

Revision history for this message
Gary van der Merwe (garyvdm) wrote :

From irclog:
<SimonK>
 I tried to reproduce bug #647204 and also couldn't. People at work who were experiencing the problem have found that it has 'gone away'. The only thing that changed was that a number of Windows updates were applied.

Note to self: I would like to figgure out what revision fixed this, so I know how it was fixed.

Revision history for this message
Gary van der Merwe (garyvdm) wrote :

Hmm - this could have been fixed in bzr/lazyimport. Need to check bzr NEWS .

Revision history for this message
Gary van der Merwe (garyvdm) wrote :

I've merged the fix for this even though I still have no managed to reproduce this.

Changed in qbzr:
assignee: nobody → Gary van der Merwe (garyvdm)
milestone: none → 0.20b1
status: Confirmed → Fix Released
Revision history for this message
Joel J. Adamson (adamsonj) wrote :

Fedora 14 with

Bazaar (bzr) 2.2.1
  Python interpreter: /usr/bin/python 2.7.0
  Python standard library: /usr/lib64/python2.7
  Platform: Linux-2.6.35.10-74.fc14.x86_64-x86_64-with-fedora-14-Laughlin
  bzrlib: /usr/lib64/python2.7/site-packages/bzrlib
  Bazaar configuration: /home/joel/.bazaar
  Bazaar log file: /home/joel/.bzr.log

bzr: ERROR: exceptions.AttributeError: 'BzrBranch7' object has no attribute 'startswith'

Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/bzrlib/plugins/qbzr/lib/trace.py", line 300, in reports_exception_decorate
    return f(*args, **kargs)
  File "/usr/lib/python2.7/site-packages/bzrlib/plugins/qbzr/lib/log.py", line 223, in load
    lt = self._locations_for_title(self.locations)
  File "/usr/lib/python2.7/site-packages/bzrlib/plugins/qbzr/lib/log.py", line 390, in _locations_for_title
    return (url_for_display(directories.dereference(location)))
  File "/usr/lib64/python2.7/site-packages/bzrlib/directory_service.py", line 54, in dereference
    match = self.get_prefix(url)
  File "/usr/lib64/python2.7/site-packages/bzrlib/registry.py", line 183, in get_prefix
    if fullname.startswith(key):
AttributeError: 'BzrBranch7' object has no attribute 'startswith'

bzr 2.2.1 on python 2.7.0 (linux2)
arguments: ['/usr/bin/bzr', 'explorer']
encoding: 'UTF-8', fsenc: 'UTF-8', lang: 'en_US.utf8'
plugins:
  bash_completion /usr/lib64/python2.7/site-packages/bzrlib/plugins/bash_completion [2.2.1]
  explorer /usr/lib/python2.7/site-packages/bzrlib/plugins/explorer [1.1.2]
  launchpad /usr/lib64/python2.7/site-packages/bzrlib/plugins/launchpad [2.2.1]
  netrc_credential_store /usr/lib64/python2.7/site-packages/bzrlib/plugins/netrc_credential_store [2.2.1]
  news_merge /usr/lib64/python2.7/site-packages/bzrlib/plugins/news_merge [2.2.1]
  qbzr /usr/lib/python2.7/site-packages/bzrlib/plugins/qbzr [0.19.3]

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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