[MERGE][0.8] break-lock command

John Arbash Meinel john at arbash-meinel.com
Thu May 4 15:33:29 BST 2006


Robert Collins wrote:
> This is also available at http://bazaar-vcs.org/bzr/break-lock.
> 
> diffstat follows: note the strange presence of 'b' in just the new
> files. I think think diff prefix patch is buggy :p.
> 

Well diffstat seems a little buggy. But the rest of the files all have
an a/NEWS, b/NEWS.
I think the reason might be that you are comparing /dev/null to
b/bzrlib/tests/...

And diffstat doesn't see an obvious prefix for /dev/null (but we
certainly shouldn't be writing it a/dev/null)

> 
>  NEWS                                                          |    6 
>  b/bzrlib/tests/branch_implementations/test_break_lock.py      |   95 +++++++++
>  b/bzrlib/tests/repository_implementations/test_break_lock.py  |   61 ++++++
>  b/bzrlib/tests/workingtree_implementations/test_break_lock.py |   72 +++++++
>  bzrlib/branch.py                                              |   20 +-
>  bzrlib/builtins.py                                            |   22 +-
>  bzrlib/bzrdir.py                                              |   22 ++
>  bzrlib/lockable_files.py                                      |   16 +
>  bzrlib/lockdir.py                                             |   27 ++
>  bzrlib/repository.py                                          |    8 
>  bzrlib/tests/__init__.py                                      |   17 +
>  bzrlib/tests/blackbox/test_break_lock.py                |   70 ++++++-
>  bzrlib/tests/blackbox/test_selftest.py                     |   34 +++
>  bzrlib/tests/branch_implementations/__init__.py               |    1 
>  bzrlib/tests/bzrdir_implementations/test_bzrdir.py    |   98 ++++++++++
>  bzrlib/tests/repository_implementations/__init__.py           |    1 
>  bzrlib/tests/test_lockable_files.py                        |   50 +++--
>  bzrlib/tests/test_lockdir.py                              |   31 +++
>  bzrlib/tests/test_ui.py                                    |   53 +++++
>  bzrlib/tests/workingtree_implementations/__init__.py          |    1 
>  bzrlib/ui/__init__.py                                      |   34 +++
>  bzrlib/ui/text.py                                          |    9 
>  bzrlib/workingtree.py                                       |   18 +
>  23 files changed, 718 insertions(+), 48 deletions(-)
> 
> 
> Cheers,
> Rob
> 
> 

...

>      def can_convert_format(self):
>          """Return true if this bzrdir is one whose format we can convert from."""
> @@ -581,6 +599,10 @@
>                                              self._format._lock_file_name,
>                                              self._format._lock_class)
>  
> +    def break_lock(self):
> +        """Pre-splitout bzrdirs do not suffer from stale locks."""
> +        raise NotImplementedError(self.break_lock)
> +

Not true, they can get stale locks from an sftp lock. Local branches
can't get stale (because they are an OS lock).

I'm not sure if you want to support break_lock() for sftp-style locking.
But you should at least make a comment about it.

...

> +    def assert_get_bool_acceptance_of_user_input(self, factory):
> +        factory.stdin = StringIO("y\nyes with garbage\nyes\nn\nnot an answer\nno\nfoo\n")
> +        factory.stdout = StringIO()
> +        # there is no output from the base factory
> +        self.assertEqual(True, factory.get_boolean(""))
> +        self.assertEqual(True, factory.get_boolean(""))
> +        self.assertEqual(False, factory.get_boolean(""))
> +        self.assertEqual(False, factory.get_boolean(""))
> +        self.assertEqual("foo\n", factory.stdin.read())

What about just a plain empty string? Should we support
get_boolean(prompt, default=None)?

This would also help since SilentUIFactory shouldn't be prompting the
user. And thus the defaults could be used.

> +
> +    def test_silent_ui_getbool(self):
> +        factory = bzrlib.ui.SilentUIFactory()
> +        self.assert_get_bool_acceptance_of_user_input(factory)

...

Otherwise this looks pretty good.

John
=:->

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060504/dbc7eb8e/attachment.pgp 


More information about the bazaar mailing list