Merge lp:~parthm/bzr/250451-better-url-for-break-lock into lp:bzr
Status: | Merged |
---|---|
Approved by: | Parth Malwankar |
Approved revision: | no longer in the source branch. |
Merged at revision: | 5303 |
Proposed branch: | lp:~parthm/bzr/250451-better-url-for-break-lock |
Merge into: | lp:bzr |
Diff against target: |
214 lines (+66/-52) 5 files modified
NEWS (+5/-0) bzrlib/errors.py (+0/-2) bzrlib/lockdir.py (+32/-24) bzrlib/remote.py (+10/-3) bzrlib/tests/test_lockdir.py (+19/-23) |
To merge this branch: | bzr merge lp:~parthm/bzr/250451-better-url-for-break-lock |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Vincent Ladeuil | Needs Fixing | ||
Martin Packman (community) | Needs Fixing | ||
Review via email: mp+27187@code.launchpad.net |
Commit message
Lock URL shown in case of failure to acquire lock (for smart server access) is now valid. Default timeout for lock contention is now 30s.
Description of the change
=== Fixes Bug #250451 ===
This patch gives a more accurate url in case where bzr fails to obtain lock from smart server.
In the current implementation, the server passes details such as lock_url (inaccurate), user, time_ago, pid to client. These are displayed in bzrlib.
This patch, avoids displaying the inaccurate lock_url in the wait_lock. If the wait_fails, bzr raises a LockContention error in bzrlib.
Does this approach look reasonable? Any other areas of code that I should check? I would appreciate any pointers on what would be a good place to put tests for this.
One thing remaining would be to handle ^C in bzrlib.
Running the test locally, following is the interaction:
=======
[foo]% bzr push bzr+ssh:
Unable to obtain lock held by Parth Malwankar <email address hidden> at parthm-laptop [process #9606], acquired 7 hours, 52 minutes ago.
Will continue to try until 22:40:59, unless you press Ctrl-C.
See "bzr help break-lock" for more.
bzr: ERROR: Could not acquire lock "(remote lock)": bzr+ssh:
[foo]%
Interacting with launchpad (which is running the un-patched server):
=======
[trunk]% bzr push lp:~parthm/+junk/lock-test
Unable to obtain lock lp-69989648:
held by <email address hidden> on host crowberry [process #26780]
locked 12 hours, 3 minutes ago
Will continue to try until 18:03:34, unless you press Ctrl-C.
See "bzr help break-lock" for more.
bzr: ERROR: Could not acquire lock "(remote lock)": bzr+ssh:
[trunk]%
Current interaction (without patch)
=======
[trunk]% bzr push lp:~parthm/+junk/lock-test
Unable to obtain lock lp-69989648:
held by <email address hidden> on host crowberry [process #26780]
locked 12 hours, 2 minutes ago
Will continue to try until 18:03:15, unless you press Ctrl-C.
See "bzr help break-lock" for more.
bzr: ERROR: Could not acquire lock "(remote lock)":
+ e.msg = self.repository .base.rstrip( '.bzr/' )
That doesn't do what you want it too. Use `.split(".bzr")[0]` instead.
Would also prefer a less hacky change to the LockContention instance, there's a todo note on the class related to this.