[merge][ping] Wait on locks

Robert Collins robertc at robertcollins.net
Mon Sep 25 22:23:37 BST 2006


On Mon, 2006-09-25 at 15:52 -0500, John Arbash Meinel wrote:
> The attached patch changes bzr so that when attempting to get a
> write-lock it will wait up to 1 hour, and give better information to the
> user about what is going on.
> 
> It seems to have gotten favorable reviews from users, but I haven't
> heard anything from Robert, Martin or Aaron.
> 
> This is a fix for both bugs #43521 and #49556. The branch is available from:
> http://bzr.arbash-meinel.com/branches/bzr/0.11-working/wait-on-lock
> 
> The initial work has been sitting around since 10/14 (almost 2 weeks
> now), so I'd like to put it to rest.

I think having a longer default is good but maybe 1 hour is excessive? 

I really dont like the idiom that seems to be turning up of:

+    def test_format_delta(self):
+        t = time.time()
+
+        def check(expected, delta):
+            actual = osutils.format_delta(delta)
+            self.assertEqual(expected, actual)
+
+        check('0 seconds ago', 0)
+        check('1 second ago', 1)
+        check('10 seconds ago', 10)
+        check('59 seconds ago', 59)

'check' in the body is really uninformative. Something like 
self.assertIntervalFormatting('0 seconds ago', 0)

would be much clearer.

if you want to avoid a new method how about

intervals = [('0 seconds ago', 0), (...)]

for expected, interval in intervals:
    actual = osutils.format_delta(interval)
    self.assertEqual(expected, actual, 
        "Interval %s failed to format as %s, got %s" 
        % (interval, expected, actual))


-Rob

-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060926/2f7d529a/attachment.pgp 


More information about the bazaar mailing list