Merge lp:~mbp/bzr/733136-lock_url into lp:bzr

Proposed by Martin Pool
Status: Superseded
Proposed branch: lp:~mbp/bzr/733136-lock_url
Merge into: lp:bzr
Diff against target: 50 lines (+14/-7) (has conflicts)
2 files modified
bzrlib/lockdir.py (+7/-7)
doc/en/release-notes/bzr-2.4.txt (+7/-0)
Text conflict in doc/en/release-notes/bzr-2.4.txt
To merge this branch: bzr merge lp:~mbp/bzr/733136-lock_url
Reviewer Review Type Date Requested Status
John A Meinel Approve
Review via email: mp+55682@code.launchpad.net

This proposal has been superseded by a proposal from 2011-03-31.

Description of the change

This fixes bug 733136 by just moving the variable declaration to a place it will definitely be seen.

To post a comment you must log in.
Revision history for this message
Martin Pool (mbp) wrote :

The fix isn't especially shallow, but I am for not writing a test for it. If people feel I should, I can.

Revision history for this message
John A Meinel (jameinel) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 3/31/2011 7:42 AM, Martin Pool wrote:
> Martin Pool has proposed merging lp:~mbp/bzr/733136-lock_url into lp:bzr.
>
> Requested reviews:
> bzr-core (bzr-core)
> Related bugs:
> Bug #733136 in Bazaar: "UnboundLocalError: local variable 'lock_url' in wait_lock"
> https://bugs.launchpad.net/bzr/+bug/733136
>
> For more details, see:
> https://code.launchpad.net/~mbp/bzr/733136-lock_url/+merge/55682
>
> This does a kind of shallow fix for bug 733136 by just moving the variable declaration to a place it will definitely be seen.

What if we pull this out into a helper function, so we don't clutter the
function itself?

Note that if this is getting triggered, there is another bug. Which is
that QBzr is being unable to get write-access to the config when it
wants to set its values. So it sounds like a lock-race or lock
confusion. (bzr is locking and qbzr is locking on top of it.)

Anyway, the fix seems fine, just cleaner in a helper. Would you want to
target 2.3 instead?

John
=:->

 merge: approve
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk2UKn8ACgkQJdeBCYSNAAPlDQCgq+DWQ/GdJ3d/pykjYOPrCbQ+
9wkAoK68su5hgMw2Xg8iE7OVCuzOOjsv
=OyWm
-----END PGP SIGNATURE-----

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bzrlib/lockdir.py'
2--- bzrlib/lockdir.py 2011-01-12 20:31:15 +0000
3+++ bzrlib/lockdir.py 2011-03-31 05:42:30 +0000
4@@ -566,6 +566,13 @@
5 deadline_str = None
6 last_info = None
7 attempt_count = 0
8+ # As local lock urls are correct we display them.
9+ # We avoid displaying remote lock urls.
10+ lock_url = self.transport.abspath(self.path)
11+ if lock_url.startswith('file://'):
12+ lock_url = lock_url.split('.bzr/')[0]
13+ else:
14+ lock_url = ''
15 while True:
16 attempt_count += 1
17 try:
18@@ -590,13 +597,6 @@
19 if deadline_str is None:
20 deadline_str = time.strftime('%H:%M:%S',
21 time.localtime(deadline))
22- # As local lock urls are correct we display them.
23- # We avoid displaying remote lock urls.
24- lock_url = self.transport.abspath(self.path)
25- if lock_url.startswith('file://'):
26- lock_url = lock_url.split('.bzr/')[0]
27- else:
28- lock_url = ''
29 user, hostname, pid, time_ago = formatted_info
30 msg = ('%s lock %s ' # lock_url
31 'held by ' # start
32
33=== modified file 'doc/en/release-notes/bzr-2.4.txt'
34--- doc/en/release-notes/bzr-2.4.txt 2011-03-30 10:54:24 +0000
35+++ doc/en/release-notes/bzr-2.4.txt 2011-03-31 05:42:30 +0000
36@@ -42,8 +42,15 @@
37 .. Fixes for situations where bzr would previously crash or give incorrect
38 or undesirable results.
39
40+<<<<<<< TREE
41 * Lazy hooks are now reset between test runs. (Jelmer Vernooij, #745566)
42
43+=======
44+* Fix ``UnboundLocalError: local variable 'lock_url' in wait_lock`` error,
45+ especially while trying to save configuration from QBzr.
46+ (Martin Pool, #733136)
47+
48+>>>>>>> MERGE-SOURCE
49 Documentation
50 *************
51